/* emit_html_label: */ void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t * tp) { htmlenv_t env; allocObj (job); env.pos = tp->pos; env.finfo.color = tp->fontcolor; env.finfo.name = tp->fontname; env.finfo.size = tp->fontsize; env.finfo.size = tp->fontsize; env.imgscale = agget (job->obj->u.n, "imagescale"); env.objid = job->obj->id; env.objid_set = 0; if ((env.imgscale == NULL) || (env.imgscale[0] == '\0')) env.imgscale = "false"; if (lp->kind == HTML_TBL) { htmltbl_t *tbl = lp->u.tbl; /* set basic graphics context */ /* Need to override line style set by node. */ gvrender_set_style(job, job->gvc->defaultlinestyle); if (tbl->data.pencolor) gvrender_set_pencolor(job, tbl->data.pencolor); else gvrender_set_pencolor(job, DEFAULT_COLOR); emit_html_tbl(job, tbl, &env); } else { emit_html_txt(job, lp->u.txt, &env); } if (env.objid_set) free (env.objid); freeObj (job); }
DbStatus btree1CleanPage(Handle *index, Btree1Set *set, uint32_t totKeyLen) { Btree1Index *btree1 = btree1index(index->map); Btree1Slot librarian, *source, *dest; uint32_t size = btree1->pageSize; Btree1Page *page = set->page; uint32_t max = page->cnt; uint32_t len, cnt, idx; uint32_t newSlot = max; Btree1PageType type; Btree1Page *frame; uint8_t *key; DbAddr addr; librarian.bits = 0; librarian.type = Btree1_librarian; librarian.dead = 1; if( !page->lvl ) { size <<= btree1->leafXtra; type = Btree1_leafPage; } else { type = Btree1_interior; } if( page->min >= (max+1) * sizeof(Btree1Slot) + sizeof(*page) + totKeyLen ) return DB_OK; // skip cleanup and proceed directly to split // if there's not enough garbage // to bother with. if( page->garbage < size / 5 ) return DB_BTREE_needssplit; if( (addr.bits = allocObj(index->map, listFree(index, type), NULL, type, size, false)) ) frame = getObj(index->map, addr); else return DB_ERROR_outofmemory; memcpy (frame, page, size); // skip page info and set rest of page to zero memset (page+1, 0, size - sizeof(*page)); page->garbage = 0; page->act = 0; cnt = 0; idx = 0; source = slotptr(frame, cnt); dest = slotptr(page, idx); // clean up page first by // removing deleted keys while( source++, cnt++ < max ) { if( cnt == set->slotIdx ) newSlot = idx + 2; if( source->dead ) continue; // copy the active key across key = keyaddr(frame, source->off); len = keylen(key) + keypre(key); size -= len; memcpy ((uint8_t *)page + size, key, len); // make a librarian slot if (cnt < max) { (++dest)->bits = librarian.bits; ++idx; } // set up the slot (++dest)->bits = source->bits; dest->off = size; idx++; page->act++; } page->min = size; page->cnt = idx; // update insert slot index // for newly cleaned-up page set->slotIdx = newSlot; // return temporary frame addSlotToFrame(index->map, listFree(index,addr.type), NULL, addr.bits); // see if page has enough space now, or does it still need splitting? if( page->min >= (idx+1) * sizeof(Btree1Slot) + sizeof(*page) + totKeyLen ) return DB_OK; return DB_BTREE_needssplit; }