56static char *option[N_OPTIONS] = {
71 " sddscombine [<SDDSinputfilelist>] [<SDDSoutputfile>]\n"
72 " [-pipe=[input][,output]]\n"
73 " [-delete={column|parameter|array},<matching-string>[,...]]\n"
74 " [-retain={column|parameter|array},<matching-string>[,...]]\n"
75 " [-sparse=<integer>][,{average|median|minimum|maximum}]\n"
76 " [-merge[={<parameter-name>,<npages>}]]\n"
80 " [-recover[=clip]]\n"
81 " [-majorOrder=row|column]\n\n"
83 " -pipe=input,output Enable piping for input and/or output.\n"
84 " -delete=type,pattern Delete columns, parameters, or arrays matching the pattern.\n"
85 " -retain=type,pattern Retain only columns, parameters, or arrays matching the pattern.\n"
86 " -sparse=<n>,mode Sample every nth row with optional mode (average, median, minimum, maximum).\n"
87 " -merge=param,npages Merge pages based on a parameter or number of pages.\n"
88 " -append Append data to the first input file.\n"
89 " -overWrite Overwrite the output file if it exists.\n"
90 " -collapse Collapse the output as if processed through sddscollapse.\n"
91 " -recover=clip Recover incomplete/corrupted data, optionally clipping incomplete pages.\n"
92 " -majorOrder=row|column Specify data write order: row-major or column-major.\n\n"
94 " sddscombine combines data from a series of SDDS files into a single SDDS file, usually with one page for each page in each file. "
95 "Data is added from files in the order that they are listed on the command line. A new parameter ('Filename') is added to show the source of each page.\n"
96 " -sparse Samples tabular data, keeping every ith row. It can also perform an optional statistical analysis of the rows.\n"
97 " -merge Merges data into a single page if no qualifiers are given. If a parameter name is provided, it merges contiguous pages with the same parameter value. "
98 "If a number of pages is specified, it merges the given number of contiguous pages.\n"
99 " -append Appends the data to the first input file.\n"
100 " -overWrite Forces overwriting of the output file if it already exists.\n"
101 " -collapse Collapses the output as if processed through sddscollapse.\n"
102 " -recover Recovers incomplete or corrupted binary data. If 'clip' is specified, incomplete pages are deleted.\n"
103 " -majorOrder Specifies output written in row-major or column-major order.\n"
104 " If -pipe=input is specified, only one file should come down the pipe!\n\n"
105 "Program by Michael Borland. (" __DATE__
" " __TIME__
", SVN revision: " SVN_VERSION
")\n";
107long SDDS_CompareParameterValues(
void *param1,
void *param2,
long type);
108long keep_element(
char *name,
char **
delete,
long deletions,
char **retain,
long retentions);
109void *SDDS_GetParameterMod(
SDDS_DATASET *SDDS_dataset,
SDDS_DATASET *SDDS_output,
char *parameter_name,
void *memory);
112#define PARAMETER_MODE 1
115char *mode_name[MODES] = {
121#define SPARSE_AVERAGE 0
122#define SPARSE_MEDIAN 1
123#define SPARSE_MINIMUM 2
124#define SPARSE_MAXIMUM 3
125#define SPARSE_MODES 4
126char *sparse_mode[SPARSE_MODES] = {
133#define ROW_INCREMENT 100
135int main(
int argc,
char **argv) {
137 char **inputfile, *outputfile;
138 long inputfiles, i, i_arg, retval = 0, first_page;
139 long iFile, first_data, sparse, setPageNumber;
140 int32_t sparse_statistics = 0;
141 long merge, nMerge, overwrite, collapse, page, append;
142 int64_t allocated_rows;
146 char *param, *last_param, *this_param, *text, *contents, **column;
147 long param_index, param_type, param_size, output_pending;
148 unsigned long pipeFlags, majorOrderFlag;
150 char **retain_column, **delete_column;
151 long retain_columns, delete_columns;
152 char **retain_parameter, **delete_parameter;
153 long retain_parameters, delete_parameters;
154 char **retain_array, **delete_array;
155 long retain_arrays, delete_arrays;
156 long nColumns, recover, recovered;
157 short columnMajorOrder = -1;
160 argc =
scanargs(&s_arg, argc, argv);
164 setPageNumber = allocated_rows = param_type = param_size = 0;
165 last_param = this_param = NULL;
168 outputfile = param = NULL;
169 inputfiles = merge = overwrite = collapse = append = nMerge = 0;
174 retain_column = delete_column = NULL;
175 retain_columns = delete_columns = 0;
176 retain_parameter = delete_parameter = NULL;
177 retain_parameters = delete_parameters = 0;
178 retain_array = delete_array = NULL;
179 retain_arrays = delete_arrays = 0;
182 argc =
scanargs(&s_arg, argc, argv);
186 for (i_arg = 1; i_arg < argc; i_arg++) {
187 if (s_arg[i_arg].arg_type == OPTION) {
188 switch (
match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
189 case SET_MAJOR_ORDER:
191 s_arg[i_arg].n_items -= 1;
192 if (s_arg[i_arg].n_items > 0 &&
193 (!
scanItemList(&majorOrderFlag, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
194 "row", -1, NULL, 0, SDDS_ROW_MAJOR_ORDER,
195 "column", -1, NULL, 0, SDDS_COLUMN_MAJOR_ORDER, NULL)))
196 SDDS_Bomb(
"invalid -majorOrder syntax/values");
197 if (majorOrderFlag & SDDS_COLUMN_MAJOR_ORDER)
198 columnMajorOrder = 1;
199 else if (majorOrderFlag & SDDS_ROW_MAJOR_ORDER)
200 columnMajorOrder = 0;
203 if (s_arg[i_arg].n_items > 2)
204 bomb(
"invalid -merge syntax", USAGE);
208 if (s_arg[i_arg].n_items == 2) {
209 if (isdigit(s_arg[i_arg].list[1][0])) {
210 if (!sscanf(s_arg[i_arg].list[1],
"%ld", &nMerge))
211 bomb(
"invalid -merge syntax (could not scan number of pages)", USAGE);
213 param = s_arg[i_arg].list[1];
217 if (s_arg[i_arg].n_items > 1)
218 bomb(
"invalid -append syntax", USAGE);
221 SDDS_Bomb(
"-collapse and -append options cannot be used together");
229 if (!
processPipeOption(s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1, &pipeFlags))
234 if (s_arg[i_arg].n_items != 1) {
236 if (s_arg[i_arg].n_items > 2 || strncmp(s_arg[i_arg].list[1],
"clip", strlen(s_arg[i_arg].list[1])) != 0)
241 if (s_arg[i_arg].n_items < 3)
243 switch (
match_string(s_arg[i_arg].list[1], mode_name, MODES, 0)) {
245 delete_column =
trealloc(delete_column,
sizeof(*delete_column) * (delete_columns + s_arg[i_arg].n_items - 2));
246 for (i = 2; i < s_arg[i_arg].n_items; i++)
247 delete_column[i - 2 + delete_columns] =
expand_ranges(s_arg[i_arg].list[i]);
248 delete_columns += s_arg[i_arg].n_items - 2;
251 delete_parameter =
trealloc(delete_parameter,
sizeof(*delete_parameter) * (delete_parameters + s_arg[i_arg].n_items - 2));
252 for (i = 2; i < s_arg[i_arg].n_items; i++)
253 delete_parameter[i - 2 + delete_parameters] =
expand_ranges(s_arg[i_arg].list[i]);
254 delete_parameters += s_arg[i_arg].n_items - 2;
257 delete_array =
trealloc(delete_array,
sizeof(*delete_array) * (delete_arrays + s_arg[i_arg].n_items - 2));
258 for (i = 2; i < s_arg[i_arg].n_items; i++)
259 delete_array[i - 2 + delete_arrays] =
expand_ranges(s_arg[i_arg].list[i]);
260 delete_arrays += s_arg[i_arg].n_items - 2;
263 SDDS_Bomb(
"invalid -delete syntax: specify column or parameter keyword");
268 if (s_arg[i_arg].n_items < 3)
270 switch (
match_string(s_arg[i_arg].list[1], mode_name, MODES, 0)) {
272 retain_column =
trealloc(retain_column,
sizeof(*retain_column) * (retain_columns + s_arg[i_arg].n_items - 2));
273 for (i = 2; i < s_arg[i_arg].n_items; i++)
274 retain_column[i - 2 + retain_columns] =
expand_ranges(s_arg[i_arg].list[i]);
275 retain_columns += s_arg[i_arg].n_items - 2;
278 retain_parameter =
trealloc(retain_parameter,
sizeof(*retain_parameter) * (retain_parameters + s_arg[i_arg].n_items - 2));
279 for (i = 2; i < s_arg[i_arg].n_items; i++)
280 retain_parameter[i - 2 + retain_parameters] =
expand_ranges(s_arg[i_arg].list[i]);
281 retain_parameters += s_arg[i_arg].n_items - 2;
284 retain_array =
trealloc(retain_array,
sizeof(*retain_array) * (retain_arrays + s_arg[i_arg].n_items - 2));
285 for (i = 2; i < s_arg[i_arg].n_items; i++)
286 retain_array[i - 2 + retain_arrays] =
expand_ranges(s_arg[i_arg].list[i]);
287 retain_arrays += s_arg[i_arg].n_items - 2;
290 SDDS_Bomb(
"invalid -retain syntax: specify column or parameter keyword");
295 if ((s_arg[i_arg].n_items >= 2) && (s_arg[i_arg].n_items <= 3)) {
296 if (sscanf(s_arg[i_arg].list[1],
"%ld", &sparse) != 1) {
297 bomb(
"invalid -sparse syntax", USAGE);
300 bomb(
"invalid -sparse syntax", USAGE);
302 if (s_arg[i_arg].n_items == 3) {
303 switch (
match_string(s_arg[i_arg].list[2], sparse_mode, SPARSE_MODES, 0)) {
305 sparse_statistics = 1;
308 sparse_statistics = 2;
311 sparse_statistics = 3;
314 sparse_statistics = 4;
322 bomb(
"invalid -sparse syntax", USAGE);
328 SDDS_Bomb(
"-collapse and -append options cannot be used together");
333 bomb(
"unrecognized option", USAGE);
337 inputfile =
trealloc(inputfile,
sizeof(*inputfile) * (inputfiles + 1));
338 inputfile[inputfiles++] = s_arg[i_arg].list[0];
343 if (inputfiles > 1) {
344 if (pipeFlags & USE_STDIN)
345 SDDS_Bomb(
"too many input files with -pipe option");
346 if (!(pipeFlags & USE_STDOUT)) {
348 outputfile = inputfile[--inputfiles];
349 if (
fexists(outputfile) && !overwrite)
350 SDDS_Bomb(
"output file exists already--give -overWrite option to force replacement");
353 }
else if (inputfiles == 1) {
354 if (pipeFlags & USE_STDIN) {
355 outputfile = inputfile[0];
358 if (pipeFlags & USE_STDOUT && outputfile)
359 SDDS_Bomb(
"too many filenames given with -pipe=output");
361 if (!(pipeFlags & USE_STDIN) || !(pipeFlags & USE_STDOUT))
364 inputfile =
tmalloc(
sizeof(*inputfile) * 1);
365 inputfile[0] = outputfile = NULL;
368 for (i = 0; i < inputfiles; i++)
369 if (inputfile[i] && outputfile && strcmp(inputfile[i], outputfile) == 0)
370 SDDS_Bomb(
"Output file is also an input file.");
387 if (columnMajorOrder != -1)
388 SDDS_output.layout.data_mode.column_major = columnMajorOrder;
390 SDDS_output.layout.data_mode.column_major = SDDS_input.layout.data_mode.column_major;
394 for (; iFile < inputfiles; iFile++) {
402 for (i = 0; i < names; i++) {
405 if (keep_element(name[i], delete_column, delete_columns, retain_column, retain_columns) &&
407 fprintf(stderr,
"Error (sddscombine): Problem appending data. Column %s does not exist in first page.\n", name[i]);
411 if (keep_element(name[i], delete_column, delete_columns, retain_column, retain_columns) &&
423 for (i = 0; i < names; i++) {
425 if (keep_element(name[i], delete_parameter, delete_parameters, retain_parameter, retain_parameters) &&
431 if (keep_element(name[i], delete_parameter, delete_parameters, retain_parameter, retain_parameters) &&
433 fprintf(stderr,
"Error (sddscombine): Problem appending data. Parameter %s does not exist in first page.\n", name[i]);
437 if (keep_element(name[i], delete_parameter, delete_parameters, retain_parameter, retain_parameters) &&
450 for (i = 0; i < names; i++) {
452 if (keep_element(name[i], delete_array, delete_arrays, retain_array, retain_arrays) &&
454 fprintf(stderr,
"Error (sddscombine): Problem appending data. Array %s does not exist in first page.\n", name[i]);
458 if (keep_element(name[i], delete_array, delete_arrays, retain_array, retain_arrays) &&
485 SDDS_DefineColumn(&SDDS_output,
"NumberCombined", NULL, NULL,
"Number of files combined to make this file", NULL,
SDDS_LONG, 0) < 0)
522 if (!
SDDS_StartPage(&SDDS_output, allocated_rows = ROW_INCREMENT)) {
539 for (; iFile < inputfiles; iFile++) {
546 while (!recovered && (retval =
SDDS_ReadPageSparse(&SDDS_input, 0, nColumns ? sparse : INT64_MAX - 1, 0, sparse_statistics)) >= 0) {
559 SDDS_Bomb(
"-merge parameter not in input file(s)");
562 SDDS_Bomb(
"-merge parameter changes type in subsequent files");
565 this_param =
tmalloc(param_size);
566 last_param =
tmalloc(param_size);
568 SDDS_Bomb(
"error getting value for -merge parameter");
571 memcpy(last_param, this_param, param_size);
574 SDDS_Bomb(
"error getting value for -merge parameter");
578 fprintf(stderr,
"parameter %s = ", param);
580 fprintf(stderr,
" now (was ");
582 fprintf(stderr,
")\n");
586 if (merge && param) {
587 if (SDDS_CompareParameterValues(this_param, last_param, param_type) != 0 && output_pending) {
591 if (!merge || (!param && first_data && first_page) || (param && !output_pending)) {
592 if (page > allocated_rows) {
597 allocated_rows += ROW_INCREMENT;
599 for (i = 0; i < columns; i++) {
600 if (!SDDS_GetParameterMod(&SDDS_input, &SDDS_output, column[i], buffer)) {
604 if (!
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_REFERENCE, page - 1, column[i], buffer, NULL)) {
610 if (!
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, page - 1,
"Filename", inputfile[iFile] ? inputfile[iFile] :
"stdin",
"NumberCombined", inputfiles, NULL)) {
615 if (!
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, page - 1,
"NumberCombined", inputfiles, NULL)) {
620 if (setPageNumber && !
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, page - 1,
"PageNumber", page, NULL)) {
625 }
else if (merge && param && output_pending) {
636 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"Filename", inputfile[iFile] ? inputfile[iFile] :
"stdin", NULL)) {
642 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"NumberCombined", inputfiles, NULL)) {
651 }
else if (merge && !param) {
652 if (nMerge > 0 && (page - 1) % nMerge == 0 && page != 1) {
659 if ((first_data && first_page) || (nMerge > 0 && (page - 1) % nMerge == 0)) {
673 if (SDDS_CompareParameterValues(this_param, last_param, param_type) != 0)
674 fprintf(stderr,
"Parameter value has changed\n");
676 if (SDDS_CompareParameterValues(this_param, last_param, param_type) != 0 && output_pending) {
678 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"NumberCombined", inputfiles, NULL)) {
689 if (!output_pending) {
712 if (!collapse && merge && output_pending) {
714 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"NumberCombined", inputfiles, NULL)) {
749void *SDDS_GetParameterMod(
SDDS_DATASET *SDDS_dataset,
SDDS_DATASET *SDDS_output,
char *parameter_name,
void *memory) {
750 long index, type, size;
754 uint64_t ulong64data;
758 unsigned short ushortdata;
775 if (!parameter_name) {
776 SDDS_SetError(
"Unable to get parameter value--parameter name pointer is NULL (SDDS_GetParameterMod)");
781 SDDS_SetError(
"Unable to get parameter value--parameter name is unrecognized (SDDS_GetParameterMod)");
785 SDDS_SetError(
"Unable to get parameter value--parameter data type is invalid (SDDS_GetParameterMod)");
792 SDDS_SetError(
"Unable to get parameter value--parameter data size is invalid (SDDS_GetParameterMod)");
797 data = memcpy(data, &floatdata, size);
800 data = memcpy(data, &doubledata, size);
803 data = memcpy(data, &ulong64data, size);
806 data = memcpy(data, &long64data, size);
809 data = memcpy(data, &ulongdata, size);
812 data = memcpy(data, &longdata, size);
815 data = memcpy(data, &ushortdata, size);
818 data = memcpy(data, &shortdata, size);
821 data = memcpy(data, &chardata, size);
829 SDDS_SetError(
"Unable to get parameter value--parameter data type is invalid (SDDS_GetParameterMod)");
832 if (!SDDS_dataset->parameter || !SDDS_dataset->parameter[index]) {
833 SDDS_SetError(
"Unable to get parameter value--parameter data array is NULL (SDDS_GetParameterMod)");
840 SDDS_SetError(
"Unable to get parameter value--parameter data size is invalid (SDDS_GetParameterMod)");
844 memcpy(data, SDDS_dataset->parameter[index], size);
845 else if (!
SDDS_CopyString((
char **)data, *(
char **)SDDS_dataset->parameter[index]))
851long SDDS_CompareParameterValues(
void *param1,
void *param2,
long type) {
858 ddiff = *((
float *)param1) - *((
float *)param2);
859 return ddiff < 0 ? -1 : ddiff > 0 ? 1 : 0;
861 ddiff = *((
double *)param1) - *((
double *)param2);
862 return ddiff < 0 ? -1 : ddiff > 0 ? 1 : 0;
864 ldiff = *((int64_t *)param1) - *((int64_t *)param2);
865 return ldiff < 0 ? -1 : ldiff > 0 ? 1 : 0;
867 ldiff = *((uint64_t *)param1) - *((uint64_t *)param2);
868 return ldiff < 0 ? -1 : ldiff > 0 ? 1 : 0;
870 ldiff = *((int32_t *)param1) - *((int32_t *)param2);
871 return ldiff < 0 ? -1 : ldiff > 0 ? 1 : 0;
873 ldiff = *((uint32_t *)param1) - *((uint32_t *)param2);
874 return ldiff < 0 ? -1 : ldiff > 0 ? 1 : 0;
876 ldiff = *((
short *)param1) - *((
short *)param2);
877 return ldiff < 0 ? -1 : ldiff > 0 ? 1 : 0;
879 ldiff = *((
unsigned short *)param1) - *((
unsigned short *)param2);
880 return ldiff < 0 ? -1 : ldiff > 0 ? 1 : 0;
882 cdiff = (short)*((
char *)param1) - (short)*((
char *)param2);
883 return cdiff < 0 ? -1 : cdiff > 0 ? 1 : 0;
885 return strcmp(*(
char **)param1, *(
char **)param2);
887 SDDS_SetError(
"Problem doing data comparison--invalid data type (SDDS_CompareParameterValues)");
893long keep_element(
char *name,
char **
delete,
long deletions,
char **retain,
long retentions) {
899 for (i = 0; i < deletions; i++) {
910 for (i = 0; i < retentions; i++) {
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_ReadRecoveryPossible(SDDS_DATASET *SDDS_dataset)
Checks if any data in an SDDS page was recovered after an error was detected.
int32_t SDDS_CopyAdditionalRows(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyPage(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
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_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row,...)
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_ClearPage(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_InitializeAppend(SDDS_DATASET *SDDS_dataset, const char *filename)
Initializes the SDDS dataset for appending data by adding a new page to an existing file.
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_InitializeAppendToPage(SDDS_DATASET *SDDS_dataset, const char *filename, int64_t updateInterval, int64_t *rowsPresentReturn)
Initializes the SDDS dataset for appending data to the last page of an existing file.
int32_t SDDS_UpdatePage(SDDS_DATASET *SDDS_dataset, uint32_t mode)
Updates the current page of the SDDS 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_DefineParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, char *fixed_value)
Defines a data parameter with a fixed string value.
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_DefineColumnLikeParameter(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Defines a column in the target dataset based on a parameter definition from the source 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_SetError(char *error_text)
Records an error message in the SDDS error stack.
int32_t SDDS_GetParameterType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of a parameter in the SDDS dataset by its index.
int32_t SDDS_GetArrayIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named array in the SDDS dataset.
char ** SDDS_GetParameterNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all parameters in the SDDS dataset.
int32_t SDDS_GetParameterIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named parameter in the SDDS dataset.
int32_t SDDS_GetColumnIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named column in the SDDS dataset.
int32_t SDDS_ColumnCount(SDDS_DATASET *page)
Retrieves the number of columns in the SDDS dataset.
char ** SDDS_GetColumnNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all columns in the SDDS dataset.
int32_t SDDS_CheckDataset(SDDS_DATASET *SDDS_dataset, const char *caller)
Validates the SDDS dataset pointer.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
void * SDDS_Malloc(size_t size)
Allocates memory of a specified size.
int32_t SDDS_DeleteParameterFixedValues(SDDS_DATASET *SDDS_dataset)
Deletes fixed values from all parameters in the SDDS dataset.
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
int32_t SDDS_NumberOfErrors()
Retrieves the number of errors recorded by SDDS library routines.
int32_t SDDS_GetTypeSize(int32_t type)
Retrieves the size in bytes of a specified SDDS data type.
int32_t SDDS_GetColumnType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of a column in the SDDS dataset by its index.
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.
int32_t SDDS_CopyString(char **target, const char *source)
Copies a source string to a target string with memory allocation.
int32_t SDDS_PrintTypedValue(void *data, int64_t index, int32_t type, char *format, FILE *fp, uint32_t mode)
Prints a data value of a specified type using an optional printf format string.
#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.
long fexists(const char *filename)
Checks if a file exists.
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.
int scanargs(SCANNED_ARG **scanned, int argc, char **argv)
long processPipeOption(char **item, long items, unsigned long *flags)
long scanItemList(unsigned long *flags, char **item, long *items, unsigned long mode,...)
Scans a list of items and assigns values based on provided keywords and types.
char * expand_ranges(char *template)
Expand range specifiers in a wildcard template into explicit character lists.
int wild_match(char *string, char *template)
Determine whether one string is a wildcard match for another.