You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2006/02/08 18:15:25 UTC

svn commit: r376000 [7/7] - in /xalan/c/trunk: Projects/Win32/VC8/ Projects/Win32/VC8/AllInOne/ Projects/Win32/VC8/CompileStylesheet/ Projects/Win32/VC8/Conf/ Projects/Win32/VC8/DocumentBuilder/ Projects/Win32/VC8/ExternalFunction/ Projects/Win32/VC8/P...

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.cpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.cpp Wed Feb  8 09:15:09 2006
@@ -29,177 +29,212 @@
 // -----------------------------------------------------------------------
 //  Constructors
 // -----------------------------------------------------------------------
-InMemHandler::InMemHandler(const char* fileName):
-	SAX2Handler(),
-	m_fStream(fileName),
-	m_isTheFirstLineInArray(true)
+InMemHandler::InMemHandler(
+            const char*     fileName,
+            const char*     indexFileName) :
+    SAX2Handler(indexFileName),
+    m_stream(fileName),
+    m_isTheFirstLineInArray(true)
 {
 }
 
-InMemHandler::~InMemHandler()
-{
-
-}
 
 
-void InMemHandler::printToDataFile( const char* sArrayOfStrins[] )
+InMemHandler::~InMemHandler()
 {
-	if ( sArrayOfStrins == 0)
-		return;
 
+}
 
-	for (int i = 0; sArrayOfStrins[i] != 0; i++)
-	{
 
-		m_fStream.writeAsASCII(sArrayOfStrins[i], strlen(sArrayOfStrins[i]));
 
-	}
+void
+InMemHandler::printToDataFile(const char*   sArrayOfStrings[])
+{
+    if (sArrayOfStrings != 0)
+    {
+        for (int i = 0; sArrayOfStrings[i] != 0; ++i)
+        {
+            m_stream.writeAsASCII(
+                sArrayOfStrings[i],
+                XMLString::stringLen(sArrayOfStrings[i]));
+        }
+    }
 }
 
 
-void InMemHandler::endDocument()
+
+void
+InMemHandler::endDocument()
 {
-	createBottomForDataFile ( );
+    createBottomForDataFile();
 
-	SAX2Handler::endDocument( );
+    SAX2Handler::endDocument();
 }
 
 
 
-
-void InMemHandler::characters(	const   XMLCh* const    chars
-						, const unsigned int    length)
+void
+InMemHandler::characters(
+            const XMLCh* const    chars,
+            const unsigned int    length)
 {
+    if (m_startCollectingCharacters == true)
+    {
+        char buffer[20];
 
-	if ( m_startCollectingCharacters == true )
-	{		
+        for( unsigned int i = 0; i < length ; ++i)
+        {
+            sprintf(
+                buffer,
+                " %#4x, ",
+                chars[i]);
 
-		char buffer[20];
-
-		for( unsigned int i = 0; i < length ; i++)
-		{
-			buffer[0] = '\0';
+            m_stream.writeAsASCII(
+                buffer,
+                XMLString::stringLen(buffer));
+        }
+    }
+}
 
-			sprintf(buffer," %#4x, ",chars[i]);
 
-			m_fStream.writeAsASCII(buffer, strlen(buffer));
 
-		}
-		
-		
+void
+InMemHandler::startDocument()
+{
+    createHeaderForDataFile();
 
-	}
+    SAX2Handler::startDocument();
 }
 
-void InMemHandler::startDocument()
-{
-	createHeaderForDataFile ( );
-
-	SAX2Handler::startDocument();
 
-}
 
-void InMemHandler::endElement(const XMLCh* const ,
-					const XMLCh* const localname,
-					const XMLCh* const )
+void
+InMemHandler::endElement(
+            const XMLCh* const,
+            const XMLCh* const  localname,
+            const XMLCh* const)
 {
-	if ( m_startCollectingCharacters == false)
-		return;
+    if (m_startCollectingCharacters == true)
+    {
+        if(!XMLString::compareString(localname, s_targetXMLCh))
+        {
+            m_startCollectingCharacters = false;
 
+            printEndOfDataLine();
+        }
+    }
+}
 
-	if(!XMLString::compareString(localname,s_targetXMLCh))
-	{
-		m_startCollectingCharacters = false;
 
-		printEndOfDataLine();
-	}
-}
 
-void InMemHandler::startElement(const   XMLCh* const    uri,
-								const   XMLCh* const    localname,
-								const   XMLCh* const    qname,
-								const   Attributes&		attributes)
+void
+InMemHandler::startElement(
+            const XMLCh* const  uri,
+            const XMLCh* const  localname,
+            const XMLCh* const  qname,
+            const Attributes&   attributes)
 {
-	
-	if(!XMLString::compareString(localname,s_transUnitXMLCh))
-	{
-		// this is an elemente, SAX2Handler class is responsible to handle:
-		// creating Index file, commom for all localization styles
-		SAX2Handler::startElement(uri, localname, qname, attributes);
-	}
-	else if(!XMLString::compareString(localname,s_targetXMLCh))
-	{
-
-		
-		m_startCollectingCharacters = true;	
-		
-		printBeginOfDataLine();
+    if(!XMLString::compareString(localname, s_transUnitXMLCh))
+    {
+        // this is an elemente, SAX2Handler class is responsible to handle:
+        // creating Index file, commom for all localization styles
+        SAX2Handler::startElement(uri, localname, qname, attributes);
+    }
+    else if(!XMLString::compareString(localname, s_targetXMLCh))
+    {
+        m_startCollectingCharacters = true; 
 
-	}
-	
+        printBeginOfDataLine();
+    }
 }
 
-void InMemHandler::createHeaderForDataFile ()
+
+
+void
+InMemHandler::createHeaderForDataFile()
 {
-	printToDataFile( szApacheLicense );
-	printToDataFile( szStartDataFile );
+    printToDataFile(szApacheLicense);
+    printToDataFile(szStartDataFile);
 }
 
 
 
-void InMemHandler::printBeginOfDataLine ()
+void
+InMemHandler::printBeginOfDataLine()
 {
+    char    buff[500];
 
-	char buff[50];
-
-	buff[0] = 0;
+    assert(XMLString::stringLen(s_szVariableName) < 400);
 
-	sprintf(buff,"%s%d[] = {",s_szVariableName, m_numberOfRecords);
-
-	m_fStream.writeAsASCII(buff,strlen(buff));
+    sprintf(
+        buff,
+        "%.400s%d[] = {",
+        s_szVariableName,
+        m_numberOfRecords);
 
+    m_stream.writeAsASCII(
+        buff,
+        XMLString::stringLen(buff));
 }
 
 
-void InMemHandler::printEndOfDataLine ()
+
+void
+InMemHandler::printEndOfDataLine()
 {
-	printToDataFile( szEndOfLineInDataFile  );
+    printToDataFile(szEndOfLineInDataFile);
 }
 
 
-void InMemHandler::createBottomForDataFile ()
+
+void
+InMemHandler::createBottomForDataFile()
 {
+    printToDataFile(szArraySizeVar);
 
-	printToDataFile( szArraySizeVar );
+    char    buff[100];
 
-	char buff[100];
-	
-	sprintf( buff, " %d ;",m_numberOfRecords);
-		
-	m_fStream.writeAsASCII(buff,strlen(buff));
+    sprintf(
+        buff,
+        " %d ;",
+        m_numberOfRecords);
 
-	m_fStream.writeAsASCII("\nstatic const XalanDOMChar* msgArray[]={ ",40);
+    m_stream.writeAsASCII(
+        buff,
+        XMLString::stringLen(buff));
 
-	buff[0] = 0;
+    const char* const   theString =
+        "\nstatic const XalanDOMChar* msgArray[]={";
 
-	
-	for(int i = 0; i < m_numberOfRecords; i++)
-	{
-		sprintf(buff,"%s%d ",s_szSimpleVariableName,i+1);
+    m_stream.writeAsASCII(
+        theString,
+        XMLString::stringLen(theString));
 
-		m_fStream.writeAsASCII(buff, strlen(buff));
+    for(int i = 0; i < m_numberOfRecords; ++i)
+    {
+        sprintf(
+            buff,
+            "%s%d ",
+            s_szSimpleVariableName,
+            i + 1);
 
-		if(i != ( m_numberOfRecords-1))
-		{
-			m_fStream.writeAsASCII(",",1);
-		}
-		else
-		{
-			m_fStream.writeAsASCII("};",2);
-		}
-		buff[0] = 0;
+        m_stream.writeAsASCII(
+            buff,
+            XMLString::stringLen(buff));
 
-	}
-	printToDataFile( szEndDataFile );	
+        if(i != m_numberOfRecords - 1)
+        {
+            m_stream.writeAsASCII(
+                ",",
+                1);
+        }
+        else
+        {
+            m_stream.writeAsASCII(
+                "};",
+                2);
+        }
+    }
 
+    printToDataFile(szEndDataFile);
 }

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.hpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/InMemHandler.hpp Wed Feb  8 09:15:09 2006
@@ -14,8 +14,12 @@
  * limitations under the License.
  */
 
-#if !defined(INMEMHANDLER_MSGCREATOR_1357924680)
-#define INMEMHANDLER_MSGCREATOR_1357924680
+#if !defined(INMEMHANDLER_1357924680)
+#define INMEMHANDLER_1357924680
+
+
+
+#include "xalanc/Include/PlatformDefinitions.hpp"
 
 #include "SAX2Handler.hpp"
 
@@ -28,72 +32,76 @@
     // -----------------------------------------------------------------------
     //  Constructors
     // -----------------------------------------------------------------------
-    InMemHandler(const char* fileName);
+    InMemHandler(
+            const char*     fileName,
+            const char*     indexFileName);
 
     virtual 
     ~InMemHandler();
 
-	// -----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     //  Implementations of the SAX DocumentHandler interface
     // -----------------------------------------------------------------------
-	virtual void 
-	endDocument();
-	
-	virtual void 
-	endElement(const XMLCh* const ,
-								 const XMLCh* const localname,
-								 const XMLCh* const )	;
-	virtual void 
-	startDocument();
-
-	virtual void 
-	startElement(const   XMLCh* const    uri,
-									const   XMLCh* const    localname,
-									const   XMLCh* const    qname,
-                                    const   Attributes&		attributes);
-
-	virtual void 
-	characters(	const   XMLCh* const    chars
-						, const unsigned int    length);
-
-
+    virtual void
+    endDocument();
 
+    virtual void
+    endElement(
+            const XMLCh* const,
+            const XMLCh* const  localname,
+            const XMLCh* const);
+
+    virtual void
+    startDocument();
+
+    virtual void 
+    startElement(
+            const XMLCh* const  uri,
+            const XMLCh* const  localname,
+            const XMLCh* const  qname,
+            const Attributes&   attributes);
+
+    virtual void 
+    characters(
+            const XMLCh* const  chars,
+            const unsigned int  length);
 
 protected:
 
-	XalanFileOutputStream	m_fStream;
+    MsgFileOutputStream     m_stream;
+
     // -----------------------------------------------------------------------
     //  functions for formatting the output file
     // -----------------------------------------------------------------------
