54#include <wx/stdpaths.h>
55#include <wx/html/winpars.h>
73int g_SG_OMP_Max_Num_Threads = omp_get_num_procs();
82 else if( iCores > omp_get_num_procs() )
84 iCores = omp_get_num_procs();
87 omp_set_num_threads(g_SG_OMP_Max_Num_Threads = iCores);
93 return( g_SG_OMP_Max_Num_Threads );
99 return( omp_get_num_procs() );
105 return( omp_get_thread_num() );
143 default :
return( bShort ?
_TL(
"none" ) :
_TL(
"undefined" ) );
248 else if( Value > max )
264#if defined(_SAGA_MSW)
265bool SG_Environment_Add_Dll_Paths(
const CSG_String &Directory);
269static struct SSG_Environment
271 bool wxInitialized =
false;
275 wxHtmlTagsModule *pHtmlTags = NULL;
277 CSG_String App_FullPath, App_Path, App_Name, API_Path;
279 CSG_MetaData Options;
291 static bool bInitialized =
false;
336 wxLocale Locale; Locale.Init(wxLANGUAGE_ENGLISH);
338 setlocale(LC_NUMERIC,
"C");
344 #if defined(_SAGA_MSW)
346 SetDefaultDllDirectories(
347 LOAD_LIBRARY_SEARCH_APPLICATION_DIR |
348 LOAD_LIBRARY_SEARCH_USER_DIRS |
349 LOAD_LIBRARY_SEARCH_SYSTEM32
356 API_Path = SAGA_Path;
365 if( !AddDllDirectory(API_Path.
c_str()) )
376 #elif defined(__WXMAC__)
390 #if defined(__WXGTK__)
392 wxApp::GTKSuppressDiagnostics();
395 wxApp::GTKAllowDiagnosticsControl();
437 theEnvironment.App_FullPath = wxStandardPaths::Get().GetExecutablePath().wx_str();
495 #if defined(_SAGA_MSW)
499 #elif defined(__WXMAC__)
503 if( Path.
Find(
"SAGA.app/Contents/MacOS") > 0 )
505 Path = Path.
Left(Path.
Find(
"SAGA.app/Contents/MacOS")) +
"SAGA.app/Contents/Share";
532 #if defined(_SAGA_MSW)
546 #if defined(_SAGA_MSW)
550 #elif defined(__WXMAC__)
554 if( Path.
Find(
"SAGA.app/Contents/MacOS") > 0 )
556 Path = Path.
Left(Path.
Find(
"SAGA.app/Contents/MacOS")) +
"SAGA.app/Contents";
558 Paths += Path +
"/Tools";
559 Paths += Path +
"/Share/toolchains";
589 #if defined(_SAGA_MSW)
595 for(
int i=0; i<Additionals.
Get_Count(); i++)
597 Paths += Additionals[i];
635 return( bGetVariable ?
Get_Variable(Variable, Value) :
false );
653 return(
theEnvironment.Options.Add_Child(Variable, Value) != NULL );
664 return( wxGetEnv(Variable.
wx_str(), NULL) );
671 if( wxGetEnv(Variable.
wx_str(), &s) )
697#if defined(_SAGA_MSW)
698bool SG_Environment_Add_Dll_Paths(
const CSG_String &Directory)
700 wxDir Dir(Directory.
wx_str());
bool bNoWarnings =
true;
706 if( Dir.GetFirst(&Path,
"*.dll", wxDIR_HIDDEN|wxDIR_FILES) )
710 if( !AddDllDirectory(Directory.
c_str()) )
723 if( Dir.GetFirst(&Path,
"pdalcpp.dll", wxDIR_HIDDEN|wxDIR_FILES) )
728 if( Dir.GetFirst(&Path, wxEmptyString, wxDIR_HIDDEN|wxDIR_DIRS) )
738 if( !SG_Environment_Add_Dll_Paths(SubDir) )
743 while( Dir.GetNext(&Path) );
747 return( bNoWarnings );
void SG_UI_Console_Print_StdErr(const char *Text, SG_Char End, bool bFlush)
TSG_Data_Type SG_Data_Type_Get_Type(const CSG_String &Identifier)
int SG_Data_Type_Get_Flag(TSG_Data_Type Type)
void SG_OMP_Set_Max_Num_Threads(int iCores)
int SG_OMP_Get_Max_Num_Procs(void)
static struct SSG_Environment theEnvironment
int SG_OMP_Get_Thread_Num(void)
CSG_String SG_Data_Type_Get_Name(TSG_Data_Type Type, bool bShort)
bool SG_Data_Type_is_Numeric(TSG_Data_Type Type)
bool SG_Set_Environment(const CSG_String &Variable, const CSG_String &Value)
bool SG_Data_Type_Range_Check(TSG_Data_Type Type, double &Value)
bool SG_Get_Environment(const CSG_String &Variable, CSG_String *Value)
int SG_OMP_Get_Max_Num_Threads(void)
CSG_String SG_Data_Type_Get_Identifier(TSG_Data_Type Type)
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
SAGA_API_DLL_EXPORT void SG_UI_Console_Print_StdErr(const char *Text, SG_Char End='\n', bool bFlush=true)
#define SG_DATATYPES_DWord
SAGA_API_DLL_EXPORT void SG_UI_Console_Print_StdOut(const char *Text, SG_Char End='\n', bool bFlush=true)
#define SG_DATATYPES_Byte
#define SG_DATATYPES_Word
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path_Absolute(const CSG_String &full_Path, const CSG_String &CWD="")
#define SG_DATATYPES_Short
#define SG_DATATYPES_String
#define SG_DATATYPES_Double
SAGA_API_DLL_EXPORT void SG_UI_ProgressAndMsg_Lock(bool bOn)
#define SG_DATATYPES_Date
#define SG_DATATYPES_Binary
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path(const CSG_String &full_Path)
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Name(const CSG_String &full_Path, bool bExtension)
SAGA_API_DLL_EXPORT CSG_Strings SG_String_Tokenize(const CSG_String &String, const CSG_String &Delimiters=SG_DEFAULT_DELIMITERS, TSG_String_Tokenizer_Mode Mode=SG_TOKEN_DEFAULT)
#define SG_DATATYPES_Char
const char gSG_Data_Type_Identifier[][32]
SAGA_API_DLL_EXPORT bool SG_Dir_Exists(const CSG_String &Directory)
#define SG_DATATYPES_Undefined
#define SG_DATATYPES_Long
#define SG_DATATYPES_ULong
#define SG_DATATYPES_Color
#define SG_DATATYPES_Float
static bool Set_Option(const CSG_String &Variable, const CSG_String &Value, bool bSetVariable=true)
static const CSG_String & Get_Application_Name(void)
static bool Set_Variable(const CSG_String &Variable, const CSG_String &Value)
static const CSG_String & Get_Application_Path(bool bPathOnly)
static CSG_Strings Get_Tool_Paths(void)
static bool Set_Application_Name(const CSG_String &Name="")
static bool Initialize(bool bInitializeWX=false, bool bInitializeGUI=false, bool bProjections=true, bool bLibraries=false, const SG_Char *SAGA_Path=NULL)
static CSG_String Get_Ressources_Path(const CSG_String &AddPath="")
static const CSG_String & Get_API_Path(void)
static bool Set_API_Path(const CSG_String &Path="")
static bool Get_Variable(const CSG_String &Variable)
static bool is_Python(void)
static CSG_String Get_Option(const CSG_String &Variable, bool bGetVariable=true)
static CSG_String Get_Share_Path(const CSG_String &AddPath="")
static bool Uninitialize(void)
bool Create(bool LoadCodeList=true)
int CmpNoCase(const CSG_String &String) const
int Cmp(const CSG_String &String) const
static CSG_String Format(const char *Format,...)
int Find(char Character, bool fromEnd=false) const
const SG_Char * c_str(void) const
CSG_String Left(size_t count) const
const class wxString & wx_str(void) const
int Get_Count(void) const