#include "stdafx.h"
#include <algorithm>		// For reverse template.
#include "UtilCoord.h"		// For mm2lg.etc.
#include "UtilMath.h"		// This header.
#include "RegData.h"		// For hix2mm,mm2hix.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//----- 02.02.08 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64tot10
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_10_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:_xZkqqHx_jFmPiKlHjBmOiPnLiCmMjAjEjCgM_xHqqkZx_.
// *			tcsBuf	:_xZkqqHx_jFmPiKlHiClFiClNjFlGiOjKjHpBiCpAiOpLiCnPiCoJiDgPiDgCiDhEiDeA_xHqqkZx_.
// *
// * < _xZkqqHx_jHoB_xHqqkZx_ >	llNum = 64_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_.
// *			_xZkqqHx_iHeA_xHqqkZx_ llNum = 64
// *			_xZkqqHx_iHeB_xHqqkZx_ lRem = 4
// *			_xZkqqHx_iHeC_xHqqkZx_ tcsBuf[0] = '4';
// *			_xZkqqHx_iHeD_xHqqkZx_ lC = 1
// *			_xZkqqHx_iHeE_xHqqkZx_ llNum = 6
// *			_xZkqqHx_iHeF_xHqqkZx_ lRem = 6
// *			_xZkqqHx_iHeG_xHqqkZx_ tcsBuf[1] = '6'
// *			_xZkqqHx_iHeH_xHqqkZx_ lC = 2
// *			_xZkqqHx_iHeI_xHqqkZx_ llNum = 0
// *			_xZkqqHx_iHeJ_xHqqkZx_ tcsBuf[2] = '\0'
// *			_xZkqqHx_iHeK_xHqqkZx_ tcsBuf = "64"
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.08 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiBeC_xHqqkZx_
// *************************************************************************/
//const _TCHAR* _i64tot10 (__int64 llNum, _TCHAR tcsBuf[])
//{
//	long lC = 0;
//	BOOL bIsMinus = FALSE;
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		tcsBuf[lC++] = _T('0') + (llNum % 10);
//		llNum /= 10;
//	} while (llNum);
//	if (bIsMinus) tcsBuf[lC++] = _T('-');
//	tcsBuf[lC] = _T('\0');
//	_tcsrev(tcsBuf);	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return tcsBuf;
//} // _i64tot10.
//----- 02.02.08 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 02.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64tow10
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_10_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:_xZkqqHx_jFmPiKlHjBmOiPnLiCmMjAjEjCgM_xHqqkZx_.
// *			wcsBuf	:_xZkqqHx_jFmPiKlHiClFiClNjFlGiOjKjHpBiCpAiOpLiCnPiCoJiDgPiDgCiDhEiDeA_xHqqkZx_.
// *
// * < _xZkqqHx_jHoB_xHqqkZx_ >	llNum = 64_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_.
// *			_xZkqqHx_iHeA_xHqqkZx_ llNum = 64
// *			_xZkqqHx_iHeB_xHqqkZx_ lRem = 4
// *			_xZkqqHx_iHeC_xHqqkZx_ wcsBuf[0] = '4';
// *			_xZkqqHx_iHeD_xHqqkZx_ lC = 1
// *			_xZkqqHx_iHeE_xHqqkZx_ llNum = 6
// *			_xZkqqHx_iHeF_xHqqkZx_ lRem = 6
// *			_xZkqqHx_iHeG_xHqqkZx_ wcsBuf[1] = '6'
// *			_xZkqqHx_iHeH_xHqqkZx_ lC = 2
// *			_xZkqqHx_iHeI_xHqqkZx_ llNum = 0
// *			_xZkqqHx_iHeJ_xHqqkZx_ wcsBuf[2] = '\0'
// *			_xZkqqHx_iHeK_xHqqkZx_ wcsBuf = "64"
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.08 Fukushiro M. _xZkqqHx_iPeDjAlDiBeC_xHqqkZx_
// *************************************************************************/
//const wchar_t* _i64tow10 (__int64 llNum, wchar_t wcsBuf[])
//{
//	long lC = 0;
//	BOOL bIsMinus = FALSE;
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		wcsBuf[lC++] = L'0' + (llNum % 10);
//		llNum /= 10;
//	} while (llNum);
//	if (bIsMinus) wcsBuf[lC++] = L'-';
//	wcsBuf[lC] = L'\0';
//	_wcsrev(wcsBuf);	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return wcsBuf;
//} // _i64tow10.
//----- 02.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 02.02.08 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_t10toi64
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	10_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpA_xHqqkZx___int64_xZkqqHx_iCmMjAjEjCgMiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tcsBuf	:_xZkqqHx_jFmPiKlHjBmOiPnLiCmMjFlGiOjKjHpBiCpAiOhHjCoI_xHqqkZx_.
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClDiCoKiClNjCgMiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.08 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiBeC_xHqqkZx_
// *************************************************************************/
//__int64 _t10toi64 (const _TCHAR tcsBuf[])
//{
//	//----- _xZkqqHx_iLpDjEjCiCpAiDfIiDeMiDgCiDhG_xHqqkZx_ -----
//	const _TCHAR* pPtr = tcsBuf;
//	while (*pPtr == _T(' ') || *pPtr == _T('\t')) pPtr++;
//
//	//----- _xZkqqHx_jFiJiCkJiCmHiCkEiCkJjClCiCnHiCoJ_xHqqkZx_ -----
//	BOOL bIsMinus = FALSE;
//	if (*pPtr == _T('-'))
//	{
//		pPtr++;
//		bIsMinus = TRUE;
//	}
//
//	__int64 llVal = 0;
//	int iNum;
//	for (; *pPtr != _T('\0'); pPtr++)
//	{
//		iNum = int(*pPtr) - int(_T('0'));
//		if (iNum < 0 || 9 < iNum) break;
//		llVal *= 10;
//		llVal += iNum;
//	}
//
//	if (bIsMinus) return -llVal;
//	return llVal;
//} // _t10toi64.
//----- 02.02.08 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_w10toi64
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	10_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpA_xHqqkZx___int64_xZkqqHx_iCmMjAjEjCgMiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wcsBuf	:_xZkqqHx_jFmPiKlHjBmOiPnLiCmMjFlGiOjKjHpBiCpAiOhHjCoI_xHqqkZx_.
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClDiCoKiClNjCgMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.08 Fukushiro M. _xZkqqHx_iPeDjAlDiBeC_xHqqkZx_
 *************************************************************************/
