This source file includes following definitions.
- mca_base_parse_paramfile
- mca_base_internal_env_store
- save_value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "opal_config.h"
23
24 #include <stdio.h>
25 #include <string.h>
26
27 #include "opal/class/opal_list.h"
28 #include "opal/mca/mca.h"
29 #include "opal/mca/base/base.h"
30 #include "opal/mca/base/mca_base_vari.h"
31 #include "opal/util/keyval_parse.h"
32 #include "opal/util/output.h"
33 static void save_value(const char *name, const char *value);
34
35 static char * file_being_read;
36 static opal_list_t * _param_list;
37
38 int mca_base_parse_paramfile(const char *paramfile, opal_list_t *list)
39 {
40 file_being_read = (char*)paramfile;
41 _param_list = list;
42
43 return opal_util_keyval_parse(paramfile, save_value);
44 }
45
46 int mca_base_internal_env_store(void)
47 {
48 return opal_util_keyval_save_internal_envars(save_value);
49 }
50
51 static void save_value(const char *name, const char *value)
52 {
53 mca_base_var_file_value_t *fv;
54 bool found = false;
55
56
57
58
59
60 OPAL_LIST_FOREACH(fv, _param_list, mca_base_var_file_value_t) {
61 if (0 == strcmp(name, fv->mbvfv_var)) {
62 if (NULL != fv->mbvfv_value) {
63 free (fv->mbvfv_value);
64 }
65 found = true;
66 break;
67 }
68 }
69
70 if (!found) {
71
72 fv = OBJ_NEW(mca_base_var_file_value_t);
73 if (NULL == fv) {
74 return;
75 }
76
77 fv->mbvfv_var = strdup(name);
78 opal_list_append(_param_list, &fv->super);
79 }
80
81 fv->mbvfv_value = value ? strdup(value) : NULL;
82 fv->mbvfv_file = file_being_read;
83 fv->mbvfv_lineno = opal_util_keyval_parse_lineno;
84 }