]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/aux/antiword/doclist.c
exec(2): fix prototypes
[plan9front.git] / sys / src / cmd / aux / antiword / doclist.c
1 /*
2  * doclist.c
3  * Copyright (C) 2004 A.J. van Os; Released under GNU GPL
4  *
5  * Description:
6  * Build, read and destroy list(s) of Word document information
7  *
8  * Note:
9  * There is no real list there is always one document per document
10  */
11
12 #include "antiword.h"
13
14 #define HALF_INCH       36000L  /* In millipoints */
15
16 /* Variables needed to write the Document Information List */
17 static document_block_type *pAnchor = NULL;
18 static document_block_type tInfo;
19
20
21 /*
22  * vDestroyDocumentInfoList - destroy the Document Information List
23  */
24 void
25 vDestroyDocumentInfoList(void)
26 {
27         DBG_MSG("vDestroyDocumentInfoList");
28
29         pAnchor = NULL;
30 } /* end of vDestoryDocumentInfoList */
31
32 /*
33  * vCreateDocumentInfoList - create the Document Information List
34  */
35 void
36 vCreateDocumentInfoList(const document_block_type *pDocument)
37 {
38         fail(pDocument == NULL);
39         fail(pAnchor != NULL);
40
41         tInfo = *pDocument;
42         pAnchor = &tInfo;
43 } /* end of vCreateDocumentInfoList */
44
45 /*
46  * lGetDefaultTabWidth - get the default tabwidth in millipoints
47  */
48 long
49 lGetDefaultTabWidth(void)
50 {
51         long    lDefaultTabWidth;
52         USHORT  usTmp;
53
54         if (pAnchor == NULL) {
55                 DBG_FIXME();
56                 return HALF_INCH;
57         }
58         usTmp = pAnchor->usDefaultTabWidth;
59         lDefaultTabWidth = usTmp == 0 ? HALF_INCH : lTwips2MilliPoints(usTmp);
60         NO_DBG_DEC(lDefaultTabWidth);
61         return lDefaultTabWidth;
62 } /* end of lGetDefaultTabWidth */
63
64 /*
65  * ucGetDopHdrFtrSpecification - get the Heder/footer specification
66  */
67 UCHAR
68 ucGetDopHdrFtrSpecification(void)
69 {
70         if (pAnchor == NULL) {
71                 DBG_FIXME();
72                 return 0x00;
73         }
74         return pAnchor->ucHdrFtrSpecification;
75 } /* end of ucGetDopHdrFtrSpecification */