diff options
-rw-r--r-- | transex3/source/cfgmerge.cxx | 16 | ||||
-rw-r--r-- | transex3/source/export.cxx | 24 | ||||
-rw-r--r-- | transex3/source/lngex.cxx | 13 | ||||
-rw-r--r-- | transex3/source/lngmerge.cxx | 15 | ||||
-rw-r--r-- | transex3/source/makefile.mk | 14 | ||||
-rw-r--r-- | transex3/source/merge.cxx | 11 |
6 files changed, 70 insertions, 23 deletions
diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx index cd5cf77a0773..6c9413ed1675 100644 --- a/transex3/source/cfgmerge.cxx +++ b/transex3/source/cfgmerge.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgmerge.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: nf $ $Date: 2001-02-02 15:40:54 $ + * last change: $Author: nf $ $Date: 2001-04-25 10:17:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,11 +79,13 @@ extern "C" { YYWarning( char * ); } #define STATE_ROOT 0x0005 #define STATE_MERGESRC 0x0006 #define STATE_ERRORLOG 0x0007 +#define STATE_UTF8 0x0008 // set of global variables BOOL bEnableExport; BOOL bMergeMode; BOOL bErrorLog; +BOOL bUTF8; ByteString sPrj; ByteString sPrjRoot; ByteString sInputFileName; @@ -103,6 +105,7 @@ extern char *GetOutputFile( int argc, char* argv[]) bEnableExport = FALSE; bMergeMode = FALSE; bErrorLog = TRUE; + bUTF8 = FALSE; sPrj = ""; sPrjRoot = ""; sInputFileName = ""; @@ -132,6 +135,10 @@ extern char *GetOutputFile( int argc, char* argv[]) nState = STATE_ERRORLOG; bErrorLog = FALSE; } + else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-UTF8" ) { + nState = STATE_UTF8; + bUTF8 = FALSE; + } else { switch ( nState ) { case STATE_NON: { @@ -615,6 +622,9 @@ void CfgExport::WorkOnRessourceEnd() sOutput += sText; sOutput += "\t\t\t\t"; sOutput += sTimeStamp; + if ( bUTF8 ) + sOutput = UTF8Converter::ConvertToUTF8( sOutput, Export::GetCharSet( Export::LangId[ i ] )); + pOutputStream->WriteLine( sOutput ); } } @@ -652,7 +662,7 @@ CfgMerge::CfgMerge( { if ( rMergeSource.Len()) pMergeDataFile = new MergeDataFile( - rMergeSource, bErrorLog, RTL_TEXTENCODING_MS_1252 ); + rMergeSource, bErrorLog, RTL_TEXTENCODING_MS_1252, bUTF8 ); } /*****************************************************************************/ diff --git a/transex3/source/export.cxx b/transex3/source/export.cxx index 5bde3d92ff10..9fac9d2eb540 100644 --- a/transex3/source/export.cxx +++ b/transex3/source/export.cxx @@ -2,9 +2,9 @@ * * $RCSfile: export.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: nf $ $Date: 2001-04-05 09:22:28 $ + * last change: $Author: nf $ $Date: 2001-04-25 10:17:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,7 @@ #include "export.hxx" #include "wrdtrans.hxx" #include "tokens.h" +#include "utf8conv.hxx" extern "C" { yyerror( char * ); } extern "C" { YYWarning( char * ); } @@ -81,6 +82,7 @@ Export *pExport = 0L; #define STATE_ERRORLOG 0x0007 #define STATE_BREAKHELP 0x0008 #define STATE_UNMERGE 0x0009 +#define STATE_UTF8 0x000A // set of global variables DECLARE_LIST( FileList, ByteString * ); @@ -90,6 +92,7 @@ BOOL bMergeMode; BOOL bErrorLog; BOOL bBreakWhenHelpText; BOOL bUnmerge; +BOOL bUTF8; ByteString sPrj; ByteString sPrjRoot; ByteString sActFileName; @@ -109,6 +112,7 @@ extern char *GetOutputFile( int argc, char* argv[]) bErrorLog = TRUE; bBreakWhenHelpText = FALSE; bUnmerge = FALSE; + bUTF8 = FALSE; sPrj = ""; sPrjRoot = ""; sActFileName = ""; @@ -146,6 +150,10 @@ extern char *GetOutputFile( int argc, char* argv[]) bUnmerge = TRUE; bMergeMode = TRUE; } + else if ( ByteString( argv[ i ]).ToUpperAscii() == "-UTF8" ) { + nState = STATE_UTF8; + bUTF8 = TRUE; + } else { switch ( nState ) { case STATE_NON: { @@ -450,7 +458,7 @@ Export::~Export() if ( bMergeMode && !bUnmerge ) { if ( !pMergeDataFile ) - pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet ); + pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet, bUTF8 ); pMergeDataFile->WriteErrorLog( sActFileName ); delete pMergeDataFile; @@ -1322,6 +1330,9 @@ BOOL Export::WriteData( ResData *pResData, BOOL bCreateNew ) sOutput += sXTitle; sOutput += "\t"; sOutput += sTimeStamp; + if ( bUTF8 ) + sOutput = UTF8Converter::ConvertToUTF8( sOutput, GetCharSet( LangId[ i ] )); + aOutput.WriteLine( sOutput ); } @@ -1412,6 +1423,9 @@ BOOL Export::WriteExportList( ResData *pResData, ExportList *pExportList, sOutput += sText; sOutput += "\t\t\t\t"; sOutput += sTimeStamp; + if ( bUTF8 ) + sOutput = UTF8Converter::ConvertToUTF8( sOutput, GetCharSet( LangId[ i ] )); + aOutput.WriteLine( sOutput ); } } @@ -1831,7 +1845,7 @@ BOOL Export::PrepareTextToMerge( ByteString &rText, USHORT nTyp, // search for merge data if ( !pMergeDataFile ) - pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet ); + pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet, bUTF8 ); PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData ); pResData->sId = sOldId; @@ -2106,7 +2120,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode ) } if ( !pMergeDataFile ) - pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet ); + pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet, bUTF8 ); switch ( nMode ) { case MERGE_MODE_NORMAL : { diff --git a/transex3/source/lngex.cxx b/transex3/source/lngex.cxx index 9e510d686f41..127e5e0de644 100644 --- a/transex3/source/lngex.cxx +++ b/transex3/source/lngex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: lngex.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $ + * last change: $Author: nf $ $Date: 2001-04-25 10:17:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,12 +73,14 @@ #define STATE_ERRORLOG 0x0007 #define STATE_BREAKHELP 0x0008 #define STATE_UNMERGE 0x0009 +#define STATE_UTF8 0x000A // set of global variables ByteString sInputFile; BOOL bEnableExport; BOOL bMergeMode; BOOL bErrorLog; +BOOL bUTF8; ByteString sPrj; ByteString sPrjRoot; ByteString sOutputFile; @@ -91,6 +93,7 @@ BOOL ParseCommandLine( int argc, char* argv[]) bEnableExport = FALSE; bMergeMode = FALSE; bErrorLog = TRUE; + bUTF8 = FALSE; sPrj = ""; sPrjRoot = ""; @@ -118,6 +121,10 @@ BOOL ParseCommandLine( int argc, char* argv[]) nState = STATE_ERRORLOG; bErrorLog = FALSE; } + else if ( ByteString( argv[ i ]).ToUpperAscii() == "-UTF8" ) { + nState = STATE_UTF8; + bUTF8 = TRUE; + } else { switch ( nState ) { case STATE_NON: { @@ -196,7 +203,7 @@ int _cdecl main( int argc, char *argv[] ) fprintf( stdout, "\nProcessing File %s ...\n", sInputFile.GetBuffer()); if ( sOutputFile.Len()) { - LngParser aParser( sInputFile ); + LngParser aParser( sInputFile, bUTF8 ); if ( bMergeMode ) aParser.Merge( sMergeSrc, sOutputFile ); else diff --git a/transex3/source/lngmerge.cxx b/transex3/source/lngmerge.cxx index b381a532d982..614d9c2a259f 100644 --- a/transex3/source/lngmerge.cxx +++ b/transex3/source/lngmerge.cxx @@ -2,9 +2,9 @@ * * $RCSfile: lngmerge.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $ + * last change: $Author: nf $ $Date: 2001-04-25 10:17:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,17 +62,19 @@ // local includes #include "lngmerge.hxx" +#include "utf8conv.hxx" // // class LngParser // /*****************************************************************************/ -LngParser::LngParser( const ByteString &rLngFile ) +LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8 ) /*****************************************************************************/ : sSource( rLngFile ), nError( LNG_OK ), - pLines( NULL ) + pLines( NULL ), + bDBIsUTF8( bUTF8 ) { pLines = new LngLineList( 100, 100 ); @@ -209,6 +211,9 @@ BOOL LngParser::CreateSDF( sOutput += sAct; sOutput += "\t\t\t\t"; sOutput += sTimeStamp; + if ( bDBIsUTF8 ) + sOutput = UTF8Converter::ConvertToUTF8( sOutput, Export::GetCharSet( Export::LangId[ i ] )); + aSDFStream.WriteLine( sOutput ); } } @@ -231,7 +236,7 @@ BOOL LngParser::Merge( } nError = LNG_OK; - MergeDataFile aMergeDataFile( rSDFFile, FALSE, RTL_TEXTENCODING_MS_1252 ); + MergeDataFile aMergeDataFile( rSDFFile, FALSE, RTL_TEXTENCODING_MS_1252, bDBIsUTF8 ); ULONG nPos = 0; BOOL bGroup = FALSE; diff --git a/transex3/source/makefile.mk b/transex3/source/makefile.mk index 5177d32b39d2..30b7dee17e6b 100644 --- a/transex3/source/makefile.mk +++ b/transex3/source/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: nf $ $Date: 2001-03-30 09:27:32 $ +# last change: $Author: nf $ $Date: 2001-04-25 10:17:04 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -86,9 +86,10 @@ OBJFILES= \ $(OBJ)$/wtratree.obj \ $(OBJ)$/wtranode.obj +# extractor and merger for *.src and *.hrc APP1TARGET= $(TARGET) APP1STACK= 16000 -APP1OBJS= $(OBJ)$/src_yy.obj +APP1OBJS= $(OBJ)$/src_yy.obj $(OBJ)$/utf8conv.obj APP1STDLIBS+=$(STATIC_LIBS) $(BTSTRPLIB) APP1LIBS+= $(LB)$/$(TARGET).lib APP1DEPN= $(OBJ)$/src_yy.obj $(LB)$/$(TARGET).lib @@ -98,26 +99,31 @@ APP1DEPN= $(OBJ)$/src_yy.obj $(LB)$/$(TARGET).lib #APP2OBJS= $(OBJ)$/termino.obj #APP2STDLIBS=$(STATIC_LIBS) $(L)$/bootstrp.lib +# extractor and merger for *.lng and *.lng APP3TARGET= lngex APP3STACK= 16000 -APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj +APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj APP3STDLIBS=$(STATIC_LIBS) +# encoding converter for *.gsi APP4TARGET= gsiconv APP4STACK= 16000 APP4OBJS= $(OBJ)$/utf8conv.obj $(OBJ)$/gsiconv.obj APP4STDLIBS=$(STATIC_LIBS) +# tag checker for *.gsi APP5TARGET= gsicheck APP5STACK= 16000 APP5OBJS= $(OBJ)$/gsicheck.obj $(OBJ)$/tagtest.obj APP5STDLIBS=$(STATIC_LIBS) +# extractor and merger for *.xxl and *.xrb APP6TARGET= xmlex APP6STACK= 16000 APP6OBJS= $(OBJ)$/xmlmerge.obj $(OBJ)$/xml_yy.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj APP6STDLIBS=$(STATIC_LIBS) +# extractor and merger for *.cfg APP7TARGET= cfgex APP7STACK= 16000 APP7OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj diff --git a/transex3/source/merge.cxx b/transex3/source/merge.cxx index 8c7def77c14e..8e4bcd354367 100644 --- a/transex3/source/merge.cxx +++ b/transex3/source/merge.cxx @@ -2,9 +2,9 @@ * * $RCSfile: merge.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: nf $ $Date: 2001-04-05 09:22:28 $ + * last change: $Author: nf $ $Date: 2001-04-25 10:17:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,6 +61,7 @@ #include <stdio.h> #include <tools/fsys.hxx> #include "export.hxx" +#include "utf8conv.hxx" // // class PFormEntrys @@ -154,7 +155,7 @@ BOOL MergeData::operator==( ResData *pData ) /*****************************************************************************/ MergeDataFile::MergeDataFile( const ByteString &rFileName, BOOL bErrLog, - CharSet aCharSet ) + CharSet aCharSet, BOOL bUTF8 ) /*****************************************************************************/ : bErrorLog( bErrLog ) { @@ -211,6 +212,10 @@ MergeDataFile::MergeDataFile( const ByteString &rFileName, BOOL bErrLog, sPFO = sLine.GetToken( 4, '\t' ); sPFO = sPFO.Copy( 1 ); sPFO.Erase( sPFO.Len() - 1 ); nLANG = sLine.GetToken( 5, '\t' ).ToInt32(); + + if ( bUTF8 ) + sLine = UTF8Converter::ConvertFromUTF8( sLine, Export::GetCharSet( nLANG )); + sTEXT = sLine.GetToken( 6, '\t' ); sTEXT = sTEXT.Copy( 1 ); sTEXT.Erase( sTEXT.Len() - 1 ); sQHTEXT = sLine.GetToken( 8, '\t' ); |