update credits
[LibreOffice.git] / rsc / source / prj / gui.cxx
blob4535b56cd2f4ea627d50cf9af10008db0f0a8644
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <rscrsc.hxx>
24 #include <rscdb.hxx>
26 static RscCompiler * pRscCompiler = NULL;
27 #if defined( UNX ) || defined ( __GNUC__ ) || defined(__MINGW32__)
28 void ExitProgram( void ){
29 #else
30 void cdecl ExitProgram( void ){
31 #endif
32 if( pRscCompiler )
33 delete pRscCompiler;
36 static RscVerbosity lcl_determineVerbosity( int argc, char ** argv )
38 for ( int i = 0; i < argc; ++i )
40 if ( argv[i] == NULL )
41 continue;
42 if ( rsc_stricmp( argv[i], "-verbose" ) == 0 )
43 return RscVerbosityVerbose;
44 if ( rsc_stricmp( argv[i], "-quiet" ) == 0 )
45 return RscVerbositySilent;
47 return RscVerbosityNormal;
50 int rsc2_main( int argc, char **argv )
52 #ifndef UNX
53 atexit( ExitProgram );
54 #endif
55 #if OSL_DEBUG_LEVEL > 1
56 fprintf( stderr, "debugging %s\n", argv[0] );
57 #endif
59 ERRTYPE aError;
61 InitRscCompiler();
62 RscError* pErrHdl = new RscError( lcl_determineVerbosity( argc, argv ) );
63 RscCmdLine* pCmdLine = new RscCmdLine( argc, argv, pErrHdl );
64 RscTypCont* pTypCont = new RscTypCont( pErrHdl,
65 pCmdLine->nByteOrder,
66 pCmdLine->aPath,
67 pCmdLine->nCommands );
69 if( pErrHdl->nErrors )
70 aError = ERR_ERROR;
71 else{
72 RscCompiler* pCompiler = new RscCompiler( pCmdLine, pTypCont );
74 pRscCompiler = pCompiler;
75 aError = pCompiler->Start();
76 pRscCompiler = NULL;
78 delete pCompiler;
81 delete pTypCont;
82 delete pCmdLine;
83 delete pErrHdl;
84 delete pHS; // wird durch InitRscCompiler erzeugt
86 if( aError.IsOk() )
87 return( 0 );
88 else
89 return( 1 );
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */