47#if defined(__MINGW32__)
48# define __USE_MINGW_ANSI_STDIO 1
56# if defined(__BORLANDC__)
57# define _setmode(handle, amode) setmode(handle, amode)
61void swapdouble(
double *l);
62void swapfloat(
float *l);
63void swaplongLong(uint64_t *l);
64void swaplong(uint32_t *l);
65void swapshort(
short *l);
67void swaplonglong(uint64_t *l) {
68 unsigned char *cp = (
unsigned char *)l;
85void swapdouble(
double *l) {
86 unsigned char *cp = (
unsigned char *)l;
103void swapfloat(
float *l) {
104 unsigned char *cp = (
unsigned char *)l;
115void swaplong(uint32_t *l) {
116 unsigned char *cp = (
unsigned char *)l;
127void swapshort(
short *l) {
128 unsigned char *cp = (
unsigned char *)l;
140#define SET_DUMPHEADER 2
142#define SET_WITHINDEX 4
147char *option[N_OPTIONS] = {
148 "ascii",
"binary",
"dumpheader",
"pipe",
"withindex",
"float",
"double"};
151 "Usage: wfm2sdds [<inputFile>] [<outputFile>]\n"
152 " [-pipe[=in][,out]]\n"
153 " [-ascii | -binary]\n"
155 " [-float | -double]\n"
158 " -pipe[=in][,out] SDDS toolkit pipe option.\n"
159 " -ascii Requests SDDS ASCII output. Default is binary.\n"
160 " -binary Requests SDDS BINARY output.\n"
161 " -withIndex Add Index column.\n"
162 " -float Output in float format. Default is double.\n"
163 " -double Output in double format.\n"
164 " -dumpHeader Print all header info to stdout.\n"
166 "Converts Tektronix WFM files to SDDS.\n"
167 "Program by Robert Soliday. (" __DATE__
" " __TIME__
", SVN revision: " SVN_VERSION
")\n";
169int main(
int argc,
char **argv) {
171 char *input = NULL, *output = NULL;
173 SCANNED_ARG *scanned;
175 long ascii = 0, dumpheader = 0;
176 unsigned long pipeFlags = 0;
178 int withIndex = 0, floatValues = 0, version = 0;
192 short fileFormat[122] =
193 {3, 9, 1, 4, 1, 4, 4, 7, 8, 7, 9, 5, 3, 5, 5, 6, 6, 5, 4, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 3, 5, 6, 8, 8, 5, 9, 8, 8, 8, 8, 5, 5, 4, 4, 4, 4, 4, 8, 9, 8, 5, 8, 8, 8, 8, 5, 9, 8, 8, 8, 8, 5, 5, 4, 4, 4, 4, 4, 8, 9, 8, 5, 8, 8, 8, 8, 5, 9, 8, 8, 8, 8, 5, 8, 9, 8, 5, 8, 8, 8, 8, 5, 9, 8, 8, 8, 8, 5,
194 8, 9, 8, 5, 8, 8, 5, 5, 5, 5, 5, 5, 5, 8, 8, 4, 7, 5, 2, 5, 5, 5, 5, 5};
195 short fileBits[122] =
196 {2, 8, 1, 4, 1, 4, 4, 4, 8, 4, 32, 4, 2, 4, 4, 8, 8, 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 2, 4, 8, 8, 8, 4, 20, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 8, 20, 8, 4, 8, 8, 8, 8, 4, 20, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 8, 20, 8, 4, 8, 8, 8, 8, 4, 20, 8, 8, 8, 8, 4, 8, 20, 8, 4, 8, 8, 8, 8, 4, 20, 8, 8,
197 8, 8, 4, 8, 20, 8, 4, 8, 8, 4, 4, 4, 4, 4, 4, 4, 8, 8, 4, 4, 4, 2, 4, 4, 4, 4, 4};
202 unsigned short uShort;
210 short bytesPerPoint = 2;
211 unsigned long prechargeoffset = 0;
212 unsigned long *precharge;
213 unsigned long RecLength = 0;
214 unsigned long *recordLength;
215 unsigned long postchargestart = 0, postchargestop = 0, postcharge;
216 double sampleInterval = 1;
217 char sampleUnits[50];
218 double sampleStart = 0;
219 double triggerPositionPercent = 0;
220 int32_t *triggerPoint;
224 double expDimInterval = 1, expDimStart = 0;
225 char expDimUnits[50];
226 int32_t *index = NULL;
227 double *sample = NULL, *curve = NULL;
228 uint32_t waveform, waveforms = 1;
229 uint32_t dataType = 0;
232 argc =
scanargs(&scanned, argc, argv);
234 fprintf(stderr,
"%s", USAGE);
235 return (EXIT_FAILURE);
238 for (iArg = 1; iArg < argc; iArg++) {
239 if (scanned[iArg].arg_type == OPTION) {
240 switch (
match_string(scanned[iArg].list[0], option, N_OPTIONS, 0)) {
260 if (!
processPipeOption(scanned[iArg].list + 1, scanned[iArg].n_items - 1, &pipeFlags)) {
261 fprintf(stderr,
"invalid -pipe syntax\n");
262 return (EXIT_FAILURE);
266 fprintf(stderr,
"invalid option seen\n");
267 fprintf(stderr,
"%s", USAGE);
268 return (EXIT_FAILURE);
272 input = scanned[iArg].list[0];
274 output = scanned[iArg].list[0];
276 fprintf(stderr,
"too many filenames\n");
277 fprintf(stderr,
"%s", USAGE);
278 return (EXIT_FAILURE);
287 fprintf(stderr,
"input file not found\n");
288 return (EXIT_FAILURE);
290 if (!(fd = fopen(input,
"rb"))) {
291 fprintf(stderr,
"problem opening input file\n");
292 return (EXIT_FAILURE);
296 if (_setmode(_fileno(stdin), _O_BINARY) == -1) {
297 fprintf(stderr,
"error: unable to set stdin to binary mode\n");
298 return (EXIT_FAILURE);
305 fprintf(stdout,
"Read www.tektronix.com/Measurement/Solutions/openchoice/docs/articles/001137801.pdf for definitions for the header elements.\n");
307 for (i = 0; i < 110; i++) {
308 if ((i == 29) && (version == 1)) {
312 if (fileFormat[i] == 1) {
313 n = fread(&Char, 1, 1, fd);
314 }
else if (fileFormat[i] == 2) {
315 n = fread(&Short, 1, 2, fd);
317 swapshort((
short *)&Short);
319 }
else if (fileFormat[i] == 3) {
320 n = fread(&uShort, 1, 2, fd);
322 swapshort((
short *)&uShort);
324 }
else if (fileFormat[i] == 4) {
325 n = fread(&Long, 1, 4, fd);
327 swaplong((uint32_t *)&Long);
329 }
else if (fileFormat[i] == 5) {
330 n = fread(&uLong, 1, 4, fd);
332 swaplong((uint32_t *)&uLong);
334 }
else if (fileFormat[i] == 6) {
335 n = fread(&uLLong, 1, 8, fd);
337 swaplonglong((uint64_t *)&uLLong);
339 }
else if (fileFormat[i] == 7) {
340 n = fread(&Float, 1, 4, fd);
342 swapfloat((
float *)&Float);
344 }
else if (fileFormat[i] == 8) {
345 n = fread(&Double, 1, 8, fd);
347 swapdouble((
double *)&Double);
349 }
else if (fileFormat[i] == 9) {
350 n = fread(buffer, 1, fileBits[i], fd);
351 buffer[fileBits[i]] =
'\0';
354 if (n != fileBits[i]) {
355 fprintf(stderr,
"Error: unable to read data from input file\n");
356 return (EXIT_FAILURE);
359 fprintf(stdout,
"#%d \tBit Offset=%d \t", i, j);
360 if (fileFormat[i] == 1) {
361 fprintf(stdout,
"Char = %d\n", Char);
362 }
else if (fileFormat[i] == 2) {
363 fprintf(stdout,
"Short = %d\n", Short);
364 }
else if (fileFormat[i] == 3) {
365 fprintf(stdout,
"uShort = %u\n", uShort);
366 }
else if (fileFormat[i] == 4) {
367 fprintf(stdout,
"Long = %" PRId32
"\n", Long);
368 }
else if (fileFormat[i] == 5) {
369 fprintf(stdout,
"uLong = %" PRIu32
"\n", uLong);
370 }
else if (fileFormat[i] == 6) {
371 fprintf(stdout,
"uLLong = %" PRIu64
"\n", uLLong);
372 }
else if (fileFormat[i] == 7) {
373 fprintf(stdout,
"Float = %15.15f\n", Float);
374 }
else if (fileFormat[i] == 8) {
375 fprintf(stdout,
"Double = %15.15lf\n", Double);
376 }
else if (fileFormat[i] == 9) {
377 fprintf(stdout,
"Char[] = %s\n", buffer);
382 if (uShort == 3855) {
387 }
else if (uShort == 61680) {
393 fprintf(stderr,
"Error: invalid WFM file\n");
394 return (EXIT_FAILURE);
398 if (strcmp(buffer,
":WFM#001") == 0) {
400 }
else if (strcmp(buffer,
":WFM#002") == 0) {
402 }
else if (strcmp(buffer,
":WFM#003") == 0) {
413 fprintf(stderr,
"Error: invalid WFM file, expected :WFM#001, :WFM#002 or :WFM#003 as version number.\n");
414 return (EXIT_FAILURE);
418 bytesPerPoint = Char;
422 waveforms = uLong + 1;
427 fprintf(stderr,
"Error: cannot convert WFM files that include multiple waveforms.\n");
428 return (EXIT_FAILURE);
433 fprintf(stderr,
"Error: cannot convert WFM files that include multiple implicit dimensions.\n");
434 return (EXIT_FAILURE);
439 fprintf(stderr,
"Error: cannot convert WFM files that include multiple explicit dimensions.\n");
440 return (EXIT_FAILURE);
445 fprintf(stderr,
"Error: cannot convert WFM files that don't include WFMDATA_VECTOR data.\n");
446 return (EXIT_FAILURE);
451 fprintf(stderr,
"Error: cannot convert WFM files that include multiple curve objects.\n");
452 return (EXIT_FAILURE);
456 expDimInterval = Double;
459 expDimStart = Double;
462 sprintf(expDimUnits,
"%s", buffer);
468 if ((uLong != 0) && (uLong != 1)) {
469 fprintf(stderr,
"Error: Unable to convert WMF file due to unsupported data storage layout.\n");
470 return (EXIT_FAILURE);
474 triggerPositionPercent = Double;
477 sampleInterval = Double;
480 sampleStart = Double;
486 sprintf(sampleUnits,
"%s", buffer);
490 time = malloc(
sizeof(
double) * waveforms);
491 precharge = malloc(
sizeof(
unsigned long) * waveforms);
492 recordLength = malloc(
sizeof(
unsigned long) * waveforms);
493 triggerPoint = malloc(
sizeof(int32_t) * waveforms);
499 for (i = 110; i < 122; i++) {
501 if (fileFormat[i] == 1) {
502 n = fread(&Char, 1, 1, fd);
503 }
else if (fileFormat[i] == 2) {
504 n = fread(&Short, 1, 2, fd);
506 swapshort((
short *)&Short);
508 }
else if (fileFormat[i] == 3) {
509 n = fread(&uShort, 1, 2, fd);
511 swapshort((
short *)&uShort);
513 }
else if (fileFormat[i] == 4) {
514 n = fread(&Long, 1, 4, fd);
516 swaplong((uint32_t *)&Long);
518 }
else if (fileFormat[i] == 5) {
519 n = fread(&uLong, 1, 4, fd);
521 swaplong((uint32_t *)&uLong);
523 }
else if (fileFormat[i] == 6) {
524 n = fread(&uLLong, 1, 8, fd);
526 swaplonglong((uint64_t *)&uLLong);
528 }
else if (fileFormat[i] == 7) {
529 n = fread(&Float, 1, 4, fd);
531 swapfloat((
float *)&Float);
533 }
else if (fileFormat[i] == 8) {
534 n = fread(&Double, 1, 8, fd);
536 swapdouble((
double *)&Double);
538 }
else if (fileFormat[i] == 9) {
539 n = fread(buffer, 1, fileBits[i], fd);
540 buffer[fileBits[i]] =
'\0';
543 if (n != fileBits[i]) {
544 fprintf(stderr,
"Error: unable to read data from input file\n");
545 return (EXIT_FAILURE);
548 fprintf(stdout,
"#%d \tBit Offset=%d \t", i, j);
549 if (fileFormat[i] == 1) {
550 fprintf(stdout,
"Char = %d\n", Char);
551 }
else if (fileFormat[i] == 2) {
552 fprintf(stdout,
"Short = %d\n", Short);
553 }
else if (fileFormat[i] == 3) {
554 fprintf(stdout,
"uShort = %u\n", uShort);
555 }
else if (fileFormat[i] == 4) {
556 fprintf(stdout,
"Long = %" PRId32
"\n", Long);
557 }
else if (fileFormat[i] == 5) {
558 fprintf(stdout,
"uLong = %" PRIu32
"\n", uLong);
559 }
else if (fileFormat[i] == 6) {
560 fprintf(stdout,
"uLLong = %" PRIu64
"\n", uLLong);
561 }
else if (fileFormat[i] == 7) {
562 fprintf(stdout,
"Float = %15.15f\n", Float);
563 }
else if (fileFormat[i] == 8) {
564 fprintf(stdout,
"Double = %15.15lf\n", Double);
565 }
else if (fileFormat[i] == 9) {
566 fprintf(stdout,
"Char[] = %s\n", buffer);
575 time[0] = timeInt + timeFrac;
578 prechargeoffset = uLong;
579 precharge[0] = prechargeoffset / bytesPerPoint;
582 postchargestart = uLong;
585 postchargestop = uLong;
586 postcharge = (postchargestop - postchargestart) / bytesPerPoint;
587 recordLength[0] = RecLength - precharge[0] - postcharge;
588 triggerPoint[0] = round(recordLength[0] * (triggerPositionPercent / 100));
592 for (waveform = 1; waveform < waveforms; waveform++) {
594 precharge[waveform] = 0;
595 recordLength[waveform] = 0;
596 triggerPoint[waveform] = 0;
597 for (i = 110; i < 114; i++) {
599 if (fileFormat[i] == 1) {
600 n = fread(&Char, 1, 1, fd);
601 }
else if (fileFormat[i] == 2) {
602 n = fread(&Short, 1, 2, fd);
604 swapshort((
short *)&Short);
606 }
else if (fileFormat[i] == 3) {
607 n = fread(&uShort, 1, 2, fd);
609 swapshort((
short *)&uShort);
611 }
else if (fileFormat[i] == 4) {
612 n = fread(&Long, 1, 4, fd);
614 swaplong((uint32_t *)&Long);
616 }
else if (fileFormat[i] == 5) {
617 n = fread(&uLong, 1, 4, fd);
619 swaplong((uint32_t *)&uLong);
621 }
else if (fileFormat[i] == 6) {
622 n = fread(&uLLong, 1, 8, fd);
624 swaplonglong((uint64_t *)&uLLong);
626 }
else if (fileFormat[i] == 7) {
627 n = fread(&Float, 1, 4, fd);
629 swapfloat((
float *)&Float);
631 }
else if (fileFormat[i] == 8) {
632 n = fread(&Double, 1, 8, fd);
634 swapdouble((
double *)&Double);
636 }
else if (fileFormat[i] == 9) {
637 n = fread(buffer, 1, fileBits[i], fd);
638 buffer[fileBits[i]] =
'\0';
641 if (n != fileBits[i]) {
642 fprintf(stderr,
"Error: unable to read data from input file\n");
643 return (EXIT_FAILURE);
646 fprintf(stdout,
"#%d \tBit Offset=%d \t", i, j);
647 if (fileFormat[i] == 1) {
648 fprintf(stdout,
"Char = %d\n", Char);
649 }
else if (fileFormat[i] == 2) {
650 fprintf(stdout,
"Short = %d\n", Short);
651 }
else if (fileFormat[i] == 3) {
652 fprintf(stdout,
"uShort = %u\n", uShort);
653 }
else if (fileFormat[i] == 4) {
654 fprintf(stdout,
"Long = %" PRId32
"\n", Long);
655 }
else if (fileFormat[i] == 5) {
656 fprintf(stdout,
"uLong = %" PRIu32
"\n", uLong);
657 }
else if (fileFormat[i] == 6) {
658 fprintf(stdout,
"uLLong = %" PRIu64
"\n", uLLong);
659 }
else if (fileFormat[i] == 7) {
660 fprintf(stdout,
"Float = %15.15f\n", Float);
661 }
else if (fileFormat[i] == 8) {
662 fprintf(stdout,
"Double = %15.15lf\n", Double);
663 }
else if (fileFormat[i] == 9) {
664 fprintf(stdout,
"Char[] = %s\n", buffer);
673 time[waveform] = timeInt + timeFrac;
677 for (waveform = 1; waveform < waveforms; waveform++) {
678 for (i = 114; i < 122; i++) {
680 if (fileFormat[i] == 1) {
681 n = fread(&Char, 1, 1, fd);
682 }
else if (fileFormat[i] == 2) {
683 n = fread(&Short, 1, 2, fd);
685 swapshort((
short *)&Short);
687 }
else if (fileFormat[i] == 3) {
688 n = fread(&uShort, 1, 2, fd);
690 swapshort((
short *)&uShort);
692 }
else if (fileFormat[i] == 4) {
693 n = fread(&Long, 1, 4, fd);
695 swaplong((uint32_t *)&Long);
697 }
else if (fileFormat[i] == 5) {
698 n = fread(&uLong, 1, 4, fd);
700 swaplong((uint32_t *)&uLong);
702 }
else if (fileFormat[i] == 6) {
703 n = fread(&uLLong, 1, 8, fd);
705 swaplonglong((uint64_t *)&uLLong);
707 }
else if (fileFormat[i] == 7) {
708 n = fread(&Float, 1, 4, fd);
710 swapfloat((
float *)&Float);
712 }
else if (fileFormat[i] == 8) {
713 n = fread(&Double, 1, 8, fd);
715 swapdouble((
double *)&Double);
717 }
else if (fileFormat[i] == 9) {
718 n = fread(buffer, 1, fileBits[i], fd);
719 buffer[fileBits[i]] =
'\0';
722 if (n != fileBits[i]) {
723 fprintf(stderr,
"Error: unable to read data from input file\n");
724 return (EXIT_FAILURE);
727 fprintf(stdout,
"#%d \tBit Offset=%d \t", i, j);
728 if (fileFormat[i] == 1) {
729 fprintf(stdout,
"Char = %d\n", Char);
730 }
else if (fileFormat[i] == 2) {
731 fprintf(stdout,
"Short = %d\n", Short);
732 }
else if (fileFormat[i] == 3) {
733 fprintf(stdout,
"uShort = %u\n", uShort);
734 }
else if (fileFormat[i] == 4) {
735 fprintf(stdout,
"Long = %" PRId32
"\n", Long);
736 }
else if (fileFormat[i] == 5) {
737 fprintf(stdout,
"uLong = %" PRIu32
"\n", uLong);
738 }
else if (fileFormat[i] == 6) {
739 fprintf(stdout,
"uLLong = %" PRIu64
"\n", uLLong);
740 }
else if (fileFormat[i] == 7) {
741 fprintf(stdout,
"Float = %15.15f\n", Float);
742 }
else if (fileFormat[i] == 8) {
743 fprintf(stdout,
"Double = %15.15lf\n", Double);
744 }
else if (fileFormat[i] == 9) {
745 fprintf(stdout,
"Char[] = %s\n", buffer);
750 prechargeoffset = uLong;
751 precharge[waveform] = prechargeoffset / bytesPerPoint;
754 postchargestart = uLong;
757 postchargestop = uLong;
758 postcharge = (postchargestop - postchargestart) / bytesPerPoint;
759 recordLength[waveform] = RecLength - precharge[waveform] - postcharge;
760 triggerPoint[waveform] = round(recordLength[waveform] * (triggerPositionPercent / 100));
767 return (EXIT_FAILURE);
771 return (EXIT_FAILURE);
775 return (EXIT_FAILURE);
779 return (EXIT_FAILURE);
784 return (EXIT_FAILURE);
789 return (EXIT_FAILURE);
793 return (EXIT_FAILURE);
797 return (EXIT_FAILURE);
800 for (waveform = 0; waveform < waveforms; waveform++) {
802 index = malloc(
sizeof(int32_t) * recordLength[waveform]);
804 fprintf(stderr,
"Error: Memory allocation failed for index.\n");
805 return (EXIT_FAILURE);
808 sample = malloc(
sizeof(
double) * recordLength[waveform]);
809 curve = malloc(
sizeof(
double) * recordLength[waveform]);
810 if ((!sample) || (!curve)) {
811 fprintf(stderr,
"Error: Memory allocation failed for sample or curve.\n");
812 return (EXIT_FAILURE);
815 for (i = 0; i < precharge[waveform]; i++) {
816 n = fread(&Short, 1, 2, fd);
818 fprintf(stderr,
"Error: unable to read precharge data from input file\n");
819 return (EXIT_FAILURE);
823 for (i = 0; i < recordLength[waveform]; i++) {
826 n = fread(&Short, 1, 2, fd);
828 swapshort((
short *)&Short);
831 sample[i] = sampleStart + (sampleInterval * i);
832 curve[i] = expDimStart + (Short * expDimInterval);
835 n = fread(&Long, 1, 4, fd);
837 swaplong((uint32_t *)&Long);
840 sample[i] = sampleStart + (sampleInterval * i);
841 curve[i] = expDimStart + (Long * expDimInterval);
844 n = fread(&uLong, 1, 4, fd);
846 swaplong((uint32_t *)&uLong);
849 sample[i] = sampleStart + (sampleInterval * i);
850 curve[i] = expDimStart + (uLong * expDimInterval);
853 n = fread(&uLLong, 1, 8, fd);
855 swaplonglong((uint64_t *)&uLLong);
858 sample[i] = sampleStart + (sampleInterval * i);
859 curve[i] = expDimStart + (uLLong * expDimInterval);
862 n = fread(&Float, 1, 4, fd);
864 swapfloat((
float *)&Float);
867 sample[i] = sampleStart + (sampleInterval * i);
868 curve[i] = expDimStart + (Float * expDimInterval);
871 n = fread(&Double, 1, 8, fd);
873 swapdouble((
double *)&Double);
876 sample[i] = sampleStart + (sampleInterval * i);
877 curve[i] = expDimStart + (Double * expDimInterval);
880 n = fread(&uChar, 1, 1, fd);
883 sample[i] = sampleStart + (sampleInterval * i);
884 curve[i] = expDimStart + (uChar * expDimInterval);
887 n = fread(&Char, 1, 1, fd);
890 sample[i] = sampleStart + (sampleInterval * i);
891 curve[i] = expDimStart + (Char * expDimInterval);
894 fprintf(stderr,
"Error: Unsupported data type encountered.\n");
895 return (EXIT_FAILURE);
900 for (i = recordLength[waveform]; i < RecLength; i++) {
901 n = fread(&Short, 1, 2, fd);
903 fprintf(stderr,
"Error: unable to read postcharge data from input file\n");
904 return (EXIT_FAILURE);
909 for (i = 0; i < recordLength[waveform]; i++) {
914 if (!SDDS_StartTable(&SDDSout, recordLength[waveform])) {
916 return (EXIT_FAILURE);
919 "TriggerPoint", triggerPoint[waveform],
920 "SampleInterval", sampleInterval,
921 "Time", time[waveform],
924 return (EXIT_FAILURE);
929 return (EXIT_FAILURE);
934 return (EXIT_FAILURE);
938 return (EXIT_FAILURE);
940 if (!SDDS_WriteTable(&SDDSout)) {
942 return (EXIT_FAILURE);
951 fprintf(stderr,
"Error: unable to read data from input file\n");
952 return (EXIT_FAILURE);
959 return (EXIT_FAILURE);
964 return (EXIT_SUCCESS);
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode,...)
int32_t SDDS_SetColumnFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, double *data, int64_t rows,...)
Sets the values for a single data column using double-precision floating-point numbers.
int32_t SDDS_SetColumnFromLongs(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t *data, int64_t rows,...)
Sets the values for a single data column using long integer numbers.
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_DefineSimpleColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *unit, int32_t type)
Defines a simple data column within the SDDS dataset.
int32_t SDDS_DefineSimpleParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *unit, int32_t type)
Defines a simple data parameter within the SDDS dataset.
int32_t SDDS_WriteLayout(SDDS_DATASET *SDDS_dataset)
Writes the SDDS layout header to the output file.
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.
int32_t SDDS_IsBigEndianMachine()
Determines whether the current machine uses big-endian byte ordering.
#define SDDS_FLOAT
Identifier for the float data type.
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.
#define SDDS_DOUBLE
Identifier for the double data type.
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)
void processFilenames(char *programName, char **input, char **output, unsigned long pipeFlags, long noWarnings, long *tmpOutputUsed)
void free_scanargs(SCANNED_ARG **scanned, int argc)