__int64 _w10toi64 (const wchar_t wcsBuf[])
{
	//----- _xZkqqHx_iLpDjEjCiCpAiDfIiDeMiDgCiDhG_xHqqkZx_ -----
	const wchar_t* pPtr = wcsBuf;
	while (*pPtr == L' ' || *pPtr == L'\t') pPtr++;

	//----- _xZkqqHx_jFiJiCkJiCmHiCkEiCkJjClCiCnHiCoJ_xHqqkZx_ -----
	BOOL bIsMinus = FALSE;
	if (*pPtr == L'-')
	{
		pPtr++;
		bIsMinus = TRUE;
	}

	__int64 llVal = 0;
	int iNum;
	for (; *pPtr != L'\0'; pPtr++)
	{
		iNum = int(*pPtr) - int(L'0');
		if (iNum < 0 || 9 < iNum) break;
		llVal *= 10;
		llVal += iNum;
	}

	if (bIsMinus) return -llVal;
	return llVal;
} // _w10toi64.

//----- 02.02.08 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64totcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			tcsBuf	:_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.15 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//// 02.01.21 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
////void _i64totcs (__int64 llNum, _TCHAR tcsBuf[], int iRadix)
//const _TCHAR* _i64totcs (__int64 llNum, _TCHAR tcsBuf[], int iRadix)
//{
//	long lC = 0;
//	BOOL bIsMinus = FALSE;
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		__int64 llMod = llNum % iRadix;
//		if (llMod < 10)
//			tcsBuf[lC++] = _T('0') + llMod;
//		else
//			tcsBuf[lC++] = _T('A') + (llMod - 10);
//		llNum /= iRadix;
//	} while (llNum);
//	if (bIsMinus) tcsBuf[lC++] = _T('-');
//	tcsBuf[lC] = _T('\0');
//	_wcsrev(tcsBuf);	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//// 02.01.21 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
//	return tcsBuf;
//} // _i64totcs.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64totcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			strBuff	:_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.21 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//const _TCHAR* _i64totcs (__int64 llNum, tcstring& strBuff, int iRadix)
//{
//	BOOL bIsMinus = FALSE;
//	strBuff.erase();
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		__int64 llMod = llNum % iRadix;
//		if (llMod < 10)
//			strBuff += _T('0') + llMod;
//		else
//			strBuff += _T('A') + (llMod - 10);
//		llNum /= iRadix;
//	} while (llNum);
//	if (bIsMinus) strBuff += _T('-');
//	reverse(strBuff.begin(), strBuff.end());	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return strBuff.c_str();
//} // _i64totcs.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64totcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			strBuff	:_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.22 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//const _TCHAR* _i64totcs (__int64 llNum, CString& strBuff, int iRadix)
//{
//	BOOL bIsMinus = FALSE;
//	strBuff.Empty();
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		__int64 llMod = llNum % iRadix;
//		if (llMod < 10)
//			strBuff += _T('0') + llMod;
//		else
//			strBuff += _T('A') + (llMod - 10);
//		llNum /= iRadix;
//	} while (llNum);
//	if (bIsMinus) strBuff += _T('-');
//	strBuff.MakeReverse();	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return (const _TCHAR*)strBuff;
//} // _i64totcs.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64totcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//CString _i64totcs (__int64 llNum, int iRadix)
//{
//	CString strBuff;
//	(void)_i64totcs(llNum, strBuff, iRadix);
//	return strBuff;
//} // _i64totcs.
//----- 02.02.08 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
//----- 02.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64towcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			wcsBuf	:_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.15 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//const wchar_t* _i64towcs (__int64 llNum, wchar_t wcsBuf[], int iRadix)
//{
//	long lC = 0;
//	BOOL bIsMinus = FALSE;
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		__int64 llMod = llNum % iRadix;
//		if (llMod < 10)
//			wcsBuf[lC++] = L'0' + llMod;
//		else
//			wcsBuf[lC++] = L'A' + (llMod - 10);
//		llNum /= iRadix;
//	} while (llNum);
//	if (bIsMinus) wcsBuf[lC++] = L'-';
//	wcsBuf[lC] = L'\0';
//	_wcsrev(wcsBuf);	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return wcsBuf;
//} // _i64towcs.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64towcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			wstrBuff:_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.21 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//const wchar_t* _i64towcs (__int64 llNum, WString& wstrBuff, int iRadix)
//{
//	BOOL bIsMinus = FALSE;
//	wstrBuff.erase();
//	//----- _xZkqqHx_jFiJiCmMiPoKiNiHiBeBiDhNiDeDiDgJiDfIiLeMiNiGiCpAjAoGjDkKiCmJ_xHqqkZx_ -----
//	if (llNum < 0)
//	{
//		bIsMinus = TRUE;
//		llNum = -llNum;
//	}
//	do
//	{
//		__int64 llMod = llNum % iRadix;
//		if (llMod < 10)
//			wstrBuff += L'0' + llMod;
//		else
//			wstrBuff += L'A' + (llMod - 10);
//		llNum /= iRadix;
//	} while (llNum);
//	if (bIsMinus) wstrBuff += L'-';
//	reverse(wstrBuff.begin(), wstrBuff.end());	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return wstrBuff.c_str();
//} // _i64towcs.
//----- 02.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64towcs
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:__int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
 *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeCjBmOiJjOiCmNiBeB_xHqqkZx_2_xZkqqHx_iBgA_xHqqkZx_36_xZkqqHx_jAgJjAjEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
