source: git/resources/feResource.h @ 756676e

spielwiese
Last change on this file since 756676e was 756676e, checked in by Reimer Behrends <behrends@…>, 5 years ago
Add includes for globaldefs.2
  • Property mode set to 100644
File size: 1.8 KB
Line 
1#ifndef FERESOURCE_H
2#define FERESOURCE_H
3
4#include <sys/param.h>
5
6#define DIR_SEP '/'
7#define DIR_SEPP "/"
8
9#ifndef MAXPATHLEN
10#define MAXPATHLEN 1024
11#endif
12
13#ifdef __cplusplus
14#include "../factory/globaldefs.h"
15/*****************************************************************
16 *
17 * Resource management (feResources.cc)
18 *
19 *****************************************************************/
20typedef enum {feResUndef = 0, feResBinary, feResDir, feResFile, feResUrl, feResPath} feResourceType;
21
22typedef struct feResourceConfig_s
23{
24  const char*           key;   // key to identify resource
25  const char            id;    // char id to identify resource
26  feResourceType  type;  // type of Resource
27  const char*           env;   // env variable to look for
28  const char*           fmt;   // format string -- see below for epxlaination
29  char*                 value; // what it was set to: may be changed
30} feResourceConfig_s;
31typedef feResourceConfig_s * feResourceConfig;
32
33EXTERN_VAR feResourceConfig_s feResourceConfigs[];
34
35// returns value of Resource as read-only string, or NULL
36// if Resource not found
37// issues warning, if explicitely requested (warn > 0), or
38// if warn < 0 and Resource is gotten for the first time
39// Always quiet if warn == 0
40char* feResource(const char id, int warn = -1);
41char* feResource(const char* key, int warn = -1);
42
43char* feGetResource(const char id, int warn = -1);
44
45// char* feResourceDefault(const char id);
46// char* feResourceDefault(const char* key);
47
48
49// This needs to be called before the first call to feResource
50// Initializes Resources, SearchPath, and extends PATH
51void feInitResources(const char* argv0);
52// Re-inits resources, should be called after changing env. variables
53void feReInitResources();
54#endif /* end ifdef __cplusplus */
55
56EXTERN_VAR char* feArgv0;
57
58const char fePathSep = ':' ;
59
60#endif
Note: See TracBrowser for help on using the repository browser.