summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2001-11-05 13:44:05 +0000
committerPhilipp Lohmann <pl@openoffice.org>2001-11-05 13:44:05 +0000
commit0e5f97c8966054d8f8e8a637a464cf76f42c09a0 (patch)
treecc25342ac79212aaa9630566d9299f8dce95b780 /rsc
parentf16282300c1dc099e9e86e4600ebab3a76c7afc3 (diff)
#94297# write multiple .res files in one pass
Diffstat (limited to 'rsc')
-rw-r--r--rsc/inc/rscdb.hxx30
-rw-r--r--rsc/inc/rscpar.hxx13
-rw-r--r--rsc/inc/rscrsc.hxx26
-rw-r--r--rsc/source/parser/rsclex.cxx6
-rw-r--r--rsc/source/parser/rscpar.cxx16
-rw-r--r--rsc/source/prj/gui.cxx11
-rw-r--r--rsc/source/prj/start.cxx51
-rw-r--r--rsc/source/rsc/rsc.cxx134
-rw-r--r--rsc/source/tools/rsctools.cxx5
9 files changed, 133 insertions, 159 deletions
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index 5f41d1615bca..f94480935508 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rscdb.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:13 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -374,20 +374,26 @@ public:
LanguageType GetDefLanguage() const
{ return (LanguageType)nDfltLangTypeId; }
LanguageType ChangeLanguage( LanguageType eLang )
- {
- LanguageType nOldLang = (LanguageType)nLangTypeId;
- nLangTypeId = eLang;
- return nOldLang;
- }
+ {
+ LanguageType nOldLang = (LanguageType)nLangTypeId;
+ nLangTypeId = eLang;
+ return nOldLang;
+ }
LanguageType ChangeDefLanguage( LanguageType eLang )
- {
- LanguageType nOldLang = (LanguageType)nDfltLangTypeId;
- nDfltLangTypeId = eLang;
- return nOldLang;
- }
+ {
+ LanguageType nOldLang = (LanguageType)nDfltLangTypeId;
+ nDfltLangTypeId = eLang;
+ return nOldLang;
+ }
RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
CharSet GetSourceCharSet() const { return nSourceCharSet; }
+ CharSet SetSourceCharSet( CharSet aCharSet )
+ {
+ CharSet aOld = nSourceCharSet;
+ nSourceCharSet = aCharSet;
+ return aOld;
+ }
void SetSearchPath( const ByteString & rStr) { aSearchPath = rStr; }
ByteString GetSearchPath() const { return aSearchPath; }
void InsertType( RscTop * pType )
diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx
index 5110cef3d7c8..8b25c8fbbdfa 100644
--- a/rsc/inc/rscpar.hxx
+++ b/rsc/inc/rscpar.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rscpar.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:13 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,7 +79,6 @@ class RscFileInst
ERRTYPE aFirstError;// Erster Fehler
USHORT nErrorLine; // Zeile des ersten Fehlers
USHORT nErrorPos; // Position des ersten Fehlers
- rtl_TextEncoding nCharSet; // Zeichensatz der einzulesenden Datei
BOOL bIncLine; // Muss Zeilennummer incrementiert werden
USHORT nLineNo; // Zeile in der Eingabedatei
ULONG lFileIndex; // Index auf Eingabedatei
@@ -99,15 +98,11 @@ public:
RscTypCont * pTypCont;
void Init(); // ctor initialisieren
RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
- ULONG lFileIndex, FILE * fFile,
- rtl_TextEncoding nSourceCharSet );
+ ULONG lFileIndex, FILE * fFile );
RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
- ULONG lFileIndex, const ByteString &,
- rtl_TextEncoding nSourceCharSet );
+ ULONG lFileIndex, const ByteString & );
~RscFileInst();
BOOL IsEof() const { return bEof; }
- void SetCharSet( rtl_TextEncoding nSet ) { nCharSet = nSet; }
- UINT16 GetCharSet() const { return (UINT16)nCharSet; }
void SetFileIndex( ULONG lFIndex ) { lFileIndex = lFIndex; }
ULONG GetFileIndex() { return( lFileIndex ); }
ULONG GetSrcIndex() { return( lSrcIndex ); }
diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx
index 0b1699d0154b..44e92c37e14d 100644
--- a/rsc/inc/rscrsc.hxx
+++ b/rsc/inc/rscrsc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rscrsc.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:13 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,8 @@
#include <rsctools.hxx>
#endif
+#include <list>
+
class RscTypCont;
/****************** T Y P E S ********************************************/
@@ -93,22 +95,31 @@ public:
RscStrList aInputList; // Liste der Quelldateien
RscStrList aSymbolList; // Liste der Symbole
ByteString aPath; // Liste der Pfade
- CharSet nSourceCharSet; // Welcher Quellzeichensatz
- LanguageType nLangTypeId; // Globale Sprachtyp
RSCBYTEORDER_TYPE nByteOrder;
short nCommands; // Steuerbits
- ByteString aOutputSrs; // Name der Srs-Ausgabedatei
- ByteString aOutputRc; // Name der Rc-Ausgabedatei
ByteString aOutputLst; // Name der List-Ausgabedatei
+ ByteString aOutputSrs; // Name der Srs-Ausgabedatei
ByteString aOutputSrc; // Name der Src-Ausgabedatei
ByteString aOutputRcCtor; // Name der Ctor-Ausgabedatei
ByteString aOutputCxx; // Name der Cxx-Ausgabedatei
ByteString aOutputHxx; // Name der Hxx-Ausgabedatei
+ struct OutputFile
+ {
+ LanguageType nLangTypeId; // Globale Sprachtyp
+ CharSet nSourceCharSet; // Welcher Quellzeichensatz
+ ByteString aOutputRc; // Name der Rc-Ausgabedatei
+
+ OutputFile() :
+ nLangTypeId( LANGUAGE_DONTKNOW ),
+ nSourceCharSet( RTL_TEXTENCODING_ASCII_US )
+ {}
+ };
+ ::std::list<OutputFile> m_aOutputFiles;
+
RscCmdLine( short argc, char ** argv, RscError * pEH );
RscCmdLine();
- void SetInputFile( const ByteString & rInputName );
~RscCmdLine();
};
/****************** R s c ************************************************/
@@ -116,7 +127,6 @@ class RscCompiler
{
private:
RscStrList aTmpFileList; // Liste der Tmp-Dateien
- ByteString aTmpOutputRc; // Name der TempRc-Ausgabedatei
ByteString aTmpOutputHxx; // Name der TempHxx-Ausgabedatei
ByteString aTmpOutputCxx; // Name der TempCxx-Ausgabedatei
ByteString aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei
diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx
index 1c73549a0608..1b96a6b339c6 100644
--- a/rsc/source/parser/rsclex.cxx
+++ b/rsc/source/parser/rsclex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rsclex.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:23 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -261,9 +261,7 @@ int MakeToken( YYSTYPE * pTokenVal ){
pBuf[i++] = c;
}
pBuf[i++] = '\0';
- //pStr = pTokenVal->string = RscChar::MakeUTF8( pBuf, pFI->GetCharSet() );
pStr = pTokenVal->string = pBuf;
- //PutStringBack( pBuf );
return( STRING );
}
if (isdigit (c)){
diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx
index c79b86dc7e19..ab933b2728ef 100644
--- a/rsc/source/parser/rscpar.cxx
+++ b/rsc/source/parser/rscpar.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rscpar.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:23 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,8 +84,6 @@
*************************************************************************/
void RscFileInst::Init()
{
- SetCharSet( RTL_TEXTENCODING_MS_1252 );
-
nLineNo = 0;
nLineBufLen = 256;
pLine = (char *)RscMem::Malloc( nLineBufLen );
@@ -105,8 +103,7 @@ void RscFileInst::Init()
|*
*************************************************************************/
RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
- ULONG lFIndex, FILE * fFile,
- rtl_TextEncoding nSourceCharSet )
+ ULONG lFIndex, FILE * fFile )
{
pTypCont = pTC;
Init();
@@ -115,16 +112,13 @@ RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
lSrcIndex = lIndexSrc;
fInputFile = fFile;
- SetCharSet( nSourceCharSet );
-
//Status: Zeiger am Ende des Lesepuffers
nInputPos = nInputEndPos = nInputBufLen = READBUFFER_MAX;
pInput = (char *)RscMem::Malloc( nInputBufLen );
}
RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
- ULONG lFIndex, const ByteString& rBuf,
- rtl_TextEncoding nSourceCharSet )
+ ULONG lFIndex, const ByteString& rBuf )
{
pTypCont = pTC;
Init();
@@ -134,8 +128,6 @@ RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
nInputPos = 0;
nInputEndPos = rBuf.Len();
- SetCharSet( nSourceCharSet );
-
// Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos
nInputBufLen = nInputEndPos +1;
pInput = (char *)RscMem::Malloc( nInputBufLen +100 );
diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx
index 235bebc54c0d..20ba067eac5a 100644
--- a/rsc/source/prj/gui.cxx
+++ b/rsc/source/prj/gui.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: gui.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,6 +124,9 @@ int cdecl main ( int argc, char ** argv) {
#ifdef MAC
InitCursorCtl( 0 );
#endif
+#ifdef DEBUG
+ fprintf( stderr, "debugging %s\n", argv[0] );
+#endif
ERRTYPE aError;
@@ -135,9 +138,9 @@ int cdecl main ( int argc, char ** argv) {
RscCmdLine* pCmdLine = new RscCmdLine( argc, argv, pErrHdl );
#endif
RscTypCont* pTypCont = new RscTypCont( pErrHdl,
- pCmdLine->nLangTypeId,
+ pCmdLine->m_aOutputFiles.front().nLangTypeId,
pCmdLine->nByteOrder,
- pCmdLine->nSourceCharSet,
+ pCmdLine->m_aOutputFiles.front().nSourceCharSet,
pCmdLine->aPath,
pCmdLine->nCommands );
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index fda87c6a407a..d17df8013699 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: start.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -219,7 +219,6 @@ static BOOL CallPrePro( const ByteString& rPrePro,
static BOOL CallRsc2( ByteString aRsc2Name,
RscStrList * pInputList,
ByteString aSrsName,
- ByteString aRcName,
RscPtrPtr * pCmdLine )
{
RscPtrPtr aNewCmdL; // Kommandozeile
@@ -248,7 +247,6 @@ static BOOL CallRsc2( ByteString aRsc2Name,
{
if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp", 3 )
|| !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo", 3 )
- || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fs", 3 )
|| !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-pp", 3 )
|| !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 )
|| !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 )
@@ -264,8 +262,7 @@ static BOOL CallRsc2( ByteString aRsc2Name,
(const char *)pCmdLine->GetEntry( i ) );
};
- fprintf( fRspFile, "%s -fs%s",
- aSrsName.GetBuffer(), aRcName.GetBuffer() );
+ fprintf( fRspFile, aSrsName.GetBuffer() );
pString = pInputList->First();
while( pString )
@@ -297,28 +294,6 @@ static BOOL CallRsc2( ByteString aRsc2Name,
}
/*************************************************************************
-|* CallRes
-|*
-|* Beschreibung
-*************************************************************************/
-static BOOL CallRes( ByteString aRcName, ByteString aResName )
-{
- short nExit;
-
- unlink( aResName.GetBuffer() ); // Zieldatei loeschen
- printf( "Copy %s to %s\n", aRcName.GetBuffer(), aResName.GetBuffer() );
- if( !Append( aResName, aRcName ) )
- {
- printf( "Cannot open file <%s or %s>\n",
- aResName.GetBuffer(), aRcName.GetBuffer() );
- nExit = 1;
- }
- else
- nExit = 0;
- return( nExit == 0 );
-}
-
-/*************************************************************************
|*
|* main()
|*
@@ -343,7 +318,6 @@ int cdecl main ( int argc, char ** argv)
ByteString aPrePro( "rscpp" );
ByteString aRsc2Name( "rsc2" );
ByteString aSrsName;
- ByteString aRcName;
ByteString aResName;
RscStrList aInputList;
RscStrList aTmpList;
@@ -396,10 +370,6 @@ int cdecl main ( int argc, char ** argv)
{ // anderer Name fuer .res-file
aResName = (*ppStr) + 3;
}
- else if( !rsc_strnicmp( (*ppStr) + 1, "fs", 2 ) )
- { // anderer Name fuer .rc-file
- aRcName = (*ppStr) + 3;
- }
else if( !rsc_strnicmp( (*ppStr) + 1, "fp", 2 ) )
{ // anderer Name fuer .srs-file
bSetSrs = TRUE;
@@ -420,8 +390,6 @@ int cdecl main ( int argc, char ** argv)
/* build the output file names */
if( ! aResName.Len() )
aResName = OutputFile( *aInputList.First(), "res" );
- if( ! aRcName.Len() )
- aRcName = OutputFile( *aInputList.First(), "rc" );
if( ! bSetSrs )
{
aSrsName = "-fp";
@@ -456,7 +424,7 @@ int cdecl main ( int argc, char ** argv)
if( !bError )
{
if( !CallRsc2( aRsc2Name, bPrePro ? &aTmpList : &aInputList,
- aSrsName, aRcName, &aCmdLine ) )
+ aSrsName, &aCmdLine ) )
{
if( !bHelp )
{
@@ -473,17 +441,6 @@ int cdecl main ( int argc, char ** argv)
pString = aTmpList.Next();
};
- if( !bError && bResFile )
- {
- if( !CallRes( aRcName, aResName ) )
- {
- printf( "Error in system resource compiler\n" );
- bError = TRUE;
- }
- else
- unlink( aRcName.GetBuffer() );
- };
-
return( bError );
}
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index 0bccb695dafd..d8347601beff 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rsc.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:29 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,6 +99,7 @@
#endif
#include <tools/fsys.hxx>
+#include <tools/intn.hxx>
#ifndef _RSCERROR_H
#include <rscerror.h>
@@ -141,13 +142,13 @@ USHORT nRefDeep = 10;
*************************************************************************/
void RscCmdLine::Init()
{
- nSourceCharSet = RTL_TEXTENCODING_MS_1252;
nCommands = 0;
- nLangTypeId = LANGUAGE_DONTKNOW;
nByteOrder = RSC_BIGENDIAN;
DirEntry aEntry;
aPath = ByteString( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); //Immer im Aktuellen Pfad suchen
+ m_aOutputFiles.clear();
+ m_aOutputFiles.push_back( OutputFile() );
}
/*************************************************************************
@@ -194,6 +195,9 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
i = 1;
while( ppStr && i < (USHORT)(aCmdLine.GetCount() -1) )
{
+#ifdef DEBUG
+ fprintf( stderr, "CmdLineArg: \"%s\"\n", *ppStr );
+#endif
if( '-' == **ppStr )
{
if( !rsc_stricmp( (*ppStr) + 1, "h" )
@@ -256,7 +260,9 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
}
else if( !rsc_strnicmp( (*ppStr) + 1, "fs", 2 ) )
{ // anderer Name fuer .rc-file
- aOutputRc = (*ppStr) + 3;
+ if( m_aOutputFiles.back().aOutputRc.Len() )
+ m_aOutputFiles.push_back( OutputFile() );
+ m_aOutputFiles.back().aOutputRc = (*ppStr) + 3;
}
else if( !rsc_strnicmp( (*ppStr) + 1, "fp", 2 ) )
{ // anderer Name fuer .srs-file
@@ -293,6 +299,7 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
}
else if( !rsc_strnicmp( (*ppStr) + 1, "CHARSET_", 8 ) )
{
+ CharSet nSourceCharSet = RTL_TEXTENCODING_ASCII_US;
if( !rsc_stricmp( (*ppStr) + 9, "ANSI" ) )
nSourceCharSet = RTL_TEXTENCODING_MS_1252;
else if( !rsc_stricmp( (*ppStr) + 9, "MAC" ) )
@@ -325,17 +332,23 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
break;
}
}
+ if( m_aOutputFiles.back().nSourceCharSet != RTL_TEXTENCODING_ASCII_US )
+ m_aOutputFiles.push_back( OutputFile() );
+ m_aOutputFiles.back().nSourceCharSet = nSourceCharSet;
}
else if( !rsc_stricmp( (*ppStr) + 1, "lg" ) )
{
- nLangTypeId = LANGUAGE_DONTKNOW;
+ m_aOutputFiles.back().nLangTypeId = LANGUAGE_DONTKNOW;
}
else if( !rsc_strnicmp( (*ppStr) + 1, "lg", 2 ) )
{
- nLangTypeId = LANGUAGE_DONTKNOW;
-#define LT(Name) \
- if( !rsc_stricmp( (*ppStr) + 3, #Name ) ) \
- nLangTypeId = LANGUAGE_##Name
+#define LT(Name) \
+ if( !rsc_stricmp( (*ppStr) + 3, #Name ) ) \
+ { \
+ if( m_aOutputFiles.back().nLangTypeId != LANGUAGE_DONTKNOW ) \
+ m_aOutputFiles.push_back( OutputFile() ); \
+ m_aOutputFiles.back().nLangTypeId = LANGUAGE_##Name ; \
+ }
LT( SYSTEM );
#include <rsclang.c>
LT( USER1 );
@@ -348,8 +361,12 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
LT( USER8 );
LT( USER9 );
if( !rsc_stricmp( (*ppStr) + 3, "EXTERN" ) )
- nLangTypeId = LANGUAGE_USER9;
- if( nLangTypeId == LANGUAGE_DONTKNOW )
+ {
+ if( m_aOutputFiles.back().nLangTypeId != LANGUAGE_DONTKNOW )
+ m_aOutputFiles.push_back( OutputFile() );
+ m_aOutputFiles.back().nLangTypeId = LANGUAGE_USER9;
+ }
+ if( m_aOutputFiles.back().nLangTypeId == LANGUAGE_DONTKNOW )
pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr );
}
else
@@ -369,10 +386,14 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
// was an inputted file specified
else if( aInputList.Count() )
{
- if( ! aOutputRc.Len() )
- aOutputRc = OutputFile( *aInputList.First(), "rc" );
+ ::std::list<OutputFile>::iterator it;
+ for( it = m_aOutputFiles.begin(); it != m_aOutputFiles.end(); ++it )
+ {
+ if( ! it->aOutputRc.Len() )
+ it->aOutputRc = ::OutputFile( *aInputList.First(), "rc" );
+ }
if( ! bOutputSrsIsSet )
- aOutputSrs = OutputFile( *aInputList.First(), "srs" );
+ aOutputSrs = ::OutputFile( *aInputList.First(), "srs" );
}
else if( !(nCommands & PRINTSYNTAX_FLAG) )
pEH->FatalError( ERR_NOINPUT, RscId() );
@@ -380,24 +401,6 @@ RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
/*************************************************************************
|*
-|* RscCmdLine::SetInputFile()
-|*
-|* Beschreibung
-|* Ersterstellung MM 22.04.91
-|* Letzte Aenderung MM 22.04.91
-|*
-*************************************************************************/
-void RscCmdLine::SetInputFile( const ByteString & rInputName )
-{
- ByteString * pString;
-
- while( NULL != (pString = aInputList.Remove( (ULONG)0 )) )
- delete pString;
- aInputList.Insert( new ByteString( rInputName ) );
-}
-
-/*************************************************************************
-|*
|* RscCmdLine::~RscCmdLine()
|*
|* Beschreibung dtor
@@ -474,8 +477,6 @@ RscCompiler::~RscCompiler()
if( fExitFile )
fclose( fExitFile );
- if( aTmpOutputRc.Len() )
- unlink( aTmpOutputRc.GetBuffer() );
if( aTmpOutputHxx.Len() )
unlink( aTmpOutputHxx.GetBuffer() );
if( aTmpOutputCxx.Len() )
@@ -662,15 +663,6 @@ void RscCompiler::EndCompile()
unlink( aTmpOutputSrc.GetBuffer() );// TempDatei loeschen
aTmpOutputSrc = ByteString();
}
-
- if( aTmpOutputRc.Len() )
- {
- // kopiere von TMP auf richtigen Namen
- unlink( pCL->aOutputRc.GetBuffer() ); // Zieldatei loeschen
- Append( pCL->aOutputRc, aTmpOutputRc );
- unlink( aTmpOutputRc.GetBuffer() ); // TempDatei loeschen
- aTmpOutputRc = ByteString();
- }
}
/*************************************************************************
@@ -705,8 +697,7 @@ ERRTYPE RscCompiler :: IncludeParser( ULONG lFileKey )
RscFile * pFNTmp;
ByteString aPathName;
RscDepend * pDep;
- RscFileInst aFileInst( pTC, lFileKey, lFileKey,
- finput, pCL->nSourceCharSet );
+ RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput );
pFName->bScanned = TRUE;
::IncludeParser( &aFileInst );
@@ -787,8 +778,7 @@ ERRTYPE RscCompiler :: ParseOneFile( ULONG lFileKey )
}
else
{
- RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput,
- pCL->nSourceCharSet );
+ RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput );
// Parser schreibt Punkte fuer jedes Objekt auf
// unterster Ebene nach stdout
pTC->pEH->StdOut( "reading file " );
@@ -851,20 +841,44 @@ ERRTYPE RscCompiler::Link()
FILE * foutput;
ERRTYPE aError;
+#ifdef UNX
+#define PATHSEP '/'
+#else
+#define PATHSEP '\\'
+#endif
+
if( !(pCL->nCommands & NOLINK_FLAG) )
{
- // rc-Datei schreiben
- aTmpOutputRc = ::GetTmpFileName();
- if ( NULL == (fExitFile = foutput = fopen( aTmpOutputRc.GetBuffer(), "wb" )) )
- pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputRc.GetBuffer() );
-
- pTC->pEH->StdOut( "Generating .rc file\n" );
-
- // Schreibe Datei
- aError = pTC->WriteRc( foutput );
-
- fclose( foutput );
- fExitFile = NULL;
+ ::std::list<RscCmdLine::OutputFile>::const_iterator it;
+ for( it = pCL->m_aOutputFiles.begin(); it != pCL->m_aOutputFiles.end(); ++it )
+ {
+ // rc-Datei schreiben
+ ByteString aDir( it->aOutputRc );
+ aDir.SetToken( aDir.GetTokenCount( PATHSEP )-1, PATHSEP, ByteString() );
+ char* pTmp = tempnam( aDir.GetBuffer(), "rsc" );
+ if ( NULL == (fExitFile = foutput = fopen( pTmp, "wb" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), pTmp );
+
+ pTC->pEH->StdOut( "Generating .rc file\n" );
+
+ // Schreibe Datei
+#ifdef DEBUG
+ fprintf( stderr, "using tmp file %s\n", pTmp );
+#endif
+ pTC->ChangeLanguage( it->nLangTypeId );
+ pTC->ChangeDefLanguage( International::GetNeutralLanguage( it->nLangTypeId ) );
+ pTC->SetSourceCharSet( it->nSourceCharSet );
+ aError = pTC->WriteRc( foutput );
+
+ fclose( foutput );
+ fExitFile = NULL;
+#ifdef DEBUG
+ fprintf( stderr, "move %s -> %s\n", pTmp, it->aOutputRc.GetBuffer() );
+#endif
+ link( pTmp, it->aOutputRc.GetBuffer() );
+ unlink( pTmp );
+ free( pTmp );
+ }
};
// hxx-Datei schreiben
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx
index 071343592b10..4d0a80f69fcc 100644
--- a/rsc/source/tools/rsctools.cxx
+++ b/rsc/source/tools/rsctools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rsctools.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: pl $ $Date: 2001-10-10 11:51:30 $
+ * last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -281,7 +281,6 @@ char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv,
if( '@' == **(ppArgv +i) ){ // wenn @, dann Response-Datei
if( NULL == (fFile = fopen( (*(ppArgv +i)) +1, "r" )) )
return( (*(ppArgv +i)) );
-
nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile );
while( nItems )
{