-	virtual void 
-	createHeaderForDataFile ();
-	
-	virtual void 
-	createBottomForDataFile ();
-
-	virtual void 
-	printBeginOfDataLine ();
-	
-	virtual void 
-	printEndOfDataLine ();
-
-	void 
-	printToDataFile( const char* sArrayOfStrins[] );
+    virtual void
+    createHeaderForDataFile();
+    
+    virtual void
+    createBottomForDataFile();
+
+    virtual void
+    printBeginOfDataLine();
+    
+    virtual void
+    printEndOfDataLine();
 
+    void
+    printToDataFile(const char*     sArrayOfStrings[]);
 
 private:
 
-	bool m_isTheFirstLineInArray;
-
-	// Not implemented...
-	InMemHandler&
-	operator=(const InMemHandler&);
+    bool    m_isTheFirstLineInArray;
 
-	InMemHandler(const InMemHandler&);
+    // Not implemented...
+    InMemHandler&
+    operator=(const InMemHandler&);
 
-	bool
-	operator==(const InMemHandler&) const;
+    InMemHandler(const InMemHandler&);
 
+    bool
+    operator==(const InMemHandler&) const;
 };
 
-#endif /// INMEMHANDLER_MSGCREATOR_1357924680
+
+
+#endif /// INMEMHANDLER_1357924680

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.cpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.cpp Wed Feb  8 09:15:09 2006
@@ -34,6 +34,13 @@
 XALAN_USING_STD(cout)
 XALAN_USING_STD(endl)
 
+static const char* s_pathSeparator =
+#if defined(WINDOWS)
+             "\\";
+#else
+            "/";
+#endif
+
 static const char* s_xalanMsgFileName ="XalanMsg_";
 
 static const char* s_txtExten = ".txt";
@@ -43,6 +50,10 @@
 static const char* s_en = "en_US";
 
 static const char* DATA_FILE_NAME="LocalMsgData.hpp";
+static const char* INDEX_FILE_NAME="LocalMsgIndex.hpp";
+
+static const unsigned int s_max_path = 2000;
+
 
 // ---------------------------------------------------------------------------
 //  Local helper methods
@@ -50,205 +61,268 @@
 static void usage()
 {
     cout << "\nUsage:\n"
-		"    MsgCreator [options] <XML file>\n\n"
-		"This program reads XML message file, and then creates C++  " << endl <<
-		" source / data files for message localization (for .dll/.so/.cat build) \n"
-		
-		"Options:\n"
-		"   <XML file>   XLIFF file with messages. Required.  \n"
-		"   -TYPE xxx    Type of localization [icu | nls | inmem*]\n"
-		"   -LOCALE      Example: [ fr | fr_FR ]; The default value is 'en_US' \n"
-		"  * = Default if not provided explicitly.\n\n"
-		"    -?          Show this help.\n\n"
-		"\n"
-		<<  endl;
+        "    MsgCreator [options] <XML file>\n\n"
+        "This program reads XML message file, and then creates C++  " << endl <<
+        " source / data files for message localization (for .dll/.so/.cat build) \n"
+        
+        "Options:\n"
+        "   <XML file>   XLIFF file with messages. Required.  \n"
+        "   -TYPE xxx    Type of localization [icu | nls | inmem*]\n"
+        "   -LOCALE      Example: [ fr | fr_FR ]; The default value is 'en_US' \n"
+        "   -OUTDIR      The directory for the output files. \n"
+        "  * = Default if not provided explicitly.\n\n"
+        "    -?          Show this help.\n\n"
+        "\n"
+        <<  endl;
 }
 
 
 class CmdLineParams
 {
-	
+    
 public:
-	
-	typedef enum{
+    
+    typedef enum{
 
-		ICU_LOCALMSG = 0,
-		INMEM_LOCALMSG,
-		NLS_LOCALMSG
-
-	}TypeOfLocaleMsg;
-	
-	const char*		inXMLFileName;
-	
-	TypeOfLocaleMsg  enTypeOfLocaleMsg;
-	
-	const char*      encodingName;
-	
-	char		localeName[6];
-
-	CmdLineParams():
-		inXMLFileName(0),
-		enTypeOfLocaleMsg(INMEM_LOCALMSG),
-		encodingName("LATIN1")
-		{  
-			localeName[0] = 0;
-			strcpy( localeName, s_en);
-		}
+        ICU_LOCALMSG = 0,
+        INMEM_LOCALMSG,
+        NLS_LOCALMSG
 
-	~CmdLineParams() {}
+    }TypeOfLocaleMsg;
+    
+    const char*     inXMLFileName;
+    
+    TypeOfLocaleMsg  enTypeOfLocaleMsg;
+    
+    const char*      encodingName;
+
+    const char*      outDir;
+
+    char        localeName[6];
+
+    CmdLineParams():
+        inXMLFileName(0),
+        enTypeOfLocaleMsg(INMEM_LOCALMSG),
+        encodingName("LATIN1"),
+        outDir("")
+        {  
+            localeName[0] = 0;
+            strcpy( localeName, s_en);
+        }
+
+    ~CmdLineParams() {}
 };
 
 
 bool
 getArgs(
-		int				argc,
-		char*			argv[],
-		CmdLineParams&	p,
-		const char**	pErrorMsg)
+        int             argc,
+        char*           argv[],
+        CmdLineParams&  p,
+        const char**    pErrorMsg)
 {
 
-	bool fSuccess = true;
+    bool fSuccess = true;
 
-	const char*		errorMessage = 0;
+    const char*     errorMessage = 0;
 
-	if ( argc > 7)
-	{
-		fSuccess = false;
-		errorMessage = "Too many parameters\n";
-	}
-
-	for (int i = 1; i < argc && fSuccess == true; ++i)
-	{
-		if (!strcmp("-h", argv[i]) || !strcmp("-?", argv[i]))
-		{
-			fSuccess = false;
-		}
-		else if (!strcmp("-LOCALE", argv[i]) )
-		{
-			++i;
-			if( i < argc && argv[i][0] != '-' )
-			{
+    if ( argc > 8)
+    {
+        fSuccess = false;
+        errorMessage = "Too many parameters\n";
+    }
+
+    for (int i = 1; i < argc && fSuccess == true; ++i)
+    {
+        if (!strcmp("-h", argv[i]) || !strcmp("-?", argv[i]))
+        {
+            fSuccess = false;
+        }
+        else if (!strcmp("-LOCALE", argv[i]) )
+        {
+            ++i;
+            if( i < argc && argv[i][0] != '-' )
+            {
 #if defined(XALAN_STRICT_ANSI_HEADERS)
-				using std::size_t;
+                using std::size_t;
 #endif
-				const size_t	localeLen = strlen(argv[i]);
+                const size_t    localeLen = strlen(argv[i]);
 
-				if ( localeLen != 2 && localeLen !=5)
-				{
-					fSuccess = false;
-					errorMessage = "Unrecognized locale\n";
-				}
-
-				if ( fSuccess  && localeLen == 5 && argv[i][2] != '_')
-				{
-					fSuccess = false;
-					errorMessage = "Unrecognized form of locale\n";
-				}
-				if ( fSuccess )
-				{
-					strcpy(p.localeName,argv[i]);
-					
-					p.localeName[5]='\0'; // just in case
-				}
-			}
-		}
-		else if (!strcmp("-TYPE", argv[i]) )
-		{
-			++i;
-			
-			if( i < argc && argv[i][0] != '-' )
-			{
-				if( !strcmp("icu",argv[i] ))
-				{
-					p.enTypeOfLocaleMsg = CmdLineParams::ICU_LOCALMSG;
-					
-				}else if( !strcmp("nls",argv[i] ))
-				{
-					p.enTypeOfLocaleMsg = CmdLineParams::NLS_LOCALMSG;
-					
-				}
-				else if( !strcmp("inmem",argv[i] ))
-				{
-					p.enTypeOfLocaleMsg = CmdLineParams::INMEM_LOCALMSG;
-					
-				}else 
-				{ 
-					fSuccess = false;
-					errorMessage = "Unknown TYPE of localization\n";
-				}
-			}
-			else
-			{
-				fSuccess = false;
-			}
-		}else if ( argv[i][0] != '-' )
-		{
-			p.inXMLFileName = argv[i];
-		}
-	}
-
-	if ( fSuccess && p.inXMLFileName == 0)
-	{
-		fSuccess = false;
-		*pErrorMsg = "Please provide XLIFF file.\n";
-	}
-
-	if ( fSuccess )
-	{
-		*pErrorMsg = 0;
-	}
-	else
-	{
-		*pErrorMsg = errorMessage;
-	}
+                if ( localeLen != 2 && localeLen !=5)
+                {
+                    fSuccess = false;
+                    errorMessage = "Unrecognized locale\n";
+                }
+
+                if ( fSuccess  && localeLen == 5 && argv[i][2] != '_')
+                {
+                    fSuccess = false;
+                    errorMessage = "Unrecognized form of locale\n";
+                }
+                if ( fSuccess )
+                {
+                    strcpy(p.localeName,argv[i]);
+                    
+                    p.localeName[5]='\0'; // just in case
+                }
+            }
+        }
+        else if (!strcmp("-TYPE", argv[i]) )
+        {
+            ++i;
+            
+            if( i < argc && argv[i][0] != '-' )
+            {
+                if( !strcmp("icu",argv[i] ))
+                {
+                    p.enTypeOfLocaleMsg = CmdLineParams::ICU_LOCALMSG;
+                    
+                }else if( !strcmp("nls",argv[i] ))
+                {
+                    p.enTypeOfLocaleMsg = CmdLineParams::NLS_LOCALMSG;
+                    
+                }
+                else if( !strcmp("inmem",argv[i] ))
+                {
+                    p.enTypeOfLocaleMsg = CmdLineParams::INMEM_LOCALMSG;
+                    
+                }else 
+                { 
+                    fSuccess = false;
+                    errorMessage = "Unknown TYPE of localization\n";
+                }
+            }
+            else
+            {
+                fSuccess = false;
+            }
+        }
+        else if (!strcmp("-OUTDIR", argv[i]) )
+        {
+            ++i;
+            
+            if( i < argc && argv[i][0] != '-' )
+            {
+                p.outDir = argv[i];
+            }
+            else
+            {
+                fSuccess = false;
+            }
+        }
+        else if ( argv[i][0] != '-' )
+        {
+            p.inXMLFileName = argv[i];
+        }
+    }
+
+    if ( fSuccess && p.inXMLFileName == 0)
+    {
+        fSuccess = false;
+        *pErrorMsg = "Please provide XLIFF file.\n";
+    }
+
+    if ( fSuccess )
+    {
+        *pErrorMsg = 0;
+    }
+    else
+    {
+        *pErrorMsg = errorMessage;
+    }
 
-	return fSuccess;
+    return fSuccess;
 }
 
 
