summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorPeter Rabi <prabi@caesar.elte.hu>2011-07-14 22:40:18 +0200
committerAndras Timar <atimar@suse.com>2011-07-15 13:31:33 +0200
commit4dfecb62c5e595439cacec3da393c45faf093d9a (patch)
treeb03a4ac9ce018ef9cd793093c0a5f3973fdbb16e /rsc
parent86c53492cc40e2d43bd3dac89698b844df961e0e (diff)
merged the 3 executables into one in module rsc
Also removed the ability to use alternatives for rscpp and rsc2. Contributed under license LGPLv3+/MPL.
Diffstat (limited to 'rsc')
-rw-r--r--rsc/prj/build.lst2
-rw-r--r--rsc/prj/d.lst4
-rw-r--r--rsc/source/prj/gui.cxx11
-rw-r--r--rsc/source/prj/makefile.mk21
-rw-r--r--rsc/source/prj/start.cxx178
-rw-r--r--rsc/source/rscpp/cpp.h4
-rw-r--r--rsc/source/rscpp/cpp1.c2
-rw-r--r--rsc/source/rscpp/cppmain.c43
-rw-r--r--rsc/source/rscpp/makefile.mk16
9 files changed, 72 insertions, 209 deletions
diff --git a/rsc/prj/build.lst b/rsc/prj/build.lst
index a26b9a055b60..d9e775d28e66 100644
--- a/rsc/prj/build.lst
+++ b/rsc/prj/build.lst
@@ -6,4 +6,4 @@ r rsc\source\res nmake - all rsc_res NULL
r rsc\source\parser nmake - all rsc_pars NULL
r rsc\source\rsc nmake - all rsc_rsc NULL
r rsc\source\rscpp nmake - all rsc_cpp NULL
-r rsc\source\prj nmake - all rsc_sprj rsc_misc rsc_pars rsc_res rsc_rsc rsc_tool NULL
+r rsc\source\prj nmake - all rsc_sprj rsc_cpp rsc_misc rsc_pars rsc_res rsc_rsc rsc_tool NULL
diff --git a/rsc/prj/d.lst b/rsc/prj/d.lst
index 984a109cf0a6..9c670b37b25c 100644
--- a/rsc/prj/d.lst
+++ b/rsc/prj/d.lst
@@ -1,9 +1,5 @@
..\%__SRC%\bin\rsc.exe %_DEST%\bin\rsc.exe
-..\%__SRC%\bin\rsc2.exe %_DEST%\bin\rsc2.exe
..\%__SRC%\bin\rsc %_DEST%\bin\rsc
-..\%__SRC%\bin\rsc2 %_DEST%\bin\rsc2
-..\%__SRC%\bin\rscpp.exe %_DEST%\bin\rscpp.exe
-..\%__SRC%\bin\rscpp %_DEST%\bin\rscpp
mkdir: %_DEST%\inc\rsc
..\inc\rsc/rscsfx.hxx %_DEST%\inc\rsc\rscsfx.hxx
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 cee2ae0612be..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,7 +143,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro,
}
}
- nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() );
+ nRet = rscpp_main( pCmdL->GetCount()-1, (char**)pCmdL->GetBlock() );
if ( fRspFile )
#if OSL_DEBUG_LEVEL > 5
@@ -170,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;
@@ -182,89 +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" );
}
- nExit = spawnvp( P_WAIT, aRsc2Name.GetBuffer(), (char* const*)aNewCmdL.GetBlock() );
+ 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 );
}
@@ -280,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;
@@ -294,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 )
{
@@ -327,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;
@@ -379,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;
@@ -391,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/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
-
-