MCPcopy Create free account
hub / github.com/apache/nuttx / parse_kconfigfile

Function parse_kconfigfile

tools/kconfig2html.c:2254–2429  ·  view source on GitHub ↗

Forward reference */

Source from the content-addressed store, hash-verified

2252static void process_kconfigfile(const char *kconfigdir,
2253 const char *kconfigname); /* Forward reference */
2254static char *parse_kconfigfile(FILE *stream, const char *kconfigdir,
2255 const char *kconfigname)
2256{
2257 enum token_type_e tokid;
2258 char *token = NULL;
2259
2260 /* Process each line in the Kconfig file */
2261
2262 while (kconfig_line(stream) != NULL)
2263 {
2264 /* Process the first token on the Kconfig file line */
2265
2266 token = get_token();
2267 while (token != NULL)
2268 {
2269 tokid = tokenize(token);
2270
2271 switch (tokid)
2272 {
2273 case TOKEN_SOURCE:
2274 {
2275 /* Get the relative path from the Kconfig file line */
2276
2277 char *source = get_token();
2278
2279 /* Remove optional quoting */
2280
2281 source = dequote(source);
2282 if (source)
2283 {
2284 char *configname = basename(source);
2285 char *subdir = dirname(source);
2286 char *dirpath;
2287
2288 /* Check for an absolute path */
2289
2290 if (source[0] == '/')
2291 {
2292 dirpath = strdup(subdir);
2293 }
2294 else
2295 {
2296 /* Check if the directory path contains $APPSDIR */
2297
2298 char *appsdir = strstr(subdir, "$APPSDIR");
2299 if (appsdir)
2300 {
2301 char *tmp = appsdir + strlen("$APPSDIR");
2302
2303 *appsdir = '\0';
2304 asprintf(&dirpath, "%s/%s%s%s",
2305 g_kconfigroot, subdir,
2306 g_appsdir, tmp);
2307 }
2308 else
2309 {
2310 asprintf(&dirpath, "%s/%s",
2311 g_kconfigroot, subdir);

Callers 1

process_kconfigfileFunction · 0.85

Calls 15

kconfig_lineFunction · 0.85
get_tokenFunction · 0.85
tokenizeFunction · 0.85
dequoteFunction · 0.85
basenameFunction · 0.85
dirnameFunction · 0.85
strdupFunction · 0.85
strstrFunction · 0.85
asprintfFunction · 0.85
process_kconfigfileFunction · 0.85
process_configFunction · 0.85
process_menuFunction · 0.85

Tested by

no test coverage detected