Sync to Wine-20050419:
Remove no longer needed files.
Deleted: trunk/reactos/lib/richedit/ansi_gen.h
Deleted: trunk/reactos/lib/richedit/ansi_sym.h
Deleted: trunk/reactos/lib/richedit/reader.c
Deleted: trunk/reactos/lib/richedit/riched32.h
Deleted: trunk/reactos/lib/richedit/rtf.h
Deleted: trunk/reactos/lib/richedit/rtf2text.h
Deleted: trunk/reactos/lib/richedit/stdcharnames.h
Deleted: trunk/reactos/lib/richedit/text-writer.c
Deleted: trunk/reactos/lib/richedit/text_map.h
_____
Deleted: trunk/reactos/lib/richedit/ansi_gen.h
--- trunk/reactos/lib/richedit/ansi_gen.h 2005-05-05 19:05:42 UTC
(rev 15015)
+++ trunk/reactos/lib/richedit/ansi_gen.h 2005-05-05 19:11:20 UTC
(rev 15016)
@@ -1,211 +0,0 @@
-/*
- RTF ANSI character set (\ansi) general map
- These are taken from the ISO-Latin-1 (ISO-8859-1) encodings, with
- a few additions
-
- Field 1 is the standard character name which the character value in
- field 2 maps onto. (It doesn't mean "to produce the character in
field 1,
- use the value in field 2.)
-
- The character value may be given either as a single character (which
will be
- converted to the ASCII value of the character), or in numeric format,
either
- in decimal or 0xyy as hex yy. Single or double quotes may be used to
quote
- characters.*/
-
-int ansi_gen[] =
-{
- rtfSC_formula ,0x06,
- rtfSC_nobrkhyphen ,0x1e,
- rtfSC_opthyphen ,0x1f,
- rtfSC_space ,' ',
- rtfSC_exclam ,'!',
- rtfSC_quotedbl ,'"',
- rtfSC_numbersign ,'#',
- rtfSC_dollar ,'$',
- rtfSC_percent ,'%',
- rtfSC_ampersand ,'&',
- rtfSC_quoteright ,'\\',
- rtfSC_parenleft ,'(',
- rtfSC_parenright ,')',
- rtfSC_asterisk ,'*',
- rtfSC_plus ,'+',
- rtfSC_comma ,',',
- rtfSC_hyphen ,'-',
- rtfSC_period ,'.',
- rtfSC_slash ,'/',
- rtfSC_zero ,'0',
- rtfSC_one ,'1',
- rtfSC_two ,'2',
- rtfSC_three ,'3',
- rtfSC_four ,'4',
- rtfSC_five ,'5',
- rtfSC_six ,'6',
- rtfSC_seven ,'7',
- rtfSC_eight ,'8',
- rtfSC_nine ,'9',
- rtfSC_colon ,':',
- rtfSC_semicolon ,';',
- rtfSC_less ,'<',
- rtfSC_equal ,'=',
- rtfSC_greater ,'>',
- rtfSC_question ,'?',
- rtfSC_at ,'@',
- rtfSC_A ,'A',
- rtfSC_B ,'B',
- rtfSC_C ,'C',
- rtfSC_D ,'D',
- rtfSC_E ,'E',
- rtfSC_F ,'F',
- rtfSC_G ,'G',
- rtfSC_H ,'H',
- rtfSC_I ,'I',
- rtfSC_J ,'J',
- rtfSC_K ,'K',
- rtfSC_L ,'L',
- rtfSC_M ,'M',
- rtfSC_N ,'N',
- rtfSC_O ,'O',
- rtfSC_P ,'P',
- rtfSC_Q ,'Q',
- rtfSC_R ,'R',
- rtfSC_S ,'S',
- rtfSC_T ,'T',
- rtfSC_U ,'U',
- rtfSC_V ,'V',
- rtfSC_W ,'W',
- rtfSC_X ,'X',
- rtfSC_Y ,'Y',
- rtfSC_Z ,'Z',
- rtfSC_bracketleft ,'[',
- rtfSC_backslash ,'\\',
- rtfSC_bracketright ,']',
- rtfSC_asciicircum ,'^',
- rtfSC_underscore ,'_',
- rtfSC_quoteleft ,'`',
- rtfSC_a ,'a',
- rtfSC_b ,'b',
- rtfSC_c ,'c',
- rtfSC_d ,'d',
- rtfSC_e ,'e',
- rtfSC_f ,'f',
- rtfSC_g ,'g',
- rtfSC_h ,'h',
- rtfSC_i ,'i',
- rtfSC_j ,'j',
- rtfSC_k ,'k',
- rtfSC_l ,'l',
- rtfSC_m ,'m',
- rtfSC_n ,'n',
- rtfSC_o ,'o',
- rtfSC_p ,'p',
- rtfSC_q ,'q',
- rtfSC_r ,'r',
- rtfSC_s ,'s',
- rtfSC_t ,'t',
- rtfSC_u ,'u',
- rtfSC_v ,'v',
- rtfSC_w ,'w',
- rtfSC_x ,'x',
- rtfSC_y ,'y',
- rtfSC_z ,'z',
- rtfSC_braceleft ,'{',
- rtfSC_bar ,'|',
- rtfSC_braceright ,'}',
- rtfSC_asciitilde ,'~',
- rtfSC_nobrkspace ,0xa0,
- rtfSC_exclamdown ,0xa1,
- rtfSC_cent ,0xa2,
- rtfSC_sterling ,0xa3,
- rtfSC_currency ,0xa4,
- rtfSC_yen ,0xa5,
- rtfSC_brokenbar ,0xa6,
- rtfSC_section ,0xa7,
- rtfSC_dieresis ,0xa8,
- rtfSC_copyright ,0xa9,
- rtfSC_ordfeminine ,0xaa,
- rtfSC_guillemotleft ,0xab,
- rtfSC_logicalnot ,0xac,
- rtfSC_opthyphen ,0xad,
- rtfSC_registered ,0xae,
- rtfSC_macron ,0xaf,
- rtfSC_degree ,0xb0,
- rtfSC_plusminus ,0xb1,
- rtfSC_twosuperior ,0xb2,
- rtfSC_threesuperior ,0xb3,
- rtfSC_acute ,0xb4,
- rtfSC_mu ,0xb5,
- rtfSC_paragraph ,0xb6,
- rtfSC_periodcentered ,0xb7,
- rtfSC_cedilla ,0xb8,
- rtfSC_onesuperior ,0xb9,
- rtfSC_ordmasculine ,0xba,
- rtfSC_guillemotright ,0xbb,
- rtfSC_onequarter ,0xbc,
- rtfSC_onehalf ,0xbd,
- rtfSC_threequarters ,0xbe,
- rtfSC_questiondown ,0xbf,
- rtfSC_Agrave ,0xc0,
- rtfSC_Aacute ,0xc1,
- rtfSC_Acircumflex ,0xc2,
- rtfSC_Atilde ,0xc3,
- rtfSC_Adieresis ,0xc4,
- rtfSC_Aring ,0xc5,
- rtfSC_AE ,0xc6,
- rtfSC_Ccedilla ,0xc7,
- rtfSC_Egrave ,0xc8,
- rtfSC_Eacute ,0xc9,
- rtfSC_Ecircumflex ,0xca,
- rtfSC_Edieresis ,0xcb,
- rtfSC_Igrave ,0xcc,
- rtfSC_Iacute ,0xcd,
- rtfSC_Icircumflex ,0xce,
- rtfSC_Idieresis ,0xcf,
- rtfSC_Eth ,0xd0,
- rtfSC_Ntilde ,0xd1,
- rtfSC_Ograve ,0xd2,
- rtfSC_Oacute ,0xd3,
- rtfSC_Ocircumflex ,0xd4,
- rtfSC_Otilde ,0xd5,
- rtfSC_Odieresis ,0xd6,
- rtfSC_multiply ,0xd7,
- rtfSC_Oslash ,0xd8,
- rtfSC_Ugrave ,0xd9,
- rtfSC_Uacute ,0xda,
- rtfSC_Ucircumflex ,0xdb,
- rtfSC_Udieresis ,0xdc,
- rtfSC_Yacute ,0xdd,
- rtfSC_Thorn ,0xde,
- rtfSC_germandbls ,0xdf,
- rtfSC_agrave ,0xe0,
- rtfSC_aacute ,0xe1,
- rtfSC_acircumflex ,0xe2,
- rtfSC_atilde ,0xe3,
- rtfSC_adieresis ,0xe4,
- rtfSC_aring ,0xe5,
- rtfSC_ae ,0xe6,
- rtfSC_ccedilla ,0xe7,
- rtfSC_egrave ,0xe8,
- rtfSC_eacute ,0xe9,
- rtfSC_ecircumflex ,0xea,
- rtfSC_edieresis ,0xeb,
- rtfSC_igrave ,0xec,
- rtfSC_iacute ,0xed,
- rtfSC_icircumflex ,0xee,
- rtfSC_idieresis ,0xef,
- rtfSC_eth ,0xf0,
- rtfSC_ntilde ,0xf1,
- rtfSC_ograve ,0xf2,
- rtfSC_oacute ,0xf3,
- rtfSC_ocircumflex ,0xf4,
- rtfSC_otilde ,0xf5,
- rtfSC_odieresis ,0xf6,
- rtfSC_divide ,0xf7,
- rtfSC_oslash ,0xf8,
- rtfSC_ugrave ,0xf9,
- rtfSC_uacute ,0xfa,
- rtfSC_ucircumflex ,0xfb,
- rtfSC_udieresis ,0xfc,
- rtfSC_yacute ,0xfd,
- rtfSC_thorn ,0xfe,
- rtfSC_ydieresis ,0xff
-};
_____
Deleted: trunk/reactos/lib/richedit/ansi_sym.h
--- trunk/reactos/lib/richedit/ansi_sym.h 2005-05-05 19:05:42 UTC
(rev 15015)
+++ trunk/reactos/lib/richedit/ansi_sym.h 2005-05-05 19:11:20 UTC
(rev 15016)
@@ -1,112 +0,0 @@
-/*
- * RTF ANSI character set (\ansi) Symbol font map
- *
- * Field 1 is the standard character name which the character value in
- * field 2 maps onto. (It doesn't mean "to produce the character in
field 1,
- * use the value in field 2.)
- *
- * The character value may be given either as a single character (which
will be
- * converted to the ASCII value of the character), or in numeric
format, either
- * in decimal or 0xyy as hex yy. Single or double quotes may be used
to quote
- * characters.
- *
- */
-
-int ansi_sym[] =
-{
- rtfSC_formula ,0x06,
- rtfSC_nobrkhyphen ,0x1e,
- rtfSC_opthyphen ,0x1f,
- rtfSC_space ,' ',
- rtfSC_exclam ,'!',
- rtfSC_universal ,'"',
- rtfSC_mathnumbersign ,'#',
- rtfSC_existential ,'$',
- rtfSC_percent ,'%',
- rtfSC_ampersand ,'&',
- rtfSC_suchthat ,'\\',
- rtfSC_parenleft ,'(',
- rtfSC_parenright ,')',
- rtfSC_mathasterisk ,'*',
- rtfSC_mathplus ,'+',
- rtfSC_comma ,',',
- rtfSC_mathminus ,'-',
- rtfSC_period ,'.',
- rtfSC_slash ,'/',
- rtfSC_zero ,'0',
- rtfSC_one ,'1',
- rtfSC_two ,'2',
- rtfSC_three ,'3',
- rtfSC_four ,'4',
- rtfSC_five ,'5',
- rtfSC_six ,'6',
- rtfSC_seven ,'7',
- rtfSC_eight ,'8',
- rtfSC_nine ,'9',
- rtfSC_colon ,':',
- rtfSC_semicolon ,';',
- rtfSC_less ,'<',
- rtfSC_mathequal ,'=',
- rtfSC_greater ,'>',
- rtfSC_question ,'?',
- rtfSC_congruent ,'@',
- rtfSC_Alpha ,'A',
- rtfSC_Beta ,'B',
- rtfSC_Chi ,'C',
- rtfSC_Delta ,'D',
- rtfSC_Epsilon ,'E',
- rtfSC_Phi ,'F',
- rtfSC_Gamma ,'G',
- rtfSC_Eta ,'H',
- rtfSC_Iota ,'I',
- rtfSC_Kappa ,'K',
- rtfSC_Lambda ,'L',
- rtfSC_Mu ,'M',
- rtfSC_Nu ,'N',
- rtfSC_Omicron ,'O',
- rtfSC_Pi ,'P',
- rtfSC_Theta ,'Q',
- rtfSC_Rho ,'R',
- rtfSC_Sigma ,'S',
- rtfSC_Tau ,'T',
- rtfSC_Upsilon ,'U',
- rtfSC_varsigma ,'V',
- rtfSC_Omega ,'W',
- rtfSC_Xi ,'X',
- rtfSC_Psi ,'Y',
- rtfSC_Zeta ,'Z',
- rtfSC_bracketleft ,'[',
- rtfSC_backslash ,'\\',
- rtfSC_bracketright ,']',
- rtfSC_asciicircum ,'^',
- rtfSC_underscore ,'_',
- rtfSC_quoteleft ,'`',
- rtfSC_alpha ,'a',
- rtfSC_beta ,'b',
- rtfSC_chi ,'c',
- rtfSC_delta ,'d',
- rtfSC_epsilon ,'e',
- rtfSC_phi ,'f',
- rtfSC_gamma ,'g',
- rtfSC_eta ,'h',
- rtfSC_iota ,'i',
- rtfSC_kappa ,'k',
- rtfSC_lambda ,'l',
- rtfSC_mu ,'m',
- rtfSC_nu ,'n',
- rtfSC_omicron ,'o',
- rtfSC_pi ,'p',
- rtfSC_theta ,'q',
- rtfSC_rho ,'r',
- rtfSC_sigma ,'s',
- rtfSC_tau ,'t',
- rtfSC_upsilon ,'u',
- rtfSC_omega ,'w',
- rtfSC_xi ,'x',
- rtfSC_psi ,'y',
- rtfSC_zeta ,'z',
- rtfSC_braceleft ,'{',
- rtfSC_bar ,'|',
- rtfSC_braceright ,'}',
- rtfSC_mathtilde ,'~'
-};
_____
Deleted: trunk/reactos/lib/richedit/reader.c
--- trunk/reactos/lib/richedit/reader.c 2005-05-05 19:05:42 UTC (rev
15015)
+++ trunk/reactos/lib/richedit/reader.c 2005-05-05 19:11:20 UTC (rev
15016)
@@ -1,2725 +0,0 @@
-/*
- * WINE RTF file reader
- *
- * Portions Copyright 2004 Mike McCormack for CodeWeavers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
- */
-
-/*
- * - Need to document error code meanings.
- * - Need to do something with \* on destinations.
- * - Make the parameter a long?
- *
- * reader.c - RTF file reader. Release 1.10.
- *
- * ASCII 10 (\n) and 13 (\r) are ignored and silently discarded.
- * Nulls are also discarded.
- * (although the read hook will still get a look at them.)
- *
- * "\:" is not a ":", it's a control symbol. But some versions
of
- * Word seem to write "\:" for ":". This reader treats
"\:" as a
- * plain text ":"
- *
- * 19 Mar 93
- * - Add hack to skip "{\*\keycode ... }" group in stylesheet.
- * This is probably the wrong thing to do, but it's simple.
- * 13 Jul 93
- * - Add THINK C awareness to malloc() declaration. Necessary so
- * compiler knows the malloc argument is 4 bytes. Ugh.
- * 07 Sep 93
- * - Text characters are mapped onto standard codes, which are placed
- * in rtfMinor.
- * - Eliminated use of index() function.
- * 05 Mar 94
- * - Added zillions of new symbols (those defined in RTF spec 1.2).
- * 14 Mar 94
- * - Public functions RTFMsg() and RTFPanic() now take variable
arguments.
- * This means RTFPanic() now is used in place of what was formerly the
- * internal function Error().
- * - 8-bit characters are now legal, so they're not converted to \'xx
- * hex char representation now.
- * 01 Apr 94
- * - Added public variables rtfLineNum and rtfLinePos.
- * - #include string.h or strings.h, avoiding strncmp() problem where
- * last argument is treated as zero when prototype isn't available.
- * 04 Apr 94
- * - Treat style numbers 222 and 0 properly as "no style" and
"normal".
- *
- * Author: Paul DuBois dubois(a)primate.wisc.edu
- *
- * This software may be redistributed without restriction and used for
- * any purpose whatsoever.
- */
-
-# include <stdio.h>
-# include <ctype.h>
-# include <string.h>
-# include <stdarg.h>
-
-#include "rtf.h"
-/*
- * include hard coded charsets
- */
-
-#include "ansi_gen.h"
-#include "ansi_sym.h"
-#include "text_map.h"
-
-#include <stdlib.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(richedit);
-
-extern HANDLE RICHED32_hHeap;
-
-static int _RTFGetChar(RTF_Info *);
-static void _RTFGetToken (RTF_Info *);
-static void _RTFGetToken2 (RTF_Info *);
-static int GetChar (RTF_Info *);
-static void ReadFontTbl (RTF_Info *);
-static void ReadColorTbl (RTF_Info *);
-static void ReadStyleSheet (RTF_Info *);
-static void ReadInfoGroup (RTF_Info *);
-static void ReadPictGroup (RTF_Info *);
-static void ReadObjGroup (RTF_Info *);
-static void LookupInit (void);
-static void Lookup (RTF_Info *, char *);
-static int Hash (char*);
-
-static void CharSetInit (RTF_Info *);
-static void ReadCharSetMaps (RTF_Info *);
-
-
-/*
- * This array is used to map standard character names onto their
numeric codes.
- * The position of the name within the array is the code.
- * stdcharnames.h is generated in the ../h directory.
- */
-
-#include "stdcharnames.h"
-
-int _RTFGetChar(RTF_Info *info)
-{
- int ch;
-
- TRACE("\n");
-
- if( info->dwInputSize <= info->dwInputUsed )
- {
- long count = 0;
- info->editstream.pfnCallback(info->editstream.dwCookie,
- info->InputBuffer, sizeof(info->InputBuffer),
&count);
- if(count == 0)
- return EOF;
- info->dwInputSize = count;
- info->dwInputUsed = 0;
- }
- ch = info->InputBuffer[info->dwInputUsed++];
- if( !ch ) return EOF;
- return ch;
-}
-
-void RTFSetEditStream(RTF_Info *info, EDITSTREAM *es)
-{
- TRACE("\n");
-
- info->editstream.dwCookie = es->dwCookie;
- info->editstream.dwError = es->dwError;
- info->editstream.pfnCallback = es->pfnCallback;
-}
-
-/*
- * Initialize the reader. This may be called multiple times,
- * to read multiple files. The only thing not reset is the input
- * stream; that must be done with RTFSetStream().
- */
-
-void RTFInit(RTF_Info *info)
-{
-int i;
-RTFColor *cp;
-RTFFont *fp;
-RTFStyle *sp;
-RTFStyleElt *eltList, *ep;
-
- TRACE("\n");
-
- if (info->rtfTextBuf == (char *) NULL) /* initialize the text
buffers */
- {
- info->rtfTextBuf = RTFAlloc (rtfBufSiz);
- info->pushedTextBuf = RTFAlloc (rtfBufSiz);
- if (info->rtfTextBuf == (char *) NULL
- || info->pushedTextBuf == (char *) NULL)
- RTFPanic (info,"Cannot allocate text buffers.");
- info->rtfTextBuf[0] = info->pushedTextBuf[0] = '\0';
- }
-
- RTFFree (info->inputName);
- RTFFree (info->outputName);
- info->inputName = info->outputName = (char *) NULL;
-
- /* initialize lookup table */
- LookupInit ();
-
- for (i = 0; i < rtfMaxClass; i++)
- RTFSetClassCallback (info, i, (RTFFuncPtr) NULL);
- for (i = 0; i < rtfMaxDestination; i++)
- RTFSetDestinationCallback (info, i, (RTFFuncPtr) NULL);
-
- /* install built-in destination readers */
- RTFSetDestinationCallback (info, rtfFontTbl, ReadFontTbl);
- RTFSetDestinationCallback (info, rtfColorTbl, ReadColorTbl);
- RTFSetDestinationCallback (info, rtfStyleSheet, ReadStyleSheet);
- RTFSetDestinationCallback (info, rtfInfo, ReadInfoGroup);
- RTFSetDestinationCallback (info, rtfPict, ReadPictGroup);
- RTFSetDestinationCallback (info, rtfObject, ReadObjGroup);
-
-
- RTFSetReadHook (info, (RTFFuncPtr) NULL);
-
- /* dump old lists if necessary */
-
- while (info->fontList != (RTFFont *) NULL)
- {
- fp = info->fontList->rtfNextFont;
- RTFFree (info->fontList->rtfFName);
- RTFFree ((char *) info->fontList);
- info->fontList = fp;
- }
- while (info->colorList != (RTFColor *) NULL)
- {
- cp = info->colorList->rtfNextColor;
- RTFFree ((char *) info->colorList);
- info->colorList = cp;
- }
- while (info->styleList != (RTFStyle *) NULL)
- {
- sp = info->styleList->rtfNextStyle;
- eltList = info->styleList->rtfSSEList;
- while (eltList != (RTFStyleElt *) NULL)
- {
- ep = eltList->rtfNextSE;
- RTFFree (eltList->rtfSEText);
- RTFFree ((char *) eltList);
- eltList = ep;
- }
- RTFFree (info->styleList->rtfSName);
- RTFFree ((char *) info->styleList);
- info->styleList = sp;
- }
-
- info->rtfClass = -1;
- info->pushedClass = -1;
- info->pushedChar = EOF;
-
- info->rtfLineNum = 0;
- info->rtfLinePos = 0;
- info->prevChar = EOF;
- info->bumpLine = 0;
-
- CharSetInit (info);
- info->csTop = 0;
-}
-
-/*
- * Set or get the input or output file name. These are never
guaranteed
- * to be accurate, only insofar as the calling program makes them so.
- */
-
-void RTFSetInputName(RTF_Info *info, char *name)
-{
- TRACE("\n");
-
- if ((info->inputName = RTFStrSave (name)) == (char *) NULL)
- RTFPanic (info,"RTFSetInputName: out of memory");
-}
-
-
-char *RTFGetInputName(RTF_Info *info)
-{
- return (info->inputName);
-}
-
-
-void RTFSetOutputName(RTF_Info *info, char *name)
-{
- TRACE("\n");
-
- if ((info->outputName = RTFStrSave (name)) == (char *) NULL)
- RTFPanic (info, "RTFSetOutputName: out of memory");
-}
-
-
-char *RTFGetOutputName(RTF_Info *info)
-{
- return (info->outputName);
-}
-
-
-
-/*
----------------------------------------------------------------------
*/
-
-/*
- * Callback table manipulation routines
- */
-
-
-/*
- * Install or return a writer callback for a token class
- */
-
-void RTFSetClassCallback(RTF_Info *info, int class, RTFFuncPtr
callback)
-{
- if (class >= 0 && class < rtfMaxClass)
- info->ccb[class] = callback;
-}
-
-
-RTFFuncPtr RTFGetClassCallback(RTF_Info *info, int class)
-{
- if (class >= 0 && class < rtfMaxClass)
- return (info->ccb[class]);
- return ((RTFFuncPtr) NULL);
-}
-
-
-/*
- * Install or return a writer callback for a destination type
- */
-
-void RTFSetDestinationCallback(RTF_Info *info, int dest, RTFFuncPtr
callback)
-{
- if (dest >= 0 && dest < rtfMaxDestination)
- info->dcb[dest] = callback;
-}
-
-
-RTFFuncPtr RTFGetDestinationCallback(RTF_Info *info, int dest)
-{
- if (dest >= 0 && dest < rtfMaxDestination)
- return (info->dcb[dest]);
- return ((RTFFuncPtr) NULL);
-}
-
-
-/*
----------------------------------------------------------------------
*/
-
-/*
- * Token reading routines
- */
-
-
-/*
- * Read the input stream, invoking the writer's callbacks
- * where appropriate.
- */
-
-void RTFRead(RTF_Info *info)
-{
- while (RTFGetToken (info) != rtfEOF)
- RTFRouteToken (info);
-}
-
-
-/*
- * Route a token. If it's a destination for which a reader is
- * installed, process the destination internally, otherwise
- * pass the token to the writer's class callback.
- */
-
-void RTFRouteToken(RTF_Info *info)
-{
-RTFFuncPtr p;
-
- TRACE("\n");
-
- if (info->rtfClass < 0 || info->rtfClass >= rtfMaxClass)
/* watchdog */
- {
- RTFPanic (info,"Unknown class %d: %s (reader
malfunction)",
- info->rtfClass,
info->rtfTextBuf);
- }
- if (RTFCheckCM (info, rtfControl, rtfDestination))
- {
- /* invoke destination-specific callback if there is one
*/
- if ((p = RTFGetDestinationCallback (info,
info->rtfMinor))
- != (RTFFuncPtr)
NULL)
- {
- (*p) (info);
- return;
- }
- }
- /* invoke class callback if there is one */
- if ((p = RTFGetClassCallback (info, info->rtfClass)) !=
(RTFFuncPtr) NULL)
- (*p) (info);
-}
-
-
-/*
- * Skip to the end of the current group. When this returns,
- * writers that maintain a state stack may want to call their
- * state unstacker; global vars will still be set to the group's
- * closing brace.
- */
-
-void RTFSkipGroup(RTF_Info *info)
-{
-int level = 1;
- TRACE("\n");
-
- while (RTFGetToken (info) != rtfEOF)
- {
- if (info->rtfClass == rtfGroup)
- {
- if (info->rtfMajor == rtfBeginGroup)
- ++level;
- else if (info->rtfMajor == rtfEndGroup)
- {
- if (--level < 1)
- break; /* end of initial group
*/
- }
- }
- }
-}
-
-
-/*
- * Read one token. Call the read hook if there is one. The
- * token class is the return value. Returns rtfEOF when there
- * are no more tokens.
- */
-
-int RTFGetToken(RTF_Info *info)
-{
-RTFFuncPtr p;
- TRACE("\n");
-
- for (;;)
- {
- _RTFGetToken (info);
- if ((p = RTFGetReadHook (info)) != (RTFFuncPtr) NULL)
- (*p) (info); /* give read hook a look at
token */
-
- /* Silently discard newlines, carriage returns, nulls.
*/
- if (!(info->rtfClass == rtfText && info->rtfFormat !=
SF_TEXT
- && (info->rtfMajor == '\r' || info->rtfMajor ==
'\n' || info->rtfMajor == '\0')))
- break;
- }
- return (info->rtfClass);
-}
-
-
-/*
- * Install or return a token reader hook.
- */
-
-void RTFSetReadHook(RTF_Info *info, RTFFuncPtr f)
-{
- info->readHook = f;
-}
-
-
-RTFFuncPtr RTFGetReadHook(RTF_Info *info)
-{
- return (info->readHook);
-}
-
-
-void RTFUngetToken(RTF_Info *info)
-{
- TRACE("\n");
-
- if (info->pushedClass >= 0) /* there's already an ungotten
token */
- RTFPanic (info,"cannot unget two tokens");
- if (info->rtfClass < 0)
- RTFPanic (info,"no token to unget");
- info->pushedClass = info->rtfClass;
- info->pushedMajor = info->rtfMajor;
- info->pushedMinor = info->rtfMinor;
- info->pushedParam = info->rtfParam;
- (void) strcpy (info->pushedTextBuf, info->rtfTextBuf);
-}
-
-
-int RTFPeekToken(RTF_Info *info)
-{
- _RTFGetToken (info);
- RTFUngetToken (info);
- return (info->rtfClass);
-}
-
-
-static void _RTFGetToken(RTF_Info *info)
-{
-RTFFont *fp;
-
- TRACE("\n");
-
- if (info->rtfFormat == SF_TEXT) {
- info->rtfMajor = GetChar (info);
- info->rtfMinor = rtfSC_nothing;
- info->rtfParam = rtfNoParam;
- info->rtfTextBuf[info->rtfTextLen = 0] = '\0';
- if (info->rtfMajor == EOF)
- info->rtfClass = rtfEOF;
- else
- info->rtfClass = rtfText;
- return;
- }
-
- /* first check for pushed token from RTFUngetToken() */
-
- if (info->pushedClass >= 0)
- {
- info->rtfClass = info->pushedClass;
- info->rtfMajor = info->pushedMajor;
- info->rtfMinor = info->pushedMinor;
- info->rtfParam = info->pushedParam;
- (void) strcpy (info->rtfTextBuf, info->pushedTextBuf);
- info->rtfTextLen = strlen (info->rtfTextBuf);
- info->pushedClass = -1;
- return;
- }
-
- /*
- * Beyond this point, no token is ever seen twice, which is
- * important, e.g., for making sure no "}" pops the font stack
twice.
- */
-
- _RTFGetToken2 (info);
- if (info->rtfClass == rtfText) /* map RTF char to standard code
*/
- info->rtfMinor = RTFMapChar (info, info->rtfMajor);
-
- /*
- * If auto-charset stuff is activated, see if anything needs
doing,
- * like reading the charset maps or switching between them.
- */
-
- if (info->autoCharSetFlags == 0)
- return;
-
- if ((info->autoCharSetFlags & rtfReadCharSet)
- && RTFCheckCM (info, rtfControl, rtfCharSet))
- {
- ReadCharSetMaps (info);
- }
- else if ((info->autoCharSetFlags & rtfSwitchCharSet)
- && RTFCheckCMM (info, rtfControl, rtfCharAttr,
rtfFontNum))
- {
- if ((fp = RTFGetFont (info, info->rtfParam)) != (RTFFont
*) NULL)
- {
- if (strncmp (fp->rtfFName, "Symbol", 6) == 0)
- info->curCharSet = rtfCSSymbol;
- else
- info->curCharSet = rtfCSGeneral;
- RTFSetCharSet (info, info->curCharSet);
- }
- }
- else if ((info->autoCharSetFlags & rtfSwitchCharSet) &&
info->rtfClass == rtfGroup)
- {
- switch (info->rtfMajor)
- {
- case rtfBeginGroup:
- if (info->csTop >= maxCSStack)
- RTFPanic (info, "_RTFGetToken: stack
overflow");
- info->csStack[info->csTop++] = info->curCharSet;
- break;
- case rtfEndGroup:
- /*
- * If stack top is 1 at this point, we are
ending the
- * group started by the initial {, which ends
the
- * RTF stream
- */
- if (info->csTop <= 0)
- RTFPanic (info,"_RTFGetToken: stack
underflow");
- else if (info->csTop == 1)
- info->rtfClass = rtfEOF;
- else
- {
- info->curCharSet =
info->csStack[--info->csTop];
- RTFSetCharSet (info, info->curCharSet);
- }
- break;
- }
- }
-}
-
-
-/* this shouldn't be called anywhere but from _RTFGetToken() */
-
-static void _RTFGetToken2(RTF_Info *info)
-{
-int sign;
-int c;
-
- TRACE("\n");
-
- /* initialize token vars */
-
- info->rtfClass = rtfUnknown;
- info->rtfParam = rtfNoParam;
- info->rtfTextBuf[info->rtfTextLen = 0] = '\0';
-
- /* get first character, which may be a pushback from previous
token */
-
- if (info->pushedChar != EOF)
- {
- c = info->pushedChar;
- info->rtfTextBuf[info->rtfTextLen++] = c;
- info->rtfTextBuf[info->rtfTextLen] = '\0';
- info->pushedChar = EOF;
- }
- else if ((c = GetChar (info)) == EOF)
- {
- info->rtfClass = rtfEOF;
- return;
- }
-
- if (c == '{')
- {
- info->rtfClass = rtfGroup;
- info->rtfMajor = rtfBeginGroup;
- return;
- }
- if (c == '}')
- {
- info->rtfClass = rtfGroup;
- info->rtfMajor = rtfEndGroup;
- return;
- }
- if (c != '\\')
- {
- /*
- * Two possibilities here:
- * 1) ASCII 9, effectively like \tab control symbol
- * 2) literal text char
- */
- if (c == '\t') /* ASCII 9 */
- {
- info->rtfClass = rtfControl;
- info->rtfMajor = rtfSpecialChar;
- info->rtfMinor = rtfTab;
- }
- else
- {
- info->rtfClass = rtfText;
- info->rtfMajor = c;
- }
- return;
- }
- if ((c = GetChar (info)) == EOF)
- {
- /* early eof, whoops (class is rtfUnknown) */
- return;
- }
- if (!isalpha (c))
- {
- /*
- * Three possibilities here:
- * 1) hex encoded text char, e.g., \'d5, \'d3
- * 2) special escaped text char, e.g., \{, \}
- * 3) control symbol, e.g., \_, \-, \|, \<10>
- */
- if (c == '\'') /* hex char */
- {
- int c2;
-
- if ((c = GetChar (info)) != EOF && (c2 = GetChar
(info)) != EOF)
- {
- /* should do isxdigit check! */
- info->rtfClass = rtfText;
- info->rtfMajor = RTFCharToHex (c) * 16
- + RTFCharToHex (c2);
- return;
- }
- /* early eof, whoops (class is rtfUnknown) */
- return;
- }
-
- /* escaped char */
- /*if (index (":{}\\", c) != (char *) NULL)*/ /* escaped
char */
- if (c == ':' || c == '{' || c == '}' || c == '\\')
- {
- info->rtfClass = rtfText;
- info->rtfMajor = c;
- return;
- }
-
[truncated at 1000 lines; 4495 more skipped]