ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbKey.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <ngc/core/ngcb.h>

Macros

#define _GNU_SOURCE
 
#define _REENTRANT
 
#define ngcbKEY_COMMENT   '#'
 
#define ngcbKEY_COMMENT1   '/'
 
#define ngcbKEY_NEWLINE   '\n'
 
#define ngcbKEY_BREAK   ';'
 
#define ngcbKEY_NULL   '\0'
 
#define ngcbKEY_SEP   '.'
 
#define ngcbKEY_VECSEP   ','
 
#define ngcbMAX_KEY_LEN   256
 
#define ngcbMAX_KEYELE_LEN   512
 

Functions

int ngcbKeyGetNext (char *fileBuffer, int fileLen, int *pos, int *line, const char *mask, char *key, char *keyVal, char *erms)
 
int ngcbKeySplit (char *key, int *nsplit, char **ksplit, int *val, char *erms)
 
int ngcbKeyIdx (char *key, int *nsplit, int *kval, char *erms)
 
int ngcbKeyMaskIdx (char *key, const char *mask)
 
int ngcbKeyGetVecInt (const char *keyVal, int *vec, char *erms)
 
int ngcbKeyGetVecFloat (const char *keyVal, float *vec, char *erms)
 
int ngcbKeyGetVecDouble (const char *keyVal, double *vec, char *erms)
 
void ngcbDiscardDetIdx (char *key)
 

Detailed Description

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ _REENTRANT

#define _REENTRANT

◆ ngcbKEY_BREAK

#define ngcbKEY_BREAK   ';'

break key

◆ ngcbKEY_COMMENT

#define ngcbKEY_COMMENT   '#'

comment key

◆ ngcbKEY_COMMENT1

#define ngcbKEY_COMMENT1   '/'

comment key

◆ ngcbKEY_NEWLINE

#define ngcbKEY_NEWLINE   '\n'

new line key

◆ ngcbKEY_NULL

#define ngcbKEY_NULL   '\0'

NULL key

◆ ngcbKEY_SEP

#define ngcbKEY_SEP   '.'

separator key

◆ ngcbKEY_VECSEP

#define ngcbKEY_VECSEP   ','

vector separator key

◆ ngcbMAX_KEY_LEN

#define ngcbMAX_KEY_LEN   256

maximum keyword length

◆ ngcbMAX_KEYELE_LEN

#define ngcbMAX_KEYELE_LEN   512

maximum keyword value length

Function Documentation

◆ ngcbDiscardDetIdx()

void ngcbDiscardDetIdx ( char * key)

Discards the DETi index from the keyword, if it is present.

◆ ngcbKeyGetNext()

int ngcbKeyGetNext ( char * fileBuffer,
int fileLen,
int * pos,
int * line,
const char * mask,
char * key,
char * keyVal,
char * erms )

Read the next keyword from fileBuffer. The function returns -1 in case of error. If operation was successful zero is returned. If the end of the buffer has been reached the function returns a positive value(1).

◆ ngcbKeyGetVecDouble()

int ngcbKeyGetVecDouble ( const char * keyVal,
double * vec,
char * erms )

Get 64-bit floating point vector from keyword value keyVal. The function returna the length of the scanned vector. A negative return value indicates an error.

◆ ngcbKeyGetVecFloat()

int ngcbKeyGetVecFloat ( const char * keyVal,
float * vec,
char * erms )

Get 32-bit floating point vector from keyword value keyVal. The function returna the length of the scanned vector. A negative return value indicates an error.

◆ ngcbKeyGetVecInt()

int ngcbKeyGetVecInt ( const char * keyVal,
int * vec,
char * erms )

Get 32-bit integer vector vector from keyword value keyVal. The function returna the length of the scanned vector. A negative return value indicates an error.

◆ ngcbKeyIdx()

int ngcbKeyIdx ( char * key,
int * nsplit,
int * kval,
char * erms )

Get the index-array of all categories in the keyword. The function returns ngcbFAILURE in case of error. If operation was successful ngcbSUCCESS is returned.

◆ ngcbKeyMaskIdx()

int ngcbKeyMaskIdx ( char * key,
const char * mask )

Return the index after the first occurrence of mask in the keyword or -1 if mask is not found or no index is present.

◆ ngcbKeySplit()

int ngcbKeySplit ( char * key,
int * nsplit,
char ** ksplit,
int * val,
char * erms )

Split a keyword into its category parts. The function returns ngcbFAILURE in case of error. If operation was successful ngcbSUCCESS is returned.