7 void *pl_emalloc(int n){
11 fprint(2, "Can't malloc!\n");
14 setmalloctag(v, getcallerpc(&n));
17 void *pl_erealloc(void *v, int n)
21 fprint(2, "Can't realloc!\n");
24 setrealloctag(v, getcallerpc(&v));
27 void pl_unexpected(Panel *g, char *rou){
28 fprint(2, "%s called unexpectedly (%s %#p)\n", rou, g->kind, g);
31 void pl_drawerror(Panel *g){
32 pl_unexpected(g, "draw");
34 int pl_hiterror(Panel *g, Mouse *m){
36 pl_unexpected(g, "hit");
39 void pl_typeerror(Panel *g, Rune c){
41 pl_unexpected(g, "type");
43 Point pl_getsizeerror(Panel *g, Point childsize){
44 pl_unexpected(g, "getsize");
47 void pl_childspaceerror(Panel *g, Point *ul, Point *size){
49 pl_unexpected(g, "childspace");
51 void pl_scrollerror(Panel *g, int dir, int button, int num, int den){
52 USED(dir, button, num, den);
53 pl_unexpected(g, "scroll");
55 void pl_setscrollbarerror(Panel *g, int top, int bot, int den){
57 pl_unexpected(g, "setscrollbar");
59 int pl_prinormal(Panel *, Point){
62 Panel *pl_newpanel(Panel *parent, int ndata){
64 if(parent && parent->flags&LEAF){
65 fprint(2, "newpanel: can't create child of %s %#p\n", parent->kind, parent);
66 exits("bad newpanel");
68 v=pl_emalloc(sizeof(Panel));
91 parent->echild->next=v;
97 v->getsize=pl_getsizeerror;
98 v->childspace=pl_childspaceerror;
99 v->scroll=pl_scrollerror;
100 v->setscrollbar=pl_setscrollbarerror;
105 v->data=pl_emalloc(ndata);
110 void plfree(Panel *p){
116 for(cp=p->child;cp;cp=ncp){
120 if(p->free) p->free(p);
121 if(p->data) free(p->data);