Hallo,
ich hab ein code, der mit Borland c++ geschrieben ist und wollte halt unter visual c++ laufen lassen wie mache ich das?
danke im Voraus
PS. da sind verschiedene Funktionen, die einander aufrufen.
ich hab ein code, der mit Borland c++ geschrieben ist und wollte halt unter visual c++ laufen lassen wie mache ich das?
danke im Voraus
PS. da sind verschiedene Funktionen, die einander aufrufen.
Code:
//------------------------------------------------------------------------------------------------------------------------------------
//Umwandlung von Borland C++ Builder zu visual c++
//------------------------------------------------------------------------------------------------------------------------------------
// Macros
#define ADD_BLANK(a,b) if(!(a)) b = b + " "; a = false;
#define ADD_STRING(a,b,c) ADD_BLANK(a,b); b += c;
#define COLOR_INPUT_FOCUS (TColor)0xE0E0FF
//------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------
void PrintAmsRec(AnsiString fmsg, struct Msg_Rx_Type *rxPtr)
{
int pos, ret;
AnsiString str;
str = "";
FrmtRxStatusText(&str, rxPtr->Status);
PrintDebug(fmsg + ": SrcAddr: " + IntToHex(rxPtr->Src_Adr, 4) +
" Status: " + IntToHex(rxPtr->Status, 2) + str);
PrintDebug( " FBlockID: " + IntToHex(rxPtr->FBlock_ID, 2) +
" InstID: " + IntToHex(rxPtr->Inst_ID, 2) +
" FuncID: " + IntToHex(rxPtr->Func_ID, 3) +
" OpType: " + IntToHex(rxPtr->Operation, 1));
pos = 0;
do
{
// show data part of the message
str = "";
ret = FrmtDataString(&str, &(rxPtr->Data[pos]), (int)rxPtr->Length - pos, 16);
if (pos == 0)
PrintDebug(" Data: " + str);
else
PrintDebug(" " + str);
pos += ret;
} while (ret > 0);
}
//------------------------------------------------------------------------------------------------------------------------------------
void FrmtRxStatusText(AnsiString *str, byte status)
{
bool first = true;
*str = "(";
if (status == 0x00)
{
ADD_STRING(first, *str, "BUF_FREE");
}
else
{
if (status & 0x01)
{
ADD_STRING(first, *str, "LOCK");
}
if (status & 0x02)
{
ADD_STRING(first, *str, "READY");
}
if (status & 0x4)
{
ADD_STRING(first, *str, "ACTIVE");
}
if (status & 0x08)
{
ADD_STRING(first, *str, "RXTRIGGER");
}
if (status & 0x10)
{
ADD_STRING(first, *str, "GBGCOL");
}
if (status & 0x80)
{
ADD_STRING(first, *str, "RXFAKE");
}
}
*str += ")";
}
//------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------
void PrintDebug(AnsiString str)
{
AnsiString timeStr;
LOCK_BUFFER
if (FrmMain->chkEnablePrint->Checked)
{
timeStr = GetTimeStampStr();
FrmMain->BufferList->Add(timeStr + str);
}
UNLOCK_BUFFER
}
//-------------------------------------------------------------------------------------------------------------------------------------
AnsiString GetTimeStampStr(void)
{
unsigned long tickcnt, sec, msec, min;
AnsiString min_str, sec_str, msec_str;
if (showTimeFlag)
{
tickcnt = GetTickCount() - FrmMain->TickCntRef;
sec = tickcnt / 1000;
msec = tickcnt % 1000;
min = sec / 60;
sec = sec % 60;
min_str = (AnsiString)min;
if (sec < 1) sec_str = "00";
else if (sec < 10) sec_str = "0"+ (AnsiString)sec;
else sec_str = (AnsiString)sec;
if (msec < 1) msec_str = "000";
else if (msec < 10) msec_str = "00"+ (AnsiString)msec;
else if (msec < 100) msec_str = "0" + (AnsiString)msec;
else msec_str = (AnsiString)msec;
return (min_str + ":" + sec_str + "." + msec_str + " ");
}
else
{
return (" "); } }
//------------------------------------------------------------------------------------------------------------------------------------
int FrmtDataString(AnsiString *str, byte *buf, int num_bytes, int max_bytes)
{
int j;
for (j = 0; j < num_bytes; j++)
{
if (max_bytes > 0 && j >= max_bytes)
return (j);
*str = *str + IntToHex(*(buf+j), 2);
if (j%4 == 3 && j != num_bytes - 1 && j != max_bytes - 1)
*str = *str + " : ";
else if (j != num_bytes - 1 )
*str = *str + " ";
}
return (-1);
}
//------------------------------------------------------------------------------------------------------------------------------------
* Alternative für IntToHex Funktion
//------------------------------------------------------------------------------------------------------------------------------------