SDDSlib
|
This file contains the functions related to reading SDDS files. More...
#include "mdb.h"
#include "match_string.h"
#include "SDDS.h"
#include "SDDS_internal.h"
#include "namelist.h"
#include "scan.h"
#include <signal.h>
Go to the source code of this file.
Macros | |
#define | DEBUG 0 |
Functions | |
int32_t | SDDS_InitializeInput (SDDS_DATASET *SDDS_dataset, char *filename) |
int32_t | SDDS_InitializeHeaderlessInput (SDDS_DATASET *SDDS_dataset, char *filename) |
Initializes the SDDS dataset for headerless input. | |
int32_t | SDDS_IsQuoted (char *string, char *position, char quotation_mark) |
Checks if a position in a string is within a quoted section. | |
int32_t | SDDS_GetNamelist (SDDS_DATASET *SDDS_dataset, char *buffer, int32_t buflen, FILE *fp) |
Reads a namelist from a file into a buffer. | |
int32_t | SDDS_GetLZMANamelist (SDDS_DATASET *SDDS_dataset, char *buffer, int32_t buflen, struct lzmafile *lzmafp) |
Reads a namelist from an LZMA-compressed file into a buffer. | |
int32_t | SDDS_ReadLayout (SDDS_DATASET *SDDS_dataset, FILE *fp) |
int32_t | SDDS_LZMAReadLayout (SDDS_DATASET *SDDS_dataset, struct lzmafile *lzmafp) |
int32_t | SDDS_ReadPage (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_CheckEndOfFile (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_ReadPageSparse (SDDS_DATASET *SDDS_dataset, uint32_t mode, int64_t sparse_interval, int64_t sparse_offset, int32_t sparse_statistics) |
int32_t | SDDS_ReadPageLastRows (SDDS_DATASET *SDDS_dataset, int64_t last_rows) |
int64_t | SDDS_SetRowLimit (int64_t limit) |
int64_t | SDDS_GetRowLimit () |
int32_t | SDDS_GotoPage (SDDS_DATASET *SDDS_dataset, int32_t page_number) |
Sets the current page of the SDDS dataset to the specified page number. | |
void | SDDS_SetTerminateMode (uint32_t mode) |
void | SDDS_SetColumnMemoryMode (SDDS_DATASET *SDDS_dataset, uint32_t mode) |
int32_t | SDDS_GetColumnMemoryMode (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_FreeStringData (SDDS_DATASET *SDDS_dataset) |
void | SDDS_FreeTableStrings (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_Terminate (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_UpdateRowCount (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_SetAutoReadRecovery (SDDS_DATASET *SDDS_dataset, uint32_t mode) |
int32_t | SDDS_InitializeInputFromSearchPath (SDDS_DATASET *SDDSin, char *file) |
Variables | |
static int64_t | SDDS_RowLimit = INT64_MAX |
Global variable to set a limit on the number of rows read. | |
static int32_t | terminateMode = 0 |
Global variable to set the terminate mode for the SDDS dataset. | |
This file contains the functions related to reading SDDS files.
The SDDS_input.c file provides functions for reading data from SDDS files. It includes functions for opening and closing SDDS files, reading headers, and reading data tables.
Definition in file SDDS_input.c.
#define DEBUG 0 |
Definition at line 38 of file SDDS_input.c.
int32_t SDDS_CheckEndOfFile | ( | SDDS_DATASET * | SDDS_dataset | ) |
Checks if the end of the SDDS dataset file has been reached.
SDDS_dataset | The SDDS dataset structure. |
Definition at line 1020 of file SDDS_input.c.
int32_t SDDS_FreeStringData | ( | SDDS_DATASET * | SDDS_dataset | ) |
Frees all allocated string data in the SDDS dataset.
This function frees any strings allocated for parameters, arrays, and columns within the SDDS dataset. It is typically called during termination to clean up allocated memory.
SDDS_dataset | The SDDS dataset to free string data from. |
Definition at line 1374 of file SDDS_input.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.
int32_t SDDS_GetColumnMemoryMode | ( | SDDS_DATASET * | SDDS_dataset | ) |
Retrieves the current column memory mode for the SDDS dataset.
SDDS_dataset | The SDDS dataset to query. |
Definition at line 1358 of file SDDS_input.c.
int32_t SDDS_GetLZMANamelist | ( | SDDS_DATASET * | SDDS_dataset, |
char * | buffer, | ||
int32_t | buflen, | ||
struct lzmafile * | lzmafp ) |
Reads a namelist from an LZMA-compressed file into a buffer.
This function reads a namelist from an LZMA-compressed file stream into the provided buffer, handling comments and skipping them appropriately.
SDDS_dataset | The SDDS dataset structure. |
buffer | The buffer where the namelist will be stored. |
buflen | The length of the buffer. |
lzmafp | The LZMA file stream to read from. |
Definition at line 344 of file SDDS_input.c.
int32_t SDDS_GetNamelist | ( | SDDS_DATASET * | SDDS_dataset, |
char * | buffer, | ||
int32_t | buflen, | ||
FILE * | fp ) |
Reads a namelist from a file into a buffer.
This function reads a namelist from the given file stream into the provided buffer, handling comments and skipping them appropriately.
SDDS_dataset | The SDDS dataset structure. |
buffer | The buffer where the namelist will be stored. |
buflen | The length of the buffer. |
fp | The file stream to read from. |
Definition at line 248 of file SDDS_input.c.
int64_t SDDS_GetRowLimit | ( | ) |
Retrieves the current row limit for the SDDS dataset.
Definition at line 1247 of file SDDS_input.c.
int32_t SDDS_GotoPage | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | page_number ) |
Sets the current page of the SDDS dataset to the specified page number.
This function is used to navigate to a specific page of the SDDS dataset. It is only supported for non-zip files and does not work for pipe input.
SDDS_dataset | The SDDS dataset to operate on. |
page_number | The page number to navigate to. |
Definition at line 1261 of file SDDS_input.c.
int32_t SDDS_InitializeHeaderlessInput | ( | SDDS_DATASET * | SDDS_dataset, |
char * | filename ) |
Initializes the SDDS dataset for headerless input.
This function initializes the SDDS dataset structure for reading data from a file without a header.
SDDS_dataset | A pointer to the SDDS_DATASET structure to be initialized. |
filename | The name of the file to read data from. |
Definition at line 175 of file SDDS_input.c.
int32_t SDDS_InitializeInput | ( | SDDS_DATASET * | SDDS_dataset, |
char * | filename ) |
Initializes a SDDS_DATASET structure for use in reading data from a SDDS file. This involves opening the file and reading the SDDS header.
SDDS_dataset | Address of the SDDS_DATASET structure for the data set. |
filename | A NULL-terminated character string giving the name of the file to set up for input. |
Definition at line 49 of file SDDS_input.c.
int32_t SDDS_InitializeInputFromSearchPath | ( | SDDS_DATASET * | SDDSin, |
char * | file ) |
Initializes the SDDS_DATASET structure for input from the search path.
The search path is defined by calling setSearchPath
. This function attempts to find the file in the search path and initializes the SDDS dataset for input.
SDDSin | The SDDS_DATASET structure to be initialized. |
file | The name of the file to be opened for input. |
Definition at line 1786 of file SDDS_input.c.
int32_t SDDS_IsQuoted | ( | char * | string, |
char * | position, | ||
char | quotation_mark ) |
Checks if a position in a string is within a quoted section.
Determines whether the specified position within a string falls inside a quoted section delimited by the given quotation mark.
string | The string to examine. |
position | The position within the string to check. |
quotation_mark | The character used as the quotation mark. |
Definition at line 217 of file SDDS_input.c.
int32_t SDDS_LZMAReadLayout | ( | SDDS_DATASET * | SDDS_dataset, |
struct lzmafile * | lzmafp ) |
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.
int32_t SDDS_ReadLayout | ( | SDDS_DATASET * | SDDS_dataset, |
FILE * | fp ) |
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.
int32_t SDDS_ReadPage | ( | SDDS_DATASET * | SDDS_dataset | ) |
Reads a page of an SDDS file. Usually called after SDDS_InitializeInput.
SDDS_dataset | Address of the SDDS_DATASET structure for the data set. |
Definition at line 1006 of file SDDS_input.c.
int32_t SDDS_ReadPageLastRows | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | last_rows ) |
Reads the last specified number of rows from the SDDS dataset.
SDDS_dataset | The pointer to the SDDS dataset structure. |
last_rows | The number of rows to read from the end of the dataset. |
Definition at line 1156 of file SDDS_input.c.
int32_t SDDS_ReadPageSparse | ( | SDDS_DATASET * | SDDS_dataset, |
uint32_t | mode, | ||
int64_t | sparse_interval, | ||
int64_t | sparse_offset, | ||
int32_t | sparse_statistics ) |
Reads a sparsed page of an SDDS file. Usually called after SDDS_InitializeInput.
SDDS_dataset | A pointer to an SDDS dataset. |
mode | Not used. |
sparse_interval | The column data can be sparsified over row intervals if this is greater than 1. |
sparse_offset | This is used to skip the initial rows of the column data. |
sparse_statistics | Not used. |
Definition at line 1082 of file SDDS_input.c.
int32_t SDDS_SetAutoReadRecovery | ( | SDDS_DATASET * | SDDS_dataset, |
uint32_t | mode ) |
Sets the auto-read recovery mode for the SDDS dataset.
SDDS_dataset | The SDDS dataset to modify. |
mode | The mode to set (SDDS_AUTOREADRECOVER or SDDS_NOAUTOREADRECOVER). |
Definition at line 1762 of file SDDS_input.c.
void SDDS_SetColumnMemoryMode | ( | SDDS_DATASET * | SDDS_dataset, |
uint32_t | mode ) |
Sets the column memory mode for the SDDS dataset.
SDDS_dataset | The SDDS dataset to operate on. |
mode | The column memory mode to set. |
Definition at line 1348 of file SDDS_input.c.
int64_t SDDS_SetRowLimit | ( | int64_t | limit | ) |
Sets the row limit for the SDDS dataset.
limit | The maximum number of rows to read. If limit <= 0 , the row limit is set to INT64_MAX . |
Definition at line 1232 of file SDDS_input.c.
void SDDS_SetTerminateMode | ( | uint32_t | mode | ) |
Sets the terminate mode for the SDDS dataset.
mode | The terminate mode to set. |
Definition at line 1338 of file SDDS_input.c.
int32_t SDDS_Terminate | ( | SDDS_DATASET * | SDDS_dataset | ) |
Closes an SDDS file and frees the related memory.
SDDS_dataset | A pointer to an SDDS dataset. |
Definition at line 1448 of file SDDS_input.c.
int32_t SDDS_UpdateRowCount | ( | SDDS_DATASET * | SDDS_dataset | ) |
Updates the row count in the SDDS file for fixed row count mode.
SDDS_dataset | The SDDS dataset to update. |
Definition at line 1702 of file SDDS_input.c.
|
static |
Global variable to set a limit on the number of rows read.
The default value is INT64_MAX
, indicating no limit.
Definition at line 1225 of file SDDS_input.c.
|
static |
Global variable to set the terminate mode for the SDDS dataset.
Default value is 0.
Definition at line 1331 of file SDDS_input.c.