Пример #1
0
void CChars::Append(unsigned int ui)
{
	char sz[32];

	IToA(ui, sz, 10);
	Append(sz);
}
Пример #2
0
char* LongLongToString(long long int lli, int iBase)
{
	int iCount = IncrementLogToStringCount();

	IToA(lli, gaszLogToStringScratchPad[iCount], iBase);
	return gaszLogToStringScratchPad[iCount];
}
Пример #3
0
void CChars::Append(int i)
{
	char sz[32];

	IToA(i, sz, 10);
	Append(sz);
}
Пример #4
0
void CChars::Append(long long int lli)
{
	char sz[64];

	IToA(lli, sz, 10);
	Append(sz);
}
Пример #5
0
void CChars::Append(unsigned long long int ulli)
{
	char sz[64];

	IToA(ulli, sz, 10);
	Append(sz);
}
Пример #6
0
void CChars::Append(int i, int iBase)
{
	char sz[32];

	IToA(i, sz, iBase);
	Append(sz);
}
Пример #7
0
char* IntToString(int i, int iBase)
{
	int iCount = IncrementLogToStringCount();

	IToA(i, gaszLogToStringScratchPad[iCount], iBase);
	return gaszLogToStringScratchPad[iCount];
}
Пример #8
0
BOOL Fail(char* szExpected, char* szActual, int iLine, char* szFile)
{
	char    szLine[1024];
	CChars  szError;

	Fail();

	IToA(iLine, szLine, 10);
	szError.Init("Failed: ");
	szError.Append(szFile);
	szError.Append(" line ");
	szError.Append(szLine);
	szError.AppendNewLine();

	szError.Append("Expected: ");
	szError.Append(szExpected);
	szError.AppendNewLine();

	szError.Append("Actual:   ");
	szError.Append(szActual);
	szError.AppendNewLine();
	szError.AppendNewLine();

	gcLogger.Add(szError.Text());

	szError.Kill();

	return FALSE;
}
void TestIToA(void)
{
    char    sz[256];

    IToA(7, sz, 10);
    AssertString("7", sz);

    IToA(456, sz, 10);
    AssertString("456", sz);

    IToA(12, sz, 10);
    AssertString("12", sz);

    IToA(-1, sz, 10);
    AssertString("-1", sz);

    IToA(-32456, sz, 10);
    AssertString("-32456", sz);
}
Пример #10
0
void ToPointerString(void* pv, char* sz)
{
	CChars	c;

	IToA((int)(ENGINE_SIZE_T)pv, sz, 16);
	c.Init(sz);
	c.RightAlign('0', 8);
	c.Insert(0, "0x");
	strcpy(sz, c.Text());
	c.Kill();
}
Пример #11
0
void CChars::Append(double d, int iNumDecimals)
{
	char	sz[128];
	char	szd[128];

	strcpy(sz, "%.");
	strcat(sz, IToA(iNumDecimals, szd, 10));
	strcat(sz, "d");
	sprintf(szd, sz, d);
	Append(szd);
}
Пример #12
0
void CChars::Append(float f, int iNumDecimals)
{
	char	sz[128];
	char	szd[128];

	strcpy(sz, "%.");
	strcat(sz, IToA(iNumDecimals, szd, 10));
	strcat(sz, "f");
	sprintf(szd, sz, f);
	Append(szd);
}
Пример #13
0
void ToLongLongIntString(long long int i, char* sz)
{
    IToA((int)i, sz, 10);
}
Пример #14
0
void ToIntHexString(int i, char* sz)
{
	IToA(i, &sz[2], 16);
	sz[0] = '0';
	sz[1] = 'x';
}
Пример #15
0
void ToIntString(int i, char* sz)
{
	IToA(i, sz, 10);
}
Пример #16
0
BOOL CNamedIndexedObjects::AddWithIDAndName(CBaseObject* pvObject, OIndex oi, char* szName)
{
	CNamedObject*		pcNamed;
	CNamedHollowObject*	pcNamedHollow;
	BOOL				bResult;

	if (mcNames.HasKey(szName))
	{
		gcLogger.Error2(__METHOD__, " Cannot add object named [", szName, "].  It already exists.", NULL);
		return FALSE;
	}

	bResult = AddWithID(pvObject, oi);
	if (!bResult)
	{
		char sz[32];

		gcLogger.Error2(__METHOD__, " Cannot add object named [", szName, "].  An index [", IToA(oi, sz, 10), "] already exists.", NULL);
		return FALSE;
	}

	if (!pvObject->IsHollow())
	{
		pcNamed = (CNamedObject*)pvObject;
		bResult = pcNamed->InitName(szName);
	}
	else
	{
		pcNamedHollow = (CNamedHollowObject*)pvObject;
		bResult = pcNamedHollow->InitName(szName);
	}

	if ((szName != NULL) && (szName[0] != 0))
	{
		oi = pvObject->GetOI();
		szName = (char*)mcNames.Put(szName, &oi, sizeof(OIndex));
		bResult = szName != NULL;
	}
	return bResult;
}
Пример #17
0
void CALLBACK WndProc(UINT32 message,UINT32 lParam,UINT32 wParam)
{
	switch (message)
	{
	case WM_CREATE:
		{
			CDC *pDC=GetDC();
			pDC->LCD_Init();
			pDC->LCD_On();
			pDC->Fill_Screen(WHITE);
			pDC->SetPixel(20,40,BLACK);
			pDC->MoveTo(20,20);
			pDC->LineTo(220,20);
			pDC->MoveTo(20,20);
			pDC->LineTo(20,300);
			pDC->MoveTo(20,300);
			pDC->LineTo(220,300);
			pDC->MoveTo(220,20);
			pDC->LineTo(220,300);
			//pDC->PrintAuthors(1,2);
			pDC->PrintMenu(50,100);
			
			char b[100];
			IToA(b,154);
			PrintF("abc%d%def%d%s..",12,34,5,"nihao");
		}
		
		break;
	case WM_TIMER:
		PrintF("WM_TIMER\n");
		break;
	case WM_LBUTTONDOWN:

		if (flag == 1)
		{
			MoveTo(lParam,wParam);
		}
		if (flag == 2)
		{
			tempX = lParam;
			tempY = wParam;
		}

		//PrintF("WM_LBUTTONDOWN\n");
		//PrintF("x=%d   y=%d\n",lParam,wParam);
		break;
	case WM_LBUTTONUP:

		if (flag == 1)
		{
			LineTo(lParam,wParam);
		}
		if (flag == 2)
		{
			PrintF("%d,%d,%d\n",abs(wParam-tempY),tempX,tempY);
			if (abs(lParam - tempX) >= abs(wParam - tempY))
			{
				DrawCircle((abs(wParam-tempY)/2+tempX),(tempY+wParam)/2,(abs(wParam - tempY)/2),BLACK);
			}
			else
			{
				DrawCircle((tempX+lParam)/2,(abs(tempX-lParam)/2+tempY),(abs(lParam - tempX)/2),BLACK);
			}
		}

		if (lParam < 176 && lParam > 50 && wParam > 100 && wParam < 116)
		{	
			if(flag == 0)
			{
				flag = 1;
				Fill_Screen(WHITE);
			}
		}
		if (lParam < 200 && lParam > 40 && wParam > 173 && wParam < 183)
		{	
			if (flag == 0)
			{
				flag = 2;
				Fill_Screen(WHITE);
			}
		}
		//PrintF("WM_LBUTTONUP\n");
		//PrintF("x=%d   y=%d\n",lParam,wParam);
		break;
	}
}