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

aeeshow/sch.h, sch-parse.c: record subsheets in parent, for future caching

This commit is contained in:
Werner Almesberger 2016-08-10 16:33:40 -03:00
parent b6975e3998
commit 77c0e07590
2 changed files with 13 additions and 2 deletions

View File

@ -288,6 +288,10 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
sheet->next_obj = &sheet->objs; sheet->next_obj = &sheet->objs;
sheet->next = NULL; sheet->next = NULL;
sheet->children = NULL;
sheet->next_child = &sheet->children;
sheet->next_sib = NULL;
sheet->parent = ctx->curr_sheet; sheet->parent = ctx->curr_sheet;
ctx->curr_sheet = sheet; ctx->curr_sheet = sheet;
@ -312,7 +316,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
const struct file *related) const struct file *related)
{ {
const char *name = ctx->obj.u.sheet.file; const char *name = ctx->obj.u.sheet.file;
const struct sheet *sheet; struct sheet *sheet;
struct file file; struct file file;
bool res; bool res;
@ -326,6 +330,10 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
return NULL; /* caller MUST clean up */ return NULL; /* caller MUST clean up */
end_sheet(ctx); end_sheet(ctx);
*ctx->curr_sheet->next_child = sheet;
ctx->curr_sheet->next_child = &sheet->next_sib;
sheet->next_sib = NULL;
return sheet; return sheet;
} }
@ -640,4 +648,3 @@ void sch_free(struct sch_ctx *ctx)
ctx->sheets = next; ctx->sheets = next;
} }
} }

View File

@ -98,6 +98,10 @@ struct sheet {
struct sch_obj **next_obj; struct sch_obj **next_obj;
struct sheet *parent; struct sheet *parent;
struct sheet *next; struct sheet *next;
struct sheet *children; /* "child" sub-sheets */
struct sheet **next_child;
struct sheet *next_sib; /* siblings sub-sheets of this sheet */
}; };
struct sch_ctx { struct sch_ctx {