56static char *option[N_OPTIONS] = {
67static char *dim_option[DIM_OPTIONS] = {
74 "Usage: sddsarray2column [<source-file>] [<target-file>]\n"
75 " [-pipe=[input][,output]]\n"
77 " [-convert=<array-name>[,<column-name>][,d<dimension>=<indexValue>]...]\n\n"
78 "sddsarray2column converts SDDS arrays to SDDS columns.\n"
79 "The number of elements in the converted arrays must equal\n"
80 "the number of rows if there are columns in the file and\n"
81 "the number of elements in other converted arrays.\n\n"
83 " sddsarray2column in out -convert=A,A_out\n"
84 " sddsarray2column in out -convert=A,A_out,d0=0\n"
85 " sddsarray2column in out \"-convert=A,A_out,d2=(1,3)\"\n\n"
86 "Program by Robert Soliday. (Compiled on " __DATE__
" at " __TIME__
", SVN revision: " SVN_VERSION
")\n";
98int main(
int argc,
char **argv) {
102 long i, i_arg, j, found, k, m, n;
104 char *input = NULL, *output = NULL, *ptr = NULL, *buffer = NULL;
105 char *description_text = NULL, *description_contents = NULL;
106 unsigned long pipeFlags = 0;
107 long noWarnings = 0, tmpfile_used = 1;
108 long virtual_rows, max_size, pageNumber, vrows;
111 char **orig_column_name = NULL, **orig_parameter_name = NULL, **orig_array_name = NULL;
112 int32_t orig_column_names = 0, orig_parameter_names = 0, orig_array_names = 0;
113 char **new_array_name = NULL;
114 long new_array_names = 0;
116 long converted_array_names = 0;
119 argc =
scanargs(&s_arg, argc, argv);
124 for (i_arg = 1; i_arg < argc; i_arg++) {
125 if (s_arg[i_arg].arg_type == OPTION) {
127 switch (
match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
129 if (s_arg[i_arg].n_items < 2) {
132 ca =
trealloc(ca,
sizeof(*ca) * (converted_array_names + 1));
134 ca[converted_array_names].name = s_arg[i_arg].list[1];
136 if ((s_arg[i_arg].n_items > 2) && (strchr(s_arg[i_arg].list[2],
'=') == NULL)) {
137 ca[converted_array_names].new_name = s_arg[i_arg].list[2];
140 ca[converted_array_names].new_name = s_arg[i_arg].list[1];
144 ca[converted_array_names].d[0] = NULL;
145 ca[converted_array_names].d[1] = NULL;
146 ca[converted_array_names].d[2] = NULL;
147 while (i < s_arg[i_arg].n_items) {
148 if (!(ptr = strchr(s_arg[i_arg].list[i],
'='))) {
152 switch (
match_string(s_arg[i_arg].list[i], dim_option, DIM_OPTIONS, 0)) {
154 ca[converted_array_names].d[0] = ptr;
157 ca[converted_array_names].d[1] = ptr;
160 ca[converted_array_names].d[2] = ptr;
167 converted_array_names++;
171 if (s_arg[i_arg].n_items != 1) {
178 if (!
processPipeOption(s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1, &pipeFlags)) {
185 input = s_arg[i_arg].list[0];
186 }
else if (output == NULL) {
187 output = s_arg[i_arg].list[0];
194 processFilenames(
"sddsarray2column", &input, &output, pipeFlags, noWarnings, &tmpfile_used);
201 if (!description_text) {
205 if (!
SDDS_InitializeOutput(&SDDS_dataset, SDDS_orig.layout.data_mode.mode, 1, description_text, description_contents, output)) {
214 if (!orig_parameter_name) {
220 if (!orig_column_name) {
226 if (!orig_array_name) {
232 for (j = 0; j < converted_array_names; j++) {
233 for (i = 0; i < orig_column_names; i++) {
234 if (strcmp(orig_column_name[i], ca[j].new_name) == 0) {
235 fprintf(stderr,
"Error: Column '%s' already exists.\n", orig_column_name[i]);
239 for (i = 0; i < converted_array_names; i++) {
240 if ((i != j) && (strcmp(ca[i].new_name, ca[j].new_name) == 0)) {
241 fprintf(stderr,
"Error: Cannot convert two arrays to the same column name '%s'.\n", ca[j].new_name);
246 for (i = 0; i < orig_array_names; i++) {
247 if (strcmp(orig_array_name[i], ca[j].name) == 0) {
253 fprintf(stderr,
"Error: Array '%s' does not exist.\n", ca[j].name);
259 for (i = 0; i < orig_array_names; i++) {
261 for (j = 0; j < converted_array_names; j++) {
262 if (strcmp(orig_array_name[i], ca[j].name) == 0) {
268 new_array_name =
trealloc(new_array_name,
sizeof(*new_array_name) * (new_array_names + 1));
269 new_array_name[new_array_names] = orig_array_name[i];
275 for (i = 0; i < orig_parameter_names; i++) {
282 for (i = 0; i < orig_column_names; i++) {
289 for (i = 0; i < new_array_names; i++) {
291 fprintf(stderr,
"Unable to transfer array '%s' to '%s'.\n", new_array_name[i], new_array_name[i]);
297 for (i = 0; i < converted_array_names; i++) {
300 fprintf(stderr,
"Error: Unknown array named '%s'.\n", ca[i].name);
303 ca[i].type = ardef->type;
304 if (
SDDS_DefineColumn(&SDDS_dataset, ca[i].new_name, ardef->symbol, ardef->units, ardef->description, ardef->format_string, ardef->type, ardef->field_length) < 0) {
306 fprintf(stderr,
"Error: Unable to define new column '%s'.\n", ca[i].new_name);
323 buffer =
tmalloc(max_size *
sizeof(
char));
326 if (pageNumber == 0) {
327 fprintf(stderr,
"Error: SDDS data garbled.\n");
328 fprintf(stderr,
"Warning: One or more data pages may be missing.\n");
331 rows = SDDS_RowCount(&SDDS_orig);
333 fprintf(stderr,
"Error: Problem counting rows in input page.\n");
337 fprintf(stderr,
"Error: Problem starting output page.\n");
341 for (i = 0; i < orig_parameter_names; i++) {
343 fprintf(stderr,
"Error: Problem getting parameter '%s'.\n", orig_parameter_name[i]);
346 if (!
SDDS_SetParameters(&SDDS_dataset, SDDS_SET_BY_NAME | SDDS_PASS_BY_REFERENCE, orig_parameter_name[i], buffer, NULL)) {
347 fprintf(stderr,
"Error: Problem setting parameter '%s'.\n", orig_parameter_name[i]);
353 for (i = 0; i < orig_column_names; i++) {
356 fprintf(stderr,
"Error: Problem getting column '%s'.\n", orig_column_name[i]);
359 if (!
SDDS_SetColumn(&SDDS_dataset, SDDS_SET_BY_NAME, ptr, rows, orig_column_name[i])) {
360 fprintf(stderr,
"Error: Problem setting column '%s'.\n", orig_column_name[i]);
366 for (i = 0; i < new_array_names; i++) {
370 fprintf(stderr,
"Error: Problem getting array '%s'.\n", new_array_name[i]);
373 if (!
SDDS_SetArray(&SDDS_dataset, new_array_name[i], SDDS_CONTIGUOUS_DATA, array->data, array->dimension)) {
374 fprintf(stderr,
"Error: Problem setting array '%s'.\n", new_array_name[i]);
381 for (i = 0; i < converted_array_names; i++) {
385 fprintf(stderr,
"Error: Problem getting array '%s'.\n", ca[i].name);
389 if ((ca[i].d[0] == NULL) && (ca[i].d[1] == NULL) && (ca[i].d[2] == NULL)) {
390 if ((orig_column_names) && (array->elements != rows)) {
391 fprintf(stderr,
"Error: Cannot convert '%s' because existing columns have a different number of rows.\n", ca[i].name);
394 if ((virtual_rows >= 0) && (array->elements != virtual_rows)) {
395 fprintf(stderr,
"Error: The number of array elements are not the same.\n");
398 if ((!orig_column_names) && (virtual_rows == -1)) {
404 virtual_rows = array->elements;
405 if (!
SDDS_SetColumn(&SDDS_dataset, SDDS_SET_BY_NAME, array->data, virtual_rows, ca[i].new_name)) {
406 fprintf(stderr,
"Error: Problem setting column '%s'.\n", ca[i].new_name);
411 ca[i].dims[0] = ca[i].dims[1] = ca[i].dims[2] = 0;
412 for (j = 0; j < array->definition->dimensions; j++) {
414 if (ca[i].d[j] == NULL) {
415 ca[i].dims[j] = array->dimension[j];
416 ca[i].dim[j] = malloc(
sizeof(
long) * ca[i].dims[j]);
417 for (k = 0; k < ca[i].dims[j]; k++) {
421 ptr = strtok(ca[i].d[j],
",");
422 while (ptr != NULL) {
423 ca[i].dim[j] = realloc(ca[i].dim[j],
sizeof(
long) * (ca[i].dims[j] + 1));
425 fprintf(stderr,
"Error: Memory allocation failed for dimension indices.\n");
429 if ((sscanf(ptr,
"%ld", &ca[i].dim[j][ca[i].dims[j]]) != 1) ||
430 (ca[i].dim[j][ca[i].dims[j]] < 0) ||
431 (ca[i].dim[j][ca[i].dims[j]] >= array->dimension[j])) {
432 fprintf(stderr,
"Error: Invalid value for d%ld: '%s'.\n", j + 1, ptr);
436 ptr = strtok(NULL,
",");
440 vrows = ca[i].dims[j];
442 vrows *= ca[i].dims[j];
446 if ((orig_column_names) && (vrows != rows)) {
447 fprintf(stderr,
"Error: Cannot convert '%s' because existing columns have a different number of rows.\n", ca[i].name);
450 if ((virtual_rows >= 0) && (vrows != virtual_rows)) {
451 fprintf(stderr,
"Error: The number of array elements are not the same.\n");
454 if ((!orig_column_names) && (virtual_rows == -1)) {
460 virtual_rows = vrows;
463 switch (ca[i].type) {
465 ca[i].data = malloc(
sizeof(
short) * vrows);
466 if (ca[i].dims[1] == 0) {
467 for (j = 0; j < ca[i].dims[0]; j++) {
468 ((
short *)ca[i].data)[n++] = ((
short *)array->data)[ca[i].dim[0][j]];
470 }
else if (ca[i].dims[2] == 0) {
471 for (j = 0; j < ca[i].dims[0]; j++) {
472 for (k = 0; k < ca[i].dims[1]; k++) {
473 ((
short *)ca[i].data)[n++] = ((
short *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
477 for (j = 0; j < ca[i].dims[0]; j++) {
478 for (k = 0; k < ca[i].dims[1]; k++) {
479 for (m = 0; m < ca[i].dims[2]; m++) {
480 ((
short *)ca[i].data)[n++] = ((
short *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
481 ca[i].dim[1][k] * array->dimension[2] +
490 ca[i].data = malloc(
sizeof(
unsigned short) * vrows);
491 if (ca[i].dims[1] == 0) {
492 for (j = 0; j < ca[i].dims[0]; j++) {
493 ((
unsigned short *)ca[i].data)[n++] = ((
unsigned short *)array->data)[ca[i].dim[0][j]];
495 }
else if (ca[i].dims[2] == 0) {
496 for (j = 0; j < ca[i].dims[0]; j++) {
497 for (k = 0; k < ca[i].dims[1]; k++) {
498 ((
unsigned short *)ca[i].data)[n++] = ((
unsigned short *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
502 for (j = 0; j < ca[i].dims[0]; j++) {
503 for (k = 0; k < ca[i].dims[1]; k++) {
504 for (m = 0; m < ca[i].dims[2]; m++) {
505 ((
unsigned short *)ca[i].data)[n++] = ((
unsigned short *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
506 ca[i].dim[1][k] * array->dimension[2] +
515 ca[i].data = malloc(
sizeof(int32_t) * vrows);
516 if (ca[i].dims[1] == 0) {
517 for (j = 0; j < ca[i].dims[0]; j++) {
518 ((int32_t *)ca[i].data)[n++] = ((int32_t *)array->data)[ca[i].dim[0][j]];
520 }
else if (ca[i].dims[2] == 0) {
521 for (j = 0; j < ca[i].dims[0]; j++) {
522 for (k = 0; k < ca[i].dims[1]; k++) {
523 ((int32_t *)ca[i].data)[n++] = ((int32_t *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
527 for (j = 0; j < ca[i].dims[0]; j++) {
528 for (k = 0; k < ca[i].dims[1]; k++) {
529 for (m = 0; m < ca[i].dims[2]; m++) {
530 ((int32_t *)ca[i].data)[n++] = ((int32_t *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
531 ca[i].dim[1][k] * array->dimension[2] +
540 ca[i].data = malloc(
sizeof(uint32_t) * vrows);
541 if (ca[i].dims[1] == 0) {
542 for (j = 0; j < ca[i].dims[0]; j++) {
543 ((uint32_t *)ca[i].data)[n++] = ((uint32_t *)array->data)[ca[i].dim[0][j]];
545 }
else if (ca[i].dims[2] == 0) {
546 for (j = 0; j < ca[i].dims[0]; j++) {
547 for (k = 0; k < ca[i].dims[1]; k++) {
548 ((uint32_t *)ca[i].data)[n++] = ((uint32_t *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
552 for (j = 0; j < ca[i].dims[0]; j++) {
553 for (k = 0; k < ca[i].dims[1]; k++) {
554 for (m = 0; m < ca[i].dims[2]; m++) {
555 ((uint32_t *)ca[i].data)[n++] = ((uint32_t *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
556 ca[i].dim[1][k] * array->dimension[2] +
565 ca[i].data = malloc(
sizeof(int64_t) * vrows);
566 if (ca[i].dims[1] == 0) {
567 for (j = 0; j < ca[i].dims[0]; j++) {
568 ((int64_t *)ca[i].data)[n++] = ((int64_t *)array->data)[ca[i].dim[0][j]];
570 }
else if (ca[i].dims[2] == 0) {
571 for (j = 0; j < ca[i].dims[0]; j++) {
572 for (k = 0; k < ca[i].dims[1]; k++) {
573 ((int64_t *)ca[i].data)[n++] = ((int64_t *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
577 for (j = 0; j < ca[i].dims[0]; j++) {
578 for (k = 0; k < ca[i].dims[1]; k++) {
579 for (m = 0; m < ca[i].dims[2]; m++) {
580 ((int64_t *)ca[i].data)[n++] = ((int64_t *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
581 ca[i].dim[1][k] * array->dimension[2] +
590 ca[i].data = malloc(
sizeof(uint64_t) * vrows);
591 if (ca[i].dims[1] == 0) {
592 for (j = 0; j < ca[i].dims[0]; j++) {
593 ((uint64_t *)ca[i].data)[n++] = ((uint64_t *)array->data)[ca[i].dim[0][j]];
595 }
else if (ca[i].dims[2] == 0) {
596 for (j = 0; j < ca[i].dims[0]; j++) {
597 for (k = 0; k < ca[i].dims[1]; k++) {
598 ((uint64_t *)ca[i].data)[n++] = ((uint64_t *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
602 for (j = 0; j < ca[i].dims[0]; j++) {
603 for (k = 0; k < ca[i].dims[1]; k++) {
604 for (m = 0; m < ca[i].dims[2]; m++) {
605 ((uint64_t *)ca[i].data)[n++] = ((uint64_t *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
606 ca[i].dim[1][k] * array->dimension[2] +
615 ca[i].data = malloc(
sizeof(
float) * vrows);
616 if (ca[i].dims[1] == 0) {
617 for (j = 0; j < ca[i].dims[0]; j++) {
618 ((
float *)ca[i].data)[n++] = ((
float *)array->data)[ca[i].dim[0][j]];
620 }
else if (ca[i].dims[2] == 0) {
621 for (j = 0; j < ca[i].dims[0]; j++) {
622 for (k = 0; k < ca[i].dims[1]; k++) {
623 ((
float *)ca[i].data)[n++] = ((
float *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
627 for (j = 0; j < ca[i].dims[0]; j++) {
628 for (k = 0; k < ca[i].dims[1]; k++) {
629 for (m = 0; m < ca[i].dims[2]; m++) {
630 ((
float *)ca[i].data)[n++] = ((
float *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
631 ca[i].dim[1][k] * array->dimension[2] +
640 ca[i].data = malloc(
sizeof(
double) * vrows);
641 if (ca[i].dims[1] == 0) {
642 for (j = 0; j < ca[i].dims[0]; j++) {
643 ((
double *)ca[i].data)[n++] = ((
double *)array->data)[ca[i].dim[0][j]];
645 }
else if (ca[i].dims[2] == 0) {
646 for (j = 0; j < ca[i].dims[0]; j++) {
647 for (k = 0; k < ca[i].dims[1]; k++) {
648 ((
double *)ca[i].data)[n++] = ((
double *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
652 for (j = 0; j < ca[i].dims[0]; j++) {
653 for (k = 0; k < ca[i].dims[1]; k++) {
654 for (m = 0; m < ca[i].dims[2]; m++) {
655 ((
double *)ca[i].data)[n++] = ((
double *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
656 ca[i].dim[1][k] * array->dimension[2] +
665 ca[i].data = malloc(
sizeof(
char *) * vrows);
666 if (ca[i].dims[1] == 0) {
667 for (j = 0; j < ca[i].dims[0]; j++) {
668 ((
char **)ca[i].data)[n++] = ((
char **)array->data)[ca[i].dim[0][j]];
670 }
else if (ca[i].dims[2] == 0) {
671 for (j = 0; j < ca[i].dims[0]; j++) {
672 for (k = 0; k < ca[i].dims[1]; k++) {
673 ((
char **)ca[i].data)[n++] = ((
char **)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
677 for (j = 0; j < ca[i].dims[0]; j++) {
678 for (k = 0; k < ca[i].dims[1]; k++) {
679 for (m = 0; m < ca[i].dims[2]; m++) {
680 ((
char **)ca[i].data)[n++] = ((
char **)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
681 ca[i].dim[1][k] * array->dimension[2] +
690 ca[i].data = malloc(
sizeof(
char) * vrows);
691 if (ca[i].dims[1] == 0) {
692 for (j = 0; j < ca[i].dims[0]; j++) {
693 ((
char *)ca[i].data)[n++] = ((
char *)array->data)[ca[i].dim[0][j]];
695 }
else if (ca[i].dims[2] == 0) {
696 for (j = 0; j < ca[i].dims[0]; j++) {
697 for (k = 0; k < ca[i].dims[1]; k++) {
698 ((
char *)ca[i].data)[n++] = ((
char *)array->data)[ca[i].dim[0][j] * array->dimension[1] + ca[i].dim[1][k]];
702 for (j = 0; j < ca[i].dims[0]; j++) {
703 for (k = 0; k < ca[i].dims[1]; k++) {
704 for (m = 0; m < ca[i].dims[2]; m++) {
705 ((
char *)ca[i].data)[n++] = ((
char *)array->data)[ca[i].dim[0][j] * (array->dimension[1] * array->dimension[2]) +
706 ca[i].dim[1][k] * array->dimension[2] +
715 fprintf(stderr,
"Error: Unsupported data type for array '%s'.\n", ca[i].name);
719 if (!
SDDS_SetColumn(&SDDS_dataset, SDDS_SET_BY_NAME, ca[i].data, virtual_rows, ca[i].new_name)) {
720 fprintf(stderr,
"Error: Problem setting column '%s'.\n", ca[i].new_name);
724 for (j = 0; j < array->definition->dimensions; j++) {
725 if (ca[i].dim[j] != NULL) {
729 if (ca[i].data != NULL) {
736 fprintf(stderr,
"Error: Problem writing page to file '%s'.\n", output);
753 if (buffer != NULL) {
756 for (i = 0; i < orig_array_names; i++) {
757 if (orig_array_name[i] != NULL) {
758 free(orig_array_name[i]);
761 if (orig_array_name != NULL) {
762 free(orig_array_name);
764 for (i = 0; i < orig_parameter_names; i++) {
765 if (orig_parameter_name[i] != NULL) {
766 free(orig_parameter_name[i]);
769 if (orig_parameter_name != NULL) {
770 free(orig_parameter_name);
772 for (i = 0; i < orig_column_names; i++) {
773 if (orig_column_name[i] != NULL) {
774 free(orig_column_name[i]);
777 if (orig_column_name != NULL) {
778 free(orig_column_name);
780 if (description_text != NULL) {
781 free(description_text);
783 if (description_contents != NULL) {
784 free(description_contents);
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_type_size[SDDS_NUM_TYPES]
Array of sizes for each supported data type.
int32_t SDDS_LengthenTable(SDDS_DATASET *SDDS_dataset, int64_t n_additional_rows)
int32_t SDDS_StartPage(SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows)
int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode,...)
int32_t SDDS_SetColumn(SDDS_DATASET *SDDS_dataset, int32_t mode, void *data, int64_t rows,...)
Sets the values for one data column in the current data table of an SDDS dataset.
int32_t SDDS_SetArray(SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer, int32_t *dimension)
Sets the values of an array variable in the SDDS dataset using specified dimensions.
int32_t SDDS_InitializeOutput(SDDS_DATASET *SDDS_dataset, int32_t data_mode, int32_t lines_per_row, const char *description, const char *contents, const char *filename)
Initializes the SDDS output dataset.
int32_t SDDS_WritePage(SDDS_DATASET *SDDS_dataset)
Writes the current data table to the output file.
int32_t SDDS_DefineColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, int32_t field_length)
Defines a data column within the SDDS dataset.
int32_t SDDS_WriteLayout(SDDS_DATASET *SDDS_dataset)
Writes the SDDS layout header to the output file.
int32_t SDDS_TransferColumnDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a column definition from a source dataset to a target dataset.
int32_t SDDS_TransferArrayDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers an array definition from a source dataset to a target dataset.
int32_t SDDS_TransferParameterDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a parameter definition from a source dataset to a target dataset.
void SDDS_FreeArray(SDDS_ARRAY *array)
Frees memory allocated for an SDDS array structure.
void SDDS_SetError(char *error_text)
Records an error message in the SDDS error stack.
ARRAY_DEFINITION * SDDS_GetArrayDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified array from the SDDS dataset.
int32_t SDDS_FreeArrayDefinition(ARRAY_DEFINITION *source)
Frees memory allocated for an array definition.
char ** SDDS_GetParameterNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all parameters in the SDDS dataset.
char ** SDDS_GetColumnNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all columns in the SDDS dataset.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
void SDDS_Bomb(char *message)
Terminates the program after printing an error message and recorded errors.
char ** SDDS_GetArrayNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all arrays in the SDDS dataset.
#define SDDS_NUM_TYPES
Total number of defined SDDS data types.
#define SDDS_ULONG
Identifier for the unsigned 32-bit integer data type.
#define SDDS_FLOAT
Identifier for the float data type.
#define SDDS_STRING
Identifier for the string data type.
#define SDDS_ULONG64
Identifier for the unsigned 64-bit integer data type.
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.
#define SDDS_SHORT
Identifier for the signed short integer data type.
#define SDDS_CHARACTER
Identifier for the character data type.
#define SDDS_USHORT
Identifier for the unsigned short integer data type.
#define SDDS_DOUBLE
Identifier for the double data type.
#define SDDS_LONG64
Identifier for the signed 64-bit integer data type.
void * trealloc(void *old_ptr, uint64_t size_of_block)
Reallocates a memory block to a new size.
void * tmalloc(uint64_t size_of_block)
Allocates a memory block of the specified size with zero initialization.
void bomb(char *error, char *usage)
Reports error messages to the terminal and aborts the program.
char * delete_chars(char *s, char *t)
Removes all occurrences of characters found in string t from string s.
long match_string(char *string, char **option, long n_options, long mode)
Matches a given string against an array of option strings based on specified modes.
long replaceFileAndBackUp(char *file, char *replacement)
Replaces a file with a replacement file and creates a backup of the original.
int scanargs(SCANNED_ARG **scanned, int argc, char **argv)
long processPipeOption(char **item, long items, unsigned long *flags)
void processFilenames(char *programName, char **input, char **output, unsigned long pipeFlags, long noWarnings, long *tmpOutputUsed)