home *** CD-ROM | disk | FTP | other *** search
-
-
- /*
- * %%File: rtfchar.c
- *
- * Chaque nom de fonction definie dans ce fichier est precede
- * des lettres : ch
- *
- * Copyright (c) 1995-1999 Bertrand LE QUELLEC
- *
- * http://perso.wanadoo.fr/blq
- * blq@wanadoo.fr
- */
-
-
- #include <stdio.h>
-
- #include "rtftype.h"
- #include "rtfdecl.h"
- #include "rtfreadr.h"
- #include "html.h"
-
- #define SOURCE_CHAR 1
- #include "rtfchar.h"
-
-
-
-
- /*
- * %%Function: chHexaToAscii.
- *
- * Renvoie le code ASCII correspondant au code Hexa passe en argument.
- */
- int chHexaToAscii(char * hexa)
- {
- int ct1 = 0, ct2 = 0, ct3 = 0, c = 0;
- char TabHex[5];
-
-
- if(!hexa)
- return ecNO;
-
- /* Boucle sur la premiere table,
- * jusqu'a la table etendue.
- */
- for (ct1 = 0; ct1 <= 128; ct1 += 128)
- {
- for (ct2 = ct1; ct2 < ct1+32; ct2++)
- {
- for (ct3 = ct2; ct3 < ct2+4*32; ct3 += 32)
- {
- if (ct3 == 0)
- c = 48;
- else if (ct3 <= 31)
- c = 64;
- else
- c = 0;
-
- sprintf(TabHex, "%x", ct3);
-
- /* Renvoie le code ASCII. */
- if(!strcmp(TabHex, hexa))
- return ct3+c;
- }
- }
- }
-
- return ecNO;
- }
-
- /*
- * %%Function: chCharactereRtf.
- *
- * Determine le caractere RTF et le transcrit en caractere TXT
- */
- int chCharactereRtf(char * code, int param, bool fParam)
- {
- char TabHexa[5];
-
-
- if(fParam == fFalse)
- sprintf(TabHexa, "%c%c", code[1], param);
- else
- sprintf(TabHexa, "%c%d", code[1], param);
-
- return ecPrintChar(chHexaToAscii(TabHexa));
- }
-
-