source: trunk/gsdl/packages/wv-0.5.44-gs/src/pcd.c@ 1468

Last change on this file since 1468 was 1468, checked in by paynter, 24 years ago

The wv Packages from www.wvware.com is used to convert Word documents into
HTML. This is an adaptation of wv version 0.5.44 for greenstone; it is
called by the gsConvert.pl script.

  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1#include <stdlib.h>
2#include <stdio.h>
3#include "wv.h"
4
5void wvGetPCD(PCD *item,FILE *fd)
6 {
7 U8 temp8;
8 temp8 = getc(fd);
9#ifdef PURIFY
10 wvInitPCD(item);
11#endif
12 item->fNoParaLast = temp8 & 0x01;
13 item->fPaphNil = (temp8 & 0x02) >> 1;
14 item->fCopied = (temp8 & 0x04) >> 2;
15 item->reserved = (temp8 & 0xf8) >> 3;
16 item->fn = getc(fd);
17 item->fc = read_32ubit(fd);
18 wvGetPRM(&item->prm,fd);
19 }
20
21void wvInitPCD(PCD *item)
22 {
23 item->fNoParaLast = 0;
24 item->fPaphNil = 0;
25 item->fCopied = 0;
26 item->reserved = 0;
27 item->fn = 0;
28 item->fc = 0;
29 wvInitPRM(&item->prm);
30 }
31
32
33int wvReleasePCD_PLCF(PCD *pcd,U32 *pos)
34 {
35 wvFree(pcd);
36 wvFree(pos);
37 return(0);
38 }
39
40
41int wvGetPCD_PLCF(PCD **pcd,U32 **pos,U32 *nopcd,U32 offset,U32 len,FILE *fd)
42 {
43 U32 i;
44 if (len == 0)
45 {
46 *pcd = NULL;
47 *pos = NULL;
48 *nopcd = 0;
49 }
50 else
51 {
52 *nopcd=(len-4)/(cbPCD+4);
53 *pos = (U32 *) malloc( (*nopcd+1) * sizeof(U32));
54 if (*pos == NULL)
55 {
56 wvError(("NO MEM 1, failed to alloc %d bytes\n",(*nopcd+1) * sizeof(U32)));
57 return(1);
58 }
59
60 *pcd = (PCD *) malloc(*nopcd * sizeof(PCD));
61 if (*pcd == NULL)
62 {
63 wvError(("NO MEM 1, failed to alloc %d bytes\n",*nopcd * sizeof(PCD)));
64 free(pos);
65 return(1);
66 }
67 fseek(fd,offset,SEEK_SET);
68 for(i=0;i<=*nopcd;i++)
69 {
70 (*pos)[i]=read_32ubit(fd);
71 wvTrace(("pcd pos is %x\n",(*pos)[i]));
72 }
73 for(i=0;i<*nopcd;i++)
74 {
75 wvGetPCD(&((*pcd)[i]),fd);
76 wvTrace(("pcd fc is %x, complex is %d, index is %d\n",(*pcd)[i].fc,(*pcd)[i].prm.fComplex,(*pcd)[i].prm.para.var2.igrpprl));
77 }
78 }
79 return(0);
80 }
Note: See TracBrowser for help on using the repository browser.