-static char* buildOutputFileName(const CmdLineParams&	p)
+static void
+appendDirectory(
+            const CmdLineParams&    p,
+            char                    FileName[])
 {
-	char* pOutputFileName = new char[80];
-	pOutputFileName[0] = '\0';
+#if defined(XALAN_STRICT_ANSI_HEADERS)
+    using std::strlen;
+    using std::size_t;
+#endif
 
-	switch(p.enTypeOfLocaleMsg)
-	{
-		
-	case CmdLineParams::ICU_LOCALMSG:
-		{
-			strcpy(pOutputFileName, p.localeName);
-			
-			strcat(pOutputFileName, s_txtExten);
-			
-			break;
-		}
-	case CmdLineParams::INMEM_LOCALMSG:
-		{
-			strcpy(pOutputFileName, DATA_FILE_NAME);
-			
-			break;
-		}
-		
-	case CmdLineParams::NLS_LOCALMSG:
-		{
-			strcpy(pOutputFileName,s_xalanMsgFileName);
-			
-			strncat(pOutputFileName, p.localeName,6);
-			
-			strcat(pOutputFileName, s_msgExten);
-			
-			break;
-		}
-	default:
-		{
-			// in that stage the local should be defined
-			assert ( 0 );
-		}
-	}
-	return pOutputFileName;
+    const size_t    dirLength = strlen(p.outDir);
+
+    if (dirLength == 0)
+    {
+        strcpy(FileName, "");
+    }
+    else
+    {
+        strcpy(FileName, p.outDir);
+
+        const char* const   separator =
+            strrchr(FileName, *s_pathSeparator);
+
+        if (separator == 0 ||
+            *(separator + 1) == '\0')
+        {
+            strcat(FileName, s_pathSeparator);
+        }
+    }
+}
+
+
+
+static void
+buildOutputFileName(
+            const CmdLineParams&    p,
+            char                    OutputFileName[])
+{
+    appendDirectory(p, OutputFileName);
+
+    switch(p.enTypeOfLocaleMsg)
+    {
+        
+    case CmdLineParams::ICU_LOCALMSG:
+        {
+            strcat(OutputFileName, p.localeName);
+            
+            strcat(OutputFileName, s_txtExten);
+            
+            break;
+        }
+    case CmdLineParams::INMEM_LOCALMSG:
+        {
+            strcat(OutputFileName, DATA_FILE_NAME);
+
+            break;
+        }
+        
+    case CmdLineParams::NLS_LOCALMSG:
+        {
+            strcat(OutputFileName,s_xalanMsgFileName);
+            
+            strncat(OutputFileName, p.localeName,6);
+            
+            strcat(OutputFileName, s_msgExten);
+            
+            break;
+        }
+    default:
+        {
+            // in that stage the local should be defined
+            assert ( 0 );
+        }
+    }
 }
 
 
+static void
+buildIndexFileName(
+            const CmdLineParams&    p,
+            char                    IndexFileName[])
+{
+    appendDirectory(p, IndexFileName);
+
+    strcat(
+        IndexFileName,
+        INDEX_FILE_NAME);
+}
 
 
 // ---------------------------------------------------------------------------
@@ -256,191 +330,186 @@
 // ---------------------------------------------------------------------------
 int main(int argC, char* argV[])
 {
-	
+    
 #if !defined(NDEBUG) && defined(_MSC_VER)
-	_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
-	
-	_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
-	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+    _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
+    
+    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
 #endif
     
-	CmdLineParams	theParams;
+    CmdLineParams   theParams;
 
-	int iReturnValue = 0;
+    int iReturnValue = 0;
 
-	const char* errorMessage = 0;
+    const char*     errorMessage = 0;
 
-	if (getArgs(argC, argV, theParams, &errorMessage) == false)
-	{
-		if ( errorMessage != 0)
-		{
-			cerr << errorMessage;
-		}
-		usage();
-		iReturnValue = 1;
-		
-	}
-	else
-	{
-		
-		try
-		{
-			XMLPlatformUtils::Initialize();
-		}
-		
-		catch (const XMLException& toCatch)
-		{
-			cerr << "Error during initialization! : "
-				<< StrX(toCatch.getMessage()) << endl;
-			iReturnValue = 2;
-		}
-		if (iReturnValue == 0)
-		{
-			
-			{	//  Create a SAX parser object. 
-				SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
-				
-				parser->setFeature(XMLUni::fgSAX2CoreValidation, false);
-				
-				parser->setFeature(XMLUni::fgXercesDynamic, true);
-				
-				parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, false);
-				
-				parser->setFeature(XMLUni::fgXercesSchema, true);
-				
-				parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
-				
-				parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
-				
-
-				//  Create the handler object and install it as the document and error
-				//  handler for the parser. Then parse the file and catch any exceptions
-				//  that propogate out
-				//
-
-				int errorCount = 0;
-
-				const char* 		fileName = theParams.inXMLFileName;
-
-				char * const		pOutputFileName = buildOutputFileName(theParams);
-
-				SAX2Handler* handler = 0;
-				try
-				{
-					switch(theParams.enTypeOfLocaleMsg){
-					case CmdLineParams::ICU_LOCALMSG:
-						{
-							handler = new ICUResHandler(pOutputFileName);
-							break;
-						}
-					case CmdLineParams::INMEM_LOCALMSG:
-						{
-							handler = new InMemHandler(pOutputFileName);
-							break;
-						}
-					case CmdLineParams::NLS_LOCALMSG:
-						{
-							handler = new NLSHandler(pOutputFileName);
-							break;
-						}
-					default:
-						{
-							assert (0);
-						}
-					}
-				}
-				
-				catch(const XalanFileOutputStream::XalanFileOutputStreamOpenException& e)
-				{
-					cerr << "\nAn error occurred\n  Error: ";
-					if (e.m_pMessage != 0)
-					{
-						cerr << e.m_pMessage <<  endl;
-					}
-					else
-					{
-						cerr << "unknown (XalanFileOutputStreamOpenException) "  << endl;
-						
-					}
-					
-					iReturnValue = 4;	
-					
-					
-				}
-				catch(const XalanFileOutputStream::XalanFileOutputStreamWriteException& e)
-				{
-					cerr << "\nAn error occurred\n  Error: ";
-					if (e.m_pMessage != 0)
-					{
-						cerr << e.m_pMessage << endl;
-					}
-					else
-					{
-						cerr << "unknown (XalanFileOutputStreamWriteException) " <<  endl;
-						
-					}
-					
-					iReturnValue = 5;	
-					
-				}
-				catch (...)
-				{
-					cerr << "Unknown error occured." << endl;
-					iReturnValue = 6;
-				}
-				
-				// run the parser
-				if ( iReturnValue == 0)
-				{
-					try
-					{				
-						handler->setLocale(theParams.localeName);
-	
-						parser->setContentHandler(handler);
-
-						parser->setErrorHandler(handler);
-						
-						parser->parse(fileName);
-						
-						errorCount = parser->getErrorCount();
-					}
-					
-					catch (const XMLException& toCatch)
-					{
-						cerr << "\nAn error occurred\n  Error: "
-							<< StrX(toCatch.getMessage()) << endl;
-
-						iReturnValue = 7;
-					}
-					catch (...)
-					{	
-						cerr << endl << "General error occured." << endl;
-						iReturnValue = 8;
-					}
-				}
-				
-
-				delete handler;
-
-				delete[] pOutputFileName;
-
-				//
-				//  Delete the parser itself.  Must be done prior to calling Terminate, below.
-				//
-				delete parser;
-
-				if (errorCount != 0)
-					iReturnValue = 9;
-
-			}
-			// And call the termination method
-			XMLPlatformUtils::Terminate();
-			
-			
-			
-		}
-		
-	}
-	return iReturnValue;
-}
+    if (getArgs(argC, argV, theParams, &errorMessage) == false)
+    {
+        if ( errorMessage != 0)
+        {
+            cerr << errorMessage;
+        }
+
+        usage();
+
+        iReturnValue = 1;
+    }
+    else
+    {
+        try
+        {
+            XMLPlatformUtils::Initialize();
+        }
+        catch (const XMLException& toCatch)
+        {
+            cerr << "Error during initialization! : "
+                << StrX(toCatch.getMessage()) << endl;
+
+            iReturnValue = 2;
+        }
+
+        if (iReturnValue == 0)
+        {
+            
+            {   //  Create a SAX parser object. 
+                SAX2XMLReader* const    parser =
+                    XMLReaderFactory::createXMLReader();
+
+                parser->setFeature(XMLUni::fgSAX2CoreValidation, false);
+
+                parser->setFeature(XMLUni::fgXercesDynamic, true);
+
+                parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, false);
+
+                parser->setFeature(XMLUni::fgXercesSchema, true);
+
+                parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
+
+                parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
+                
+
+                //  Create the handler object and install it as the document and error
+                //  handler for the parser. Then parse the file and catch any exceptions
+                //  that propogate out
+                //
+                int errorCount = 0;
+
+                const char* const   fileName = theParams.inXMLFileName;
+
+                char    OutputFileName[s_max_path];
+                char    IndexFileName[s_max_path];
+
+                buildOutputFileName(theParams, OutputFileName);
+                buildIndexFileName(theParams, IndexFileName);
+
+                SAX2Handler* handler = 0;
+
+                try
+                {
+                    switch(theParams.enTypeOfLocaleMsg){
+                    case CmdLineParams::ICU_LOCALMSG:
+                        {
+                            handler = new ICUResHandler(OutputFileName, IndexFileName);
+                            break;
+                        }
+                    case CmdLineParams::INMEM_LOCALMSG:
+                        {
+                            handler = new InMemHandler(OutputFileName, IndexFileName);
+                            break;
+                        }
+                    case CmdLineParams::NLS_LOCALMSG:
+                        {
+                            handler = new NLSHandler(OutputFileName, IndexFileName);
+                            break;
+                        }
+                    default:
+                        {
+                            assert (0);
+                        }
+                    }
+                }
+                catch(const MsgFileOutputStream::OpenException&     e)
+                {
+                    cerr << "\nAn error occurred\n  Error: ";
+
+                    if (e.m_message != 0)
+                    {
+                        cerr << e.m_message <<  endl;
+                    }
+                    else
+                    {
+                        cerr << "unknown (XalanFileOutputStreamOpenException) "  << endl;
+                    }
+
+                    iReturnValue = 4;   
+                }
+                catch(const MsgFileOutputStream::WriteException&    e)
+                {
+                    cerr << "\nAn error occurred\n  Error: ";
+
+                    if (e.m_message != 0)
+                    {
+                        cerr << e.m_message << endl;
+                    }
+                    else
+                    {
+                        cerr << "unknown (MsgFileOutputStream::WriteException) " <<  endl;
+                    }
+
+                    iReturnValue = 5;   
+                }
+                catch (...)
+                {
+                    cerr << "Unknown error occured." << endl;
+
+                    iReturnValue = 6;
+                }
+
+                // run the parser
+                if (iReturnValue == 0)
+                {
+                    try
+                    {               
+                        handler->setLocale(theParams.localeName);
+
+                        parser->setContentHandler(handler);
+
+                        parser->setErrorHandler(handler);
+
+                        parser->parse(fileName);
+
+                        errorCount = parser->getErrorCount();
+                    }
+                    catch (const XMLException& toCatch)
+                    {
+                        cerr << "\nAn error occurred\n  Error: "
+                            << StrX(toCatch.getMessage()) << endl;
+
+                        iReturnValue = 7;
+                    }
+                    catch (...)
+                    {   
+                        cerr << endl << "General error occured." << endl;
+                        iReturnValue = 8;
+                    }
+                }
+
+                delete handler;
+
+                //
+                //  Delete the parser itself.  Must be done prior to calling Terminate, below.
+                //
+                delete parser;
+
+                if (errorCount != 0)
+                    iReturnValue = 9;
+            }
+
+            // And call the termination method
+            XMLPlatformUtils::Terminate();
+        }
+    }
 
+    return iReturnValue;
+}

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.hpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgCreator.hpp Wed Feb  8 09:15:09 2006
@@ -17,7 +17,7 @@
 #if !defined(MSG_CREATOR_1357924680)
 #define MSG_CREATOR_1357924680
 
-#include <xalanc/Include/PlatformDefinitions.hpp>
+#include "xalanc/Include/PlatformDefinitions.hpp"
 
 #include <xercesc/util/XMLString.hpp>
 

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp Wed Feb  8 09:15:09 2006
@@ -17,6 +17,7 @@
 #include "MsgFileOutputStream.hpp"
 
 #include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
 #include <xercesc/util/XMLString.hpp>
 
 #include <cassert>
@@ -24,223 +25,207 @@
 #include <cstdio>
 
 
-static  XalanFileOutputStream::HandleType
-openFile(const char*	theFileName)
+static  MsgFileOutputStream::HandleType
+openFile(const char*    theFileName)
 {
-	typedef XalanFileOutputStream::HandleType	HandleType;
+    assert(theFileName != 0);
 
-#if defined(WIN32)
-
-	
-			return CreateFile(
-					theFileName,
-					GENERIC_WRITE,
-					0,
-					0,
-					CREATE_ALWAYS,
-					FILE_ATTRIBUTE_NORMAL,
-					0);
-				
-				
-#else
-
-			return fopen(theFileName, "wb");
-
-#endif
+    return fopen(theFileName, "wb");
 }
 
 
 
-XalanFileOutputStream::XalanFileOutputStream(
-			const char*	theFileName) :
-			m_fileName(theFileName),
-			m_handle(openFile(theFileName))
+MsgFileOutputStream::MsgFileOutputStream(const char*    theFileName) :
+            m_fileName(theFileName),
+            m_handle(openFile(theFileName))
 {
-#if defined(WIN32)
-    if (m_handle == INVALID_HANDLE_VALUE)
-#else
     if (m_handle == 0)
-#endif
-	{
-		throw XalanFileOutputStreamOpenException(
-					theFileName,
-					errno);
-	}
+    {
+        throw OpenException(
+                    theFileName,
+                    errno);
+    }
 }
 
 
 
-XalanFileOutputStream::~XalanFileOutputStream()
+MsgFileOutputStream::~MsgFileOutputStream()
 {
-#if defined(WIN32)
-    if (m_handle != INVALID_HANDLE_VALUE)
-	{
-		CloseHandle(m_handle);
-	}
-#else
     if (m_handle != 0)
-	{
-		fclose(m_handle);
-	}
-#endif
+    {
+        fclose(m_handle);
+    }
 }
 
 
 
 void
-XalanFileOutputStream::doFlush()
+MsgFileOutputStream::doFlush()
 {
-#if !defined(WIN32)
-	if (fflush(m_handle) != 0)
-	{
-		throw XalanFileOutputStreamWriteException(
-			m_fileName,
-			errno);
-	}
-#endif
+    if (fflush(m_handle) != 0)
+    {
+        throw WriteException(
+                m_fileName,
+                errno);
+    }
 }
 
 
 
 void
-XalanFileOutputStream::writeData(
-			const char*		theBuffer,
-			unsigned int		theBufferLength)
-{
-#if defined(WIN32)
-	DWORD			theBytesWritten;
-
-	if (WriteFile(m_handle, theBuffer, DWORD(theBufferLength), &theBytesWritten, 0) == false ||
-	    theBytesWritten != theBufferLength)
-	{
-		throw XalanFileOutputStreamWriteException(
-			m_fileName,
-			GetLastError());
-	}
-#else
-	const size_t	theBytesWritten =
-		fwrite(theBuffer,
-			   1,
-			   theBufferLength,
-			   m_handle);
-
-	if (theBytesWritten != theBufferLength)
-	{
-		throw XalanFileOutputStreamWriteException(
-			m_fileName,
-			errno);
-	}
-#endif
+MsgFileOutputStream::writeData(
+            const char*     theBuffer,
+            unsigned int    theBufferLength)
+{
+    const size_t    theBytesWritten =
+        fwrite(theBuffer,
+               1,
+               theBufferLength,
+               m_handle);
+
+    if (theBytesWritten != theBufferLength)
+    {
+        throw WriteException(
+                m_fileName,
+                errno);
+    }
 }
 
 
 
-static char*
+void
 FormatMessageLocal(
-			const char*				theMessage,
-			const char*				theFileName,
-			int						theErrorCode)
+            const char*     theMessage,
+            const char*     theFileName,
+            int             theErrorCode,
+            char*           theResult)
 {
-	assert( theMessage != 0 );
+    assert(theMessage != 0);
+    assert(theFileName != 0);
+    assert(theResult != 0);
 
-	assert( theFileName != 0);
-
-	char*		strtoBuild = new char[256];
-	strtoBuild[0] = '\0';
+    sprintf(
+        theResult,
+        "%.100s %.1000s.  The C++ run-time error code (errno) is %d.",
+        theMessage,
+        theFileName,
+        theErrorCode);
+}
 
-	strncat(strtoBuild,theMessage, 100);
-	strtoBuild[100] = 0; // in case that lenght(theMessage) > 100 
 
-	strcat(strtoBuild,".  The C++ run-time error code (errno) is ");
 
-	char szNumb[20];
-	szNumb[0] = 0;
-	sprintf(szNumb,"%d",theErrorCode);
+MsgFileOutputStream::OpenException::OpenException(
+        const char*     theFileName,
+        int             theErrorCode) :
+    m_message()
+{
+    FormatMessageLocal(
+        "Error opening file: ",
+        theFileName,
+        theErrorCode,
+        m_message);    
+}
 
-	strncat(strtoBuild,szNumb,18);
 
-	strcat(strtoBuild,".");
 
-	return strtoBuild;
+MsgFileOutputStream::OpenException::~OpenException()
+{
 }
 
 
 
-XalanFileOutputStream::XalanFileOutputStreamOpenException::XalanFileOutputStreamOpenException(
-		const char*		theFileName,
-		int					theErrorCode) :
-		m_pMessage( FormatMessageLocal(
-				"Error opening file: ",
-				theFileName,
-				theErrorCode))
-			
+MsgFileOutputStream::WriteException::WriteException(
+        const char*     theFileName,
+        int             theErrorCode) :
+    m_message()
 {
+    FormatMessageLocal(
+        "Error writing file: ",
+        theFileName,
+        theErrorCode,
+        m_message);
 }
 
 
 
-XalanFileOutputStream::XalanFileOutputStreamOpenException::~XalanFileOutputStreamOpenException()
+MsgFileOutputStream::WriteException::~WriteException()
 {
-	delete [] m_pMessage;
 }
 
 
 
