static void update (dnode_t *pnode) { Tkvindex_t tkvi; dnode_t *list, *cnode; seennode_t *seennode; char *s; long i, n; indent += 2; n = ((Ttable_t *) pnode->vo)->n; if (!(list = malloc (n * sizeof (dnode_t)))) panic1 (POS, "update", "list malloc failed"); for ( cnode = &list[0], Tgetfirst (pnode->vo, &tkvi); tkvi.kvp; cnode++, Tgetnext (&tkvi) ) { cnode->ko = tkvi.kvp->ko; cnode->vo = tkvi.kvp->vo; cnode->ttype = Tgettype (cnode->vo); } qsort ((char *) list, n, sizeof (dnode_t), cmp); for (i = 0, cnode = &list[0]; i < n; i++, cnode++) { cnode->path = Spath (pnode->path, cnode->ko); seennode = findseen (cnode); if (seennode) { pr ((s = Sseen (cnode->ko, seennode->path))), free (s); } else { add2seen (cnode); if (cnode->ttype == T_TABLE) { pr ((s = Stfull (cnode->ko))), free (s); update (cnode); pr ("];"); } else { pr ((s = Ssfull (cnode->ko, cnode->vo))), free (s); } } } free (list); indent -= 2; }
/* update is called only for TXT_FULL tables */ static void update (txtnode_t *pnode, long ptim) { txtnode_t *cnode, *seennode; long ctim; int i; Gawsetmode (&Gwidgets[pnode->u.f.t.mwi], TRUE); if (!pnode->u.f.t.list) buildlist (pnode); else if (ptim < Tgettime (pnode->vo)) rebuildlist (pnode); for ( i = 0, cnode = &pnode->u.f.t.list[0]; i < pnode->u.f.t.n; i++, cnode++ ) { ctim = cnode->time; if (txtvo2toggle == cnode->vo) { switch (cnode->mode) { case TXT_SEEN: break; case TXT_ABSTRACT: unfillnode (cnode); cnode->mode = TXT_FULL; fillnode (pnode, cnode); break; case TXT_FULL: unfillnode (cnode); cnode->mode = TXT_ABSTRACT; fillnode (pnode, cnode); break; } } if (!(seennode = findseen (cnode))) add2seen (cnode); if ( seennode && cnode->mode == TXT_SEEN && seennode->ko != cnode->u.s.ko ) { unfillnode (cnode); cnode->u.s.txtnode = seennode; cnode->u.s.ko = seennode->ko; fillnode (pnode, cnode); } else if (seennode && cnode->mode != TXT_SEEN) { unfillnode (cnode); cnode->mode = TXT_SEEN; cnode->u.s.txtnode = seennode; cnode->u.s.ko = seennode->ko; fillnode (pnode, cnode); } else if (!seennode && cnode->mode == TXT_SEEN) { unfillnode (cnode); cnode->mode = TXT_ABSTRACT; fillnode (pnode, cnode); } else if (cnode->time == -1) { unfillnode (cnode); if (seennode) cnode->u.s.txtnode = seennode; fillnode (pnode, cnode); } if (cnode->ttype == T_TABLE && cnode->mode == TXT_FULL) update (cnode, ctim); } Gaworder (&Gwidgets[pnode->u.f.t.mwi], pnode, orderfunc); Gawsetmode (&Gwidgets[pnode->u.f.t.mwi], FALSE); }