WString _i64towcs (__int64 llNum, int iRadix)
{
	WString wstrBuff;
	wstrBuff.assign(100, L'\0');
	(void)_i64tow(llNum, wstrBuff.begin(), iRadix);
	wstrBuff.resize(wcslen(wstrBuff.begin()));
	return wstrBuff;
} // _i64towcs.
//----- 02.02.08 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_tcstoi64
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpA_xHqqkZx___int64_xZkqqHx_iCmMjAjEjCgMiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tcpBuf		:n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAiOhHjCoIiBeC_xHqqkZx_
 *			tcpEndPtr	:_xZkqqHx_jFlGiOjKjHpBiCmMiOjPiImKjChFiCpAjFnEiClHiBeCjFhDjHhGiCmIiCoH_xHqqkZx_NULL_xZkqqHx_iBeC_xHqqkZx_
 *			iRadix		:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeCjBmOiJjOiCmNiBeB_xHqqkZx_2_xZkqqHx_iBgA_xHqqkZx_36_xZkqqHx_jAgJjAjEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.15 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
__int64 _tcstoi64 (const _TCHAR* tcpBuf, const _TCHAR** tcpEndPtr, int iRadix)
{
	//----- _xZkqqHx_iLpDjEjCiCpAiDfIiDeMiDgCiDhG_xHqqkZx_ -----
	const _TCHAR* tcpPtr = tcpBuf;
	while (*tcpPtr == _T(' ') || *tcpPtr == _T('\t')) tcpPtr++;
	//----- _xZkqqHx_jFiJiCkJiCmHiCkEiCkJjClCiCnHiCoJ_xHqqkZx_ -----
	BOOL bIsMinus = FALSE;
	if (*tcpPtr == _T('-'))
	{
		tcpPtr++;
		bIsMinus = TRUE;
	}
	__int64 llVal = 0;
	int iNum;
	for (; *tcpPtr != _T('\0'); tcpPtr++)
	{
		if (_T('0') <= *tcpPtr && *tcpPtr <= _T('9'))
			iNum = int(*tcpPtr) - int(_T('0'));
		else
		if (_T('A') <= *tcpPtr && *tcpPtr <= _T('Z'))
			iNum = int(*tcpPtr) - int(_T('A')) + 10;
		else
		if (_T('a') <= *tcpPtr && *tcpPtr <= _T('z'))
			iNum = int(*tcpPtr) - int(_T('a')) + 10;
		else
			break;
		if (iRadix <= iNum) break;
		llVal *= iRadix;
		llVal += iNum;
	}
	// _xZkqqHx_iOjPiCmMjFlGiOjKiImKjChFiCpAjAnNjCoIiBeC_xHqqkZx_
	if (tcpEndPtr != NULL) *tcpEndPtr = tcpPtr;
	if (bIsMinus) return -llVal;
	return llVal;
} // _tcstoi64.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_wcstoi64
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpA_xHqqkZx___int64_xZkqqHx_iCmMjAjEjCgMiCmJjFmPiKlHiClHiCoJ_xHqqkZx_.
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wcpBuf		:n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAiOhHjCoIiBeC_xHqqkZx_
 *			wcpEndPtr	:_xZkqqHx_jFlGiOjKjHpBiCmMiOjPiImKjChFiCpAjFnEiClHiBeCjFhDjHhGiCmIiCoH_xHqqkZx_NULL_xZkqqHx_iBeC_xHqqkZx_
 *			iRadix		:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeCjBmOiJjOiCmNiBeB_xHqqkZx_2_xZkqqHx_iBgA_xHqqkZx_36_xZkqqHx_jAgJjAjEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.08 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