-XalanFileOutputStream::XalanFileOutputStreamWriteException::XalanFileOutputStreamWriteException(
-		const char*		theFileName,
-		int				theErrorCode) :
-		m_pMessage(FormatMessageLocal(
-					"Error writing file: ",
-					theFileName,
-					theErrorCode))
-{
+void
+MsgFileOutputStream::write(
+            const XMLCh*    theString,
+            unsigned int    theLength)
+{
+    assert(theString != 0);
+
+    writeData(
+        (const char*)theString,
+        theLength * sizeof(XMLCh));
 }
 
 
 
-XalanFileOutputStream::XalanFileOutputStreamWriteException::~XalanFileOutputStreamWriteException()
+void
+MsgFileOutputStream::write(
+            const char*     theString,
+            unsigned int    theLength)
 {
-	delete [] m_pMessage;
-}
+    assert (theString != 0);
 
+    XMLCh*  theUTFString =
+        XMLString::transcode(theString);
 
-void 	XalanFileOutputStream::write(const UTF16Ch*	theString, unsigned int		theLength)
-{
-	assert ( theString != 0 );
-	writeData((const char*)theString,theLength * sizeof(UTF16Ch) );
+    write(
+        theUTFString,
+        theLength);
+
+    XMLString::release(&theUTFString);
 }
 
-void 	XalanFileOutputStream::write(const char*	theString, unsigned int		theLength)
-{
-	assert ( theString != 0 );
 
-	UTF16Ch* theUTFString = XMLString::transcode(theString);
 
-	write(theUTFString,theLength);
+void
+MsgFileOutputStream::writeAsASCII(
+            const XMLCh*    theString,
+            unsigned int    theLength)
+{
+    char*   szString =
+        XMLString::transcode(theString);
+
+    writeData(
+        szString,
+        theLength);
 
-	XMLString::release(&theUTFString);
+    XMLString::release(&szString);
 }
 
-void XalanFileOutputStream::writeAsASCII(const UTF16Ch*	theString, unsigned int		theLengts)
-{
-	char* szString = XMLString::transcode(theString);
-	writeData( szString, theLengts );
-	XMLString::release(&szString);
 
-}
 
-void XalanFileOutputStream::writeAsASCII(const char*	theString, unsigned int		theLengts)
+void
+MsgFileOutputStream::writeAsASCII(
+            const char*     theString,
+            unsigned int    theLength)
 {
-	writeData( theString, theLengts );
+    writeData(
+        theString,
+        theLength);
 }
 
-const UTF16Ch	s_UTF16ByteOrderMark[] =
+
+
+static const XMLCh s_UTF16ByteOrderMark[] =
 {
-	UTF16Ch(0xFEFF),
-	UTF16Ch(0)
+    XMLCh(0xFEFF)
 };
 
-void 	XalanFileOutputStream::writeUTFprefix()
+
+void
+MsgFileOutputStream::writeUTFPrefix()
 {
-	write(s_UTF16ByteOrderMark,1);
+    write(
+        s_UTF16ByteOrderMark,
+        1);
 }

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.hpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.hpp Wed Feb  8 09:15:09 2006
@@ -16,19 +16,14 @@
 
 // This file is simplified version of XalanFileOutputStream.hpp / .cpp
 
-#if !defined(XALANOUTPUTFILE_1357924680)
-#define XALANOUTPUTFILE_1357924680
+#if !defined(MSGFILEOUTPUTSTREAM_1357924680)
+#define MSGFILEOUTPUTSTREAM_1357924680
 
-#include <xercesc/util/XMLUniDefs.hpp>
+#include "xalanc/Include/PlatformDefinitions.hpp"
 
 
-#if defined(WIN32)
-#include <windows.h>
-#else
-#include <cstdio>
-#endif
 
-#include <vector>
+#include <cstdio>
 
 
 
@@ -37,120 +32,121 @@
 
 
 
-// Class responcible for printing into file with UTF16
+// Class responsible for printing into file with UTF16
 
 
-class  XalanFileOutputStream 
+class  MsgFileOutputStream
 {
 public :
 
-#if defined(WIN32)
-	typedef HANDLE		HandleType;
-#else
 #if defined(XALAN_STRICT_ANSI_HEADERS)
-	typedef std::FILE*	HandleType;
+    typedef std::FILE*  HandleType;
 #else
-	typedef FILE*		HandleType;
-#endif
+    typedef FILE*       HandleType;
 #endif
 
-	/**
-	 * Construct an XalanFileOutputStream object.
-	 * 
-	 * @param theFileName name of file
-	 * @param theBufferSize The size of the transcoding buffer
-	 */
-    XalanFileOutputStream(
-			const char*	theFileName);
+    /**
+     * Construct an MsgFileOutputStream object.
+     * 
+     * @param theFileName name of file
+     * @param theBufferSize The size of the transcoding buffer
+     */
+    MsgFileOutputStream(const char*     theFileName);
 
     virtual
-	~XalanFileOutputStream();
+    ~MsgFileOutputStream();
+
+
+    class OpenException
+    {
+    public:
+
+        /**
+         * Construct an OpenException exception object for an exception
+         * that occurred when opening a file.
+         * 
+         * @param theFileName  The name of file.
+         * @param theErrorCode The errno for the error encountered
+         */
+        OpenException(
+            const char*     theFileName,
+            int             theErrorCode);
+
+        ~OpenException();
+
+        char    m_message[1200];
+    };
+
+    class WriteException
+    {
+    public:
+
+        /**
+         * Construct an WriteException exception object for an exception
+         * that occurred while writing to a file.
+         * 
+         * @param theFileName  The name of file.
+         * @param theErrorCode The errno for the error encountered
+         */
+        WriteException(
+                const char*     theFileName,
+                int             theErrorCode);
+
+        ~WriteException();
+
+        char    m_message[1200];
+    };
+
+    void
+    write(
+            const XMLCh*    theString,
+            unsigned int    theLength);
+
+    void 
+    write(
+            const char*     theString,
+            unsigned int    theLength);
+
+    void 
+    writeAsASCII(
+            const char*     theString,
+            unsigned int    theLength);
+
+    void
+    writeAsASCII(
+            const XMLCh*    theString,
+            unsigned int    theLength);
 
+    void
+    writeUTFPrefix();
 
-	class  XalanFileOutputStreamOpenException 
-	{
-	public:
-
-		/**
-		 * Construct an XalanFileOutputStreamOpen exception object for an exception
-		 * that occurred on opening a text file stream.
-		 * 
-		 * @param theFileName  name of file causing the exception
-		 * @param theErrorCode number of error encountered
-		 */
-		XalanFileOutputStreamOpenException(
-			const char*		theFileName,
-			int				theErrorCode);
-
-		virtual
-		~XalanFileOutputStreamOpenException();
-		
-		char*	m_pMessage;
-	};
-
-	class XalanFileOutputStreamWriteException 
-	{
-	public:
-
-		/**
-		 * Construct an XalanFileOutputStreamOpen exception object for an exception
-		 * that occurred while writing to a text file stream.
-		 * 
-		 * @param theFileName  name of file causing the exception
-		 * @param theErrorCode number of error encountered
-		 */
-		XalanFileOutputStreamWriteException(
-			const char*			theFileName,
-			int						theErrorCode);
-
-		virtual
-		~XalanFileOutputStreamWriteException();
-
-		char* m_pMessage;
-	};
-
-
-	void 
-	write(const UTF16Ch*	theString, unsigned int		theLength);
-	void 
-	write(const char*	theString, unsigned int		theLength);
-
-	void 
-	writeAsASCII(const char*	theString, unsigned int		theLengts);
-
-	void
-	writeAsASCII(const UTF16Ch*	theString, unsigned int		theLengts);
-	void
-	writeUTFprefix();
 protected:
 
-	void
-	writeData(
-			const char*		theBuffer,
-			unsigned int	theBufferLength);
+    void
+    writeData(
+            const char*     theBuffer,
+            unsigned int    theBufferLength);
 
-	void
-	doFlush();
+    void
+    doFlush();
 
 private:
 
     // These are not implemented...
-    XalanFileOutputStream(const XalanFileOutputStream&);
+    MsgFileOutputStream(const MsgFileOutputStream&);
 
-    XalanFileOutputStream&
-	operator=(const XalanFileOutputStream&);
+    MsgFileOutputStream&
+    operator=(const MsgFileOutputStream&);
 
     bool
-	operator==(const XalanFileOutputStream&) const;
+    operator==(const MsgFileOutputStream&) const;
 
 
-	// Data members...
-	const char*			m_fileName;
+    // Data members...
+    const char* const   m_fileName;
 
-	const HandleType	m_handle;
+    const HandleType    m_handle;
 };
 
 
-#endif //XALANOUTPUTFILE_1357924680
-
-
+#endif //   MSGFILEOUTPUTSTREAM_1357924680

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.cpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.cpp Wed Feb  8 09:15:09 2006
@@ -22,109 +22,141 @@
 
 #include <cstdio>
 
+
 // -----------------------------------------------------------------------
 //  Constructors
 // -----------------------------------------------------------------------
-NLSHandler::NLSHandler(const char* fileName, bool bCreateUnicode ):
-	ICUResHandler(fileName),
-	m_RunningNumber(2),
-	m_bCreateUnicode(bCreateUnicode)
+NLSHandler::NLSHandler(
+            const char*     fileName,
+            const char*     indexFileName,
+            bool            createUnicode ):
+    ICUResHandler(fileName, indexFileName),
+    m_runningNumber(2),
+    m_createUnicode(createUnicode)
 {
 }
 
-void NLSHandler::startDocument()
-{
-	if (m_bCreateUnicode)
-	{
-		ICUResHandler::startDocument();
-	}
-	else
-	{
-		createHeaderForDataFile ( );
-		
-		SAX2Handler::startDocument();
-	}
 
-}
 
-void NLSHandler::characters(	const   XMLCh* const    chars
-						, const unsigned int    length)
+void
+NLSHandler::startDocument()
 {
+    if (m_createUnicode)
+    {
+        ICUResHandler::startDocument();
+    }
+    else
+    {
+        createHeaderForDataFile();
+        
+        SAX2Handler::startDocument();
+    }
+}
+
 
-	if ( m_startCollectingCharacters == true )
-	{
-		if( m_bCreateUnicode)
-		{
-			m_fStream.write(chars,length);
-		}
-		else
-		{
-			m_fStream.writeAsASCII(chars,length);
-		}
-	}
+
+void
+NLSHandler::characters(
+            const XMLCh* const    chars,
+            const unsigned int    length)
+{
+    if (m_startCollectingCharacters == true)
+    {
+        if (m_createUnicode)
+        {
+            m_stream.write(chars, length);
+        }
+        else
+        {
+            m_stream.writeAsASCII(chars, length);
+        }
+    }
 }
 
-void NLSHandler::createHeaderForDataFile ()
+
+
+void
+NLSHandler::createHeaderForDataFile()
 {
-	if (m_bCreateUnicode )
-	{
-		printToDataFile( szApacheLicense );
-		printToDataFile( szStartDataFile );
-	}
-	else
-	{
-		printToDataFileasASCII( szApacheLicense );
-		printToDataFileasASCII( szStartDataFile );
-	}
+    if (m_createUnicode)
+    {
+        printToDataFile(szApacheLicense);
+        printToDataFile(szStartDataFile);
+    }
+    else
+    {
+        printToDataFileAsASCII(szApacheLicense);
+        printToDataFileAsASCII(szStartDataFile);
+    }
 
 }
 
-void NLSHandler::printToDataFileasASCII( const char* sArrayOfStrins[] )
-{
-	if ( sArrayOfStrins == NULL)
-		return;
 
-	for (int i = 0; sArrayOfStrins[i] != NULL; i++)
-	{
-		m_fStream.writeAsASCII(sArrayOfStrins[i],strlen(sArrayOfStrins[i]));
-	}
+
+void
+NLSHandler::printToDataFileAsASCII(const char*  sArrayOfStrings[])
+{
+    if (sArrayOfStrings != 0)
+    {
+        for (unsigned int i = 0; sArrayOfStrings[i] != 0; ++i)
+        {
+            m_stream.writeAsASCII(
+                sArrayOfStrings[i],
+                XMLString::stringLen(sArrayOfStrings[i]));
+        }
+    }
 }
 
-void NLSHandler::printBeginOfDataLine ()
+
+
+void
+NLSHandler::printBeginOfDataLine()
 {
-	char szNumb[20];
+    char szNumb[20];
 
-	sprintf(szNumb,"%d ^", m_RunningNumber);
+    sprintf(
+        szNumb,
+        "%d ^",
+        m_runningNumber);
 
-	m_RunningNumber++;
+    ++m_runningNumber;
 
-	if ( m_bCreateUnicode )
-	{
-		m_fStream.write(szNumb,strlen(szNumb));
-	}
-	else
-	{
-		m_fStream.writeAsASCII(szNumb,strlen(szNumb));
-	}
+    if (m_createUnicode)
+    {
+        m_stream.write(
+            szNumb,
+            XMLString::stringLen(szNumb));
+    }
+    else
+    {
+        m_stream.writeAsASCII(
+            szNumb,
+            XMLString::stringLen(szNumb));
+    }
 }
 
 
 
-void NLSHandler::createBottomForDataFile ()
+void
+NLSHandler::createBottomForDataFile()
 {
-
-
 }
 
 
-void NLSHandler::printEndOfDataLine ()
+
+void
+NLSHandler::printEndOfDataLine()
 {
-	if ( m_bCreateUnicode )
-	{
-		m_fStream.write("^\n",2);
-	}
-	else
-	{
-		m_fStream.writeAsASCII("^\n",2);
-	}
+    if (m_createUnicode)
+    {
+        m_stream.write(
+            "^\n",
+            2);
+    }
+    else
+    {
+        m_stream.writeAsASCII(
+            "^\n",
+            2);
+    }
 }

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.hpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/NLSHandler.hpp Wed Feb  8 09:15:09 2006
@@ -17,6 +17,8 @@
 #if !defined(NLSHANDLER_MSGCREATOR_1357924680)
 #define NLSHANDLER_MSGCREATOR_1357924680
 
+#include "xalanc/Include/PlatformDefinitions.hpp"
+
 #include "ICUResHandler.hpp"
 
 
@@ -25,53 +27,58 @@
 class NLSHandler : public ICUResHandler 
 {
 public:
-	NLSHandler(const char* fileName, bool bCreateUnicode = false);
 
-	virtual 
-	~NLSHandler(){}
+    NLSHandler(
+            const char*     fileName,
+            const char*     indexFileName,
+            bool            createUnicode = false);
+
+    virtual 
+    ~NLSHandler(){}
+
+    virtual void 
+    createHeaderForDataFile();
+
+    virtual void 
+    createBottomForDataFile();
+
+    virtual void 
+    printBeginOfDataLine();
+
+    virtual void 
+    printEndOfDataLine();
 
-	virtual void 
-	createHeaderForDataFile ();
-	
-	virtual void 
-	createBottomForDataFile ();
-
-	virtual void 
-	printBeginOfDataLine ();
-	
-	virtual void 
-	printEndOfDataLine ();
-
-	void 
-	characters(	const   XMLCh* const    chars
-						, const unsigned int    length);
-	void 
-	startDocument();
+    void 
+    characters(
+            const XMLCh* const    chars,
+            const unsigned int    length);
+
+    void 
+    startDocument();
 
 protected:
 
-	// ASCII version of print
-	void 
-	printToDataFileasASCII( const char* sArrayOfStrins[] );
+    // ASCII version of print
+    void 
+    printToDataFileAsASCII(const char*  sArrayOfStrings[]);
 
 private:
-	int m_RunningNumber;
-	
-	bool m_bCreateUnicode;
-
-	// Not implemented...
-	NLSHandler&
-	operator=(const NLSHandler&);
 
-	NLSHandler(const NLSHandler&);
+    int         m_runningNumber;
 
-	bool
-	operator==(const NLSHandler&) const;
-};
+    const bool  m_createUnicode;
 
 
+    // Not implemented...
+    NLSHandler&
+    operator=(const NLSHandler&);
 
+    NLSHandler(const NLSHandler&);
+
+    bool
+    operator==(const NLSHandler&) const;
+};
 
-#endif  //NLSHANDLER_MSGCREATOR_1357924680
 
 
+#endif  //NLSHANDLER_MSGCREATOR_1357924680

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp Wed Feb  8 09:15:09 2006
@@ -18,119 +18,138 @@
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
+#include "SAX2Handler.hpp"
+
 #include <cassert>
 #include <cstdio>
 
 #include <xercesc/sax2/Attributes.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
 
-#include "ICUResHandler.hpp"
 #include "IndexFileData.hpp"
 #include "MsgCreator.hpp"
 
 
 
-static const char* INDEX_FILE_NAME="LocalMsgIndex.hpp";
-
-
-
 // ---------------------------------------------------------------------------
 //  SAX2Handler: Constructors and Destructor
 // ---------------------------------------------------------------------------
-SAX2Handler::SAX2Handler( ) :
-							m_numberOfRecords(0),
-							m_locale(0),
-							m_startCollectingCharacters(false),
-							m_fIndexOutputStream(INDEX_FILE_NAME)
+SAX2Handler::SAX2Handler(const char*     indexFileName) :
+    m_numberOfRecords(0),
+    m_locale(0),
+    m_startCollectingCharacters(false),
+    m_indexOutputStream(indexFileName)
 {
-
 }
 
+
+
 SAX2Handler::~SAX2Handler()
 {
-	if (m_locale != 0)
-	{
-		XMLString::release(&m_locale);
-	}
+    if (m_locale != 0)
+    {
+        XMLString::release(&m_locale);
+    }
 }
 
-void SAX2Handler::createHeaderForIndexFile ()
+
+
+void
+SAX2Handler::createHeaderForIndexFile()
 {
-	printToIndexFile( szApacheLicense );
-	
-	printToIndexFile ( szStartIndexFile );
+    printToIndexFile(szApacheLicense);
+
+    printToIndexFile(szStartIndexFile);
 }
 
-void SAX2Handler::printBeginOfIndexLine ()
+
+
+void
+SAX2Handler::printBeginOfIndexLine()
 {
-	printToIndexFile ( szBeginIndexLine );
+    printToIndexFile(szBeginIndexLine);
 }
 
-	
-void SAX2Handler::printEndOfIndexLine ()
+
+void
+SAX2Handler::printEndOfIndexLine()
 {
 }
 
 
 
-void SAX2Handler::createBottomForIndexFile ()
+void
+SAX2Handler::createBottomForIndexFile()
 {
-	printToIndexFile ( szEndIndexFile );
+    printToIndexFile(szEndIndexFile);
 }
 
 
-void SAX2Handler::printToIndexFile( const char* sArrayOfStrins[] )
-{
-	if ( sArrayOfStrins == NULL)
-		return;
 
-	for (int i = 0; sArrayOfStrins[i] != NULL; i++)
-	{
-		m_fIndexOutputStream.writeAsASCII(sArrayOfStrins[i],XMLString::stringLen(sArrayOfStrins[i]));
-	}
+void
+SAX2Handler::printToIndexFile(const char*   sArrayOfStrings[])
+{
+    if (sArrayOfStrings != 0)
+    {
+        for (unsigned int i = 0; sArrayOfStrings[i] != 0; ++i)
+        {
+            m_indexOutputStream.writeAsASCII(
+                sArrayOfStrings[i],
+                XMLString::stringLen(sArrayOfStrings[i]));
+        }
+    }
 }
 
 
 
-void SAX2Handler::startElement(const   XMLCh* const    ,
-									const   XMLCh* const    localname,
-									const   XMLCh* const    ,
-                                    const   Attributes&		attributes)
+void
+SAX2Handler::startElement(
+            const   XMLCh* const,
+            const   XMLCh* const    localname,
+            const   XMLCh* const,
+            const   Attributes&     attributes)
 {
-	if(!XMLString::compareString(localname,s_transUnitXMLCh))
-	{
-		unsigned int len = attributes.getLength();
-		
-		++m_numberOfRecords;
-		
-		for (unsigned int index = 0; index < len; index++)
-		{
-			const XMLCh* name = attributes.getQName(index) ;
-			
-			if (name != NULL && !XMLString::compareString(name,s_idXMLCh)	)
-			{
-				const XMLCh* val = attributes.getValue(index);
-				if ( val != NULL )
-				{
-					if ( m_numberOfRecords != 1)
-						printBeginOfIndexLine();
-										
-					m_fIndexOutputStream.writeAsASCII(val,XMLString::stringLen(val));
-					
-					char buff[100];
-					
-					sprintf( buff, "		 = %d \n",(m_numberOfRecords - 1));
-					
-					m_fIndexOutputStream.writeAsASCII(buff,XMLString::stringLen(buff));
-					
-					printEndOfIndexLine ();
-				}
-			}
-			
-			
-		}
-		
-	}
+    if(!XMLString::compareString(localname, s_transUnitXMLCh))
+    {
+        const unsigned int  len =
+            attributes.getLength();
+
+        ++m_numberOfRecords;
+
+        for (unsigned int index = 0; index < len; index++)
+        {
+            const XMLCh* const  name =
+                attributes.getQName(index);
+            assert(name != 0);
+
+            if (!XMLString::compareString(name, s_idXMLCh))
+            {
+                const XMLCh* const  val =
+                    attributes.getValue(index);
+                assert(val != 0);
+
+                if ( m_numberOfRecords !=  1)
+                    printBeginOfIndexLine();
+
+                m_indexOutputStream.writeAsASCII(
+                    val,
+                    XMLString::stringLen(val));
+
+                char buff[100];
+
+                sprintf(
+                    buff,
+                    "\t\t = %d \n",
+                    m_numberOfRecords - 1);
+
+                m_indexOutputStream.writeAsASCII(
+                    buff,
+                    XMLString::stringLen(buff));
+
+                printEndOfIndexLine();
+            }
+        }
+    }
 }
 
 
@@ -141,54 +160,68 @@
 // ---------------------------------------------------------------------------
 //  
 // ---------------------------------------------------------------------------
-void SAX2Handler::error(const SAXParseException& e)
+void
+SAX2Handler::error(const SAXParseException&     e)
 {
     cerr << "\nError at file " << StrX(e.getSystemId())
-		 << ", line " << e.getLineNumber()
-		 << ", char " << e.getColumnNumber()
+         << ", line " << e.getLineNumber()
+         << ", char " << e.getColumnNumber()
          << "\n  Message: " << StrX(e.getMessage()) << endl;
+
+    throw e;
 }
 
-void SAX2Handler::fatalError(const SAXParseException& e)
+
+
+void
+SAX2Handler::fatalError(const SAXParseException&    e)
 {
     cerr << "\nFatal Error at file " << StrX(e.getSystemId())
-		 << ", line " << e.getLineNumber()
-		 << ", char " << e.getColumnNumber()
+         << ", line " << e.getLineNumber()
+         << ", char " << e.getColumnNumber()
          << "\n  Message: " << StrX(e.getMessage()) << endl;
+
+    throw e;
 }
 
-void SAX2Handler::warning(const SAXParseException& e)
+
+
+void
+SAX2Handler::warning(const SAXParseException&   e)
 {
     cerr << "\nWarning at file " << StrX(e.getSystemId())
-		 << ", line " << e.getLineNumber()
-		 << ", char " << e.getColumnNumber()
+         << ", line " << e.getLineNumber()
+         << ", char " << e.getColumnNumber()
          << "\n  Message: " << StrX(e.getMessage()) << endl;
 }
 
 
-void SAX2Handler::setLocale( const char* localName)
+
+void
+SAX2Handler::setLocale(const char*  localName)
 {
-	assert(localName != 0);
+    assert(localName != 0);
 
-	if (m_locale != 0)
-	{
-		XMLString::release(&m_locale);
-	}
+    if (m_locale != 0)
+    {
+        XMLString::release(&m_locale);
+    }
 
-	m_locale = XMLString::transcode(localName);
+    m_locale = XMLString::transcode(localName);
 }
 
 
-void SAX2Handler::startDocument()
+
+void
+SAX2Handler::startDocument()
 {
-	createHeaderForIndexFile ( );
+    createHeaderForIndexFile();
 }
 
 
 
-void SAX2Handler::endDocument()
+void
+SAX2Handler::endDocument()
 {
-	createBottomForIndexFile ( );
+    createBottomForIndexFile();
 }
-
-

Modified: xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp (original)
+++ xalan/c/trunk/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp Wed Feb  8 09:15:09 2006
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#if !defined(SAX2HANDLER_MSGCREATOR_1357924680)
-#define SAX2HANDLER_MSGCREATOR_1357924680
+#if !defined(SAX2HANDLER_1357924680)
+#define SAX2HANDLER_1357924680
 
 #include "MsgFileOutputStream.hpp"
 
@@ -29,76 +29,76 @@
 
 static const XMLCh s_transUnitXMLCh[] = 
 { 
-	chLatin_t, 
-	chLatin_r,
-	chLatin_a,	
-	chLatin_n, 
-	chLatin_s, 
-	chDash, 
-	chLatin_u, 
-	chLatin_n,
-	chLatin_i, 
-	chLatin_t,
+    chLatin_t, 
+    chLatin_r,
+    chLatin_a,  
+    chLatin_n, 
+    chLatin_s, 
+    chDash, 
+    chLatin_u, 
+    chLatin_n,
+    chLatin_i, 
+    chLatin_t,
 
-	chNull
+    chNull
 };
 
 
 static const XMLCh s_sourceXMLCh[] = 
 { 
-	chLatin_s, 
-	chLatin_o,
-	chLatin_u,	
-	chLatin_r, 
-	chLatin_c, 
-	chLatin_e, 
+    chLatin_s, 
+    chLatin_o,
+    chLatin_u,  
+    chLatin_r, 
+    chLatin_c, 
+    chLatin_e, 
 
-	chNull
+    chNull
 };
 
 
 static const XMLCh s_targetXMLCh[] = 
 { 
-	chLatin_t, 
-	chLatin_a,
-	chLatin_r,	
-	chLatin_g, 
-	chLatin_e, 
-	chLatin_t, 
+    chLatin_t, 
+    chLatin_a,
+    chLatin_r,  
+    chLatin_g, 
+    chLatin_e, 
+    chLatin_t, 
 
-	chNull
+    chNull
 };
 
 
 static const XMLCh s_xmlLangXMLCh[] = 
 { 
-	chLatin_x, 
-	chLatin_m,
-	chLatin_l,	
-	chColon, 
-	chLatin_l, 
-	chLatin_a, 
-	chLatin_n, 
-	chLatin_g,
-	chNull
+    chLatin_x, 
+    chLatin_m,
+    chLatin_l,  
+    chColon, 
+    chLatin_l, 
+    chLatin_a, 
+    chLatin_n, 
+    chLatin_g,
+    chNull
 };
 
 
 
 static const XMLCh s_idXMLCh[] =
 {
-	chLatin_i,
-	chLatin_d,
-	chNull
+    chLatin_i,
+    chLatin_d,
+    chNull
 };
 
 static const XMLCh s_textXMLCh[] = 
 { 
-	chLatin_T, 
-	chLatin_e, 
-	chLatin_x, 
-	chLatin_t, 
-	chNull
+    chLatin_T, 
+    chLatin_e, 
+    chLatin_x, 
+    chLatin_t, 
+    chNull
 };
 
 
@@ -112,83 +112,93 @@
     // -----------------------------------------------------------------------
     //  Constructors
     // -----------------------------------------------------------------------
-    SAX2Handler();
+    SAX2Handler(const char*     indexFileName);
     virtual ~SAX2Handler();
 
 public:
     virtual void 
     startElement(const   XMLCh* const    ,
-									const   XMLCh* const    localname,
-									const   XMLCh* const    ,
-                                    const   Attributes&		attributes);
+                                    const   XMLCh* const    localname,
+                                    const   XMLCh* const    ,
+                                    const   Attributes&     attributes);
 
-	virtual void 
-	startDocument();
+    virtual void 
+    startDocument();
 
-	virtual void 
-	endDocument();
+    virtual void 
+    endDocument();
 
    // -----------------------------------------------------------------------
     //  Implementations of the SAX ErrorHandler interface
     // -----------------------------------------------------------------------
-	virtual void 
-	error(const SAXParseException& e); 
-	
-	virtual void 
-	fatalError(const SAXParseException& e);
-	
-	virtual void 
-	warning(const SAXParseException& e);
-
-	void 
-	setLocale( const char* localeName);
-
-	const XMLCh*
-	getLocale () const
-	{
-		return m_locale;
-	}
+    virtual void 
+    error(const SAXParseException& e); 
+    
+    virtual void 
+    fatalError(const SAXParseException& e);
+    
+    virtual void 
+    warning(const SAXParseException& e);
+
+    void 
+    setLocale(const char*   localeName);
+
+    const XMLCh*
+    getLocale () const
+    {
+        return m_locale;
+    }
 
 protected:
-	bool translateCharToXMLByteArr ( XMLByte* buffer, int iBufLen, const char* szSource)const;
 
-	virtual void 
-	createHeaderForDataFile ()=0;
-	
-	virtual void 
-	createBottomForDataFile ()=0;
-
-	virtual void 
-	printBeginOfDataLine ()=0;
-	
-	virtual void 
-	printEndOfDataLine ()=0;
-
-	virtual void 
-	printToDataFile( const char* sArrayOfStrins[] ) = 0;
-	
-	void 
-	printToIndexFile( const char* sArrayOfStrins[] );
+    bool
+    translateCharToXMLByteArray(
+        XMLByte*        buffer,
+        int             iBufLen,
+        const char*     szSource) const;
+
+    virtual void
+    createHeaderForDataFile() = 0;
+
+    virtual void
+    createBottomForDataFile() = 0;
 
-	void 
-	printNumbOfRecords ();
+    virtual void
+    printBeginOfDataLine() = 0;
 
+    virtual void
+    printEndOfDataLine() = 0;
 
+    virtual void
+    printToDataFile(const char*     sArrayOfStrings[]) = 0;
+
+    void
+    printToIndexFile(const char*    sArrayOfStrings[]);
+
+    void
+    printNumbOfRecords();
 
 private:
 
-	void createHeaderForIndexFile ();
-	void createBottomForIndexFile ();
+    void
+    createHeaderForIndexFile();
+
+    void
+    createBottomForIndexFile();
+
+    void
+    printBeginOfIndexLine();
 
-	void printBeginOfIndexLine ();
-	void printEndOfIndexLine ();
+    void
+    printEndOfIndexLine();
 
-protected :
-	int	m_numberOfRecords;
+protected:
+
+    int     m_numberOfRecords;
 
-	XMLCh* m_locale;
+    XMLCh*  m_locale;
 
-	bool m_startCollectingCharacters;
+    bool    m_startCollectingCharacters;
 
     // -----------------------------------------------------------------------
     //  SAX2 Handler is responsible for creating index file, so keep
@@ -196,20 +206,18 @@
     // -----------------------------------------------------------------------
 
 private:
-	XalanFileOutputStream    m_fIndexOutputStream;
 
-	// Not implemented...
-	SAX2Handler&
-	operator=(const SAX2Handler&);
+    MsgFileOutputStream     m_indexOutputStream;
 
-	SAX2Handler(const SAX2Handler&);
+    // Not implemented...
+    SAX2Handler&
+    operator=(const SAX2Handler&);
 
-	bool
-	operator==(const SAX2Handler&) const;
+    SAX2Handler(const SAX2Handler&);
 
+    bool
+    operator==(const SAX2Handler&) const;
 };
 
 
-#endif //SAX2HANDLER_MSGCREATOR_1357924680
-
-
+#endif //SAX2HANDLER_1357924680

Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp Wed Feb  8 09:15:09 2006
@@ -86,32 +86,72 @@
     StylesheetConstructionContext(theManager),
     m_processor(processor),
     m_xpathFactory(xpathFactory),
-    m_xpathProcessor(theManager, XPathProcessorImpl::create(theManager)),
+    m_xpathProcessor(
+        theManager,
+        XPathProcessorImpl::create(theManager)),
     m_stylesheets(theManager),
     m_stringPool(theManager),
-    m_xalanDOMCharVectorAllocator(theManager, theXalanDOMCharVectorAllocatorBlockSize),
+    m_xalanDOMCharVectorAllocator(
+        theManager,
+        theXalanDOMCharVectorAllocatorBlockSize),
     m_tempBuffer(theManager),
     m_scratchQName(theManager),
     m_stringCache(theManager),
-    m_avtAllocator(theManager, theAVTAllocatorBlockSize),
-    m_avtPartSimpleAllocator(theManager, theAVTPartSimpleAllocatorBlockSize),
-    m_avtPartXPathAllocator(theManager, theAVTPartXPathAllocatorBlockSize),
-    m_xalanQNameByValueAllocator(theManager, theXalanQNameByValueAllocatorBlockSize),
-    m_useAttributeSetsQName(XSLTEngineImpl::getXSLNameSpaceURL(), Constants::ATTRNAME_USEATTRIBUTESETS),
-    m_pointerVectorAllocator(theManager, thePointerVectorAllocatorBlockSize),
+    m_avtAllocator(
+        theManager,
+        theAVTAllocatorBlockSize),
+    m_avtPartSimpleAllocator(
+        theManager,
+        theAVTPartSimpleAllocatorBlockSize),
+    m_avtPartXPathAllocator(
+        theManager,
+        theAVTPartXPathAllocatorBlockSize),
+    m_xalanQNameByValueAllocator(
+        theManager,
+        theXalanQNameByValueAllocatorBlockSize),
+    m_useAttributeSetsQName(
+        XSLTEngineImpl::getXSLNameSpaceURL(),
+        Constants::ATTRNAME_USEATTRIBUTESETS),
+    m_pointerVectorAllocator(
+        theManager,
+        thePointerVectorAllocatorBlockSize),
     m_allocatedElements(theManager),
-    m_elemApplyTemplatesAllocator(theManager, eDefaultElemApplyTemplatesBlockSize),
-    m_elemAttributeAllocator(theManager, eDefaultElemAttributeBlockSize),
-    m_elemAttributeSetAllocator(theManager, eDefaultElemAttributeSetBlockSize),
-    m_elemCallTemplateAllocator(theManager, eDefaultElemCallTemplateBlockSize),
-    m_elemElementAllocator(theManager, eDefaultElemElementBlockSize),
-    m_elemLiteralResultAllocator(theManager, eDefaultElemLiteralResultBlockSize),
-    m_elemTemplateAllocator(theManager, eDefaultElemTemplateBlockSize),
-    m_elemTextLiteralAllocator(theManager, eDefaultElemTextLiteralBlockSize),
-    m_elemValueOfAllocator(theManager, eDefaultElemValueOfBlockSize),
-    m_elemVariableAllocator(theManager, eDefaultElemVariableBlockSize),
-    m_matchPatternDataAllocator(theManager,eDefaultMatchPatternDataBlockSize),
-    m_spaceAttrQName(DOMServices::s_XMLNamespaceURI, Constants::ATTRNAME_SPACE)
+    m_elemApplyTemplatesAllocator(
+        theManager,
+        eDefaultElemApplyTemplatesBlockSize),
+    m_elemAttributeAllocator(
+        theManager,
+        eDefaultElemAttributeBlockSize),
+    m_elemAttributeSetAllocator(
+        theManager,
+        eDefaultElemAttributeSetBlockSize),
+    m_elemCallTemplateAllocator(
+        theManager,
+        eDefaultElemCallTemplateBlockSize),
+    m_elemElementAllocator(
+        theManager,
+        eDefaultElemElementBlockSize),
+    m_elemLiteralResultAllocator(
+        theManager,
+        eDefaultElemLiteralResultBlockSize),
+    m_elemTemplateAllocator(
+        theManager,
+        eDefaultElemTemplateBlockSize),
+    m_elemTextLiteralAllocator(
+        theManager,
+        eDefaultElemTextLiteralBlockSize),
+    m_elemValueOfAllocator(
+        theManager,
+        eDefaultElemValueOfBlockSize),
+    m_elemVariableAllocator(
+        theManager,
+        eDefaultElemVariableBlockSize),
+    m_matchPatternDataAllocator(
+        theManager,
+        eDefaultMatchPatternDataBlockSize),
+    m_spaceAttrQName(
+        DOMServices::s_XMLNamespaceURI,
+        Constants::ATTRNAME_SPACE)
 {
 }
 
@@ -218,14 +258,14 @@
     for_each(
             m_stylesheets.begin(),
             m_stylesheets.end(),
-            DeleteFunctor<StylesheetRoot>( getMemoryManager()));
+            DeleteFunctor<StylesheetRoot>(getMemoryManager()));
 
     m_stylesheets.clear();
 
     for_each(
             m_allocatedElements.begin(),
             m_allocatedElements.end(),
-            DeleteFunctor<ElemTemplateElement>( getMemoryManager()));
+            DeleteFunctor<ElemTemplateElement>(getMemoryManager()));
 
     m_allocatedElements.clear();
 
