SDDSlib
|
Internal definitions and function declarations for SDDS with LZMA support. More...
Go to the source code of this file.
Classes | |
struct | lzmafile |
Macros | |
#define | LZMA_BUF_SIZE 4096 |
#define | TABLE_LENGTH_INCREMENT 100 |
#define | SDDS_DESCRIPTION_COMMAND 0 |
#define | SDDS_COLUMN_COMMAND 1 |
#define | SDDS_PARAMETER_COMMAND 2 |
#define | SDDS_ASSOCIATE_COMMAND 3 |
#define | SDDS_DATA_COMMAND 4 |
#define | SDDS_INCLUDE_COMMAND 5 |
#define | SDDS_ARRAY_COMMAND 6 |
#define | SDDS_NUM_COMMANDS 7 |
Functions | |
void * | lzma_open (const char *path, const char *mode) |
int | lzma_close (struct lzmafile *file) |
long | lzma_read (struct lzmafile *file, void *buf, size_t count) |
long | lzma_write (struct lzmafile *file, const void *buf, size_t count) |
int | lzma_printf (struct lzmafile *file, const char *format,...) |
int | lzma_puts (const char *s, struct lzmafile *file) |
int | lzma_putc (int c, struct lzmafile *file) |
char * | lzma_gets (char *s, int size, struct lzmafile *file) |
int | lzma_eof (struct lzmafile *file) |
long | lzma_tell (struct lzmafile *file) |
int | lzma_seek (struct lzmafile *file, long offset, int whence) |
void * | UnpackLZMAOpen (char *filename) |
char * | fgetsLZMASkipComments (SDDS_DATASET *SDDS_dataset, char *s, int32_t slen, struct lzmafile *lzmafp, char skip_char) |
Reads a line from a LZMA-compressed file while skipping comment lines. | |
char * | fgetsLZMASkipCommentsResize (SDDS_DATASET *SDDS_dataset, char **s, int32_t *slen, struct lzmafile *lzmafp, char skip_char) |
Reads a line from a LZMA-compressed file with dynamic buffer resizing while skipping comment lines. | |
int32_t | SDDS_LZMAWriteBinaryString (char *string, struct lzmafile *lzmafp, SDDS_FILEBUFFER *fBuffer) |
Writes a binary string to a file with LZMA compression. | |
char * | SDDS_ReadNonNativeLZMABinaryString (struct lzmafile *lzmafp, SDDS_FILEBUFFER *fBuffer, int32_t skip) |
Reads a non-native endian binary string from an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteNonNativeBinaryString (char *string, struct lzmafile *lzmafp, SDDS_FILEBUFFER *fBuffer) |
Writes a non-native endian binary string to an LZMA-compressed file. | |
int32_t | SDDS_WriteBinaryArrays (SDDS_DATASET *SDDS_dataset) |
Writes the binary arrays of the SDDS dataset to a file. | |
int32_t | SDDS_WriteBinaryColumns (SDDS_DATASET *SDDS_dataset) |
Writes the binary columns of an SDDS dataset to the associated file. | |
int32_t | SDDS_WriteNonNativeBinaryColumns (SDDS_DATASET *SDDS_dataset) |
Writes non-native endian binary columns of an SDDS dataset to the associated file. | |
int32_t | SDDS_WriteBinaryParameters (SDDS_DATASET *SDDS_dataset) |
Writes the binary parameters of the SDDS dataset. | |
int32_t | SDDS_WriteBinaryPage (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_WriteBinaryRow (SDDS_DATASET *SDDS_dataset, int64_t row) |
Writes a single binary row of an SDDS dataset to the associated file. | |
int32_t | SDDS_UpdateBinaryPage (SDDS_DATASET *SDDS_dataset, uint32_t mode) |
Updates the binary page of an SDDS dataset. | |
int32_t | SDDS_UpdateNonNativeBinaryPage (SDDS_DATASET *SDDS_dataset, uint32_t mode) |
Updates a non-native endian binary page in an SDDS dataset. | |
int32_t | SDDS_fseek (FILE *fp, int64_t offset, int32_t dir) |
Sets the file position indicator for a given file stream with retry logic. | |
char * | SDDS_ReadBinaryString (FILE *fp, SDDS_FILEBUFFER *fBuffer, int32_t skip) |
Reads a binary string from a file with buffering. | |
int32_t | SDDS_ReadBinaryArrays (SDDS_DATASET *SDDS_dataset) |
Reads binary arrays from an SDDS dataset. | |
int32_t | SDDS_ReadBinaryColumns (SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset) |
Reads the binary columns from an SDDS dataset. | |
int32_t | SDDS_ReadNonNativeBinaryColumns (SDDS_DATASET *SDDS_dataset) |
Reads the non-native endian binary columns from an SDDS dataset. | |
int32_t | SDDS_ReadBinaryParameters (SDDS_DATASET *SDDS_dataset) |
Reads binary parameters from the specified SDDS dataset. | |
int32_t | SDDS_ReadBinaryPage (SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset, int32_t sparse_statistics) |
Reads a binary page from an SDDS dataset. | |
int32_t | SDDS_ReadBinaryPageLastRows (SDDS_DATASET *SDDS_dataset, int64_t last_rows) |
Reads the last specified number of rows from a binary page of an SDDS dataset. | |
int32_t | SDDS_ReadBinaryPageDetailed (SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset, int64_t last_rows, int32_t sparse_statistics) |
Reads a binary page from an SDDS dataset with detailed options. | |
int32_t | SDDS_ReadBinaryRow (SDDS_DATASET *SDDS_dataset, int64_t row, int32_t skip) |
Reads a binary row from the specified SDDS dataset. | |
int32_t | SDDS_ReadNonNativePageLastRows (SDDS_DATASET *SDDS_dataset, int64_t last_rows) |
Reads the last few rows from a non-native endian page in an SDDS dataset. | |
int32_t | SDDS_ReadNonNativeBinaryPageDetailed (SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset, int64_t last_rows) |
Reads a detailed non-native endian binary page from an SDDS dataset. | |
int32_t | SDDS_ReadNonNativePageDetailed (SDDS_DATASET *SDDS_dataset, uint32_t mode, int64_t sparse_interval, int64_t sparse_offset, int64_t last_rows) |
Reads a detailed non-native endian page from an SDDS dataset. | |
int32_t | SDDS_ReadNonNativeBinaryPageLastRows (SDDS_DATASET *SDDS_dataset, int64_t last_rows) |
Reads the last few rows from a non-native endian binary page in an SDDS dataset. | |
int32_t | SDDS_AllocateColumnFlags (SDDS_DATASET *SDDS_target) |
int32_t | SDDS_WriteAsciiArrays (SDDS_DATASET *SDDS_dataset, FILE *fp) |
Writes the arrays of an SDDS dataset in ASCII format to a file. | |
int32_t | SDDS_WriteAsciiParameters (SDDS_DATASET *SDDS_dataset, FILE *fp) |
Writes the parameter data of an SDDS dataset in ASCII format to a file. | |
void | SDDS_AppendParameterComment (PARAMETER_DEFINITION *definition, char *text, char *string) |
int32_t | SDDS_WriteAsciiRow (SDDS_DATASET *SDDS_dataset, int64_t row, FILE *fp) |
Writes a single row of data in ASCII format to a file. | |
int32_t | SDDS_WriteAsciiPage (SDDS_DATASET *SDDS_dataset) |
Writes a page of data in ASCII format to the SDDS dataset. | |
int32_t | SDDS_ReadAsciiArrays (SDDS_DATASET *SDDS_dataset) |
Reads the arrays from an ASCII file into the SDDS dataset. | |
int32_t | SDDS_ReadAsciiParameters (SDDS_DATASET *SDDS_dataset) |
Reads the parameters from an ASCII file into the SDDS dataset. | |
int32_t | SDDS_AsciiDataExpected (SDDS_DATASET *SDDS_dataset) |
Checks whether the SDDS dataset expects ASCII data input. | |
int32_t | SDDS_ReadAsciiPageLastRows (SDDS_DATASET *SDDS_dataset, int64_t last_rows) |
Reads the last specified number of rows from an ASCII page of an SDDS dataset. | |
int32_t | SDDS_ReadAsciiPageDetailed (SDDS_DATASET *SDDS_dataset, int64_t sparse_interval, int64_t sparse_offset, int64_t last_rows, int32_t sparse_statistics) |
Reads a detailed page of data from an ASCII file into an SDDS dataset with optional sparsity and statistics. | |
int32_t | SDDS_LZMAWriteAsciiParameters (SDDS_DATASET *SDDS_dataset, struct lzmafile *lzmafp) |
Writes the parameter data of an SDDS dataset in ASCII format to an LZMA compressed file. | |
int32_t | SDDS_LZMAWriteAsciiArrays (SDDS_DATASET *SDDS_dataset, struct lzmafile *lzmafp) |
Writes the arrays of an SDDS dataset in ASCII format to an LZMA compressed file. | |
int32_t | SDDS_LZMAWriteAsciiRow (SDDS_DATASET *SDDS_dataset, int64_t row, struct lzmafile *lzmafp) |
Writes a single row of data in ASCII format to an LZMA compressed file. | |
int32_t | SDDS_CopyColumn (SDDS_DATASET *SDDS_dataset, int32_t target, int32_t source) |
Copies data from a source column to a target column within an SDDS dataset. | |
int32_t | SDDS_CopyParameter (SDDS_DATASET *SDDS_dataset, int32_t target, int32_t source) |
Copies a parameter from a source index to a target index within an SDDS dataset. | |
int32_t | SDDS_TransferRow (SDDS_DATASET *SDDS_dataset, int64_t target, int64_t source) |
Transfers data from a source row to a target row within an SDDS dataset. | |
int64_t | SDDS_GetSelectedRowIndex (SDDS_DATASET *SDDS_dataset, int64_t srow_index) |
Retrieves the actual row index corresponding to a selected row position within the current data table. | |
int32_t | SDDS_CheckTable (SDDS_DATASET *SDDS_dataset, const char *caller) |
int32_t | SDDS_AdvanceCounter (int32_t *counter, int32_t *max_count, int32_t n_indices) |
Advances a multi-dimensional counter based on maximum counts for each dimension. | |
void | SDDS_FreePointerArray (void **data, int32_t dimensions, int32_t *dimension) |
Frees a multi-dimensional pointer array created by SDDS_MakePointerArray. | |
int32_t | SDDS_WriteVersion (int32_t version_number, FILE *fp) |
Writes the SDDS protocol version to a standard file. | |
int32_t | SDDS_WriteDescription (char *description, char *contents, FILE *fp) |
Writes the SDDS description section to a standard file. | |
int32_t | SDDS_WriteColumnDefinition (COLUMN_DEFINITION *column, FILE *fp) |
Writes a column definition to a standard file. | |
int32_t | SDDS_WriteParameterDefinition (PARAMETER_DEFINITION *parameter, FILE *fp) |
Writes a parameter definition to a standard file. | |
int32_t | SDDS_WriteAssociateDefinition (ASSOCIATE_DEFINITION *associate, FILE *fp) |
Writes an associate definition to a standard file. | |
int32_t | SDDS_WriteArrayDefinition (ARRAY_DEFINITION *array_definition, FILE *fp) |
Writes an array definition to a standard file. | |
int32_t | SDDS_WriteDataMode (SDDS_LAYOUT *layout, FILE *fp) |
Writes the data mode section to a standard file. | |
int32_t | SDDS_LZMAWriteVersion (int32_t version_number, struct lzmafile *lzmafp) |
Writes the SDDS protocol version to an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteDescription (char *description, char *contents, struct lzmafile *lzmafp) |
Writes the SDDS description section to an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteColumnDefinition (COLUMN_DEFINITION *column, struct lzmafile *lzmafp) |
Writes a column definition to an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteParameterDefinition (PARAMETER_DEFINITION *parameter, struct lzmafile *lzmafp) |
Writes a parameter definition to an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteAssociateDefinition (ASSOCIATE_DEFINITION *associate, struct lzmafile *lzmafp) |
Writes an associate definition to an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteArrayDefinition (ARRAY_DEFINITION *array_definition, struct lzmafile *lzmafp) |
Writes an array definition to an LZMA-compressed file. | |
int32_t | SDDS_LZMAWriteDataMode (SDDS_LAYOUT *layout, struct lzmafile *lzmafp) |
Writes the data mode section to an LZMA-compressed file. | |
int32_t | SDDS_ProcessDescription (SDDS_DATASET *SDDS_dataset, char *s) |
Process the description section of the SDDS dataset. | |
int32_t | SDDS_ProcessColumnDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Process the column definition section of the SDDS dataset. | |
int32_t | SDDS_ProcessParameterDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Process the parameter definition section of the SDDS dataset. | |
int32_t | SDDS_ProcessArrayDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Process the array definition section of the SDDS dataset. | |
FILE * | SDDS_ProcessIncludeCommand (SDDS_DATASET *SDDS_dataset, char *s) |
Process the include command within the SDDS dataset. | |
int32_t | SDDS_ProcessAssociateDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Process the associate definition section of the SDDS dataset. | |
int32_t | SDDS_ProcessDataMode (SDDS_DATASET *SDDS_dataset, char *s) |
Process the data mode section of the SDDS dataset. | |
int32_t | SDDS1_ProcessDescription (SDDS_DATASET *SDDS_dataset, char *s) |
Process the description section for SDDS protocol version 1. | |
int32_t | SDDS1_ProcessColumnDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Processes and defines a column within an SDDS dataset. | |
int32_t | SDDS1_ProcessParameterDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Processes and defines a parameter within an SDDS dataset. | |
int32_t | SDDS1_ProcessArrayDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Processes and defines an array within an SDDS dataset. | |
FILE * | SDDS1_ProcessIncludeCommand (SDDS_DATASET *SDDS_dataset, char *s) |
Processes an include command by opening the specified file. | |
int32_t | SDDS1_ProcessAssociateDefinition (SDDS_DATASET *SDDS_dataset, char *s) |
Processes and defines an associate within an SDDS dataset. | |
int32_t | SDDS1_ProcessDataMode (SDDS_DATASET *SDDS_dataset, char *s) |
Processes and sets the data mode for an SDDS dataset. | |
int32_t | SDDS_ReadLayout (SDDS_DATASET *SDDS_dataset, FILE *fp) |
int32_t | SDDS_LZMAReadLayout (SDDS_DATASET *SDDS_dataset, struct lzmafile *lzmafp) |
int32_t | SDDS_UpdateAsciiPage (SDDS_DATASET *SDDS_dataset, uint32_t mode) |
Updates the current ASCII page of an SDDS dataset with new data. | |
uint32_t | SDDS_GetSpecialCommentsModes (SDDS_DATASET *SDDS_dataset) |
Retrieves the current special comments modes set in the SDDS dataset. | |
void | SDDS_ResetSpecialCommentsModes (SDDS_DATASET *SDDS_dataset) |
Resets the special comments modes in the SDDS dataset. | |
void | SDDS_ParseSpecialComments (SDDS_DATASET *SDDS_dataset, char *s) |
Parses and processes special comment commands within the SDDS dataset. | |
void | SDDS_FreeTableStrings (SDDS_DATASET *SDDS_dataset) |
Variables | |
char * | SDDS_command [SDDS_NUM_COMMANDS] |
Array of supported SDDS command names. | |
Internal definitions and function declarations for SDDS with LZMA support.
This header file contains internal macros, structures, and function prototypes used by the SDDS (Self Describing Data Sets) library to handle LZMA-compressed files. It includes definitions for the lzmafile
structure, buffer sizes, and various binary and ASCII I/O routines tailored for SDDS datasets.
The file ensures that internal components are only included once using include guards and conditionally includes the LZMA library when necessary.
lzmafile
: Represents an LZMA-compressed file with associated stream and buffer.lzma_open
, lzma_close
, lzma_read
, lzma_write
: Basic file operations for LZMA files.SDDS_WriteBinaryArrays
, SDDS_ReadBinaryArrays
, etc.: SDDS-specific binary I/O functions.SDDS_WriteAsciiArrays
, SDDS_ReadAsciiArrays
, etc.: SDDS-specific ASCII I/O functions.LZMA_BUF_SIZE
: Defines the buffer size for LZMA operations.TABLE_LENGTH_INCREMENT
: Specifies the increment size for table allocations.lzma.h
) for compression support.This file is intended for internal use within the SDDS library and should not be included directly by external applications. It provides the necessary infrastructure to manage compressed data streams and perform efficient I/O operations on SDDS datasets.
Definition in file SDDS_internal.h.
#define LZMA_BUF_SIZE 4096 |
Definition at line 62 of file SDDS_internal.h.
#define SDDS_ARRAY_COMMAND 6 |
Definition at line 209 of file SDDS_internal.h.
#define SDDS_ASSOCIATE_COMMAND 3 |
Definition at line 206 of file SDDS_internal.h.
#define SDDS_COLUMN_COMMAND 1 |
Definition at line 204 of file SDDS_internal.h.
#define SDDS_DATA_COMMAND 4 |
Definition at line 207 of file SDDS_internal.h.
#define SDDS_DESCRIPTION_COMMAND 0 |
Definition at line 203 of file SDDS_internal.h.
#define SDDS_INCLUDE_COMMAND 5 |
Definition at line 208 of file SDDS_internal.h.
#define SDDS_NUM_COMMANDS 7 |
Definition at line 210 of file SDDS_internal.h.
#define SDDS_PARAMETER_COMMAND 2 |
Definition at line 205 of file SDDS_internal.h.
#define TABLE_LENGTH_INCREMENT 100 |
Definition at line 88 of file SDDS_internal.h.
char * fgetsLZMASkipComments | ( | SDDS_DATASET * | SDDS_dataset, |
char * | s, | ||
int32_t | slen, | ||
struct lzmafile * | lzmafp, | ||
char | skip_char ) |
Reads a line from a LZMA-compressed file while skipping comment lines.
This function reads lines from the specified LZMA-compressed file stream, ignoring lines that begin with the specified skip_char
. It also processes special comment lines that start with !#
by parsing them using SDDS_ParseSpecialComments
.
[in] | SDDS_dataset | Pointer to the SDDS_DATASET structure, used for processing comments. |
[out] | s | Pointer to a character array where the read line will be stored. |
[in] | slen | The maximum number of characters to read into s . |
[in] | lzmafp | Pointer to the lzmafile structure representing the LZMA-compressed file stream. |
[in] | skip_char | Character indicating the start of a comment line. Lines beginning with this character will be skipped. |
s
containing the read line. If the end of the file is reached or an error occurs, returns NULL
.s
by removing comments as determined by SDDS_CutOutComments
.Definition at line 1528 of file SDDS_utils.c.
char * fgetsLZMASkipCommentsResize | ( | SDDS_DATASET * | SDDS_dataset, |
char ** | s, | ||
int32_t * | slen, | ||
struct lzmafile * | lzmafp, | ||
char | skip_char ) |
Reads a line from a LZMA-compressed file with dynamic buffer resizing while skipping comment lines.
This function reads lines from the specified LZMA-compressed file stream, ignoring lines that begin with the specified skip_char
. If a line exceeds the current buffer size, the buffer is dynamically resized to accommodate the entire line. It also processes special comment lines that start with !#
by parsing them using SDDS_ParseSpecialComments
.
[in] | SDDS_dataset | Pointer to the SDDS_DATASET structure, used for processing comments. |
[in,out] | s | Pointer to a pointer to a character array where the read line will be stored. This buffer may be resized if necessary. |
[in,out] | slen | Pointer to an int32_t variable specifying the current size of the buffer *s . This value may be updated if the buffer is resized. |
[in] | lzmafp | Pointer to the lzmafile structure representing the LZMA-compressed file stream. |
[in] | skip_char | Character indicating the start of a comment line. Lines beginning with this character will be skipped. |
*s
containing the read line. If the end of the file is reached or an error occurs, returns NULL
.*s
, including freeing it when no longer needed.Definition at line 1560 of file SDDS_utils.c.
int lzma_close | ( | struct lzmafile * | file | ) |
Definition at line 100 of file SDDS_lzma.c.
int lzma_eof | ( | struct lzmafile * | file | ) |
Definition at line 378 of file SDDS_lzma.c.
char * lzma_gets | ( | char * | s, |
int | size, | ||
struct lzmafile * | file ) |
Definition at line 181 of file SDDS_lzma.c.
void * lzma_open | ( | const char * | path, |
const char * | mode ) |
Definition at line 70 of file SDDS_lzma.c.
int lzma_printf | ( | struct lzmafile * | file, |
const char * | format, | ||
... ) |
Definition at line 355 of file SDDS_lzma.c.
int lzma_putc | ( | int | c, |
struct lzmafile * | file ) |
Definition at line 319 of file SDDS_lzma.c.
int lzma_puts | ( | const char * | s, |
struct lzmafile * | file ) |
Definition at line 275 of file SDDS_lzma.c.
long lzma_read | ( | struct lzmafile * | file, |
void * | buf, | ||
size_t | count ) |
Definition at line 140 of file SDDS_lzma.c.
int lzma_seek | ( | struct lzmafile * | file, |
long | offset, | ||
int | whence ) |
Definition at line 397 of file SDDS_lzma.c.
long lzma_tell | ( | struct lzmafile * | file | ) |
Definition at line 393 of file SDDS_lzma.c.
long lzma_write | ( | struct lzmafile * | file, |
const void * | buf, | ||
size_t | count ) |
Definition at line 239 of file SDDS_lzma.c.
|
extern |
Processes and defines an array within an SDDS dataset.
This function parses an array definition string, extracts the necessary array information, and defines the array in the given SDDS dataset.
SDDS_dataset | Pointer to the SDDS dataset where the array will be defined. |
s | String containing the array definition in namelist format. |
1
on successful processing and definition of the array.0
if an error occurs during parsing or definition. Definition at line 916 of file SDDS_process.c.
|
extern |
Processes and defines an associate within an SDDS dataset.
This function parses an associate definition string, extracts the necessary associate information, and defines the associate in the given SDDS dataset.
SDDS_dataset | Pointer to the SDDS dataset where the associate will be defined. |
s | String containing the associate definition in namelist format. |
1
on successful processing and definition of the associate.0
if an error occurs during parsing or definition. Definition at line 847 of file SDDS_process.c.
|
extern |
Processes and defines a column within an SDDS dataset.
This function parses a column definition string, extracts the necessary column information, and defines the column in the given SDDS dataset.
SDDS_dataset | Pointer to the SDDS dataset where the column will be defined. |
s | String containing the column definition in namelist format. |
1
on successful processing and definition of the column.0
if an error occurs during parsing or definition. Definition at line 730 of file SDDS_process.c.
|
extern |
Processes and sets the data mode for an SDDS dataset.
This function parses a data mode definition string, extracts the necessary data mode information, and sets the data mode in the given SDDS dataset.
SDDS_dataset | Pointer to the SDDS dataset where the data mode will be set. |
s | String containing the data mode definition in namelist format. |
1
on successful processing and setting of the data mode.0
if an error occurs during parsing or if mandatory fields are missing. Definition at line 879 of file SDDS_process.c.
|
extern |
Process the description section for SDDS protocol version 1.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the description string. |
Definition at line 703 of file SDDS_process.c.
|
extern |
Processes an include command by opening the specified file.
This function parses an include command string to extract the filename, then attempts to open the file for reading. It returns a file pointer if successful.
SDDS_dataset | Pointer to the SDDS dataset (unused in current implementation). |
s | String containing the include command in namelist format. |
FILE
on success.NULL
if parsing fails or the file cannot be opened. Definition at line 818 of file SDDS_process.c.
|
extern |
Processes and defines a parameter within an SDDS dataset.
This function parses a parameter definition string, extracts the necessary parameter information, and defines the parameter in the given SDDS dataset.
SDDS_dataset | Pointer to the SDDS dataset where the parameter will be defined. |
s | String containing the parameter definition in namelist format. |
1
on successful processing and definition of the parameter.0
if an error occurs during parsing or definition. Definition at line 774 of file SDDS_process.c.
|
extern |
Advances a multi-dimensional counter based on maximum counts for each dimension.
This helper function increments a multi-dimensional counter array, handling carry-over for each dimension. It is typically used for iterating over multi-dimensional arrays in a nested loop fashion.
counter | Pointer to an array of integers representing the current count in each dimension. |
max_count | Pointer to an array of integers representing the maximum count for each dimension. |
n_indices | The number of dimensions (indices) in the counter and max_count arrays. |
-1
to indicate completion.Definition at line 1491 of file SDDS_dataprep.c.
|
extern |
Allocates memory for column flags and column order arrays in the specified SDDS dataset.
This function allocates memory for the column_flag
and column_order
arrays based on the number of columns defined in the dataset's layout. It initializes column_flag
to 1 and column_order
to 0 and 1 respectively.
SDDS_target | Pointer to the SDDS_DATASET structure where column flags will be allocated. |
Definition at line 36 of file SDDS_dataprep.c.
|
extern |
Checks whether the SDDS dataset expects ASCII data input.
This function determines if the provided SDDS dataset is expecting ASCII data. The dataset expects ASCII data if it has columns, arrays, or parameters without fixed values. If the dataset only contains parameters with fixed values and no columns or arrays, it does not expect ASCII data.
SDDS_dataset | Pointer to the SDDS dataset to check. |
Definition at line 2140 of file SDDS_ascii.c.
|
extern |
Copies data from a source column to a target column within an SDDS dataset.
This function duplicates the data from the specified source column to the target column in the provided SDDS dataset. It handles both string and non-string data types appropriately, ensuring that memory is managed correctly for string entries.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
target | The index of the target column where data will be copied to. |
source | The index of the source column from which data will be copied. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the column copy was successful. |
0 | Indicates that an error occurred (e.g., invalid dataset, out-of-range indices, memory allocation failure, string copy failure). |
target
and source
must be valid column indices within the dataset.Definition at line 3928 of file SDDS_extract.c.
|
extern |
Copies a parameter from a source index to a target index within an SDDS dataset.
This function duplicates the parameter data from the source index to the target index in the provided SDDS dataset. It handles both string and non-string data types appropriately, ensuring that memory is managed correctly for string entries.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
target | The index of the target parameter where data will be copied to. |
source | The index of the source parameter from which data will be copied. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the parameter copy was successful. |
0 | Indicates that an error occurred (e.g., invalid dataset, out-of-range indices, memory allocation failure, string copy failure). |
target
and source
must be valid parameter indices within the dataset.Definition at line 4017 of file SDDS_extract.c.
|
extern |
Frees a multi-dimensional pointer array created by SDDS_MakePointerArray.
This function recursively deallocates a multi-dimensional pointer array that was previously created using SDDS_MakePointerArray
or SDDS_MakePointerArrayRecursively
. It ensures that all pointer layers are properly freed to prevent memory leaks.
[in] | data | Pointer to the multi-dimensional pointer array to be freed. |
[in] | dimensions | The number of dimensions in the pointer array. |
[in] | dimension | An array specifying the size of each dimension. |
Definition at line 3012 of file SDDS_utils.c.
void SDDS_FreeTableStrings | ( | SDDS_DATASET * | SDDS_dataset | ) |
Frees the strings in the current table of the SDDS dataset.
This function frees any strings stored in the data columns of the current table. It does not free strings from parameters or arrays.
SDDS_dataset | The SDDS dataset to free table strings from. |
Definition at line 1425 of file SDDS_input.c.
|
extern |
Sets the file position indicator for a given file stream with retry logic.
Attempts to set the file position indicator for the specified file stream (fp
) to a new position defined by offset
and dir
. The function retries the fseek
operation up to FSEEK_TRIES
times in case of transient failures, implementing a delay between attempts.
fp | Pointer to the FILE stream whose position indicator is to be set. |
offset | Number of bytes to offset from the position specified by dir . |
dir | Positioning directive, which can be one of:
|
0
if the operation is successful.-1
if all retry attempts fail to set the file position.The function attempts to set the file position using fseek
. If fseek
fails, it sleeps for 1 second (or 1 second using nanosleep
on vxWorks systems) before retrying. After FSEEK_TRIES
unsuccessful attempts, it reports a warning and returns -1
.
fseek
operation.fseek
errors, which will cause it to fail after retries. Definition at line 1258 of file SDDS_binary.c.
|
extern |
Retrieves the actual row index corresponding to a selected row position within the current data table.
This function maps a selected row index (i.e., the position among rows marked as "of interest") to its corresponding actual row index within the dataset's data table.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
srow_index
out of range).srow_index
is within the valid range [0, SDDS_CountRowsOfInterest(SDDS_dataset)
- 1] to avoid out-of-range errors.Definition at line 1701 of file SDDS_extract.c.
uint32_t SDDS_GetSpecialCommentsModes | ( | SDDS_DATASET * | SDDS_dataset | ) |
Retrieves the current special comments modes set in the SDDS dataset.
This function returns the current set of special comment flags that have been parsed and set within the dataset. These flags indicate the presence of specific configurations such as endianness and fixed row counts.
[in] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
uint32_t
value representing the combined set of special comment flags.0
if no special comments have been set.SDDS_ParseSpecialComments
.Definition at line 5201 of file SDDS_utils.c.
|
extern |
Reads the header layout of an SDDS dataset from a file with LZMA compression.
SDDS_dataset | The SDDS dataset structure to store the layout information. |
lzmafp | The LZMA file pointer to the SDDS file. |
Definition at line 680 of file SDDS_input.c.
|
extern |
Writes an array definition to an LZMA-compressed file.
This function outputs the definition of a single array in the SDDS layout to an LZMA-compressed file. It includes fields such as name, symbol, units, description, format string, group name, data type, and dimensions. The definition is enclosed within &array and &end tags.
array_definition | Pointer to the array definition structure. |
lzmafp | The LZMA-compressed file pointer where the array definition will be written. |
Definition at line 722 of file SDDS_write.c.
|
extern |
Writes the arrays of an SDDS dataset in ASCII format to an LZMA compressed file.
This function writes all arrays contained in the provided SDDS dataset to the specified LZMA compressed file in ASCII format. For each array, it writes the dimensions, a description line, and the array elements formatted according to their data type.
SDDS_dataset | Pointer to the SDDS dataset containing the arrays to be written. |
lzmafp | Pointer to the LZMA file stream where the array data will be written. |
SDDS_SetError()
.SDDS_LZMAWriteTypedValue()
to write each array element according to its data type. Each array element is written, with up to 6 elements per line. Definition at line 680 of file SDDS_ascii.c.
|
extern |
Writes the parameter data of an SDDS dataset in ASCII format to an LZMA compressed file.
This function writes all parameters of the provided SDDS dataset to the specified LZMA compressed file in ASCII format. Only parameters that do not have fixed values are written. Each parameter value is written on a new line.
SDDS_dataset | Pointer to the SDDS dataset containing the parameter data. |
lzmafp | Pointer to the LZMA file stream where the ASCII data will be written. |
SDDS_SetError()
.SDDS_LZMAWriteTypedValue()
to write each parameter value according to its data type. Definition at line 565 of file SDDS_ascii.c.
|
extern |
Writes a single row of data in ASCII format to an LZMA compressed file.
This function writes the specified row from the SDDS dataset to the provided LZMA compressed file in ASCII format. The data is formatted according to the data types of the columns. Supports multi-line rows as specified by the data mode settings in the dataset layout.
SDDS_dataset | Pointer to the SDDS dataset containing the data. |
row | Zero-based index of the row to write. |
lzmafp | Pointer to the LZMA file stream where the row data will be written. |
SDDS_SetError()
.SDDS_LZMAWriteTypedValue()
to write each column value according to its data type. The number of values per line is determined by the lines_per_row
setting in the dataset layout. Definition at line 826 of file SDDS_ascii.c.
|
extern |
Writes an associate definition to an LZMA-compressed file.
This function outputs the definition of an associate in the SDDS layout to an LZMA-compressed file. It includes fields such as name, filename, contents, path, description, and an SDDS flag. The definition is enclosed within &associate and &end tags.
associate_definition | Pointer to the associate definition structure. |
lzmafp | The LZMA-compressed file pointer where the associate definition will be written. |
Definition at line 520 of file SDDS_write.c.
int32_t SDDS_LZMAWriteBinaryString | ( | char * | string, |
struct lzmafile * | lzmafp, | ||
SDDS_FILEBUFFER * | fBuffer ) |
Writes a binary string to a file with LZMA compression.
This function writes a binary string to the specified LZMA-compressed file by first writing the length of the string followed by the string's content. If the input string is NULL, an empty string is written instead. The writing operation utilizes LZMA buffered write functions to ensure data is compressed appropriately.
[in] | string | The null-terminated string to be written. If NULL, an empty string is written. |
[in] | lzmafp | The LZMA file pointer to write to. Must be a valid, open LZMA-compressed file in write mode. |
[in,out] | fBuffer | Pointer to the file buffer used for buffered writing operations. |
1 | Operation was successful. |
0 | An error occurred during writing. |
Definition at line 2549 of file SDDS_binary.c.
|
extern |
Writes a column definition to an LZMA-compressed file.
This function outputs the definition of a single column in the SDDS layout to an LZMA-compressed file. It includes fields such as name, symbol, units, description, format string, and data type. The definition is enclosed within &column and &end tags.
column_definition | Pointer to the column definition structure. |
lzmafp | The LZMA-compressed file pointer where the column definition will be written. |
Definition at line 356 of file SDDS_write.c.
|
extern |
Writes the data mode section to an LZMA-compressed file.
This function outputs the data mode settings of the SDDS layout to the specified LZMA-compressed file pointer. It includes settings such as mode, lines per row, row counts, endianess, column-major order, and fixed row counts. The section is enclosed within &data and &end tags.
layout | Pointer to the SDDS layout structure containing data mode settings. |
lzmafp | The LZMA-compressed file pointer where the data mode section will be written. |
Definition at line 614 of file SDDS_write.c.
|
extern |
Writes the SDDS description section to an LZMA-compressed file.
This function writes the description section of the SDDS layout, including optional text and contents fields. It encapsulates the data within &description and &end tags in an LZMA-compressed file.
text | The descriptive text for the SDDS layout. |
contents | The contents description for the SDDS layout. |
lzmafp | The LZMA-compressed file pointer where the description will be written. |
Definition at line 280 of file SDDS_write.c.
int32_t SDDS_LZMAWriteNonNativeBinaryString | ( | char * | string, |
struct lzmafile * | lzmafp, | ||
SDDS_FILEBUFFER * | fBuffer ) |
Writes a non-native endian binary string to an LZMA-compressed file.
This function writes a binary string to the specified LZMA-compressed file pointer, handling non-native endianness. It first writes the length of the string as a 32-bit integer with byte order swapped. If the string is not to be skipped, it then writes the string data itself followed by a null terminator. If the input string is NULL, an empty string is written instead.
[in] | string | The string to write. If NULL, an empty string is written. |
[in] | lzmafp | Pointer to the LZMAFILE where the string will be written. |
[in] | fBuffer | Pointer to the SDDS_FILEBUFFER structure used for buffered writing. |
1 | The string was successfully written and byte-swapped. |
0 | An error occurred during the write operation, such as I/O failures or memory allocation issues. |
lzmafp
is valid and open for writing. This function does not perform memory allocation for the string; it assumes that the string is already allocated and managed appropriately. Definition at line 5630 of file SDDS_binary.c.
|
extern |
Writes a parameter definition to an LZMA-compressed file.
This function outputs the definition of a single parameter in the SDDS layout to an LZMA-compressed file. It includes fields such as name, symbol, units, description, format string, data type, and fixed value. The definition is enclosed within ¶meter and &end tags.
parameter_definition | Pointer to the parameter definition structure. |
lzmafp | The LZMA-compressed file pointer where the parameter definition will be written. |
Definition at line 438 of file SDDS_write.c.
|
extern |
Writes the SDDS protocol version to an LZMA-compressed file.
This function outputs the SDDS protocol version string to the provided LZMA-compressed file pointer. Maintaining the protocol version is essential for ensuring the integrity of the SDDS file format.
version_number | The SDDS protocol version number to write. |
lzmafp | The LZMA-compressed file pointer where the version string will be written. |
Definition at line 77 of file SDDS_write.c.
void SDDS_ParseSpecialComments | ( | SDDS_DATASET * | SDDS_dataset, |
char * | s ) |
Parses and processes special comment commands within the SDDS dataset.
This function interprets special commands embedded within comment strings of the SDDS dataset. Supported special commands include:
big-endian
little-endian
fixed-rowcount
Each recognized command updates the commentFlags
field within the dataset's layout to reflect the presence of these special configurations.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. The commentFlags field will be updated based on the parsed commands. |
[in] | s | Pointer to the null-terminated string containing special comment commands to be parsed. |
s
is properly formatted and null-terminated to prevent undefined behavior.Definition at line 5251 of file SDDS_utils.c.
|
extern |
Process the array definition section of the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the array definition string. |
Definition at line 243 of file SDDS_process.c.
|
extern |
Process the associate definition section of the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the associate definition string. |
Definition at line 181 of file SDDS_process.c.
|
extern |
Process the column definition section of the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the column definition string. |
Definition at line 88 of file SDDS_process.c.
|
extern |
Process the data mode section of the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the data mode string. |
Definition at line 212 of file SDDS_process.c.
|
extern |
Process the description section of the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the description string. |
Definition at line 57 of file SDDS_process.c.
|
extern |
Process the include command within the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the include command string. |
Definition at line 150 of file SDDS_process.c.
|
extern |
Process the parameter definition section of the SDDS dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure. |
s | Pointer to the parameter definition string. |
Definition at line 119 of file SDDS_process.c.
|
extern |
Reads the arrays from an ASCII file into the SDDS dataset.
This function reads array data from an ASCII file and stores it in the provided SDDS dataset. It supports reading from regular files, as well as GZIP and LZMA compressed files if enabled.
SDDS_dataset | Pointer to the SDDS dataset where the arrays will be stored. |
Definition at line 1047 of file SDDS_ascii.c.
|
extern |
Reads a detailed page of data from an ASCII file into an SDDS dataset with optional sparsity and statistics.
This function reads a page of data from an ASCII SDDS file into the provided dataset, supporting various options for data sparsity and statistical processing. It allows specifying a sparse interval and offset to read every nth row starting from a specific offset, as well as reading only the last specified number of rows. Additionally, it can compute statistical measures over the sparse data, such as average, median, minimum, or maximum.
SDDS_dataset | Pointer to the SDDS dataset where the data will be stored. |
sparse_interval | Interval for sparsity; reads every nth row if greater than 1. Use 1 to read every row. |
sparse_offset | Offset from the first row to start reading. Rows before this offset are skipped. |
last_rows | Number of last rows to read. If greater than 0, only the last last_rows rows are read, overriding sparse_interval and sparse_offset . Use 0 to read all rows according to sparse_interval and sparse_offset . |
sparse_statistics | Statistical operation to perform over the sparse data:
|
last_rows
is specified and greater than 0, it overrides sparse_interval
and sparse_offset
. In case of errors during reading, the function attempts to recover if autoRecover
is enabled in the dataset. Definition at line 1273 of file SDDS_ascii.c.
|
extern |
Reads the last specified number of rows from an ASCII page of an SDDS dataset.
This function reads only the last specified number of rows from the next ASCII page in the SDDS dataset.
SDDS_dataset | Pointer to the SDDS dataset where the data will be stored. |
last_rows | Number of rows to read from the end of the page. |
SDDS_ReadAsciiPageDetailed()
to perform the actual reading. Definition at line 1241 of file SDDS_ascii.c.
|
extern |
Reads the parameters from an ASCII file into the SDDS dataset.
This function reads parameter data from an ASCII file and stores it in the provided SDDS dataset. It supports reading from regular files, as well as GZIP and LZMA compressed files if enabled.
SDDS_dataset | Pointer to the SDDS dataset where the parameters will be stored. |
Definition at line 927 of file SDDS_ascii.c.
|
extern |
Reads binary arrays from an SDDS dataset.
This function iterates through all array definitions within the specified SDDS dataset and reads their binary data from the underlying file. It handles various compression formats, including uncompressed, LZMA-compressed, and GZIP-compressed files. For each array, the function reads its definition, dimensions, and data elements, allocating and managing memory as necessary. String arrays are handled by reading each string individually, while other data types are read in bulk.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
1 | All arrays were successfully read and stored. |
0 | An error occurred during the read operation, such as I/O failures, memory allocation issues, or corrupted array definitions. |
Definition at line 3053 of file SDDS_binary.c.
|
extern |
Reads the binary columns from an SDDS dataset.
This function iterates through all column definitions within the specified SDDS dataset and reads their binary data from the underlying file. It handles various compression formats, including uncompressed, LZMA-compressed, and GZIP-compressed files. For each column, the function reads data for each row, managing memory allocation for string columns as necessary. Non-string data types are read in bulk for each column.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
1 | All columns were successfully read and stored. |
0 | An error occurred during the read operation, such as I/O failures, memory allocation issues, or corrupted column definitions. |
Definition at line 3218 of file SDDS_binary.c.
|
extern |
Reads a binary page from an SDDS dataset.
This function reads a binary page from the specified SDDS dataset. It allows for sparse reading by specifying the sparse_interval
and sparse_offset
parameters, enabling the reading of data at specified intervals or starting from a specific offset.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
sparse_interval | Interval at which to read rows. A value greater than 1 enables sparse reading. |
sparse_offset | Number of initial rows to skip before starting to read data. |
sparse_statistics | Flag indicating whether to compute statistics during sparse reading:
|
-1
if the end-of-file is reached.0
on error.The function internally calls SDDS_ReadBinaryPageDetailed
with the provided parameters to perform the actual reading. It handles various scenarios, including non-native byte orders and different data layouts (row-major or column-major).
Definition at line 2120 of file SDDS_binary.c.
|
extern |
Reads a binary page from an SDDS dataset with detailed options.
This function reads a binary page from the specified SDDS dataset, providing detailed control over the reading process. It supports sparse reading, reading a specific number of rows from the end, and computing statistics on the data.
Typically, this function is not called directly. Instead, it is invoked through higher-level functions such as SDDS_ReadBinaryPage
or SDDS_ReadBinaryPageLastRows
, which provide simplified interfaces for common reading scenarios.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
sparse_interval | Interval at which to read rows. A value greater than 1 enables sparse reading. |
sparse_offset | Number of initial rows to skip before starting to read data. |
last_rows | The number of rows to read from the end of the dataset. If 0 , all rows are read. |
sparse_statistics | Flag indicating whether to compute statistics during sparse reading:
|
-1
if the end-of-file is reached.0
on error.The function performs the following steps:
-1
.SDDS_ReadNonNativePageDetailed
if necessary.SDDS_ReadBinaryColumns
if necessary.sparse_interval
and sparse_offset
.sparse_statistics
is enabled, computes the specified statistics (average, median, min, max) on floating-point data.zLib
for gzip, LZMA libraries) must be enabled during compilation for handling compressed files. Definition at line 2202 of file SDDS_binary.c.
|
extern |
Reads the last specified number of rows from a binary page of an SDDS dataset.
This function reads the last last_rows
rows from the binary page of the specified SDDS dataset. It is useful for retrieving recent data entries without processing the entire dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
last_rows | The number of rows to read from the end of the dataset. |
-1
if the end-of-file is reached.0
on error.The function internally calls SDDS_ReadBinaryPageDetailed
with sparse_interval
set to 1
, sparse_offset
set to 0
, and last_rows
as specified. This configuration ensures that only the last last_rows
rows are read from the dataset.
last_rows
does not exceed the total number of rows in the dataset to avoid errors.Definition at line 2150 of file SDDS_binary.c.
|
extern |
Reads binary parameters from the specified SDDS dataset.
This function iterates through all the parameters defined in the SDDS dataset layout and reads their values from the underlying file. It handles different data types, including strings, and manages memory allocation for string parameters. Depending on the dataset's compression settings (uncompressed, LZMA, or GZIP), it uses the appropriate reading functions to retrieve the parameter values.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
1 | All parameters were successfully read and stored. |
0 | An error occurred during the read operation, such as I/O errors, data type mismatches, or memory allocation failures. |
Definition at line 2941 of file SDDS_binary.c.
|
extern |
Reads a binary row from the specified SDDS dataset.
This function reads a single row of data from the given SDDS dataset. Depending on the dataset's configuration, it handles uncompressed, LZMA-compressed, or GZIP-compressed files. For each column in the dataset, the function reads the appropriate data type. If a column is of type string, it reads the string using the corresponding string reading function. If the 'skip' parameter is set, the function skips reading the data without storing it.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
[in] | row | The row number to read. Must be within the allocated range of rows in the dataset. |
[in] | skip | If non-zero, the function skips reading the data for each column without storing it. |
1 | The row was successfully read and stored (or skipped). |
0 | An error occurred during reading, such as I/O errors or memory allocation failures. |
Definition at line 2711 of file SDDS_binary.c.
|
extern |
Reads a binary string from a file with buffering.
This function reads a binary string from the specified file by first reading the length of the string and then reading the string content based on the length. If the 'skip' parameter is set, the string data is skipped over instead of being stored. The function allocates memory for the string, which should be freed by the caller when no longer needed.
[in] | fp | The file pointer to read from. Must be an open file in binary read mode. |
[in,out] | fBuffer | Pointer to the file buffer used for buffered reading operations. |
[in] | skip | If non-zero, the string data is skipped without being stored. |
NULL | An error occurred during reading or memory allocation. |
Non-NULL | Pointer to the read string. |
Definition at line 2616 of file SDDS_binary.c.
|
extern |
Reads the header layout of an SDDS dataset from a file.
SDDS_dataset | The SDDS dataset structure to store the layout information. |
fp | The file pointer to the SDDS file. |
Definition at line 517 of file SDDS_input.c.
|
extern |
Reads the non-native endian binary columns from an SDDS dataset.
This function is similar to SDDS_ReadBinaryColumns but specifically handles columns with non-native endianness. It iterates through all column definitions within the specified SDDS dataset and reads their binary data from the underlying file, ensuring that the byte order is correctly swapped to match the system's native endianness. The function supports various compression formats, including uncompressed, LZMA-compressed, and GZIP-compressed files.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
1 | All non-native endian columns were successfully read and byte-swapped. |
0 | An error occurred during the read or byte-swapping operation, such as I/O failures, memory allocation issues, or corrupted column definitions. |
Definition at line 3459 of file SDDS_binary.c.
|
extern |
Reads a detailed non-native endian binary page from an SDDS dataset.
This function reads a binary page from the specified SDDS dataset, handling data with non-native endianness. It supports both sparse reading and reading of the last few rows based on the provided parameters. The function performs necessary byte order conversions to ensure correct data interpretation on the host system.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
[in] | sparse_interval | Interval between rows to be read for sparsity. |
[in] | sparse_offset | Offset to start reading rows for sparsity. |
[in] | last_rows | Number of last rows to read from the dataset. |
>0 | Page number successfully read. |
0 | An error occurred during the read operation, such as I/O failures, data corruption, or unsupported data modes. |
Definition at line 4230 of file SDDS_binary.c.
|
extern |
Reads the last few rows from a non-native endian binary page in an SDDS dataset.
This function reads the specified number of last rows from a binary page in the given SDDS dataset, handling data with non-native endianness. It performs necessary byte order conversions to ensure correct data interpretation on the host system.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
[in] | last_rows | Number of last rows to read from the dataset. |
>0 | Number of rows successfully read. |
0 | An error occurred during the read operation, such as I/O failures, data corruption, or unsupported data modes. |
Definition at line 4203 of file SDDS_binary.c.
char * SDDS_ReadNonNativeLZMABinaryString | ( | struct lzmafile * | lzmafp, |
SDDS_FILEBUFFER * | fBuffer, | ||
int32_t | skip ) |
Reads a non-native endian binary string from an LZMA-compressed file.
This function reads a binary string from the specified LZMA-compressed file pointer, handling non-native endianness. It first reads the length of the string, swaps its byte order if necessary, allocates memory for the string, reads the string data, and null-terminates it.
[in] | lzmafp | Pointer to the LZMAFILE from which to read the string. |
[in,out] | fBuffer | Pointer to the SDDS_FILEBUFFER structure used for buffered reading. |
[in] | skip | If non-zero, the function will skip reading the string data, useful for sparse reading. |
Non-NULL | Pointer to the newly allocated string. |
NULL | An error occurred during reading or memory allocation. |
Definition at line 4903 of file SDDS_binary.c.
|
extern |
Reads a detailed non-native endian page from an SDDS dataset.
This function reads a page of data from the specified SDDS dataset, handling data with non-native endianness. It supports both ASCII and binary data modes, performing necessary byte order conversions to ensure correct data interpretation on the host system. Additionally, it allows for sparse reading and reading of the last few rows based on the provided parameters.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
[in] | mode | Mode flag to support future expansion. |
[in] | sparse_interval | Interval between rows to be read for sparsity. |
[in] | sparse_offset | Offset to start reading rows for sparsity. |
[in] | last_rows | Number of last rows to read from the dataset. |
>0 | Number of rows successfully read. |
0 | An error occurred during the read operation, such as I/O failures, data corruption, or unsupported data modes. |
Definition at line 4051 of file SDDS_binary.c.
|
extern |
Reads the last few rows from a non-native endian page in an SDDS dataset.
This function reads the specified number of last rows from the non-native endian page of the given SDDS dataset. It handles data with non-native endianness, performing necessary byte order conversions to ensure correct data interpretation on the host system.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to read from. |
[in] | last_rows | Number of last rows to read from the dataset. |
>0 | Number of rows successfully read. |
0 | An error occurred during the read operation, such as I/O failures, data corruption, or unsupported data modes. |
Definition at line 4118 of file SDDS_binary.c.
void SDDS_ResetSpecialCommentsModes | ( | SDDS_DATASET * | SDDS_dataset | ) |
Resets the special comments modes in the SDDS dataset.
This function clears all special comment flags that have been set within the dataset. After calling this function, the dataset will no longer have any special configurations related to comments.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. The commentFlags field will be reset to 0 . |
Definition at line 5221 of file SDDS_utils.c.
|
extern |
Transfers data from a source row to a target row within an SDDS dataset.
This function copies all column data from the specified source row to the target row in the provided SDDS dataset. It handles both string and non-string data types appropriately, ensuring that memory is managed correctly for string entries.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
target | The index of the target row where data will be copied to. |
source | The index of the source row from which data will be copied. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the row transfer was successful. |
0 | Indicates that an error occurred (e.g., invalid dataset, out-of-range indices, memory allocation failure, string copy failure). |
target
and source
must be valid row indices within the dataset.Definition at line 3802 of file SDDS_extract.c.
|
extern |
Updates the current ASCII page of an SDDS dataset with new data.
This function updates the ASCII page of the provided SDDS dataset, appending any new rows that have been added since the last write. It handles updating the row count in the file and ensures data consistency. If the dataset is not currently writing a page, it initiates a new page write.
SDDS_dataset | Pointer to the SDDS dataset to update. |
mode | Mode flags that control the update behavior. Common modes include:
|
SDDS_SetError()
.Definition at line 2167 of file SDDS_ascii.c.
|
extern |
Updates the binary page of an SDDS dataset.
This function updates the binary page of the specified SDDS dataset based on the provided mode. It handles writing the dataset's binary data to the associated file, managing buffering, and handling different file formats such as gzip and LZMA if applicable.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to update. |
mode | Bitmask indicating the update mode. It can be:
|
1
on successful update.0
if an error occurs during the update process.The function performs several checks before updating:
SDDS_OUTPUT_ENDIANESS
to determine if a non-native binary update is required.Definition at line 1077 of file SDDS_binary.c.
|
extern |
Updates a non-native endian binary page in an SDDS dataset.
This function updates an existing binary page in the specified SDDS dataset, handling byte order reversal to convert between little-endian and big-endian formats. It supports updating rows based on the provided mode flags, such as flushing the table. The function ensures that the buffer is flushed before performing the update and writes any new rows that have been flagged for writing. It also handles fixed row counts and manages byte order conversions as necessary.
[in,out] | SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to update. |
[in] | mode | Bitmask indicating the update mode (e.g., FLUSH_TABLE). |
1 | The binary page was successfully updated and byte-swapped. |
0 | An error occurred during the update operation, such as I/O failures, invalid row counts, or corrupted dataset definitions. |
Definition at line 5711 of file SDDS_binary.c.
|
extern |
Writes an array definition to a standard file.
This function outputs the definition of a single array in the SDDS layout. It includes fields such as name, symbol, units, description, format string, group name, data type, and dimensions. The definition is enclosed within &array and &end tags.
array_definition | Pointer to the array definition structure. |
fp | The file pointer where the array definition will be written. |
Definition at line 692 of file SDDS_write.c.
|
extern |
Writes the arrays of an SDDS dataset in ASCII format to a file.
This function writes all arrays contained in the provided SDDS dataset to the specified file pointer in ASCII format. For each array, it writes the dimensions, a description line, and the array elements formatted according to their data type.
SDDS_dataset | Pointer to the SDDS dataset containing the arrays to be written. |
fp | File pointer to the ASCII file where the array data will be written. |
SDDS_SetError()
.SDDS_WriteTypedValue()
to write each array element according to its data type. Each array element is written, with up to 6 elements per line. Definition at line 635 of file SDDS_ascii.c.
|
extern |
Writes a page of data in ASCII format to the SDDS dataset.
This function writes the current page of data from the SDDS dataset to an ASCII file. It handles writing to regular files, as well as LZMA and GZIP compressed files if enabled. The function writes the page number, parameters, arrays, and rows of data according to the SDDS format.
SDDS_dataset | Pointer to the SDDS dataset containing the data to be written. |
Definition at line 410 of file SDDS_ascii.c.
|
extern |
Writes the parameter data of an SDDS dataset in ASCII format to a file.
This function writes all parameters of the SDDS dataset to the provided file pointer in ASCII format. Only parameters that do not have fixed values are written. Each parameter value is written on a new line.
SDDS_dataset | Pointer to the SDDS dataset containing the parameter data. |
fp | File pointer to the ASCII file where the parameter data will be written. |
Definition at line 531 of file SDDS_ascii.c.
|
extern |
Writes a single row of data in ASCII format to a file.
This function writes the specified row from the SDDS dataset to the provided file pointer in ASCII format. The data is formatted according to the data types of the columns. Supports multi-line rows as specified by the data mode settings in the dataset layout.
SDDS_dataset | Pointer to the SDDS dataset containing the data. |
row | Zero-based index of the row to write. |
fp | File pointer to the ASCII file where the row data will be written. |
SDDS_SetError()
.SDDS_WriteTypedValue()
to write each column value according to its data type. The number of values per line is determined by the lines_per_row
setting in the dataset layout. Definition at line 775 of file SDDS_ascii.c.
|
extern |
Writes an associate definition to a standard file.
This function outputs the definition of an associate in the SDDS layout. It includes fields such as name, filename, contents, path, description, and an SDDS flag. The definition is enclosed within &associate and &end tags.
associate_definition | Pointer to the associate definition structure. |
fp | The file pointer where the associate definition will be written. |
Definition at line 493 of file SDDS_write.c.
|
extern |
Writes the binary arrays of the SDDS dataset to a file.
This function writes all arrays defined in the SDDS dataset to the associated binary file. It handles arrays with and without dimensions, and manages different compression formats such as gzip and LZMA if enabled.
SDDS_dataset | Pointer to the SDDS_DATASET structure containing the dataset to write. |
1
on successful write of all arrays.0
if an error occurs during the writing process.The function performs the following steps:
SDDS_STRING
, it writes each string element using the appropriate compression method.The function handles different file formats:
SDDS_GZipWriteBinaryString
and SDDS_GZipBufferedWrite
.SDDS_LZMAWriteBinaryString
and SDDS_LZMABufferedWrite
.SDDS_WriteBinaryString
and SDDS_BufferedWrite
.zLib
or LZMA) must be enabled during compilation for handling compressed files. Definition at line 1533 of file SDDS_binary.c.
|
extern |
Writes the binary columns of an SDDS dataset to the associated file.
This function iterates over each column defined in the SDDS dataset layout and writes its data to the binary file. It handles different data types, including strings and numeric types, and supports various compression formats such as gzip and LZMA if enabled.
Depending on the dataset's configuration, the function writes directly to a standard binary file, a gzip-compressed file, or an LZMA-compressed file. It also handles sparse data by only writing rows flagged for inclusion.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to write. |
1
on successful writing of all columns.0
if an error occurs during the writing process.The function performs the following steps:
SDDS_CheckDataset
.zLib
for gzip, LZMA libraries) must be enabled during compilation for handling compressed files.Definition at line 1673 of file SDDS_binary.c.
|
extern |
Writes a binary page of data to an SDDS dataset, handling compression and buffering.
This function writes a binary page (including parameters, arrays, and row data) to the SDDS dataset pointed to by SDDS_dataset
. It handles different file types, including regular files, LZMA-compressed files, and GZIP-compressed files, and uses buffering to improve write performance.
The function performs the following steps:
It uses the appropriate buffered write functions (SDDS_BufferedWrite
, SDDS_LZMABufferedWrite
, or SDDS_GZipBufferedWrite
) depending on the file type.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the SDDS dataset to write to. |
SDDS_SetError
if any step fails. Definition at line 749 of file SDDS_binary.c.
|
extern |
Writes the binary parameters of the SDDS dataset.
This function writes all non-fixed parameters of the SDDS dataset to the associated binary file. It handles different compression formats such as gzip and LZMA if enabled.
SDDS_dataset | Pointer to the SDDS_DATASET structure containing the dataset to write. |
1
on successful write of all parameters.0
if an error occurs during the writing process.The function performs the following steps:
SDDS_STRING
, it writes the string using the appropriate compression method.The function handles different file formats:
SDDS_GZipWriteBinaryString
and SDDS_GZipBufferedWrite
.SDDS_LZMAWriteBinaryString
and SDDS_LZMABufferedWrite
.SDDS_WriteBinaryString
and SDDS_BufferedWrite
.zLib
or LZMA) must be enabled during compilation for handling compressed files. Definition at line 1426 of file SDDS_binary.c.
|
extern |
Writes a single binary row of an SDDS dataset to the associated file.
This function writes the data of a specified row within the SDDS dataset to the binary file. It handles different data types, including strings and numeric types, and supports various compression formats such as gzip and LZMA if enabled.
Depending on the dataset's configuration, the function writes directly to a standard binary file, a gzip-compressed file, or an LZMA-compressed file.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
row | The zero-based index of the row to write. |
1
on successful writing of the row.0
if an error occurs during the writing process.The function performs the following steps:
SDDS_CheckDataset
.zLib
for gzip, LZMA libraries) must be enabled during compilation for handling compressed files.Definition at line 1957 of file SDDS_binary.c.
|
extern |
Writes a column definition to a standard file.
This function outputs the definition of a single column in the SDDS layout. It includes fields such as name, symbol, units, description, format string, and data type. The definition is enclosed within &column and &end tags.
column_definition | Pointer to the column definition structure. |
fp | The file pointer where the column definition will be written. |
Definition at line 329 of file SDDS_write.c.
|
extern |
Writes the data mode section to a standard file.
This function outputs the data mode settings of the SDDS layout to the specified file pointer. It includes settings such as mode, lines per row, row counts, endianess, column-major order, and fixed row counts. The section is enclosed within &data and &end tags.
layout | Pointer to the SDDS layout structure containing data mode settings. |
fp | The file pointer where the data mode section will be written. |
Definition at line 576 of file SDDS_write.c.
|
extern |
Writes the SDDS description section to a standard file.
This function writes the description section of the SDDS layout, including optional text and contents fields. It encapsulates the data within &description and &end tags.
text | The descriptive text for the SDDS layout. |
contents | The contents description for the SDDS layout. |
fp | The file pointer where the description will be written. |
Definition at line 256 of file SDDS_write.c.
|
extern |
Writes non-native endian binary columns of an SDDS dataset to the associated file.
This function iterates over each column defined in the SDDS dataset layout and writes its data to the binary file using a non-native byte order. It handles different data types, including strings and numeric types, and supports various compression formats such as gzip and LZMA if enabled.
Depending on the dataset's configuration, the function writes directly to a standard binary file, a gzip-compressed file, or an LZMA-compressed file. It also handles sparse data by only writing rows flagged for inclusion.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset to write. |
1
on successful writing of all columns.0
if an error occurs during the writing process.The function performs the following steps:
SDDS_CheckDataset
.zLib
for gzip, LZMA libraries) must be enabled during compilation for handling compressed files.Definition at line 1816 of file SDDS_binary.c.
|
extern |
Writes a parameter definition to a standard file.
This function outputs the definition of a single parameter in the SDDS layout. It includes fields such as name, symbol, units, description, format string, data type, and fixed value. The definition is enclosed within ¶meter and &end tags.
parameter_definition | Pointer to the parameter definition structure. |
fp | The file pointer where the parameter definition will be written. |
Definition at line 411 of file SDDS_write.c.
|
extern |
Writes the SDDS protocol version to a standard file.
This function outputs the SDDS protocol version string to the provided file pointer. It is crucial that the protocol version remains unchanged to ensure compatibility.
version_number | The SDDS protocol version number to write. |
fp | The file pointer where the version string will be written. |
Definition at line 59 of file SDDS_write.c.
void * UnpackLZMAOpen | ( | char * | filename | ) |
Definition at line 401 of file SDDS_lzma.c.
|
extern |
Array of supported SDDS command names.
Lists the command strings that can be used within SDDS files to define structure and data.
Definition at line 81 of file SDDS_data.c.