diff options
Diffstat (limited to 'rsc/source')
-rw-r--r-- | rsc/source/misc/rscdbl.cxx | 11 | ||||
-rw-r--r-- | rsc/source/parser/erscerr.cxx | 4 | ||||
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 59 | ||||
-rw-r--r-- | rsc/source/parser/rsckey.cxx | 10 | ||||
-rw-r--r-- | rsc/source/parser/rsclex.cxx | 34 | ||||
-rw-r--r-- | rsc/source/parser/rscpar.cxx | 17 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.cxx | 7 | ||||
-rw-r--r-- | rsc/source/prj/gui.cxx | 11 | ||||
-rw-r--r-- | rsc/source/prj/makefile.mk | 21 | ||||
-rw-r--r-- | rsc/source/prj/start.cxx | 186 | ||||
-rw-r--r-- | rsc/source/res/rscclass.cxx | 27 | ||||
-rw-r--r-- | rsc/source/rsc/rsc.cxx | 60 | ||||
-rw-r--r-- | rsc/source/rscpp/cpp.h | 4 | ||||
-rw-r--r-- | rsc/source/rscpp/cpp1.c | 2 | ||||
-rw-r--r-- | rsc/source/rscpp/cppmain.c | 43 | ||||
-rw-r--r-- | rsc/source/rscpp/makefile.mk | 16 | ||||
-rw-r--r-- | rsc/source/tools/rscdef.cxx | 317 | ||||
-rw-r--r-- | rsc/source/tools/rsctools.cxx | 23 |
18 files changed, 110 insertions, 742 deletions
diff --git a/rsc/source/misc/rscdbl.cxx b/rsc/source/misc/rscdbl.cxx index 5e6faeb47c22..8de91ae9dbbd 100644 --- a/rsc/source/misc/rscdbl.cxx +++ b/rsc/source/misc/rscdbl.cxx @@ -37,11 +37,6 @@ #include <rsctop.hxx> #include "rsclst.hxx" -/************************************************************************* -|* -|* RscTypCont::FillNameIdList() -|* -*************************************************************************/ REResourceList * InsertList( Atom nClassName, const RscId& rId, REResourceList * pList ) { REResourceList * pSubList; @@ -52,7 +47,7 @@ REResourceList * InsertList( Atom nClassName, const RscId& rId, if( pStrClass ) aStrClass = pStrClass; else - aStrClass = ByteString::CreateFromInt32( (long)nClassName ); + aStrClass = rtl::OString::valueOf(static_cast<sal_Int32>(nClassName)); pSubList = new REResourceList( pList, aStrClass, rId ); @@ -110,8 +105,4 @@ void FillList( RscTop * pRscTop, REResourceList * pList, sal_uLong lFileKey ){ }; } -void RscTypCont::FillNameIdList( REResourceList * pList, sal_uLong lFileKey ){ - FillList( pRoot, pList, lFileKey ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx index 23337514b2c5..d323e5229d7b 100644 --- a/rsc/source/parser/erscerr.cxx +++ b/rsc/source/parser/erscerr.cxx @@ -123,9 +123,9 @@ void RscError::WriteError( const ERRTYPE& rError, const char * pMessage ) case ERR_ERROR: { StdLstErr( "!! " ); if( 1 == nErrors ) - StdLstErr( ByteString::CreateFromInt32( nErrors ).GetBuffer() ); + StdLstErr(rtl::OString::valueOf(static_cast<sal_Int32>(nErrors )).getStr()); else - StdLstErr( ByteString::CreateFromInt32( (nErrors -1) ).GetBuffer() ); + StdLstErr(rtl::OString::valueOf(static_cast<sal_Int32>(nErrors -1)).getStr()); StdLstErr( " Error" ); StdLstErr( " found!!" ); } diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index a71b4a51eea2..1c7e544e18eb 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -315,56 +315,6 @@ RscTop * RscTypCont::SearchType( Atom nId ) /************************************************************************* |* -|* RscTypCont :: Search -|* -*************************************************************************/ -RscTop * RscTypCont :: Search( Atom nRT ){ - return( (RscTop *)pRoot->Search( nRT ) ); -} - -CLASS_DATA RscTypCont :: Search( Atom nRT, const RscId & rId ){ - ObjNode *pObjNode; - RscTop *pRscTop; - - if( NULL != (pRscTop = Search( nRT )) ){ - if( NULL != (pObjNode = pRscTop->GetObjNode( rId )) ){ - return( pObjNode->GetRscObj() ); - } - } - return( (CLASS_DATA)0 ); -} - -/************************************************************************* -|* -|* RscTypCont :: Delete() -|* -*************************************************************************/ -void RscTypCont :: Delete( Atom nRT, const RscId & rId ){ - ObjNode * pObjNode; - RscTop * pRscTop; - - if( NULL != (pRscTop = Search( nRT )) ){ - if( NULL != (pObjNode = pRscTop->GetObjNode()) ){ - pObjNode = pObjNode->Search( rId ); - - if( pObjNode ){ - //Objekt aus Baum entfernen - pRscTop->pObjBiTree = - (ObjNode *)pRscTop->pObjBiTree->Remove( pObjNode ); - - if( pObjNode->GetRscObj() ){ - pRscTop->Destroy( RSCINST( pRscTop, - pObjNode->GetRscObj() ) ); - rtl_freeMemory( pObjNode->GetRscObj() ); - } - delete pObjNode; - } - } - } -} - -/************************************************************************* -|* |* RscTypCont :: PutSysName() |* *************************************************************************/ @@ -969,11 +919,6 @@ void RscTypCont :: Delete( sal_uLong lFileKey ){ aFileTab.DeleteFileContext( lFileKey ); } -/************************************************************************* -|* -|* RscTypCont :: MakeConsistent() -|* -*************************************************************************/ sal_Bool IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop ) { sal_Bool bRet = sal_True; @@ -1021,10 +966,6 @@ sal_Bool MakeConsistent( RscTop * pRscTop ) return bRet; } -sal_Bool RscTypCont :: MakeConsistent(){ - return( ::MakeConsistent( pRoot ) ); -} - sal_uInt32 RscTypCont::PutTranslatorKey( sal_uInt64 nKey ) { aIdTranslator[ nKey ] = nFilePos; diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx index 621ab4d69598..bdd21e89742f 100644 --- a/rsc/source/parser/rsckey.cxx +++ b/rsc/source/parser/rsckey.cxx @@ -122,11 +122,6 @@ Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, long nValue ) return( Put( pHS->getID( pName ), nTyp, nValue ) ); }; -Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp ) -{ - return( Put( nName, nTyp, (long)nName ) ); -}; - Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) { Atom nId; @@ -140,11 +135,6 @@ Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ) return( Put( nName, nTyp, (long)pClass ) ); }; -Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, RscTop * pClass ) -{ - return( Put( pHS->getID( pName ), nTyp, (long)pClass ) ); -}; - /************************************************************************* |* |* RscNameTable::Get() diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 47be75549220..e9e4a0ebb9d0 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -413,38 +413,4 @@ ERRTYPE parser( RscFileInst * pFileInst ) return( aError ); } -RscExpression * MacroParser( RscFileInst & rFileInst ) -{ - ERRTYPE aError; - RscExpression * pExpression; - - InitParser( &rFileInst ); - - //Ziel auf macro_expression setzen - aKeyVal[ 0 ].nKeyWord = MACROTARGET; - bTargetDefined = sal_True; - aError = yyparse(); - - pExpression = pExp; - //EndParser() wuerde pExp loeschen - if( pExp ) - pExp = NULL; - - EndParser(); - - // yyparser gibt 0 zurueck, wenn erfolgreich - if( 0 == aError ) - aError.Clear(); - if( rFileInst.pTypCont->pEH->nErrors ) - aError = ERR_ERROR; - rFileInst.SetError( aError ); - - //im Fehlerfall pExpression loeschen - if( aError.IsError() && pExpression ){ - delete pExpression; - pExpression = NULL; - }; - return( pExpression ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx index fc3c44c8754d..d3dc291c5631 100644 --- a/rsc/source/parser/rscpar.cxx +++ b/rsc/source/parser/rscpar.cxx @@ -72,23 +72,6 @@ RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, pInput = (char *)rtl_allocateMemory( nInputBufLen ); } -RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, - sal_uLong lFIndex, const ByteString& rBuf ) -{ - pTypCont = pTC; - Init(); - lFileIndex = lFIndex; - lSrcIndex = lIndexSrc; - fInputFile = NULL; - nInputPos = 0; - nInputEndPos = rBuf.Len(); - - // Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos - nInputBufLen = nInputEndPos +1; - pInput = (char *)rtl_allocateMemory( nInputBufLen +100 ); - memcpy( pInput, rBuf.GetBuffer(), nInputEndPos ); -} - /************************************************************************* |* |* RscFileInst::~RscFileInst() diff --git a/rsc/source/parser/rscyacc.cxx b/rsc/source/parser/rscyacc.cxx index c795abcc1fc9..f812523d9dc1 100644 --- a/rsc/source/parser/rscyacc.cxx +++ b/rsc/source/parser/rscyacc.cxx @@ -111,15 +111,16 @@ void SetString( const RSCINST & rInst, const char * pVarName, const char * pStr RscId MakeRscId( RscExpType aExpType ) { - if( !aExpType.IsNothing() ){ - sal_Int32 lValue; + if( !aExpType.IsNothing() ) + { + sal_Int32 lValue(0); if( !aExpType.Evaluate( &lValue ) ) pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); if( lValue < 1 || lValue > (sal_Int32)0x7FFF ) { pTC->pEH->Error( ERR_IDRANGE, NULL, RscId(), - ByteString::CreateFromInt32( lValue ).GetBuffer() ); + rtl::OString::valueOf(lValue).getStr() ); } if( aExpType.IsDefinition() ) diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx index 42d45caeb433..a25413492e1d 100644 --- a/rsc/source/prj/gui.cxx +++ b/rsc/source/prj/gui.cxx @@ -31,7 +31,6 @@ #include <stdlib.h> #include <stdio.h> -#include <sal/main.h> #include <rscrsc.hxx> #include <rscdb.hxx> @@ -66,7 +65,8 @@ RscVerbosity lcl_determineVerbosity( int argc, char ** argv ) return RscVerbosityNormal; } -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { +int rsc2_main( int argc, char **argv ) +{ #ifndef UNX atexit( ExitProgram ); #endif @@ -107,11 +107,4 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { return( 1 ); } -void RscExit( sal_uInt32 nExit ) -{ - if( nExit ) - printf( "Program exit is %ud\n", (unsigned int)nExit ); - exit( nExit ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/prj/makefile.mk b/rsc/source/prj/makefile.mk index 9a504e3de78e..d496919cca23 100644 --- a/rsc/source/prj/makefile.mk +++ b/rsc/source/prj/makefile.mk @@ -45,22 +45,17 @@ OBJFILES= $(OBJ)$/gui.obj \ APP1TARGET= rsc APP1STDLIBS=$(TOOLSLIB) $(I18NISOLANGLIB) $(SALLIB) # $(RTLLIB) -APP1LIBS= $(LB)$/rsctoo.lib -APP1OBJS= $(OBJ)$/start.obj +APP1LIBS= $(LB)$/rscmis.lib \ + $(LB)$/rscpar.lib \ + $(LB)$/rscres.lib \ + $(LB)$/rscrsc.lib \ + $(LB)$/rscpp.lib \ + $(LB)$/rsctoo.lib +APP1OBJS= $(OBJ)$/start.obj \ + $(OBJ)$/gui.obj APP1STACK=64000 APP1RPATH=NONE -APP2TARGET= rsc2 -APP2STDLIBS=$(TOOLSLIB) $(I18NISOLANGLIB) $(SALLIB) # $(RTLLIB) -APP2LIBS= $(LB)$/rsctoo.lib \ - $(LB)$/rscres.lib \ - $(LB)$/rscpar.lib \ - $(LB)$/rscrsc.lib \ - $(LB)$/rscmis.lib -APP2OBJS= $(OBJ)$/gui.obj -APP2STACK=64000 -APP2RPATH=NONE - # --- Targets ------------------------------------------------------------ .INCLUDE : target.mk diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index 8a949546ce3a..be085254354f 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -50,39 +50,20 @@ #include <tools/fsys.hxx> /*************** C O D E ************************************************/ -/****************************************************************/ -/* */ -/* Function : fuer Ansi kompatibilitaet */ -/* */ -/****************************************************************/ -#ifdef UNX -#define P_WAIT 0 - int spawnvp( int, const char * cmdname, char *const* argv ){ - int rc(0); - - switch( fork() ){ - case -1: - return( -1 ); - case 0: - if( execvp( cmdname, argv ) == -1 ) - // an error occurs - return( -1 ); - break; - default: - if( -1 == wait( &rc ) ) - return( -1 ); - } - return( WEXITSTATUS( rc ) ); - } -#endif + +// Entry point declaration for modules rscpp and rsc2 +extern "C" +{ + int rscpp_main(int, char**); +} +int rsc2_main(int, char**); /************************************************************************* |* CallPrePro() |* |* Beschreibung *************************************************************************/ -static sal_Bool CallPrePro( const ByteString& rPrePro, - const ByteString& rInput, +static sal_Bool CallPrePro( const ByteString& rInput, const ByteString& rOutput, RscPtrPtr * pCmdLine, sal_Bool bResponse ) @@ -90,7 +71,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, RscPtrPtr aNewCmdL; // Kommandozeile RscPtrPtr aRespCmdL; // Kommandozeile RscPtrPtr * pCmdL = &aNewCmdL; - int i, nExit; + int i, nRet; FILE* fRspFile = NULL; ByteString aRspFileName; @@ -101,7 +82,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, } if( !fRspFile ) - aNewCmdL.Append( rsc_strdup( rPrePro.GetBuffer() ) ); + aNewCmdL.Append( rsc_strdup( "rscpp" ) ); bool bVerbose = false; for( i = 1; i < int(pCmdLine->GetCount() -1); i++ ) @@ -137,7 +118,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, if( fRspFile ) { - aRespCmdL.Append( rsc_strdup( rPrePro.GetBuffer() ) ); + aRespCmdL.Append( rsc_strdup( "rscpp" ) ); ByteString aTmpStr( '@' ); aTmpStr += aRspFileName; aRespCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) ); @@ -162,11 +143,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, } } -#if defined UNX - nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() ); -#else - nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char**)pCmdL->GetBlock() ); -#endif + nRet = rscpp_main( pCmdL->GetCount()-1, (char**)pCmdL->GetBlock() ); if ( fRspFile ) #if OSL_DEBUG_LEVEL > 5 @@ -174,7 +151,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, #else unlink( aRspFileName.GetBuffer() ); #endif - if ( nExit ) + if ( nRet ) return sal_False; return sal_True; @@ -186,93 +163,65 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, |* |* Beschreibung *************************************************************************/ -static sal_Bool CallRsc2( ByteString aRsc2Name, - RscStrList * pInputList, +static sal_Bool CallRsc2( RscStrList * pInputList, ByteString aSrsName, RscPtrPtr * pCmdLine ) { - int nExit; - ByteString* pString; - ByteString aRspFileName; // Response-Datei - FILE * fRspFile; // Response-Datei + int nRet; + ByteString* pString; + RscVerbosity eVerbosity = RscVerbosityNormal; - aRspFileName = ::GetTmpFileName(); - fRspFile = fopen( aRspFileName.GetBuffer(), "w" ); + RscPtrPtr aNewCmdL; + aNewCmdL.Append( rsc_strdup( "rsc2" ) ); - RscVerbosity eVerbosity = RscVerbosityNormal; - if( fRspFile ) + for (int i = 1; i < (int)(pCmdLine->GetCount() -1); ++i) { - for (int i = 1; i < (int)(pCmdLine->GetCount() -1); ++i) + if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) ) { - if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) ) - { - eVerbosity = RscVerbosityVerbose; - continue; - } - if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-quiet" ) ) - { - eVerbosity = RscVerbositySilent; - continue; - } - if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-pp=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rsc2=", 6 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) - // Am I the only one that thinks the following line inludes all the tests before? - || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) - { - } - else - fprintf( fRspFile, "%s ", - (const char *)pCmdLine->GetEntry( i ) ); - }; - - fprintf( fRspFile, "%s", aSrsName.GetBuffer() ); - - for ( size_t i = 0, n = pInputList->size(); i < n; ++i ) + eVerbosity = RscVerbosityVerbose; + continue; + } + if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-quiet" ) ) { - pString = (*pInputList)[ i ]; - fprintf( fRspFile, " %s", pString->GetBuffer() ); - }; - - fclose( fRspFile ); + eVerbosity = RscVerbositySilent; + continue; + } + if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) + || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) + { + } + else + aNewCmdL.Append( rsc_strdup( (char *)pCmdLine->GetEntry( i ) ) ); }; - RscPtrPtr aNewCmdL; // Kommandozeile - aNewCmdL.Append( rsc_strdup( aRsc2Name.GetBuffer() ) ); - ByteString aTmpStr( '@' ); - aTmpStr += aRspFileName; - aNewCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) ); - aNewCmdL.Append( (void *)0 ); + aNewCmdL.Append( rsc_strdup( aSrsName.GetBuffer() ) ); + + for ( size_t i = 0, n = pInputList->size(); i < n; ++i ) + { + pString = (*pInputList)[ i ]; + aNewCmdL.Append( rsc_strdup( pString->GetBuffer() ) ); + }; if ( eVerbosity >= RscVerbosityVerbose ) { printf( "Rsc2 commandline: " ); - printf( "%s", (const char *)aNewCmdL.GetEntry( 0 ) ); - printf( " " ); - printf( "%s", (const char *)aNewCmdL.GetEntry( 1 ) ); + for( size_t i = 0; i < (unsigned int)(aNewCmdL.GetCount() -1); i++ ) + { + printf( " %s", (const char *)aNewCmdL.GetEntry( i ) ); + } printf( "\n" ); } -#if defined UNX - nExit = spawnvp( P_WAIT, aRsc2Name.GetBuffer(), (char* const*)aNewCmdL.GetBlock() ); -#else - nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char**)aNewCmdL.GetBlock() ); -#endif + nRet = rsc2_main( aNewCmdL.GetCount(), (char**)aNewCmdL.GetBlock() ); - if( fRspFile ) - #if OSL_DEBUG_LEVEL > 5 - fprintf( stderr, "leaving response file %s\n", aRspFileName.GetBuffer() ); - #else - unlink( aRspFileName.GetBuffer() ); - #endif - if( nExit ) + if( nRet ) return( sal_False ); return( sal_True ); } @@ -288,10 +237,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_Bool bHelp = sal_False; sal_Bool bError = sal_False; sal_Bool bResponse = sal_False; - ByteString aSolarbin(getenv("SOLARBINDIR")); - ByteString aDelim("/"); - ByteString aPrePro; //( aSolarbin + aDelim + ByteString("rscpp")); - ByteString aRsc2Name; //( aSolarbin + aDelim + ByteString("rsc2")); ByteString aSrsName; ByteString aResName; RscStrList aInputList; @@ -302,14 +247,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_uInt32 i; ByteString* pString; - aPrePro = aSolarbin; - aPrePro += aDelim; - aPrePro += ByteString("rscpp"); - - aRsc2Name = aSolarbin; - aRsc2Name += aDelim; - aRsc2Name += ByteString("rsc2"); - pStr = ::ResponseFile( &aCmdLine, argv, argc ); if( pStr ) { @@ -335,17 +272,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) bHelp = sal_True; } else if( !rsc_strnicmp( (*ppStr) + 1, "presponse", 9 ) ) - { // anderer Name fuer den Preprozessor + { // whether to use response file when parameterising preprocessor bResponse = sal_True; } - else if( !rsc_strnicmp( (*ppStr) + 1, "pp=", 3 ) ) - { // anderer Name fuer den Preprozessor - aPrePro = (*ppStr) + 4; - } - else if( !rsc_strnicmp( (*ppStr) + 1, "rsc2=", 5 ) ) - { // Accept alternate name for the rsc2 compiler - aRsc2Name = (*ppStr) + 6; - } else if( !rsc_strnicmp( (*ppStr) + 1, "fo=", 3 ) ) { // anderer Name fuer .res-file aResName = (*ppStr) + 4; @@ -387,7 +316,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { pString = aInputList[ k ]; aTmpName = ::GetTmpFileName(); - if( !CallPrePro( aPrePro, *pString, aTmpName, &aCmdLine, bResponse ) ) + if( !CallPrePro( *pString, aTmpName, &aCmdLine, bResponse ) ) { printf( "Error starting preprocessor\n" ); bError = sal_True; @@ -399,8 +328,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if( !bError ) { - if( !CallRsc2( aRsc2Name, bPrePro ? &aTmpList : &aInputList, - aSrsName, &aCmdLine ) ) + if( !CallRsc2( bPrePro ? &aTmpList : &aInputList, aSrsName, &aCmdLine ) ) { if( !bHelp ) { diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx index 6f2939cd2fd2..8060c3271240 100644 --- a/rsc/source/res/rscclass.cxx +++ b/rsc/source/res/rscclass.cxx @@ -1124,33 +1124,6 @@ ERRTYPE RscSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, /************************************************************************* |* -|* RscFirstSysDepend::RscFirstSysDepend() -|* -|* Beschreibung -|* -*************************************************************************/ -RscFirstSysDepend::RscFirstSysDepend( Atom nId, sal_uInt32 nTypeId, - RscTop * pSuper ) - : RscSysDepend( nId, nTypeId, pSuper ) -{} - -/************************************************************************* -|* -|* RscFirstSysDepend::WriteRc() -|* -|* Beschreibung -|* -*************************************************************************/ -ERRTYPE RscFirstSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) -{ - ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); - aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra, sal_True ); - return aError; -} - -/************************************************************************* -|* |* RscTupel::RscTupel() |* |* Beschreibung diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx index f8e308a7a47f..6dbf71c3983c 100644 --- a/rsc/source/rsc/rsc.cxx +++ b/rsc/source/rsc/rsc.cxx @@ -113,18 +113,6 @@ void RscCmdLine::Init() |* Beschreibung Kommandozeile interpretierten |* *************************************************************************/ -RscCmdLine::RscCmdLine() -{ - Init(); -} - -/************************************************************************* -|* -|* RscCmdLine::RscCmdLine() -|* -|* Beschreibung Kommandozeile interpretierten -|* -*************************************************************************/ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH ) { char * pStr; @@ -1048,39 +1036,6 @@ void RscCompiler::Append( const ByteString& rOutputSrs, } } -/********************************************************************/ -/* */ -/* Function : GetTmpFileName() */ -/* */ -/* Description : Packt einen Dateinamen in Tmp-Dateiliste. */ -/* */ -/********************************************************************/ -ByteString RscCompiler::GetTmpFileName() -{ - ByteString aFileName; - - aFileName = ::GetTmpFileName(); - return( aFileName ); -} - -/********************************************************************/ -/* */ -/* Function : sal_Bool openinput() */ -/* */ -/* Description : Check to see if the input file exists and can */ -/* be opened for reading. */ -/********************************************************************/ - -void RscCompiler::OpenInput( const ByteString& rInput ) -{ - FILE *fp; - /* try to open the input file */ - if( NULL == (fp = fopen( rInput.GetBuffer(), "r"))) - pTC->pEH->FatalError( ERR_OPENFILE, RscId(), rInput.GetBuffer() ); - - fclose( fp ); -} - /************************************************************************* |* |* GetImageFilePath() @@ -1248,7 +1203,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, sal_Int32 nNumber = atoi( aLine.GetBuffer() ); if( nNumber < 10000 ) - aBaseFileName += ByteString::CreateFromInt32( 0 ); + aBaseFileName += '0'; if( GetImageFilePath( rOutputFile, rContext, aBaseFileName += aLine , aFilePath, pSysListFile ) ) aEntryVector.push_back( ::std::pair< ByteString, sal_Int32 >( aFilePath, nNumber ) ); @@ -1276,14 +1231,15 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, for( sal_uInt32 i = 0; i < aEntryVector.size(); ++i ) { - ByteString aEntryString( "< \"" ); + rtl::OStringBuffer aEntryString( + RTL_CONSTASCII_STRINGPARAM("< \"")); - aEntryString += aEntryVector[ i ].first; - aEntryString += "\"; "; - aEntryString += ByteString::CreateFromInt32( aEntryVector[ i ].second ); - aEntryString += "; >;"; + aEntryString.append(aEntryVector[i].first); + aEntryString.append(RTL_CONSTASCII_STRINGPARAM("\"; ")); + aEntryString.append(static_cast<sal_Int32>(aEntryVector[ i ].second)); + aEntryString.append(RTL_CONSTASCII_STRINGPARAM("; >;")); - aOStm.WriteLine( aEntryString ); + aOStm.WriteLine(aEntryString.makeStringAndClear()); } aOStm.WriteLine( "};" ); diff --git a/rsc/source/rscpp/cpp.h b/rsc/source/rscpp/cpp.h index 8ec451ab9d3d..ddcecc8114c2 100644 --- a/rsc/source/rscpp/cpp.h +++ b/rsc/source/rscpp/cpp.h @@ -290,9 +290,9 @@ extern SIZES size_table[]; /* For #if sizeof sizes */ #ifdef NOMAIN /* BP */ #ifndef _NO_PROTO -int start_cpp( int argc, char *argv[] ); +int rscpp_main( int argc, char **argv ); #endif -#define MAIN start_cpp /* fuer die cpp.lib muss main() geandert werden */ +#define MAIN rscpp_main /* fuer die cpp.lib muss main() geandert werden */ #else #ifdef WNT #define MAIN __cdecl main diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c index 378adaa17c5e..014a14b1e65d 100644 --- a/rsc/source/rscpp/cpp1.c +++ b/rsc/source/rscpp/cpp1.c @@ -26,6 +26,8 @@ * ************************************************************************/ +#define NOMAIN + #include <stdio.h> #include <ctype.h> #include "cppdef.h" diff --git a/rsc/source/rscpp/cppmain.c b/rsc/source/rscpp/cppmain.c deleted file mode 100644 index 144576e2846b..000000000000 --- a/rsc/source/rscpp/cppmain.c +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define NOMAIN - -#include <stdio.h> -#include <ctype.h> -#include "cppdef.h" -#include "cpp.h" - -int main( argc, argv ) - int argc; - char *argv[]; -{ - return( start_cpp( argc, argv ) ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/rscpp/makefile.mk b/rsc/source/rscpp/makefile.mk index 2cec0885ffad..980ef451f542 100644 --- a/rsc/source/rscpp/makefile.mk +++ b/rsc/source/rscpp/makefile.mk @@ -57,13 +57,6 @@ OBJFILES= \ $(OBJ)$/cpp5.obj \ $(OBJ)$/cpp6.obj \ -.IF "$(cpp)" == "" -LIBSALCPPRT=$(0) -APP1TARGET= $(TARGET) -APP1LIBS=$(LB)$/$(TARGET).lib -APP1STACK=32768 -.ENDIF - .IF "$(GUI)"=="UNX" CDEFS+=-Dunix .ENDIF @@ -79,12 +72,3 @@ NOOPTFILES=$(OBJ)$/cpp6.obj # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - -cpp1.c: cppdef.h cpp.h -cpp2.c: cppdef.h cpp.h -cpp3.c: cppdef.h cpp.h -cpp4.c: cppdef.h cpp.h -cpp5.c: cppdef.h cpp.h -cpp6.c: cppdef.h cpp.h - - diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index ad4bab1412a2..8f8754d1b205 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -44,7 +44,6 @@ sal_Bool RscId::bNames = sal_True; |* *************************************************************************/ void RscId::SetNames( sal_Bool bSet ) { bNames = bSet; } -sal_Bool RscId::IsSetNames() { return bNames; } /************************************************************************* |* @@ -170,34 +169,17 @@ RscId::operator sal_Int32() const *************************************************************************/ ByteString RscId::GetName() const { - ByteString aStr; + rtl::OStringBuffer aStr; if ( !aExp.IsNothing() ) { if( bNames ) - aExp.GetMacro( aStr ); + aExp.AppendMacro(aStr); else - aStr = ByteString::CreateFromInt32( GetNumber() ); + aStr.append(GetNumber()); } - return aStr; -} - -/************************************************************************* -|* -|* RscId::GetMacro() -|* -*************************************************************************/ -ByteString RscId::GetMacro() const -{ - ByteString aStr; - - if ( aExp.IsDefinition() ) - aStr = aExp.aExp.pDef->GetMacro(); - else - aExp.GetMacro( aStr ); - - return aStr; + return aStr.makeStringAndClear(); } /****************** R s c D e f i n e ************************************/ @@ -259,27 +241,7 @@ void RscDefine::DefineToNumber() if( pExp ) delete pExp; pExp = NULL; - SetName( ByteString::CreateFromInt32( lId ) ); -} - -/************************************************************************* -|* -|* RscDefine::ChangeMacro() -|* -*************************************************************************/ -void RscDefine::ChangeMacro( RscExpression * pExpression ){ - if( pExp ) - delete pExp; - pExp = pExpression; - pExp->Evaluate( &lId ); -} - -void RscDefine::ChangeMacro( sal_Int32 lIdentifier ){ - if( pExp ){ - delete pExp; - pExp = NULL; - } - lId = lIdentifier; + SetName(rtl::OString::valueOf(lId)); } /************************************************************************* @@ -314,7 +276,7 @@ ByteString RscDefine::GetMacro() { if( pExp ) return pExp->GetMacro(); - return ByteString::CreateFromInt32( lId ); + return rtl::OString::valueOf(lId); } /****************** R s c D e f i n e L i s t ****************************/ @@ -359,35 +321,6 @@ RscDefine * RscDefineList::New( sal_uLong lFileKey, const ByteString & rDefName, return pDef; } -/************************************************************************* -|* -|* RscDefineList::Remove() -|* -*************************************************************************/ -sal_Bool RscDefineList::Remove( RscDefine * pDef ) { - for ( RscSubDefList::iterator it = maList.begin(); it < maList.end(); ++it ) { - if ( *it == pDef ) { - (*it)->DefineToNumber(); - (*it)->DecRef(); - maList.erase( it ); - return sal_True; - } - } - return sal_False; -} - -sal_Bool RscDefineList::Remove( size_t lIndex ) { - if ( lIndex < maList.size() ) { - RscSubDefList::iterator it = maList.begin(); - ::std::advance( it, lIndex ); - (*it)->DefineToNumber(); - (*it)->DecRef(); - maList.erase( it ); - return sal_True; - } - return sal_False; -} - sal_Bool RscDefineList::Remove() { if ( maList.empty() ) return sal_False; @@ -400,29 +333,6 @@ sal_Bool RscDefineList::Remove() { /************************************************************************* |* -|* RscDefineList::Befor() -|* -*************************************************************************/ -sal_Bool RscDefineList::Befor( const RscDefine * pFree, - const RscDefine * pDepend ) -{ - size_t i = 0; - size_t n = maList.size(); - while ( i < n ) { - if ( maList[ i ] == pFree ) { - for ( ++i ; i < n ; ++i ) { - if ( maList[ i ] == pDepend ) { - return sal_True; - } - } - } - ++i; - } - return sal_False; -} - -/************************************************************************* -|* |* RscDefineList::WriteAll() |* *************************************************************************/ @@ -459,23 +369,14 @@ sal_Bool RscExpType::Evaluate( sal_Int32 * plValue ) const{ return sal_True; } -/************************************************************************* -|* -|* RscExpType::GetMacro() -|* -*************************************************************************/ -void RscExpType::GetMacro( ByteString & rStr ) const +void RscExpType::AppendMacro(rtl::OStringBuffer& rStr) const { - ByteString aStr; - if( IsDefinition() ) - { - rStr += aExp.pDef->GetName(); - } + rStr.append(aExp.pDef->GetName()); else if( IsExpression() ) - rStr += aExp.pExp->GetMacro(); + rStr.append(aExp.pExp->GetMacro()); else if( IsNumber() ) - rStr += ByteString::CreateFromInt32( GetLong() ); + rStr.append(GetLong()); } @@ -555,38 +456,38 @@ sal_Bool RscExpression::Evaluate( sal_Int32 * plValue ){ *************************************************************************/ ByteString RscExpression::GetMacro() { - ByteString aLeft; + rtl::OStringBuffer aLeft; // Ausgabeoptimierung if( aLeftExp.IsNothing() ) { if ( '-' == cOperation ) { - aLeft += '('; - aLeft += '-'; + aLeft.append('('); + aLeft.append('-'); } - aRightExp.GetMacro( aLeft ); + aRightExp.AppendMacro(aLeft); if( '-' == cOperation ) - aLeft += ')'; + aLeft.append(')'); } else if( aRightExp.IsNothing() ) - aLeftExp.GetMacro( aLeft ); + aLeftExp.AppendMacro(aLeft); else{ - aLeft += '('; + aLeft.append('('); // linken Zweig auswerten - aLeftExp.GetMacro( aLeft ); + aLeftExp.AppendMacro(aLeft); - aLeft += cOperation; + aLeft.append(cOperation); - aLeft += '('; + aLeft.append('('); // rechten Zweig auswerten - aRightExp.GetMacro( aLeft ); - aLeft += ')'; + aRightExp.AppendMacro(aLeft); + aLeft.append(')'); - aLeft += ')'; + aLeft.append(')'); } - return aLeft; + return aLeft.makeStringAndClear(); } /****************** R s c F i l e ****************************************/ @@ -672,25 +573,6 @@ sal_Bool RscFile :: InsertDependFile( sal_uLong lIncFile, size_t lPos ) return sal_True; } -/************************************************************************* -|* -|* RscFile::RemoveDependFile() -|* -*************************************************************************/ -void RscFile :: RemoveDependFile( sal_uLong lDepFile ) -{ - for ( size_t i = aDepLst.size(); i > 0; ) - { - RscDepend* pDep = aDepLst[ --i ]; - if( pDep->GetFileKey() == lDepFile ) { - RscDependList::iterator it = aDepLst.begin(); - ::std::advance( it, i ); - delete *it; - aDepLst.erase( it ); - } - } -} - /****************** R s c D e f T r e e **********************************/ /************************************************************************* |* @@ -767,10 +649,6 @@ sal_Bool RscDefTree::Evaluate( RscDefine * pDef ){ return sal_True; } -sal_Bool RscDefTree::Evaluate(){ - return Evaluate( pDefRoot ); -} - /****************** R s c F i l e T a b **********************************/ /************************************************************************* |* @@ -828,23 +706,6 @@ RscDefine * RscFileTab::FindDef( const char * pName ){ /************************************************************************* |* -|* RscFileTab::FindDef() -|* -*************************************************************************/ -RscDefine * RscFileTab::FindDef( sal_uLong lFileKey, const ByteString & rName ) -{ - RscDefine * pDef = FindDef( rName ); - - if( pDef ) - //befindet sich das DEFINE in einer Include-Datei in der - //Datei lFileKey - if( Depend( lFileKey, pDef->GetFileKey() ) ) - return pDef; - return NULL; -} - -/************************************************************************* -|* |* RscFileTab::Depend() |* *************************************************************************/ @@ -972,113 +833,6 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const ByteString & rDefName, /************************************************************************* |* -|* RscFileTab::IsDefUsed() -|* -*************************************************************************/ -sal_Bool RscFileTab::IsDefUsed( const ByteString & rDefName ) -{ - RscDefine * pDef = FindDef( rDefName ); - - if( pDef ) - return( pDef->GetRefCount() != 2 ); - - return sal_False; -} - -/************************************************************************* -|* -|* RscFileTab::DeleteDef() -|* -*************************************************************************/ -void RscFileTab::DeleteDef( const ByteString & rDefName ) -{ - RscDefine * pDef = FindDef( rDefName ); - RscFile * pFile; - - if( pDef ){ - pFile = GetFile( pDef->GetFileKey() ); - if( pFile ){ - aDefTree.Remove( pDef ); - pFile->aDefLst.Remove( pDef ); - } - }; -} - -/************************************************************************* -|* -|* RscFileTab::ChangeDef() -|* -*************************************************************************/ -sal_Bool RscFileTab::ChangeDef( const ByteString & rDefName, sal_Int32 lId ) -{ - RscDefine * pDef = FindDef( rDefName ); - - if( pDef ){ - pDef->ChangeMacro( lId ); - //alle Macros neu bewerten - return aDefTree.Evaluate(); - }; - return( sal_False ); -} - -/************************************************************************* -|* -|* RscFileTab::ChangeDef() -|* -*************************************************************************/ -sal_Bool RscFileTab::ChangeDef( const ByteString & rDefName, - RscExpression * pExp ) -{ - RscDefine * pDef = FindDef( rDefName ); - RscFile * pFile; - - if( pDef ) - { - pFile = GetFile( pDef->GetFileKey() ); - sal_uLong lPos = 0; - if( pFile ) - lPos = pFile->aDefLst.GetPos( pDef ); - //Macros in den Expressions sind definiert ? - if( TestDef( pDef->GetFileKey(), lPos, pExp ) ){ - pDef->ChangeMacro( pExp ); - //alle Macros neu bewerten - return aDefTree.Evaluate(); - } - }; - - // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird - // geloescht werden - delete pExp; - - return( sal_False ); -} - -/************************************************************************* -|* -|* RscFileTab::ChangeDefName() -|* -*************************************************************************/ -sal_Bool RscFileTab::ChangeDefName( const ByteString & rDefName, - const ByteString & rNewName ) -{ - RscDefine * pDef = FindDef( rDefName ); - - //Name gefunden ? - if( pDef ){ - // und neuer Name noch nicht bekannt ? - if( !FindDef( pDef->GetFileKey(), rNewName ) ){ - aDefTree.Remove( pDef ); - pDef->SetName( rNewName ); - aDefTree.Insert( pDef ); - return( sal_True ); - } - }; - - return( sal_False ); -} - -/************************************************************************* -|* |* RscFileTab::DeleteFileContext() |* *************************************************************************/ @@ -1099,29 +853,6 @@ void RscFileTab :: DeleteFileContext( sal_uLong lFileKey ){ /************************************************************************* |* -|* RscFileTab::DeleteFile() -|* -*************************************************************************/ -void RscFileTab :: DeleteFile( sal_uLong lFileKey ){ - RscFile * pFName; - - //Defines freigeben - DeleteFileContext( lFileKey ); - - //Schleife ueber alle Abhaengigkeiten - pFName = First(); - while( pFName ){ - pFName->RemoveDependFile( lFileKey ); - pFName = Next(); - }; - - pFName = Remove( lFileKey ); - if( pFName ) - delete pFName; -} - -/************************************************************************* -|* |* RscFileTab::NewCodeFile() |* *************************************************************************/ diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index ec0931607c44..006b225c04ae 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -177,29 +177,6 @@ sal_Bool Append( ByteString aOutputSrs, ByteString aTmpFile ) /************************************************************************* |* -|* InputFile -|* -|* Beschreibung Haengt Extension an, wenn keine da ist -|* Parameter: pInput, der Input-Dateiname. -|* pExt, die Extension des Ausgabenamens -|* -*************************************************************************/ -ByteString InputFile ( const char * pInput, const char * pExt ) -{ - UniString aUniInput( pInput, RTL_TEXTENCODING_ASCII_US ); - DirEntry aFileName( aUniInput ); - - if ( 0 == aFileName.GetExtension().Len() ) - { - UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US ); - aFileName.SetExtension( aExt ); - } - - return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US ); -} - -/************************************************************************* -|* |* OutputFile |* |* Beschreibung Ersetzt Extension durch eine andere |