mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 18:42:28 +02:00
eeshow/sch.h (struct sheet.parent): remove; we can just record it locally
This commit is contained in:
parent
8f352832e0
commit
9524447bf1
@ -278,7 +278,6 @@ static void init_res(struct sheet *res)
|
|||||||
res->title = NULL;
|
res->title = NULL;
|
||||||
res->objs = NULL;
|
res->objs = NULL;
|
||||||
res->next_obj = &res->objs;
|
res->next_obj = &res->objs;
|
||||||
res->parent = NULL;
|
|
||||||
res->next = NULL;
|
res->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,6 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
|
|||||||
|
|
||||||
sheet->oid = NULL;
|
sheet->oid = NULL;
|
||||||
|
|
||||||
sheet->parent = ctx->curr_sheet;
|
|
||||||
ctx->curr_sheet = sheet;
|
ctx->curr_sheet = sheet;
|
||||||
|
|
||||||
*ctx->next_sheet = sheet;
|
*ctx->next_sheet = sheet;
|
||||||
@ -302,13 +301,6 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void end_sheet(struct sch_ctx *ctx)
|
|
||||||
{
|
|
||||||
ctx->curr_sheet = ctx->curr_sheet->parent;
|
|
||||||
assert(ctx->curr_sheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool parse_line(const struct file *file, void *user, const char *line);
|
static bool parse_line(const struct file *file, void *user, const char *line);
|
||||||
|
|
||||||
|
|
||||||
@ -317,7 +309,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;
|
||||||
struct sheet *sheet;
|
struct sheet *parent, *sheet;
|
||||||
struct file file;
|
struct file file;
|
||||||
void *oid;
|
void *oid;
|
||||||
bool res;
|
bool res;
|
||||||
@ -325,6 +317,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
|
|||||||
if (!file_open(&file, name, related))
|
if (!file_open(&file, name, related))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
parent = ctx->curr_sheet;
|
||||||
sheet = new_sheet(ctx);
|
sheet = new_sheet(ctx);
|
||||||
oid = file_oid(&file);
|
oid = file_oid(&file);
|
||||||
sheet->oid = oid;
|
sheet->oid = oid;
|
||||||
@ -335,7 +328,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
|
|||||||
for (other = ctx->prev->sheets; other; other = other->next)
|
for (other = ctx->prev->sheets; other; other = other->next)
|
||||||
if (!other->has_children &&
|
if (!other->has_children &&
|
||||||
file_oid_eq(other->oid, oid)) {
|
file_oid_eq(other->oid, oid)) {
|
||||||
end_sheet(ctx);
|
ctx->curr_sheet = parent;
|
||||||
sheet->title = other->title;
|
sheet->title = other->title;
|
||||||
sheet->objs = other->objs;
|
sheet->objs = other->objs;
|
||||||
return sheet;
|
return sheet;
|
||||||
@ -347,9 +340,9 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
|
|||||||
file_close(&file);
|
file_close(&file);
|
||||||
if (!res)
|
if (!res)
|
||||||
return NULL; /* leave it to caller to clean up */
|
return NULL; /* leave it to caller to clean up */
|
||||||
end_sheet(ctx);
|
|
||||||
|
|
||||||
ctx->curr_sheet->has_children = 1;
|
ctx->curr_sheet = parent;
|
||||||
|
parent->has_children = 1;
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ struct sheet {
|
|||||||
const char *title; /* malloced, unless delta */
|
const char *title; /* malloced, unless delta */
|
||||||
struct sch_obj *objs;
|
struct sch_obj *objs;
|
||||||
struct sch_obj **next_obj;
|
struct sch_obj **next_obj;
|
||||||
struct sheet *parent;
|
|
||||||
struct sheet *next;
|
struct sheet *next;
|
||||||
|
|
||||||
bool has_children; /* aka sub-sheets */
|
bool has_children; /* aka sub-sheets */
|
||||||
|
Loading…
Reference in New Issue
Block a user