source: dev/branches/x64_compiler_on_32/abdev/ab_common/src/Environment.cpp

Last change on this file was 751, checked in by イグトランス (egtra), 16 years ago

性能がよいというdlmallocを導入。

File size: 1.2 KB
Line 
1#include "stdafx.h"
2
3std::string ActiveBasic::Common::Environment::rootPath;
4bool ActiveBasic::Common::Environment::isRemoveExternal = false;
5
6using namespace ActiveBasic::Common;
7
8void Environment::SetAbdevRootPath( const std::string &rootPath )
9{
10 Environment::rootPath = Jenga::Common::Path::MakeFullPath( rootPath, Jenga::Common::Environment::GetAppDir() );
11}
12const std::string Environment::GetAbdevRootPath()
13{
14 if( rootPath.empty() )
15 {
16 SetAbdevRootPath( "" );
17 }
18 return rootPath;
19}
20
21const std::string Environment::GetUserAppDir()
22{
23 return Jenga::Common::Environment::GetUserAppDir() + "\\ActiveBasic";
24}
25
26const std::string Environment::GetCompilerExePath( Platform::EnumType platform )
27{
28 switch( platform )
29 {
30 case Platform::X86:
31 return rootPath + "\\bin\\x86\\abc.exe";
32 case Platform::X64:
33 return rootPath + "\\bin\\x64\\abc.exe";
34 }
35 throw;
36}
37
38void* operator new( std::size_t n )
39{
40 if ( void* p = dlmalloc(n) ){
41 return p;
42 }
43 else{
44 throw std::bad_alloc();
45 }
46}
47
48void* operator new[]( std::size_t n )
49{
50 return ::operator new( n );
51}
52
53void operator delete( void* p )
54{
55 dlfree( p );
56}
57
58void operator delete[]( void* p )
59{
60 ::operator delete( p );
61}
Note: See TracBrowser for help on using the repository browser.