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.
This commit is contained in:
parent
86c53492cc
commit
4dfecb62c5
9 changed files with 72 additions and 209 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
// Entry point declaration for modules rscpp and rsc2
|
||||
extern "C"
|
||||
{
|
||||
int rscpp_main(int, char**);
|
||||
}
|
||||
return( WEXITSTATUS( rc ) );
|
||||
}
|
||||
#endif
|
||||
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,22 +163,17 @@ 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;
|
||||
int nRet;
|
||||
ByteString* pString;
|
||||
ByteString aRspFileName; // Response-Datei
|
||||
FILE * fRspFile; // Response-Datei
|
||||
|
||||
aRspFileName = ::GetTmpFileName();
|
||||
fRspFile = fopen( aRspFileName.GetBuffer(), "w" );
|
||||
|
||||
RscVerbosity eVerbosity = RscVerbosityNormal;
|
||||
if( fRspFile )
|
||||
{
|
||||
|
||||
RscPtrPtr aNewCmdL;
|
||||
aNewCmdL.Append( rsc_strdup( "rsc2" ) );
|
||||
|
||||
for (int i = 1; i < (int)(pCmdLine->GetCount() -1); ++i)
|
||||
{
|
||||
if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) )
|
||||
|
@ -212,59 +188,40 @@ static sal_Bool CallRsc2( ByteString aRsc2Name,
|
|||
}
|
||||
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 ) );
|
||||
aNewCmdL.Append( rsc_strdup( (char *)pCmdLine->GetEntry( i ) ) );
|
||||
};
|
||||
|
||||
fprintf( fRspFile, "%s", aSrsName.GetBuffer() );
|
||||
aNewCmdL.Append( rsc_strdup( aSrsName.GetBuffer() ) );
|
||||
|
||||
for ( size_t i = 0, n = pInputList->size(); i < n; ++i )
|
||||
{
|
||||
pString = (*pInputList)[ i ];
|
||||
fprintf( fRspFile, " %s", pString->GetBuffer() );
|
||||
aNewCmdL.Append( rsc_strdup( pString->GetBuffer() ) );
|
||||
};
|
||||
|
||||
fclose( fRspFile );
|
||||
};
|
||||
|
||||
RscPtrPtr aNewCmdL; // Kommandozeile
|
||||
aNewCmdL.Append( rsc_strdup( aRsc2Name.GetBuffer() ) );
|
||||
ByteString aTmpStr( '@' );
|
||||
aTmpStr += aRspFileName;
|
||||
aNewCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) );
|
||||
aNewCmdL.Append( (void *)0 );
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
*
|
||||
************************************************************************/
|
||||
|
||||
#define NOMAIN
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cppdef.h"
|
||||
|
|
|
@ -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: */
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue