Loading...
Searching...
No Matches
feResource.h
Go to the documentation of this file.
#ifndef FERESOURCE_H
#define FERESOURCE_H
#include <sys/param.h>
#define DIR_SEP '/'
#define DIR_SEPP "/"
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#ifdef __cplusplus
#include "../factory/globaldefs.h"
/*****************************************************************
*
* Resource management (feResources.cc)
*
*****************************************************************/
typedef enum {feResUndef = 0, feResBinary, feResDir, feResFile, feResUrl, feResPath} feResourceType;
typedef struct feResourceConfig_s
{
const char* key; // key to identify resource
const char id; // char id to identify resource
feResourceType type; // type of Resource
const char* env; // env variable to look for
const char* fmt; // format string -- see below for epxlaination
char* value; // what it was set to: may be changed
} feResourceConfig_s;
typedef feResourceConfig_s * feResourceConfig;
EXTERN_VAR feResourceConfig_s feResourceConfigs[];
// returns value of Resource as read-only string, or NULL
// if Resource not found
// issues warning, if explicitely requested (warn > 0), or
// if warn < 0 and Resource is gotten for the first time
// Always quiet if warn == 0
char* feResource(const char id, int warn = -1);
char* feResource(const char* key, int warn = -1);
char* feGetResource(const char id, int warn = -1);
// char* feResourceDefault(const char id);
// char* feResourceDefault(const char* key);
// This needs to be called before the first call to feResource
// Initializes Resources, SearchPath, and extends PATH
void feInitResources(const char* argv0);
// Re-inits resources, should be called after changing env. variables
void feReInitResources();
#endif /* end ifdef __cplusplus */
EXTERN_VAR char* feArgv0;
const char fePathSep = ':' ;
#endif
argv0
char * argv0
Definition coeffs_test_runner.cpp:14
feArgv0
VAR char * feArgv0
Definition feResource.cc:19
feResourceConfigs
VAR feResourceConfig_s feResourceConfigs[]
Definition feResource.cc:41
feResourceConfig_s::type
feResourceType type
Definition feResource.h:26
fePathSep
const char fePathSep
Definition feResource.h:58
feResourceConfig_s::id
const char id
Definition feResource.h:25
feResourceConfig_s::value
char * value
Definition feResource.h:29
feReInitResources
void feReInitResources()
Definition feResource.cc:182
feGetResource
char * feGetResource(const char id, int warn=-1)
Definition feResource.cc:145
feResourceConfig_s::key
const char * key
Definition feResource.h:24
feResourceConfig_s::env
const char * env
Definition feResource.h:27
feResourceConfig
feResourceConfig_s * feResourceConfig
Definition feResource.h:31
feResource
char * feResource(const char id, int warn=-1)
Definition feResource.cc:140
feInitResources
void feInitResources(const char *argv0)
Definition feResource.cc:160
feResourceConfig_s::fmt
const char * fmt
Definition feResource.h:28
feResourceType
feResourceType
Definition feResource.h:20
feResBinary
@ feResBinary
Definition feResource.h:20
feResPath
@ feResPath
Definition feResource.h:20
feResDir
@ feResDir
Definition feResource.h:20
feResUrl
@ feResUrl
Definition feResource.h:20
feResUndef
@ feResUndef
Definition feResource.h:20
feResFile
@ feResFile
Definition feResource.h:20
feResourceConfig_s
Definition feResource.h:23
globaldefs.h
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6