My Project
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
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_sfeResourceConfig
 

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

Definition at line 31 of file feResource.h.

Enumeration Type Documentation

◆ feResourceType

Enumerator
feResUndef 
feResBinary 
feResDir 
feResFile 
feResUrl 
feResPath 

Definition at line 20 of file feResource.h.

feResourceType
Definition: feResource.h:20
@ feResBinary
Definition: feResource.h:20
@ feResPath
Definition: feResource.h:20
@ feResDir
Definition: feResource.h:20
@ feResUrl
Definition: feResource.h:20
@ feResUndef
Definition: feResource.h:20
@ feResFile
Definition: feResource.h:20

Function Documentation

◆ feGetResource()

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

Definition at line 148 of file feResource.cc.

149{
150 return feResource(feGetResourceConfig(id), warn);
151}
static feResourceConfig feGetResourceConfig(const char id)
Definition: feResource.cc:213
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:236

◆ feInitResources()

void feInitResources ( const char *  argv0)

Definition at line 163 of file feResource.cc.

164{
165 if (argv0==NULL)
166 {
167 //WarnS("illegal argv[0]==NULL");
168 feArgv0 = (char*)malloc(MAXPATHLEN+strlen("/Singular"));
169 getcwd(feArgv0, MAXPATHLEN);
170 strcat(feArgv0,"/Singular");
171 }
172 else
173 feArgv0 = strdup(argv0);
174#ifdef RESOURCE_DEBUG
175 printf("feInitResources(argv0: '%s'): entering...\n", feArgv0);
176#endif
177 // init some Resources
178 feResource('b');
179 feResource('r');
180 // don't complain about stuff when initializing SingularPath
181 feResource('s',0);
182 feResource('P');
183}
VAR char * feArgv0
Definition: feResource.cc:19
#define strdup
Definition: omAllocFunc.c:18
#define malloc
Definition: omAllocFunc.c:12
#define NULL
Definition: omList.c:12
#define MAXPATHLEN
Definition: omRet2Info.c:22

◆ feReInitResources()

void feReInitResources ( )

Definition at line 185 of file feResource.cc.

186{
187 int i = 0;
188 while (feResourceConfigs[i].key != NULL)
189 {
190 if ((feResourceConfigs[i].value != NULL)
191 && (feResourceConfigs[i].value[0] != '\0'))
192 {
193 free(feResourceConfigs[i].value);
194 feResourceConfigs[i].value = (char *)"";
195 }
196 i++;
197 }
198#ifdef RESOURCE_DEBUG
199 printf("feInitResources(): entering...\n");
200#endif
201 // init some Resources
202 feResource('b');
203 feResource('r');
204 // don't complain about stuff when initializing SingularPath
205 feResource('s',0);
206}
int i
Definition: cfEzgcd.cc:132
VAR feResourceConfig_s feResourceConfigs[]
Definition: feResource.cc:41
#define free
Definition: omAllocFunc.c:14

◆ feResource() [1/2]

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

Definition at line 138 of file feResource.cc.

139{
140 return feResource(feGetResourceConfig(key), warn);
141}

◆ feResource() [2/2]

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

Definition at line 143 of file feResource.cc.

144{
145 return feResource(feGetResourceConfig(id), warn);
146}

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.