summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-10 16:33:40 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-10 16:33:40 -0300
commit6cb5efd7dd1705fdffd21e4581b73d0415feaf29 (patch)
treed836db14b41805a3d677538b5b687cbc6244b8aa
parentdbe59daa451bbd64651aa4cfc3a5ab9f37cfba04 (diff)
downloadeeshow-6cb5efd7dd1705fdffd21e4581b73d0415feaf29.tar.gz
eeshow-6cb5efd7dd1705fdffd21e4581b73d0415feaf29.tar.bz2
eeshow-6cb5efd7dd1705fdffd21e4581b73d0415feaf29.zip
aeeshow/sch.h, sch-parse.c: record subsheets in parent, for future caching
-rw-r--r--sch-parse.c11
-rw-r--r--sch.h4
2 files changed, 13 insertions, 2 deletions
diff --git a/sch-parse.c b/sch-parse.c
index 0101351..2959f50 100644
--- a/sch-parse.c
+++ b/sch-parse.c
@@ -288,6 +288,10 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
sheet->next_obj = &sheet->objs;
sheet->next = NULL;
+ sheet->children = NULL;
+ sheet->next_child = &sheet->children;
+ sheet->next_sib = NULL;
+
sheet->parent = ctx->curr_sheet;
ctx->curr_sheet = sheet;
@@ -312,7 +316,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
const struct file *related)
{
const char *name = ctx->obj.u.sheet.file;
- const struct sheet *sheet;
+ struct sheet *sheet;
struct file file;
bool res;
@@ -326,6 +330,10 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
return NULL; /* caller MUST clean up */
end_sheet(ctx);
+ *ctx->curr_sheet->next_child = sheet;
+ ctx->curr_sheet->next_child = &sheet->next_sib;
+ sheet->next_sib = NULL;
+
return sheet;
}
@@ -640,4 +648,3 @@ void sch_free(struct sch_ctx *ctx)
ctx->sheets = next;
}
}
-
diff --git a/sch.h b/sch.h
index 1aa31c7..4bb08f9 100644
--- a/sch.h
+++ b/sch.h
@@ -98,6 +98,10 @@ struct sheet {
struct sch_obj **next_obj;
struct sheet *parent;
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 {