@@ -276,7 +316,10 @@
     m_stylesheets.reserve(m_stylesheets.size() + 1);
 
     StylesheetRoot* const   theStylesheetRoot =
-        StylesheetRoot::create( getMemoryManager(), theBaseIdentifier, *this);
+        StylesheetRoot::create(
+            getMemoryManager(),
+            theBaseIdentifier,
+            *this);
 
     m_stylesheets.push_back(theStylesheetRoot);
 
@@ -352,7 +395,9 @@
 StylesheetConstructionContextDefault::URLAutoPtrType
 StylesheetConstructionContextDefault::getURLFromString(const XalanDOMString&    urlString)
 {
-    return URISupport::getURLFromString(urlString,  getMemoryManager());
+    return URISupport::getURLFromString(
+                urlString,
+                getMemoryManager());
 }
 
 
@@ -361,7 +406,9 @@
 StylesheetConstructionContextDefault::getURLStringFromString(const XalanDOMString&  urlString,
                                                              XalanDOMString&        theResult)
 {
-    URISupport::getURLStringFromString(urlString, theResult);
+    URISupport::getURLStringFromString(
+            urlString,
+            theResult);
 
     return theResult;
 }
@@ -373,7 +420,10 @@
             const XalanDOMString&   urlString,
             const XalanDOMString&   base)
 {
-    return URISupport::getURLFromString(urlString, base,  getMemoryManager());
+    return URISupport::getURLFromString(
+                urlString,
+                base,
+                getMemoryManager());
 }
 
 
