21#include "match_string.h"
31# define pclose(x) _pclose(x)
33# if defined(__BORLANDC__)
34# define _setmode(handle, amode) setmode(handle, amode)
55 if (
sizeof(gzFile) !=
sizeof(
void *)) {
56 SDDS_SetError(
"gzFile is not the same size as void *, possible corruption of the SDDS_LAYOUT structure");
63 sprintf(s,
"Unable to initialize input for file %s--can't zero SDDS_DATASET structure (SDDS_InitializeInput)", filename);
67 SDDS_dataset->layout.gzipFile = SDDS_dataset->layout.lzmaFile = SDDS_dataset->layout.disconnected = SDDS_dataset->layout.popenUsed = 0;
68 SDDS_dataset->layout.depth = SDDS_dataset->layout.data_command_seen = SDDS_dataset->layout.commentFlags = SDDS_dataset->deferSavingLayout = 0;
69 SDDS_dataset->layout.data_mode.column_memory_mode = DEFAULT_COLUMN_MEMORY_MODE;
71 SDDS_dataset->layout.filename = NULL;
73 sprintf(s,
"Memory allocation failure initializing file \"%s\" (SDDS_InitializeInput)", filename);
79 if (_setmode(_fileno(stdin), _O_BINARY) == -1) {
80 sprintf(s,
"unable to set stdin to binary mode");
85 SDDS_dataset->layout.fp = stdin;
88 if (!(extension = strrchr(filename,
'.')) || strcmp(extension,
".gz") != 0) {
90 if ((extension = strrchr(filename,
'.')) && ((strcmp(extension,
".lzma") == 0) || (strcmp(extension,
".xz") == 0))) {
91 SDDS_dataset->layout.lzmaFile = 1;
92 if (!(SDDS_dataset->layout.lzmafp = UnpackLZMAOpen(filename))) {
93 sprintf(s,
"Unable to open file \"%s\" for reading (SDDS_InitializeInput)", filename);
97 SDDS_dataset->layout.fp = SDDS_dataset->layout.lzmafp->fp;
99 if (!(SDDS_dataset->layout.fp = UnpackFopen(filename, UNPACK_REQUIRE_SDDS | UNPACK_USE_PIPE, &SDDS_dataset->layout.popenUsed, NULL))) {
100 sprintf(s,
"Unable to open file \"%s\" for reading (SDDS_InitializeInput)", filename);
107 SDDS_dataset->layout.gzipFile = 1;
108 if (!(SDDS_dataset->layout.gzfp = UnpackGZipOpen(filename))) {
109 sprintf(s,
"Unable to open file \"%s\" for reading (SDDS_InitializeInput)", filename);
116 SDDS_dataset->page_number = SDDS_dataset->page_started = 0;
117 SDDS_dataset->file_had_data = 0;
120 if (SDDS_dataset->layout.gzipFile) {
121 if (!SDDS_GZipReadLayout(SDDS_dataset, SDDS_dataset->layout.gzfp))
125 if (SDDS_dataset->layout.lzmaFile) {
135 SDDS_dataset->layout.layout_written = 0;
139 if (SDDS_dataset->layout.n_columns &&
140 ((!(SDDS_dataset->column_flag = (int32_t *)
SDDS_Malloc(
sizeof(int32_t) * SDDS_dataset->layout.n_columns)) ||
141 !(SDDS_dataset->column_order = (int32_t *)
SDDS_Malloc(
sizeof(int32_t) * SDDS_dataset->layout.n_columns))) ||
142 (!
SDDS_SetMemory(SDDS_dataset->column_flag, SDDS_dataset->layout.n_columns,
SDDS_LONG, (int32_t)1, (int32_t)0) ||
143 !
SDDS_SetMemory(SDDS_dataset->column_order, SDDS_dataset->layout.n_columns,
SDDS_LONG, (int32_t)0, (int32_t)1)))) {
144 SDDS_SetError(
"Unable to initialize input--memory allocation failure (SDDS_InitializeInput)");
147 SDDS_dataset->mode = SDDS_READMODE;
148 SDDS_dataset->pagecount_offset = NULL;
149 if (!SDDS_dataset->layout.gzipFile && !SDDS_dataset->layout.lzmaFile && !SDDS_dataset->layout.popenUsed && SDDS_dataset->layout.filename) {
155 SDDS_dataset->pages_read = 0;
156 SDDS_dataset->pagecount_offset = malloc(
sizeof(*SDDS_dataset->pagecount_offset));
157 SDDS_dataset->pagecount_offset[0] = ftell(SDDS_dataset->layout.fp);
158 fseek(SDDS_dataset->layout.fp, 0, 2);
159 SDDS_dataset->endOfFile_offset = ftell(SDDS_dataset->layout.fp);
160 fseek(SDDS_dataset->layout.fp, SDDS_dataset->pagecount_offset[0], 0);
181 SDDS_SetError(
"Unable to initialize input--can't zero SDDS_DATASET structure (SDDS_InitializeInput)");
184 SDDS_dataset->layout.gzipFile = SDDS_dataset->layout.lzmaFile = 0;
185 SDDS_dataset->layout.depth = SDDS_dataset->layout.data_command_seen = SDDS_dataset->layout.commentFlags = SDDS_dataset->deferSavingLayout = 0;
186 if (!(SDDS_dataset->layout.fp = fopen(filename, FOPEN_READ_MODE))) {
191 SDDS_SetError(
"Memory allocation failure (SDDS_InitializeInput)");
194 SDDS_dataset->mode = SDDS_READMODE;
195 SDDS_dataset->page_number = SDDS_dataset->page_started = 0;
196 SDDS_dataset->pages_read = 0;
197 SDDS_dataset->pagecount_offset = malloc(
sizeof(*SDDS_dataset->pagecount_offset));
198 SDDS_dataset->pagecount_offset[0] = ftell(SDDS_dataset->layout.fp);
199 fseek(SDDS_dataset->layout.fp, 0, 2);
200 SDDS_dataset->endOfFile_offset = ftell(SDDS_dataset->layout.fp);
201 fseek(SDDS_dataset->layout.fp, SDDS_dataset->pagecount_offset[0], 0);
218 int32_t in_quoted_section;
221 if (*position == quotation_mark)
224 in_quoted_section = 0;
227 if (*
string == quotation_mark && (
string == string0 || *(
string - 1) !=
'\\'))
228 in_quoted_section = !in_quoted_section;
229 else if (
string == position)
230 return (in_quoted_section);
249 char *ptr, *flag, *buffer0;
255 if ((ptr = strchr(buffer,
'&')) && !
SDDS_IsQuoted(buffer, ptr,
'"'))
260 n = strlen(buffer) - 1;
261 if (buffer[n] ==
'\n') {
263 if ((n - 1 >= 0) && (buffer[n - 1] ==
'\r'))
273 while (*ptr !=
'"' && *ptr)
280 if (strncmp(ptr,
"&end", 4) == 0)
290 if ((n = strlen(buffer)) >= 4) {
291 ptr = buffer + n - 4;
293 if (*ptr ==
'&' && (ptr == buffer || *(ptr - 1) !=
'\\') && strncmp(ptr,
"&end", 4) == 0 && !
SDDS_IsQuoted(buffer, ptr,
'"')) {
305 buflen -= strlen(buffer);
306 buffer += strlen(buffer);
309 n = strlen(buffer) - 1;
310 if (buffer[n] ==
'\n') {
312 if ((n - 1 >= 0) && (buffer[n - 1] ==
'\r'))
315 if ((ptr = strstr(buffer,
"&end")) && !
SDDS_IsQuoted(buffer0, ptr,
'"'))
317 buflen -= strlen(buffer);
318 buffer += strlen(buffer);
345 char *ptr, *flag, *buffer0;
351 if ((ptr = strchr(buffer,
'&')) && !
SDDS_IsQuoted(buffer, ptr,
'"'))
356 n = strlen(buffer) - 1;
357 if (buffer[n] ==
'\n') {
359 if ((n - 1 >= 0) && (buffer[n - 1] ==
'\r'))
369 while (*ptr !=
'"' && *ptr)
376 if (strncmp(ptr,
"&end", 4) == 0)
386 if ((n = strlen(buffer)) >= 4) {
387 ptr = buffer + n - 4;
389 if (*ptr ==
'&' && (ptr == buffer || *(ptr - 1) !=
'\\') && strncmp(ptr,
"&end", 4) == 0 && !
SDDS_IsQuoted(buffer, ptr,
'"')) {
401 buflen -= strlen(buffer);
402 buffer += strlen(buffer);
404 n = strlen(buffer) - 1;
405 if (buffer[n] ==
'\n') {
407 if ((n - 1 >= 0) && (buffer[n - 1] ==
'\r'))
410 if ((ptr = strstr(buffer,
"&end")) && !
SDDS_IsQuoted(buffer0, ptr,
'"'))
412 buflen -= strlen(buffer);
413 buffer += strlen(buffer);
433int32_t SDDS_GetGZipNamelist(
SDDS_DATASET *SDDS_dataset,
char *buffer, int32_t buflen, gzFile gzfp) {
434 char *ptr, *flag, *buffer0;
439 while ((flag = fgetsGZipSkipComments(SDDS_dataset, buffer, buflen, gzfp,
'!'))) {
440 if ((ptr = strchr(buffer,
'&')) && !
SDDS_IsQuoted(buffer, ptr,
'"'))
445 n = strlen(buffer) - 1;
446 if (buffer[n] ==
'\n') {
448 if ((n - 1 >= 0) && (buffer[n - 1] ==
'\r'))
458 while (*ptr !=
'"' && *ptr)
465 if (strncmp(ptr,
"&end", 4) == 0)
475 if ((n = strlen(buffer)) >= 4) {
476 ptr = buffer + n - 4;
478 if (*ptr ==
'&' && (ptr == buffer || *(ptr - 1) !=
'\\') && strncmp(ptr,
"&end", 4) == 0 && !
SDDS_IsQuoted(buffer, ptr,
'"')) {
490 buflen -= strlen(buffer);
491 buffer += strlen(buffer);
492 while ((flag = fgetsGZipSkipComments(SDDS_dataset, buffer, buflen, gzfp,
'!'))) {
493 n = strlen(buffer) - 1;
494 if (buffer[n] ==
'\n') {
496 if ((n - 1 >= 0) && (buffer[n - 1] ==
'\r'))
499 if ((ptr = strstr(buffer,
"&end")) && !
SDDS_IsQuoted(buffer0, ptr,
'"'))
501 buflen -= strlen(buffer);
502 buffer += strlen(buffer);
518 char buffer[SDDS_MAXLINE];
519 char *groupName, *ptr;
521 int32_t retval, bigEndianMachine;
522 uint32_t commentFlags;
525 SDDS_SetError(
"Unable to read layout--NULL file pointer (SDDS_ReadLayout)");
528 if (SDDS_dataset->layout.depth == 0) {
529 if (SDDS_dataset->layout.disconnected) {
530 SDDS_SetError(
"Can't read layout--file is disconnected (SDDS_ReadLayout)");
537 SDDS_dataset->layout.layout_written = 1;
538 if (!fgets(SDDS_dataset->layout.s, SDDS_MAXLINE, fp)) {
540 SDDS_SetError(
"Unable to read layout--no header lines found (SDDS_ReadLayout)");
543 if (strncmp(SDDS_dataset->layout.s,
"SDDS", 4) != 0) {
545 SDDS_SetError(
"Unable to read layout--no header lines found (SDDS_ReadLayout)");
548 if (sscanf(SDDS_dataset->layout.s + 4,
"%" SCNd32, &SDDS_dataset->layout.version) != 1) {
550 SDDS_SetError(
"Unable to read layout--no version number on first line (SDDS_ReadLayout)");
554 SDDS_dataset->layout.data_command_seen = 0;
556 while (
SDDS_GetNamelist(SDDS_dataset, SDDS_dataset->layout.s, SDDS_MAXLINE, fp)) {
558 strcpy(buffer, SDDS_dataset->layout.s);
560 groupName = SDDS_dataset->layout.s + 1;
561 if (!(ptr = strpbrk(SDDS_dataset->layout.s,
" \t"))) {
562 SDDS_SetError(
"Unable to read layout---no groupname in namelist (SDDS_ReadLayout)");
566 switch (match_string(groupName,
SDDS_command, SDDS_NUM_COMMANDS, EXACT_MATCH)) {
567 case SDDS_DESCRIPTION_COMMAND:
570 SDDS_SetError(
"Unable to process description (SDDS_ReadLayout)");
574 case SDDS_COLUMN_COMMAND:
577 SDDS_SetError(
"Unable to process column definition (SDDS_ReadLayout)");
581 case SDDS_PARAMETER_COMMAND:
584 SDDS_SetError(
"Unable to process parameter definition (SDDS_ReadLayout)");
588 case SDDS_ASSOCIATE_COMMAND:
589#if RW_ASSOCIATES != 0
592 SDDS_SetError(
"Unable to process associate definition (SDDS_ReadLayout)");
597 case SDDS_DATA_COMMAND:
600 SDDS_SetError(
"Unable to process data mode (SDDS_ReadLayout)");
603 if (SDDS_dataset->layout.data_command_seen) {
606 SDDS_SetError(
"Unable to read layout--multiple data commands (SDDS_ReadLayout)");
610 SDDS_SetError(
"Unable to read layout--couldn't save layout (SDDS_ReadLayout)");
613 SDDS_dataset->layout.data_command_seen = 1;
615 if ((commentFlags & SDDS_BIGENDIAN_SEEN) && (commentFlags & SDDS_LITTLEENDIAN_SEEN)) {
616 SDDS_SetError(
"Unable to read data as it says it is both big and little endian (SDDS_ReadLayout)");
620 SDDS_dataset->swapByteOrder = SDDS_dataset->layout.byteOrderDeclared = 0;
621 SDDS_dataset->autoRecover = 0;
622 if ((commentFlags & SDDS_BIGENDIAN_SEEN) || (SDDS_dataset->layout.data_mode.endian == SDDS_BIGENDIAN)) {
623 SDDS_dataset->layout.byteOrderDeclared = SDDS_BIGENDIAN_SEEN;
624 if (!bigEndianMachine)
625 SDDS_dataset->swapByteOrder = 1;
627 if ((commentFlags & SDDS_LITTLEENDIAN_SEEN) || (SDDS_dataset->layout.data_mode.endian == SDDS_LITTLEENDIAN)) {
628 SDDS_dataset->layout.byteOrderDeclared = SDDS_LITTLEENDIAN_SEEN;
629 if (bigEndianMachine)
630 SDDS_dataset->swapByteOrder = 1;
632 if ((commentFlags & SDDS_FIXED_ROWCOUNT_SEEN) || (SDDS_dataset->layout.data_mode.fixed_row_count))
636 case SDDS_INCLUDE_COMMAND:
639 SDDS_SetError(
"Unable to process include command (SDDS_ReadLayout)");
642 SDDS_dataset->layout.depth += 1;
644 SDDS_dataset->layout.depth -= 1;
649 if (SDDS_dataset->layout.data_command_seen) {
653 case SDDS_ARRAY_COMMAND:
656 SDDS_SetError(
"Unable to process array definition (SDDS_ReadLayout)");
662 sprintf(buffer,
"Unknown layout entry %s given (SDDS_ReadLayout)", groupName);
668 if ((feof(fp) && SDDS_dataset->layout.depth != 0) || SDDS_dataset->layout.data_command_seen)
681 char buffer[SDDS_MAXLINE];
682 char *groupName, *ptr;
684 int32_t retval, bigEndianMachine;
685 uint32_t commentFlags;
688 SDDS_SetError(
"Unable to read layout--NULL file pointer (SDDS_LZMAReadLayout)");
691 if (SDDS_dataset->layout.depth == 0) {
692 if (SDDS_dataset->layout.disconnected) {
693 SDDS_SetError(
"Can't read layout--file is disconnected (SDDS_LZMAReadLayout)");
700 SDDS_dataset->layout.layout_written = 1;
701 if (!lzma_gets(SDDS_dataset->layout.s, SDDS_MAXLINE, lzmafp)) {
703 SDDS_SetError(
"Unable to read layout--no header lines found (SDDS_LZMAReadLayout)");
706 if (strncmp(SDDS_dataset->layout.s,
"SDDS", 4) != 0) {
708 SDDS_SetError(
"Unable to read layout--no header lines found (SDDS_LZMAReadLayout)");
711 if (sscanf(SDDS_dataset->layout.s + 4,
"%" SCNd32, &SDDS_dataset->layout.version) != 1) {
713 SDDS_SetError(
"Unable to read layout--no version number on first line (SDDS_LZMAReadLayout)");
717 SDDS_dataset->layout.data_command_seen = 0;
721 strcpy(buffer, SDDS_dataset->layout.s);
723 groupName = SDDS_dataset->layout.s + 1;
724 if (!(ptr = strpbrk(SDDS_dataset->layout.s,
" \t"))) {
725 SDDS_SetError(
"Unable to read layout---no groupname in namelist (SDDS_LZMAReadLayout)");
729 switch (match_string(groupName,
SDDS_command, SDDS_NUM_COMMANDS, EXACT_MATCH)) {
730 case SDDS_DESCRIPTION_COMMAND:
733 SDDS_SetError(
"Unable to process description (SDDS_LZMAReadLayout)");
737 case SDDS_COLUMN_COMMAND:
740 SDDS_SetError(
"Unable to process column definition (SDDS_LZMAReadLayout)");
744 case SDDS_PARAMETER_COMMAND:
747 SDDS_SetError(
"Unable to process parameter definition (SDDS_LZMAReadLayout)");
751 case SDDS_ASSOCIATE_COMMAND:
752#if RW_ASSOCIATES != 0
755 SDDS_SetError(
"Unable to process associate definition (SDDS_LZMAReadLayout)");
760 case SDDS_DATA_COMMAND:
763 SDDS_SetError(
"Unable to process data mode (SDDS_LZMAReadLayout)");
766 if (SDDS_dataset->layout.data_command_seen) {
769 SDDS_SetError(
"Unable to read layout--multiple data commands (SDDS_LZMAReadLayout)");
773 SDDS_SetError(
"Unable to read layout--couldn't save layout (SDDS_LZMAReadLayout)");
776 SDDS_dataset->layout.data_command_seen = 1;
778 if ((commentFlags & SDDS_BIGENDIAN_SEEN) && (commentFlags & SDDS_LITTLEENDIAN_SEEN)) {
779 SDDS_SetError(
"Unable to read data as it says it is both big and little endian (SDDS_LZMAReadLayout)");
783 SDDS_dataset->swapByteOrder = SDDS_dataset->layout.byteOrderDeclared = 0;
784 SDDS_dataset->autoRecover = 0;
785 if ((commentFlags & SDDS_BIGENDIAN_SEEN) || (SDDS_dataset->layout.data_mode.endian == SDDS_BIGENDIAN)) {
786 SDDS_dataset->layout.byteOrderDeclared = SDDS_BIGENDIAN_SEEN;
787 if (!bigEndianMachine)
788 SDDS_dataset->swapByteOrder = 1;
790 if ((commentFlags & SDDS_LITTLEENDIAN_SEEN) || (SDDS_dataset->layout.data_mode.endian == SDDS_LITTLEENDIAN)) {
791 SDDS_dataset->layout.byteOrderDeclared = SDDS_LITTLEENDIAN_SEEN;
792 if (bigEndianMachine)
793 SDDS_dataset->swapByteOrder = 1;
795 if ((commentFlags & SDDS_FIXED_ROWCOUNT_SEEN) || (SDDS_dataset->layout.data_mode.fixed_row_count))
799 case SDDS_INCLUDE_COMMAND:
802 SDDS_SetError(
"Unable to process include command (SDDS_LZMAReadLayout)");
805 SDDS_dataset->layout.depth += 1;
807 SDDS_dataset->layout.depth -= 1;
812 if (SDDS_dataset->layout.data_command_seen) {
816 case SDDS_ARRAY_COMMAND:
819 SDDS_SetError(
"Unable to process array definition (SDDS_LZMAReadLayout)");
825 sprintf(buffer,
"Unknown layout entry %s given (SDDS_LZMAReadLayout)", groupName);
831 if ((lzma_eof(lzmafp) && SDDS_dataset->layout.depth != 0) || SDDS_dataset->layout.data_command_seen)
844int32_t SDDS_GZipReadLayout(
SDDS_DATASET *SDDS_dataset, gzFile gzfp) {
845 char buffer[SDDS_MAXLINE];
846 char *groupName, *ptr;
848 int32_t retval, bigEndianMachine;
849 uint32_t commentFlags;
852 SDDS_SetError(
"Unable to read layout--NULL file pointer (SDDS_GZipReadLayout)");
855 if (SDDS_dataset->layout.disconnected) {
856 SDDS_SetError(
"Can't read layout--file is disconnected (SDDS_GZipReadLayout)");
863 SDDS_dataset->layout.layout_written = 1;
864 if (!gzgets(gzfp, SDDS_dataset->layout.s, SDDS_MAXLINE)) {
866 SDDS_SetError(
"Unable to read layout--no header lines found (SDDS_GZipReadLayout)");
869 if (strncmp(SDDS_dataset->layout.s,
"SDDS", 4) != 0) {
871 SDDS_SetError(
"Unable to read layout--no header lines found (SDDS_GZipReadLayout)");
874 if (sscanf(SDDS_dataset->layout.s + 4,
"%" SCNd32, &SDDS_dataset->layout.version) != 1) {
876 SDDS_SetError(
"Unable to read layout--no version number on first line (SDDS_GZipReadLayout)");
880 if (SDDS_dataset->layout.depth == 0)
881 SDDS_dataset->layout.data_command_seen = 0;
882 while (SDDS_GetGZipNamelist(SDDS_dataset, SDDS_dataset->layout.s, SDDS_MAXLINE, gzfp)) {
884 strcpy(buffer, SDDS_dataset->layout.s);
886 groupName = SDDS_dataset->layout.s + 1;
887 if (!(ptr = strpbrk(SDDS_dataset->layout.s,
" \t"))) {
888 SDDS_SetError(
"Unable to read layout---no groupname in namelist (SDDS_GZipReadLayout)");
892 switch (match_string(groupName,
SDDS_command, SDDS_NUM_COMMANDS, EXACT_MATCH)) {
893 case SDDS_DESCRIPTION_COMMAND:
896 SDDS_SetError(
"Unable to process description (SDDS_GZipReadLayout)");
900 case SDDS_COLUMN_COMMAND:
903 SDDS_SetError(
"Unable to process column definition (SDDS_GZipReadLayout)");
907 case SDDS_PARAMETER_COMMAND:
910 SDDS_SetError(
"Unable to process parameter definition (SDDS_GZipReadLayout)");
914 case SDDS_ASSOCIATE_COMMAND:
915# if RW_ASSOCIATES != 0
918 SDDS_SetError(
"Unable to process associate definition (SDDS_GZipReadLayout)");
923 case SDDS_DATA_COMMAND:
926 SDDS_SetError(
"Unable to process data mode (SDDS_GZipReadLayout)");
929 if (SDDS_dataset->layout.data_command_seen) {
932 SDDS_SetError(
"Unable to read layout--multiple data commands (SDDS_GZipReadLayout)");
936 SDDS_SetError(
"Unable to read layout--couldn't save layout (SDDS_GZipReadLayout)");
939 SDDS_dataset->layout.data_command_seen = 1;
941 if ((commentFlags & SDDS_BIGENDIAN_SEEN) && (commentFlags & SDDS_LITTLEENDIAN_SEEN)) {
942 SDDS_SetError(
"Unable to read data as it says it is both big and little endian (SDDS_ReadLayout)");
946 SDDS_dataset->swapByteOrder = SDDS_dataset->layout.byteOrderDeclared = 0;
947 SDDS_dataset->autoRecover = 0;
948 if ((commentFlags & SDDS_BIGENDIAN_SEEN) || (SDDS_dataset->layout.data_mode.endian == SDDS_BIGENDIAN)) {
949 SDDS_dataset->layout.byteOrderDeclared = SDDS_BIGENDIAN_SEEN;
950 if (!bigEndianMachine)
951 SDDS_dataset->swapByteOrder = 1;
953 if ((commentFlags & SDDS_LITTLEENDIAN_SEEN) || (SDDS_dataset->layout.data_mode.endian == SDDS_LITTLEENDIAN)) {
954 SDDS_dataset->layout.byteOrderDeclared = SDDS_LITTLEENDIAN_SEEN;
955 if (bigEndianMachine)
956 SDDS_dataset->swapByteOrder = 1;
958 if ((commentFlags & SDDS_FIXED_ROWCOUNT_SEEN) || (SDDS_dataset->layout.data_mode.fixed_row_count))
962 case SDDS_INCLUDE_COMMAND:
965 SDDS_SetError(
"Unable to process include command (SDDS_GZipReadLayout)");
968 SDDS_dataset->layout.depth += 1;
970 SDDS_dataset->layout.depth -= 1;
975 if (SDDS_dataset->layout.data_command_seen) {
979 case SDDS_ARRAY_COMMAND:
982 SDDS_SetError(
"Unable to process array definition (SDDS_GZipReadLayout)");
988 sprintf(buffer,
"Unknown layout entry %s given (SDDS_GZipReadLayout)", groupName);
994 if ((gzeof(gzfp) && SDDS_dataset->layout.depth != 0) || SDDS_dataset->layout.data_command_seen)
1008 if (SDDS_dataset->parallel_io)
1023 if (SDDS_dataset->layout.disconnected) {
1024 SDDS_SetError(
"Can't check status--file is disconnected (SDDS_EndOfFile)");
1028 if (SDDS_dataset->layout.gzipFile) {
1029 if (!SDDS_dataset->layout.gzfp) {
1030 SDDS_SetError(
"Unable to check status--NULL file pointer (SDDS_EndOfFile)");
1035 if (SDDS_dataset->layout.lzmaFile) {
1036 if (!SDDS_dataset->layout.lzmafp) {
1037 SDDS_SetError(
"Unable to check status--NULL file pointer (SDDS_EndOfFile)");
1041 if (!SDDS_dataset->layout.fp) {
1042 SDDS_SetError(
"Unable to check status--NULL file pointer (SDDS_EndOfFile)");
1049 if (SDDS_dataset->fBuffer.bufferSize && SDDS_dataset->fBuffer.bytesLeft) {
1054 if (SDDS_dataset->layout.gzipFile) {
1055 if (gzeof(SDDS_dataset->layout.gzfp))
1059 if (SDDS_dataset->layout.lzmaFile) {
1060 if (lzma_eof(SDDS_dataset->layout.lzmafp))
1063 if (feof(SDDS_dataset->layout.fp))
1090 if (SDDS_dataset->layout.disconnected) {
1091 SDDS_SetError(
"Can't read page--file is disconnected (SDDS_ReadPageSparse)");
1095 if (SDDS_dataset->layout.gzipFile) {
1096 if (!SDDS_dataset->layout.gzfp) {
1097 SDDS_SetError(
"Unable to read page--NULL file pointer (SDDS_ReadPageSparse)");
1102 if (SDDS_dataset->layout.lzmaFile) {
1103 if (!SDDS_dataset->layout.lzmafp) {
1104 SDDS_SetError(
"Unable to read page--NULL file pointer (SDDS_ReadPageSparse)");
1108 if (!SDDS_dataset->layout.fp) {
1109 SDDS_SetError(
"Unable to read page--NULL file pointer (SDDS_ReadPageSparse)");
1116 if (SDDS_dataset->original_layout.data_mode.mode == SDDS_ASCII) {
1117 if ((retval =
SDDS_ReadAsciiPage(SDDS_dataset, sparse_interval, sparse_offset, sparse_statistics)) < 1) {
1120 }
else if (SDDS_dataset->original_layout.data_mode.mode == SDDS_BINARY) {
1121 if ((retval =
SDDS_ReadBinaryPage(SDDS_dataset, sparse_interval, sparse_offset, sparse_statistics)) < 1) {
1125 SDDS_SetError(
"Unable to read page--unrecognized data mode (SDDS_ReadPageSparse)");
1128 if (!SDDS_dataset->layout.gzipFile && !SDDS_dataset->layout.lzmaFile && !SDDS_dataset->layout.popenUsed && SDDS_dataset->layout.filename && SDDS_dataset->pagecount_offset) {
1135 if (SDDS_dataset->pagecount_offset[SDDS_dataset->pages_read] < SDDS_dataset->endOfFile_offset) {
1136 SDDS_dataset->pages_read++;
1137 if (!(SDDS_dataset->pagecount_offset = realloc(SDDS_dataset->pagecount_offset,
sizeof(int64_t) * (SDDS_dataset->pages_read + 1)))) {
1138 SDDS_SetError(
"Unable to allocate memory for pagecount_offset (SDDS_ReadPageSparse)");
1141 SDDS_dataset->pagecount_offset[SDDS_dataset->pages_read] = ftell(SDDS_dataset->layout.fp);
1144 SDDS_dataset->pages_read++;
1161 if (SDDS_dataset->layout.disconnected) {
1162 SDDS_SetError(
"Can't read page--file is disconnected (SDDS_ReadPageLastRows)");
1166 if (SDDS_dataset->layout.gzipFile) {
1167 if (!SDDS_dataset->layout.gzfp) {
1168 SDDS_SetError(
"Unable to read page--NULL file pointer (SDDS_ReadPageLastRows)");
1173 if (SDDS_dataset->layout.lzmaFile) {
1174 if (!SDDS_dataset->layout.lzmafp) {
1175 SDDS_SetError(
"Unable to read page--NULL file pointer (SDDS_ReadPageLastRows)");
1179 if (!SDDS_dataset->layout.fp) {
1180 SDDS_SetError(
"Unable to read page--NULL file pointer (SDDS_ReadPageLastRows)");
1187 if (SDDS_dataset->original_layout.data_mode.mode == SDDS_ASCII) {
1191 }
else if (SDDS_dataset->original_layout.data_mode.mode == SDDS_BINARY) {
1196 SDDS_SetError(
"Unable to read page--unrecognized data mode (SDDS_ReadPageLastRows)");
1199 if (!SDDS_dataset->layout.gzipFile && !SDDS_dataset->layout.lzmaFile && !SDDS_dataset->layout.popenUsed && SDDS_dataset->layout.filename && SDDS_dataset->pagecount_offset) {
1206 if (SDDS_dataset->pagecount_offset[SDDS_dataset->pages_read] < SDDS_dataset->endOfFile_offset) {
1207 SDDS_dataset->pages_read++;
1208 if (!(SDDS_dataset->pagecount_offset = realloc(SDDS_dataset->pagecount_offset,
sizeof(int64_t) * (SDDS_dataset->pages_read + 1)))) {
1209 SDDS_SetError(
"Unable to allocate memory for pagecount_offset (SDDS_ReadPageLastRows)");
1212 SDDS_dataset->pagecount_offset[SDDS_dataset->pages_read] = ftell(SDDS_dataset->layout.fp);
1215 SDDS_dataset->pages_read++;
1266 if (SDDS_dataset->layout.disconnected) {
1267 SDDS_SetError(
"Can't go to page--file is disconnected (SDDS_GotoPage)");
1270 if (SDDS_dataset->layout.popenUsed || !SDDS_dataset->layout.filename) {
1271 SDDS_SetError(
"Can't go to page of pipe is used (SDDS_GotoPage)");
1275 if (SDDS_dataset->layout.gzipFile) {
1276 SDDS_SetError(
"Can not go to page of a gzip file (SDDS_GotoPage)");
1280 if (SDDS_dataset->layout.lzmaFile) {
1281 SDDS_SetError(
"Can not go to page of an .lzma or .xz file (SDDS_GotoPage)");
1284 if (!SDDS_dataset->layout.fp) {
1285 SDDS_SetError(
"Unable to go to page--NULL file pointer (SDDS_GotoPage)");
1292 if (!SDDS_dataset->layout.filename) {
1293 SDDS_SetError(
"Can't go to page--NULL filename pointer (SDDS_GotoPage)");
1296 if (SDDS_dataset->mode != SDDS_READMODE) {
1297 SDDS_SetError(
"Can't go to page--file mode has to be reading mode (SDDS_GotoPage)");
1300 if (SDDS_dataset->fBuffer.bufferSize) {
1301 SDDS_SetError(
"Can't go to page--file buffering is turned on (SDDS_GotoPage)");
1304 if (page_number < 1) {
1305 SDDS_SetError(
"The page_number can not be less than 1 (SDDS_GotoPage)");
1308 if (page_number > SDDS_dataset->pages_read) {
1309 offset = SDDS_dataset->pagecount_offset[SDDS_dataset->pages_read] - ftell(SDDS_dataset->layout.fp);
1310 fseek(SDDS_dataset->layout.fp, offset, 1);
1311 SDDS_dataset->page_number = SDDS_dataset->pages_read;
1312 while (SDDS_dataset->pages_read < page_number) {
1314 SDDS_SetError(
"The page_number is greater than the total pages (SDDS_GotoPage)");
1319 offset = SDDS_dataset->pagecount_offset[page_number - 1] - ftell(SDDS_dataset->layout.fp);
1320 fseek(SDDS_dataset->layout.fp, offset, 1);
1321 SDDS_dataset->page_number = page_number - 1;
1349 SDDS_dataset->layout.data_mode.column_memory_mode = mode;
1359 return (SDDS_dataset->layout.data_mode.column_memory_mode);
1380 layout = &SDDS_dataset->original_layout;
1382 if (SDDS_dataset->parameter) {
1383 for (i = 0; i < layout->n_parameters; i++) {
1384 if (layout->parameter_definition[i].type ==
SDDS_STRING) {
1385 free(*(
char **)(SDDS_dataset->parameter[i]));
1386 *(
char **)(SDDS_dataset->parameter[i]) = NULL;
1390 if (SDDS_dataset->array) {
1391 for (i = 0; i < layout->n_arrays; i++) {
1392 if (layout->array_definition[i].type ==
SDDS_STRING) {
1393 for (j = 0; j < SDDS_dataset->array[i].elements; j++)
1394 if (((
char **)SDDS_dataset->array[i].data)[j]) {
1395 free(((
char **)SDDS_dataset->array[i].data)[j]);
1396 ((
char **)SDDS_dataset->array[i].data)[j] = NULL;
1401 if (SDDS_dataset->data) {
1402 for (i = 0; i < layout->n_columns; i++)
1403 if (SDDS_dataset->data[i]) {
1404 if (layout->column_definition[i].type ==
SDDS_STRING) {
1405 ptr = (
char **)SDDS_dataset->data[i];
1406 for (j = 0; j < SDDS_dataset->n_rows_allocated; j++, ptr++)
1431 for (i = 0; i < SDDS_dataset->layout.n_columns; i++)
1432 if (SDDS_dataset->layout.column_definition[i].type ==
SDDS_STRING) {
1433 ptr = (
char **)SDDS_dataset->data[i];
1434 for (j = 0; j < SDDS_dataset->n_rows; j++, ptr++)
1453 char termBuffer[16384];
1455 if (SDDS_dataset->parallel_io)
1460 layout = &SDDS_dataset->original_layout;
1462 fp = SDDS_dataset->layout.fp;
1464 if (SDDS_dataset->layout.gzipFile) {
1465 if (SDDS_dataset->layout.gzfp && layout->filename) {
1466 if ((SDDS_dataset->writing_page) && (SDDS_dataset->layout.data_mode.fixed_row_count)) {
1470 gzclose(SDDS_dataset->layout.gzfp);
1474 if (SDDS_dataset->layout.lzmaFile) {
1475 if (SDDS_dataset->layout.lzmafp && layout->filename) {
1476 if ((SDDS_dataset->writing_page) && (SDDS_dataset->layout.data_mode.fixed_row_count)) {
1480 lzma_close(SDDS_dataset->layout.lzmafp);
1483 if (fp && layout->filename) {
1484 if ((SDDS_dataset->writing_page) && (SDDS_dataset->layout.data_mode.fixed_row_count)) {
1488 if (layout->popenUsed) {
1489 while (fread(termBuffer,
sizeof(*termBuffer), 16384, fp)) {
1492 fprintf(stderr,
"pclose is not supported in vxWorks\n");
1507 fprintf(stderr,
"Freeing data for file %s\n", SDDS_dataset->layout.filename ? SDDS_dataset->layout.filename :
"NULL");
1510 if (SDDS_dataset->pagecount_offset)
1511 free(SDDS_dataset->pagecount_offset);
1512 if (SDDS_dataset->row_flag)
1513 free(SDDS_dataset->row_flag);
1514 if (SDDS_dataset->column_order)
1515 free(SDDS_dataset->column_order);
1516 if (SDDS_dataset->column_flag)
1517 free(SDDS_dataset->column_flag);
1518 if (SDDS_dataset->fBuffer.buffer)
1519 free(SDDS_dataset->fBuffer.buffer);
1521 fprintf(stderr,
"freeing parameter data...\n");
1523 if (SDDS_dataset->parameter) {
1524 for (i = 0; i < layout->n_parameters; i++) {
1525 if (layout->parameter_definition[i].type ==
SDDS_STRING && *(
char **)(SDDS_dataset->parameter[i]))
1526 free(*(
char **)(SDDS_dataset->parameter[i]));
1527 if (SDDS_dataset->parameter[i])
1528 free(SDDS_dataset->parameter[i]);
1530 free(SDDS_dataset->parameter);
1533 fprintf(stderr,
"freeing array data...\n");
1535 if (SDDS_dataset->array) {
1536 for (i = 0; i < layout->n_arrays; i++) {
1538 for (j = 0; j < SDDS_dataset->array[i].elements; j++)
1539 if (((
char **)SDDS_dataset->array[i].data)[j])
1540 free(((
char **)SDDS_dataset->array[i].data)[j]);
1550 if (SDDS_dataset->array[i].data)
1551 free(SDDS_dataset->array[i].data);
1553 if (SDDS_dataset->array[i].pointer && SDDS_dataset->array[i].definition->dimensions != 1)
1554 free(SDDS_dataset->array[i].pointer);
1555 if (SDDS_dataset->array[i].dimension)
1556 free(SDDS_dataset->array[i].dimension);
1558 if (SDDS_dataset->array[i].definition && SDDS_dataset->array[i].definition->name) {
1559 if (SDDS_dataset->array[i].definition->name != layout->array_definition[i].name)
1562 SDDS_dataset->array[i].definition = NULL;
1564 free(SDDS_dataset->array);
1567 fprintf(stderr,
"freeing tabular data...\n");
1569 if (SDDS_dataset->data) {
1570 for (i = 0; i < layout->n_columns; i++)
1571 if (SDDS_dataset->data[i]) {
1572 if ((SDDS_dataset->column_track_memory == NULL) || (SDDS_dataset->column_track_memory[i])) {
1574 ptr = (
char **)SDDS_dataset->data[i];
1575 for (j = 0; j < SDDS_dataset->n_rows_allocated; j++, ptr++)
1579 free(SDDS_dataset->data[i]);
1582 free(SDDS_dataset->data);
1584 if (SDDS_dataset->column_track_memory)
1585 free(SDDS_dataset->column_track_memory);
1587 fprintf(stderr,
"freeing layout data...\n");
1589 if (layout->description)
1590 free(layout->description);
1591 if (layout->contents == (&SDDS_dataset->layout)->contents)
1592 (&SDDS_dataset->layout)->contents = NULL;
1593 if (layout->contents)
1594 free(layout->contents);
1595 if (layout->filename)
1596 free(layout->filename);
1597 if (layout->column_definition) {
1598 for (i = 0; i < layout->n_columns; i++) {
1599 if (layout->column_index[i])
1600 free(layout->column_index[i]);
1601 if (layout->column_definition[i].name)
1602 free(layout->column_definition[i].name);
1603 if (layout->column_definition[i].symbol)
1604 free(layout->column_definition[i].symbol);
1605 if (layout->column_definition[i].units)
1606 free(layout->column_definition[i].units);
1607 if (layout->column_definition[i].description)
1608 free(layout->column_definition[i].description);
1609 if (layout->column_definition[i].format_string)
1610 free(layout->column_definition[i].format_string);
1612 free(layout->column_definition);
1613 free(layout->column_index);
1615 if (layout->parameter_definition) {
1616 for (i = 0; i < layout->n_parameters; i++) {
1617 if (layout->parameter_index[i])
1618 free(layout->parameter_index[i]);
1619 if (layout->parameter_definition[i].name)
1620 free(layout->parameter_definition[i].name);
1621 if (layout->parameter_definition[i].symbol)
1622 free(layout->parameter_definition[i].symbol);
1623 if (layout->parameter_definition[i].units)
1624 free(layout->parameter_definition[i].units);
1625 if (layout->parameter_definition[i].description)
1626 free(layout->parameter_definition[i].description);
1627 if (layout->parameter_definition[i].format_string)
1628 free(layout->parameter_definition[i].format_string);
1629 if (layout->parameter_definition[i].fixed_value)
1630 free(layout->parameter_definition[i].fixed_value);
1632 free(layout->parameter_definition);
1633 free(layout->parameter_index);
1635 if (layout->array_definition) {
1636 for (i = 0; i < layout->n_arrays; i++) {
1637 if (layout->array_index[i])
1638 free(layout->array_index[i]);
1639 if (layout->array_definition[i].name)
1640 free(layout->array_definition[i].name);
1641 if (layout->array_definition[i].symbol)
1642 free(layout->array_definition[i].symbol);
1643 if (layout->array_definition[i].units)
1644 free(layout->array_definition[i].units);
1645 if (layout->array_definition[i].description)
1646 free(layout->array_definition[i].description);
1647 if (layout->array_definition[i].format_string)
1648 free(layout->array_definition[i].format_string);
1649 if (layout->array_definition[i].group_name)
1650 free(layout->array_definition[i].group_name);
1652 free(layout->array_definition);
1653 free(layout->array_index);
1655 if (layout->associate_definition) {
1656 for (i = 0; i < layout->n_associates; i++) {
1657 if (layout->associate_definition[i].name)
1658 free(layout->associate_definition[i].name);
1659 if (layout->associate_definition[i].filename)
1660 free(layout->associate_definition[i].filename);
1661 if (layout->associate_definition[i].path)
1662 free(layout->associate_definition[i].path);
1663 if (layout->associate_definition[i].description)
1664 free(layout->associate_definition[i].description);
1665 if (layout->associate_definition[i].contents)
1666 free(layout->associate_definition[i].contents);
1668 free(layout->associate_definition);
1671 layout = &SDDS_dataset->layout;
1672 if (layout->contents)
1673 free(layout->contents);
1674 if (layout->column_definition)
1675 free(layout->column_definition);
1676 if (layout->array_definition)
1677 free(layout->array_definition);
1678 if (layout->associate_definition)
1679 free(layout->associate_definition);
1680 if (layout->parameter_definition)
1681 free(layout->parameter_definition);
1682 if (layout->column_index)
1683 free(layout->column_index);
1684 if (layout->parameter_index)
1685 free(layout->parameter_index);
1686 if (layout->array_index)
1687 free(layout->array_index);
1691 fprintf(stderr,
"done\n");
1705 int64_t offset, rows;
1707 char *outputEndianess = NULL;
1709 if ((SDDS_dataset->layout.gzipFile) || (SDDS_dataset->layout.lzmaFile))
1711 if (!(fp = SDDS_dataset->layout.fp)) {
1712 SDDS_SetError(
"Unable to update page--file pointer is NULL (SDDS_UpdateRowCount)");
1716 fprintf(stderr,
"Updating rowcount in file %s with pointer %p\n", SDDS_dataset->layout.filename ? SDDS_dataset->layout.filename :
"NULL", fp);
1718 fBuffer = &SDDS_dataset->fBuffer;
1720 SDDS_SetError(
"Unable to write page--buffer flushing problem (SDDS_UpdateRowCount)");
1724 if (
SDDS_fseek(fp, SDDS_dataset->rowcount_offset, 0) == -1) {
1725 SDDS_SetError(
"Unable to update page--failure doing fseek (SDDS_UpdateRowCount)");
1729 if (SDDS_dataset->layout.data_mode.mode == SDDS_ASCII) {
1730 fprintf(fp,
"%20" PRId64
"\n", rows);
1733 if (rows > INT32_MAX) {
1735 SDDS_SetError(
"Unable to update page--failure writing number of rows (SDDS_UpdateRowCount)");
1738 rows32 = (int32_t)rows;
1739 if ((outputEndianess = getenv(
"SDDS_OUTPUT_ENDIANESS"))) {
1743 if (fwrite(&rows32,
sizeof(rows32), 1, fp) != 1) {
1744 SDDS_SetError(
"Unable to update page--failure writing number of rows (SDDS_UpdateRowCount)");
1749 SDDS_SetError(
"Unable to update page--failure doing fseek to end of page (SDDS_UpdateRowCount)");
1765 if (mode & SDDS_AUTOREADRECOVER) {
1766 SDDS_dataset->autoRecover = 1;
1767 }
else if (mode & SDDS_NOAUTOREADRECOVER) {
1768 SDDS_dataset->autoRecover = 0;
1770 SDDS_SetError(
"Invalid Auto Read Recovery mode (SDDS_SetAutoReadRecovery).");
1789 if (!(filename = findFileInSearchPath(file))) {
1791 if (!(s =
SDDS_Malloc(
sizeof(*s) * (strlen(file) + 100))))
1792 SDDS_SetError(
"file does not exist in search path (InitializeInputFromSearchPath)");
1794 sprintf(s,
"file %s does not exist in search path (InitializeInputFromSearchPath)", file);
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_ReadAsciiPageLastRows(SDDS_DATASET *SDDS_dataset, int64_t last_rows)
Reads the last specified number of rows from an ASCII page of an SDDS dataset.
int32_t SDDS_ReadAsciiPage(SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset, int32_t sparse_statistics)
Reads the next SDDS ASCII page into memory with optional data sparsity and statistics.
int32_t SDDS_FlushBuffer(FILE *fp, SDDS_FILEBUFFER *fBuffer)
int32_t SDDS_ReadBinaryPage(SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset, int32_t sparse_statistics)
Reads a binary page from an SDDS dataset.
void SDDS_SwapLong(int32_t *data)
Swaps the endianness of a 32-bit integer.
int32_t SDDS_fseek(FILE *fp, int64_t offset, int32_t dir)
Sets the file position indicator for a given file stream with retry logic.
int32_t SDDS_ReadBinaryPageLastRows(SDDS_DATASET *SDDS_dataset, int64_t last_rows)
Reads the last specified number of rows from a binary page of an SDDS dataset.
void SDDS_DeferSavingLayout(SDDS_DATASET *SDDS_dataset, int32_t mode)
int32_t SDDS_SaveLayout(SDDS_DATASET *SDDS_dataset)
char * SDDS_command[SDDS_NUM_COMMANDS]
Array of supported SDDS command names.
Internal definitions and function declarations for SDDS with LZMA support.
int32_t SDDS_ProcessArrayDefinition(SDDS_DATASET *SDDS_dataset, char *s)
Process the array definition section of the SDDS dataset.
int32_t SDDS_ProcessParameterDefinition(SDDS_DATASET *SDDS_dataset, char *s)
Process the parameter definition section of the SDDS dataset.
int32_t SDDS_ProcessAssociateDefinition(SDDS_DATASET *SDDS_dataset, char *s)
Process the associate definition section of the SDDS dataset.
char * fgetsLZMASkipComments(SDDS_DATASET *SDDS_dataset, char *s, int32_t slen, struct lzmafile *lzmafp, char skip_char)
Reads a line from a LZMA-compressed file while skipping comment lines.
FILE * SDDS_ProcessIncludeCommand(SDDS_DATASET *SDDS_dataset, char *s)
Process the include command within the SDDS dataset.
int32_t SDDS_ProcessDataMode(SDDS_DATASET *SDDS_dataset, char *s)
Process the data mode section of the SDDS dataset.
uint32_t SDDS_GetSpecialCommentsModes(SDDS_DATASET *SDDS_dataset)
Retrieves the current special comments modes set in the SDDS dataset.
int32_t SDDS_ProcessDescription(SDDS_DATASET *SDDS_dataset, char *s)
Process the description section of the SDDS dataset.
void SDDS_ResetSpecialCommentsModes(SDDS_DATASET *SDDS_dataset)
Resets the special comments modes in the SDDS dataset.
int32_t SDDS_ProcessColumnDefinition(SDDS_DATASET *SDDS_dataset, char *s)
Process the column definition section of the SDDS dataset.
void SDDS_SetError(char *error_text)
Records an error message in the SDDS error stack.
int32_t SDDS_ZeroMemory(void *mem, int64_t n_bytes)
Sets a block of memory to zero.
int32_t SDDS_FreeArrayDefinition(ARRAY_DEFINITION *source)
Frees memory allocated for an array definition.
char * fgetsSkipComments(SDDS_DATASET *SDDS_dataset, char *s, int32_t slen, FILE *fp, char skip_char)
Reads a line from a file while skipping comment lines.
int32_t SDDS_SetMemory(void *mem, int64_t n_elements, int32_t data_type,...)
Initializes a memory block with a sequence of values based on a specified data type.
int32_t SDDS_CheckDataset(SDDS_DATASET *SDDS_dataset, const char *caller)
Validates the SDDS dataset pointer.
void * SDDS_Malloc(size_t size)
Allocates memory of a specified size.
int32_t SDDS_CopyString(char **target, const char *source)
Copies a source string to a target string with memory allocation.
int32_t SDDS_IsBigEndianMachine()
Determines whether the current machine uses big-endian byte ordering.
int32_t SDDS_MPI_Terminate(SDDS_DATASET *SDDS_dataset)
Terminates the SDDS dataset by freeing all allocated resources and closing MPI files.
#define SDDS_STRING
Identifier for the string data type.
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.