diff -r 59758314f811 -r d4524d6a4472 Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/text_8c_source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/text_8c_source.html Fri Jun 11 15:24:34 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ - - - - -TB9.2 Example Applications: examples/PIPS/antiword/src/text.c Source File - - - - - -

examples/PIPS/antiword/src/text.c

00001 /*
-00002  * text.c
-00003  * Copyright (C) 1999-2004 A.J. van Os; Released under GNU GPL
-00004  *
-00005  * Description:
-00006  * Functions to deal with the Text format
-00007  *
-00008  */
-00009 
-00010 #include <string.h>
-00011 #include "antiword.h"
-00012 
-00013 /* The character set */
-00014 static encoding_type    eEncoding = encoding_neutral;
-00015 /* Current vertical position information */
-00016 static long             lYtopCurr = 0;
-00017 /* Local representation of the non-breaking space */
-00018 static UCHAR            ucNbsp = 0;
-00019 
-00020 
-00021 /*
-00022  * vPrologueTXT - set options and perform the Text initialization
-00023  */
-00024 void
-00025 vPrologueTXT(diagram_type *pDiag, const options_type *pOptions)
-00026 {
-00027         fail(pDiag == NULL);
-00028         fail(pOptions == NULL);
-00029 
-00030         eEncoding = pOptions->eEncoding;
-00031         pDiag->lXleft = 0;
-00032         pDiag->lYtop = 0;
-00033         lYtopCurr = 0;
-00034 } /* end of vPrologueTXT */
-00035 
-00036 /*
-00037  * vEpilogueTXT - clean up after everything is done
-00038  */
-00039 void
-00040 vEpilogueTXT(FILE *pOutFile)
-00041 {
-00042         fail(pOutFile == NULL);
-00043 
-00044         fprintf(pOutFile, "\n");
-00045 } /* end of vEpilogueTXT */
-00046 
-00047 /*
-00048  * vPrintTXT - print a Text string
-00049  */
-00050 static void
-00051 vPrintTXT(FILE *pFile, const char *szString, size_t tStringLength)
-00052 {
-00053         const UCHAR     *ucBytes;
-00054         size_t          tCount;
-00055 
-00056         fail(szString == NULL);
-00057 
-00058         if (szString == NULL || szString[0] == '\0' || tStringLength == 0) {
-00059                 return;
-00060         }
-00061 
-00062         if (eEncoding == encoding_utf_8) {
-00063                 fprintf(pFile, "%.*s", (int)tStringLength, szString);
-00064                 return;
-00065         }
-00066 
-00067         if (ucNbsp == 0) {
-00068                 ucNbsp = ucGetNbspCharacter();
-00069                 DBG_HEX_C(ucNbsp != 0xa0, ucNbsp);
-00070         }
-00071 
-00072         ucBytes = (UCHAR *)szString;
-00073         for (tCount = 0; tCount < tStringLength ; tCount++) {
-00074                 if (ucBytes[tCount] == ucNbsp) {
-00075                         (void)putc(' ', pFile);
-00076                 } else {
-00077                         (void)putc(szString[tCount], pFile);
-00078                 }
-00079         }
-00080 } /* end of vPrintTXT */
-00081 
-00082 /*
-00083  * vMoveTo - move to the given X,Y coordinates
-00084  *
-00085  * Move the current position of the given diagram to its X,Y coordinates,
-00086  * start on a new page if needed
-00087  */
-00088 static void
-00089 vMoveTo(diagram_type *pDiag)
-00090 {
-00091         int     iCount, iNbr;
-00092 
-00093         fail(pDiag == NULL);
-00094         fail(pDiag->pOutFile == NULL);
-00095 
-00096         if (pDiag->lYtop != lYtopCurr) {
-00097                 iNbr = iDrawUnits2Char(pDiag->lXleft);
-00098                 for (iCount = 0; iCount < iNbr; iCount++) {
-00099                         (void)putc(FILLER_CHAR, pDiag->pOutFile);
-00100                 }
-00101                 lYtopCurr = pDiag->lYtop;
-00102         }
-00103 } /* end of vMoveTo */
-00104 
-00105 /*
-00106  * vMove2NextLineTXT - move to the next line
-00107  */
-00108 void
-00109 vMove2NextLineTXT(diagram_type *pDiag)
-00110 {
-00111         fail(pDiag == NULL);
-00112         fail(pDiag->pOutFile == NULL);
-00113 
-00114         pDiag->lYtop++;
-00115         (void)fprintf(pDiag->pOutFile, "\n");
-00116 } /* end of vMove2NextLineTXT */
-00117 
-00118 /*
-00119  * vSubstringTXT - print a sub string
-00120  */
-00121 void
-00122 vSubstringTXT(diagram_type *pDiag,
-00123         const char *szString, size_t tStringLength, long lStringWidth)
-00124 {
-00125         fail(pDiag == NULL || szString == NULL);
-00126         fail(pDiag->pOutFile == NULL);
-00127         fail(pDiag->lXleft < 0);
-00128         fail(tStringLength != strlen(szString));
-00129 
-00130         if (szString[0] == '\0' || tStringLength == 0) {
-00131                 return;
-00132         }
-00133 
-00134         vMoveTo(pDiag);
-00135         vPrintTXT(pDiag->pOutFile, szString, tStringLength);
-00136         pDiag->lXleft += lStringWidth;
-00137 } /* end of vSubstringTXT */
-00138 
-00139 /*
-00140  * Create an start of paragraph by moving the y-top mark
-00141  */
-00142 void
-00143 vStartOfParagraphTXT(diagram_type *pDiag, long lBeforeIndentation)
-00144 {
-00145         fail(pDiag == NULL);
-00146         fail(lBeforeIndentation < 0);
-00147 
-00148         if (lBeforeIndentation >= lTwips2MilliPoints(HEADING_GAP)) {
-00149                 /* A large gap is replaced by an empty line */
-00150                 vMove2NextLineTXT(pDiag);
-00151         }
-00152 } /* end of vStartOfParagraphTXT */
-00153 
-00154 /*
-00155  * Create an end of paragraph by moving the y-top mark
-00156  */
-00157 void
-00158 vEndOfParagraphTXT(diagram_type *pDiag, long lAfterIndentation)
-00159 {
-00160         fail(pDiag == NULL);
-00161         fail(pDiag->pOutFile == NULL);
-00162         fail(lAfterIndentation < 0);
-00163 
-00164         if (pDiag->lXleft > 0) {
-00165                 /* To the start of the line */
-00166                 vMove2NextLineTXT(pDiag);
-00167         }
-00168 
-00169         if (lAfterIndentation >= lTwips2MilliPoints(HEADING_GAP)) {
-00170                 /* A large gap is replaced by an empty line */
-00171                 vMove2NextLineTXT(pDiag);
-00172         }
-00173 } /* end of vEndOfParagraphTXT */
-00174 
-00175 /*
-00176  * Create an end of page
-00177  */
-00178 void
-00179 vEndOfPageTXT(diagram_type *pDiag, long lAfterIndentation)
-00180 {
-00181         vEndOfParagraphTXT(pDiag, lAfterIndentation);
-00182 } /* end of vEndOfPageTXT */
-
-
Generated by  - -doxygen 1.6.2
- -