diff --git a/eeshow/delta.c b/eeshow/delta.c index fe89233..b9a9473 100644 --- a/eeshow/delta.c +++ b/eeshow/delta.c @@ -284,6 +284,30 @@ static bool obj_eq(const struct sch_obj *a, const struct sch_obj *b) } +bool sheet_eq(const struct sheet *a, const struct sheet *b) +{ + const struct sch_obj *obj_a, *obj_b; + + if (a == NULL && b == NULL) + return 1; + if (!(a && b)) + return 0; + + if (a->title != b->title && strcmp(a->title, b->title)) + return 0; + + obj_a = a->objs; + obj_b = b->objs; + while (obj_a && obj_b) { + if (!obj_eq(obj_a, obj_b)) + return 0; + obj_a = obj_a->next; + obj_b = obj_b->next; + } + return obj_a == obj_b; +} + + static void free_obj(struct sch_obj *obj) { /* there may be more to free once we get into cloning components */ diff --git a/eeshow/delta.h b/eeshow/delta.h index 85dd5d5..893825b 100644 --- a/eeshow/delta.h +++ b/eeshow/delta.h @@ -17,6 +17,8 @@ #include "sch.h" +bool sheet_eq(const struct sheet *a, const struct sheet *b); + void delta(const struct sheet *a, const struct sheet *b, struct sheet *res_a, struct sheet *res_b, struct sheet *res_ab); void delta_free(struct sheet *d);