46 #undef CB_CONFIG_STRING
47 #undef CB_CONFIG_BOOLEAN
48 #undef CB_CONFIG_SUPPORT
50 #define CB_CONFIG_ANY(type,var,name) type var = (type)0;
51 #define CB_CONFIG_INT(var,name) unsigned int var = 0;
52 #define CB_CONFIG_STRING(var,name) const char *var = NULL;
53 #define CB_CONFIG_BOOLEAN(var,name) unsigned int var = 0;
54 #define CB_CONFIG_SUPPORT(var,name) enum cb_support var = CB_OK;
60 #undef CB_CONFIG_STRING
61 #undef CB_CONFIG_BOOLEAN
62 #undef CB_CONFIG_SUPPORT
64 #define CB_CONFIG_ANY(type,var,name) , {CB_ANY, name, (void *)&var, NULL}
65 #define CB_CONFIG_INT(var,name) , {CB_INT, name, (void *)&var, NULL}
66 #define CB_CONFIG_STRING(var,name) , {CB_STRING, name, (void *)&var, NULL}
67 #define CB_CONFIG_BOOLEAN(var,name) , {CB_BOOLEAN, name, (void *)&var, NULL}
68 #define CB_CONFIG_SUPPORT(var,name) , {CB_SUPPORT, name, (void *)&var, NULL}
93 #undef CB_CONFIG_STRING
94 #undef CB_CONFIG_BOOLEAN
95 #undef CB_CONFIG_SUPPORT
97 #define CB_CONFIG_SIZE sizeof(config_table) / sizeof(struct config_struct)
111 for (p = s; *p; p++) {
121 const char *str,
const int max,
const int min)
124 _(
"Invalid value '%s' for configuration tag '%s'"), val, name);
127 _(
"should be one of the following values: %s"), str);
128 }
else if (max == min && max == 0) {
141 _(
"Unsupported value '%s' for configuration tag '%s'"), val, name);
165 s = strpbrk (buff,
" \t:=");
167 for (j=strlen(buff); buff[j-1] ==
'\r' || buff[j-1] ==
'\n'; )
170 _(
"Invalid configuration tag '%s'"), buff);
181 if (i == CB_CONFIG_SIZE) {
188 for (s++; *s && strchr (
" \t:=", *s); s++) {
192 for (e = s + 1; *e && !strchr (
"#", *e); e++) {
196 for (--e; e >= s && strchr (
" \t\r\n", *e); e--) {
208 if (strcmp (name,
"assign-clause") == 0) {
209 if (strcmp (val,
"cobol2002") == 0) {
212 }
else if (strcmp (val,
"mf") == 0) {
214 }
else if (strcmp (val,
"ibm") == 0) {
217 invalid_value (fname, line, name, val,
"cobol2002, mf, ibm", 0, 0);
220 }
else if (strcmp (name,
"binary-size") == 0) {
221 if (strcmp (val,
"2-4-8") == 0) {
223 }
else if (strcmp (val,
"1-2-4-8") == 0) {
225 }
else if (strcmp (val,
"1--8") == 0) {
228 invalid_value (fname, line, name, val,
"2-4-8, 1-2-4-8, 1--8", 0, 0);
231 }
else if (strcmp (name,
"binary-byteorder") == 0) {
232 if (strcmp (val,
"native") == 0) {
234 }
else if (strcmp (val,
"big-endian") == 0) {
237 invalid_value (fname, line, name, val,
"native, big-endian", 0, 0);
243 for (j = 0; val[j]; j++) {
244 if (val[j] <
'0' || val[j] >
'9') {
251 if (strcmp (name,
"tab-width") == 0) {
260 }
else if (strcmp (name,
"text-column") == 0) {
269 }
else if (strcmp (name,
"word-length") == 0) {
284 if (strcmp (name,
"include") == 0 ||
285 strcmp (name,
"includeif") == 0) {
291 if (strcmp (name,
"includeif") == 0) {
298 _(
"'%s' not supported with -cb_conf"), name);
301 }
else if (strcmp (name,
"not-reserved") == 0) {
303 }
else if (strcmp (name,
"reserved") == 0) {
306 *((
const char **)var) = val;
311 if (strcmp (val,
"yes") == 0) {
313 }
else if (strcmp (val,
"no") == 0) {
321 if (strcmp (val,
"ok") == 0) {
323 }
else if (strcmp (val,
"warning") == 0) {
325 }
else if (strcmp (val,
"archaic") == 0) {
327 }
else if (strcmp (val,
"obsolete") == 0) {
329 }
else if (strcmp (val,
"skip") == 0) {
331 }
else if (strcmp (val,
"ignore") == 0) {
333 }
else if (strcmp (val,
"error") == 0) {
335 }
else if (strcmp (val,
"unconformable") == 0) {
339 "ok, warning, archaic, obsolete, skip, ignore, error, unconformable", 0, 0);
355 const unsigned char *x;
361 for (i=0; conf_file[i] != 0 && conf_file[i] !=
SLASH_CHAR; i++);
362 if (conf_file[i] == 0) {
363 if (access(conf_file,
F_OK) != 0) {
374 for (i = (
int)strlen(buff); i != 0 && buff[i] !=
SLASH_CHAR; i--);
378 if (access(filename,
F_OK) == 0) {
379 conf_file = filename;
385 if (filename[0] == 0) {
389 if (access(filename,
F_OK) == 0) {
390 conf_file = filename;
399 if (c->
name && strcmp(c->
name, conf_file) == 0) {
408 fp = fopen (conf_file,
"r");
436 if (buff[0] ==
'#' || buff[0] ==
'\n') {
441 for (x = (
const unsigned char *)buff; *x; x++) {
451 if (sub_ret == 1 || sub_ret == 3) {
456 _(
"Configuration file was included here"));
460 if (sub_ret != 0) ret = sub_ret;
486 _(
"The previous loaded configuration '%s' will be discarded"),
void cob_free(void *mptr)
const char * cob_config_dir
static int cb_load_conf_file(const char *conf_file, int isoptional)
int cb_config_entry(char *buff, const char *fname, const int line)
void remove_reserved_word(const char *)
void configuration_warning(const char *, const int, const char *,...) COB_A_FORMAT34
static void unsupported_value(const char *fname, const int line, const char *name, const char *val)
#define CB_BINARY_SIZE_2_4_8
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
#define CB_BYTEORDER_BIG_ENDIAN
static struct includelist * conf_includes
static struct config_struct config_table[]
#define CB_BYTEORDER_NATIVE
void * cobc_main_strdup(const char *dupstr)
#define CB_BINARY_SIZE_1_2_4_8
static char * read_string(const char *text)
struct includelist * next
char * cob_expand_env_string(char *strval)
void configuration_error(const char *, const int, const int, const char *,...) COB_A_FORMAT45
if fold fold static computed alternate extra correct stack on syntax debugging line
static void invalid_value(const char *fname, const int line, const char *name, const char *val, const char *str, const int max, const int min)
int cb_load_std(const char *name)
void add_reserved_word(const char *, const char *, const int)
void * cob_malloc(const size_t size)
#define CB_BINARY_SIZE_1__8
int cb_load_conf(const char *fname, const int prefix_dir)