161 {
163 long i_arg, reuse, reusePage;
164 int64_t i, j, k, rows1, rows2, n;
165 SCANNED_ARG *s_arg;
166 char s[200], *ptr;
167 char **take_column, **leave_column, **output_column;
168 STRING_PAIR *match_column, *equate_column;
169 double *equate_tolerance;
170 long take_columns, leave_columns, match_columns, equate_columns, leave_all_columns;
171 int32_t output_columns;
172 char *input1, *input2, *output, *match_value;
173 long tmpfile_used, retval1, retval2;
174 long *row_used;
176 long transfers;
177 long warnings, fillIn;
179 unsigned long pipeFlags, majorOrderFlag;
180 REFDATA rename_data, take_RefData;
181 EDIT_NAME_REQUEST *edit_column_request, *edit_parameter_request, *edit_array_request;
182 long edit_column_requests, edit_parameter_requests, edit_array_requests;
183 short columnMajorOrder = -1;
184
186 argc =
scanargs(&s_arg, argc, argv);
187 if (argc < 3) {
188 fprintf(stderr, "%s\n", USAGE);
189 exit(EXIT_FAILURE);
190 }
191
192 input1 = input2 = output = NULL;
193 take_column = leave_column = NULL;
194 match_column = equate_column = NULL;
195 equate_tolerance = NULL;
196 take_columns = leave_columns = match_columns = equate_columns = reuse = reusePage = 0;
197 tmpfile_used = 0;
198 transfer = NULL;
199 transfers = 0;
200 ifnot_item.items = ifis_item.items = 0;
201 warnings = 1;
202 pipeFlags = 0;
203 fillIn = 0;
204 leave_all_columns = 0;
205
206 rename_data.columns = rename_data.parameters = rename_data.arrays = 0;
207 rename_data.new_column = rename_data.orig_column = rename_data.new_parameter = rename_data.orig_parameter = rename_data.new_array = rename_data.orig_array = NULL;
208 edit_column_request = edit_parameter_request = edit_array_request = NULL;
209 edit_column_requests = edit_parameter_requests = edit_array_requests = 0;
210 take_RefData.columns = take_RefData.parameters = take_RefData.arrays = 0;
211 take_RefData.orig_column = take_RefData.new_column = take_RefData.orig_parameter = take_RefData.new_parameter = take_RefData.orig_array = take_RefData.new_array = NULL;
212
213 for (i_arg = 1; i_arg < argc; i_arg++) {
214 if (s_arg[i_arg].arg_type == OPTION) {
216 switch (
match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
217 case SET_MAJOR_ORDER:
218 majorOrderFlag = 0;
219 s_arg[i_arg].n_items--;
220 if (s_arg[i_arg].n_items > 0 && (!
scanItemList(&majorOrderFlag, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
"row", -1, NULL, 0, SDDS_ROW_MAJOR_ORDER,
"column", -1, NULL, 0, SDDS_COLUMN_MAJOR_ORDER, NULL)))
221 SDDS_Bomb(
"invalid -majorOrder syntax/values");
222 if (majorOrderFlag & SDDS_COLUMN_MAJOR_ORDER)
223 columnMajorOrder = 1;
224 else if (majorOrderFlag & SDDS_ROW_MAJOR_ORDER)
225 columnMajorOrder = 0;
226 break;
227 case SET_LEAVE_COLUMNS:
228 if (s_arg[i_arg].n_items < 2) {
229 fprintf(stderr, "%s\n", USAGE);
230 exit(EXIT_FAILURE);
231 }
232 leave_column =
trealloc(leave_column,
sizeof(*leave_column) * (leave_columns + s_arg[i_arg].n_items - 1));
233 for (i = 1; i < s_arg[i_arg].n_items; i++)
234 leave_column[i - 1 + leave_columns] = s_arg[i_arg].list[i];
235 leave_columns += s_arg[i_arg].n_items - 1;
236 break;
237 case SET_TAKE_COLUMNS:
238 if (s_arg[i_arg].n_items < 2) {
239 fprintf(stderr, "%s\n", USAGE);
240 exit(EXIT_FAILURE);
241 }
242 take_column =
trealloc(take_column,
sizeof(*take_column) * (take_columns + s_arg[i_arg].n_items - 1));
243 for (i = 1; i < s_arg[i_arg].n_items; i++)
244 take_column[i - 1 + take_columns] = s_arg[i_arg].list[i];
245 take_columns += s_arg[i_arg].n_items - 1;
246 break;
247 case SET_MATCH_COLUMNS:
248 if (s_arg[i_arg].n_items < 2) {
249 fprintf(stderr, "%s\n", USAGE);
250 exit(EXIT_FAILURE);
251 }
252 match_column =
trealloc(match_column,
sizeof(*match_column) * (match_columns + s_arg[i_arg].n_items - 1));
253 for (i = 1; i < s_arg[i_arg].n_items; i++) {
254 if ((ptr = strchr(s_arg[i_arg].list[i], '=')))
255 *ptr++ = 0;
256 else
257 ptr = s_arg[i_arg].list[i];
258 match_column[i - 1 + match_columns][0] = s_arg[i_arg].list[i];
259 match_column[i - 1 + match_columns][1] = ptr;
260 }
261 match_columns += s_arg[i_arg].n_items - 1;
262 break;
263 case SET_EQUATE_COLUMNS:
264 if (s_arg[i_arg].n_items < 2)
266 equate_column =
trealloc(equate_column,
sizeof(*equate_column) * (equate_columns + s_arg[i_arg].n_items - 1));
267 equate_tolerance =
trealloc(equate_tolerance,
sizeof(*equate_tolerance) * (equate_columns + s_arg[i_arg].n_items - 1));
268 for (i = 1; i < s_arg[i_arg].n_items; i++) {
270 if ((ptr = strchr(s_arg[i_arg].list[i], '=')))
271 *ptr++ = 0;
272 else
273 ptr = s_arg[i_arg].list[i];
274 equate_column[equate_columns][0] = s_arg[i_arg].list[i];
275 equate_column[equate_columns][1] = ptr;
276 equate_tolerance[equate_columns] = 0;
277 equate_columns += 1;
278 } else {
279 sscanf(s_arg[i_arg].list[i], "%le", &equate_tolerance[equate_columns - 1]);
280 }
281 }
282 break;
283 case SET_TRANSFER:
284 if (s_arg[i_arg].n_items < 3)
286 transfer =
trealloc(transfer,
sizeof(*transfer) * (transfers + s_arg[i_arg].n_items - 2));
287 switch (
match_string(s_arg[i_arg].list[1], transfer_type, TRANSFER_TYPES, 0)) {
288 case PARAMETER_TRANSFER:
289 for (i = 2; i < s_arg[i_arg].n_items; i++) {
290 transfer[i - 2 + transfers].type = PARAMETER_TRANSFER;
291 transfer[i - 2 + transfers].name = s_arg[i_arg].list[i];
292 }
293 break;
294 case ARRAY_TRANSFER:
295 for (i = 2; i < s_arg[i_arg].n_items; i++) {
296 transfer[i - 2 + transfers].type = ARRAY_TRANSFER;
297 transfer[i - 2 + transfers].name = s_arg[i_arg].list[i];
298 }
299 break;
300 default:
302 break;
303 }
304 transfers += s_arg[i_arg].n_items - 2;
305 break;
306 case SET_REUSE:
307 if (s_arg[i_arg].n_items == 1)
308 reuse = 1;
309 else {
310 char *reuseOptions[2] = {"rows", "page"};
311 for (i = 1; i < s_arg[i_arg].n_items; i++) {
312 switch (
match_string(s_arg[i_arg].list[i], reuseOptions, 2, 0)) {
313 case 0:
314 reuse = 1;
315 break;
316 case 1:
317 reusePage = 1;
318 break;
319 default:
321 break;
322 }
323 }
324 }
325 break;
326 case SET_IFNOT:
327 if (s_arg[i_arg].n_items < 3)
329 add_ifitem(&ifnot_item, s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1);
330 break;
331 case SET_NOWARNINGS:
332 warnings = 0;
333 break;
334 case SET_IFIS:
335 if (s_arg[i_arg].n_items < 3)
337 add_ifitem(&ifis_item, s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1);
338 break;
339 case SET_PIPE:
340 if (!
processPipeOption(s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1, &pipeFlags))
342 break;
343 case SET_FILLIN:
344 fillIn = 1;
345 break;
346 case SET_RENAME:
347 if (s_arg[i_arg].n_items < 3)
349 switch (
match_string(s_arg[i_arg].list[1], mode_name, MODES, 0)) {
350 case COLUMN_MODE:
351 k = rename_data.columns;
352 rename_data.new_column =
trealloc(rename_data.new_column,
sizeof(
char *) * (k + s_arg[i_arg].n_items - 2));
353 rename_data.orig_column =
trealloc(rename_data.orig_column,
sizeof(
char *) * (k + s_arg[i_arg].n_items - 2));
354 for (i = 2; i < s_arg[i_arg].n_items; i++) {
355 if (!(ptr = strchr(s_arg[i_arg].list[i], '=')))
357 *ptr++ = 0;
358 rename_data.orig_column[k + i - 2] = s_arg[i_arg].list[i];
359 rename_data.new_column[k + i - 2] = ptr;
360 }
361 rename_data.columns += s_arg[i_arg].n_items - 2;
362 break;
363 case PARAMETER_MODE:
364 k = rename_data.parameters;
365 rename_data.new_parameter =
trealloc(rename_data.new_parameter,
sizeof(
char *) * (k + s_arg[i_arg].n_items - 2));
366 rename_data.orig_parameter =
trealloc(rename_data.orig_parameter,
sizeof(
char *) * (k + s_arg[i_arg].n_items - 2));
367 for (i = 2; i < s_arg[i_arg].n_items; i++) {
368 if (!(ptr = strchr(s_arg[i_arg].list[i], '=')))
370 *ptr++ = 0;
371 rename_data.orig_parameter[k + i - 2] = s_arg[i_arg].list[i];
372 rename_data.new_parameter[k + i - 2] = ptr;
373 }
374 rename_data.parameters += s_arg[i_arg].n_items - 2;
375 break;
376 case ARRAY_MODE:
377 k = rename_data.arrays;
378 rename_data.new_array =
trealloc(rename_data.new_array,
sizeof(
char *) * (k + s_arg[i_arg].n_items - 2));
379 rename_data.orig_array =
trealloc(rename_data.orig_array,
sizeof(
char *) * (k + s_arg[i_arg].n_items - 2));
380 for (i = 2; i < s_arg[i_arg].n_items; i++) {
381 if (!(ptr = strchr(s_arg[i_arg].list[i], '=')))
383 *ptr++ = 0;
384 rename_data.orig_array[k + i - 2] = s_arg[i_arg].list[i];
385 rename_data.new_array[k + i - 2] = ptr;
386 }
387 rename_data.arrays += s_arg[i_arg].n_items - 2;
388 break;
389 default:
390 SDDS_Bomb(
"invalid -rename syntax: specify column, parameter, or array keyword");
391 break;
392 }
393 break;
394 case SET_EDIT:
395 if (s_arg[i_arg].n_items != 4)
397 switch (
match_string(s_arg[i_arg].list[1], mode_name, MODES, 0)) {
398 case COLUMN_MODE:
399 edit_column_request =
trealloc(edit_column_request,
sizeof(*edit_column_request) * (edit_column_requests + 1));
401 SDDS_CopyString(&edit_column_request[edit_column_requests].edit_string, s_arg[i_arg].list[3]);
402 edit_column_requests++;
403 break;
404 case PARAMETER_MODE:
405 edit_parameter_request =
trealloc(edit_parameter_request,
sizeof(*edit_parameter_request) * (edit_parameter_requests + 1));
407 SDDS_CopyString(&edit_parameter_request[edit_parameter_requests].edit_string, s_arg[i_arg].list[3]);
408 edit_parameter_requests++;
409 break;
410 case ARRAY_MODE:
411 edit_array_request =
trealloc(edit_array_request,
sizeof(*edit_array_request) * (edit_array_requests + 1));
413 SDDS_CopyString(&edit_array_request[edit_array_requests].edit_string, s_arg[i_arg].list[3]);
414 edit_array_requests++;
415 break;
416 default:
417 SDDS_Bomb(
"invalid -editnames syntax: specify column, parameter, or array keyword");
418 break;
419 }
420 break;
421 default:
422 fprintf(stderr, "Error: Unknown switch: %s\n%s\n", s_arg[i_arg].list[0], USAGE);
424 break;
425 }
426 } else {
427 if (input1 == NULL)
428 input1 = s_arg[i_arg].list[0];
429 else if (input2 == NULL)
430 input2 = s_arg[i_arg].list[0];
431 else if (output == NULL)
432 output = s_arg[i_arg].list[0];
433 else {
434 fprintf(stderr, "Error: Too many filenames specified.\n%s\n", USAGE);
436 }
437 }
438 }
439
440 if (pipeFlags & USE_STDIN && input1) {
441 if (output) {
442 fprintf(stderr, "Error: Too many filenames specified with -pipe option.\n%s\n", USAGE);
443 SDDS_Bomb(
"too many filenames (sddsmxref)");
444 }
445 output = input2;
446 input2 = input1;
447 input1 = NULL;
448 }
449 processFilenames(
"sddsmxref", &input1, &output, pipeFlags, !warnings, &tmpfile_used);
450 if (!input2) {
451 SDDS_Bomb(
"Second input file not specified");
452 exit(EXIT_FAILURE);
453 }
454
457 exit(EXIT_FAILURE);
458 }
459 if (!check_ifitems(&SDDS_1, &ifnot_item, 0, warnings) || !check_ifitems(&SDDS_1, &ifis_item, 1, warnings))
460 exit(EXIT_SUCCESS);
463 exit(EXIT_FAILURE);
464 }
465
466 if (transfers) {
467 if (!expandTransferRequests(&take_RefData.orig_parameter, &take_RefData.parameters, PARAMETER_TRANSFER, transfer, transfers, &SDDS_2) ||
468 !expandTransferRequests(&take_RefData.orig_array, &take_RefData.arrays, ARRAY_TRANSFER, transfer, transfers, &SDDS_2))
470 }
473 if (take_columns) {
475 for (i = 0; i < take_columns; i++) {
477 sprintf(s, "Error: Column '%s' not found in file '%s'", take_column[i], input2);
480 }
483 }
484 }
485
486 leave_all_columns = 0;
487 if (leave_columns == 1 && strcmp(leave_column[0], "*") == 0)
488 leave_all_columns = 1;
489 else {
490 if (!take_columns)
492 for (i = 0; i < leave_columns; i++) {
495 continue;
498 }
499 if (leave_columns)
500 free(leave_column);
501 if (take_columns)
502 free(take_column);
503
505 SDDS_SetError(
"Error: No columns selected to take from input file.");
507 }
508 }
509
510 for (i = 0; i < match_columns; i++) {
513 sprintf(s, "Error: Column '%s' not found or not of string type in file '%s'.", match_column[i][0], input1 ? input1 : "stdin");
516 }
519 sprintf(s, "Error: Column '%s' not found or not of string type in file '%s'.", match_column[i][1], input2);
522 }
523 }
524 for (i = 0; i < equate_columns; i++) {
527 sprintf(s, "Error: Column '%s' not found or not of numeric type in file '%s'.", equate_column[i][0], input1 ? input1 : "stdin");
530 }
533 sprintf(s, "Error: Column '%s' not found or not of numeric type in file '%s'.", equate_column[i][1], input2);
536 }
537 }
538
539 } else {
540 take_columns = 0;
541 take_RefData.columns = 0;
542 leave_all_columns = 1;
543 }
544 if (!take_RefData.columns && !leave_all_columns && warnings)
545 fprintf(stderr, "Warning: No columns being taken from '%s' that are not already in '%s'.\n",
546 input1 ? input1 : "stdin", input2);
547 if (leave_all_columns) {
548 take_RefData.columns = 0;
549 take_columns = 0;
550 }
551
552 if (output && (pipeFlags & USE_STDOUT))
553 SDDS_Bomb(
"Too many filenames specified with -pipe option.");
554 if (!output && !(pipeFlags & USE_STDOUT)) {
555 if (warnings)
556 fprintf(stderr, "Warning: Existing file '%s' will be replaced.\n", input1 ? input1 : "stdin");
557 tmpfile_used = 1;
559 }
562 exit(EXIT_FAILURE);
563 }
564 if (columnMajorOrder != -1)
565 SDDS_output.layout.data_mode.column_major = columnMajorOrder;
566 else
567 SDDS_output.layout.data_mode.column_major = SDDS_1.layout.data_mode.column_major;
568
569
570 process_newnames(&SDDS_2, &take_RefData, rename_data, edit_column_request, edit_column_requests,
571 edit_parameter_request, edit_parameter_requests, edit_array_request, edit_array_requests);
572
573 for (i = 0; i < take_RefData.columns; i++) {
575 if (warnings)
576 fprintf(stderr, "Warning: Column '%s' already exists in the first input file. No data will be taken from column '%s' of the second input file.\n",
577 take_RefData.new_column[i], take_RefData.orig_column[i]);
578 free(take_RefData.new_column[i]);
579 free(take_RefData.orig_column[i]);
580 for (j = i; j < take_RefData.columns - 1; j++) {
581 take_RefData.new_column[j] = take_RefData.new_column[j + 1];
582 take_RefData.orig_column[j] = take_RefData.orig_column[j + 1];
583 }
584
585 take_RefData.columns -= 1;
586 i--;
587 if (take_RefData.columns == 0)
588 break;
589 } else {
592 }
593 }
594 if (!(output_column = (
char **)
SDDS_GetColumnNames(&SDDS_output, &output_columns)) || output_columns == 0) {
595 SDDS_SetError(
"Error: Problem getting output column names.");
597 }
598
599 for (i = 0; i < take_RefData.parameters; i++) {
601 free(take_RefData.orig_parameter[i]);
602 free(take_RefData.new_parameter[i]);
603 for (j = i; j < take_RefData.parameters - 1; j++)
604 take_RefData.orig_parameter[j] = take_RefData.orig_parameter[j + 1];
605 take_RefData.parameters -= 1;
606 i--;
607 if (take_RefData.parameters == 0)
608 break;
609 } else {
612 }
613 }
614
615 for (i = 0; i < take_RefData.arrays; i++) {
617 free(take_RefData.orig_array[i]);
618 free(take_RefData.new_array[i]);
619 for (j = i; j < take_RefData.arrays - 1; j++)
620 take_RefData.orig_array[j] = take_RefData.orig_array[j + 1];
621 take_RefData.arrays -= 1;
622 i--;
623 if (take_RefData.arrays == 0)
624 break;
625 } else {
628 }
629 }
632 if (!take_RefData.columns && !leave_all_columns && warnings)
633 fprintf(stderr, "Warning: No columns being taken from '%s' that are not already in '%s'.\n", input2, input1 ? input1 : "stdin");
634 if (output_columns) {
635 for (i = 0; i < output_columns; i++)
636 free(output_column[i]);
637 free(output_column);
638 }
639 row_used = NULL;
641 if (!reusePage) {
643 fprintf(stderr, "Warning: <input2> ends before <input1>.\n");
644 break;
645 }
646 } else {
650 }
651 if (take_RefData.columns &&
657 row_used =
SDDS_Realloc(row_used,
sizeof(*row_used) * rows2);
659 }
663 }
667 }
668
669 if (!CopyParametersFromSecondInput(&SDDS_output, &SDDS_2, take_RefData)) {
670 SDDS_SetError(
"Error: Problem copying parameters from second input file.");
672 }
673 if (!CopyArraysFromSecondInput(&SDDS_output, &SDDS_2, take_RefData)) {
674 SDDS_SetError(
"Error: Problem copying arrays from second input file.");
676 }
679 SDDS_SetError(
"Error: Problem copying parameters or arrays from first input file.");
681 }
682 for (j = 0; j < rows1; j++) {
684 sprintf(s, "Error: Problem copying row %" PRId64 " of first data set.", j);
687 }
688 SDDS_output.row_flag[j] = 1;
689 if (!match_columns && !equate_columns && !leave_all_columns) {
690 if (j >= rows2) {
691 if (warnings)
692 fprintf(stderr, "Warning: No match for row %" PRId64 " (value %s)\n", j, match_value);
693 SDDS_output.row_flag[j] = 0;
694 continue;
695 }
696 if (!CopyRowToNewColumn(&SDDS_output, j, &SDDS_2, j, take_RefData, take_RefData.columns, input2)) {
697 fprintf(stderr, "Error: Failed to copy data to output.\n");
698 exit(EXIT_FAILURE);
699 }
700 continue;
701 }
702 if (!leave_all_columns) {
704 for (i = 0; i < match_columns; i++) {
705 if (!
SDDS_GetValue(&SDDS_1, match_column[i][0], j, &match_value)) {
706 sprintf(s, "Error: Problem getting column '%s' from file '%s'.", match_column[i][0], input1 ? input1 : "stdin");
709 }
711 sprintf(s, "Error: Problem setting rows of interest for column '%s'.", match_column[i][1]);
714 }
715 free(match_value);
716 }
718 if (warnings)
719 fprintf(stderr, "Warning: No match for row %" PRId64 "\n", j);
720 SDDS_output.row_flag[j] = 0;
721 continue;
722 }
723 i = -1;
724 for (k = 0; k < rows2; k++) {
725 if (!SDDS_2.row_flag[k])
726 continue;
727 i++;
728 if (!row_used[k] && rows_equate(&SDDS_1, j, &SDDS_2, k, equate_columns, equate_column, equate_tolerance)) {
729 row_used[k] = reuse ? 0 : 1;
730 if (!CopyRowToNewColumn(&SDDS_output, j, &SDDS_2, k, take_RefData, take_RefData.columns, input2)) {
731 fprintf(stderr, "Error: Failed to copy data to output.\n");
732 exit(EXIT_FAILURE);
733 }
734 break;
735 }
736 }
737 if (k == rows2) {
738 if (warnings)
739 fprintf(stderr, "Warning: No match for row %" PRId64 "\n", j);
740 if (!fillIn)
741 SDDS_output.row_flag[j] = 0;
742 continue;
743 }
744 }
745 }
747 SDDS_SetError(
"Error: Problem writing data to output file.");
749 }
750 }
751
754 exit(EXIT_FAILURE);
755 }
757 exit(EXIT_FAILURE);
759 if (row_used)
760 free(row_used);
761
762 free_refdata(&take_RefData, 0);
763 free_refdata(&rename_data, 1);
764
765 free_edit_request(edit_column_request, edit_column_requests);
766 free_edit_request(edit_parameter_request, edit_parameter_requests);
767 free_edit_request(edit_array_request, edit_array_requests);
768 if (match_columns)
769 free(match_column);
770 if (equate_columns)
771 free(equate_column);
772
773 return EXIT_SUCCESS;
774}
int32_t SDDS_CopyParameters(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_InitializeCopy(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, char *filename, char *filemode)
int32_t SDDS_CopyRowDirect(SDDS_DATASET *SDDS_target, int64_t target_row, SDDS_DATASET *SDDS_source, int64_t source_row)
int32_t SDDS_CopyArrays(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_StartPage(SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows)
int32_t SDDS_ClearPage(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_WritePage(SDDS_DATASET *SDDS_dataset)
Writes the current data table to the output file.
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.
int32_t SDDS_ZeroMemory(void *mem, int64_t n_bytes)
Sets a block of memory to zero.
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.
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
#define SDDS_NUMERIC_TYPE(type)
Checks if the given type identifier corresponds to any numeric type.
void * trealloc(void *old_ptr, uint64_t size_of_block)
Reallocates a memory block to a new size.
char * cp_str(char **s, char *t)
Copies a string, allocating memory for storage.
long tokenIsNumber(char *token)
Checks if the given token represents a valid number.
char * delete_chars(char *s, char *t)
Removes all occurrences of characters found in string t from string s.
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)
void free_scanargs(SCANNED_ARG **scanned, int argc)
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 * tmpname(char *s)
Supplies a unique temporary filename.
int has_wildcards(char *template)
Check if a template string contains any wildcard characters.