| plan 9 kernel history: overview | file list | diff list |
1992/0628/port/devbit.c (diff list | history)
| 1992/06271/sys/src/9/port/devbit.c:77,82 – 1992/0628/sys/src/9/port/devbit.c:77,83 (short | long | prev | next) | ||
| 1992/0622 | int narena; /* number allocated */ | |
| 1990/0327 | int lastid; /* last allocated bitmap id */ | |
| 1992/0209 | int lastsubfid; /* last allocated subfont id */ | |
| 1992/0628 | int lastcachesf; /* last cached subfont id */ | |
| 1990/0623 | int lastfid; /* last allocated font id */ | |
| 1990/0329 | int init; /* freshly opened; init message pending */ | |
| 1990/0613 | int rid; /* read bitmap id */ | |
| 1992/06271/sys/src/9/port/devbit.c:272,277 – 1992/0628/sys/src/9/port/devbit.c:273,279 | ||
| 1990/0327 | bit.lastid = -1; | |
| 1990/0623 | bit.lastfid = -1; | |
| 1992/0209 | bit.lastsubfid = -1; | |
| 1992/0628 | bit.lastcachesf = -1; | |
| 1990/0613 | bit.rid = -1; | |
| 1991/0706 | bit.mid = -1; | |
| 1990/0604 | bit.init = 0; | |
| 1992/06271/sys/src/9/port/devbit.c:335,344 – 1992/0628/sys/src/9/port/devbit.c:337,344 | ||
| 1992/0621 | esp = &bit.subfont[bit.nsubfont]; for(sp=&bit.subfont[1]; sp<esp; sp++){ s = *sp; | |
| 1992/0628 | if(s) | |
| 1992/0621 | subfontfree(s); | |
| 1992/06271/sys/src/9/port/devbit.c:367,372 – 1992/0628/sys/src/9/port/devbit.c:367,373 | ||
| 1992/0627 | int off, j; | |
| 1990/06231 | Fontchar *i; | |
| 1990/0902 | GBitmap *src; | |
| 1992/0628 | BSubfont *s; | |
| 1990/0327 | ||
| 1990/11211 | if(c->qid.path & CHDIR) | |
| 1990/0324 | return devdirread(c, va, n, bitdir, NBIT, devgen); | |
| 1992/06271/sys/src/9/port/devbit.c:506,511 – 1992/0628/sys/src/9/port/devbit.c:507,538 | ||
| 1992/0622 | PSHORT(p+1, bit.lastsubfid); bit.lastsubfid = -1; n = 3; | |
| 1992/0628 | }else if(bit.lastcachesf > 0){ /* * allocate subfont: * 'J' 1 * subfont id 2 * font info 3*12 * fontchars 6*(subfont->n+1) */ p[0] = 'J'; PSHORT(p+1, bit.lastcachesf); s = bit.subfont[bit.lastcachesf]; if(s==0 || n<3+3*12+6*(s->n+1)) error(Ebadblt); p += 3; sprint((char*)p, "%11d %11d %11d ", s->n, s->height, s->ascent); p += 3*12; for(i=s->info,j=0; j<=s->n; j++,i++,p+=6){ PSHORT(p, i->x); p[2] = i->top; p[3] = i->bottom; p[4] = i->left; p[5] = i->width; } n = 3+3*12+6*(s->n+1); bit.lastcachesf = -1; | |
| 1992/0622 | }else if(bit.lastfid >= 0){ /* * allocate font: | |
| 1992/06271/sys/src/9/port/devbit.c:603,609 – 1992/0628/sys/src/9/port/devbit.c:630,636 | ||
| 1990/0324 | { | |
| 1990/0329 | uchar *p, *q; | |
| 1991/0706 | long m, v, miny, maxy, minx, maxx, t, x, y; | |
| 1992/0628 | ulong l, nw, ws, rv, q0, q1; | |
| 1992/0621 | int off, isoff, i, j, ok; | |
| 1990/06111 | Point pt, pt1, pt2; | |
| 1990/0324 | Rectangle rect; | |
| 1992/06271/sys/src/9/port/devbit.c:759,765 – 1992/0628/sys/src/9/port/devbit.c:786,792 | ||
| 1990/0604 | ||
| 1990/0623 | case 'g': /* | |
| 1992/0209 |
| |
| 1992/0628 | * free subfont | |
| 1990/0623 | * 'g' 1 * id 2 */ | |
| 1992/06271/sys/src/9/port/devbit.c:766,775 – 1992/0628/sys/src/9/port/devbit.c:793,801 | ||
| 1990/0623 | if(m < 3) | |
| 1990/11211 | error(Ebadblt); | |
| 1990/0623 | v = GSHORT(p+1); | |
| 1992/0621 |
| |
| 1992/0628 | if(v<0 || v>=bit.nsubfont || (f=bit.subfont[v])==0 || f->ref==0) | |
| 1990/11211 | error(Ebadfont); | |
| 1992/0621 | subfontfree(f); | |
| 1990/0623 | m -= 3; p += 3; break; | |
| 1992/06271/sys/src/9/port/devbit.c:804,817 – 1992/0628/sys/src/9/port/devbit.c:830,856 | ||
| 1990/0329 | ||
| 1992/06271 | case 'j': /* | |
| 1992/0628 | * subfont cache check | |
| 1992/06271 | * * 'j' 1 * qid 8 BUG: ignored */ | |
| 1992/0628 | if(m < 9) error(Ebadblt); q0 = GLONG(p+1); q1 = GLONG(p+5); for(i=0; i<bit.nsubfont; i++){ f = bit.subfont[i]; if(f && f->qid[0]==q0 && f->qid[1]==q1) goto sfcachefound; } error(Esfnotcached); sfcachefound: f->ref++; bit.lastcachesf = i; | |
| 1992/06271 | m -= 9; p += 9; | |
| 1990/0623 | case 'k': | |
| 1992/06271/sys/src/9/port/devbit.c:848,853 – 1992/0628/sys/src/9/port/devbit.c:887,893 | ||
| 1990/0623 | f->ascent = p[4]; | |
| 1992/06271 | f->qid[0] = GLONG(p+7); f->qid[1] = GLONG(p+11); | |
| 1992/0628 | f->ref = 1; | |
| 1990/0623 | v = GSHORT(p+5); | |
| 1992/0621 | if(v<0 || v>=bit.nmap || (dst=bit.map[v])==0) | |
| 1990/11211 | error(Ebadbitmap); | |
| 1992/06271/sys/src/9/port/devbit.c:1250,1257 – 1992/0628/sys/src/9/port/devbit.c:1290,1297 | ||
| 1992/0209 | if(l >= NFCACHE+NFLOOK) error(Ebadblt); v = GSHORT(p+5); | |
| 1992/0622 |
| |
| 1992/0209 |
| |
| 1992/0628 | if(v<0 || v>=bit.nsubfont || (f=bit.subfont[v])==0 || f->ref==0) error(Ebadfont); | |
| 1992/0209 | nw = GSHORT(p+7); if(nw >= f->n) error(Ebadblt); | |
| 1992/06271/sys/src/9/port/devbit.c:1305,1310 – 1992/0628/sys/src/9/port/devbit.c:1345,1351 | ||
| 1992/0209 | { | |
| 1992/0622 | Arena *a, *ea, *na, *aa; | |
| 1992/0621 | GBitmap *b, **bp, **ep; | |
| 1992/0628 | BSubfont *s; | |
| 1992/0209 | ulong l, ws, nw; long t; | |
| 1992/0622 | int i, try; | |
| 1992/06271/sys/src/9/port/devbit.c:1357,1366 – 1992/0628/sys/src/9/port/devbit.c:1398,1428 | ||
| 1992/0622 | if(a->nwords < HDR+nw) a->nwords = HDR+nw; a->words = xalloc(a->nwords*sizeof(ulong)); | |
| 1992/0628 | if(a->words){ a->wfree = a->words; a->nbusy = 0; goto found; } /* free unused subfonts, compact, and try again */ for(i=0; i<bit.nsubfont; i++){ s = bit.subfont[i]; if(s && s->ref==0){ bitfree(s->bits); free(s->info); free(s); bit.subfont[i] = 0; } } bitcompact(); for(a=bit.arena; a<ea; a++){ if(a->words == 0) continue; if(a->wfree+HDR+nw <= a->words+a->nwords) goto found; } if(a == ea) | |
| 1992/0622 | error(Enobitstore); | |
| 1992/0621 | b = smalloc(sizeof(GBitmap)); | |
| 1992/06271/sys/src/9/port/devbit.c:1424,1432 – 1992/0628/sys/src/9/port/devbit.c:1486,1493 | ||
| 1992/0621 | void | |
| 1992/06271 | subfontfree(BSubfont *s) | |
| 1992/0621 | { | |
| 1992/06271 |
| |
| 1992/0621 |
| |
| 1992/0628 | s->ref--; return; | |
| 1992/0621 | } void | |