Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include <stdlib.h>
22 : #include <stdio.h>
23 : #include <rscrsc.hxx>
24 : #include <rscdb.hxx>
25 :
26 : /*************** G l o b a l e V a r i a b l e n **********************/
27 : static RscCompiler * pRscCompiler = NULL;
28 : /****************************************************************/
29 : /* */
30 : /* Function : ExitProgram() */
31 : /* */
32 : /* Description : Gibt die Temporaeren Dateien frei. */
33 : /****************************************************************/
34 : #if defined( UNX ) || defined ( GCC ) || defined(__MINGW32__)
35 0 : void ExitProgram( void ){
36 : #else
37 : void cdecl ExitProgram( void ){
38 : #endif
39 0 : if( pRscCompiler )
40 0 : delete pRscCompiler;
41 0 : }
42 :
43 691 : static RscVerbosity lcl_determineVerbosity( int argc, char ** argv )
44 : {
45 23022 : for ( int i = 0; i < argc; ++i )
46 : {
47 22331 : if ( argv[i] == NULL )
48 0 : continue;
49 22331 : if ( rsc_stricmp( argv[i], "-verbose" ) == 0 )
50 0 : return RscVerbosityVerbose;
51 22331 : if ( rsc_stricmp( argv[i], "-quiet" ) == 0 )
52 0 : return RscVerbositySilent;
53 : }
54 691 : return RscVerbosityNormal;
55 : }
56 :
57 691 : int rsc2_main( int argc, char **argv )
58 : {
59 : #ifndef UNX
60 : atexit( ExitProgram );
61 : #endif
62 : #if OSL_DEBUG_LEVEL > 1
63 : fprintf( stderr, "debugging %s\n", argv[0] );
64 : #endif
65 :
66 691 : ERRTYPE aError;
67 :
68 691 : InitRscCompiler();
69 691 : RscError* pErrHdl = new RscError( lcl_determineVerbosity( argc, argv ) );
70 691 : RscCmdLine* pCmdLine = new RscCmdLine( argc, argv, pErrHdl );
71 : RscTypCont* pTypCont = new RscTypCont( pErrHdl,
72 : pCmdLine->nByteOrder,
73 : pCmdLine->aPath,
74 691 : pCmdLine->nCommands );
75 :
76 691 : if( pErrHdl->nErrors )
77 0 : aError = ERR_ERROR;
78 : else{
79 691 : RscCompiler* pCompiler = new RscCompiler( pCmdLine, pTypCont );
80 :
81 691 : pRscCompiler = pCompiler;
82 691 : aError = pCompiler->Start();
83 691 : pRscCompiler = NULL;
84 :
85 691 : delete pCompiler;
86 : }
87 :
88 691 : delete pTypCont;
89 691 : delete pCmdLine;
90 691 : delete pErrHdl;
91 691 : delete pHS; // wird durch InitRscCompiler erzeugt
92 :
93 691 : if( aError.IsOk() )
94 691 : return( 0 );
95 : else
96 0 : return( 1 );
97 : }
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|