Lines Matching refs:tab
52 static int vdunfold(Table_t* tab)
54 static int vdunfold(tab)
55 Table_t* tab;
64 n_tar = tab->n_tar;
65 tar = tab->tar;
66 n_src = tab->n_src;
67 src = tab->src;
68 target = tab->target;
69 source = tab->source;
72 { if((inst = VDGETC((Vdio_t*)tab)) < 0)
82 { if((size = VDGETC((Vdio_t*)tab)) < 0)
85 (size = (long)(*_Vdgetu)((Vdio_t*)tab,size)) < 0)
96 { if((long)(n = sizeof(tab->data)) > size)
98 if((*_Vdread)((Vdio_t*)tab,tab->data,n) != n )
100 r = (*target->writef)((Void_t*)tab->data, n,
101 tab->t_org+t, target);
107 if((*_Vdread)((Vdio_t*)tab,tar+t,n) != n)
125 { if((size = VDGETC((Vdio_t*)tab)) < 0)
128 (size = (long)(*_Vdgetu)((Vdio_t*)tab,size)) < 0)
136 if((copy = VDGETC((Vdio_t*)tab)) < 0)
139 copy = tab->quick[copy + ((k_type-K_QUICK)<<VD_BITS)];
142 (copy = (long)(*_Vdgetu)((Vdio_t*)tab,copy)) < 0)
145 copy += tab->recent[k_type - K_RECENT];
150 K_UPDATE(tab->quick,tab->recent,tab->rhere,copy);
165 tab->t_org+t, target);
174 if(tab->compress)
175 { copy += tab->t_org - tab->n_src;
179 { copy += tab->s_org;
190 { n = sizeof(tab->data);
194 ((Void_t*)tab->data, n,
199 ((Void_t*)tab->data, n,
200 tab->t_org+t, target);
229 { if((long)(n = sizeof(tab->data)) > s)
232 ((Void_t*)tab->data, n,
233 a + tab->t_org, target );
237 ((Void_t*)tab->data, n,
238 t + tab->t_org, target );
271 Table_t tab;
279 INIT(&tab.io,delta);
280 tab.source = source;
281 tab.target = target;
287 if((*_Vdread)(&tab.io,magic,n) != n)
294 if((t = (long)(*_Vdgetu)(&tab.io,0)) < 0 ||
300 if((t = (long)(*_Vdgetu)(&tab.io,0)) < 0)
311 if((window = (long)(*_Vdgetu)(&tab.io,0)) < 0)
314 tab.compress = n_src == 0 ? 1 : 0;
317 tab.tar = tab.src = NIL(uchar*);
318 tab.t_alloc = tab.s_alloc = 0;
323 if(n > 0 && (tab.tar = (uchar*)malloc(n*sizeof(uchar))) )
324 tab.t_alloc = 1;
332 if(n > 0 && (tab.src = (uchar*)malloc(n*sizeof(uchar))) )
333 tab.s_alloc = 1;
338 { tab.t_org = t; /* current location in target stream */
341 { tab.s_org = 0;
344 tab.n_src = 0;
346 { tab.n_src = HEADER(window);
347 p = t - tab.n_src;
349 tab.src = tar + p;
350 else if(tab.src)
351 { n = (int)tab.n_src;
352 if(tab.tar)
353 { data = tab.tar + tab.n_tar - n;
354 memcpy((Void_t*)tab.src,(Void_t*)data,n);
357 { r = (*target->readf)(tab.src,n,p,target);
365 { tab.n_src = window;
371 tab.s_org = p;
374 tab.src = src + p;
375 else if(tab.src)
376 { n = (int)tab.n_src;
377 r = (*source->readf)(tab.src,n,p,source);
385 tab.tar = (uchar*)tar+t;
386 tab.n_tar = window < (n_tar-t) ? window : (n_tar-t);
388 K_INIT(tab.quick,tab.recent,tab.rhere);
389 if(vdunfold(&tab) < 0)
391 if(!target->data && tab.tar)
392 { p = (*target->writef)((Void_t*)tab.tar,(int)tab.n_tar,t,target);
393 if(p != tab.n_tar)
397 t += tab.n_tar;
401 if(tab.t_alloc)
402 free((Void_t*)tab.tar);
403 if(tab.s_alloc)
404 free((Void_t*)tab.src);