00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <stdlib.h>
00010 #include <string.h>
00011 #include "antiword.h"
00012
00013
00014
00015
00016
00017 typedef struct row_desc_tag {
00018 row_block_type tInfo;
00019 struct row_desc_tag *pNext;
00020 } row_desc_type;
00021
00022
00023 static row_desc_type *pAnchor = NULL;
00024 static row_desc_type *pRowLast = NULL;
00025
00026 static row_desc_type *pRowCurrent = NULL;
00027
00028
00029
00030
00031
00032 void
00033 vDestroyRowInfoList(void)
00034 {
00035 row_desc_type *pCurr, *pNext;
00036
00037 DBG_MSG("vDestroyRowInfoList");
00038
00039
00040 pCurr = pAnchor;
00041 while (pCurr != NULL) {
00042 pNext = pCurr->pNext;
00043 pCurr = xfree(pCurr);
00044 pCurr = pNext;
00045 }
00046 pAnchor = NULL;
00047
00048 pRowLast = NULL;
00049 pRowCurrent = NULL;
00050 }
00051
00052
00053
00054
00055 void
00056 vAdd2RowInfoList(const row_block_type *pRowBlock)
00057 {
00058 row_desc_type *pListMember;
00059 short *psTmp;
00060 int iIndex;
00061
00062 fail(pRowBlock == NULL);
00063
00064 if (pRowBlock->ulFileOffsetStart == FC_INVALID ||
00065 pRowBlock->ulFileOffsetEnd == FC_INVALID ||
00066 pRowBlock->ulFileOffsetStart == pRowBlock->ulFileOffsetEnd) {
00067 DBG_HEX_C(pRowBlock->ulFileOffsetStart != FC_INVALID,
00068 pRowBlock->ulFileOffsetStart);
00069 DBG_HEX_C(pRowBlock->ulFileOffsetEnd != FC_INVALID,
00070 pRowBlock->ulFileOffsetEnd);
00071 return;
00072 }
00073
00074 NO_DBG_HEX(pRowBlock->ulFileOffsetStart);
00075 NO_DBG_HEX(pRowBlock->ulFileOffsetEnd);
00076 NO_DBG_DEC(pRowBlock->ucNumberOfColumns);
00077
00078
00079 pListMember = xmalloc(sizeof(row_desc_type));
00080
00081 pListMember->tInfo = *pRowBlock;
00082 pListMember->pNext = NULL;
00083
00084 for (iIndex = 0, psTmp = pListMember->tInfo.asColumnWidth;
00085 iIndex < (int)pListMember->tInfo.ucNumberOfColumns;
00086 iIndex++, psTmp++) {
00087 if (*psTmp < 0) {
00088 *psTmp = 0;
00089 DBG_MSG("The column width was negative");
00090 }
00091 }
00092
00093 if (pAnchor == NULL) {
00094 pAnchor = pListMember;
00095 pRowCurrent = pListMember;
00096 } else {
00097 fail(pRowLast == NULL);
00098 pRowLast->pNext = pListMember;
00099 }
00100 pRowLast = pListMember;
00101 }
00102
00103
00104
00105
00106 const row_block_type *
00107 pGetNextRowInfoListItem(void)
00108 {
00109 const row_block_type *pItem;
00110
00111 if (pRowCurrent == NULL) {
00112 return NULL;
00113 }
00114 pItem = &pRowCurrent->tInfo;
00115 pRowCurrent = pRowCurrent->pNext;
00116 return pItem;
00117 }