Index: cpp/frams/mhandlers/errmanager.cpp
===================================================================
--- cpp/frams/errmgr/errmanager.cpp	(revision 348)
+++ 	(revision )
@@ -1,125 +1,0 @@
-// This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
-// See LICENSE.txt for details.
-
-#include "errmanager.h"
-#include <common/stl-util.h>
-
-void _FramMessageSingleLine(const char *o, const char *m, const char *txt, int w)
-{
-	tlsGetRef(errmgr_instance).send(o, m, txt, w);
-}
-
-THREAD_LOCAL_DEF(ErrorManager, errmgr_instance);
-
-void ErrorManager::send(int level, const char *o, const char *m, const char *bl, int w)
-{
-	if (level >= handlers.size()) level = handlers.size() - 1;
-	bool blocked = 0;
-	for (int i = level; i >= 0; i--)
-	{
-		ErrorHandlerBase *r = handlers(i);
-		if ((!(r->options & ErrorHandlerBase::Paused)) &&
-			((!blocked) || (r->options & ErrorHandlerBase::CannotBeBlocked)))
-		{
-			r->handle(o, m, bl, w);
-			if (!(r->options & ErrorHandlerBase::DontBlock)) blocked = 1;
-		}
-	}
-}
-
-int ErrorManager::add(ErrorHandlerBase *h)
-{
-	h->mgr = this;
-	handlers += h;
-	return handlers.size() - 1;
-}
-
-void ErrorManager::remove(int i)
-{
-	ErrorHandlerBase *h = handlers(i);
-	h->mgr = 0;
-	handlers.remove(i);
-}
-
-void ErrorManager::remove(ErrorHandlerBase *h)
-{
-	int i;
-	if ((i = handlers.find(h)) < 0) return;
-	remove(i);
-}
-
-void ErrorManager::removeAll()
-{
-	while (handlers.size() > 0)
-		remove(handlers.size() - 1);
-}
-
-//////////////////////////////////
-
-void ErrorHandlerBase::send(const char *o, const char *m, const char *bl, int w)
-{
-	if (!isEnabled()) return;
-	int level = mgr->find(this);
-	if (level >= 0) mgr->send(level - 1, o, m, bl, w);
-}
-
-void ErrorHandlerBase::FMprintf(const char *o, const char *m, int w, const char *bl, ...)
-{
-	if (!isEnabled()) return;
-	string buf;
-	va_list argptr;
-	va_start(argptr, bl);
-	buf = ssprintf_va(bl, argptr);
-	va_end(argptr);
-	send(o, m, buf.c_str(), w);
-}
-
-
-void ErrorHandlerBase::enable()
-{
-	if (isEnabled()) return;
-	tlsGetRef(errmgr_instance).add(this);
-}
-
-void ErrorHandlerBase::disable()
-{
-	if (!isEnabled()) return;
-	tlsGetRef(errmgr_instance).remove(this);
-}
-
-void ErrorHandlerBase::pause()
-{
-	if (isPaused()) return;
-	options |= Paused;
-}
-
-void ErrorHandlerBase::resume()
-{
-	if (!isPaused()) return;
-	options &= ~Paused;
-}
-
-/////////////////////////////////
-
-void ErrorHandler::handle(const char *o, const char *m, const char *bl, int w)
-{
-	if (w > maxlevel) maxlevel = w;
-	if (w >= FMLV_INFO) infocount++;
-	if (w >= FMLV_WARN) warncount++;
-	if (w >= FMLV_ERROR) errcount++;
-
-	if (w >= storlevel)
-	{
-		storcount++;
-		if (options & (StoreFirstMessage | StoreAllMessages))
-		{
-			if (!((options&StoreFirstMessage) && (msgs.len() > 0)))
-			{
-				if (msgs.len() > 0) msgs += '\n';
-				msgs += o; msgs += "::"; msgs += m;
-				msgs += " - "; msgs += bl;
-			}
-		}
-	}
-}
Index: cpp/frams/mhandlers/errmanager.h
===================================================================
--- cpp/frams/errmgr/errmanager.h	(revision 348)
+++ 	(revision )
@@ -1,118 +1,0 @@
-// This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
-// See LICENSE.txt for details.
-
-#ifndef _ERRMANAGER_H_
-#define _ERRMANAGER_H_
-
-#include <frams/util/list.h>
-#include <frams/util/sstring.h>
-#include <common/framsg.h>
-#include <common/threads.h>
-
-class ErrorHandlerBase;
-
-class ErrorManager
-{
-	friend class ErrorHandlerBase;
-	SListTempl<ErrorHandlerBase*> handlers;
-	void send(int level, const char *o, const char *m, const char *bl, int w);
-public:
-	int find(ErrorHandlerBase *r) { return handlers.find(r); }
-	int add(ErrorHandlerBase *r);
-	void remove(int i);
-	void remove(ErrorHandlerBase *r);
-	void removeAll();
-	void send(const char *o, const char *m, const char *bl, int w)
-	{
-		send(handlers.size() - 1, o, m, bl, w);
-	}
-	~ErrorManager() { removeAll(); }
-};
-
-extern THREAD_LOCAL_DECL(ErrorManager, errmgr_instance);
-
-////////////////////////////////////////
-
-class ErrorHandlerBase
-{
-	friend class ErrorManager;
-protected:
-	ErrorManager* mgr;
-	int options;
-
-public:
-
-	enum HandlerOptions
-	{
-		DontBlock = 1, CannotBeBlocked = 2, DontEnable = 4, Paused = 8
-	};
-
-	void FMprintf(const char *o, const char *m, int w, const char *bl, ...);
-	void send(const char *o, const char *m, const char *bl, int w);
-
-	bool isEnabled() { return mgr ? 1 : 0; }
-	void enable();
-	void disable();
-	bool isPaused() { return (options & Paused) != 0; }
-	void pause();
-	void resume();
-
-	ErrorHandlerBase(int opts = 0) :mgr(0), options(opts)
-	{
-		if (!(options&DontEnable)) enable();
-	}
-	virtual ~ErrorHandlerBase()
-	{
-		disable();
-	}
-
-	virtual void handle(const char *o, const char *m, const char *bl, int w) {}
-};
-
-///////////////////////////////////////////
-
-class ErrorHandler : public ErrorHandlerBase
-{
-protected:
-	int maxlevel, errcount, warncount, storlevel, storcount, infocount;
-	SString msgs;
-
-public:
-
-	void reset() { maxlevel = FMLV_INFO - 1; errcount = warncount = storcount = infocount = 0; msgs = 0; }
-
-	enum Options2
-	{
-		StoreFirstMessage = 16, StoreAllMessages = 32
-	};
-
-	int getErrorCount()       { return errcount; }
-	int getWarningCount()     { return warncount; }
-	int getInfoCount()        { return infocount; }
-	int getStoredCount()      { return storcount; }
-	int getErrorLevel()       { return maxlevel; }
-	const SString& getMessages() { return msgs; }
-
-	ErrorHandler(int opts = 0, int store = FMLV_ERROR) :ErrorHandlerBase(opts), storlevel(store)
-	{
-		reset();
-	}
-
-	void handle(const char *o, const char *m, const char *bl, int w);
-};
-
-class ErrorRedirector : public ErrorHandlerBase
-{
-	ErrorManager *other_mgr;
-public:
-	ErrorRedirector(ErrorManager *om)
-		:ErrorHandlerBase(), other_mgr(om) {}
-
-	void handle(const char *o, const char *m, const char *bl, int w)
-	{
-		other_mgr->send(o, m, bl, w);
-	}
-};
-
-#endif
Index: cpp/frams/mhandlers/mhandlers.cpp
===================================================================
--- cpp/frams/mhandlers/mhandlers.cpp	(revision 372)
+++ cpp/frams/mhandlers/mhandlers.cpp	(revision 372)
@@ -0,0 +1,125 @@
+// This file is a part of Framsticks SDK.  http://www.framsticks.com/
+// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// See LICENSE.txt for details.
+
+#include "mhandlers.h"
+#include <common/stl-util.h>
+
+void _HmessageSingleLine(const char *o, const char *m, const char *txt, int w)
+{
+	tlsGetRef(message_handler_manager_instance).send(o, m, txt, w);
+}
+
+THREAD_LOCAL_DEF(MessageHandlerManager, message_handler_manager_instance);
+
+void MessageHandlerManager::send(int level, const char *o, const char *m, const char *bl, int w)
+{
+	if (level >= handlers.size()) level = handlers.size() - 1;
+	bool blocked = 0;
+	for (int i = level; i >= 0; i--)
+	{
+		MessageHandlerBase *r = handlers(i);
+		if ((!(r->options & MessageHandlerBase::Paused)) &&
+			((!blocked) || (r->options & MessageHandlerBase::CannotBeBlocked)))
+		{
+			r->handle(o, m, bl, w);
+			if (!(r->options & MessageHandlerBase::DontBlock)) blocked = 1;
+		}
+	}
+}
+
+int MessageHandlerManager::add(MessageHandlerBase *h)
+{
+	h->mgr = this;
+	handlers += h;
+	return handlers.size() - 1;
+}
+
+void MessageHandlerManager::remove(int i)
+{
+	MessageHandlerBase *h = handlers(i);
+	h->mgr = 0;
+	handlers.remove(i);
+}
+
+void MessageHandlerManager::remove(MessageHandlerBase *h)
+{
+	int i;
+	if ((i = handlers.find(h)) < 0) return;
+	remove(i);
+}
+
+void MessageHandlerManager::removeAll()
+{
+	while (handlers.size() > 0)
+		remove(handlers.size() - 1);
+}
+
+//////////////////////////////////
+
+void MessageHandlerBase::send(const char *o, const char *m, const char *bl, int w)
+{
+	if (!isEnabled()) return;
+	int level = mgr->find(this);
+	if (level >= 0) mgr->send(level - 1, o, m, bl, w);
+}
+
+void MessageHandlerBase::Hprintf(const char *o, const char *m, int w, const char *bl, ...)
+{
+	if (!isEnabled()) return;
+	string buf;
+	va_list argptr;
+	va_start(argptr, bl);
+	buf = ssprintf_va(bl, argptr);
+	va_end(argptr);
+	send(o, m, buf.c_str(), w);
+}
+
+
+void MessageHandlerBase::enable()
+{
+	if (isEnabled()) return;
+	tlsGetRef(message_handler_manager_instance).add(this);
+}
+
+void MessageHandlerBase::disable()
+{
+	if (!isEnabled()) return;
+	tlsGetRef(message_handler_manager_instance).remove(this);
+}
+
+void MessageHandlerBase::pause()
+{
+	if (isPaused()) return;
+	options |= Paused;
+}
+
+void MessageHandlerBase::resume()
+{
+	if (!isPaused()) return;
+	options &= ~Paused;
+}
+
+/////////////////////////////////
+
+void MessageHandlerToMemory::handle(const char *o, const char *m, const char *bl, int w)
+{
+	if (w > maxlevel) maxlevel = w;
+	if (w >= HMLV_INFO) infocount++;
+	if (w >= HMLV_WARN) warncount++;
+	if (w >= HMLV_ERROR) errcount++;
+
+	if (w >= storlevel)
+	{
+		storcount++;
+		if (options & (StoreFirstMessage | StoreAllMessages))
+		{
+			if (!((options&StoreFirstMessage) && (msgs.len() > 0)))
+			{
+				if (msgs.len() > 0) msgs += '\n';
+				msgs += o; msgs += "::"; msgs += m;
+				msgs += " - "; msgs += bl;
+			}
+		}
+	}
+}
Index: cpp/frams/mhandlers/mhandlers.h
===================================================================
--- cpp/frams/mhandlers/mhandlers.h	(revision 372)
+++ cpp/frams/mhandlers/mhandlers.h	(revision 372)
@@ -0,0 +1,118 @@
+// This file is a part of Framsticks SDK.  http://www.framsticks.com/
+// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// See LICENSE.txt for details.
+
+#ifndef _MHANDLERS_H_
+#define _MHANDLERS_H_
+
+#include <frams/util/list.h>
+#include <frams/util/sstring.h>
+#include <common/hmessage.h>
+#include <common/threads.h>
+
+class MessageHandlerBase;
+
+class MessageHandlerManager
+{
+	friend class MessageHandlerBase;
+	SListTempl<MessageHandlerBase*> handlers;
+	void send(int level, const char *o, const char *m, const char *bl, int w);
+public:
+	int find(MessageHandlerBase *r) { return handlers.find(r); }
+	int add(MessageHandlerBase *r);
+	void remove(int i);
+	void remove(MessageHandlerBase *r);
+	void removeAll();
+	void send(const char *o, const char *m, const char *bl, int w)
+	{
+		send(handlers.size() - 1, o, m, bl, w);
+	}
+	~MessageHandlerManager() { removeAll(); }
+};
+
+extern THREAD_LOCAL_DECL(MessageHandlerManager, message_handler_manager_instance);
+
+////////////////////////////////////////
+
+class MessageHandlerBase
+{
+	friend class MessageHandlerManager;
+protected:
+	MessageHandlerManager* mgr;
+	int options;
+
+public:
+
+	enum HandlerOptions
+	{
+		DontBlock = 1, CannotBeBlocked = 2, Enable = 4, Paused = 8
+	};
+
+	void Hprintf(const char *o, const char *m, int w, const char *bl, ...);
+	void send(const char *o, const char *m, const char *bl, int w);
+
+	bool isEnabled() { return mgr ? 1 : 0; }
+	void enable();
+	void disable();
+	bool isPaused() { return (options & Paused) != 0; }
+	void pause();
+	void resume();
+
+	MessageHandlerBase(int opts = 0) :mgr(0), options(opts)
+	{
+		if (options&Enable) enable();
+	}
+	virtual ~MessageHandlerBase()
+	{
+		disable();
+	}
+
+	virtual void handle(const char *o, const char *m, const char *bl, int w) {}
+};
+
+///////////////////////////////////////////
+
+class MessageHandlerToMemory : public MessageHandlerBase
+{
+protected:
+	int maxlevel, errcount, warncount, storlevel, storcount, infocount;
+	SString msgs;
+
+public:
+
+	void reset() { maxlevel = HMLV_INFO - 1; errcount = warncount = storcount = infocount = 0; msgs = 0; }
+
+	enum Options2
+	{
+		StoreFirstMessage = 16, StoreAllMessages = 32
+	};
+
+	int getErrorCount()       { return errcount; }
+	int getWarningCount()     { return warncount; }
+	int getInfoCount()        { return infocount; }
+	int getStoredCount()      { return storcount; }
+	int getErrorLevel()       { return maxlevel; }
+	const SString& getMessages() { return msgs; }
+
+	MessageHandlerToMemory(int opts = 0, int minimal_level_to_store = HMLV_ERROR) :MessageHandlerBase(opts), storlevel(minimal_level_to_store)
+	{
+		reset();
+	}
+
+	void handle(const char *o, const char *m, const char *bl, int w);
+};
+
+class RedirectingMessageHandler : public MessageHandlerBase
+{
+	MessageHandlerManager *other_mgr;
+public:
+	RedirectingMessageHandler(MessageHandlerManager *om,int opts=0)
+		:MessageHandlerBase(opts), other_mgr(om) {}
+
+	void handle(const char *o, const char *m, const char *bl, int w)
+	{
+		other_mgr->send(o, m, bl, w);
+	}
+};
+
+#endif
Index: cpp/frams/mhandlers/stderrors.cpp
===================================================================
--- cpp/frams/errmgr/stderrors.cpp	(revision 348)
+++ cpp/frams/mhandlers/stderrors.cpp	(revision 372)
@@ -5,5 +5,5 @@
 #include "stderrors.h"
 #include <frams/util/sstringutils.h>