__int64 _wcstoi64 (const wchar_t* wcpBuf, const wchar_t** wcpEndPtr, int iRadix)
{
	//----- _xZkqqHx_iLpDjEjCiCpAiDfIiDeMiDgCiDhG_xHqqkZx_ -----
	const wchar_t* wcpPtr = wcpBuf;
	while (*wcpPtr == L' ' || *wcpPtr == L'\t') wcpPtr++;
	//----- _xZkqqHx_jFiJiCkJiCmHiCkEiCkJjClCiCnHiCoJ_xHqqkZx_ -----
	BOOL bIsMinus = FALSE;
	if (*wcpPtr == L'-')
	{
		wcpPtr++;
		bIsMinus = TRUE;
	}
	__int64 llVal = 0;
	int iNum;
	for (; *wcpPtr != L'\0'; wcpPtr++)
	{
		if (L'0' <= *wcpPtr && *wcpPtr <= L'9')
			iNum = int(*wcpPtr) - int(L'0');
		else
		if (L'A' <= *wcpPtr && *wcpPtr <= L'Z')
			iNum = int(*wcpPtr) - int(L'A') + 10;
		else
		if (L'a' <= *wcpPtr && *wcpPtr <= L'z')
			iNum = int(*wcpPtr) - int(L'a') + 10;
		else
			break;
		if (iRadix <= iNum) break;
		llVal *= iRadix;
		llVal += iNum;
	}
	// _xZkqqHx_iOjPiCmMjFlGiOjKiImKjChFiCpAjAnNjCoIiBeC_xHqqkZx_
	if (wcpEndPtr != NULL) *wcpEndPtr = wcpPtr;
	if (bIsMinus) return -llVal;
	return llVal;
} // _wcstoi64.

