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)) {
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 = 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,
403 if (!PyArg_ParseTuple(args,
"lsssssslll", &fileIndex, &name , &symbol, &units, &description, &format_string, &group_name, &type, &field_length, &dimensions)) {
407 if (strlen(symbol) == 0)
410 if (strlen(units) == 0)
413 if (strlen(description) == 0)
416 if (strlen(format_string) == 0)
417 format_string = NULL;
419 if (strlen(group_name) == 0)
421 return PyLong_FromLong(
SDDS_DefineArray(&
dataset_f[fileIndex], name, symbol, units, description, format_string, type, field_length, dimensions, group_name));
450 if (!PyArg_ParseTuple(args,
"lsssssll", &fileIndex, &name , &symbol, &units, &description, &format_string, &type, &field_length)) {
454 if (strlen(symbol) == 0)
457 if (strlen(units) == 0)
460 if (strlen(description) == 0)
463 if (strlen(format_string) == 0)
464 format_string = NULL;
465 return PyLong_FromLong(
SDDS_DefineColumn(&
dataset_f[fileIndex], name, symbol, units, description, format_string, type, field_length));
480 if (!PyArg_ParseTuple(args,
"s", &name)) {
517 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
521 if (strlen(units) == 0)
547 if (!PyArg_ParseTuple(args,
"lssll", &fileIndex, &name, &units, &type, &dimensions)) {
551 if (strlen(units) == 0)
559 return PyLong_FromLong(results);
580 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
584 if (strlen(units) == 0)
601 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
619 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
642 if (!PyArg_ParseTuple(args,
"lsl", &fileIndex, &
string, &mode)) {
662 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &
string)) {
684 if (!PyArg_ParseTuple(args,
"lsl", &fileIndex, &
string, &mode)) {
704 long fileIndexTarget;
705 long fileIndexSource;
708 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &filename, &filemode)) {
712 if (strlen(filename) == 0)
729 long fileIndexTarget;
730 long fileIndexSource;
731 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
749 long fileIndexTarget;
750 long fileIndexSource;
751 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
769 long fileIndexTarget;
770 long fileIndexSource;
771 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
789 long fileIndexTarget;
790 long fileIndexSource;
791 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
809 long fileIndexTarget;
810 long fileIndexSource;
811 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
829 long fileIndexTarget;
830 long fileIndexSource;
831 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
851 long fileIndexTarget;
853 long fileIndexSource;
855 if (!PyArg_ParseTuple(args,
"llll", &fileIndexTarget, &target_row, &fileIndexSource, &source_row)) {
875 long fileIndexTarget;
877 long fileIndexSource;
879 if (!PyArg_ParseTuple(args,
"llll", &fileIndexTarget, &target_row, &fileIndexSource, &source_row)) {
897 long fileIndexTarget;
898 long fileIndexSource;
899 if (!PyArg_ParseTuple(args,
"ll", &fileIndexTarget, &fileIndexSource)) {
917 long fileIndex, mode;
918 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &mode)) {
938 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
956 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
975 long expected_n_rows;
976 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &expected_n_rows)) {
994 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1014 long n_additional_rows;
1015 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &n_additional_rows)) {
1034 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1053 long fileIndex, mode;
1054 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &mode)) {
1075 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &filename)) {
1095 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1117 long sparse_interval;
1119 if (!PyArg_ParseTuple(args,
"lll", &fileIndex, &sparse_interval, &sparse_offset)) {
1141 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &last_rows)) {
1159 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1162 return PyLong_FromLongLong((
long long)SDDS_RowCount(&
dataset_f[fileIndex]));
1179 long column_flag_value;
1180 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &column_flag_value)) {
1200 long row_flag_value;
1201 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &row_flag_value)) {
1222 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &row)) {
1242 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &column_name)) {
1261 char *parameter_name;
1262 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, ¶meter_name)) {
1280 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1298 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1314 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1330 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1346 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1367 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1373 if (!(v = PyList_New(2)))
1376 PyList_SetItem(v, 0, PyString_FromString(text));
1379 PyList_SetItem(v, 0, PyString_FromString(
""));
1382 PyList_SetItem(v, 1, PyString_FromString(contents));
1385 PyList_SetItem(v, 1, PyString_FromString(
""));
1403 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1410 return PyString_FromString(text);
1411 return PyString_FromString(
"");
1427 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
1434 return PyString_FromString(contents);
1435 return PyString_FromString(
"");
1475 if (!PyArg_ParseTuple(args,
"s", &error_text)) {
1494 if (!PyArg_ParseTuple(args,
"s", &message)) {
1513 if (!PyArg_ParseTuple(args,
"s", &message)) {
1532 if (!PyArg_ParseTuple(args,
"s", &name)) {
1551 if (!PyArg_ParseTuple(args,
"l", &mode)) {
1572 long fileIndexTarget;
1573 long fileIndexSource;
1576 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1595 long fileIndexTarget;
1596 long fileIndexSource;
1599 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1618 long fileIndexTarget;
1619 long fileIndexSource;
1622 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1641 long fileIndexTarget;
1642 long fileIndexSource;
1645 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1664 long fileIndexTarget;
1665 long fileIndexSource;
1668 if (!PyArg_ParseTuple(args,
"llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1686 long fileIndexTarget;
1687 long fileIndexSource;
1689 if (!PyArg_ParseTuple(args,
"lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1707 long fileIndexTarget;
1708 long fileIndexSource;
1710 if (!PyArg_ParseTuple(args,
"lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1728 long fileIndexTarget;
1729 long fileIndexSource;
1731 if (!PyArg_ParseTuple(args,
"lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1750 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1769 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1788 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1807 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
1826 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
1845 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1864 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1885 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1890 if (!(v = PyList_New(6)))
1894 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
1896 PyList_SetItem(v, 0, PyString_FromString(
""));
1898 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
1900 PyList_SetItem(v, 1, PyString_FromString(
""));
1901 if (pardef->description)
1902 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
1904 PyList_SetItem(v, 2, PyString_FromString(
""));
1905 if (pardef->format_string)
1906 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
1908 PyList_SetItem(v, 3, PyString_FromString(
""));
1909 PyList_SetItem(v, 4, PyLong_FromLong(pardef->type));
1910 PyList_SetItem(v, 5, PyLong_FromLong(pardef->field_length));
1932 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
1937 if (!(v = PyList_New(8)))
1941 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
1943 PyList_SetItem(v, 0, PyString_FromString(
""));
1945 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
1947 PyList_SetItem(v, 1, PyString_FromString(
""));
1948 if (pardef->description)
1949 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
1951 PyList_SetItem(v, 2, PyString_FromString(
""));
1952 if (pardef->format_string)
1953 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
1955 PyList_SetItem(v, 3, PyString_FromString(
""));
1956 if (pardef->group_name)
1957 PyList_SetItem(v, 4, PyString_FromString(pardef->group_name));
1959 PyList_SetItem(v, 4, PyString_FromString(
""));
1960 PyList_SetItem(v, 5, PyLong_FromLong(pardef->type));
1961 PyList_SetItem(v, 6, PyLong_FromLong(pardef->field_length));
1962 PyList_SetItem(v, 7, PyLong_FromLong(pardef->dimensions));
1982 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2001 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
2022 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &name)) {
2027 if (!(v = PyList_New(6)))
2031 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
2033 PyList_SetItem(v, 0, PyString_FromString(
""));
2035 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
2037 PyList_SetItem(v, 1, PyString_FromString(
""));
2038 if (pardef->description)
2039 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
2041 PyList_SetItem(v, 2, PyString_FromString(
""));
2042 if (pardef->format_string)
2043 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
2045 PyList_SetItem(v, 3, PyString_FromString(
""));
2046 PyList_SetItem(v, 4, PyLong_FromLong(pardef->type));
2047 if (pardef->fixed_value)
2048 PyList_SetItem(v, 5, PyString_FromString(pardef->fixed_value));
2050 PyList_SetItem(v, 5, PyString_FromString(
""));
2068 if (!PyArg_ParseTuple(args,
"l", &type)) {
2087 if (!PyArg_ParseTuple(args,
"l", &type)) {
2092 return PyString_FromString(name);
2093 sprintf(msgbuf,
"sdds.GetTypeName: %ld is an invalid SDDS data type", type);
2094 PyErr_SetString(PyExc_StandardError, msgbuf);
2109 if (!PyArg_ParseTuple(args,
"s", &typeName)) {
2132 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
2155 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
2178 if (!PyArg_ParseTuple(args,
"lssl", &fileIndex, &name, &units, &type)) {
2195 if (!PyArg_ParseTuple(args,
"s", &
string)) {
2212 if (!PyArg_ParseTuple(args,
"s", &s)) {
2233 if (!PyArg_ParseTuple(args,
"lsd", &fileIndex, &name, &factor)) {
2254 if (!PyArg_ParseTuple(args,
"lsd", &fileIndex, &name, &factor)) {
2274 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2296 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &newmode)) {
2318 if (!PyArg_ParseTuple(args,
"ls", &fileIndex, &caller)) {
2336 if (!PyArg_ParseTuple(args,
"l", &newMode)) {
2362 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2368 if ((index >= 0) && (index < number)) {
2369 v = PyString_FromString(data[index]);
2370 for (i=0;i<number;i++)
2375 for (i=0;i<number;i++)
2400 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2406 if (!(v = PyList_New(number)))
2408 for (index = 0; index < number; index++)
2409 PyList_SetItem(v, index, PyString_FromString(data[index]));
2410 for (i=0;i<number;i++)
2436 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2442 if ((index >= 0) && (index < number)) {
2443 v = PyString_FromString(data[index]);
2444 for (i=0;i<number;i++)
2449 for (i=0;i<number;i++)
2474 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2480 if (!(v = PyList_New(number)))
2482 for (index = 0; index < number; index++)
2483 PyList_SetItem(v, index, PyString_FromString(data[index]));
2484 for (i=0;i<number;i++)
2510 if (!PyArg_ParseTuple(args,
"ll", &fileIndex, &index)) {
2516 if ((index >= 0) && (index < number)) {
2517 v = PyString_FromString(data[index]);
2518 for (i=0;i<number;i++)
2523 for (i=0;i<number;i++)
2548 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
2554 if (!(v = PyList_New(number)))
2556 for (index = 0; index < number; index++)
2557 PyList_SetItem(v, index, PyString_FromString(data[index]));
2558 for (i=0;i<number;i++)
2580 PyObject *indexOrName;
2584 if (!PyArg_ParseTuple(args,
"lOO", &fileIndex, &indexOrName, &v)) {
2587 if (PyString_Check(indexOrName)) {
2589 }
else if (PyNumber_Check(indexOrName)) {
2590 if (PyInt_Check(indexOrName))
2591 index = PyInt_AsLong(indexOrName);
2592 else if (PyLong_Check(indexOrName))
2593 index = PyLong_AsLong(indexOrName);
2604 if (PyLong_Check(v)) {
2610 if (PyLong_Check(v)) {
2611 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsUnsignedLong(v),-1));
2613 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsUnsignedLong(v),-1));
2616 if (PyLong_Check(v)) {
2617 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsLongLong(v),-1));
2619 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsLongLong(v),-1));
2622 if (PyLong_Check(v)) {
2623 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsUnsignedLongLong(v),-1));
2625 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsUnsignedLongLong(v),-1));
2629 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyFloat_AsDouble(v),-1));
2631 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,(
char)(PyString_AsString(v)[0]),-1));
2633 return PyLong_FromLong(
SDDS_SetParameters(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyString_AsString(v),-1));
2635 return PyLong_FromLong(0);
2656 PyObject *indexOrName;
2669 int32_t *dimension=NULL;
2671 if (!PyArg_ParseTuple(args,
"lOOO", &fileIndex, &indexOrName, &v, &dim)) {
2674 if (PyString_Check(indexOrName)) {
2678 }
else if (PyNumber_Check(indexOrName)) {
2679 if (PyInt_Check(indexOrName))
2680 index = PyInt_AsLong(indexOrName);
2681 else if (PyLong_Check(indexOrName))
2682 index = PyLong_AsLong(indexOrName);
2688 if (number <= index)
2694 type = arraydef->type;
2695 dimensions = arraydef->dimensions;
2697 if (dimensions != PyList_Size(dim))
2699 dimension = malloc(
sizeof(int32_t)*dimensions);
2701 for (i=0;i<dimensions;i++) {
2702 temp = PyList_GetItem(dim, i);
2703 if (PyInt_Check(temp))
2704 dimension[i] = PyInt_AsLong(temp);
2705 else if (PyLong_Check(temp))
2706 dimension[i] = PyLong_AsLong(temp);
2711 elements = (long)PyList_Size(v);
2714 data = malloc(
sizeof(
short)*elements);
2715 for (i=0;i<elements;i++) {
2716 temp = PyList_GetItem(v, i);
2717 if (PyLong_Check(temp))
2718 ((
short*)data)[i] = (short)PyLong_AsLong(temp);
2720 ((
short*)data)[i] = (short)PyInt_AsLong(temp);
2724 data = malloc(
sizeof(
unsigned short)*elements);
2725 for (i=0;i<elements;i++) {
2726 temp = PyList_GetItem(v, i);
2727 if (PyLong_Check(temp))
2728 ((
unsigned short*)data)[i] = (
unsigned short)PyLong_AsLong(temp);
2730 ((
unsigned short*)data)[i] = (
unsigned short)PyInt_AsLong(temp);
2734 data = malloc(
sizeof(int32_t)*elements);
2735 for (i=0;i<elements;i++) {
2736 temp = PyList_GetItem(v, i);
2737 if (PyLong_Check(temp))
2738 ((int32_t*)data)[i] = (int32_t)PyLong_AsLong(temp);
2740 ((int32_t*)data)[i] = (int32_t)PyInt_AsLong(temp);
2744 data = malloc(
sizeof(uint32_t)*elements);
2745 for (i=0;i<elements;i++) {
2746 temp = PyList_GetItem(v, i);
2747 if (PyLong_Check(temp))
2748 ((uint32_t*)data)[i] = (uint32_t)PyLong_AsUnsignedLong(temp);
2750 ((uint32_t*)data)[i] = (uint32_t)PyInt_AsUnsignedLong(temp);
2754 data = malloc(
sizeof(int64_t)*elements);
2755 for (i=0;i<elements;i++) {
2756 temp = PyList_GetItem(v, i);
2757 if (PyLong_Check(temp))
2758 ((int64_t*)data)[i] = (int64_t)PyLong_AsLongLong(temp);
2760 ((int64_t*)data)[i] = (int64_t)PyInt_AsLongLong(temp);
2764 data = malloc(
sizeof(uint64_t)*elements);
2765 for (i=0;i<elements;i++) {
2766 temp = PyList_GetItem(v, i);
2767 if (PyLong_Check(temp))
2768 ((uint64_t*)data)[i] = (uint64_t)PyLong_AsUnsignedLongLong(temp);
2770 ((uint64_t*)data)[i] = (uint64_t)PyInt_AsUnsignedLongLong(temp);
2774 data = malloc(
sizeof(
float)*elements);
2775 for (i=0;i<elements;i++)
2776 ((
float*)data)[i] = (float)PyFloat_AsDouble(PyList_GetItem(v, i));
2779 data = malloc(
sizeof(
double)*elements);
2780 for (i=0;i<elements;i++)
2781 ((
double*)data)[i] = (double)PyFloat_AsDouble(PyList_GetItem(v, i));
2784 data = malloc(
sizeof(
char)*elements);
2785 for (i=0;i<elements;i++)
2786 ((
char*)data)[i] = (char)(PyString_AsString(PyList_GetItem(v, i))[0]);
2789 data = malloc(
sizeof(
char*)*elements);
2790 for (i=0;i<elements;i++)
2791 SDDS_CopyString(((
char**)data)+i, PyString_AsString(PyList_GetItem(v, i)));
2794 if (PyString_Check(indexOrName)) {
2795 result =
SDDS_SetArray(&
dataset_f[fileIndex],PyString_AsString(indexOrName),SDDS_CONTIGUOUS_DATA,data,dimension);
2798 for (i=0;i<number;i++)
2807 free((
unsigned short*)data);
2810 free((int32_t*)data);
2813 free((uint32_t*)data);
2816 free((int64_t*)data);
2819 free((uint64_t*)data);
2825 free((
double*)data);
2831 for (i=0;i<elements;i++)
2832 free(((
char**)data)[i]);
2836 if (dimension) free(dimension);
2837 return PyLong_FromLong(result);
2857 PyObject *indexOrName;
2865 if (!PyArg_ParseTuple(args,
"lOO", &fileIndex, &indexOrName, &v)) {
2868 if (PyString_Check(indexOrName)) {
2870 }
else if (PyNumber_Check(indexOrName)) {
2871 if (PyInt_Check(indexOrName))
2872 index = PyInt_AsLong(indexOrName);
2873 else if (PyLong_Check(indexOrName))
2874 index = PyLong_AsLong(indexOrName);
2881 rows = (long)PyList_Size(v);
2884 data = malloc(
sizeof(
short)*rows);
2885 for (i=0;i<rows;i++) {
2886 temp = PyList_GetItem(v, i);
2887 if (PyLong_Check(temp))
2888 ((
short*)data)[i] = (short)PyLong_AsLong(temp);
2890 ((
short*)data)[i] = (short)PyInt_AsLong(temp);
2894 data = malloc(
sizeof(
unsigned short)*rows);
2895 for (i=0;i<rows;i++) {
2896 temp = PyList_GetItem(v, i);
2897 if (PyLong_Check(temp))
2898 ((
unsigned short*)data)[i] = (
unsigned short)PyLong_AsLong(temp);
2900 ((
unsigned short*)data)[i] = (
unsigned short)PyInt_AsLong(temp);
2904 data = malloc(
sizeof(int32_t)*rows);
2905 for (i=0;i<rows;i++) {
2906 temp = PyList_GetItem(v, i);
2907 if (PyLong_Check(temp))
2908 ((int32_t*)data)[i] = (int32_t)PyLong_AsLong(temp);
2910 ((int32_t*)data)[i] = (int32_t)PyInt_AsLong(temp);
2914 data = malloc(
sizeof(uint32_t)*rows);
2915 for (i=0;i<rows;i++) {
2916 temp = PyList_GetItem(v, i);
2917 if (PyLong_Check(temp))
2918 ((uint32_t*)data)[i] = (uint32_t)PyLong_AsUnsignedLong(temp);
2920 ((uint32_t*)data)[i] = (uint32_t)PyInt_AsUnsignedLong(temp);
2924 data = malloc(
sizeof(int64_t)*rows);
2925 for (i=0;i<rows;i++) {
2926 temp = PyList_GetItem(v, i);
2927 if (PyLong_Check(temp))
2928 ((int64_t*)data)[i] = (int64_t)PyLong_AsLongLong(temp);
2930 ((int64_t*)data)[i] = (int64_t)PyInt_AsLongLong(temp);
2934 data = malloc(
sizeof(uint64_t)*rows);
2935 for (i=0;i<rows;i++) {
2936 temp = PyList_GetItem(v, i);
2937 if (PyLong_Check(temp))
2938 ((uint64_t*)data)[i] = (uint64_t)PyLong_AsUnsignedLongLong(temp);
2940 ((uint64_t*)data)[i] = (uint64_t)PyInt_AsUnsignedLongLong(temp);
2944 data = malloc(
sizeof(
float)*rows);
2945 for (i=0;i<rows;i++)
2946 ((
float*)data)[i] = (float)PyFloat_AsDouble(PyList_GetItem(v, i));
2949 data = malloc(
sizeof(
double)*rows);
2950 for (i=0;i<rows;i++)
2951 ((
double*)data)[i] = (double)PyFloat_AsDouble(PyList_GetItem(v, i));
2954 data = malloc(
sizeof(
char)*rows);
2955 for (i=0;i<rows;i++)
2956 ((
char*)data)[i] = (char)(PyString_AsString(PyList_GetItem(v, i))[0]);
2959 data = malloc(
sizeof(
char*)*rows);
2960 for (i=0;i<rows;i++)
2961 SDDS_CopyString(((
char**)data)+i, PyString_AsString(PyList_GetItem(v, i)));
2970 free((
unsigned short*)data);
2973 free((int32_t*)data);
2976 free((uint32_t*)data);
2979 free((int64_t*)data);
2982 free((uint64_t*)data);
2988 free((
double*)data);
2994 for (i=0;i<rows;i++)
2995 free(((
char**)data)[i]);
2999 return PyLong_FromLong(result);
3024 if (!PyArg_ParseTuple(args,
"llO", &fileIndex, &row, &v)) {
3027 elements = (long)PyList_Size(v);
3028 for (i=0; i<elements; i=i+2) {
3030 temp = PyList_GetItem(v, i+1);
3037 if (PyLong_Check(temp)) {
3046 if (PyLong_Check(temp)) {
3047 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsUnsignedLong(temp),-1) == 0)
3050 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsUnsignedLong(temp),-1) == 0)
3055 if (PyLong_Check(temp)) {
3064 if (PyLong_Check(temp)) {
3065 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsUnsignedLongLong(temp),-1) == 0)
3068 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsUnsignedLongLong(temp),-1) == 0)
3078 if (
SDDS_SetRowValues(&
dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,(
char)(PyString_AsString(temp)[0]),-1) == 0)
3087 return PyLong_FromLong(1);
3105 PyObject *indexOrName;
3115 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3118 if (PyString_Check(indexOrName)) {
3120 }
else if (PyNumber_Check(indexOrName)) {
3121 if (PyInt_Check(indexOrName))
3122 index = PyInt_AsLong(indexOrName);
3123 else if (PyLong_Check(indexOrName))
3124 index = PyLong_AsLong(indexOrName);
3133 if ((index >= 0) && (index < number)) {
3139 rows = SDDS_RowCount(&(
dataset_f[fileIndex]));
3149 for (i=0;i<number;i++)
3156 if (!(v = PyList_New(rows)))
3159 switch (originalType) {
3161 for (i=0;i < rows;i++) {
3162 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
short*)columnValue)[i])));
3164 free((
short*)columnValue);
3167 for (i=0;i < rows;i++) {
3168 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
unsigned short*)columnValue)[i])));
3170 free((
unsigned short*)columnValue);
3173 for (i=0;i < rows;i++) {
3174 PyList_SetItem(v, i, PyLong_FromLong((
long)(((int32_t*)columnValue)[i])));
3176 free((int32_t*)columnValue);
3179 for (i=0;i < rows;i++) {
3180 PyList_SetItem(v, i, PyLong_FromUnsignedLong((
unsigned long)(((uint32_t*)columnValue)[i])));
3182 free((uint32_t*)columnValue);
3185 for (i=0;i < rows;i++) {
3186 PyList_SetItem(v, i, PyLong_FromLongLong((
long long)(((int64_t*)columnValue)[i])));
3188 free((int64_t*)columnValue);
3191 for (i=0;i < rows;i++) {
3192 PyList_SetItem(v, i, PyLong_FromUnsignedLongLong((
unsigned long long)(((uint64_t*)columnValue)[i])));
3194 free((uint64_t*)columnValue);
3197 for (i=0;i < rows;i++) {
3198 sprintf(buffer,
"%.6E", ((
float*)columnValue)[i]);
3199 PyList_SetItem(v, i, PyFloat_FromDouble(atof(buffer)));
3201 free((
float*)columnValue);
3204 for (i=0;i < rows;i++) {
3205 PyList_SetItem(v, i, PyFloat_FromDouble(((
double*)columnValue)[i]));
3207 free((
double*)columnValue);
3210 for (i=0;i < rows;i++) {
3211 sprintf(buffer,
"%c", ((
char*)columnValue)[i]);
3212 PyList_SetItem(v, i, PyString_FromString(buffer));
3214 free((
char*)columnValue);
3217 for (i=0;i < rows;i++) {
3218 PyList_SetItem(v, i, PyString_FromString(((
char**)columnValue)[i]));
3220 for (i=0;i < rows;i++)
3221 free(((
char**)columnValue)[i]);
3222 free((
char**)columnValue);
3245 PyObject *indexOrName;
3246 long originalType, i, elements;
3254 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3257 if (PyString_Check(indexOrName)) {
3259 }
else if (PyNumber_Check(indexOrName)) {
3260 if (PyInt_Check(indexOrName))
3261 index = PyInt_AsLong(indexOrName);
3262 else if (PyLong_Check(indexOrName))
3263 index = PyLong_AsLong(indexOrName);
3272 if ((index >= 0) && (index < number)) {
3280 for (i=0;i<number;i++)
3284 originalType = arrayValue->definition->type;
3289 elements = arrayValue->elements;
3299 if (!(v = PyList_New(arrayValue->elements)))
3302 switch (originalType) {
3304 for (i=0;i < elements;i++) {
3305 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
short*)arrayValue->data)[i])));
3309 for (i=0;i < elements;i++) {
3310 PyList_SetItem(v, i, PyLong_FromLong((
long)(((
unsigned short*)arrayValue->data)[i])));
3314 for (i=0;i < elements;i++) {
3315 PyList_SetItem(v, i, PyLong_FromLong((
long)(((int32_t*)arrayValue->data)[i])));
3319 for (i=0;i < elements;i++) {
3320 PyList_SetItem(v, i, PyLong_FromUnsignedLong((
unsigned long)(((uint32_t*)arrayValue->data)[i])));
3324 for (i=0;i < elements;i++) {
3325 PyList_SetItem(v, i, PyLong_FromLongLong((
long long)(((int64_t*)arrayValue->data)[i])));
3329 for (i=0;i < elements;i++) {
3330 PyList_SetItem(v, i, PyLong_FromUnsignedLongLong((
unsigned long long)(((uint64_t*)arrayValue->data)[i])));
3334 for (i=0;i < elements;i++) {
3335 sprintf(buffer,
"%.6E", ((
float*)arrayValue->data)[i]);
3336 PyList_SetItem(v, i, PyFloat_FromDouble(atof(buffer)));
3340 for (i=0;i < elements;i++) {
3341 PyList_SetItem(v, i, PyFloat_FromDouble(((
double*)arrayValue->data)[i]));
3345 for (i=0;i < elements;i++) {
3346 sprintf(buffer,
"%c", ((
char*)arrayValue->data)[i]);
3347 PyList_SetItem(v, i, PyString_FromString(buffer));
3351 for (i=0;i < elements;i++) {
3352 PyList_SetItem(v, i, PyString_FromString(((
char**)arrayValue->data)[i]));
3377 PyObject *indexOrName;
3385 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3388 if (PyString_Check(indexOrName)) {
3390 }
else if (PyNumber_Check(indexOrName)) {
3391 if (PyInt_Check(indexOrName))
3392 index = PyInt_AsLong(indexOrName);
3393 else if (PyLong_Check(indexOrName))
3394 index = PyLong_AsLong(indexOrName);
3403 if ((index >= 0) && (index < number)) {
3411 for (i=0;i<number;i++)
3418 if (!(v = PyList_New(arrayValue->definition->dimensions)))
3420 for (i=0;i<arrayValue->definition->dimensions;i++) {
3421 PyList_SetItem(v, i, PyLong_FromLong(arrayValue->dimension[i]));
3442 PyObject *indexOrName;
3444 void *parameterValue;
3452 if (!PyArg_ParseTuple(args,
"lO", &fileIndex, &indexOrName)) {
3455 if (PyString_Check(indexOrName)) {
3457 }
else if (PyNumber_Check(indexOrName)) {
3458 if (PyInt_Check(indexOrName))
3459 index = PyInt_AsLong(indexOrName);
3460 else if (PyLong_Check(indexOrName))
3461 index = PyLong_AsLong(indexOrName);
3470 if ((index >= 0) && (index < number)) {
3481 for (i=0;i<number;i++)
3485 if (!(parameterValue)) {
3490 switch (originalType) {
3492 v = PyLong_FromLong((
long)(((
short*)parameterValue)[0]));
3493 free((
short*)parameterValue);
3496 v = PyLong_FromLong((
long)(((
unsigned short*)parameterValue)[0]));
3497 free((
unsigned short*)parameterValue);
3500 v = PyLong_FromLong((
long)(((int32_t*)parameterValue)[0]));
3501 free((int32_t*)parameterValue);
3504 v = PyLong_FromUnsignedLong((
unsigned long)(((uint32_t*)parameterValue)[0]));
3505 free((uint32_t*)parameterValue);
3508 v = PyLong_FromLongLong((
long long)(((int64_t*)parameterValue)[0]));
3509 free((int64_t*)parameterValue);
3512 v = PyLong_FromUnsignedLongLong((
unsigned long long)(((uint64_t*)parameterValue)[0]));
3513 free((uint64_t*)parameterValue);
3516 sprintf(buffer,
"%.6E", ((
float*)parameterValue)[0]);
3517 v = PyFloat_FromDouble(atof(buffer));
3518 free((
float*)parameterValue);
3521 v = PyFloat_FromDouble(((
double*)parameterValue)[0]);
3522 free((
double*)parameterValue);
3525 sprintf(buffer,
"%c", ((
char*)parameterValue)[0]);
3526 v = PyString_FromString(buffer);
3527 free((
char*)parameterValue);
3530 v = PyString_FromString(((
char**)parameterValue)[0]);
3531 free(((
char**)parameterValue)[0]);
3532 free((
char**)parameterValue);
3551 if (!PyArg_ParseTuple(args,
"l", &fileIndex)) {
3554 return PyLong_FromLong(
dataset_f[fileIndex].layout.data_mode.mode);
3561#if PY_MAJOR_VERSION >= 3
3562#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
3564#define GETSTATE(m) (&_state)
3568static PyMethodDef sddsdata_methods[] = {
3688#if PY_MAJOR_VERSION >= 3
3690 __declspec(dllexport) PyObject* PyInit_sddsdata(
void);
3694 __declspec(dllexport)
void initsddsdata(
void);
3698#if PY_MAJOR_VERSION >= 3
3699static int sddsdata_traverse(PyObject *m, visitproc visit,
void *arg) {
3700 Py_VISIT(GETSTATE(m)->error);
3703static int sddsdata_clear(PyObject *m) {
3704 Py_CLEAR(GETSTATE(m)->error);
3707static struct PyModuleDef moduledef = {
3708 PyModuleDef_HEAD_INIT,
3718#define INITERROR return NULL
3720#define INITERROR return
3723#if PY_MAJOR_VERSION >= 3
3725PyMODINIT_FUNC PyInit_sddsdata(
void)
3727void initsddsdata(
void)
3731#if PY_MAJOR_VERSION >= 3
3732 PyObject *module = PyModule_Create(&moduledef);
3734 PyObject *module = Py_InitModule(
"sddsdata", sddsdata_methods );
3739 st = GETSTATE(module);
3741 st->error = PyErr_NewException(
"sddsedir.Error", NULL, NULL);
3742 if (st->error == NULL) {
3747#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.