From ab613fcc86849608dd084f684433e7f06f6797ed Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 10 Aug 2016 15:26:03 -0300 Subject: [PATCH] eeshow/lib-parse.c (lib_parse_file): separate "core" from lib_parse --- eeshow/lib-parse.c | 11 +++++++++-- eeshow/lib.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/eeshow/lib-parse.c b/eeshow/lib-parse.c index 379458b..9ea9679 100644 --- a/eeshow/lib-parse.c +++ b/eeshow/lib-parse.c @@ -258,15 +258,22 @@ static bool lib_parse_line(const struct file *file, } +bool lib_parse_file(struct lib *lib, struct file *file) +{ + lib->state = lib_skip; + return file_read(file, lib_parse_line, lib); +} + + + bool lib_parse(struct lib *lib, const char *name, const struct file *related) { struct file file; bool res; - lib->state = lib_skip; if (!file_open(&file, name, related)) return 0; - res = file_read(&file, lib_parse_line, lib); + res = lib_parse_file(lib, &file); file_close(&file); return res; } diff --git a/eeshow/lib.h b/eeshow/lib.h index 115a516..4a902fe 100644 --- a/eeshow/lib.h +++ b/eeshow/lib.h @@ -119,6 +119,7 @@ const struct comp *lib_find(const struct lib *lib, const char *name); bool lib_field_visible(const struct comp *comp, int n); void lib_render(const struct comp *comp, unsigned unit, const int m[6]); +bool lib_parse_file(struct lib *lib, struct file *file); bool lib_parse(struct lib *lib, const char *name, const struct file *related); void lib_init(struct lib *lib); void lib_free(struct lib *lib);