//----- 02.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_ui64towcs
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	unsigned __int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ullNum	:unsigned __int64_xZkqqHx_iCmMjAjEjCgMiCpAiOhHjCoIiBeC_xHqqkZx_
// *			strBuff	:_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *			iRadix	:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.27 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//const wchar_t* _ui64towcs (unsigned __int64 ullNum, WString& strBuff, int iRadix)
//{
//	strBuff.erase();
//	do
//	{
//		unsigned __int64 ullMod = ullNum % iRadix;
//		if (ullMod < 10)
//			strBuff += L'0' + ullMod;
//		else
//			strBuff += L'A' + (ullMod - 10);
//		ullNum /= iRadix;
//	} while (ullNum);
//	reverse(strBuff.begin(), strBuff.end());	// _xZkqqHx_jFlGiOjKjHpBiCpAiCnAiCmBiCkNiCoIjFnEiClHiBeC_xHqqkZx_
//	return strBuff.c_str();
//} // _ui64towcs.
//----- 02.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_wcstoui64
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpA_xHqqkZx_unsigned __int64_xZkqqHx_iCmMjAjEjCgMiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tcpBuf		:n_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCpAiOhHjCoIiBeC_xHqqkZx_
 *			tcpEndPtr	:_xZkqqHx_jFlGiOjKjHpBiCmMiOjPiImKjChFiCpAjFnEiClHiBeCjFhDjHhGiCmIiCoH_xHqqkZx_NULL_xZkqqHx_iBeC_xHqqkZx_
 *			iRadix		:n_xZkqqHx_jAgJjAjEiCpAiOhHjCoIiBeCjBmOiJjOiCmNiBeB_xHqqkZx_2_xZkqqHx_iBgA_xHqqkZx_36_xZkqqHx_jAgJjAjEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	unsigned __int64_xZkqqHx_iCmMjAjEjCgMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.01.27 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
unsigned __int64 _wcstoui64 (const wchar_t* tcpBuf, const wchar_t** tcpEndPtr, int iRadix)
{
	//----- _xZkqqHx_iLpDjEjCiCpAiDfIiDeMiDgCiDhG_xHqqkZx_ -----
	const wchar_t* tcpPtr = tcpBuf;
	while (*tcpPtr == L' ' || *tcpPtr == L'\t') tcpPtr++;
	unsigned __int64 ullVal = 0;
	int iNum;
	for (; *tcpPtr != L'\0'; tcpPtr++)
	{
		if (L'0' <= *tcpPtr && *tcpPtr <= L'9')
			iNum = int(*tcpPtr) - int(L'0');
		else
		if (L'A' <= *tcpPtr && *tcpPtr <= L'Z')
			iNum = int(*tcpPtr) - int(L'A') + 10;
		else
		if (L'a' <= *tcpPtr && *tcpPtr <= L'z')
			iNum = int(*tcpPtr) - int(L'a') + 10;
		else
			break;
		if (iRadix <= iNum) break;
		ullVal *= iRadix;
		ullVal += iNum;
	}
	// _xZkqqHx_iOjPiCmMjFlGiOjKiImKjChFiCpAjAnNjCoIiBeC_xHqqkZx_
	if (tcpEndPtr != NULL) *tcpEndPtr = tcpPtr;
	return ullVal;
} // _wcstoui64.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	_i64tow10fig
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	__int64_xZkqqHx_iCmMjAjEjCgMiCpA_xHqqkZx_10_xZkqqHx_jAgJjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClFiBeBiOhHjCoIiClDiCoKiClNiMiFiCmJiPkMjAjEjDfPiCpA_xHqqkZx_
 *			_xZkqqHx_jFhEiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	llNum	:_xZkqqHx_jFmPiKlHjBmOiPnLiCmMjAjEjCgMiBeC_xHqqkZx_
 *			wcsBuf	:_xZkqqHx_jFmPiKlHiClFiClNjFlGiOjKjHpBiCpAiOpLiCnPiCoJiDgPiDgCiDhEiDeAiBeC_xHqqkZx_
 *			iFig	:_xZkqqHx_iPkMjAjEjDfPiCmMiImKjChFiBeC_xHqqkZx_
 *			bIsCut0	:_xZkqqHx_iPkMjAjEjDfPiImIiJlKiCmFiNmFiMoDiCmM_xHqqkZx_0_xZkqqHx_iCpAiDeKiDgCiDgHiClHiCoJiCkJiCmHiCkEiCkJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	llNum = 76443_xZkqqHx_iBeB_xHqqkZx_iFig = -2_xZkqqHx_iCmMiPoKiNiHiBeB_xHqqkZx_wcsBuf = "764.43"
 *************************************************************************/
