11#if PY_MAJOR_VERSION >= 3
13#define PyString_Check PyUnicode_Check
14#define PyString_AsString PyUnicode_AsUTF8
15#define PyString_FromString PyUnicode_FromString
16#define PyInt_Check PyLong_Check
17#define PyInt_AsLong PyLong_AsLong
18#define PyInt_AsUnsignedLong PyLong_AsUnsignedLong
19#define PyInt_AsLongLong PyLong_AsLongLong
20#define PyInt_AsUnsignedLongLong PyLong_AsUnsignedLongLong
21#define PyExc_StandardError PyExc_Exception
23#if PY_MAJOR_VERSION < 3
24#define PyInt_AsUnsignedLongLong PyInt_AsUnsignedLongLongMask
25#define PyInt_AsUnsignedLong PyInt_AsUnsignedLongMask
26#define PyInt_AsLongLong PyInt_AsLong
53 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &filename)) {
75 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &filename)) {
98 long updateInterval, result;
100 if (!PyArg_ParseTuple(args,
"lsl", &fileIndex, &filename, &updateInterval)) {
106 return PyLong_FromLongLong((
long long)rowsPresent);
133 if (!PyArg_ParseTuple(args,
"lllsss", &fileIndex, &data_mode, &lines_per_row, &description, &contents, &filename)) {
137 if (strlen(description) == 0)
140 if (strlen(contents) == 0)
158 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
161 dataset_f[fileIndex].layout.data_mode.column_major = 1;
178 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
198 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
201 dataset_f[fileIndex].layout.data_mode.column_major = 0;
218 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
221 dataset_f[fileIndex].layout.data_mode.fsync_data = 1;
238 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
241 dataset_f[fileIndex].layout.data_mode.fsync_data = 0;
259 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
311 PyObject *fixed_value;
312 char *fixedStringValue;
313 int32_t fixedLongValue;
314 double fixedDoubleValue;
315 char buffer[SDDS_MAXLINE];
316 if (!PyArg_ParseTuple(args,
"lssssslO", &fileIndex, &name , &symbol , &units , &description , &format_string , &type , &fixed_value)) {
317 return PyLong_FromLong(-1);
320 if (strlen(symbol) == 0)
323 if (strlen(units) == 0)
326 if (strlen(description) == 0)
329 if (strlen(format_string) == 0)
330 format_string = NULL;
332 if (PyString_Check(fixed_value)) {
333 fixedStringValue = (
char*)PyString_AsString(fixed_value);
334 if (fixedStringValue)
335 if (strlen(fixedStringValue) == 0)
336 fixedStringValue = NULL;
339 description, format_string,
340 type, fixedStringValue));
342 if (PyNumber_Check(fixed_value)) {
343 if (PyLong_Check(fixed_value)) {
344 fixedLongValue = (int32_t)PyLong_AsLong(fixed_value);
348 description, format_string,
350 }
else if (PyInt_Check(fixed_value)) {
351 fixedLongValue = (int32_t)PyInt_AsLong(fixed_value);
355 description, format_string,
357 }
else if (PyFloat_Check(fixed_value)) {
358 fixedDoubleValue = PyFloat_AsDouble(fixed_value);
362 description, format_string,
368 description, format_string,
405 if (!PyArg_ParseTuple(args,
"lsssssslll", &fileIndex, &name , &symbol, &units, &description, &format_string, &group_name, &type, &field_length, &dimensions)) {
406 return PyLong_FromLong(-1);
409 if (strlen(symbol) == 0)
412 if (strlen(units) == 0)
415 if (strlen(description) == 0)
418 if (strlen(format_string) == 0)
419 format_string = NULL;
421 if (strlen(group_name) == 0)
423 return PyLong_FromLong(
SDDS_DefineArray(&
dataset_f[fileIndex], name, symbol, units, description, format_string, type, field_length, dimensions, group_name));
454 if (!PyArg_ParseTuple(args,
"lsssssll", &fileIndex, &name , &symbol, &units, &description, &format_string, &type, &field_length)) {
455 return PyLong_FromLong(-1);
458 if (strlen(symbol) == 0)
461 if (strlen(units) == 0)
464 if (strlen(description) == 0)
467 if (strlen(format_string) == 0)
468 format_string = NULL;
469 return PyLong_FromLong(
SDDS_DefineColumn(&
dataset_f[fileIndex], name, symbol, units, description, format_string, type, field_length));
484 if (!PyArg_ParseTuple(args,
"s", &name)) {
521 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
525 if (strlen(units) == 0)
551 if (!PyArg_ParseTuple(args,
"lssll", &fileIndex, &name, &units, &type, &dimensions)) {
555 if (strlen(units) == 0)
563 return PyLong_FromLong(results);
584 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
588 if (strlen(units) == 0)
605 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
623 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
646 if (!PyArg_ParseTuple(args,
"lsl", &fileIndex, &
string, &mode)) {
666 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &
string)) {
688 if (!PyArg_ParseTuple(args,
"lsl", &fileIndex, &
string, &mode)) {
708 long fileIndexTarget;
709 long fileIndexSource;
712 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &filename, &filemode)) {
716 if (strlen(filename) == 0)
733 long fileIndexTarget;
734 long fileIndexSource;
735 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
753 long fileIndexTarget;
754 long fileIndexSource;
755 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
773 long fileIndexTarget;
774 long fileIndexSource;
775 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
793 long fileIndexTarget;
794 long fileIndexSource;
795 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
813 long fileIndexTarget;
814 long fileIndexSource;
815 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
833 long fileIndexTarget;
834 long fileIndexSource;
835 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
855 long fileIndexTarget;
857 long fileIndexSource;
859 if (!PyArg_ParseTuple(args,
"llll", &fileIndexTarget, &target_row, &fileIndexSource, &source_row)) {
879 long fileIndexTarget;
881 long fileIndexSource;
883 if (!PyArg_ParseTuple(args,
"llll", &fileIndexTarget, &target_row, &fileIndexSource, &source_row)) {
901 long fileIndexTarget;
902 long fileIndexSource;
903 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
921 long fileIndex, mode;
922 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &mode)) {
942 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
960 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
979 long expected_n_rows;
980 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &expected_n_rows)) {
998 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1018 long n_additional_rows;
1019 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &n_additional_rows)) {
1038 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1057 long fileIndex, mode;
1058 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &mode)) {
1079 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &filename)) {
1099 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1121 long sparse_interval;
1123 if (!PyArg_ParseTuple(args,
"lll", &fileIndex, &sparse_interval, &sparse_offset)) {
1145 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &last_rows)) {
1163 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1166 return PyLong_FromLongLong((
long long)SDDS_RowCount(&
dataset_f[fileIndex]));
1183 long column_flag_value;
1184 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &column_flag_value)) {
1204 long row_flag_value;
1205 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &row_flag_value)) {
1226 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &row)) {
1227 return PyLong_FromLong(-1);
1246 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &column_name)) {
1265 char *parameter_name;
1266 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, ¶meter_name)) {
1284 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1302 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1318 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1334 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1350 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1371 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1377 if (!(v = PyList_New(2)))
1380 PyList_SetItem(v, 0, PyString_FromString(text));
1383 PyList_SetItem(v, 0, PyString_FromString(
""));
1386 PyList_SetItem(v, 1, PyString_FromString(contents));
1389 PyList_SetItem(v, 1, PyString_FromString(
""));
1407 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1414 return PyString_FromString(text);
1415 return PyString_FromString(
"");
1431 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1438 return PyString_FromString(contents);
1439 return PyString_FromString(
"");
1479 if (!PyArg_ParseTuple(args,
"s", &error_text)) {
1498 if (!PyArg_ParseTuple(args,
"s", &message)) {
1517 if (!PyArg_ParseTuple(args,
"s", &message)) {
1536 if (!PyArg_ParseTuple(args,
"s", &name)) {
1555 if (!PyArg_ParseTuple(args,
"l", &mode)) {
1576 long fileIndexTarget;
1577 long fileIndexSource;
1580 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1599 long fileIndexTarget;
1600 long fileIndexSource;
1603 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1622 long fileIndexTarget;
1623 long fileIndexSource;
1626 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1645 long fileIndexTarget;
1646 long fileIndexSource;
1649 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1668 long fileIndexTarget;
1669 long fileIndexSource;
1672 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1690 long fileIndexTarget;
1691 long fileIndexSource;
1693 if (!PyArg_ParseTuple(args,
"lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1711 long fileIndexTarget;
1712 long fileIndexSource;
1714 if (!PyArg_ParseTuple(args,
"lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1732 long fileIndexTarget;
1733 long fileIndexSource;
1735 if (!PyArg_ParseTuple(args,
"lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1754 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1755 return PyLong_FromLong(-1);
1773 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1774 return PyLong_FromLong(-1);
1792 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1793 return PyLong_FromLong(-1);
1811 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
1830 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
1849 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1868 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1889 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1894 if (!(v = PyList_New(6)))
1898 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
1900 PyList_SetItem(v, 0, PyString_FromString(
""));
1902 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
1904 PyList_SetItem(v, 1, PyString_FromString(
""));
1905 if (pardef->description)
1906 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
1908 PyList_SetItem(v, 2, PyString_FromString(
""));
1909 if (pardef->format_string)
1910 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
1912 PyList_SetItem(v, 3, PyString_FromString(
""));
1913 PyList_SetItem(v, 4, PyLong_FromLong(pardef->type));
1914 PyList_SetItem(v, 5, PyLong_FromLong(pardef->field_length));
1936 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1941 if (!(v = PyList_New(8)))
1945 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
1947 PyList_SetItem(v, 0, PyString_FromString(
""));
1949 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
1951 PyList_SetItem(v, 1, PyString_FromString(
""));
1952 if (pardef->description)
1953 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
1955 PyList_SetItem(v, 2, PyString_FromString(
""));
1956 if (pardef->format_string)
1957 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
1959 PyList_SetItem(v, 3, PyString_FromString(
""));
1960 if (pardef->group_name)
1961 PyList_SetItem(v, 4, PyString_FromString(pardef->group_name));
1963 PyList_SetItem(v, 4, PyString_FromString(
""));
1964 PyList_SetItem(v, 5, PyLong_FromLong(pardef->type));
1965 PyList_SetItem(v, 6, PyLong_FromLong(pardef->field_length));
1966 PyList_SetItem(v, 7, PyLong_FromLong(pardef->dimensions));
1986 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2005 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
2026 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
2031 if (!(v = PyList_New(6)))
2035 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
2037 PyList_SetItem(v, 0, PyString_FromString(
""));
2039 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
2041 PyList_SetItem(v, 1, PyString_FromString(
""));
2042 if (pardef->description)
2043 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
2045 PyList_SetItem(v, 2, PyString_FromString(
""));
2046 if (pardef->format_string)
2047 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
2049 PyList_SetItem(v, 3, PyString_FromString(
""));
2050 PyList_SetItem(v, 4, PyLong_FromLong(pardef->type));
2051 if (pardef->fixed_value)
2052 PyList_SetItem(v, 5, PyString_FromString(pardef->fixed_value));
2054 PyList_SetItem(v, 5, PyString_FromString(
""));
2072 if (!PyArg_ParseTuple(args,
"l", &type)) {
2073 return PyLong_FromLong(-1);
2091 if (!PyArg_ParseTuple(args,
"l", &type)) {
2096 return PyString_FromString(name);
2097 sprintf(msgbuf,
"sdds.GetTypeName: %ld is an invalid SDDS data type", type);
2098 PyErr_SetString(PyExc_StandardError, msgbuf);
2113 if (!PyArg_ParseTuple(args,
"s", &typeName)) {
2136 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
2137 return PyLong_FromLong(SDDS_CHECK_WRONGTYPE);
2159 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
2160 return PyLong_FromLong(SDDS_CHECK_WRONGTYPE);
2182 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
2183 return PyLong_FromLong(SDDS_CHECK_WRONGTYPE);
2199 if (!PyArg_ParseTuple(args,
"s", &
string)) {
2216 if (!PyArg_ParseTuple(args,
"s", &s)) {
2237 if (!PyArg_ParseTuple(args,
"lsd", &fileIndex, &name, &factor)) {
2258 if (!PyArg_ParseTuple(args,
"lsd", &fileIndex, &name, &factor)) {
2278 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2300 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &newmode)) {
2322 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &caller)) {
2340 if (!PyArg_ParseTuple(args,
"l", &newMode)) {
2366 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2372 if ((index >= 0) && (index < number)) {
2373 v = PyString_FromString(data[index]);
2374 for (i=0;i<number;i++)
2379 for (i=0;i<number;i++)
2404 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2410 if (!(v = PyList_New(number)))
2412 for (index = 0; index < number; index++)
2413 PyList_SetItem(v, index, PyString_FromString(data[index]));
2414 for (i=0;i<number;i++)
2440 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2446 if ((index >= 0) && (index < number)) {
2447 v = PyString_FromString(data[index]);
2448 for (i=0;i<number;i++)
2453 for (i=0;i<number;i++)
2478 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2484 if (!(v = PyList_New(number)))
2486 for (index = 0; index < number; index++)
2487 PyList_SetItem(v, index, PyString_FromString(data[index]));
2488 for (i=0;i<number;i++)
2514 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2520 if ((index >= 0) && (index < number)) {
2521 v = PyString_FromString(data[index]);
2522 for (i=0;i<number;i++)
2527 for (i=0;i<number;i++)
2552 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2558 if (!(v = PyList_New(number)))
2560 for (index = 0; index < number; index++)
2561 PyList_SetItem(v, index, PyString_FromString(data[index]));
2562 for (i=0;i<number;i++)
2584 PyObject *indexOrName;
2588 if (!PyArg_ParseTuple(args,
"lOO", &fileIndex, &indexOrName, &v)) {
2591 if (PyString_Check(indexOrName)) {
2593 }
else if (PyNumber_Check(indexOrName)) {
2594 if (PyInt_Check(indexOrName))
2595 index = PyInt_AsLong(indexOrName);
2596 else if (PyLong_Check(indexOrName))
2597 index = PyLong_AsLong(indexOrName);
2608 if (PyLong_Check(v)) {
2614 if (PyLong_Check(v)) {
2615 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsUnsignedLong(v),-1));
2617 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsUnsignedLong(v),-1));
2620 if (PyLong_Check(v)) {
2621 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsLongLong(v),-1));
2623 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsLongLong(v),-1));
2626 if (PyLong_Check(v)) {
2627 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsUnsignedLongLong(v),-1));
2629 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsUnsignedLongLong(v),-1));
2633 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyFloat_AsDouble(v),-1));
2635 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,(
char)(PyString_AsString(v)[0]),-1));
2637 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyString_AsString(v),-1));
2639 return PyLong_FromLong(0);
2660 PyObject *indexOrName;
2673 int32_t *dimension=NULL;
2675 if (!PyArg_ParseTuple(args,
"lOOO", &fileIndex, &indexOrName, &v, &dim)) {
2678 if (PyString_Check(indexOrName)) {
2682 }
else if (PyNumber_Check(indexOrName)) {
2683 if (PyInt_Check(indexOrName))
2684 index = PyInt_AsLong(indexOrName);
2685 else if (PyLong_Check(indexOrName))
2686 index = PyLong_AsLong(indexOrName);
2692 if (number <= index)
2698 type = arraydef->type;
2699 dimensions = arraydef->dimensions;
2701 if (dimensions != PyList_Size(dim))
2703 dimension = malloc(
sizeof(int32_t)*dimensions);
2705 for (i=0;i<dimensions;i++) {
2706 temp = PyList_GetItem(dim, i);
2707 if (PyInt_Check(temp))
2708 dimension[i] = PyInt_AsLong(temp);
2709 else if (PyLong_Check(temp))
2710 dimension[i] = PyLong_AsLong(temp);
2715 elements = (long)PyList_Size(v);
2718 data = malloc(
sizeof(
short)*elements);
2719 for (i=0;i<elements;i++) {
2720 temp = PyList_GetItem(v, i);
2721 if (PyLong_Check(temp))
2722 ((
short*)data)[i] = (short)PyLong_AsLong(temp);
2724 ((
short*)data)[i] = (short)PyInt_AsLong(temp);
2728 data = malloc(
sizeof(
unsigned short)*elements);
2729 for (i=0;i<elements;i++) {
2730 temp = PyList_GetItem(v, i);
2731 if (PyLong_Check(temp))
2732 ((
unsigned short*)data)[i] = (
unsigned short)PyLong_AsLong(temp);
2734 ((
unsigned short*)data)[i] = (
unsigned short)PyInt_AsLong(temp);
2738 data = malloc(
sizeof(int32_t)*elements);
2739 for (i=0;i<elements;i++) {
2740 temp = PyList_GetItem(v, i);
2741 if (PyLong_Check(temp))
2742 ((int32_t*)data)[i] = (int32_t)PyLong_AsLong(temp);
2744 ((int32_t*)data)[i] = (int32_t)PyInt_AsLong(temp);
2748 data = malloc(
sizeof(uint32_t)*elements);
2749 for (i=0;i<elements;i++) {
2750 temp = PyList_GetItem(v, i);
2751 if (PyLong_Check(temp))
2752 ((uint32_t*)data)[i] = (uint32_t)PyLong_AsUnsignedLong(temp);
2754 ((uint32_t*)data)[i] = (uint32_t)PyInt_AsUnsignedLong(temp);
2758 data = malloc(
sizeof(int64_t)*elements);
2759 for (i=0;i<elements;i++) {
2760 temp = PyList_GetItem(v, i);
2761 if (PyLong_Check(temp))
2762 ((int64_t*)data)[i] = (int64_t)PyLong_AsLongLong(temp);
2764 ((int64_t*)data)[i] = (int64_t)PyInt_AsLongLong(temp);
2768 data = malloc(
sizeof(uint64_t)*elements);
2769 for (i=0;i<elements;i++) {
2770 temp = PyList_GetItem(v, i);
2771 if (PyLong_Check(temp))
2772 ((uint64_t*)data)[i] = (uint64_t)PyLong_AsUnsignedLongLong(temp);
2774 ((uint64_t*)data)[i] = (uint64_t)PyInt_AsUnsignedLongLong(temp);
2778 data = malloc(
sizeof(
float)*elements);
2779 for (i=0;i<elements;i++)
2780 ((
float*)data)[i] = (float)PyFloat_AsDouble(PyList_GetItem(v, i));
2783 data = malloc(
sizeof(
double)*elements);
2784 for (i=0;i<elements;i++)
2785 ((
double*)data)[i] = (double)PyFloat_AsDouble(PyList_GetItem(v, i));
2788 data = malloc(
sizeof(
char)*elements);
2789 for (i=0;i<elements;i++)
2790 ((
char*)data)[i] = (char)(PyString_AsString(PyList_GetItem(v, i))[0]);
2793 data = malloc(
sizeof(
char*)*elements);
2794 for (i=0;i<elements;i++)
2795 SDDS_CopyString(((
char**)data)+i, PyString_AsString(PyList_GetItem(v, i)));
2798 if (PyString_Check(indexOrName)) {
2799 result =
SDDS_SetArray(&
dataset_f[fileIndex],(
char*)PyString_AsString(indexOrName),SDDS_CONTIGUOUS_DATA,data,dimension);
2802 for (i=0;i<number;i++)
2811 free((
unsigned short*)data);
2814 free((int32_t*)data);
2817 free((uint32_t*)data);
2820 free((int64_t*)data);
2823 free((uint64_t*)data);
2829 free((
double*)data);
2835 for (i=0;i<elements;i++)
2836 free(((
char**)data)[i]);
2840 if (dimension) free(dimension);
2841 return PyLong_FromLong(result);
2861 PyObject *indexOrName;
2869 if (!PyArg_ParseTuple(args,
"lOO", &fileIndex, &indexOrName, &v)) {
2872 if (PyString_Check(indexOrName)) {
2874 }
else if (PyNumber_Check(indexOrName)) {
2875 if (PyInt_Check(indexOrName))
2876 index = PyInt_AsLong(indexOrName);
2877 else if (PyLong_Check(indexOrName))
2878 index = PyLong_AsLong(indexOrName);
2885 rows = (long)PyList_Size(v);
2888 data = malloc(
sizeof(
short)*rows);
2889 for (i=0;i<rows;i++) {
2890 temp = PyList_GetItem(v, i);
2891 if (PyLong_Check(temp))
2892 ((
short*)data)[i] = (short)PyLong_AsLong(temp);
2894 ((
short*)data)[i] = (short)PyInt_AsLong(temp);
2898 data = malloc(
sizeof(
unsigned short)*rows);
2899 for (i=0;i<rows;i++) {
2900 temp = PyList_GetItem(v, i);
2901 if (PyLong_Check(temp))
2902 ((
unsigned short*)data)[i] = (
unsigned short)PyLong_AsLong(temp);
2904 ((
unsigned short*)data)[i] = (
unsigned short)PyInt_AsLong(temp);
2908 data = malloc(
sizeof(int32_t)*rows);
2909 for (i=0;i<rows;i++) {
2910 temp = PyList_GetItem(v, i);
2911 if (PyLong_Check(temp))
2912 ((int32_t*)data)[i] = (int32_t)PyLong_AsLong(temp);
2914 ((int32_t*)data)[i] = (int32_t)PyInt_AsLong(temp);
2918 data = malloc(
sizeof(uint32_t)*rows);
2919 for (i=0;i<rows;i++) {
2920 temp = PyList_GetItem(v, i);
2921 if (PyLong_Check(temp))
2922 ((uint32_t*)data)[i] = (uint32_t)PyLong_AsUnsignedLong(temp);
2924 ((uint32_t*)data)[i] = (uint32_t)PyInt_AsUnsignedLong(temp);
2928 data = malloc(
sizeof(int64_t)*rows);
2929 for (i=0;i<rows;i++) {
2930 temp = PyList_GetItem(v, i);
2931 if (PyLong_Check(temp))
2932 ((int64_t*)data)[i] = (int64_t)PyLong_AsLongLong(temp);
2934 ((int64_t*)data)[i] = (int64_t)PyInt_AsLongLong(temp);
2938 data = malloc(
sizeof(uint64_t)*rows);
2939 for (i=0;i<rows;i++) {
2940 temp = PyList_GetItem(v, i);
2941 if (PyLong_Check(temp))
2942 ((uint64_t*)data)[i] = (uint64_t)PyLong_AsUnsignedLongLong(temp);
2944 ((uint64_t*)data)[i] = (uint64_t)PyInt_AsUnsignedLongLong(temp);
2948 data = malloc(
sizeof(
float)*rows);
2949 for (i=0;i<rows;i++)
2950 ((
float*)data)[i] = (float)PyFloat_AsDouble(PyList_GetItem(v, i));
2953 data = malloc(
sizeof(
double)*rows);
2954 for (i=0;i<rows;i++)
2955 ((
double*)data)[i] = (double)PyFloat_AsDouble(PyList_GetItem(v, i));
2958 data = malloc(
sizeof(
char)*rows);
2959 for (i=0;i<rows;i++)
2960 ((
char*)data)[i] = (char)(PyString_AsString(PyList_GetItem(v, i))[0]);
2963 data = malloc(
sizeof(
char*)*rows);
2964 for (i=0;i<rows;i++)
2965 SDDS_CopyString(((
char**)data)+i, PyString_AsString(PyList_GetItem(v, i)));
2974 free((
unsigned short*)data);
2977 free((int32_t*)data);
2980 free((uint32_t*)data);
2983 free((int64_t*)data);
2986 free((uint64_t*)data);
2992 free((
double*)data);
2998 for (i=0;i<rows;i++)
2999 free(((
char**)data)[i]);
3003 return PyLong_FromLong(result);
3028 if (!PyArg_ParseTuple(args,
"llO", &fileIndex, &row, &v)) {
3031 elements = (long)PyList_Size(v);
3032 for (i=0; i<elements; i=i+2) {
3034 temp = PyList_GetItem(v, i+1);
3041 if (PyLong_Check(temp)) {
3050 if (PyLong_Check(temp)) {
3051 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsUnsignedLong(temp),-1) == 0)
3054 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsUnsignedLong(temp),-1) == 0)
3059 if (PyLong_Check(temp)) {
3068 if (PyLong_Check(temp)) {
3069 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsUnsignedLongLong(temp),-1) == 0)
3072 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsUnsignedLongLong(temp),-1) == 0)
3082 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,(
char)(PyString_AsString(temp)[0]),-1) == 0)
3091 return PyLong_FromLong(1);
3109 PyObject *indexOrName;
3119 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3122 if (PyString_Check(indexOrName)) {
3124 }
else if (PyNumber_Check(indexOrName)) {
3125 if (PyInt_Check(indexOrName))
3126 index = PyInt_AsLong(indexOrName);
3127 else if (PyLong_Check(indexOrName))
3128 index = PyLong_AsLong(indexOrName);
3137 if ((index >= 0) && (index < number)) {
3143 rows = SDDS_RowCount(&(
dataset_f[fileIndex]));
3153 for (i=0;i<number;i++)
3160 if (!(v = PyList_New(rows)))
3163 switch (originalType) {
3165 for (i=0;i < rows;i++) {
3166 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
short*)columnValue)[i])));
3168 free((
short*)columnValue);
3171 for (i=0;i < rows;i++) {
3172 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
unsigned short*)columnValue)[i])));
3174 free((
unsigned short*)columnValue);
3177 for (i=0;i < rows;i++) {
3178 PyList_SetItem(v, i, PyLong_FromLong((
long)(((int32_t*)columnValue)[i])));
3180 free((int32_t*)columnValue);
3183 for (i=0;i < rows;i++) {
3184 PyList_SetItem(v, i, PyLong_FromUnsignedLong((
unsigned long)(((uint32_t*)columnValue)[i])));
3186 free((uint32_t*)columnValue);
3189 for (i=0;i < rows;i++) {
3190 PyList_SetItem(v, i, PyLong_FromLongLong((
long long)(((int64_t*)columnValue)[i])));
3192 free((int64_t*)columnValue);
3195 for (i=0;i < rows;i++) {
3196 PyList_SetItem(v, i, PyLong_FromUnsignedLongLong((
unsigned long long)(((uint64_t*)columnValue)[i])));
3198 free((uint64_t*)columnValue);
3201 for (i=0;i < rows;i++) {
3202 sprintf(buffer,
"%.6E", ((
float*)columnValue)[i]);
3203 PyList_SetItem(v, i, PyFloat_FromDouble(atof(buffer)));
3205 free((
float*)columnValue);
3208 for (i=0;i < rows;i++) {
3209 PyList_SetItem(v, i, PyFloat_FromDouble(((
double*)columnValue)[i]));
3211 free((
double*)columnValue);
3214 for (i=0;i < rows;i++) {
3215 sprintf(buffer,
"%c", ((
char*)columnValue)[i]);
3216 PyList_SetItem(v, i, PyString_FromString(buffer));
3218 free((
char*)columnValue);
3221 for (i=0;i < rows;i++) {
3222 PyList_SetItem(v, i, PyString_FromString(((
char**)columnValue)[i]));
3224 for (i=0;i < rows;i++)
3225 free(((
char**)columnValue)[i]);
3226 free((
char**)columnValue);
3249 PyObject *indexOrName;
3250 long originalType, i, elements;
3258 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3261 if (PyString_Check(indexOrName)) {
3263 }
else if (PyNumber_Check(indexOrName)) {
3264 if (PyInt_Check(indexOrName))
3265 index = PyInt_AsLong(indexOrName);
3266 else if (PyLong_Check(indexOrName))
3267 index = PyLong_AsLong(indexOrName);
3276 if ((index >= 0) && (index < number)) {
3284 for (i=0;i<number;i++)
3288 originalType = arrayValue->definition->type;
3293 elements = arrayValue->elements;
3303 if (!(v = PyList_New(arrayValue->elements)))
3306 switch (originalType) {
3308 for (i=0;i < elements;i++) {
3309 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
short*)arrayValue->data)[i])));
3313 for (i=0;i < elements;i++) {
3314 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
unsigned short*)arrayValue->data)[i])));
3318 for (i=0;i < elements;i++) {
3319 PyList_SetItem(v, i, PyLong_FromLong((
long)(((int32_t*)arrayValue->data)[i])));
3323 for (i=0;i < elements;i++) {
3324 PyList_SetItem(v, i, PyLong_FromUnsignedLong((
unsigned long)(((uint32_t*)arrayValue->data)[i])));
3328 for (i=0;i < elements;i++) {
3329 PyList_SetItem(v, i, PyLong_FromLongLong((
long long)(((int64_t*)arrayValue->data)[i])));
3333 for (i=0;i < elements;i++) {
3334 PyList_SetItem(v, i, PyLong_FromUnsignedLongLong((
unsigned long long)(((uint64_t*)arrayValue->data)[i])));
3338 for (i=0;i < elements;i++) {
3339 sprintf(buffer,
"%.6E", ((
float*)arrayValue->data)[i]);
3340 PyList_SetItem(v, i, PyFloat_FromDouble(atof(buffer)));
3344 for (i=0;i < elements;i++) {
3345 PyList_SetItem(v, i, PyFloat_FromDouble(((
double*)arrayValue->data)[i]));
3349 for (i=0;i < elements;i++) {
3350 sprintf(buffer,
"%c", ((
char*)arrayValue->data)[i]);
3351 PyList_SetItem(v, i, PyString_FromString(buffer));
3355 for (i=0;i < elements;i++) {
3356 PyList_SetItem(v, i, PyString_FromString(((
char**)arrayValue->data)[i]));
3381 PyObject *indexOrName;
3389 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3392 if (PyString_Check(indexOrName)) {
3394 }
else if (PyNumber_Check(indexOrName)) {
3395 if (PyInt_Check(indexOrName))
3396 index = PyInt_AsLong(indexOrName);
3397 else if (PyLong_Check(indexOrName))
3398 index = PyLong_AsLong(indexOrName);
3407 if ((index >= 0) && (index < number)) {
3415 for (i=0;i<number;i++)
3422 if (!(v = PyList_New(arrayValue->definition->dimensions)))
3424 for (i=0;i<arrayValue->definition->dimensions;i++) {
3425 PyList_SetItem(v, i, PyLong_FromLong(arrayValue->dimension[i]));
3446 PyObject *indexOrName;
3448 void *parameterValue;
3456 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3459 if (PyString_Check(indexOrName)) {
3461 }
else if (PyNumber_Check(indexOrName)) {
3462 if (PyInt_Check(indexOrName))
3463 index = PyInt_AsLong(indexOrName);
3464 else if (PyLong_Check(indexOrName))
3465 index = PyLong_AsLong(indexOrName);
3474 if ((index >= 0) && (index < number)) {
3485 for (i=0;i<number;i++)
3489 if (!(parameterValue)) {
3494 switch (originalType) {
3496 v = PyLong_FromLong((
long)(((
short*)parameterValue)[0]));
3497 free((
short*)parameterValue);
3500 v = PyLong_FromLong((
long)(((
unsigned short*)parameterValue)[0]));
3501 free((
unsigned short*)parameterValue);
3504 v = PyLong_FromLong((
long)(((int32_t*)parameterValue)[0]));
3505 free((int32_t*)parameterValue);
3508 v = PyLong_FromUnsignedLong((
unsigned long)(((uint32_t*)parameterValue)[0]));
3509 free((uint32_t*)parameterValue);
3512 v = PyLong_FromLongLong((
long long)(((int64_t*)parameterValue)[0]));
3513 free((int64_t*)parameterValue);
3516 v = PyLong_FromUnsignedLongLong((
unsigned long long)(((uint64_t*)parameterValue)[0]));
3517 free((uint64_t*)parameterValue);
3520 sprintf(buffer,
"%.6E", ((
float*)parameterValue)[0]);
3521 v = PyFloat_FromDouble(atof(buffer));
3522 free((
float*)parameterValue);
3525 v = PyFloat_FromDouble(((
double*)parameterValue)[0]);
3526 free((
double*)parameterValue);
3529 sprintf(buffer,
"%c", ((
char*)parameterValue)[0]);
3530 v = PyString_FromString(buffer);
3531 free((
char*)parameterValue);
3534 v = PyString_FromString(((
char**)parameterValue)[0]);
3535 free(((
char**)parameterValue)[0]);
3536 free((
char**)parameterValue);
3555 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
3558 return PyLong_FromLong(
dataset_f[fileIndex].layout.data_mode.mode);
3565#if PY_MAJOR_VERSION >= 3
3566#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
3568#define GETSTATE(m) (&_state)
3572static PyMethodDef sddsdata_methods[] = {
3692#if PY_MAJOR_VERSION >= 3
3694 __declspec(dllexport) PyObject* PyInit_sddsdata(
void);
3698 __declspec(dllexport)
void initsddsdata(
void);
3702#if PY_MAJOR_VERSION >= 3
3703static int sddsdata_traverse(PyObject *m, visitproc visit,
void *arg) {
3704 Py_VISIT(GETSTATE(m)->error);
3707static int sddsdata_clear(PyObject *m) {
3708 Py_CLEAR(GETSTATE(m)->error);
3711static struct PyModuleDef moduledef = {
3712 PyModuleDef_HEAD_INIT,
3722#define INITERROR return NULL
3724#define INITERROR return
3727#if PY_MAJOR_VERSION >= 3
3729PyMODINIT_FUNC PyInit_sddsdata(
void)
3731void initsddsdata(
void)
3735#if PY_MAJOR_VERSION >= 3
3736 PyObject *module = PyModule_Create(&moduledef);
3738 PyObject *module = Py_InitModule(
"sddsdata", sddsdata_methods );
3743 st = GETSTATE(module);
3745 st->error = PyErr_NewException(
"sddsedir.Error", NULL, NULL);
3746 if (st->error == NULL) {
3751#if PY_MAJOR_VERSION >= 3
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
void SDDS_DeferSavingLayout(SDDS_DATASET *SDDS_dataset, int32_t mode)
int32_t SDDS_CopyLayout(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyColumns(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyParameters(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_SaveLayout(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_AppendLayout(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
int32_t SDDS_InitializeCopy(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, char *filename, char *filemode)
int32_t SDDS_CopyAdditionalRows(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyRowDirect(SDDS_DATASET *SDDS_target, int64_t target_row, SDDS_DATASET *SDDS_source, int64_t source_row)
int32_t SDDS_CopyPage(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyArrays(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyRow(SDDS_DATASET *SDDS_target, int64_t target_row, SDDS_DATASET *SDDS_source, int64_t source_srow)
int32_t SDDS_RestoreLayout(SDDS_DATASET *SDDS_dataset)
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_SetColumn(SDDS_DATASET *SDDS_dataset, int32_t mode, void *data, int64_t rows,...)
Sets the values for one data column in the current data table of an SDDS dataset.
int32_t SDDS_SetArray(SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer, int32_t *dimension)
Sets the values of an array variable in the SDDS dataset using specified dimensions.
int32_t SDDS_DefineParameter1(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, void *fixed_value)
Defines a data parameter with a fixed numerical value.
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_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_EraseData(SDDS_DATASET *SDDS_dataset)
Erases all data entries in 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_SetRowCountMode(SDDS_DATASET *SDDS_dataset, uint32_t mode)
Sets the row count mode for the SDDS dataset.
int32_t SDDS_DefineArray(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, int32_t dimensions, const char *group_name)
Defines a data array within the SDDS dataset.
int32_t SDDS_UpdatePage(SDDS_DATASET *SDDS_dataset, uint32_t mode)
Updates the current page of the SDDS dataset.
int32_t SDDS_SetNameValidityFlags(uint32_t flags)
Sets the validity flags for parameter and column names in 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_IsValidName(const char *name, const char *class)
Checks if a given name is valid for a specified class within the SDDS dataset.
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_ProcessParameterString(SDDS_DATASET *SDDS_dataset, char *string, int32_t mode)
Process a parameter definition string.
int32_t SDDS_ProcessColumnString(SDDS_DATASET *SDDS_dataset, char *string, int32_t mode)
Process a column definition string.
int32_t SDDS_ProcessArrayString(SDDS_DATASET *SDDS_dataset, char *string)
Process an array definition string.
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_TransferAllArrayDefinitions(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Transfers all array definitions from a source dataset to a target dataset.
int32_t SDDS_TransferAllParameterDefinitions(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Transfers all parameter definitions from a source dataset to a target dataset.
int32_t SDDS_DefineParameterLikeColumn(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Defines a parameter in the target dataset based on a column definition from the source 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.
int32_t SDDS_TransferAllColumnDefinitions(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Transfers all column definitions from a source dataset to a target dataset.
void SDDS_FreeArray(SDDS_ARRAY *array)
Frees memory allocated for an SDDS array structure.
int32_t SDDS_CheckArray(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if an array exists in the SDDS dataset with the specified name, units, and type.
int32_t SDDS_GetNamedArrayType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of an array in the SDDS dataset by its name.
uint32_t SDDS_SetAutoCheckMode(uint32_t newMode)
Sets the automatic check mode for SDDS dataset validation.
int32_t SDDS_GetNamedColumnType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of a column in the SDDS dataset by its name.
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_GetNamedParameterType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of a parameter in the SDDS dataset by its name.
int32_t SDDS_SetDataMode(SDDS_DATASET *SDDS_dataset, int32_t newmode)
Sets the data mode (ASCII or Binary) for the SDDS dataset.
ARRAY_DEFINITION * SDDS_GetArrayDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified array from the SDDS dataset.
int32_t SDDS_FreeArrayDefinition(ARRAY_DEFINITION *source)
Frees memory allocated for an array definition.
int32_t SDDS_GetArrayIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named array in the SDDS dataset.
PARAMETER_DEFINITION * SDDS_GetParameterDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified parameter from the SDDS dataset.
int32_t SDDS_ParameterCount(SDDS_DATASET *page)
Retrieves the number of parameters in the SDDS dataset.
int32_t SDDS_FreeParameterDefinition(PARAMETER_DEFINITION *source)
Frees memory allocated for a parameter definition.
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_SprintTypedValue(void *data, int64_t index, int32_t type, const char *format, char *buffer, uint32_t mode)
Formats a data value of a specified type into a string buffer using an optional printf format string.
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_GetTypeName(int32_t type)
Retrieves the name of a specified SDDS data type as a string.
int32_t SDDS_CheckColumn(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if a column exists in the SDDS dataset with the specified name, units, and type.
char ** SDDS_GetColumnNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all columns in the SDDS dataset.
int32_t SDDS_GetArrayType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of an array in the SDDS dataset by its index.
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.
int32_t SDDS_DeleteParameterFixedValues(SDDS_DATASET *SDDS_dataset)
Deletes fixed values from all parameters in the SDDS dataset.
void SDDS_ClearErrors()
Clears all recorded error messages from the SDDS error stack.
int32_t SDDS_ApplyFactorToColumn(SDDS_DATASET *SDDS_dataset, char *name, double factor)
Applies a scaling factor to all elements of a specific column 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_IdentifyType(char *typeName)
Identifies the SDDS data type based on its string name.
int32_t SDDS_ArrayCount(SDDS_DATASET *page)
Retrieves the number of arrays in the SDDS dataset.
int32_t SDDS_GetTypeSize(int32_t type)
Retrieves the size in bytes of a specified SDDS data type.
int32_t SDDS_StringIsBlank(char *s)
Checks if a string is blank (contains only whitespace characters).
int32_t SDDS_ApplyFactorToParameter(SDDS_DATASET *SDDS_dataset, char *name, double factor)
Applies a scaling factor to a specific parameter in the SDDS dataset.
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.
int32_t SDDS_CheckParameter(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if a parameter exists in the SDDS dataset with the specified name, units, and type.
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_HasWhitespace(char *string)
Checks if a string contains any whitespace characters.
void SDDS_Warning(char *message)
Prints a warning message to stderr.
int32_t SDDS_FreeColumnDefinition(COLUMN_DEFINITION *source)
Frees memory allocated for a column definition.
COLUMN_DEFINITION * SDDS_GetColumnDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified column from the SDDS dataset.
#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.
static PyObject * sddsdata_GetMode(PyObject *self, PyObject *args)
Retrieves the data mode of a dataset.
static PyObject * sddsdata_GetArrayNames(PyObject *self, PyObject *args)
Retrieves all array names from a dataset.
static PyObject * sddsdata_ApplyFactorToColumn(PyObject *self, PyObject *args)
Applies a scaling factor to a column in a dataset.
static PyObject * sddsdata_GetNamedColumnType(PyObject *self, PyObject *args)
Retrieves the type of a column by name in a dataset.
static PyObject * sddsdata_CopyRow(PyObject *self, PyObject *args)
Copies a row from one SDDS dataset to another.
static PyObject * sddsdata_SetArray(PyObject *self, PyObject *args)
Sets an array value in a dataset.
static PyObject * sddsdata_GetDescriptionText(PyObject *self, PyObject *args)
Retrieves the description text for a dataset.
static PyObject * sddsdata_ProcessColumnString(PyObject *self, PyObject *args)
Processes a column definition string.
static PyObject * sddsdata_EraseData(PyObject *self, PyObject *args)
Erases data from an SDDS dataset.
static PyObject * sddsdata_GetParameter(PyObject *self, PyObject *args)
Retrieves the value of a parameter from a dataset.
SDDS_DATASET dataset_f[20]
Array of SDDS dataset structures.
static PyObject * sddsdata_DeleteUnsetRows(PyObject *self, PyObject *args)
Deletes all unset rows in the dataset.
static PyObject * sddsdata_EnableFSync(PyObject *self, PyObject *args)
Enables filesystem synchronization (fsync) for an SDDS dataset.
static PyObject * sddsdata_GetColumnIndex(PyObject *self, PyObject *args)
Retrieves the index of a column in a dataset.
static PyObject * sddsdata_CopyArrays(PyObject *self, PyObject *args)
Copies arrays from one SDDS dataset to another.
static PyObject * sddsdata_InitializeCopy(PyObject *self, PyObject *args)
Initializes a copy from one SDDS dataset to another.
static PyObject * sddsdata_ProcessParameterString(PyObject *self, PyObject *args)
Processes a parameter definition string.
static PyObject * sddsdata_SetRowMajorOrder(PyObject *self, PyObject *args)
Sets the data order for the SDDS dataset to row-major.
static PyObject * sddsdata_ProcessArrayString(PyObject *self, PyObject *args)
Processes an array definition string.
static PyObject * sddsdata_HasWhitespace(PyObject *self, PyObject *args)
Determines if a string contains whitespace.
static PyObject * sddsdata_GetColumnNames(PyObject *self, PyObject *args)
Retrieves all column names from a dataset.
static PyObject * sddsdata_GetRowFlag(PyObject *self, PyObject *args)
Gets the flag value for a specific row in the dataset.
static PyObject * sddsdata_GetColumn(PyObject *self, PyObject *args)
Retrieves a column's data from a dataset.
static PyObject * sddsdata_TransferArrayDefinition(PyObject *self, PyObject *args)
Transfers an array definition from one dataset to another.
static PyObject * sddsdata_GetParameterNames(PyObject *self, PyObject *args)
Retrieves all parameter names from a dataset.
static PyObject * sddsdata_SetNameValidityFlags(PyObject *self, PyObject *args)
Sets name validity flags to allow any name.
static PyObject * sddsdata_TransferAllParameterDefinitions(PyObject *self, PyObject *args)
Transfers all parameter definitions from one dataset to another.
static PyObject * sddsdata_GetColumnDefinition(PyObject *self, PyObject *args)
Retrieves the definition of a column in a dataset.
static PyObject * sddsdata_GetNamedArrayType(PyObject *self, PyObject *args)
Retrieves the type of an array by name in a dataset.
static PyObject * sddsdata_GetDescription(PyObject *self, PyObject *args)
Gets the description (text and contents) of the dataset.
static PyObject * sddsdata_LengthenTable(PyObject *self, PyObject *args)
Lengthens the table by adding additional rows.
static PyObject * sddsdata_SetRowFlags(PyObject *self, PyObject *args)
Sets the row flags for the dataset.
static PyObject * sddsdata_CheckColumn(PyObject *self, PyObject *args)
Verifies the existence and type of a column in a dataset.
static PyObject * sddsdata_GetParameterNameFromIndex(PyObject *self, PyObject *args)
Retrieves a parameter name by its index from a dataset.
static PyObject * sddsdata_StartPage(PyObject *self, PyObject *args)
Starts a page in an SDDS dataset.
static PyObject * sddsdata_GetNamedParameterType(PyObject *self, PyObject *args)
Retrieves the type of a parameter by name in a dataset.
static PyObject * sddsdata_DefineSimpleParameter(PyObject *self, PyObject *args)
Defines a simple parameter in an SDDS dataset.
static PyObject * sddsdata_CopyLayout(PyObject *self, PyObject *args)
Copies the layout from one SDDS dataset to another.
static PyObject * sddsdata_InitializeInput(PyObject *self, PyObject *args)
Initializes an SDDS dataset for input from a file.
static PyObject * sddsdata_NumberOfErrors(PyObject *self, PyObject *args)
Returns the number of errors recorded.
static PyObject * sddsdata_SetParameter(PyObject *self, PyObject *args)
Sets a parameter value in a dataset by index or name.
static PyObject * sddsdata_InitializeAppend(PyObject *self, PyObject *args)
Initializes an SDDS dataset for appending data to a file.
static PyObject * sddsdata_DisableFSync(PyObject *self, PyObject *args)
Disables filesystem synchronization (fsync) for an SDDS dataset.
static PyObject * sddsdata_DefineParameterLikeColumn(PyObject *self, PyObject *args)
Defines a parameter in one dataset based on a column in another dataset.
static PyObject * sddsdata_ApplyFactorToParameter(PyObject *self, PyObject *args)
Applies a scaling factor to a parameter in a dataset.
static PyObject * sddsdata_SaveLayout(PyObject *self, PyObject *args)
Saves the layout of an SDDS dataset.
static PyObject * sddsdata_SetFixedRowCountMode(PyObject *self, PyObject *args)
Sets the row count mode for an SDDS dataset to fixed row count mode.
static PyObject * sddsdata_DeferSavingLayout(PyObject *self, PyObject *args)
Defers saving the layout of an SDDS dataset.
static PyObject * sddsdata_RestoreLayout(PyObject *self, PyObject *args)
Restores the layout of an SDDS dataset.
static PyObject * sddsdata_InitHeaderlessInput(PyObject *self, PyObject *args)
Initializes a headerless input for a dataset file.
static PyObject * sddsdata_ReadPageLastRows(PyObject *self, PyObject *args)
Reads the last rows of the current page from the dataset file.
static PyObject * sddsdata_Warning(PyObject *self, PyObject *args)
Displays a warning message on stderr.
static PyObject * sddsdata_TransferColumnDefinition(PyObject *self, PyObject *args)
Transfers a column definition from one dataset to another.
static PyObject * sddsdata_DeleteUnsetColumns(PyObject *self, PyObject *args)
Deletes all unset columns in the dataset.
static PyObject * sddsdata_CheckArray(PyObject *self, PyObject *args)
Verifies the existence and type of an array in a dataset.
static PyObject * sddsdata_SetColumnFlags(PyObject *self, PyObject *args)
Sets the column flags for the dataset.
static PyObject * sddsdata_GetArrayNameFromIndex(PyObject *self, PyObject *args)
Retrieves an array name by its index from a dataset.
static PyObject * sddsdata_SetTerminateMode(PyObject *self, PyObject *args)
Sets the termination mode for SDDS to avoid freeing strings in arrays and tables.
static PyObject * sddsdata_RowCount(PyObject *self, PyObject *args)
Gets the number of rows in the dataset.
static PyObject * sddsdata_ParameterCount(PyObject *self, PyObject *args)
Gets the count of parameters in the dataset.
static PyObject * sddsdata_GetParameterIndex(PyObject *self, PyObject *args)
Retrieves the index of a parameter in a dataset.
static PyObject * sddsdata_ReadPage(PyObject *self, PyObject *args)
Reads the current page from the dataset file.
static PyObject * sddsdata_DefineSimpleArray(PyObject *self, PyObject *args)
Defines a simple array in an SDDS dataset.
static PyObject * sddsdata_SetColumnMajorOrder(PyObject *self, PyObject *args)
Sets the data order for the SDDS dataset to column-major.
static PyObject * sddsdata_WritePage(PyObject *self, PyObject *args)
Writes the current page of the dataset to the file.
static PyObject * sddsdata_GetArray(PyObject *self, PyObject *args)
Retrieves an array's data from a dataset.
static PyObject * sddsdata_DeleteParameter(PyObject *self, PyObject *args)
Deletes a parameter from the dataset.
static PyObject * sddsdata_RegisterProgramName(PyObject *self, PyObject *args)
Registers a program name for use in error messages.
static PyObject * sddsdata_ClearPage(PyObject *self, PyObject *args)
Clears the current page in an SDDS dataset.
static PyObject * sddsdata_DeleteColumn(PyObject *self, PyObject *args)
Deletes a column from the dataset.
static PyObject * sddsdata_GetArrayType(PyObject *self, PyObject *args)
Retrieves the type of an array in a dataset.
static PyObject * sddsdata_SetColumn(PyObject *self, PyObject *args)
Sets a column value in a dataset.
static PyObject * sddsdata_AppendLayout(PyObject *self, PyObject *args)
Appends the layout of one SDDS dataset to another.
static PyObject * sddsdata_CopyPage(PyObject *self, PyObject *args)
Copies a page from one SDDS dataset to another.
static PyObject * sddsdata_ReadPageSparse(PyObject *self, PyObject *args)
Reads a sparse page from the dataset file.
static PyObject * sddsdata_CheckParameter(PyObject *self, PyObject *args)
Verifies the existence and type of a parameter in a dataset.
static PyObject * sddsdata_StringIsBlank(PyObject *self, PyObject *args)
Checks if a string is blank.
static PyObject * sddsdata_IdentifyType(PyObject *self, PyObject *args)
Identifies the SDDS data type for a given type name.
static PyObject * sddsdata_CopyRowDirect(PyObject *self, PyObject *args)
Directly copies a row from one SDDS dataset to another.
static PyObject * sddsdata_SetError(PyObject *self, PyObject *args)
Sets an error description.
static PyObject * sddsdata_GetTypeSize(PyObject *self, PyObject *args)
Retrieves the size of a given SDDS data type.
static PyObject * sddsdata_CopyAdditionalRows(PyObject *self, PyObject *args)
Copies additional rows from one SDDS dataset to another.
static PyObject * sddsdata_GetColumnNameFromIndex(PyObject *self, PyObject *args)
Retrieves a column name by its index from a dataset.
static PyObject * sddsdata_TransferParameterDefinition(PyObject *self, PyObject *args)
Transfers a parameter definition from one dataset to another.
static PyObject * sddsdata_GetArrayIndex(PyObject *self, PyObject *args)
Retrieves the index of an array in a dataset.
static PyObject * sddsdata_GetParameterType(PyObject *self, PyObject *args)
Retrieves the type of a parameter in a dataset.
static PyObject * sddsdata_SetDataMode(PyObject *self, PyObject *args)
Sets the data mode for a given dataset.
static PyObject * sddsdata_Bomb(PyObject *self, PyObject *args)
Displays a message on stderr and exits the program.
static PyObject * sddsdata_ArrayCount(PyObject *self, PyObject *args)
Gets the count of arrays in the dataset.
static PyObject * sddsdata_DefineColumn(PyObject *self, PyObject *args)
Defines a column in an SDDS dataset.
static PyObject * sddsdata_ColumnCount(PyObject *self, PyObject *args)
Gets the count of columns in the dataset.
static PyObject * sddsdata_DefineParameter(PyObject *self, PyObject *args)
Defines a parameter in an SDDS dataset.
static PyObject * sddsdata_SetRowValues(PyObject *self, PyObject *args)
Sets values for a specific row in a dataset.
static PyObject * sddsdata_GetArrayDefinition(PyObject *self, PyObject *args)
Retrieves the definition of an array in a dataset.
static PyObject * sddsdata_CopyParameters(PyObject *self, PyObject *args)
Copies parameters from one SDDS dataset to another.
static PyObject * sddsdata_DefineSimpleColumn(PyObject *self, PyObject *args)
Defines a simple column in an SDDS dataset.
static PyObject * sddsdata_GetArrayDimensions(PyObject *self, PyObject *args)
Retrieves the dimensions of an array in a dataset.
static PyObject * sddsdata_DefineArray(PyObject *self, PyObject *args)
Defines an array in an SDDS dataset.
static PyObject * sddsdata_CheckDataset(PyObject *self, PyObject *args)
Checks the validity of a dataset.
static PyObject * sddsdata_TransferAllArrayDefinitions(PyObject *self, PyObject *args)
Transfers all array definitions from one dataset to another.
static PyObject * sddsdata_PrintErrors(PyObject *self, PyObject *args)
Prints error messages based on the provided mode.
static PyObject * sddsdata_InitializeOutput(PyObject *self, PyObject *args)
Initializes an SDDS dataset for output to a file.
static PyObject * sddsdata_SetAutoCheckMode(PyObject *self, PyObject *args)
Sets the auto-check mode for datasets.
static PyObject * sddsdata_CopyColumns(PyObject *self, PyObject *args)
Copies columns from one SDDS dataset to another.
static PyObject * sddsdata_UpdatePage(PyObject *self, PyObject *args)
Updates the page based on the specified mode.
static PyObject * sddsdata_TransferAllColumnDefinitions(PyObject *self, PyObject *args)
Transfers all column definitions from one dataset to another.
static PyObject * sddsdata_WriteLayout(PyObject *self, PyObject *args)
Writes the layout of an SDDS dataset.
static PyObject * sddsdata_InitializeAppendToPage(PyObject *self, PyObject *args)
Initializes appending data to an existing SDDS page in a file.
static PyObject * sddsdata_DefineColumnLikeParameter(PyObject *self, PyObject *args)
Defines a column in one dataset based on a parameter in another dataset.
static PyObject * sddsdata_ClearErrors(PyObject *self, PyObject *args)
Clears all recorded errors.
static PyObject * sddsdata_IsValidName(PyObject *self, PyObject *args)
Validates a name for SDDS compatibility.
static PyObject * sddsdata_DeleteParameterFixedValues(PyObject *self, PyObject *args)
Deletes fixed parameter values for a given dataset.
static PyObject * sddsdata_GetColumnType(PyObject *self, PyObject *args)
Retrieves the type of a column in a dataset.
static PyObject * sddsdata_Terminate(PyObject *self, PyObject *args)
Terminates an SDDS dataset, releasing any associated resources.
static PyObject * sddsdata_GetDescriptionContents(PyObject *self, PyObject *args)
Retrieves the description contents for a dataset.
static PyObject * sddsdata_GetTypeName(PyObject *self, PyObject *args)
Retrieves the name of a given SDDS data type.
static PyObject * sddsdata_GetParameterDefinition(PyObject *self, PyObject *args)
Retrieves the definition of a parameter in a dataset.