1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 15:53:44 +02:00

eeshow/lib-parse.c (lib_parse_file): separate "core" from lib_parse

This commit is contained in:
Werner Almesberger 2016-08-10 15:26:03 -03:00
parent 4a2177e041
commit ab613fcc86
2 changed files with 10 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);