-#include <common/framsg.h>
+#include <common/hmessage.h>
 
 bool listIndexCheck(SList* list,int index,const char* msgobj,const char* msgfun)
@@ -13,7 +13,7 @@
 	{
 	if (size>0) 
-		FMprintf(msgobj,msgfun,FMLV_ERROR,"Invalid index %d (allowed range is 0..%d)",index,size-1);
+		Hprintf(msgobj,msgfun,HMLV_ERROR,"Invalid index %d (allowed range is 0..%d)",index,size-1);
 	else
-		FMprintf(msgobj,msgfun,FMLV_ERROR,"Invalid index %d (this list is empty)",index);
+		Hprintf(msgobj,msgfun,HMLV_ERROR,"Invalid index %d (this list is empty)",index);
 	return 0;
 	}
@@ -29,5 +29,5 @@
 	{
 	SString msg2=SString(msg)+": \"%s\" (adjusted to \"%s\")";
-	FMprintf(msgobj,msgfun,FMLV_WARN,msg2.c_str(),in.c_str(),corrected.c_str());
+	Hprintf(msgobj,msgfun,HMLV_WARN,msg2.c_str(),in.c_str(),corrected.c_str());
 	}
 return corrected;
Index: cpp/frams/mhandlers/stdouterr.cpp
===================================================================
--- cpp/frams/errmgr/stdouterr.cpp	(revision 348)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
-// See LICENSE.txt for details.
-
-#include "stdouterr.h"
-#ifdef SHP
-#include <FBaseSys.h> //AppLog
-#else
-#include <stdio.h>
-#endif
-
-void StdoutErrorHandler::handle(const char *o, const char *m, const char *bl, int w)
-{
-	if (w < -1) w = -1; else if (w>3) w = 3;
-#ifdef SHP
-	AppLog(FRAMSG_FORMAT "\n",MSG_LEVEL[w+1],o,m,bl);
-#else
-	if (file)
-		file->printf(FRAMSG_FORMAT "\n", MSG_LEVEL[w + 1], o, m, bl);
-	else
-		printf(FRAMSG_FORMAT "\n", MSG_LEVEL[w + 1], o, m, bl);
-#endif
-}
Index: cpp/frams/mhandlers/stdouterr.h
===================================================================
--- cpp/frams/errmgr/stdouterr.h	(revision 348)
+++ 	(revision )
@@ -1,19 +1,0 @@
-// This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
-// See LICENSE.txt for details.
-
-#ifndef _STDOUTERRORHANDLER_H_
-#define _STDOUTERRORHANDLER_H_
-
-#include "errmanager.h"
-#include <frams/virtfile/virtfile.h>
-
-class StdoutErrorHandler : public ErrorHandlerBase
-{
-	VirtFILE *file;
-public:
-	StdoutErrorHandler(int opts = DontBlock, VirtFILE *_file = NULL) :ErrorHandlerBase(opts), file(_file) {}
-	void handle(const char *o, const char *m, const char *bl, int w);
-};
-
-#endif
Index: cpp/frams/mhandlers/stdouthandler.cpp
===================================================================
--- cpp/frams/mhandlers/stdouthandler.cpp	(revision 372)
+++ cpp/frams/mhandlers/stdouthandler.cpp	(revision 372)
@@ -0,0 +1,23 @@
+// This file is a part of Framsticks SDK.  http://www.framsticks.com/
+// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// See LICENSE.txt for details.
+
+#include "stdouthandler.h"
+#ifdef SHP
+#include <FBaseSys.h> //AppLog
+#else
+#include <stdio.h>
+#endif
+
+void MessageHandlerToStdout::handle(const char *o, const char *m, const char *bl, int w)
+{
+	if (w < -1) w = -1; else if (w>3) w = 3;
+#ifdef SHP
+	AppLog(HMSG_FORMAT "\n",HMSG_LEVEL[w+1],o,m,bl);
+#else
+	if (file)
+		file->printf(HMSG_FORMAT "\n", HMSG_LEVEL[w + 1], o, m, bl);
+	else
+		printf(HMSG_FORMAT "\n", HMSG_LEVEL[w + 1], o, m, bl);
+#endif
+}
Index: cpp/frams/mhandlers/stdouthandler.h
===================================================================
--- cpp/frams/mhandlers/stdouthandler.h	(revision 372)
+++ cpp/frams/mhandlers/stdouthandler.h	(revision 372)
@@ -0,0 +1,19 @@
+// This file is a part of Framsticks SDK.  http://www.framsticks.com/
+// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// See LICENSE.txt for details.
+
+#ifndef _STDOUTHANDLER_H_
+#define _STDOUTHANDLER_H_
+
+#include "mhandlers.h"
+#include <frams/virtfile/virtfile.h>
+
+class MessageHandlerToStdout : public MessageHandlerBase
+{
+	VirtFILE *file;
+public:
+	MessageHandlerToStdout(int opts = 0, VirtFILE *_file = NULL) :MessageHandlerBase(opts), file(_file) {}
+	void handle(const char *o, const char *m, const char *bl, int w);
+};
+
+#endif
