Don't add underscore prefix to amd64 symbols
[reactos.git] / reactos / tools / rbuild / autoregister.cpp
1 /*
2 * Copyright (C) 2005 Casper S. Hornstrup
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 #include "pch.h"
19
20 #include "rbuild.h"
21
22 using std::string;
23
24 AutoRegister::AutoRegister ( const Project& project_,
25 const Module* module_,
26 const XMLElement& node_ )
27 : XmlNode(project_, node_),
28 module(module_)
29 {
30 Initialize();
31 }
32
33 bool
34 AutoRegister::IsSupportedModuleType ( ModuleType type )
35 {
36 if ( type == Win32DLL ||
37 type == Win32OCX )
38 {
39 return true;
40 }
41 else
42 {
43 return false;
44 }
45 }
46
47 AutoRegisterType
48 AutoRegister::GetAutoRegisterType( const string& type )
49 {
50 if ( type == "DllRegisterServer" )
51 return DllRegisterServer;
52 if ( type == "DllInstall" )
53 return DllInstall;
54 if ( type == "Both" )
55 return Both;
56 throw XMLInvalidBuildFileException (
57 node.location,
58 "<autoregister> type attribute must be DllRegisterServer, DllInstall or Both." );
59 }
60
61 void
62 AutoRegister::Initialize ()
63 {
64 if ( !IsSupportedModuleType ( module->type ) )
65 {
66 throw XMLInvalidBuildFileException (
67 node.location,
68 "<autoregister> is not applicable for this module type." );
69 }
70
71 const XMLAttribute* att = node.GetAttribute ( "infsection", true );
72 if ( !att )
73 {
74 throw XMLInvalidBuildFileException (
75 node.location,
76 "<autoregister> must have a 'infsection' attribute." );
77 }
78 infSection = att->value;
79
80 att = node.GetAttribute ( "type", true );
81 if ( !att )
82 {
83 throw XMLInvalidBuildFileException (
84 node.location,
85 "<autoregister> must have a 'type' attribute." );
86 }
87 type = GetAutoRegisterType ( att->value );
88 }