You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

77 lines
2.8 KiB

// MEKOROT.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "MEKOROT.h"
#define LOG( X ) m_pLog->Log( "main", NULL, X )
#define LOG_ERROR( X ) m_pLog->Log( "main", NULL, _LOG_ERROR, X )
int main(){
basicLogCollection * m_pLog = basicLogCollection::getInstance();
objectConsoleLoggingService * m_pCL;
objectFileLoggingService * m_pFL;
config_setting_t * m_pSP = basicSettingsProvider::getInstance((CSTR)"mekorot.conf")->getSubNode(NULL, (CSTR)"GENERAL");
config_setting_t * pSetting = NULL;
mekorotKernel * m_pKRNL;
m_pCL = new objectConsoleLoggingService();
if ( m_pCL ) m_pLog->addHandler( m_pCL );
pSetting = config_setting_get_member( m_pSP, "USE_LOG_FILE" );
if ( pSetting != NULL ) {
if (config_setting_get_bool(pSetting) ) {
char mLogFileName[128];
pSetting = config_setting_get_member(m_pSP, "LOG_FILE_NAME");
if (pSetting != NULL) {
sprintf(mLogFileName, "%s", config_setting_get_string(pSetting));
} else {
sprintf(mLogFileName, "mekorot.log" );
pSetting = config_setting_add(m_pSP, "LOG_FILE_NAME", CONFIG_TYPE_STRING);
basicSettingsProvider::getInstance()->compromise();
if (pSetting == NULL) {
LOG_ERROR("Failure while adding setting!");
return -1;
};
config_setting_set_string(pSetting, mLogFileName);
};
m_pFL = new objectFileLoggingService( mLogFileName );
if ( m_pFL == NULL) {
LOG_ERROR("Failure open log file!");
} else {
m_pLog->addHandler( m_pFL );
};
};
} else {
pSetting = config_setting_add( m_pSP, "USE_LOG_FILE", CONFIG_TYPE_BOOL);
basicSettingsProvider::getInstance()->compromise();
if (pSetting == NULL) {
LOG_ERROR("Failure while adding setting!");
return -1;
};
};
m_pKRNL = new mekorotKernel();
if (m_pKRNL != NULL) {
if (m_pKRNL->init()) {
m_pKRNL->waitThreadEnd();
} else {
LOG_ERROR("Failure during Kernel Thread Start!");
};
} else {
LOG_ERROR("Failure during Kernel Construct!");
};
basicSettingsProvider::getInstance()->validate();
return 0;
}
#undef LOG
#undef LOG_ERROR
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file