本文整理汇总了C++中CByteArray::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CByteArray::Add方法的具体用法?C++ CByteArray::Add怎么用?C++ CByteArray::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CByteArray
的用法示例。
在下文中一共展示了CByteArray::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Follow
void CSinaSvr::Follow(LPCTSTR lpUID)
{
TCHAR szUid[20] = _T("2436235444");
//_tcscpy(szUid,lpUid);
TCHAR szPost[1024]= {0};
_stprintf(szPost,_T("uid=%s&f=1&extra=refer_sort%3Apl_content_hisPersonalInfo&_t=0"),szUid);
int iSize = _tcslen(szPost);
CByteArray arr;
for (int i = 0; i < iSize; i++)
{
arr.Add(szPost[i]);
}
TCHAR szHeader[1024] = {0};
_stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),szUid);
TCHAR szURL[1024]=_T("http://weibo.com/aj/f/followed");
COleVariant vPostData = arr;
COleVariant vURL(szURL, VT_BSTR);
COleVariant vHeaders(szHeader, VT_BSTR);
COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR);
COleVariant vFlags((long) NULL, VT_I4);
Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders);
}
示例2: Login
void CSinaSvr::Login(LPCTSTR lpUserName,LPCTSTR lpPwd)
{
SetAction(ACT_LOGIN_SINA);
TCHAR szPost[1024]= {0};
_stprintf(szPost,_T("username=%s&password=%s&entry=miniblog&act=1&from=referer%3Awww_index"),lpUserName,lpPwd);
int iSize = _tcslen(szPost);
CByteArray arr;
for (int i = 0; i < iSize; i++)
{
arr.Add(szPost[i]);
}
TCHAR szHeader[1024] = _T("Content-Type: application/x-www-form-urlencoded; charset=UTF-8");
TCHAR szURL[1024]=_T("http://login.sina.com.cn/sso/login.php");
COleVariant vPostData = arr;
COleVariant vURL(szURL, VT_BSTR);
COleVariant vHeaders(szHeader, VT_BSTR);
COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR);
COleVariant vFlags((long) NULL, VT_I4);
Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders);
}
示例3: Forward
void CSinaSvr::Forward(LPCTSTR lpMid,LPCTSTR lpUid,LPCTSTR lpReason)
{
TCHAR szMid[MAX_PATH] = _T("3366217727338022");
_tcscpy(szMid,lpMid);
TCHAR szUid[] = _T("2400232192");
WCHAR szwPost[1024]={0};
TCHAR szReason[] = _T("ת·¢Î¢²©£¡");
_tcscpy(szReason,lpReason);
_stprintf(szwPost,_T("appkey=&mid=%s&style_type=1&reason=%s&_t=0"),szMid,szReason);
char szPost[1024]= {0};
WideCharToMultiByte(CP_UTF8, 0, szwPost, -1, szPost, MAX_PATH, NULL, NULL);
int iSize = strlen(szPost);
CByteArray arr;
for (int i = 0; i < iSize; i++)
{
arr.Add(szPost[i]);
}
TCHAR szHeader[1024] = {0};
_stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),szUid);
TCHAR szURL[1024]=_T("http://weibo.com/aj/mblog/forward");
COleVariant vPostData = arr;
COleVariant vURL(szURL, VT_BSTR);
COleVariant vHeaders(szHeader, VT_BSTR);
COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR);
COleVariant vFlags((long) NULL, VT_I4);
Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders);
}
示例4: vURL
void CSinaSvr::PostWeibo1(LPCTSTR lpContent)
{
// //check URL;
// if (m_strCurURL.Find(_T("http://weibo.com/",0)) < 0)
// return;
WCHAR szwPost[1024]={0};
_stprintf(szwPost,_T("_t=0&pic_id=&text=%s"),lpContent);
char szPost[1024]= {0};
WideCharToMultiByte(CP_UTF8, 0, szwPost, -1, szPost, MAX_PATH, NULL, NULL);
int iSize = strlen(szPost);
CByteArray arr;
for (int i = 0; i < iSize; i++)
{
arr.Add(szPost[i]);
}
TCHAR szHeader[1024] = {0};
_stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),m_szCurUID);
TCHAR szURL[1024]=_T("http://weibo.com/aj/mblog/add");
COleVariant vPostData = arr;
COleVariant vURL(szURL, VT_BSTR);
COleVariant vHeaders(szHeader, VT_BSTR);
COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR);
COleVariant vFlags((long) NULL, VT_I4);
Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders);
}
示例5: GetBinary
CTobCompiler::EToken CTobCompiler::GetBinary(CByteArray& bin)
{
DWORD cache = 1;
BOOL comment = FALSE;
for(;;)
{
int c = fgetc(m_fsrc);
if (c == EOF)
{
if (!feof(m_fsrc))
m_err.Format("can not read src file at %p", ftell(m_fsrc));
else
m_err = "not found ']' at the end of src file";
return ERR_SEVERE;
}
if (comment)
{
if (c == '\n') { ++m_line; comment = FALSE; }
continue;
}
BYTE half = ms_hextable[c];
if (half < 16)
{
cache = (cache << 4) + half;
if (cache >= 0x100)
{
bin.Add((BYTE)cache);
cache = 1;
}
}
else if (c <= ' ') continue;
else if (c == '\n') ++m_line;
else if (c == ']')
{
if (cache != 1) bin.Add((BYTE)(cache & 0x0f));
return SYM_BIN;
}
else if (c == ';') { comment = TRUE; continue; }
else
{
m_err.Format("bad hex char 0x%02X", c);
return ERR_NORMAL;
}
}
}
示例6: GetBinaryValue
BOOL CRegistry::GetBinaryValue(LPCTSTR name_of_value, CByteArray& return_array)
{
ASSERT(name_of_value != NULL);
if (name_of_value == NULL) {
m_ErrorCode = ERROR_INVALID_PARAMETER;
return(FALSE);
}
// Thanks go to Chris Hines ([email protected]) for finding
// a bug here. If you add entries to the key, then the
// information retrieved via QueryInfo() may be invalid. This
// will screw you here. So, we must make sure our information
// is correct before we attempt to *use* the data.
QueryInfo();
DWORD size_of_buffer = m_LongestValueDataLength;
LPBYTE memory_buffer = (LPBYTE) new BYTE[ size_of_buffer ];
if (memory_buffer == NULL) {
m_ErrorCode = ::GetLastError();
return(FALSE);
}
BOOL ret = TRUE;
KeyValueTypes type = typeBinary;
if (QueryValue(name_of_value, type, memory_buffer, size_of_buffer) != FALSE) {
/*
** We've got data so give it back to the caller
*/
return_array.RemoveAll();
DWORD index = 0;
while(index < size_of_buffer) {
return_array.Add(memory_buffer[ index ]);
index++;
}
ret = TRUE;
}
else {
ret = FALSE;
}
delete [] memory_buffer;
return(ret);
}
示例7: GpsOnSeriesRead
//GPS接收数据事件
void CALLBACK CGPS::GpsOnSeriesRead(void * powner,BYTE* buf,DWORD dwBufLen)
{
CGPS * pGps = (CGPS*)powner;
//得到本类指针
CByteArray * pArray = &(pGps->m_aRecvBuf);
//得到缓冲区大小
int iMaxSize = pArray->GetSize();
//得到缓冲区所使用的大小
int iUpperBound = pArray->GetUpperBound();
for (int i=0;i<dwBufLen;i++)
{
pArray->Add(*(buf+i));
}
//将收到的数据发给主程序显示出来
char* pRecvBuf = new char[dwBufLen+1];
ZeroMemory(pRecvBuf,dwBufLen+1);
CopyMemory(pRecvBuf,buf,dwBufLen);
//发送接收串口原始数据WINDOWS消息通知
//消息处理完毕后,应释放内存
::PostMessage(pGps->m_pWnd->m_hWnd,WM_GPS_RECV_BUF,WPARAM(pRecvBuf),dwBufLen+1);
CString strGps;
//检查是否已经存在有效的GPS数据
if (pGps->HaveValidGPSData(pArray,strGps))
{
PGPSData pGpsData = NULL;
pGpsData = pGps->AnalyseGpsData(strGps);
if (pGpsData != NULL)
{
//将接收到的GPS数据填充到最新当前数据
pGps->m_gpsCurData = (*pGpsData);
//发送接收有效GPS位置信息WINDOWS消息通知
//由消息处理函数释放内存
::PostMessage(pGps->m_pWnd->m_hWnd,WM_GPS_RECV_VALID_LONGLAT,WPARAM(pGpsData),0);
}
}
}
示例8: InitBlob
CByteArray* CMainDlg::InitBlob()
{
CByteArray* blob = new CByteArray(); //Creazione del blob contenitore
dati* pDati = new dati(); //Creazione della struttura specializzata
pDati->nVersione = 0; //Inserimento del numero di versione
pDati->alt = m_pSerieSet->m_Dimensione1;
pDati->larg = m_pSerieSet->m_Dimensione2;
pDati->lung = m_pSerieSet->m_Dimensione3;
pDati->massa = 0;
pDati->caricoSp = 0;
pDati->tipoRott = 1;
// Riempimento del blob contenitore
char *p_ary = (char*)pDati;
for(int i=0;i<sizeof(struct dati);i++)
{
blob->Add(*p_ary);
p_ary++;
}
return blob; // Restituzione del puntatore al nuovo blob
}
示例9: Comment
void CSinaSvr::Comment(LPCTSTR lpMid,LPCTSTR lpUID,LPCTSTR lpContent)
{
TCHAR szMid[MAX_PATH] = _T("3366217727338022");
TCHAR szUid[] = _T("2400232192");
WCHAR szwPost[1024]={0};
TCHAR szContent[1024] = _T("comment-test");
_tcscpy(szMid,lpMid);
_tcscpy(szUid,lpUID);
_tcscpy(szContent,lpContent);
_stprintf(szwPost,_T("act=post&mid=%s&uid=%s&forward=0&isroot=1&content=%s&_t=0"),szMid,m_szCurUID,szContent);
//_stprintf(szwPost,_T("act=post&mid=3366217727338022&uid=1828546224&forward=0&isroot=0&content=comment-test&type=big&_t=0"));
char szPost[1024]= {0};
WideCharToMultiByte(CP_UTF8, 0, szwPost, -1, szPost, MAX_PATH, NULL, NULL);
int iSize = strlen(szPost);
CByteArray arr;
for (int i = 0; i < iSize; i++)
{
arr.Add(szPost[i]);
}
TCHAR szHeader[1024] = {0};
_stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),szUid);
//_stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nx-requested-with: XMLHttpRequest"),szUid);
TCHAR szURL[1024]=_T("http://weibo.com/aj/comment/add");
COleVariant vPostData = arr;
COleVariant vURL(szURL, VT_BSTR);
COleVariant vHeaders(szHeader, VT_BSTR);
COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR);
COleVariant vFlags((long) NULL, VT_I4);
Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders);
}
示例10: TestFile
void CSourceODBC::TestFile(void)
{
{
SetPosition(0);
SDBField *colmn = m_database.GetColomn( _T("FILE") );
CByteArray *p = &colmn->binValue;
int rew = 432;
}
SetPosition(0);
Edit();
SDBField *colmn = m_database.GetColomn( _T("FILE") );
CByteArray *ba = &m_database.GetColomn( _T("FILE") )->binValue;
ba->RemoveAt(0, ba->GetSize());
ba->Add(111);
Set(_T("Comment"), _T("wqe"));
while(!CanUpdate()) {
Sleep(10);
}
Update();
}
示例11:
void 座位详情页::OnBnClickedButton1()
{
UpdateData(TRUE);
if (flag == 1)
{
//flag++;
if (x = 1)
strcpy(fileDizhi, "res\\mv1.ini");
if (x==2)
strcpy(fileDizhi, "res\\mv2.ini");
if (x==3)
strcpy(fileDizhi, "res\\mv3.ini");
}
load();
if (flag == 1)
{
//flag++;
if (x = 1)
strcpy(fileDizhi, "res\\mv1.ini");
if (x == 2)
strcpy(fileDizhi, "res\\mv2.ini");
if (x == 3)
strcpy(fileDizhi, "res\\mv3.ini");
}
int k,yu=0;
for (k = 0; k < 16; k++)
{
if (str[diDian][changCi][k] == 'k')
{
yu++;
CStatic *pic=NULL;
switch (k)
{
case 0: pic = (CStatic *)GetDlgItem(IDC_STATIC1); break;
case 1: pic = (CStatic *)GetDlgItem(IDC_STATIC2); break;
case 2: pic = (CStatic *)GetDlgItem(IDC_STATIC3); break;
case 3: pic = (CStatic *)GetDlgItem(IDC_STATIC4); break;
case 4: pic = (CStatic *)GetDlgItem(IDC_STATIC5); break;
case 5: pic = (CStatic *)GetDlgItem(IDC_STATIC6); break;
case 6: pic = (CStatic *)GetDlgItem(IDC_STATIC7); break;
case 7: pic = (CStatic *)GetDlgItem(IDC_STATIC8); break;
case 8: pic = (CStatic *)GetDlgItem(IDC_STATIC9); break;
case 9: pic = (CStatic *)GetDlgItem(IDC_STATIC10); break;
case 10: pic = (CStatic *)GetDlgItem(IDC_STATIC11); break;
case 11: pic = (CStatic *)GetDlgItem(IDC_STATIC12); break;
case 12: pic = (CStatic *)GetDlgItem(IDC_STATIC13); break;
case 13: pic = (CStatic *)GetDlgItem(IDC_STATIC14); break;
case 14: pic = (CStatic *)GetDlgItem(IDC_STATIC15); break;
case 15: pic = (CStatic *)GetDlgItem(IDC_STATIC16); break;
default:MessageBox(_T("k值错误"));
}
pic->ShowWindow(SW_SHOW);
}
else
{
CStatic *pic=NULL;
switch (k)
{
case 0: pic = (CStatic *)GetDlgItem(IDC_STATIC1); break;
case 1: pic = (CStatic *)GetDlgItem(IDC_STATIC2); break;
case 2: pic = (CStatic *)GetDlgItem(IDC_STATIC3); break;
case 3: pic = (CStatic *)GetDlgItem(IDC_STATIC4); break;
case 4: pic = (CStatic *)GetDlgItem(IDC_STATIC5); break;
case 5: pic = (CStatic *)GetDlgItem(IDC_STATIC6); break;
case 6: pic = (CStatic *)GetDlgItem(IDC_STATIC7); break;
case 7: pic = (CStatic *)GetDlgItem(IDC_STATIC8); break;
case 8: pic = (CStatic *)GetDlgItem(IDC_STATIC9); break;
case 9: pic = (CStatic *)GetDlgItem(IDC_STATIC10); break;
case 10: pic = (CStatic *)GetDlgItem(IDC_STATIC11); break;
case 11: pic = (CStatic *)GetDlgItem(IDC_STATIC12); break;
case 12: pic = (CStatic *)GetDlgItem(IDC_STATIC13); break;
case 13: pic = (CStatic *)GetDlgItem(IDC_STATIC14); break;
case 14: pic = (CStatic *)GetDlgItem(IDC_STATIC15); break;
case 15: pic = (CStatic *)GetDlgItem(IDC_STATIC16); break;
default:MessageBox(_T("k值错误"));
}
pic->ShowWindow(SW_HIDE);
}
}
CByteArray array; //动态数组
array.RemoveAll(); //清除动态数组
array.Add(yu); //按字节添加数据
comKou.put_Output(COleVariant(array)); //发送数据
save();
load();
UpdateData(FALSE);
}
示例12: wreg
// Write Operation
void CFanmotorDlg::wreg(int reg_addr, int datr)
{
success=1;
VARIANT r;
CByteArray baData;
CStringArray dataStr;
//separate input 2 bytes datr into 1byte + 1byte
int datrH=datr/256;
int datrL=datr%256;
CString regstring;
regstring.Format(_T("%02x "),reg_addr);
CString strinputH;
strinputH.Format(_T("%02x "),datrH);
CString strinputL;
strinputL.Format(_T("%02x"),datrL);
CString str = regstring+strinputH+strinputL;
int timeout_counter=0;
if(this->virtual_board)
{
WriteVirtualBoardReg(reg_addr, datr, fOTP);
return;
}
int parseResult = ParseString(dataStr,str);
if (parseResult != -1){
AfxMessageBox(L"Incorrect Data (\""+dataStr[parseResult]+L"\") is Typed. Please correct it",
MB_ICONERROR | MB_OK,0);
return;
}
else{
if (dataStr.GetSize() == 0) {
AfxMessageBox(L"Type some HEX data to send!",MB_ICONERROR | MB_OK,0);
return;
}
}
for (int i=0; i<dataStr.GetSize(); i++) {
WCHAR *ch,*buf;
buf = dataStr[i].GetBuffer(dataStr[i].GetLength());
BYTE dataByte = (BYTE)wcstol(buf,&ch,16);
dataStr[i].ReleaseBuffer();
baData.Add(dataByte);
}
COleVariant data(baData); // Create array of Data
// Send Data To Bridge
r = Bridge->SendIICdata(L"0000011", 0x49, data);//spi comm, no acknowledge signal return to r.cannot check connection success.
//do{
// timeout_counter++;
// if (timeout_counter == TIMEOUT){
// DisplayInforMessageBox((LPCWSTR)L"Error", (LPCWSTR)L"Device is not available.\nPlease check your hardware connection and power supply!");
// success = 0;
// }
// r = Bridge->SendIICdata(L"0000011", 0x49, data);
//}while ((r.bVal != 34) && (timeout_counter != TIMEOUT));
Sleep(20);
end:;
}
示例13: OnInitDialog
BOOL CTyAnimate_Prop::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_listbmp.SetRectType(false);
m_listbmp.SetColumnType(false);
m_listvec.SetRectType(false);
m_listvec.SetColumnType(false);
CStringArray Head;
CByteArray Cols;
Head.Add("序号");
Cols.Add(20);
Head.Add("图名");
Cols.Add(60);
Head.Add("透明色");
Cols.Add(20);
m_listbmp.InitCtrl(&Head, &Cols);
Head.RemoveAll();
Cols.RemoveAll();
Head.Add("序号");
Cols.Add(20);
Head.Add("图名");
Cols.Add(60);
Head.Add("动态色");
Cols.Add(20);
m_listvec.InitCtrl(&Head, &Cols);
m_listbmp.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)LVS_EX_FULLROWSELECT);
m_listvec.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)LVS_EX_FULLROWSELECT);
if (myanimate.picskind==0)
{
m_listbmp.ShowWindow(SW_SHOW);
m_listvec.ShowWindow(SW_HIDE);
for (int i=0;i<myanimate.piccount;i++)
{
CString tmp;
tmp.Format("%d",i);
Head.RemoveAll();
Head.Add(tmp);
Head.Add(myanimate.pics[i].picname);
if (myanimate.pics[i].pickind==0)
{
Head.Add("无");
}else{
Head.Add("有");
}
int pos=m_listbmp.AddItem(&Head);
m_listbmp.SetItemData(pos,myanimate.pics[i].piccolor);
}
// m_listbmp.SetItemBackgndColor(WHITE,pos,0);
// m_listbmp.SetItemTextColor(BLACK,pos,0);
}
if (myanimate.picskind==1)
{
m_listbmp.ShowWindow(SW_HIDE);
m_listvec.ShowWindow(SW_SHOW);
for (int i=0;i<myanimate.piccount;i++)
{
CString tmp;
tmp.Format("%d",i);
Head.RemoveAll();
Head.Add(tmp);
Head.Add(myanimate.pics[i].picname);
if (myanimate.pics[i].pickind==0)
{
Head.Add("无");
}else{
Head.Add("有");
}
int pos=m_listvec.AddItem(&Head);
m_listvec.SetItemData(pos,myanimate.pics[i].piccolor);
}
// m_listbmp.SetItemBackgndColor(WHITE,pos,0);
// m_listbmp.SetItemTextColor(BLACK,pos,0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例14: GetString
CTobCompiler::EToken CTobCompiler::GetString(CByteArray& bin)
{
CByteArray temp;
int c, d, e;
for(;;)
{
if ((c = fgetc(m_fsrc)) < 0) break;
if (c == '\n') ++m_line;
else if (ms_tokentable[c] == 3)
{
m_err.Format("found invalid char 0x%02X in src file at %p", c, ftell(m_fsrc)-1);
return ERR_NORMAL;
}
else if (c < ' ') continue;
else if (c == '\'' || c == '"')
{
if ((d = fgetc(m_fsrc)) > 0)
{
if (d == ':')
{
if ((d = fgetc(m_fsrc)) < 0) break;
e = GetSizeFromType(d);
if (e == -1)
{
m_err.Format("unknown type '%c' after ':'", d);
return ERR_NORMAL;
}
d = temp.GetSize();
for(int i = 0; i < e; ++i)
bin.Add(((BYTE*)&d)[i]);
}
else if (fseek(m_fsrc, -1, SEEK_CUR))
{
m_err.Format("can not seek src file at %p", ftell(m_fsrc));
return ERR_SEVERE;
}
}
bin.Append(temp);
if (c == '"')
bin.Add(0);
if (m_Option.bIgnoreCase)
strlwr((LPSTR)bin.GetData());
return SYM_STR;
}
else if (c == '\\')
{
if ((c = fgetc(m_fsrc)) < 0) break;
switch(CHAR_UPPER(c))
{
case 'N': c = '\n'; break;
case 'R': c = '\r'; break;
case 'T': c = '\t'; break;
case '0': c = '\0'; break;
case '1': c = '\x01'; break;
case '2': c = '\x02'; break;
case '3': c = '\x03'; break;
case '4': c = '\x04'; break;
case '5': c = '\x05'; break;
case '6': c = '\x06'; break;
case '7': c = '\x07'; break;
case '8': c = '\x08'; break;
case '9': c = '\x09'; break;
case 'A': c = '\x0a'; break;
case 'B': c = '\x0b'; break;
case 'C': c = '\x0c'; break;
case 'D': c = '\x0d'; break;
case 'E': c = '\x0e'; break;
case 'F': c = '\x0f'; break;
case 'X':
{
if ((c = fgetc(m_fsrc)) < 0) goto end_;
BYTE b0 = ms_hextable[c];
if (b0 == 16)
{
m_err.Format("bad hex char 0x%02X after '\\x'", b0);
return ERR_NORMAL;
}
if ((c = fgetc(m_fsrc)) < 0) goto end_;
BYTE b1 = ms_hextable[c];
if (b1 == 16)
{
m_err.Format("bad hex char 0x%02X after '\\x'", b1);
return ERR_NORMAL;
}
temp.Add((BYTE)((b0<<4) + b1));
}
}
}
if (c >= 0x81)
{
if ((d = fgetc(m_fsrc)) < 0) break;
if (d < 0x40)
{
if (fseek(m_fsrc, -1, SEEK_CUR))
{
m_err.Format("can not seek src file at %p", ftell(m_fsrc));
return ERR_SEVERE;
}
//.........这里部分代码省略.........
示例15: if
CTobCompiler::EToken CTobCompiler::CompilePass1()
{
EToken r, LastToken;
CString str, buf, sizebuf;
CByteArray* bin;
SValueType* val;
SExpression* exp;
for(;;)
{
BOOL bSkipGetToken = FALSE;
if ((r = GetToken(str)) <= 0) return r;
_SkipGetToken:
if (r == SYM_DEF)
{
/*
if (m_bin.GetSize() > 0)
{
m_err = "const token can not defined after data";
return ERR_NORMAL;
}
*/
if ((r = GetToken(str)) < 0) return r;
if (r != SYM_TOKEN)
{
m_err = "not found token after '@'";
return ERR_NORMAL;
}
if (str == "_IGNORECASE")
{
m_Option.bIgnoreCase = TRUE;
continue;
}
if ((r = GetToken(buf)) < 0) return r;
if (r == SYM_BIN)
{
bin = new CByteArray;
if ((r = GetBinary(*bin)) < 0) { delete bin; return r; }
AddMap(m_binmap, str, bin);
}
else if (r == SYM_STR)
{
bin = new CByteArray;
if ((r = GetString(*bin)) < 0) { delete bin; return r; }
AddMap(m_binmap, str, bin);
}
else if (r == SYM_INT)
{
ULONG Length;
BOOL bHex = (buf[0] == '0' && buf[1] == 'x');
r = GetToken(sizebuf);
LastToken = r;
if (r == SYM_TYPE)
{
r = GetToken(sizebuf);
if (r != SYM_TOKEN)
{
m_err = "not found type after ':'";
return ERR_NORMAL;
}
Length = GetSizeFromType(sizebuf[0]);
if (Length == -1)
{
m_err.Format("unknown type '%c' after ':'", sizebuf[0]);
return ERR_NORMAL;
}
}
else
{
Length = -1;
}
val = new SValueType((int)strtoul(buf, NULL, bHex ? 16 : 10), Length);
AddMap(m_valmap, str, val);
if (Length == -1)
bSkipGetToken = TRUE;
r = SYM_INT;
}
else if (r == SYM_FLOAT)
{
AddMap(m_valmap, str, new SValueType(atof(buf)));
}
else
{
m_err.Format("not found '[' or ''' or '\"' or number after '@%s'", (LPCTSTR)str);
return ERR_NORMAL;
}
if (m_Option.bIgnoreCase)
str.MakeUpper();
if (str == "_DEFI")
{
if (r != SYM_INT || val->ival < 1 || val->ival > 4)
{
//.........这里部分代码省略.........