Lines Matching refs:cfg

29     XLU_Config *cfg;  in xlu_cfg_init()  local
31 cfg= malloc(sizeof(*cfg)); in xlu_cfg_init()
32 if (!cfg) return 0; in xlu_cfg_init()
34 cfg->report= report; in xlu_cfg_init()
35 cfg->config_source= strdup(report_source); in xlu_cfg_init()
36 if (!cfg->config_source) { free(cfg); return 0; } in xlu_cfg_init()
38 cfg->settings= 0; in xlu_cfg_init()
39 return cfg; in xlu_cfg_init()
42 static int ctx_prep(CfgParseContext *ctx, XLU_Config *cfg) { in ctx_prep() argument
45 ctx->cfg= cfg; in ctx_prep()
53 fprintf(cfg->report,"%s: unable to create scanner: %s\n", in ctx_prep()
54 cfg->config_source, strerror(e)); in ctx_prep()
78 ctx->cfg->report); in parse()
82 int xlu_cfg_readfile(XLU_Config *cfg, const char *real_filename) { in xlu_cfg_readfile() argument
87 e = ctx_prep(&ctx, cfg); in xlu_cfg_readfile()
93 fprintf(cfg->report,"%s: unable to open configuration file: %s\n", in xlu_cfg_readfile()
109 int xlu_cfg_readdata(XLU_Config *cfg, const char *data, int length) { in xlu_cfg_readdata() argument
114 e= ctx_prep(&ctx, cfg); in xlu_cfg_readdata()
119 fprintf(cfg->report,"%s: unable to allocate scanner buffer\n", in xlu_cfg_readdata()
120 cfg->config_source); in xlu_cfg_readdata()
159 void xlu_cfg_destroy(XLU_Config *cfg) { in xlu_cfg_destroy() argument
162 if (!cfg) return; in xlu_cfg_destroy()
163 for (set= cfg->settings; in xlu_cfg_destroy()
169 free(cfg->config_source); in xlu_cfg_destroy()
170 free(cfg); in xlu_cfg_destroy()
173 static XLU_ConfigSetting *find(const XLU_Config *cfg, const char *n) { in find() argument
176 for (set= cfg->settings; in find()
184 static int find_atom(const XLU_Config *cfg, const char *n, in find_atom() argument
188 set= find(cfg,n); in find_atom()
193 fprintf(cfg->report, in find_atom()
196 cfg->config_source, set->lineno, n); in find_atom()
209 int xlu_cfg_value_get_string(const XLU_Config *cfg, XLU_ConfigValue *value, in xlu_cfg_value_get_string() argument
214 fprintf(cfg->report, in xlu_cfg_value_get_string()
216 cfg->config_source, value->loc.first_line, in xlu_cfg_value_get_string()
226 int xlu_cfg_value_get_list(const XLU_Config *cfg, XLU_ConfigValue *value, in xlu_cfg_value_get_list() argument
231 fprintf(cfg->report, in xlu_cfg_value_get_list()
233 cfg->config_source, value->loc.first_line, in xlu_cfg_value_get_list()
250 int xlu_cfg_get_string(const XLU_Config *cfg, const char *n, in xlu_cfg_get_string() argument
255 e= find_atom(cfg,n,&set,dont_warn); if (e) return e; in xlu_cfg_get_string()
260 int xlu_cfg_replace_string(const XLU_Config *cfg, const char *n, in xlu_cfg_replace_string() argument
265 e= find_atom(cfg,n,&set,dont_warn); if (e) return e; in xlu_cfg_replace_string()
271 int xlu_cfg_get_bounded_long(const XLU_Config *cfg, const char *n, in xlu_cfg_get_bounded_long() argument
279 e= find_atom(cfg,n,&set,dont_warn); if (e) return e; in xlu_cfg_get_bounded_long()
282 fprintf(cfg->report, in xlu_cfg_get_bounded_long()
285 cfg->config_source, set->lineno, n); in xlu_cfg_get_bounded_long()
294 fprintf(cfg->report, in xlu_cfg_get_bounded_long()
297 cfg->config_source, set->lineno, n, strerror(e)); in xlu_cfg_get_bounded_long()
302 fprintf(cfg->report, in xlu_cfg_get_bounded_long()
304 cfg->config_source, set->lineno, n); in xlu_cfg_get_bounded_long()
309 fprintf(cfg->report, in xlu_cfg_get_bounded_long()
311 cfg->config_source, set->lineno, l, min); in xlu_cfg_get_bounded_long()
316 fprintf(cfg->report, in xlu_cfg_get_bounded_long()
318 cfg->config_source, set->lineno, l, max); in xlu_cfg_get_bounded_long()
326 int xlu_cfg_get_long(const XLU_Config *cfg, const char *n, in xlu_cfg_get_long() argument
328 return xlu_cfg_get_bounded_long(cfg, n, LONG_MIN, LONG_MAX, value_r, in xlu_cfg_get_long()
332 int xlu_cfg_get_defbool(const XLU_Config *cfg, const char *n, libxl_defbool *b, in xlu_cfg_get_defbool() argument
338 ret = xlu_cfg_get_long(cfg, n, &l, dont_warn); in xlu_cfg_get_defbool()
344 int xlu_cfg_get_list(const XLU_Config *cfg, const char *n, in xlu_cfg_get_list() argument
347 set= find(cfg,n); if (!set) return ESRCH; in xlu_cfg_get_list()
350 fprintf(cfg->report, in xlu_cfg_get_list()
353 cfg->config_source, set->lineno, n); in xlu_cfg_get_list()
362 int xlu_cfg_get_list_as_string_list(const XLU_Config *cfg, const char *n, in xlu_cfg_get_list_as_string_list() argument
368 rc = xlu_cfg_get_list(cfg, n, &list, &nr, dont_warn); in xlu_cfg_get_list_as_string_list()
562 XLU_ConfigSetting *prev_set = find(ctx->cfg, name); in xlu__cfg_set_store()
581 set->next= ctx->cfg->settings; in xlu__cfg_set_store()
582 ctx->cfg->settings= set; in xlu__cfg_set_store()
699 fprintf(ctx->cfg->report, in xlu__cfg_yyerror()
701 ctx->cfg->config_source, lineno, in xlu__cfg_yyerror()