当前位置: 首页>>代码示例>>C++>>正文


C++ TRACE1函数代码示例

本文整理汇总了C++中TRACE1函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACE1函数的具体用法?C++ TRACE1怎么用?C++ TRACE1使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TRACE1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: roamingMngr_smHandover

/**
*
* roamingMngr_smHandover 
*
* \b Description: 
*
* This procedure is called when handover should be invoked.
*   Go over the candidate APs and start handover to each of them. 
 * If there's no candidate APs, disconnect.
 * Handover to the current AP is allowed only if the trigger is
 * low quality.
 * 
* \b ARGS:
*
*  I   - hRoamingMngr - roamingMngr SM context  \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
* 
*/
static void roamingMngr_smHandover(TI_HANDLE hRoamingMngr)
{
    roamingMngr_t           *pRoamingMngr;
    bssEntry_t              *pApToConnect;
    apConn_connRequest_t    requestToApConn;

    pRoamingMngr = (roamingMngr_t*)hRoamingMngr;

    if ((pRoamingMngr->handoverWasPerformed) && (pRoamingMngr->candidateApIndex == CURRENT_AP_INDEX))
    {   /* Handover with the current AP already failed, Disconnect */
        roamingMngr_smEvent(ROAMING_EVENT_FAILURE, pRoamingMngr);
        return;
    }
    if (pRoamingMngr->listOfCandidateAps.numOfNeighborBSS > 0)
    {   /* Neighbor APs are the highest priority to Roam */
        pRoamingMngr->candidateApIndex = 
            pRoamingMngr->listOfCandidateAps.neighborBSSList[pRoamingMngr->listOfCandidateAps.numOfNeighborBSS-1];
        pRoamingMngr->listOfCandidateAps.numOfNeighborBSS--;
    }
    else if (pRoamingMngr->listOfCandidateAps.numOfPreAuthBSS > 0)
    {   /* Pre-Auth APs are the second priority to Roam */
        pRoamingMngr->candidateApIndex = 
            pRoamingMngr->listOfCandidateAps.preAuthBSSList[pRoamingMngr->listOfCandidateAps.numOfPreAuthBSS-1];
        pRoamingMngr->listOfCandidateAps.numOfPreAuthBSS--;
    }
    else if (pRoamingMngr->listOfCandidateAps.numOfRegularBSS > 0)
    {   /* Regular APs are APs that are not pre-authenticated and not Neighbor */
        pRoamingMngr->candidateApIndex = 
            pRoamingMngr->listOfCandidateAps.regularBSSList[pRoamingMngr->listOfCandidateAps.numOfRegularBSS-1];
        pRoamingMngr->listOfCandidateAps.numOfRegularBSS--;
    }
    else
    {   /* No Candidate APs */
        pRoamingMngr->candidateApIndex = INVALID_CANDIDATE_INDEX;
    }

    TRACE1(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_smHandover, candidateApIndex=%d \n", pRoamingMngr->candidateApIndex);


    if (pRoamingMngr->candidateApIndex == INVALID_CANDIDATE_INDEX)
    {   /* No cnadidate to Roam to, only the current AP is candidate */
        if (pRoamingMngr->roamingTrigger <= ROAMING_TRIGGER_LOW_QUALITY_GROUP)
        {   /* If the trigger to Roam is low quality, and there are no candidate APs
                to roam to, retain connected to the current AP */
            requestToApConn.requestType = (pRoamingMngr->handoverWasPerformed) ? AP_CONNECT_RECONNECT_CURR_AP : AP_CONNECT_RETAIN_CURR_AP;
            pRoamingMngr->candidateApIndex = CURRENT_AP_INDEX;
        }
        else
        {   /* Disconnect the BSS, there are no more APs to roam to */
            roamingMngr_smEvent(ROAMING_EVENT_FAILURE, pRoamingMngr);
            return;
        }
    }
    else
    {   /* There is a valid candidate AP */
        if (pRoamingMngr->roamingTrigger > ROAMING_TRIGGER_FAST_CONNECT_GROUP)
        {   /* Full re-connection should be perfromed */
            requestToApConn.requestType = AP_CONNECT_FULL_TO_AP; 
        }
        else
        {   /* Fast re-connection should be perfromed */
            requestToApConn.requestType = AP_CONNECT_FAST_TO_AP; 
        }
    }
#ifdef TI_DBG
    /* For debug */
    if (!pRoamingMngr->handoverWasPerformed)
    {   /* Take the time before the first handover started */
        pRoamingMngr->roamingHandoverStartedTimestamp = os_timeStampMs(pRoamingMngr->hOs);
    }
#endif
    
    if (pRoamingMngr->candidateApIndex == CURRENT_AP_INDEX)
    {   /* get the current AP */
        pApToConnect = apConn_getBSSParams(pRoamingMngr->hAPConnection);
    }
    else
    {   /* get the candidate AP */
//.........这里部分代码省略.........
开发者ID:Achotjan,项目名称:FreeXperia,代码行数:101,代码来源:roamingMngr_autoSM.c

示例2: iterateRawmidiDevices

// for each ALSA device, call iterator. userData is passed to the iterator
// returns total number of iterations
static int iterateRawmidiDevices(snd_rawmidi_stream_t direction,
                                 DeviceIteratorPtr iterator,
                                 void* userData) {
    int count = 0;
    int subdeviceCount;
    int card, dev, subDev;
    char devname[16];
    int err;
    snd_ctl_t *handle;
    snd_rawmidi_t *rawmidi;
    snd_rawmidi_info_t *rawmidi_info;
    snd_ctl_card_info_t *card_info, *defcardinfo = NULL;
    UINT32 deviceID;
    int doContinue = TRUE;

    snd_rawmidi_info_malloc(&rawmidi_info);
    snd_ctl_card_info_malloc(&card_info);

    // 1st try "default" device
    if (direction == SND_RAWMIDI_STREAM_INPUT) {
        err = snd_rawmidi_open(&rawmidi, NULL, ALSA_DEFAULT_DEVICE_NAME,
                               SND_RAWMIDI_NONBLOCK);
    } else if (direction == SND_RAWMIDI_STREAM_OUTPUT) {
        err = snd_rawmidi_open(NULL, &rawmidi, ALSA_DEFAULT_DEVICE_NAME,
                               SND_RAWMIDI_NONBLOCK);
    } else {
        ERROR0("ERROR: iterateRawmidiDevices(): direction is neither"
               " SND_RAWMIDI_STREAM_INPUT nor SND_RAWMIDI_STREAM_OUTPUT\n");
        err = MIDI_INVALID_ARGUMENT;
    }
    if (err < 0) {
        ERROR1("ERROR: snd_rawmidi_open (\"default\"): %s\n",
               snd_strerror(err));
    } else {
        err = snd_rawmidi_info(rawmidi, rawmidi_info);

        snd_rawmidi_close(rawmidi);
        if (err < 0) {
            ERROR1("ERROR: snd_rawmidi_info (\"default\"): %s\n",
                    snd_strerror(err));
        } else {
            // try to get card info
            card = snd_rawmidi_info_get_card(rawmidi_info);
            if (card >= 0) {
                sprintf(devname, ALSA_HARDWARE_CARD, card);
                if (snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK) >= 0) {
                    if (snd_ctl_card_info(handle, card_info) >= 0) {
                        defcardinfo = card_info;
                    }
                    snd_ctl_close(handle);
                }
            }
            // call calback function for the device
            if (iterator != NULL) {
                doContinue = (*iterator)(ALSA_DEFAULT_DEVICE_ID, rawmidi_info,
                                         defcardinfo, userData);
            }
            count++;
        }
    }

    // iterate cards
    card = -1;
    TRACE0("testing for cards...\n");
    if (snd_card_next(&card) >= 0) {
        TRACE1("Found card %d\n", card);
        while (doContinue && (card >= 0)) {
            sprintf(devname, ALSA_HARDWARE_CARD, card);
            TRACE1("Opening control for alsa rawmidi device \"%s\"...\n", devname);
            err = snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK);
            if (err < 0) {
                ERROR2("ERROR: snd_ctl_open, card=%d: %s\n", card, snd_strerror(err));
            } else {
                TRACE0("snd_ctl_open() SUCCESS\n");
                err = snd_ctl_card_info(handle, card_info);
                if (err < 0) {
                    ERROR2("ERROR: snd_ctl_card_info, card=%d: %s\n", card, snd_strerror(err));
                } else {
                    TRACE0("snd_ctl_card_info() SUCCESS\n");
                    dev = -1;
                    while (doContinue) {
                        if (snd_ctl_rawmidi_next_device(handle, &dev) < 0) {
                            ERROR0("snd_ctl_rawmidi_next_device\n");
                        }
                        TRACE0("snd_ctl_rawmidi_next_device() SUCCESS\n");
                        if (dev < 0) {
                            break;
                        }
                        snd_rawmidi_info_set_device(rawmidi_info, dev);
                        snd_rawmidi_info_set_subdevice(rawmidi_info, 0);
                        snd_rawmidi_info_set_stream(rawmidi_info, direction);
                        err = snd_ctl_rawmidi_info(handle, rawmidi_info);
                        TRACE0("after snd_ctl_rawmidi_info()\n");
                        if (err < 0) {
                            if (err != -ENOENT) {
                                ERROR2("ERROR: snd_ctl_rawmidi_info, card=%d: %s", card, snd_strerror(err));
                            }
                        } else {
//.........这里部分代码省略.........
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:101,代码来源:PLATFORM_API_LinuxOS_ALSA_MidiUtils.c

示例3: TRACE0

bregonig *recompile_onig_ex(bregonig *rxold,
                            pattern_type type, const TCHAR *ptn,
                            const TCHAR *patternp, const TCHAR *patternendp,
                            const TCHAR *prerepp, const TCHAR *prerependp,
                            const TCHAR *optionp, const TCHAR *optionendp,
                            TCHAR *msg)
{
    int flag, compare;
    bregonig *rx;
    OnigOptionType option;
    OnigEncoding enc;
    TRACE0(_T("recompile_onig_ex()\n"));
    TRACE2(_T("patternp: %s, len: %d\n"), patternp, patternendp-patternp);
    TRACE2(_T("prerepp: %s, len: %d\n"), prerepp, prerependp-prerepp);
    TRACE2(_T("optionp: %s, len: %d\n"), optionp, optionendp-optionp);


    compare = compare_pattern(rxold, type, patternp, patternendp,
                              prerepp, prerependp, optionp, optionendp);
    TRACE1(_T("compare: %d\n"), compare);
    if (compare < 0) {
        // need to compile
        delete rxold;
        rxold = NULL;

        if (patternp == NULL
                || ((type == PTN_SUBST || type == PTN_TRANS) && prerepp == NULL)) {
            asc2tcs(msg, "invalid reg parameter", BREGEXP_MAX_ERROR_MESSAGE_LEN);
            return NULL;
        }
    } else {
        // no need to compile
        if (rxold->outp) {
            delete [] rxold->outp;
            rxold->outp = NULL;
        }
        if (rxold->splitp) {
            delete [] rxold->splitp;
            rxold->splitp = NULL;
        }
    }

    parse_option(optionp, optionendp, &option, &enc, &flag);

    if (type == PTN_TRANS) {
        if (compare == 0) {
            // no need to compile
            TRACE1(_T("rxold(1):0x%08x\n"), rxold);
            return rxold;
        }
        rx = trcomp(patternp, patternendp, prerepp, prerependp, flag, msg);
        if (rx == NULL) {
            return NULL;
        }
    } else {
        if (compare == 0) {
            // no need to compile
            TRACE1(_T("rxold(2):0x%08x\n"), rxold);
            return rxold;
        } else if (compare < 0) {
            // pattern string needs to compile.
            rx = new (std::nothrow) bregonig();
            if (rx == NULL) {
                asc2tcs(msg, "out of space regexp", BREGEXP_MAX_ERROR_MESSAGE_LEN);
                return NULL;
            }
            OnigErrorInfo err_info;
            int err_code = onig_new(&rx->reg,
                                    (UChar*) patternp, (UChar*) patternendp,
                                    option, enc, &OnigSyntaxPerl_NG_EX, &err_info);
            if (err_code != ONIG_NORMAL) {
                onig_err_to_bregexp_msg(err_code, &err_info, msg);
                delete rx;
                return NULL;
            }

            rx->nparens = onig_number_of_captures(rx->reg);	//
            rx->pmflags = flag;
        } else {
            // only replace string needs to compile.
            rx = rxold;
        }
        if (rxold != NULL && rxold->repstr != NULL) {
            delete rxold->repstr;
            rxold->repstr = NULL;
        }
        if (type == PTN_SUBST) {						// substitute
            try {
                rx->pmflags |= PMf_SUBSTITUTE;
                rx->repstr = compile_rep(rx, prerepp, prerependp);	// compile replace string
            } catch (std::exception& ex) {
                asc2tcs(msg, ex.what(), BREGEXP_MAX_ERROR_MESSAGE_LEN);
                delete rx;
                return NULL;
            }
        }
    }

    if (ptn != NULL) {
        size_t plen = _tcslen(ptn);
//.........这里部分代码省略.........
开发者ID:k-takata,项目名称:bregonig,代码行数:101,代码来源:bregonig.cpp

示例4: TRACE1

int CSAStatusLog::MapOpen(int nType)
{
    if( m_csFileName.IsEmpty() ) 
        return -1; 
    
    m_nType	= nType;
    CString strPath	= m_csFileName;
    //	if( !FolderExist( strPath ) )

    // 创建文件对象

    HANDLE hFile = (HANDLE)CreateFile(strPath, GENERIC_READ,\
        0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if (hFile == INVALID_HANDLE_VALUE)
    {
        TRACE1("创建文件对象失败,错误代码:%d\n ", GetLastError());
        return -1;
    }
    // 得到文件尺寸
    DWORD dwFileSizeHigh;
    m_qwFileSize = GetFileSize(hFile, &dwFileSizeHigh);
    m_qwFileSize |= (((__int64)dwFileSizeHigh) << 32);
    m_qwFileSize+=sizeof(char);
    if( m_qwFileSize >= __MAX_LOGFILE_SIZE__)
    {
        CloseHandle(hFile);
        return -1;
    }
    // 创建文件映射对象
    if( nType == OT_WRITE )
        m_hFileMap = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, __MAX_LOGFILE_SIZE__, NULL);
    else
        m_hFileMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
    if (m_hFileMap == NULL)
    {
        // 关闭文件对象
        CloseHandle(hFile);
        TRACE1("%s",GetLastError);
        TRACE1("创建文件映射对象失败,错误代码:%d ", GetLastError());
        return -1;
    }
    // 得到系统分配粒度
    SYSTEM_INFO SysInfo;
    GetSystemInfo(&SysInfo);
    DWORD dwGran = SysInfo.dwAllocationGranularity;
          //   当数据写满60%时,为防数据溢出,需要在其后开辟一新的映射视图   

    // 得到文件尺寸
    __int64 qwFileSize = GetFileSize(hFile, &dwFileSizeHigh);
    qwFileSize |= (((__int64)dwFileSizeHigh) << 32);
    // 关闭文件对象
    CloseHandle(hFile);
    // 块大小
    DWORD dwBlockBytes = 1000 * dwGran;
    if (qwFileSize < 1000 * dwGran)
        dwBlockBytes = (DWORD)qwFileSize;
    
    // 映射视图
    m_lpbMapAddress = (TCHAR *)MapViewOfFile(m_hFileMap,FILE_MAP_READ, 0, 0, dwBlockBytes);
    if (m_lpbMapAddress == NULL)
    {
        AfxMessageBox("映射文件映射失败,错误代码:%d ", GetLastError());
        return -1;
    }
    
    m_fMapOpen		= TRUE;
    
    return 0;
}
开发者ID:liguyu,项目名称:cppexample,代码行数:69,代码来源:SAStatusLog.cpp

示例5: inet_addr

// 生成时统报文设置帧
void CTailTimeFrameSocket::MakeTimeDelayFrameData(CInstrument* pInstrument, unsigned int uiTimeHigh, unsigned int uiTimeLow)
{
    unsigned int uiIPSource =	0;
    unsigned int uiIPAim	=	0;
    unsigned int usPortAim	=	0;
    unsigned int usCommand	=	0;
    for(int i=0; i<SndFrameSize; i++)
    {
        m_pTimeDelayData[i] = 0x00;
    }
    m_pTimeDelayData[0] = 0x11;
    m_pTimeDelayData[1] = 0x22;
    m_pTimeDelayData[2] = 0x33;
    m_pTimeDelayData[3] = 0x44;
    m_pTimeDelayData[4] = 0x00;
    m_pTimeDelayData[5] = 0x00;
    m_pTimeDelayData[6] = 0x00;
    m_pTimeDelayData[7] = 0x00;
    m_pTimeDelayData[8] = 0x00;
    m_pTimeDelayData[9] = 0x00;
    m_pTimeDelayData[10] = 0x00;
    m_pTimeDelayData[11] = 0x00;
    m_pTimeDelayData[12] = 0x00;
    m_pTimeDelayData[13] = 0x00;
    m_pTimeDelayData[14] = 0x00;
    m_pTimeDelayData[15] = 0x00;

    uiIPSource	=	inet_addr(m_csIPSource);
    uiIPAim		=	pInstrument->m_uiIPAddress;
    usPortAim	=	TimeSetPort;
    usCommand	=	SendSetCmd;
    // 源IP地址
    memcpy(&m_pTimeDelayData[16], &uiIPSource, 4);
    // 目标IP地址
    memcpy(&m_pTimeDelayData[20], &uiIPAim, 4);
    TRACE1("时统设置帧-仪器IP地址:%d\r\n", uiIPAim);
    // 目标端口号
    memcpy(&m_pTimeDelayData[24], &usPortAim, 2);
    // 命令号 1-设置命令应答;2-查询命令应答;3-AD采样数据重发
    memcpy(&m_pTimeDelayData[26], &usCommand, 2);

    int iPos = 32;
    // 命令字0x05修正时延高位
    m_pTimeDelayData[iPos] = 0x05;
    iPos++;
    memcpy(&m_pTimeDelayData[iPos], &uiTimeHigh, 4);
    iPos = iPos + 4;

    // 命令字0x06修正时延低位
    m_pTimeDelayData[iPos] = 0x06;
    iPos++;
    memcpy(&m_pTimeDelayData[iPos], &uiTimeLow, 4);
    iPos = iPos + 4;

    // 设置命令字结束
    m_pTimeDelayData[iPos] = 0x00;

    unsigned short usCRC16 = 0;
    usCRC16 = get_crc_16(&m_pTimeDelayData[FrameHeadSize], SndFrameSize - FrameHeadSize - CRCCheckSize);
    memcpy(&m_pTimeDelayData[SndFrameSize - CRCSize], &usCRC16, 2);
}
开发者ID:liquanhai,项目名称:cxm-hitech-matrix428,代码行数:62,代码来源:TailTimeFrameSocket.cpp

示例6: Flashram_Command

/*
 =======================================================================================================================
 =======================================================================================================================
 */
void Flashram_Command(unsigned __int32 data)
{
    DEBUG_FLASHRAM_TRACE(TRACE1("*** CMD = %08X ***", data));
    switch(data >> 24)
    {
    case 0x4b:	/* Set Erase Block Mode (128 Byte - aligned ) */
        DEBUG_FLASHRAM_TRACE(TRACE0("Flash Erase Mode"));
        FlashRAM_Mode = FLASH_ERASE;
        FlashRAM_Offset = (data & 0xFFFF) * 128;
        break;

    case 0x78:	/* Second part of the Erase Block */
        DEBUG_FLASHRAM_TRACE(TRACE0("Flash Erase Block"));
        FlashRAM_Status[0] = 0x11118008;
        FlashRAM_Status[1] = 0x00c20000;
        break;

    /* Init a FlashWrite */
    case 0xb4:
        DEBUG_FLASHRAM_TRACE(TRACE0("Flash FlashWrite Init"));
        FlashRAM_Mode = FLASH_WRITE;
        break;

    /* Sets the Block for the FlashWrite (128 Byte - aligned ) */
    case 0xa5:
        DEBUG_FLASHRAM_TRACE(TRACE0("Flash FlashWrite"));
        FlashRAM_Offset = (data & 0xFFFF) * 128;
        FlashRAM_Status[0] = 0x11118004;
        FlashRAM_Status[1] = 0x00c20000;
        break;

    case 0xD2:
        {		/* Flash RAM Execute */
            switch(FlashRAM_Mode)
            {
            case FLASH_NOOP:
                break;
            case FLASH_ERASE:
                DEBUG_FLASHRAM_TRACE(TRACE1("Executed Erase: %08X", FlashRAM_Offset));
                memset(pLOAD_UBYTE_PARAM(0xA8000000) + FlashRAM_Offset, 0xFF, 128);
                FileIO_WriteFLASHRAM(0,0,0);	//Write to disk
                break;
            case FLASH_WRITE:
                DEBUG_FLASHRAM_TRACE(TRACE1("Executed Write: %08X", FlashRAM_Offset));
                memcpy(pLOAD_UBYTE_PARAM(0xA8000000) + FlashRAM_Offset, &FlashRAM_Buffer[0], 128);
                FileIO_WriteFLASHRAM(0,0,0);	//Write to disk
                break;
            }
        }
        break;
    case 0xE1:
        {		/* Set FlashRAM Status */
            DEBUG_FLASHRAM_TRACE(TRACE0("Flash Status"));
            FlashRAM_Mode = FLASH_STATUS;
            FlashRAM_Status[0] = 0x11118001;
            FlashRAM_Status[1] = 0x00c20000;
        }
        break;
    case 0xF0:	/* Set FlashRAM Read */
        /* DEBUG_FLASHRAM_TRACE(TRACE0 ("Flash Read")); */
        FlashRAM_Mode = FLASH_NOOP;
        FlashRAM_Offset = 0;
        FlashRAM_Status[0] = 0x11118004;
        FlashRAM_Status[1] = 0xf0000000;
        break;
    }
}
开发者ID:LegendOfDragoon,项目名称:1964-X,代码行数:71,代码来源:gamesave.cpp

示例7: genSM_Event

void genSM_Event (TI_HANDLE hGenSM, TI_UINT32 uEvent, void *pData)
{
    TGenSM              *pGenSM =       (TGenSM*)hGenSM;
    TGenSM_actionCell   *pCell;

#ifdef TI_DBG
    /* sanity check */
    if (pGenSM == NULL)
    {
        os_printf("genSM_Event: Handle is NULL!!\n");
        return;
    }
    if (uEvent >= pGenSM->uEventNum)
    {
        TRACE3(pGenSM->hReport, REPORT_SEVERITY_ERROR , "genSM_Event: module: %d received event %d, which is out of events boundry %d\n", pGenSM->uModuleLogIndex, uEvent, pGenSM->uEventNum);
    }
    if (TI_TRUE == pGenSM->bEventPending)
    {
        TRACE3(pGenSM->hReport, REPORT_SEVERITY_ERROR , "genSM_Event: module: %d received event %d, when event %d is pending execution!\n", pGenSM->uModuleLogIndex, uEvent, pGenSM->uEvent);
    }
#endif

    /* mark that an event is pending */
    pGenSM->bEventPending = TI_TRUE;

    /* save event and data */
    pGenSM->uEvent = uEvent;
    pGenSM->pData = pData;

    /* if an event is currently executing, return (new event will be handled when current event is done) */
    if (TI_TRUE == pGenSM->bInAction)
    {
        TRACE1(pGenSM->hReport, REPORT_SEVERITY_INFORMATION , ": module: %d delaying execution of event \n", pGenSM->uModuleLogIndex);
        return;
    }

    /* execute events, until none is pending */
    while (TI_TRUE == pGenSM->bEventPending)
    {
        /* get the cell pointer for the current state and event */
        pCell = &(pGenSM->tMatrix[ (pGenSM->uCurrentState * pGenSM->uEventNum) + pGenSM->uEvent ]);


        /* print state transition information */
        TRACE4(pGenSM->hReport, REPORT_SEVERITY_INFORMATION, "genSM_Event: module %d <currentState = %d, event = %d> --> nextState = %d\n", pGenSM->uModuleLogIndex, pGenSM->uCurrentState, uEvent, pCell->uNextState);

        /* mark that event execution is in place */
        pGenSM->bInAction = TI_TRUE;

        /* mark that pending event is being handled */
        pGenSM->bEventPending = TI_FALSE;

        /* update current state */
        pGenSM->uCurrentState = pCell->uNextState;

        /* run transition function */
        (*(pCell->fAction)) (pGenSM->pData);

        /* mark that event execution is complete */
        pGenSM->bInAction = TI_FALSE;
    }
}
开发者ID:Achotjan,项目名称:FreeXperia,代码行数:62,代码来源:GenSM.c

示例8: cmdBld_CmdIeTest

/****************************************************************************
 *                      cmdBld_BitIeTestCmd()
 ****************************************************************************
 * DESCRIPTION:
 * INPUTS: None
 *
 * OUTPUT:  None
 *
 * RETURNS: TI_OK or TI_NOK
 ****************************************************************************/
TI_STATUS cmdBld_CmdIeTest (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmd)
{
    TCmdBld      *pCmdBld = (TI_HANDLE)hCmdBld;
    TI_UINT32    paramLength;
    TI_BOOL      bIsCBfuncNecessary = TI_TRUE;

    if (NULL == pTestCmd) {
        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, " pTestCmd_Buf = NULL!!!\n");
        return TI_NOK;
    }

    if ( (TestCmdID_enum)pTestCmd->testCmdId < MAX_TEST_CMD_ID ) {
        bIsCBfuncNecessary = TI_TRUE;
    } else {
        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_WARNING, " Unsupported testCmdId (%d)\n", pTestCmd->testCmdId);
    }

    if (bIsCBfuncNecessary && fCb == NULL) {
        return TI_OK;
    }

    switch( pTestCmd->testCmdId ) {
    case TEST_CMD_PD_BUFFER_CAL:
        paramLength = sizeof(TTestCmdPdBufferCal);
        break;

    case TEST_CMD_P2G_CAL:
        paramLength = sizeof(TTestCmdP2GCal);
        break;

    case TEST_CMD_RX_STAT_GET:
        paramLength = sizeof(RadioRxStatistics);
        break;

        /* packet */
    case TEST_CMD_FCC:
        paramLength = sizeof(TPacketParam);
        break;

        /* tone */
    case TEST_CMD_TELEC:
        paramLength = sizeof(TToneParam);
        break;

    case TEST_CMD_PLT_TEMPLATE:
        paramLength = sizeof(TTxTemplate);
        break;

        /* channel tune */
    case TEST_CMD_CHANNEL_TUNE:
        paramLength = sizeof(TTestCmdChannel);
        break;

    case TEST_CMD_GET_FW_VERSIONS:
        paramLength = sizeof(TFWVerisons);
        break;

    case TEST_CMD_INI_FILE_RADIO_PARAM:
        paramLength = sizeof(IniFileRadioParam);
        break;

    case TEST_CMD_INI_FILE_GENERAL_PARAM:
        paramLength = sizeof(IniFileGeneralParam);
        break;

    case TEST_CMD_PLT_GAIN_ADJUST:
        paramLength = sizeof(uint32);
        break;

    case TEST_CMD_RUN_CALIBRATION_TYPE:
        paramLength = sizeof(TTestCmdRunCalibration);
        break;

    case TEST_CMD_TX_GAIN_ADJUST:
        paramLength = sizeof(TTxGainAdjust);
        break;
    case TEST_CMD_TEST_TONE:
        paramLength = sizeof(TestToneParams_t);
        break;

    case TEST_CMD_SET_EFUSE:
        paramLength = sizeof(EfuseParameters_t);
        break;
    case TEST_CMD_GET_EFUSE:
        paramLength = sizeof(EfuseParameters_t);
        break;

    case TEST_CMD_RX_PLT_CAL:
        paramLength = sizeof(RadioRxPltCal);
        break;
//.........这里部分代码省略.........
开发者ID:3ig,项目名称:Xperia-2011-Official-Kernel-Sources,代码行数:101,代码来源:CmdBldCmdIE.c

示例9: TRACE1

// Parses Ecmt packets
void CEcmtMidpDebugPlugin::HandleNotifyL(const CEcmtMessageEvent& aEvent)
{
    static const TInt KMinMsgSize[] = {
        0,
        ECMT_MIDP_DEBUG_OPEN_SIZE,
        ECMT_MIDP_DEBUG_CLOSE_SIZE,
        ECMT_MIDP_DEBUG_SEND_MIN_SIZE,
        ECMT_MIDP_DEBUG_CONNECT_SIZE,
        ECMT_MIDP_DEBUG_RESET_SIZE
    };

    static const TInt KMaxMsgSize[] = {
        0,
        ECMT_MIDP_DEBUG_OPEN_SIZE,
        ECMT_MIDP_DEBUG_CLOSE_SIZE,
        ECMT_MIDP_DEBUG_SEND_MAX_SIZE,
        ECMT_MIDP_DEBUG_CONNECT_SIZE,
        ECMT_MIDP_DEBUG_RESET_SIZE
    };

    const TPtrC8 msg = iMessaging->Message(aEvent);
    TInt msglen = msg.Length();
    if (msglen >= ECMT_MIDP_DEBUG_HEADER_SIZE)
    {
        // Decode the header
        TUint opcode = msg[ECMT_MIDP_DEBUG_HEADER_OPCODE_OFFSET];
        TUint sid = (msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET] << 24) | 
            (msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET+1] << 16) |
            (msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET+2] << 8) |
            (msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET+3]);

        // Check opcode
        if (opcode < ECMT_MIDP_DEBUG_OPCODE_MIN ||
            opcode > ECMT_MIDP_DEBUG_OPCODE_MAX)
        {
            TRACE1("invalid opcode: %u",opcode);
            return;
        }

        // Check message size
        if (msglen < KMinMsgSize[opcode] || 
            msglen > KMaxMsgSize[opcode])
        {
            TRACE2("opcode %u, invalid message size %u",opcode,msglen);
            return;
        }

        // Try to find existing session
        TInt index = -1;
        CEcmtMidpDebugSession* session = FindSession(sid, index);
        switch (opcode) {
        case ECMT_MIDP_DEBUG_OPCODE_OPEN:
            if (session)
            {
                TRACE2("OPEN: destroying session %08X (%d)",session,sid);
                delete session;
                iSessions.Remove(index);
            }
            session = CEcmtMidpDebugSession::NewL(sid,this,iMessaging);
            CleanupStack::PushL(session);
            LEAVE_IF_ERROR(iSessions.Append(session));
            CleanupStack::Pop(session);
            TRACE2("OPEN: created new session %08X (%u)",session,sid);
            break;
                
        case ECMT_MIDP_DEBUG_OPCODE_CLOSE:
            if (session)
            {
                TRACE2("CLOSE: destroying session %08X (%u)",session,sid);
                delete session;
                iSessions.Remove(index);
            }
            else
            {
                TRACE1("CLOSE: no such session: %u",sid); 
            }
            break;

        case ECMT_MIDP_DEBUG_OPCODE_SEND:
            if (session)
            {
                TUint cid = (msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET] << 24) | 
                    (msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET+1] << 16) |
                    (msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET+2] << 8) |
                    (msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET+3]);
                TUint seq = (msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET] << 24) | 
                    (msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET+1] << 16) |
                    (msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET+2] << 8) |
                    (msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET+3]);
                session->Send(cid, seq,
                    msg.Right(msglen - ECMT_MIDP_DEBUG_SEND_DATA_OFFSET));
            }
            else
            {
                // Tell the other side that this session id is invalid
                TRACE1("SEND: invalid sid %u",sid);
                SendSessionCloseMessage(sid);
            }
            break;
//.........这里部分代码省略.........
开发者ID:fedor4ever,项目名称:packaging,代码行数:101,代码来源:EcmtMidpDebugPlugin.cpp

示例10: CRealFtpClient

/**
* GetFtpDirectory
*
* Description: 1) Conect to ftp server, change directory. 
*	2) Get dir listing.
*	3) Read existing listing file, 
*	4) If listing has changed, write new dir listing file.
*
* Parameters:	CConnection - describes ftp connection info, user, host etc.
*				dir - ftp remote directory
*				ftpClient - optional ftpclient. if null, will create, connect and close.
* Return:
*				bool - success
* ??? was it updated?
*/
bool CFtpManager::GetFtpDirectory(CConnection * con, CString &directory, CRealFtpClient * ftpClient)
{
    bool result = false;
    //TRACE1(" con %s \n ", con->name);

    //Connect(con, m_ftpClient);
    //if(!m_ftpClient.IsConnected()) // Not connected
    //{
    //	return;
    //}
    bool closeConnection = false;
    if(!ftpClient)
    {
        ftpClient = new CRealFtpClient();
        closeConnection = true;
    }
    if(!ftpClient->IsConnected()) // Not connected
    {
        int retcode = 11;
        retcode = ftpClient->FTPConnect(con->host, con->user, con->password, _T(""));
        if(retcode == UTE_SUCCESS)
        {
            ftpClient->SetFireWallMode(TRUE);
        }
    }

    //m_ftpClient.SetFireWallMode(TRUE);
    //ftpClient->SetFireWallMode(TRUE);

    CString localStorePath;
    GetLocalStorePath(con, localStorePath);
    localStorePath = localStorePath + directory + CString(_T(""));
    localStorePath.Replace('/', '\\');

    CString dirContentListing(_T(""));
    CString fileListing(_T(""));
    CString folderListing(_T(""));

    CUT_DIRINFO di;
    _TCHAR entry[HISTORY_ENTRY_SIZE];
    _TCHAR dir[MAX_PATH];
    int valRet;
    {
        valRet = ftpClient->ChDir( directory );
        if (valRet != UTE_SUCCESS){
            //m_history.AddLine(CUT_ERR::GetErrorString (valRet));
            TRACE1(" chdir failed: %s \n ", CUT_ERR::GetErrorString(valRet) );
        }
        else 
        {
            int dirInfo = ftpClient->GetDirInfo();

            int count = ftpClient->GetDirInfoCount();
            for(int t=0;t<count;t++){
                ftpClient->GetDirEntry(t, &di);
                // v4.2 dir info now has _TCHAR
                // Format: Name,size,time, time display
                _sntprintf(entry, 
                    sizeof(entry)/sizeof(_TCHAR), 
                    _T("<n>%s</n><s>%ld</s><d>%2.2d/%2.2d/%2.2d %2.2d:%2.2d</d><p>%d</p><o>%s</o><g>%s</g>"),
                    di.fileName, di.fileSize,
                    di.year, di.month, di.day, di.hour, di.minute, di.permissions, di.owner, di.group);
                    
                //m_history.AddLine(entry);

                if(di.isDir)
                {
                    CString folderPath(localStorePath + _T("") + di.fileName );
                    if(GetFileAttributes(folderPath) == INVALID_FILE_ATTRIBUTES){
                        CreateDirectory(folderPath, NULL);
                    }

                    CString fileInfo(_T(""));
                    fileInfo = fileInfo + CString(_T("<t>d</t>")) + CString(entry) + _T("\n");
                    folderListing = folderListing + fileInfo;
                } else {
                    // File
                    CString fileInfo(_T(""));
                    fileInfo = fileInfo + CString(_T("<t>f</t>")) + CString(entry) + _T("\n");
                    fileListing = fileListing + fileInfo;
                }
            }
            dirContentListing = CString(folderListing + fileListing);

            
//.........这里部分代码省略.........
开发者ID:Omgan,项目名称:RealFTP.net,代码行数:101,代码来源:FtpManager.cpp

示例11: CString


//.........这里部分代码省略.........
    BOOL bWorking = finder.FindFile(localStoreSearchPath);
    while (bWorking)
    {
        bWorking = finder.FindNextFile();
        if(finder.IsDirectory())
        {
            CFileContainer f;
            f.dir = 1;
            f.name = finder.GetFileName(); //  .GetFileTitle();
            f.path = CString(dir); //finder.GetFilePath();
            f.localPath = CString(localStorePath);
            if(f.name.Trim().Compare(_T(".")) != 0 && f.name.Trim().Compare(_T("..")) != 0){
                //files.push_back(f);
            }
        } 
        // else sync local file
    }
    finder.Close();
    */

    // Read file 
    CString dirContentFile(localStorePath + _T(".files.rftp"));

    //char nameBuffer[100];
    //sprintf(nameBuffer, "%S", dirContentFile); // CString to char *
    
    CFileStatus status;
    if(CFile::GetStatus(dirContentFile, status))
    {
        CStdioFile file (dirContentFile, CStdioFile::modeRead | CFile::shareDenyNone);
        CString buffer;
        //CString string;
        while (file.ReadString(buffer))
        {
            CXml xml;

            CString type(_T(""));
            xml.GetTag(buffer, CString(_T("t")), type);
            bool isDir = false;
            if(type.Compare(_T("d")) == 0){
                isDir = true;
            }
            

            CString fileName(_T(""));
            xml.GetTag(buffer, CString(_T("n")), fileName);

            
            // size
            long size = 0;
            CString fileSize(_T(""));
            if(xml.GetTag(buffer, CString(_T("s")), fileSize)){
                fileSize = fileSize.Trim();
                if(fileSize.GetLength() > 0){
                    size = _wtol(fileSize);
                }
            }

            // Date
            CString fileDate(_T(""));
            xml.GetTag(buffer, CString(_T("d")), fileDate);	
            fileDate = fileDate.Trim();
            

            // permissions
            CString filePermissions(_T(""));
            xml.GetTag(buffer, CString(_T("p")), filePermissions);	
            filePermissions = filePermissions.Trim();

            //TRACE1(" line: %s \n", buffer);
            CFileContainer f;
            if(isDir){
                f.dir = 1;
            } else {
                f.dir = 0;
            }
            f.name = fileName; 
            f.path = CString(dir); 
            f.localPath = CString(localStorePath);
            f.size = size;
            f.remoteDate = CString(fileDate);
            f.host = CString(con->host);
            //TRACE1("filePermissions %s \n " , filePermissions);
            f.permissions = CString(filePermissions);
            
            if(f.name.Trim().Compare(_T(".")) != 0 && f.name.Trim().Compare(_T("..")) != 0 ){
                int i = 0;
                files.push_back(f);
            }
        }
    } 
    else 
    {
        // Directory not read.
        //GetFtpDirectory(con, dir, NULL);
        TRACE1(" ReadLocalDirectory not found: %s \n", dir);
        result = false;
    }
    return result;
}
开发者ID:Omgan,项目名称:RealFTP.net,代码行数:101,代码来源:FtpManager.cpp

示例12: EplLinInit

static int __init EplLinInit(void)
{

    tEplKernel EplRet;
    int iErr;
    int iRet;
#ifdef CONFIG_DEVFS_FS
    int nMinorNumber;
#endif

    TRACE0("EPL: + EplLinInit...\n");
    TRACE2("EPL:   Driver build: %s / %s\n", __DATE__, __TIME__);

    iRet = 0;

    // initialize global variables
    atomic_set(&AtomicEventState_g, EVENT_STATE_INIT);
    sema_init(&SemaphoreCbEvent_g, 1);
    init_waitqueue_head(&WaitQueueCbEvent_g);
    init_waitqueue_head(&WaitQueueProcess_g);
    init_waitqueue_head(&WaitQueueRelease_g);

#ifdef CONFIG_DEVFS_FS

    // register character device handler
    TRACE2("EPL:   Installing Driver '%s', Version %s...\n",
           EPLLIN_DRV_NAME, EPL_PRODUCT_VERSION);
    TRACE0("EPL:   (using dynamic major number assignment)\n");
    nDrvMajorNumber_g =
        register_chrdev(0, EPLLIN_DRV_NAME, &EplLinFileOps_g);
    if (nDrvMajorNumber_g != 0) {
        TRACE2
            ("EPL:   Driver '%s' installed successful, assigned MajorNumber=%d\n",
             EPLLIN_DRV_NAME, nDrvMajorNumber_g);
    } else {
        TRACE1
            ("EPL:   ERROR: Driver '%s' is unable to get a free MajorNumber!\n",
             EPLLIN_DRV_NAME);
        iRet = -EIO;
        goto Exit;
    }

    // create device node in DEVFS
    nMinorNumber = 0;
    TRACE1("EPL:   Creating device node '/dev/%s'...\n", EPLLIN_DEV_NAME);
    iErr =
        devfs_mk_cdev(MKDEV(nDrvMajorNumber_g, nMinorNumber),
              S_IFCHR | S_IRUGO | S_IWUGO, EPLLIN_DEV_NAME);
    if (iErr == 0) {
        TRACE1("EPL:   Device node '/dev/%s' created successful.\n",
               EPLLIN_DEV_NAME);
    } else {
        TRACE1("EPL:   ERROR: unable to create device node '/dev/%s'\n",
               EPLLIN_DEV_NAME);
        iRet = -EIO;
        goto Exit;
    }

#else

    // register character device handler
    // only one Minor required
    TRACE2("EPL:   Installing Driver '%s', Version %s...\n",
           EPLLIN_DRV_NAME, EPL_PRODUCT_VERSION);
    iRet = alloc_chrdev_region(&nDevNum_g, 0, 1, EPLLIN_DRV_NAME);
    if (iRet == 0) {
        TRACE2
            ("EPL:   Driver '%s' installed successful, assigned MajorNumber=%d\n",
             EPLLIN_DRV_NAME, MAJOR(nDevNum_g));
    } else {
        TRACE1
            ("EPL:   ERROR: Driver '%s' is unable to get a free MajorNumber!\n",
             EPLLIN_DRV_NAME);
        iRet = -EIO;
        goto Exit;
    }

    // register cdev structure
    pEpl_cdev_g = cdev_alloc();
    pEpl_cdev_g->ops = &EplLinFileOps_g;
    pEpl_cdev_g->owner = THIS_MODULE;
    iErr = cdev_add(pEpl_cdev_g, nDevNum_g, 1);
    if (iErr) {
        TRACE2("EPL:   ERROR %d: Driver '%s' could not be added!\n",
               iErr, EPLLIN_DRV_NAME);
        iRet = -EIO;
        goto Exit;
    }
#endif

    // create device node in PROCFS
    EplRet = EplLinProcInit();
    if (EplRet != kEplSuccessful) {
        goto Exit;
    }

      Exit:

    TRACE1("EPL: - EplLinInit (iRet=%d)\n", iRet);
    return (iRet);
//.........这里部分代码省略.........
开发者ID:robacklin,项目名称:ts4700,代码行数:101,代码来源:EplApiLinuxKernel.c

示例13: atoi

//==============================================================================================
// FUNCTION: WindowProc
// PURPOSE:  
//
LRESULT CMCTeleServerDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
   // process telegraph open message
   // add the sender's HWND to the client list
   // send a telegraph packet to that HWND
   if( message == s_uMCTGOpenMessage )
   {
      UINT uSerialNum = atoi(m_mctdCurrentState.szSerialNumber);
      UINT uChannelID = m_mctdCurrentState.uChannelID;
      if( !MCTG_Match700BSignalIDs( uSerialNum,
                                    uChannelID, 
                                    lParam      ) )

      {
         // this request is for another MultiClamp device / channel
         // ignore it
         return TRUE;
      }

      UINT uX = 0;

      // see if the sender's HWND is already in the client list
      for(uX = 0; uX < MCTG_MAX_CLIENTS; ++ uX)
      {
         if(m_ClientHwndList[uX] == (HWND) wParam)
         {
            // failed to add sender's HWND to client list
            // this HWND is already connected
            TRACE2("server(%s,%d): ",
                   m_mctdCurrentState.szSerialNumber,
                   m_mctdCurrentState.uChannelID );
            TRACE1("open failed for 0x%08X: already open\n", wParam);
            return TRUE;
         }
      }

      // attempt to add the sender's HWND to the client list
      // place it in the first available blank slot
      ASSERT(wParam != NULL);
      BOOL bSuccess = FALSE;
      for(uX = 0; uX < MCTG_MAX_CLIENTS; ++ uX)
      {
         if(m_ClientHwndList[uX] == NULL)
         {
            m_ClientHwndList[uX] = (HWND) wParam;
            bSuccess = TRUE;
            break;
         }
      }

      if( bSuccess )
      {
         // successfully added HWND to client list
         TRACE2("server(%s,%d): ",
                m_mctdCurrentState.szSerialNumber,
                m_mctdCurrentState.uChannelID );
         TRACE1("open connection to 0x%08X\n", wParam);
      }
      else
      {
         // failed to add sender's HWND to client list
         // no free slots available
         TRACE2("server(%s,%d): ",
                m_mctdCurrentState.szSerialNumber,
                m_mctdCurrentState.uChannelID );
         TRACE1("open failed for 0x%08X: no free slots\n", wParam);
         return TRUE;
      }

      if( IsWindow( (HWND) wParam ) )
      {
         // HWND is valid, send telegraph packet
         COPYDATASTRUCT cpds;
         cpds.dwData = (DWORD) s_uMCTGRequestMessage;
         cpds.cbData = sizeof(MC_TELEGRAPH_DATA);
         cpds.lpData = &m_mctdCurrentState;

         ::SendMessage ( (HWND) wParam,
                         WM_COPYDATA ,
                         NULL, 
                         (LPARAM) &cpds );

         return TRUE;
      }
      else
      {
         // invalid HWND, remove from client list
         TRACE2("server(%s,%d): ",
                m_mctdCurrentState.szSerialNumber,
                m_mctdCurrentState.uChannelID );
         TRACE1("invalid HWND, removing 0x%08X\n", m_ClientHwndList[uX]);
         m_ClientHwndList[uX] = NULL;
         return TRUE;
      }
   }

//.........这里部分代码省略.........
开发者ID:chubykin,项目名称:AutoPatcher_IG,代码行数:101,代码来源:MCTeleServerDlg.cpp

示例14: receiver_receive

static void receiver_receive(receiver_t *self, bytecode_stream_t *message,
                             context_t *context)
{
    atom_t selector;
    message_fifo_t *fifo;
    message_node_t *node;
    node_iterator_t it;

    if (!message || !message->end) {
        WARNING1("message === NULL");
        return;
    }

    selector = message->end->code.verb;
    fifo = get_fifo(self, selector);
    node = calloc(sizeof(message_node_t), 1);

    if (!fifo)
        fifo = add_fifo(self, selector);

    if (fifo->closed_p) {
        /* destroy the message and the context objects */
        bytecode_stream_retire(message);
        context_retire(context);

        return;
    }

    /*
       insert message in the right position

       messages are ordered by decreasing context from beginning to end.
    */
    if (get_node_iterator(fifo, &it)) {
        message_node_t *current = NULL;
        message_node_t *last = NULL;

        TRACE3("adding at: %f in fifo: %s", context->ms,
               atom_get_cstring_value(fifo->atom));

        while ((current = node_iterator_next(&it)) &&
               context->is_in(context, current->context)) {
            /* advance until context is not anymore in current context */
            TRACE2("current at: %f", current->context->ms);
            last = current;
        }

        if (last == NULL) {
            if (fifo->end == NULL) {
                TRACE1("append to empty fifo");
                node->next = node;
                node->prev = node;
                fifo->end = node;
            } else {
                if (context->is_in(context, current->context)) {
                    TRACE2("insert after current at %f", current->context->ms);
                    node->prev = current;
                    node->next = current->next;
                    current->next = node;
                    node->next->prev = node;
                } else {
                    TRACE2("insert before current at %f", current->context->ms);
                    node->next = current;
                    node->prev = current->prev;
                    current->prev = node;
                    node->prev->next = node;
                }
                if (current == fifo->end)
                    fifo->end = node;
            }
        } else {
            if (context->is_in(context, last->context)) {
                TRACE2("insert after last at %f", last->context->ms);
                node->prev = last;
                node->next = last->next;
                last->next = node;
                node->next->prev = node;
            } else {
                TRACE2("insert before last at %f", last->context->ms);
                node->next = last;
                node->prev = last->prev;
                last->prev = node;
                node->prev->next = node;
            }
            if (last == fifo->end)
                fifo->end = node;
        }
    }
    node->bytecodes = message;
    node->context = context;
    node->dispatched_p = 0;

    if (node->context->dispatch_now_p) {
        self->eval(self, node->bytecodes, node->context);
        node->dispatched_p = 1;
    }
}
开发者ID:uucidl,项目名称:plus-one-minus-one,代码行数:97,代码来源:receiver.c

示例15: TRACE1

void CTraceClipboardData::SendOut(LPCSTR pszData)
{
    int nLength;
    if (pszData == NULL || (nLength = lstrlenA(pszData)) == 0)
        return;

    // send it to TRACE (can be redirected)
    if (m_dwTarget & AFX_STACK_DUMP_TARGET_TRACE)
        TRACE1("%hs", pszData);

    // send it to OutputDebugString() (can't redirect)
    if (m_dwTarget & AFX_STACK_DUMP_TARGET_ODS)
        OutputDebugStringA(pszData);

    // build a buffer for the clipboard
    if (m_dwTarget & AFX_STACK_DUMP_TARGET_CLIPBOARD)
    {
        if (m_hMemory == NULL)
        {
           m_hMemory = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1024);
            if (m_hMemory == NULL)
            {
                TRACE0("AfxDumpStack Error: No memory available for clipboard.\n");
                m_dwTarget &= ~AFX_STACK_DUMP_TARGET_CLIPBOARD;
            }
            else
            {
                m_dwUsed = nLength;
                m_dwSize = 1024;
                LPSTR pstr = (LPSTR) GlobalLock(m_hMemory);
                if (pstr != NULL)
                {
                    lstrcpyA(pstr, pszData);
                    GlobalUnlock(m_hMemory);
                }
                else
                {
                    TRACE0("AfxDumpStack Error: Couldn't lock memory!\n");
                    GlobalFree(m_hMemory);
                    m_hMemory = NULL;
                    m_dwTarget &= ~AFX_STACK_DUMP_TARGET_CLIPBOARD;
                }
            }
        }
        else
        {
            if ((m_dwUsed + nLength + 1) >= m_dwSize)
            {
                // grow by leaps and bounds
                m_dwSize *= 2;
                if (m_dwSize > (1024L*1024L))
                {
                    TRACE0("AfxDumpStack Error: more than one megabyte on clipboard.\n");
                    m_dwTarget &= ~AFX_STACK_DUMP_TARGET_CLIPBOARD;
                }

                HGLOBAL hMemory = GlobalReAlloc(m_hMemory, m_dwSize, GMEM_MOVEABLE);
                if (hMemory == NULL)
                {
                    TRACE1("AfxDumpStack Error: Couldn't get %d bytes!\n", m_dwSize);
                    m_dwTarget &= ~AFX_STACK_DUMP_TARGET_CLIPBOARD;
                }
                else
                    m_hMemory = hMemory;
            }

            LPSTR pstr = (LPSTR) GlobalLock(m_hMemory);
            if (pstr != NULL)
            {
                lstrcpyA(pstr + m_dwUsed, pszData);
                m_dwUsed += nLength;
                GlobalUnlock(m_hMemory);
            }
            else
            {
                TRACE0("AfxDumpStack Error: Couldn't lock memory!\n");
                m_dwTarget &= ~AFX_STACK_DUMP_TARGET_CLIPBOARD;
            }
        }
    }

    return;
}
开发者ID:anyue100,项目名称:winscp,代码行数:83,代码来源:dumpstak.cpp


注:本文中的TRACE1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。