@@ -384,7 +434,10 @@
             const XalanDOMString&   base,
             XalanDOMString&         theResult)
 {
-    URISupport::getURLStringFromString(urlString, base, theResult);
+    URISupport::getURLStringFromString(
+            urlString,
+            base,
+            theResult);
 
     return theResult;
 }
@@ -570,7 +623,10 @@
             DocumentHandlerType*    docHandler,
             XalanDocument*          docToRegister)
 {
-    return m_processor.parseXML(urlString, docHandler, docToRegister);
+    return m_processor.parseXML(
+                urlString,
+                docHandler,
+                docToRegister);
 }
 
 
@@ -583,7 +639,11 @@
 {
     assert(theAttributeName != 0);
 
-    m_scratchQName.set(theAttributeName, theStylesheet.getNamespaces(), theLocator, true);
+    m_scratchQName.set(
+        theAttributeName,
+        theStylesheet.getNamespaces(),
+        theLocator,
+        true);
 
     return m_spaceAttrQName == m_scratchQName;
 }
@@ -598,7 +658,11 @@
 {
     assert(theAttributeName != 0);
 
-    m_scratchQName.set(theAttributeName, theStylesheet.getNamespaces(), theLocator, true);
+    m_scratchQName.set(
+        theAttributeName,
+        theStylesheet.getNamespaces(),
+        theLocator,
+        true);
 
     return m_useAttributeSetsQName == m_scratchQName;
 }
