00001
00002
00003
00004
00005
00006
00007 #include "SgSystem.h"
00008 #include "SgInit.h"
00009
00010 #include <iostream>
00011 #include "SgException.h"
00012 #include "SgMemCheck.h"
00013 #include "SgProp.h"
00014
00015 using namespace std;
00016
00017
00018
00019 namespace {
00020
00021 bool s_isSgInitialized = false;
00022
00023 }
00024
00025
00026
00027 void SgFini()
00028 {
00029 SgProp::Fini();
00030 SgMemCheck();
00031 s_isSgInitialized = false;
00032 }
00033
00034 void SgInitImpl(bool compiledInDebugMode)
00035 {
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef NDEBUG
00044 if (! compiledInDebugMode)
00045 {
00046 cerr <<
00047 "Incompatible library: SmartGame was compiled "
00048 "without NDEBUG, but main program with\n";
00049 abort();
00050 }
00051 #else
00052 if (compiledInDebugMode)
00053 {
00054 cerr << "Incompatible library: SmartGame was compiled "
00055 "with NDEBUG, but main program without\n";
00056 abort();
00057 }
00058 #endif
00059
00060 SgProp::Init();
00061 s_isSgInitialized = true;
00062 }
00063
00064 void SgInitCheck()
00065 {
00066 if (! s_isSgInitialized)
00067 throw SgException("SgInit not called");
00068 }
00069
00070
00071