void _i64tow10fig (__int64 llNum, wchar_t wcsBuf[], int iFig, int bIsCut0)
{
	if (0 <= iFig)
	{
		_i64tow(llNum, wcsBuf, 10);
		if (llNum != 0)
		{
			//----- _xZkqqHx_iMiFjFkKiCmM_xHqqkZx_0_xZkqqHx_iCpAjFoCiPfL_xHqqkZx_ -----
			while (0 < iFig--)
				wcscat(wcsBuf, L"0");
		}
	} else
	{
		// _xZkqqHx_iImIiNhOiCmMiPiIjHjNiCpAjFkKiCkJiCoIiCoCiClHiCkNiClHiCoJiClNiCnPjAlDiCmMjCgMiCmJiClHiCoJiBeC_xHqqkZx_
		iFig = -iFig;
		if (llNum == 0)
		{
			wcscpy(wcsBuf, L"0");
		} else
		{
			/******[EX]*********
			10001    len   5
			10.001   iFig -3  iDif  2
			1.0001   iFig -4  iDif  1
			0.10001  iFig -5  iDif  0
			0.010001 iFig -6  iDif -1
			********************/
			wchar_t	wcsBuf2[500];
			int		iDif;
			wcsBuf[0] = L'\0';
			if (llNum < 0)
			{
				llNum = -llNum;
				wcscpy(wcsBuf, L"-");
			}
			_i64tow(llNum, wcsBuf2, 10);
			iDif = wcslen(wcsBuf2) - iFig;

			if (0 < iDif)
			{
				wcsncat(wcsBuf, wcsBuf2, iDif);
				wcscat(wcsBuf, L".");
				wcscat(wcsBuf, wcsBuf2 + iDif);
			} else
			{
				wcscat(wcsBuf, L"0.");
				while (iDif++ < 0)
					wcscat(wcsBuf, L"0");
				wcscat(wcsBuf, wcsBuf2);
			}
			if (bIsCut0)
			//----- _xZkqqHx_jFlGiOjKjHpBiNmFiMoDiCmM_xHqqkZx_"0"_xZkqqHx_iCpAiPjMiLiOiClHiCoJ_xHqqkZx_ -----
			{
				for (iDif = wcslen(wcsBuf) - 1; 0 <= iDif; iDif--)
				{
					if (wcsBuf[iDif] == L'0')
					{
						wcsBuf[iDif] = L'\0';
					} else
					{
						if (wcsBuf[iDif] == L'.')
							wcsBuf[iDif] = L'\0';
						break;
					}
				}
			}
		}
	}
} // void _i64tow10fig.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	RoundOffStr
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOgMiOmMiMnMjDpMiClFiClNjFlGiOjKjHpBiCpAiOoGjDlOiClHiCoJ_xHqqkZx_.
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wcsBuff	:_xZkqqHx_jFlGiOjKjHpBiCpAjFnEiClHiDgPiDgCiDhEiDeAiCpAjAnNjCoI_xHqqkZx_.
 *			dNum	:_xZkqqHx_jFmPiKlHjBmOiPnLiCmMjAjEjCgM_xHqqkZx_.
 *			iFig	:_xZkqqHx_jGhLiKnGjAjEiOmAiNhDiMiLiJmKiCmMjHeMiMpIiMiFiBeBjBkGiClPiOgMiOmMiMnMjDpMiClHiCoJiMiFiCmM_xHqqkZx_
 *					 _xZkqqHx_iCfAiCmCiPoDiCmMiMiFiCpAiOhHjCoIiClHiCoJ_xHqqkZx_.1_xZkqqHx_iCmMiImKiCpA_xHqqkZx_0_xZkqqHx_iMiFiCmGiClHiCoJ_xHqqkZx_.
 *			bIsCut0	:_xZkqqHx_iPkMjAjEjDfPiImIiJlKiCmFiNmFiMoDiCmM_xHqqkZx_0_xZkqqHx_iCpAiDeKiDgCiDgHiClHiCoJiCkJiCmHiCkEiCkJ_xHqqkZx_.
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	D2L(FdExtern.h)_xZkqqHx_iCpAiOfBiPmG_xHqqkZx_.
 *
 * < _xZkqqHx_jHoB_xHqqkZx_ >	15.348 -> 15.35_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_
 *			RoundOffStr(wcsBufff, 15.348, -2)
 *			15348 -> 15350_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_
 *			RoundOffStr(wcsBufff, 15348, 1)
 *			-15.345 -> -15.34_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_
 *			RoundOffStr(wcsBufff, -15.345, -2)
 *			-15348 -> -15350_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_
 *			RoundOffStr(wcsBufff, -15348, 1)
 *************************************************************************/
void RoundOffStr (wchar_t wcsBuff[], double dNum, int iFig, int bIsCut0)
{
	_i64tow10fig(D2LL(dNum / ::pow(10.0, iFig)), wcsBuff, iFig, bIsCut0);
} // RoundOffStr.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	hix2histr
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iCgHiCgIiChHiNmAjFfHiBgJiCgHiCgIiNmAjFfHiCmM_xHqqkZx_g_pReg->GetUnitToHixCoeff()_xZkqqHx_jEhLiBgKiCpAiCgHiCgIiNmAjFfHjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wcsBufff	:_xZkqqHx_jFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
 *			hix		:_xZkqqHx_iCgHiCgIiChHiNmAjFfHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	wcsBufff_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.02.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
