MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
readcfg.h File Reference

Macros

#define format2key

Functions

void open_config_prefix (const char *fn, const char *prefix, const char *prekey)
void open_config (const char *fn, int priority)
void close_config (const char *format,...)
int readcfg_peek (const char *format,...)
int readcfg_peek_n (const char *format,...)
int readcfg_peek_priority (const char *format,...)
int readcfg_peek_index (const char *format,...)
void readcfg_ignore (const char *format,...)
const char * readcfg_raw (const char *format,...)
char * readcfg_str (const char *format,...)
int readcfg_int (const char *format,...)
real readcfg_dbl (const char *format,...)
int readcfg_strarr (char ***res, int len, int relax, const char *format,...)
int readcfg_intarr (int **ret, int len, int relax, const char *format,...)
int readcfg_dblarr (real **ret, int len, int relax, const char *format,...)
dmat * readstr_dmat (int n, int relax, const char *key, const char *str)
dmat * readcfg_dmat (int n, int relax, const char *format,...)
lmat * readcfg_lmat (int n, int relax, const char *format,...)
dcell * readcfg_dcell (const char *format,...)

Detailed Description

Routines to read .conf type config files. Each entry is composed of a key and a value. The entries are maintained in a hash table. Each entry can be retrieved from the key.

Macro Definition Documentation

◆ format2key

#define format2key
Value:
char key[512]; \
va_list ap; \
va_start(ap,format); \
vsnprintf(key,sizeof(key), format, ap); \
va_end(ap)

Function Documentation

◆ close_config()

void close_config ( const char * format,
... )

Save all configs to file and check for unused config options.

◆ readcfg_peek()

int readcfg_peek ( const char * format,
... )

Check whether a have a record of a key.

◆ readcfg_peek_n()

int readcfg_peek_n ( const char * format,
... )

Check the size of an array input

◆ readcfg_peek_priority()

int readcfg_peek_priority ( const char * format,
... )

Return priority value of the record

◆ readcfg_peek_index()

int readcfg_peek_index ( const char * format,
... )

Return index value of the record

◆ readcfg_ignore()

void readcfg_ignore ( const char * format,
... )

Ignore an entry and do not warn if it does not exist.

◆ readcfg_raw()

const char * readcfg_raw ( const char * format,
... )

Obtain a raw value from the key.

◆ readcfg_str()

char * readcfg_str ( const char * format,
... )

Obtain a string value from the key.

◆ readcfg_int()

int readcfg_int ( const char * format,
... )

Read integer

◆ readcfg_dbl()

real readcfg_dbl ( const char * format,
... )

Read real

◆ readcfg_strarr()

int readcfg_strarr ( char *** ret,
int len,
int relax,
const char * format,
... )

Read string array of len elements

◆ readcfg_intarr()

int readcfg_intarr ( int ** ret,
int len,
int relax,
const char * format,
... )

Read integer array of len elements

◆ readcfg_dblarr()

int readcfg_dblarr ( real ** ret,
int len,
int relax,
const char * format,
... )

Read integer array of len elements

◆ readstr_dmat()

dmat * readstr_dmat ( int n,
int relax,
const char * key,
const char * str )

Read as a dmat. It can be a file name or an array.

Parameters
[in]nNumber of elements requested
[in]relax1: allow fewer values and fill the rest
[in]keythe key that needs the value.
[in]strinput

◆ readcfg_dmat()

dmat * readcfg_dmat ( int n,
int relax,
const char * format,
... )

Read as a dmat. It can be a file name or an array.

◆ readcfg_lmat()

lmat * readcfg_lmat ( int n,
int relax,
const char * format,
... )

Read as an lmat.

◆ readcfg_dcell()

dcell * readcfg_dcell ( const char * format,
... )

Read dcell