source: trunk/gsdl/packages/wv-0.5.44-gs/src/bkf.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.3 KB
Line 
1#include <stdlib.h>
2#include <stdio.h>
3#include "wv.h"
4
5void wvGetBKF(BKF *item,FILE *fd)
6 {
7 U16 temp16;
8#ifdef PURIFY
9 wvInitBKF(item);
10#endif
11 item->ibkl = (S16)read_16ubit(fd);
12 temp16 = read_16ubit(fd);
13 item->itcFirst = temp16 & 0x007F;
14 item->fPub = (temp16 & 0x0080) >> 7;
15 item->itcLim = (temp16 & 0x7F00) >> 8;
16 item->fCol = (temp16 & 0x8000) >> 15;
17 }
18
19void wvInitBKF(BKF *item)
20 {
21 item->ibkl = 0;
22 item->itcFirst = 0;
23 item->fPub = 0;
24 item->itcLim = 0;
25 item->fCol = 0;
26 }
27
28int wvGetBKF_PLCF(BKF **bkf,U32 **pos,U32 *nobkf,U32 offset,U32 len,FILE *fd)
29 {
30 U32 i;
31 if (len == 0)
32 {
33 *bkf = NULL;
34 *pos = NULL;
35 *nobkf = 0;
36 }
37 else
38 {
39 *nobkf=(len-4)/(cbBKF+4);
40 *pos = (U32 *) malloc( (*nobkf+1) * sizeof(U32));
41 if (*pos == NULL)
42 {
43 wvError(("NO MEM 1, failed to alloc %d bytes\n",(*nobkf+1) * sizeof(U32)));
44 return(1);
45 }
46
47 *bkf= (BKF *) malloc(*nobkf * sizeof(BKF));
48 if (*bkf== NULL)
49 {
50 wvError(("NO MEM 1, failed to alloc %d bytes\n",*nobkf* sizeof(BKF)));
51 free(pos);
52 return(1);
53 }
54 fseek(fd,offset,SEEK_SET);
55 for(i=0;i<=*nobkf;i++)
56 (*pos)[i]=read_32ubit(fd);
57 for(i=0;i<*nobkf;i++)
58 wvGetBKF(&((*bkf)[i]),fd);
59 }
60 return(0);
61 }
62
Note: See TracBrowser for help on using the repository browser.