#include #include "pushy.h" // A splitter links a unode together with a dnode by embedding the // unode in a dupS, which locates the unode by field "mate". typedef struct {dnode n; dnode * bSt; char s; unode* mate,* sav;} dupS; static void dupa(char c, dupS * n, unode* p){ n->s = c; n->sav = p; {dnode* dn = (dnode*)n; (dn->nsn->code)(c, dn->nsn, n->mate);}} static void dupb(unode* p){dupS* ds = (dupS*)(p->dn); (ds->bSt->code)(ds->s, ds->bSt, ds->sav);} dnode* ctee(dnode* s1, dnode* s2){ dupS* dn = malloc(sizeof(dupS)); unode* un = malloc(sizeof(unode)); *dn = (dupS){(dnode){(push)dupa, s1}, s2, 0, un, 0}; *un = (unode){dupb, &(dn->n)}; return &(dn->n);}