3 * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
6 * Build, read and destroy a list of Word table-row information
14 * Private structure to hide the way the information
15 * is stored from the rest of the program
17 typedef struct row_desc_tag
{
19 struct row_desc_tag
*pNext
;
22 /* Variables needed to write the Row Information List */
23 static row_desc_type
*pAnchor
= NULL
;
24 static row_desc_type
*pRowLast
= NULL
;
25 /* Variable needed to read the Row Information List */
26 static row_desc_type
*pRowCurrent
= NULL
;
30 * vDestroyRowInfoList - destroy the Row Information List
33 vDestroyRowInfoList(void)
35 row_desc_type
*pCurr
, *pNext
;
37 DBG_MSG("vDestroyRowInfoList");
39 /* Free the Row Information List */
41 while (pCurr
!= NULL
) {
47 /* Reset all control variables */
50 } /* end of vDestroyRowInfoList */
53 * vAdd2RowInfoList - Add an element to the Row Information List
56 vAdd2RowInfoList(const row_block_type
*pRowBlock
)
58 row_desc_type
*pListMember
;
62 fail(pRowBlock
== NULL
);
64 if (pRowBlock
->ulFileOffsetStart
== FC_INVALID
||
65 pRowBlock
->ulFileOffsetEnd
== FC_INVALID
||
66 pRowBlock
->ulFileOffsetStart
== pRowBlock
->ulFileOffsetEnd
) {
67 DBG_HEX_C(pRowBlock
->ulFileOffsetStart
!= FC_INVALID
,
68 pRowBlock
->ulFileOffsetStart
);
69 DBG_HEX_C(pRowBlock
->ulFileOffsetEnd
!= FC_INVALID
,
70 pRowBlock
->ulFileOffsetEnd
);
74 NO_DBG_HEX(pRowBlock
->ulFileOffsetStart
);
75 NO_DBG_HEX(pRowBlock
->ulFileOffsetEnd
);
76 NO_DBG_DEC(pRowBlock
->ucNumberOfColumns
);
77 NO_DBG_DEC(pRowBlock
->iColumnWidthSum
);
79 /* Create the new list member */
80 pListMember
= xmalloc(sizeof(row_desc_type
));
81 /* Fill the new list member */
82 pListMember
->tInfo
= *pRowBlock
;
83 pListMember
->pNext
= NULL
;
84 /* Correct the values where needed */
85 for (iIndex
= 0, psTmp
= pListMember
->tInfo
.asColumnWidth
;
86 iIndex
< (int)pListMember
->tInfo
.ucNumberOfColumns
;
90 DBG_MSG("The column width was negative");
93 /* Add the new member to the list */
94 if (pAnchor
== NULL
) {
95 pAnchor
= pListMember
;
96 pRowCurrent
= pListMember
;
98 fail(pRowLast
== NULL
);
99 pRowLast
->pNext
= pListMember
;
101 pRowLast
= pListMember
;
102 } /* end of vAdd2RowInfoList */
105 * Get the next item in the Row Information List
107 const row_block_type
*
108 pGetNextRowInfoListItem(void)
110 const row_block_type
*pItem
;
112 if (pRowCurrent
== NULL
) {
115 pItem
= &pRowCurrent
->tInfo
;
116 pRowCurrent
= pRowCurrent
->pNext
;
118 } /* end of pGetNextRowInfoListItem */