added: namespace Winix over all *.h/*.cpp files

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@948 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-02-12 16:30:49 +00:00
parent 145445c713
commit 7468e7a36c
335 changed files with 2452 additions and 505 deletions

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
*/
@@ -20,6 +20,10 @@
#include "core/version.h"
namespace Winix
{
Log log;
Log nlog; // notify log (used by a notification thread)
SLog slog; // session logger
@@ -90,14 +94,18 @@ void LogInfo(LogManipulators log_level, const char * msg, bool put_version, cons
}
} // namespace Winix
int main(int argv, char ** argc)
{
using Winix::app;
std::srand(std::time(0));
if( argv != 2 )
{
print_syntax();
Winix::print_syntax();
return 1;
}
@@ -111,19 +119,19 @@ int main(int argv, char ** argc)
app.config.log_stdout = false;
if( !app.config.log_stdout )
CloseDescriptors();
Winix::CloseDescriptors();
if( app.config.demonize && !app.Demonize() )
return 4;
log.SetTimeZones(&app.system.time_zones);
Winix::log.SetTimeZones(&app.system.time_zones);
log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file,
app.config.log_stdout, app.config.log_request);
Winix::log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file,
app.config.log_stdout, app.config.log_request);
nlog.Init(app.config.log_level, true, app.config.log_notify_file, false, 1);
Winix::nlog.Init(app.config.log_level, true, app.config.log_notify_file, false, 1);
LogInfo(log3, "booting Winix", true, "");
Winix::LogInfo(Winix::log3, "booting Winix", true, "");
if( !app.InitFCGI() )
return 5;
@@ -133,11 +141,11 @@ int main(int argv, char ** argc)
app.LogUserGroups();
log << log3 << "base_url: " << app.config.base_url << logend;
Winix::log << Winix::log3 << "base_url: " << app.config.base_url << Winix::logend;
// load plugins before loading sessions - session_manager.LoadSessions()
// because some of the plugins can init its own sessions dates
plugin.LoadPlugins(app.config.plugins_dir, app.config.plugin_file);
Winix::plugin.LoadPlugins(app.config.plugins_dir, app.config.plugin_file);
// app.Init() starts other threads as well (they will be waiting on the lock)
if( !app.Init() )
@@ -148,15 +156,15 @@ int main(int argv, char ** argc)
// saving all starting logs
app.Lock();
LogInfo(log1, "Winix", true, "started");
log << logsave;
Winix::LogInfo(Winix::log1, "Winix", true, "started");
Winix::log << Winix::logsave;
app.Unlock();
// main loop
app.Start();
app.Lock();
plugin.Call((Session*)0, WINIX_CLOSE);
Winix::plugin.Call((Winix::Session*)0, WINIX_CLOSE);
app.Close();
// now all sessions are cleared
app.Unlock();
@@ -164,7 +172,7 @@ int main(int argv, char ** argc)
app.WaitForThreads();
// now all others threads are terminated
LogInfo(log1, "Winix", true, "stopped");
Winix::LogInfo(Winix::log1, "Winix", true, "stopped");
return 0;
}