// ErO Module : private global functions
//
// YB
/////////////////////////////////////////////
#include "StdAfx.h"

#include "ErO_Priv.hpp"

#include "ErO_Op.hpp"

extern BOOL ERO_g_bInitDone;

//************************************************************************
void ERO_fn_vInit()
{
	ASSERT( !ERO_g_bInitDone );

	//Fills lists of messages
	g_cslGravityMessages.AddTail("Warning");
	g_cslGravityMessages.AddTail("Instability Warning");
	g_cslGravityMessages.AddTail("Fatal Error");
	g_cslGravityMessages.AddTail("Unknown ...");

	g_cslGravityExplanations.AddTail("Something happened and it should not");
	g_cslGravityExplanations.AddTail("Something happened which could cause the program to work strangely");
	g_cslGravityExplanations.AddTail("An error has occured and the program will probably fail");
	g_cslGravityExplanations.AddTail("The level of Error is unknown : it could be fatal !");
}

//***************************************************************************
void ErO_fn_vBuildStringListForInfos(CString _csOriginalString,
																		 CStringList *_pclList)
{
	const CString c_csReturn = '\n';

	if ( !_csOriginalString.IsEmpty() )
	{
		CString csTempString(_csOriginalString);
		short wIndex = 0;
		BOOL bReturnFound = FALSE;

		while ( wIndex < csTempString.GetLength() )
		{
			bReturnFound = ( csTempString.GetAt(wIndex) == c_csReturn );

			if ( !bReturnFound )
				wIndex ++;
			else
			{
				_pclList->AddTail(csTempString.Left(wIndex));
				csTempString = csTempString.Right(csTempString.GetLength() - wIndex - 1);

				wIndex = 0;
			}
		}
		_pclList->AddTail(csTempString);
	}
}
