void wvAddCHPXFromBucket6(CHP *achp, UPXF *upxf, STSH *stsh) { U8 *pointer; U16 i = 0; U8 sprm8; U16 sprm; wvTrace(("cbUPX word 6 is %d\n", upxf->cbUPX)); #ifdef SPRMTEST GET_fprintf_HANDLER() (stderr, "\n"); while (i < upxf->cbUPX) { GET_fprintf_HANDLER() (stderr, "%x (%d) ", *(upxf->upx.chpx.grpprl + i), *(upxf->upx.chpx.grpprl + i)); i++; } GET_fprintf_HANDLER() (stderr, "\n"); i = 0; #endif while (i < upxf->cbUPX) { sprm8 = bread_8ubit(upxf->upx.chpx.grpprl + i, &i); #ifdef SPRMTEST wvError(("chp word 6 sprm is %x (%d)\n", sprm8, sprm8)); #endif sprm = (U16)wvGetrgsprmWord6(sprm8); #ifdef SPRMTEST wvError(("chp word 6 sprm is converted to %x\n", sprm)); #endif pointer = upxf->upx.chpx.grpprl + i; wvApplySprmFromBucket(WORD6, sprm, NULL, achp, NULL, stsh, pointer, &i, NULL); } }
/* Character properties * -basically just like PAPX FKPs above * however, rather than an array of BX structs in rgbx, * there is an array of bytes (giving the word offset to the CHPX) in rgb * -JB */ void wvGetCHPX_FKP (wvVersion ver, CHPX_FKP * fkp, U32 pn, wvStream * fd) { int i; U8 page[WV_PAGESIZE]; U16 pos = 0; /*size_t bytes_read; */ /* [email protected] */ /* there seem to be a lot of repeat calls... */ /* pn=0 is safe because thats the index block, not a CHPX_FKP */ if (pn != 0 && pn == wvCHPX_pn_previous) { memcpy (fkp, &wvCHPX_FKP_previous, sizeof (CHPX_FKP)); return; } wvStream_goto (fd, pn * WV_PAGESIZE); /*bytes_read= */ wvStream_read (page, WV_PAGESIZE, 1, fd); fkp->crun = (U8) page[WV_PAGESIZE - 1]; wvTrace (("chpx fkp gone to %x\n", pn * WV_PAGESIZE + (WV_PAGESIZE - 1))); wvTrace (("crun is %d\n", fkp->crun)); fkp->rgfc = (U32 *) wvMalloc (sizeof (U32) * (fkp->crun + 1)); fkp->rgb = (U8 *) wvMalloc (sizeof (U8) * (fkp->crun)); fkp->grpchpx = (CHPX *) wvMalloc (sizeof (CHPX) * (fkp->crun)); wvStream_goto (fd, pn * WV_PAGESIZE); wvTrace (("offset is %x\n", pn * WV_PAGESIZE)); for (i = 0; i < fkp->crun + 1; i++) { fkp->rgfc[i] = bread_32ubit (&(page[pos]), &pos); wvTrace (("rgfc is %x\n", fkp->rgfc[i])); } for (i = 0; i < fkp->crun; i++) fkp->rgb[i] = bread_8ubit (&(page[pos]), &pos); for (i = 0; i < fkp->crun; i++) { if (fkp->rgb[i] == 0) { wvTrace (("i is %d, using clear chpx\n", i)); wvInitCHPX (&(fkp->grpchpx[i])); } else { wvTrace ( ("chpx index i is %d, offset is %x\n", i, (pn * WV_PAGESIZE) + (fkp->rgb[i] * 2))); pos = fkp->rgb[i] * 2; wvGetCHPX (ver, &(fkp->grpchpx[i]), page, &pos); } } if (wvCHPX_pn_previous != 0) internal_wvReleaseCHPX_FKP (&wvCHPX_FKP_previous); memcpy (&wvCHPX_FKP_previous, fkp, sizeof (CHPX_FKP)); wvCHPX_pn_previous = pn; }
void wvGetCHPX(wvVersion ver, CHPX *item, U8 *page, U16 *pos) { U8 i; item->cbGrpprl = bread_8ubit(&(page[*pos]), pos); if (item->cbGrpprl > 0) { item->grpprl = (U8 *)wvMalloc(item->cbGrpprl); memcpy(item->grpprl, &(page[*pos]), item->cbGrpprl); } else item->grpprl = NULL; item->istd = 0; /* I have no idea what to set this to... -- nothing; the istd is contained in the grpprl*/ for (i = 0; i < item->cbGrpprl; i++) wvTrace(("chpx byte is %x\n", item->grpprl[i])); }
int wvAddSEPXFromBucket6 (SEP * asep, SEPX * item, STSH * stsh) { U8 *pointer; U16 i = 0; int ret = 0; U8 sprm8; U16 sprm; Sprm RetSprm; #ifdef SPRMTEST fprintf (stderr, "\n"); while (i < item->cb) { fprintf (stderr, "%x (%d) ", *(item->grpprl + i), *(item->grpprl + i)); i++; } fprintf (stderr, "\n"); i = 0; #endif while (i < item->cb) { sprm8 = bread_8ubit (item->grpprl + i, &i); #ifdef SPRMTEST wvError (("sep word 6 sprm is %x (%d)\n", sprm8, sprm8)); #endif sprm = (U16) wvGetrgsprmWord6 (sprm8); #ifdef SPRMTEST wvTrace (("sep word 6 sprm is converted to %x\n", sprm)); #endif pointer = item->grpprl + i; RetSprm = wvApplySprmFromBucket (WORD6, sprm, NULL, NULL, asep, stsh, pointer, &i, NULL); if (RetSprm.sgc == sgcSep) ret = 1; } return (ret); }
void wvGetBX6 (BX * item, U8 * page, U16 * pos) { item->offset = bread_8ubit (&(page[*pos]), pos); wvGetPHE6 (&item->phe, page, pos); }