Loading...
Searching...
No Matches
feResource.h File Reference
`#include <sys/param.h>`
`#include "../factory/globaldefs.h"`

Go to the source code of this file.

## Data Structures

struct | feResourceConfig_s

## Macros

#define | DIR_SEP '/'
#define | DIR_SEPP "/"
#define | MAXPATHLEN 1024

## Typedefs

typedef feResourceConfig_s * | feResourceConfig

## Enumerations

enum | feResourceType { feResUndef = 0 , feResBinary , feResDir , feResFile , feResUrl , feResPath }

## Functions

char * | feResource (const char id, int warn=-1)
char * | feResource (const char *key, int warn=-1)
char * | feGetResource (const char id, int warn=-1)
void | feInitResources (const char *argv0)
void | feReInitResources ()

## Variables

EXTERN_VAR feResourceConfig_s | feResourceConfigs []
EXTERN_VAR char * | feArgv0
const char | fePathSep = ':'

## Data Structure Documentation

## feResourceConfig_s

struct feResourceConfig_s

Definition at line 22 of file feResource.h.

Data Fields
const char * | env |
const char * | fmt |
const char | id |
const char * | key |
feResourceType | type |
char * | value |

## Macro Definition Documentation

## DIR_SEP

#define DIR_SEP '/'

Definition at line 6 of file feResource.h.

## DIR_SEPP

#define DIR_SEPP "/"

Definition at line 7 of file feResource.h.

## MAXPATHLEN

#define MAXPATHLEN 1024

Definition at line 10 of file feResource.h.

## Typedef Documentation

## feResourceConfig

typedef feResourceConfig_s* feResourceConfig

Definition at line 31 of file feResource.h.

## Enumeration Type Documentation

## feResourceType

enum feResourceType

Enumerator
feResUndef |
feResBinary |
feResDir |
feResFile |
feResUrl |
feResPath |

Definition at line 20 of file feResource.h.

{feResUndef = 0, feResBinary, feResDir, feResFile, feResUrl, feResPath} feResourceType;
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

## Function Documentation

## feGetResource()

char * feGetResource | ( | const char | id,
|  | int | warn = -1 )

Definition at line 145 of file feResource.cc.

{
return feResource(feGetResourceConfig(id), warn);
}
feGetResourceConfig
static feResourceConfig feGetResourceConfig(const char id)
Definition feResource.cc:210
feResource
static char * feResource(feResourceConfig config, int warn)
Definition feResource.cc:233

## feInitResources()

void feInitResources | ( | const char * | argv0 | ) |

Definition at line 160 of file feResource.cc.

{
if (argv0==NULL)
{
//WarnS("illegal argv[0]==NULL");
feArgv0 = (char*)malloc(MAXPATHLEN+strlen("/Singular"));
getcwd(feArgv0, MAXPATHLEN);
strcat(feArgv0,"/Singular");
}
else
feArgv0 = strdup(argv0);
#ifdef RESOURCE_DEBUG
printf("feInitResources(argv0: '%s'): entering...\n", feArgv0);
#endif
// init some Resources
feResource('b');
feResource('r');
// don't complain about stuff when initializing SingularPath
feResource('s',0);
feResource('P');
}
argv0
char * argv0
Definition coeffs_test_runner.cpp:14
feArgv0
VAR char * feArgv0
Definition feResource.cc:19
strdup
#define strdup
Definition omAllocFunc.c:18
malloc
#define malloc
Definition omAllocFunc.c:12
NULL
#define NULL
Definition omList.c:12
MAXPATHLEN
#define MAXPATHLEN
Definition omRet2Info.c:22

## feReInitResources()

void feReInitResources | ( |  | ) |

Definition at line 182 of file feResource.cc.

{
int i = 0;
while (feResourceConfigs[i].key != NULL)
{
if ((feResourceConfigs[i].value != NULL)
&& (feResourceConfigs[i].value[0] != '\0'))
{
free(feResourceConfigs[i].value);
feResourceConfigs[i].value = (char *)"";
}
i++;
}
#ifdef RESOURCE_DEBUG
printf("feInitResources(): entering...\n");
#endif
// init some Resources
feResource('b');
feResource('r');
// don't complain about stuff when initializing SingularPath
feResource('s',0);
}
i
int i
Definition cfEzgcd.cc:132
feResourceConfigs
VAR feResourceConfig_s feResourceConfigs[]
Definition feResource.cc:41
free
#define free
Definition omAllocFunc.c:14

## feResource() [1/2]

char * feResource | ( | const char * | key,
|  | int | warn = -1 )

Definition at line 135 of file feResource.cc.

{
return feResource(feGetResourceConfig(key), warn);
}

## feResource() [2/2]

char * feResource | ( | const char | id,
|  | int | warn = -1 )

Definition at line 140 of file feResource.cc.

{
return feResource(feGetResourceConfig(id), warn);
}

## Variable Documentation

## feArgv0

EXTERN_VAR char* feArgv0

Definition at line 56 of file feResource.h.

## fePathSep

const char fePathSep = ':'

Definition at line 58 of file feResource.h.

## feResourceConfigs

EXTERN_VAR feResourceConfig_s feResourceConfigs[]

Definition at line 33 of file feResource.h.