diff --git a/src/antiword.h b/src/antiword.h index 3f4aad5..5167d02 100644 --- a/src/antiword.h +++ b/src/antiword.h @@ -309,7 +309,7 @@ extern void vCreateDocumentInfoList(const document_block_type *); extern UCHAR ucGetDopHdrFtrSpecification(void); /* draw.c & output.c */ extern BOOL bAddDummyImage(diagram_type *, const imagedata_type *); -extern diagram_type *pCreateDiagram(const char *, const char *); +extern diagram_type *pCreateDiagram(const char *, const char *, FILE* outfile); extern void vPrologue2(diagram_type *, int); extern void vMove2NextLine(diagram_type *, drawfile_fontref, USHORT); extern void vSubstring2Diagram(diagram_type *, @@ -465,6 +465,7 @@ extern notetype_enum eGetNotetype(ULONG); /* options.c */ extern int iReadOptions(int, char **); extern void vGetOptions(options_type *); +extern options_type *direct_vGetOptions(); #if defined(__riscos) extern void vChoicesOpenAction(window_handle); extern BOOL bChoicesMouseClick(event_pollblock *, void *); diff --git a/src/asc85enc.c b/src/asc85enc.c index 8ff6bc8..3f23e4a 100644 --- a/src/asc85enc.c +++ b/src/asc85enc.c @@ -19,8 +19,8 @@ static const ULONG aulPower85[5] = { 1UL, 85UL, 85UL * 85, 85UL * 85 * 85, 85UL * 85 * 85 * 85, }; -static int iOutBytes = 0; /* Number of characters in an output line */ -static char cCharPrev = '\0'; +static __thread int iOutBytes = 0; /* Number of characters in an output line */ +static __thread char cCharPrev = '\0'; /* * Two percent characters at the start of a line will cause trouble diff --git a/src/blocklist.c b/src/blocklist.c index c847c27..aa805be 100644 --- a/src/blocklist.c +++ b/src/blocklist.c @@ -27,20 +27,20 @@ typedef struct readinfo_tag { } readinfo_type; /* Variables to describe the start of the block lists */ -static list_mem_type *pTextAnchor = NULL; -static list_mem_type *pFootnoteAnchor = NULL; -static list_mem_type *pHdrFtrAnchor = NULL; -static list_mem_type *pMacroAnchor = NULL; -static list_mem_type *pAnnotationAnchor = NULL; -static list_mem_type *pEndnoteAnchor = NULL; -static list_mem_type *pTextBoxAnchor = NULL; -static list_mem_type *pHdrTextBoxAnchor = NULL; +static __thread list_mem_type *pTextAnchor = NULL; +static __thread list_mem_type *pFootnoteAnchor = NULL; +static __thread list_mem_type *pHdrFtrAnchor = NULL; +static __thread list_mem_type *pMacroAnchor = NULL; +static __thread list_mem_type *pAnnotationAnchor = NULL; +static __thread list_mem_type *pEndnoteAnchor = NULL; +static __thread list_mem_type *pTextBoxAnchor = NULL; +static __thread list_mem_type *pHdrTextBoxAnchor = NULL; /* Variable needed to build the block list */ -static list_mem_type *pBlockLast = NULL; +static __thread list_mem_type *pBlockLast = NULL; /* Variable needed to read the block lists */ -static readinfo_type tOthers = { NULL, 0, 0, }; -static readinfo_type tHdrFtr = { NULL, 0, 0, }; -static readinfo_type tFootnote = { NULL, 0, 0, }; +static __thread readinfo_type tOthers = { NULL, 0, 0, }; +static __thread readinfo_type tHdrFtr = { NULL, 0, 0, }; +static __thread readinfo_type tFootnote = { NULL, 0, 0, }; /* diff --git a/src/chartrans.c b/src/chartrans.c index 5edaae9..a7ac9f4 100644 --- a/src/chartrans.c +++ b/src/chartrans.c @@ -145,8 +145,8 @@ typedef struct char_table_tag { USHORT usUnicode; } char_table_type; -static char_table_type atCharTable[256]; -static size_t tNextPosFree = 0; +static __thread char_table_type atCharTable[256]; +static __thread size_t tNextPosFree = 0; /* diff --git a/src/datalist.c b/src/datalist.c index 564f469..7ee75f4 100644 --- a/src/datalist.c +++ b/src/datalist.c @@ -25,15 +25,15 @@ typedef struct data_mem_tag { } data_mem_type; /* Variable to describe the start of the data block list */ -static data_mem_type *pAnchor = NULL; +static __thread data_mem_type *pAnchor = NULL; /* Variable needed to read the data block list */ -static data_mem_type *pBlockLast = NULL; +static __thread data_mem_type *pBlockLast = NULL; /* Variable needed to read the data block list */ -static data_mem_type *pBlockCurrent = NULL; -static ULONG ulBlockOffset = 0; -static size_t tByteNext = 0; +static __thread data_mem_type *pBlockCurrent = NULL; +static __thread ULONG ulBlockOffset = 0; +static __thread size_t tByteNext = 0; /* Last block read */ -static UCHAR aucBlock[BIG_BLOCK_SIZE]; +static __thread UCHAR aucBlock[BIG_BLOCK_SIZE]; /* diff --git a/src/depot.c b/src/depot.c index 295c39d..39b5af6 100644 --- a/src/depot.c +++ b/src/depot.c @@ -10,8 +10,8 @@ #define SIZE_RATIO (BIG_BLOCK_SIZE/SMALL_BLOCK_SIZE) -static ULONG *aulSmallBlockList = NULL; -static size_t tSmallBlockListLen = 0; +static __thread ULONG *aulSmallBlockList = NULL; +static __thread size_t tSmallBlockListLen = 0; /* diff --git a/src/doclist.c b/src/doclist.c index d4ac380..99a9b69 100644 --- a/src/doclist.c +++ b/src/doclist.c @@ -14,8 +14,8 @@ #define HALF_INCH 36000L /* In millipoints */ /* Variables needed to write the Document Information List */ -static document_block_type *pAnchor = NULL; -static document_block_type tInfo; +static __thread document_block_type *pAnchor = NULL; +static __thread document_block_type tInfo; /* diff --git a/src/fmt_text.c b/src/fmt_text.c index db211e9..16c88c5 100644 --- a/src/fmt_text.c +++ b/src/fmt_text.c @@ -14,11 +14,11 @@ #include "antiword.h" /* The character set */ -static encoding_type eEncoding = encoding_neutral; +static __thread encoding_type eEncoding = encoding_neutral; /* Current vertical position information */ -static long lYtopCurr = 0; +static __thread long lYtopCurr = 0; /* Local representation of the non-breaking space */ -static UCHAR ucNbsp = 0; +static __thread UCHAR ucNbsp = 0; /* diff --git a/src/fontlist.c b/src/fontlist.c index d55efbb..ba8ec15 100644 --- a/src/fontlist.c +++ b/src/fontlist.c @@ -21,8 +21,8 @@ typedef struct font_desc_tag { } font_mem_type; /* Variables needed to write the Font Information List */ -static font_mem_type *pAnchor = NULL; -static font_mem_type *pFontLast = NULL; +static __thread font_mem_type *pAnchor = NULL; +static __thread font_mem_type *pFontLast = NULL; /* diff --git a/src/fonts.c b/src/fonts.c index 77fde74..3228a0c 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -27,8 +27,8 @@ #define FAMILY_DECORATIVE 5 /* Font Translation Table */ -static size_t tFontTableRecords = 0; -static font_table_type *pFontTable = NULL; +static __thread size_t tFontTableRecords = 0; +static __thread font_table_type *pFontTable = NULL; /* * Find the given font in the font table diff --git a/src/fonts_r.c b/src/fonts_r.c index 0898d4f..95f2e1d 100644 --- a/src/fonts_r.c +++ b/src/fonts_r.c @@ -12,7 +12,7 @@ #include "drawfile.h" #include "antiword.h" -static font_handle tFontCurr = (font_handle)-1; +static __thread font_handle tFontCurr = (font_handle)-1; /* * pOpenFontTableFile - open the Font translation file diff --git a/src/fonts_u.c b/src/fonts_u.c index a99f7d2..caf1740 100644 --- a/src/fonts_u.c +++ b/src/fonts_u.c @@ -13,9 +13,9 @@ #include "fontinfo.h" /* Don't use fonts, just plain text */ -static BOOL bUsePlainText = TRUE; +static __thread BOOL bUsePlainText = TRUE; /* Which character set should be used */ -static encoding_type eEncoding = encoding_neutral; +static __thread encoding_type eEncoding = encoding_neutral; /* diff --git a/src/hdrftrlist.c b/src/hdrftrlist.c index c164188..8e5b248 100644 --- a/src/hdrftrlist.c +++ b/src/hdrftrlist.c @@ -33,8 +33,8 @@ typedef struct hdrftr_mem_tag { } hdrftr_mem_type; /* Variables needed to write the Header/footer Information List */ -static hdrftr_mem_type *pHdrFtrList = NULL; -static size_t tHdrFtrLen = 0; +static __thread hdrftr_mem_type *pHdrFtrList = NULL; +static __thread size_t tHdrFtrLen = 0; /* diff --git a/src/listlist.c b/src/listlist.c index eb86589..b8858ec 100644 --- a/src/listlist.c +++ b/src/listlist.c @@ -31,16 +31,16 @@ typedef struct list_value_tag { } list_value_type; /* Variables needed to describe the LFO list (pllfo) */ -static ULONG *aulLfoList = NULL; -static USHORT usLfoLen = 0; +static __thread ULONG *aulLfoList = NULL; +static __thread USHORT usLfoLen = 0; /* Variables needed to write the List Information List */ -static list_desc_type *pAnchor = NULL; -static list_desc_type *pBlockLast = NULL; +static __thread list_desc_type *pAnchor = NULL; +static __thread list_desc_type *pBlockLast = NULL; /* Variable needed for numbering new lists */ -static list_value_type *pValues = NULL; +static __thread list_value_type *pValues = NULL; /* Variables needed for numbering old lists */ -static int iOldListSeqNumber = 0; -static USHORT usOldListValue = 0; +static __thread int iOldListSeqNumber = 0; +static __thread USHORT usOldListValue = 0; /* diff --git a/src/main_ros.c b/src/main_ros.c index 8f4f316..3dc6104 100644 --- a/src/main_ros.c +++ b/src/main_ros.c @@ -47,13 +47,13 @@ static char *szTask = "!Antiword"; /* The window handle of the choices window */ -static window_handle tChoicesWindow = 0; +static __thread window_handle tChoicesWindow = 0; /* Dummy diagram with the iconbar menu pointer */ -static diagram_type tDummyDiagram; +static __thread diagram_type tDummyDiagram; /* Program information Box */ -static dialog2_block *pInfoBox = NULL; +static __thread dialog2_block *pInfoBox = NULL; /* Info box fields */ #define PURPOSE_INFO_FIELD 2 diff --git a/src/notes.c b/src/notes.c index ffc7526..a900acf 100644 --- a/src/notes.c +++ b/src/notes.c @@ -20,13 +20,13 @@ typedef struct footnote_local_tag { } footnote_local_type; /* Variables needed to write the Footnote and Endnote information */ -static ULONG *aulFootnoteList = NULL; -static size_t tFootnoteListLength = 0; -static ULONG *aulEndnoteList = NULL; -static size_t tEndnoteListLength = 0; +static __thread ULONG *aulFootnoteList = NULL; +static __thread size_t tFootnoteListLength = 0; +static __thread ULONG *aulEndnoteList = NULL; +static __thread size_t tEndnoteListLength = 0; /* Variables needed to write the Footnote Text */ -static footnote_local_type *pFootnoteText = NULL; -static size_t tFootnoteTextLength = 0; +static __thread footnote_local_type *pFootnoteText = NULL; +static __thread size_t tFootnoteTextLength = 0; /* diff --git a/src/options.c b/src/options.c index 8379fef..45990ad 100644 --- a/src/options.c +++ b/src/options.c @@ -34,7 +34,7 @@ extern int getopt(int, char **, const char *); #endif /* __riscos */ /* Current values for options */ -static options_type tOptionsCurr; +static __thread options_type tOptionsCurr; #if defined(__riscos) /* Temporary values for options */ static options_type tOptionsTemp; @@ -479,7 +479,8 @@ iReadOptions(int argc, char **argv) } } - tOptionsCurr.eEncoding = eMappingFile2Encoding(szLeafname); +// tOptionsCurr.eEncoding = eMappingFile2Encoding(szLeafname); + tOptionsCurr.eEncoding = encoding_latin_2; DBG_DEC(tOptionsCurr.eEncoding); if (tOptionsCurr.eConversionType == conversion_ps && @@ -537,11 +538,14 @@ iReadOptions(int argc, char **argv) void vGetOptions(options_type *pOptions) { - fail(pOptions == NULL); - *pOptions = tOptionsCurr; } /* end of vGetOptions */ +options_type *direct_vGetOptions() +{ + return &tOptionsCurr; +} + #if defined(__riscos) /* * vWriteOptions - write the current options to the Options file diff --git a/src/out2window.c b/src/out2window.c index 9bdacc3..6e0e19b 100644 --- a/src/out2window.c +++ b/src/out2window.c @@ -12,7 +12,7 @@ #include "antiword.h" /* Used for numbering the chapters */ -static unsigned int auiHdrCounter[9]; +static __thread unsigned int auiHdrCounter[9]; /* diff --git a/src/output.c b/src/output.c index b2757ab..c57a053 100644 --- a/src/output.c +++ b/src/output.c @@ -8,7 +8,7 @@ #include "antiword.h" -static conversion_type eConversionType = conversion_unknown; +static __thread conversion_type eConversionType = conversion_unknown; static encoding_type eEncoding = encoding_neutral; @@ -153,7 +153,7 @@ bAddDummyImage(diagram_type *pDiag, const imagedata_type *pImg) * remark: does not return if the diagram can't be created */ diagram_type * -pCreateDiagram(const char *szTask, const char *szFilename) +pCreateDiagram(const char *szTask, const char *szFilename, FILE* outfile) { diagram_type *pDiag; @@ -163,7 +163,7 @@ pCreateDiagram(const char *szTask, const char *szFilename) /* Get the necessary memory */ pDiag = xmalloc(sizeof(diagram_type)); /* Initialization */ - pDiag->pOutFile = stdout; + pDiag->pOutFile = outfile; vPrologue1(pDiag, szTask, szFilename); /* Return success */ return pDiag; diff --git a/src/pdf.c b/src/pdf.c index 85b7101..e9de907 100644 --- a/src/pdf.c +++ b/src/pdf.c @@ -23,42 +23,42 @@ #endif /* DEBUG */ /* The character set */ -static encoding_type eEncoding = encoding_neutral; +static __thread encoding_type eEncoding = encoding_neutral; /* Current creator for a PDF header */ -static const char *szProducer = NULL; +static __thread const char *szProducer = NULL; /* The height and width of a PDF page (in DrawUnits) */ -static long lPageHeight = LONG_MAX; -static long lPageWidth = LONG_MAX; +static __thread long lPageHeight = LONG_MAX; +static __thread long lPageWidth = LONG_MAX; /* The height of the footer on the current page (in DrawUnits) */ -static long lFooterHeight = 0; +static __thread long lFooterHeight = 0; /* Inside a footer (to prevent an infinite loop when the footer is too big) */ -static BOOL bInFtrSpace = FALSE; +static __thread BOOL bInFtrSpace = FALSE; /* Current font information */ -static drawfile_fontref tFontRefCurr = (drawfile_fontref)-1; -static USHORT usFontSizeCurr = 0; -static int iFontColorCurr = -1; +static __thread drawfile_fontref tFontRefCurr = (drawfile_fontref)-1; +static __thread USHORT usFontSizeCurr = 0; +static __thread int iFontColorCurr = -1; /* Current vertical position information */ -static long lYtopCurr = -1; +static __thread long lYtopCurr = -1; /* Image counter */ -static int iImageCount = 0; +static __thread int iImageCount = 0; /* Section index */ -static int iSectionIndex = 0; +static __thread int iSectionIndex = 0; /* Are we on the first page of the section? */ -static BOOL bFirstInSection = TRUE; +static __thread BOOL bFirstInSection = TRUE; /* File positions */ -static long lFilePosition = 0; -static long *alLocation = NULL; -static size_t tLocations = 0; -static int iMaxLocationNumber = 0; +static __thread long lFilePosition = 0; +static __thread long *alLocation = NULL; +static __thread size_t tLocations = 0; +static __thread int iMaxLocationNumber = 0; /* File position at the start of a page */ -static long lStreamStart = -1; +static __thread long lStreamStart = -1; /* Page objects */ -static int *aiPageObject = NULL; -static int iPageCount = 0; -static size_t tMaxPageObjects = 0; +static __thread int *aiPageObject = NULL; +static __thread int iPageCount = 0; +static __thread size_t tMaxPageObjects = 0; /* Current object number */ /* 1 = root; 2 = info; 3 = pages; 4 = encoding; 5-16 = fonts; 17 = resources */ -static int iObjectNumberCurr = 17; +static __thread int iObjectNumberCurr = 17; static void vMoveTo(diagram_type *, long); diff --git a/src/pictlist.c b/src/pictlist.c index dd9e4bf..3893d96 100644 --- a/src/pictlist.c +++ b/src/pictlist.c @@ -20,8 +20,8 @@ typedef struct picture_mem_tag { } picture_mem_type; /* Variables needed to write the Picture Information List */ -static picture_mem_type *pAnchor = NULL; -static picture_mem_type *pPictureLast = NULL; +static __thread picture_mem_type *pAnchor = NULL; +static __thread picture_mem_type *pPictureLast = NULL; /* diff --git a/src/postscript.c b/src/postscript.c index fd20e53..a3974c2 100644 --- a/src/postscript.c +++ b/src/postscript.c @@ -21,36 +21,36 @@ #include "antiword.h" /* The character set */ -static encoding_type eEncoding = encoding_neutral; +static __thread encoding_type eEncoding = encoding_neutral; /* The image level */ -static image_level_enum eImageLevel = level_default; +static __thread image_level_enum eImageLevel = level_default; /* The output must use landscape orientation */ -static BOOL bUseLandscape = FALSE; +static __thread BOOL bUseLandscape = FALSE; /* The height and width of a PostScript page (in DrawUnits) */ -static long lPageHeight = LONG_MAX; -static long lPageWidth = LONG_MAX; +static __thread long lPageHeight = LONG_MAX; +static __thread long lPageWidth = LONG_MAX; /* The height of the footer on the current page (in DrawUnits) */ -static long lFooterHeight = 0; +static __thread long lFooterHeight = 0; /* Inside a footer (to prevent an infinite loop when the footer is too big) */ -static BOOL bInFtrSpace = FALSE; +static __thread BOOL bInFtrSpace = FALSE; /* Current time for a PS header */ -static const char *szCreationDate = NULL; +static __thread const char *szCreationDate = NULL; /* Current creator for a PS header */ -static const char *szCreator = NULL; +static __thread const char *szCreator = NULL; /* Current font information */ -static drawfile_fontref tFontRefCurr = (drawfile_fontref)-1; -static USHORT usFontSizeCurr = 0; -static int iFontColorCurr = -1; +static __thread drawfile_fontref tFontRefCurr = (drawfile_fontref)-1; +static __thread USHORT usFontSizeCurr = 0; +static __thread int iFontColorCurr = -1; /* Current vertical position information */ -static long lYtopCurr = -1; +static __thread long lYtopCurr = -1; /* PostScript page counter */ -static int iPageCount = 0; +static __thread int iPageCount = 0; /* Image counter */ -static int iImageCount = 0; +static __thread int iImageCount = 0; /* Section index */ -static int iSectionIndex = 0; +static __thread int iSectionIndex = 0; /* Are we on the first page of the section? */ -static BOOL bFirstInSection = TRUE; +static __thread BOOL bFirstInSection = TRUE; static void vMoveTo(diagram_type *, long); diff --git a/src/propmod.c b/src/propmod.c index 7a3cdbb..c567ccd 100644 --- a/src/propmod.c +++ b/src/propmod.c @@ -17,9 +17,9 @@ #endif /* DEBUG */ /* Variables needed to write the property modifier list */ -static UCHAR **ppAnchor = NULL; -static size_t tNextFree = 0; -static size_t tMaxElements = 0; +static __thread UCHAR **ppAnchor = NULL; +static __thread size_t tNextFree = 0; +static __thread size_t tMaxElements = 0; /* diff --git a/src/rowlist.c b/src/rowlist.c index a3dd2fb..63136f0 100644 --- a/src/rowlist.c +++ b/src/rowlist.c @@ -20,10 +20,10 @@ typedef struct row_desc_tag { } row_desc_type; /* Variables needed to write the Row Information List */ -static row_desc_type *pAnchor = NULL; -static row_desc_type *pRowLast = NULL; +static __thread row_desc_type *pAnchor = NULL; +static __thread row_desc_type *pRowLast = NULL; /* Variable needed to read the Row Information List */ -static row_desc_type *pRowCurrent = NULL; +static __thread row_desc_type *pRowCurrent = NULL; /* diff --git a/src/sectlist.c b/src/sectlist.c index 016d1b8..38df789 100644 --- a/src/sectlist.c +++ b/src/sectlist.c @@ -22,8 +22,8 @@ typedef struct section_mem_tag { } section_mem_type; /* Variables needed to write the Section Information List */ -static section_mem_type *pAnchor = NULL; -static section_mem_type *pSectionLast = NULL; +static __thread section_mem_type *pAnchor = NULL; +static __thread section_mem_type *pSectionLast = NULL; /* diff --git a/src/stylelist.c b/src/stylelist.c index 09b5ab5..db0e3df 100644 --- a/src/stylelist.c +++ b/src/stylelist.c @@ -23,16 +23,16 @@ typedef struct style_mem_tag { } style_mem_type; /* Variables needed to write the Style Information List */ -static style_mem_type *pAnchor = NULL; -static style_mem_type *pStyleLast = NULL; +static __thread style_mem_type *pAnchor = NULL; +static __thread style_mem_type *pStyleLast = NULL; /* The type of conversion */ -static conversion_type eConversionType = conversion_unknown; +static __thread conversion_type eConversionType = conversion_unknown; /* The character set encoding */ -static encoding_type eEncoding = encoding_neutral; +static __thread encoding_type eEncoding = encoding_neutral; /* Values for efficiency reasons */ -static const style_mem_type *pMidPtr = NULL; -static BOOL bMoveMidPtr = FALSE; -static BOOL bInSequence = TRUE; +static __thread const style_mem_type *pMidPtr = NULL; +static __thread BOOL bMoveMidPtr = FALSE; +static __thread BOOL bInSequence = TRUE; /* diff --git a/src/stylesheet.c b/src/stylesheet.c index 0cb4cc3..85f4890 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -15,10 +15,10 @@ #define SGC_CHP 2 /* Variables needed to describe the stylesheet list */ -static style_block_type *atStyleInfo = NULL; -static font_block_type *atFontInfo = NULL; -static BOOL *abFilled = NULL; -static size_t tStdCount = 0; +static __thread style_block_type *atStyleInfo = NULL; +static __thread font_block_type *atFontInfo = NULL; +static __thread BOOL *abFilled = NULL; +static __thread size_t tStdCount = 0; /* diff --git a/src/summary.c b/src/summary.c index 2449b6a..12e59cc 100644 --- a/src/summary.c +++ b/src/summary.c @@ -32,15 +32,15 @@ #define TIME_OFFSET_HI 0x019db1de #define TIME_OFFSET_LO 0xd53e8000 -static char *szTitle = NULL; -static char *szSubject = NULL; -static char *szAuthor = NULL; -static time_t tCreateDtm = (time_t)-1; -static time_t tLastSaveDtm= (time_t)-1; -static char *szAppName = NULL; -static char *szManager = NULL; -static char *szCompany = NULL; -static USHORT usLid = (USHORT)-1; +static __thread char *szTitle = NULL; +static __thread char *szSubject = NULL; +static __thread char *szAuthor = NULL; +static __thread time_t tCreateDtm = (time_t)-1; +static __thread time_t tLastSaveDtm= (time_t)-1; +static __thread char *szAppName = NULL; +static __thread char *szManager = NULL; +static __thread char *szCompany = NULL; +static __thread USHORT usLid = (USHORT)-1; /* diff --git a/src/tabstop.c b/src/tabstop.c index 604d949..9fe7198 100644 --- a/src/tabstop.c +++ b/src/tabstop.c @@ -11,7 +11,7 @@ #define HALF_INCH 36000L /* In millipoints */ -static long lDefaultTabWidth = HALF_INCH; +static __thread long lDefaultTabWidth = HALF_INCH; /* diff --git a/src/text.c b/src/text.c index bd3dc92..d17a5be 100644 --- a/src/text.c +++ b/src/text.c @@ -13,9 +13,9 @@ /* The character set */ static encoding_type eEncoding = encoding_neutral; /* Current vertical position information */ -static long lYtopCurr = 0; +static __thread long lYtopCurr = 0; /* Local representation of the non-breaking space */ -static UCHAR ucNbsp = 0; +static __thread UCHAR ucNbsp = 0; /* diff --git a/src/word2text.c b/src/word2text.c index 62b8964..439a5fc 100644 --- a/src/word2text.c +++ b/src/word2text.c @@ -44,34 +44,34 @@ static ULONG ulCharCounter; static int iCurrPct, iPrevPct; #endif /* __riscos */ /* The document is in the format belonging to this version of Word */ -static int iWordVersion = -1; +static __thread int iWordVersion = -1; /* Special treatment for files from Word 4/5/6 on an Apple Macintosh */ -static BOOL bOldMacFile = FALSE; +static __thread BOOL bOldMacFile = FALSE; /* Section Information */ -static const section_block_type *pSection = NULL; -static const section_block_type *pSectionNext = NULL; +static __thread const section_block_type *pSection = NULL; +static __thread const section_block_type *pSectionNext = NULL; /* All the (command line) options */ -static options_type tOptions; +static __thread options_type tOptions; /* Needed for reading a complete table row */ -static const row_block_type *pRowInfo = NULL; -static BOOL bStartRow = FALSE; -static BOOL bEndRowNorm = FALSE; -static BOOL bEndRowFast = FALSE; -static BOOL bIsTableRow = FALSE; +static __thread const row_block_type *pRowInfo = NULL; +static __thread BOOL bStartRow = FALSE; +static __thread BOOL bEndRowNorm = FALSE; +static __thread BOOL bEndRowFast = FALSE; +static __thread BOOL bIsTableRow = FALSE; /* Index of the next style and font information */ -static USHORT usIstdNext = ISTD_NORMAL; +static __thread USHORT usIstdNext = ISTD_NORMAL; /* Needed for finding the start of a style */ -static const style_block_type *pStyleInfo = NULL; -static style_block_type tStyleNext; -static BOOL bStartStyle = FALSE; -static BOOL bStartStyleNext = FALSE; +static __thread const style_block_type *pStyleInfo = NULL; +static __thread style_block_type tStyleNext; +static __thread BOOL bStartStyle = FALSE; +static __thread BOOL bStartStyleNext = FALSE; /* Needed for finding the start of a font */ -static const font_block_type *pFontInfo = NULL; -static font_block_type tFontNext; -static BOOL bStartFont = FALSE; -static BOOL bStartFontNext = FALSE; +static __thread const font_block_type *pFontInfo = NULL; +static __thread font_block_type tFontNext; +static __thread BOOL bStartFont = FALSE; +static __thread BOOL bStartFontNext = FALSE; /* Needed for finding an image */ -static ULONG ulFileOffsetImage = FC_INVALID; +static __thread ULONG ulFileOffsetImage = FC_INVALID; /* diff --git a/src/wordlib.c b/src/wordlib.c index d8471d6..ffaf57e 100644 --- a/src/wordlib.c +++ b/src/wordlib.c @@ -8,7 +8,7 @@ #include "antiword.h" -static BOOL bOldMacFile = FALSE; +static __thread BOOL bOldMacFile = FALSE; /* diff --git a/src/xml.c b/src/xml.c index 92048ad..eaa334f 100644 --- a/src/xml.c +++ b/src/xml.c @@ -22,35 +22,35 @@ /* The character set */ static encoding_type eEncoding = encoding_neutral; /* Word version */ -static int iWordVersion = -1; +static __thread int iWordVersion = -1; /* Special treatment for files from Word 4/5/6 on an Apple Macintosh */ -static BOOL bOldMacFile = FALSE; +static __thread BOOL bOldMacFile = FALSE; /* Text is emphasised */ -static BOOL bEmphasisOpen = FALSE; +static __thread BOOL bEmphasisOpen = FALSE; /* Text is superscript */ -static BOOL bSuperscriptOpen = FALSE; +static __thread BOOL bSuperscriptOpen = FALSE; /* Text is subscript */ -static BOOL bSubscriptOpen = FALSE; +static __thread BOOL bSubscriptOpen = FALSE; /* Title is open */ -static BOOL bTitleOpen = FALSE; +static __thread BOOL bTitleOpen = FALSE; /* Table is open */ -static BOOL bTableOpen = FALSE; +static __thread BOOL bTableOpen = FALSE; /* Footnote is open */ -static BOOL bFootnoteOpen = FALSE; +static __thread BOOL bFootnoteOpen = FALSE; /* Current paragraph level */ -static UINT uiParagraphLevel = 0; +static __thread UINT uiParagraphLevel = 0; /* Current list level */ -static UINT uiListLevel = 0; +static __thread UINT uiListLevel = 0; /* Current list level is still empty */ -static BOOL bEmptyListLevel = TRUE; +static __thread BOOL bEmptyListLevel = TRUE; /* Current header level */ -static USHORT usHeaderLevelCurrent = 0; +static __thread USHORT usHeaderLevelCurrent = 0; /* Current header level is still empty */ -static BOOL bEmptyHeaderLevel = TRUE; +static __thread BOOL bEmptyHeaderLevel = TRUE; /* Number of columns in the current table */ -static int iTableColumnsCurrent = 0; +static __thread int iTableColumnsCurrent = 0; /* Footnote number */ -static UINT uiFootnoteNumber = 0; +static __thread UINT uiFootnoteNumber = 0; /* Constants for the stack */ #define INITIAL_STACK_SIZE 10 @@ -61,9 +61,9 @@ static UINT uiFootnoteNumber = 0; #endif /* DEBUG */ /* Variables for the stack */ -static UCHAR *aucStack = NULL; -static size_t tStacksize = 0; -static size_t tStackNextFree = 0; +static __thread UCHAR *aucStack = NULL; +static __thread size_t tStacksize = 0; +static __thread size_t tStackNextFree = 0; /* Constants for the tags */ #define TAG_NOTAG (UCHAR)0