wchar_t* hix2histr (wchar_t wcsBufff[], hixc hix)
{
	_i64tow10fig(hix, wcsBufff, g_pReg->GetUnitToHiPower());
	return wcsBufff;
} // hix2histr.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	histr2hix
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iCgHiCgIiNmAjFfHjFlGiOjKjHpBiCpAiCgHiCgIiChHiNmAjFfHiBgJiCgHiCgIiNmAjFfHiCmM_xHqqkZx_g_pReg->GetUnitToHixCoeff()_xZkqqHx_jEhLiBgKiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tcpStr	:_xZkqqHx_jFlGiOjKjHpBiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iCgHiCgIiChHiNmAjFfHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.02.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
hixc histr2hix (const wchar_t* tcpStr)
{
	return D2LL(g_pReg->GetUnitToHixCoeff() * wcstod(tcpStr, NULL));
} // histr2hix.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	tms2xtm
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jEhLjAjEiCpAiBeBiCfAiCePiCePiCePiCePjEhLiCmMiMiFiCmM_xHqqkZx__int64_xZkqqHx_iMfOiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tms	:_xZkqqHx_jEhLjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.02.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
xtmc tms2xtm (tmsc tms)
{
	return D2LL(10000.0 * tms);
} // tms2xtm.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	xtm2tms
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCpAjEhLjAjEiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tx	:_xZkqqHx_iCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jEhLjAjEiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.02.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
tmsc xtm2tms (xtmc tx)
{
	return tmsc(tx) / 10000.0;
} // xtm2tms.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	xtm2tmsstr
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCpAiBeBjEhLjAjEjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wcsBufff	:_xZkqqHx_jFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
 *			tx		:_xZkqqHx_iCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	wcsBufff_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.02.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
wchar_t* xtm2tmsstr (wchar_t wcsBufff[], xtmc tx)
{
	_i64tow10fig(tx, wcsBufff, -4);
	return wcsBufff;
} // xtm2tmsstr.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	tmsstr2xtm
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jEhLjAjEjFlGiOjKjHpBiCpAiBeBiCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	tcpStr	:_xZkqqHx_jEhLjAjEjFlGiOjKjHpBiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iCfAiCePiCePiCePiCePjEhLiCmMjEhLjAjEiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.02.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
xtmc tmsstr2xtm (const wchar_t* tcpStr)
{
	return D2LL(10000.0 * wcstod(tcpStr, NULL));
} // tmsstr2xtm.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	RoundOff
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClN_xHqqkZx_hix_xZkqqHx_jCgMiCpAiBeBiOhHjCoIiClDiCoKiClNjHeMiMpIiMiFjAjEiCmFiOgMiOmMiMnMjDpMiClHiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iOgMiOmMiMnMjDpMiClHiCoJiCmGiCkLiCmJiBeB_xHqqkZx_lUnit_xZkqqHx_iCmMjEhLjAjEiCmJiCmIiCoJiCoGiCkEiCmJiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	hixVal	:hixc_xZkqqHx_jCgMiCpAiOhHjCoIiBeC_xHqqkZx_
 *			iFig	:_xZkqqHx_jHeMiMpIiMiFjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *			lUnit	:_xZkqqHx_jEhLjAjEiCmMjBgGiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFmPiKlHiClFiClN_xHqqkZx_hixc_xZkqqHx_jCgMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_jHoB_xHqqkZx_:	hixVal:22146_xZkqqHx_iBeB_xHqqkZx_iFig:3_xZkqqHx_iBeB_xHqqkZx_lUnit:25 _xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ 22500
 *				hixVal:22146_xZkqqHx_iBeB_xHqqkZx_iFig:3_xZkqqHx_iBeB_xHqqkZx_lUnit:5 _xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ 22000
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.09.05 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
hixc RoundOff (hixc hixVal, int iFig, long lUnit)
{
	// hixVal _xZkqqHx_iCkK_xHqqkZx_ 0 _xZkqqHx_iCmMiPoKiNiHiCmNiBeB_xHqqkZx_log10_xZkqqHx_iKnGjAjEiCkKjGlDiMpIiCmMiClNiCnPiBeBiClBiClBiCmFiDeKiDgCiDgHiBeC_xHqqkZx_
	if (hixVal == 0) return 0;
	if (lUnit == 0) lUnit = 1;
	int b = int(log10(hixVal));
	double p = pow(10.0, -b + iFig - 1);
	hixc hx = D2LL(double(hixVal * p) / double(lUnit)) * lUnit;
	return D2LL(double(hx) / p);
} // RoundOff.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	hixroundoff
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	hix_xZkqqHx_iNmAjFfHiCpAjHeMiMpIiMiFjAjE_xHqqkZx_2_xZkqqHx_iMiFiBeB_xHqqkZx_5_xZkqqHx_iCmMjEhLjAjEiCmGiClFiCmEiOgMiOmMiMnMjDpMiClFiCmEjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.09.05 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
hixc hixroundoff (hixc hix)
{
	return RoundOff(hix, 2, 5);
} // hixroundoff.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	mmroundoff
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOmAiNmAjFfHiCpAiBeB_xHqqkZx_hix_xZkqqHx_iNmAjFfHiCmJjFmPiKlHiClFiCmEjHeMiMpIiMiFjAjE_xHqqkZx_2_xZkqqHx_iMiFiBeB_xHqqkZx_5_xZkqqHx_iCmMjEhLjAjEiCmGiClFiCmE_xHqqkZx_
 *			_xZkqqHx_iOgMiOmMiMnMjDpMiClFiCmEiBeBiNmEiCnBiOmAiNmAjFfHiCmFjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.09.05 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