@@ -613,7 +677,11 @@
 {
     assert(theName != 0);
 
-    m_scratchQName.set(theName, theStylesheet.getNamespaces(), theLocator, false);
+    m_scratchQName.set(
+        theName,
+        theStylesheet.getNamespaces(),
+        theLocator,
+        false);
 
     return m_scratchQName.isValid();
 }
@@ -656,8 +724,11 @@
             const AttributeListType&    atts,
             const LocatorType*          locator)
 {
-    const XalanLocator::size_type   lineNumber = XalanLocator::getLineNumber(locator);
-    const XalanLocator::size_type   columnNumber = XalanLocator::getColumnNumber(locator);
+    const XalanLocator::size_type   lineNumber =
+        XalanLocator::getLineNumber(locator);
+
+    const XalanLocator::size_type   columnNumber =
+        XalanLocator::getColumnNumber(locator);
 
     ElemTemplateElement*    theElement = 0;
 
@@ -975,8 +1046,11 @@
             const AttributeListType&    atts,
             const LocatorType*          locator)
 {
-    const XalanLocator::size_type   lineNumber = XalanLocator::getLineNumber(locator);
-    const XalanLocator::size_type   columnNumber = XalanLocator::getColumnNumber(locator);
+    const XalanLocator::size_type   lineNumber =
+        XalanLocator::getLineNumber(locator);
+
+    const XalanLocator::size_type   columnNumber =
+        XalanLocator::getColumnNumber(locator);
 
     ElemTemplateElement*    theElement = 0;
 
@@ -1007,14 +1081,16 @@
     }
     else
     {
-        GetAndReleaseCachedString theGuard(*this);
-        GetAndReleaseCachedString theGuard1(*this);
+        const GetAndReleaseCachedString     theGuard1(*this);
+        const GetAndReleaseCachedString     theGuard2(*this);
 
         error(
             XalanMessageLoader::getMessage(
-                theGuard.get(),
+                theGuard1.get(),
                 XalanMessages::UnknownXSLTToken_1Param,
-                LongToDOMString(token, theGuard1.get())),
+                LongToDOMString(
+                    token,
+                    theGuard2.get())),
             0,
             locator);
     }
@@ -1032,8 +1108,11 @@
             ExtensionNSHandler&         handler,
             const LocatorType*          locator)
 {
-    const XalanLocator::size_type   lineNumber = XalanLocator::getLineNumber(locator);
-    const XalanLocator::size_type   columnNumber = XalanLocator::getColumnNumber(locator);
+    const XalanLocator::size_type   lineNumber =
+        XalanLocator::getLineNumber(locator);
+
+    const XalanLocator::size_type   columnNumber =
+        XalanLocator::getColumnNumber(locator);
 
     m_allocatedElements.push_back(0);
 
@@ -1061,8 +1140,11 @@
             bool                        disableOutputEscaping,
             const LocatorType*          locator)
 {
-    const XalanLocator::size_type   lineNumber = XalanLocator::getLineNumber(locator);
-    const XalanLocator::size_type   columnNumber = XalanLocator::getColumnNumber(locator);
+    const XalanLocator::size_type   lineNumber =
+        XalanLocator::getLineNumber(locator);
+
+    const XalanLocator::size_type   columnNumber =
+        XalanLocator::getColumnNumber(locator);
 
     return m_elemTextLiteralAllocator.create(
             *this,
@@ -1118,7 +1200,8 @@
         const ElementTokenTableEntry* const 
             theCurrent = theFirst + (theLast - theFirst) / 2;
 
-        const int   theResult = compareIgnoreCaseASCII(name, theCurrent->m_name);
+        const int   theResult =
+            compareIgnoreCaseASCII(name, theCurrent->m_name);
 
         if (theResult < 0)
         {
@@ -1198,13 +1281,19 @@
     assert(theString != 0);
 
     const XalanDOMString::size_type     theActualLength =
-        theLength == XalanDOMString::npos ? XalanDOMString::length(theString) : theLength;
+        theLength == XalanDOMString::npos ?
+            XalanDOMString::length(theString) :
+            theLength;
 
     XalanDOMChar*   theVector =
-        m_xalanDOMCharVectorAllocator.allocate(fTerminate == true ? theActualLength + 1 : theActualLength);
+        m_xalanDOMCharVectorAllocator.allocate(
+            fTerminate == true ? theActualLength + 1 : theActualLength);
 
     XalanDOMChar* const     theEnd =
-        XalanCopy(theString, theString + theActualLength, theVector);
+        XalanCopy(
+            theString,
+            theString + theActualLength,
+            theVector);
 
     if (fTerminate == true)
     {
@@ -1223,7 +1312,12 @@
             const XalanDOMChar*             stringedValue,
             const PrefixResolver&           resolver)
 {
-    return m_avtAllocator.create(*this, locator, name, stringedValue, resolver);
+    return m_avtAllocator.create(
+                *this,
+                locator,
+                name,
+                stringedValue,
+                resolver);
 }
 
 
@@ -1233,7 +1327,10 @@
             const XalanDOMChar*         theString,
             XalanDOMString::size_type   theLength)
 {
-    return m_avtPartSimpleAllocator.create(*this, theString, theLength);
+    return m_avtPartSimpleAllocator.create(
+                *this,
+                theString,
+                theLength);
 }
 
 
@@ -1282,8 +1379,11 @@
             const LocatorType*          locator,
             bool                        fUseDefault)
 {
-    return  m_xalanQNameByValueAllocator.create(qname, namespaces, locator, fUseDefault);
-
+    return  m_xalanQNameByValueAllocator.create(
+                qname,
+                namespaces,
+                locator,
+                fUseDefault);
 }
 
 
@@ -1295,8 +1395,11 @@
             const LocatorType*          locator,
             bool                        fUseDefault)
 {
-    return  m_xalanQNameByValueAllocator.create(qname, namespaces, locator, fUseDefault);
-
+    return  m_xalanQNameByValueAllocator.create(
+                qname,
+                namespaces,
+                locator,
+                fUseDefault);
 }
 
 
@@ -1321,7 +1424,8 @@
     }
     else
     {
-        const XalanQName**  theResult = doAllocateXalanQNamePointerVector(count);
+        const XalanQName**  theResult =
+            doAllocateXalanQNamePointerVector(count);
         assert(theResult != 0);
 
         const GetAndReleaseCachedString     theGuard(*this);

Modified: xalan/c/trunk/src/xalanc/XSLT/XResultTreeFrag.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XSLT/XResultTreeFrag.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XResultTreeFrag.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XResultTreeFrag.hpp Wed Feb  8 09:15:09 2006
@@ -27,13 +27,6 @@
 
 
 
-#if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
-#include <xalanc/XPath/ResultTreeFragBase.hpp>
-#endif
-
-
-
-
 // Base class header file.
 #include <xalanc/XPath/NodeRefListBase.hpp>
 #include <xalanc/XPath/XObject.hpp>

Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp Wed Feb  8 09:15:09 2006
@@ -1060,12 +1060,16 @@
 {
     const XalanDOMChar*     id = 0;
 
-    MemoryManagerType& theManager = const_cast<XSLTEngineImpl*>(this)->getMemoryManager();
+    MemoryManager& theManager =
+        const_cast<XSLTEngineImpl*>(this)->getMemoryManager();
 
-    XalanDOMString          uri( theManager );
+    XalanDOMString  uri(theManager);
 
-    int                     lineNumber = XalanLocator::getUnknownValue();
-    int                     columnNumber = XalanLocator::getUnknownValue();
+    XalanLocator::size_type     lineNumber =
+        XalanLocator::getUnknownValue();
+
+    XalanLocator::size_type     columnNumber =
+        XalanLocator::getUnknownValue();
 
     const LocatorType*      locator = getLocatorFromStack();
 
@@ -1114,7 +1118,12 @@
 
     if (classification == ProblemListener::eERROR)
     {
-        throw XSLTProcessorException(theManager, msg, uri, lineNumber, columnNumber);
+        throw XSLTProcessorException(
+                theManager,
+                msg,
+                uri,
+                lineNumber,
+                columnNumber);
     }
 }
 

Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp Wed Feb  8 09:15:09 2006
@@ -203,7 +203,7 @@
 	virtual
 	~XSLTEngineImpl();
 
-    MemoryManagerType&
+    MemoryManager&
     getMemoryManager()
     {
         return m_xpathConstructionContext.getMemoryManager();

Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h?rev=376000&r1=375999&r2=376000&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h Wed Feb  8 09:15:09 2006
@@ -61,7 +61,11 @@
 	/**
 	 * This is a typedef for characters encoded in UTF-16.
 	 */
-	typedef unsigned short	XalanUTF16Char;
+#if defined(_NATIVE_WCHAR_T_DEFINED)
+    typedef wchar_t	        XalanUTF16Char;
+#else
+    typedef unsigned short	XalanUTF16Char;
+#endif
 
 	/**
 	 * Initialize Xerces and Xalan.



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org