00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "config_interrogatedb.h"
00020 #include "interrogate_request.h"
00021
00022 #include <dconfig.h>
00023
00024 #if defined(WIN32_VC) && defined(_DEBUG)
00025
00026 #define USE_WIN32_DBGHEAP
00027 #include <crtdbg.h>
00028 #endif
00029
00030 Configure(config_interrogatedb);
00031 NotifyCategoryDef(interrogatedb, "");
00032
00033 ConfigureFn(config_interrogatedb) {
00034
00035
00036 #ifdef USE_WIN32_DBGHEAP
00037 string use_win32_dbgheap_str = config_interrogatedb.GetString("use-win32-dbgheap", "");
00038 bool win32_report_leaks = config_interrogatedb.GetBool("win32-report-leaks", false);
00039
00040 int dbg_flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
00041
00042 if (use_win32_dbgheap_str == "full") {
00043
00044
00045 dbg_flags |= (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF |
00046 _CRTDBG_CHECK_CRT_DF);
00047
00048 } else {
00049
00050
00051 bool use_win32_dbgheap_bool = config_interrogatedb.GetBool("use-win32-dbgheap", false);
00052
00053 if (!use_win32_dbgheap_bool) {
00054
00055
00056
00057 dbg_flags = 0;
00058 }
00059 }
00060
00061 if (win32_report_leaks) {
00062
00063
00064
00065 dbg_flags |= _CRTDBG_LEAK_CHECK_DF;
00066 }
00067
00068 _CrtSetDbgFlag(dbg_flags);
00069 #endif
00070 }
00071
00072 const DSearchPath &
00073 get_interrogatedb_path() {
00074 static DSearchPath *interrogatedb_path = NULL;
00075 if (interrogatedb_path == (DSearchPath *)NULL) {
00076 interrogatedb_path = new DSearchPath(".");
00077 interrogatedb_path->append_path
00078 (config_interrogatedb.GetString("ETC_PATH", "."));
00079 }
00080 return *interrogatedb_path;
00081 }
00082