mmetol mmroundoff (mmetol mm)
{
	return hix2mm(hixroundoff(mm2hix(mm)));
} // mmroundoff.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	mmroundoff
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOmAiNmAjFfHiCpAiBeB_xHqqkZx_hix_xZkqqHx_iNmAjFfHiCmJjFmPiKlHiClFiCmEjHeMiMpIiMiFjAjE_xHqqkZx_2_xZkqqHx_iMiFiBeB_xHqqkZx_5_xZkqqHx_iCmMjEhLjAjEiCmGiClFiCmE_xHqqkZx_
 *			_xZkqqHx_iOgMiOmMiMnMjDpMiClFiCmEiBeBiNmEiCnBiOmAiNmAjFfHiCmFjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.09.05 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DBLPoint mmroundoff (DBLPoint& mmpt)
{
	return DBLPoint(mmroundoff(mmpt.x), mmroundoff(mmpt.y));
} // mmroundoff.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	mmroundoff
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOmAiNmAjFfHiCpAiBeB_xHqqkZx_hix_xZkqqHx_iNmAjFfHiCmJjFmPiKlHiClFiCmEjHeMiMpIiMiFjAjE_xHqqkZx_2_xZkqqHx_iMiFiBeB_xHqqkZx_5_xZkqqHx_iCmMjEhLjAjEiCmGiClFiCmE_xHqqkZx_
 *			_xZkqqHx_iOgMiOmMiMnMjDpMiClFiCmEiBeBiNmEiCnBiOmAiNmAjFfHiCmFjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.09.05 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DBLRect mmroundoff (DBLRect& mmrt)
{
	return DBLRect(	mmroundoff(mmrt.left), mmroundoff(mmrt.top),
					mmroundoff(mmrt.right), mmroundoff(mmrt.bottom));
} // mmroundoff.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	dbpt2str
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	dblpnt_xZkqqHx_iMfOiBgJ_xHqqkZx_double_xZkqqHx_iCmMiDhMiDeDiDjDiDgHiNmAjFfHiBgKiCpAjAjEjCgMjFlGiOjKjHpBiCmJjFmPiKlHiClHiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iPkMjAjEjDfPiImIiJlKiCmMiNmFiMoDiCmM_xHqqkZx_ 0 _xZkqqHx_iCpAiNoNiPjMiClHiCoJiBeCiPkMjAjEjDfPiImIiJlKiCmJjCgMiCkKjGlDiCkCiPoKiNiHiCmN_xHqqkZx_
 *			_xZkqqHx_iPkMjAjEjDfPiCoAiNoNiPjMiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wcsBufff	:_xZkqqHx_jFlGiOjKjHpBiCpAjFnEiClHiBeC_xHqqkZx_
 *			dbpt	:dblpnt_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	wcsBufff_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
wchar_t* dbpt2str (wchar_t wcsBufff[], dblpnt dbpt)
{
	// 15.348 -> 15.35_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_
	// RoundOffStr(wcsBufff, 15.348, -2)
	RoundOffStr(wcsBufff, dbpt, -2, TRUE);
	return wcsBufff;
} // dbpt2str.
