コード例 #1
0
BOOL 
CEditorPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode)
{
    // Get current data from dialog
    if(notifyCode == BN_CLICKED){
        DoTransfer(TRUE);

	    if (id == IDC_CHOOSE_HTML_EDITOR &&
            GetApplicationFilename(m_strHTML_Editor, IDS_CHOOSE_HTML_EDITOR) ){
		    DoTransfer(FALSE);
		    return TRUE;
	    } else if (id == IDC_CHOOSE_IMAGE_EDITOR &&
            GetApplicationFilename(m_strImageEditor, IDS_CHOOSE_IMAGE_EDITOR) ){
		    DoTransfer(FALSE);
		    return TRUE;
        }
    }
	return CEditorPropertyPage::OnCommand(id, hwndCtl, notifyCode);
}
コード例 #2
0
// Destroys the window created with Activate()
STDMETHODIMP CPropertyPageEx::Deactivate()
{
	assert(m_hwndDlg);
	if (!m_hwndDlg)
		return ResultFromScode(E_UNEXPECTED);

	// Do data transfer. More than likely PageChanging() was called and we
	// transfered the data there as well, but to be safe do it again here
	DoTransfer(TRUE);

	DestroyWindow();
	return NOERROR;
}
コード例 #3
0
// Applies current property page values to underlying objects specified through
// SetObjects
STDMETHODIMP CPropertyPageEx::Apply()
{
	assert(m_pObject);
	assert(m_bHasBeenActivated);

	// Do data transfer
	if (m_hwndDlg)
		DoTransfer(TRUE);

	// Ask the page to apply the changes
	ApplyChanges();

	return NOERROR;
}
コード例 #4
0
ファイル: tagdlg.cpp プロジェクト: vicamo/b2g_mozilla-central
BOOL CTagDlg::InitDialog() 
{
//XPCALLS THAT NEED TO BE DONT IN CONSTRUCTOR ARE MOVED HERE
    getWFE()->GetLayoutViewSize(&m_iFullWidth, &m_iFullHeight);
//END XPCALLS FROM CONSTRUCTOR
    
    if( ED_ELEMENT_UNKNOWN_TAG == getEDT()->GetCurrentElementType() ) {
        m_csTagData = getEDT()->GetUnknownTagData();
    } else {
        m_bInsert = TRUE;
    }
    DoTransfer(FALSE);
  	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #5
0
ファイル: tagdlg.cpp プロジェクト: vicamo/b2g_mozilla-central
void CTagDlg::OnOK() 
{
    DoTransfer(TRUE);
    if( !DoVerifyTag( (char*)LPCSTR(m_csTagData) ) ){
        return;
    }

    getEDT()->BeginBatchChanges();
	
    if( m_bInsert ){
        getEDT()->InsertUnknownTag((char*)LPCSTR(m_csTagData));
    } else {
        getEDT()->SetUnknownTagData((char*)LPCSTR(m_csTagData));
    }
    getEDT()->EndBatchChanges();

    //Note: For Attributes-only editing(e.g., HREF JavaScript),
    //      caller must get data from m_csTagData;
    EndDialog(m_hwndDlg,IDOK);
}
コード例 #6
0
//=============================================================================
int Epetra_DistObject::Export(const Epetra_SrcDistObject& A,
			      const Epetra_Import& Importer,
			      Epetra_CombineMode CombineMode,
                              const Epetra_OffsetIndex * Indexor)
{

  if (!Map_.SameAs(Importer.SourceMap())) EPETRA_CHK_ERR(-2);
  if (!A.Map().SameAs(Importer.TargetMap())) EPETRA_CHK_ERR(-3);

  int NumSameIDs = Importer.NumSameIDs();
  int NumPermuteIDs = Importer.NumPermuteIDs();
  int NumRemoteIDs = Importer.NumExportIDs();
  int NumExportIDs = Importer.NumRemoteIDs();
  int* ExportLIDs = Importer.RemoteLIDs();
  int* RemoteLIDs = Importer.ExportLIDs();
  int* PermuteToLIDs = Importer.PermuteFromLIDs();
  int* PermuteFromLIDs = Importer.PermuteToLIDs();

  EPETRA_CHK_ERR(DoTransfer(A, CombineMode, NumSameIDs, NumPermuteIDs, NumRemoteIDs, NumExportIDs,
			    PermuteToLIDs, PermuteFromLIDs,  RemoteLIDs, ExportLIDs,
			    LenImports_, Imports_, LenExports_, Exports_,
			    Importer.Distributor(), true, Indexor));
  return(0);
}
コード例 #7
0
int main(int argc, char * argv[])
{
  Operations operation;

  
  if (argc < 2 || (operation = GetOperation(argv[1])) == NumOperations || argc < RequiredArgsForOperation[operation]) {
    Operations op;
    fputs("usage: c_api { ", stderr);
    for (op = OpListen; op < NumOperations; op++) {
      if (op > OpListen)
        fputs(" | ", stderr);
      fputs(OperationNames[op], stderr);
    }
    fputs(" } [ A-party [ B-party ] ]\n", stderr);
    return 1;
  }

  puts("Initialising.\n");

  if (!InitialiseOPAL())
    return 1;

  switch (operation) {
    case OpListen :
      puts("Listening.\n");
      HandleMessages(60000);
      break;

    case OpCall :
      if (argc > 3) {
        if (!DoCall(argv[2], argv[3]))
          break;
      } else {
        if (!DoCall(NULL, argv[2]))
          break;
      }
      HandleMessages(15000);
      break;

    case OpMute :
      if (!DoCall(NULL, argv[2]))
        break;
      HandleMessages(15000);
      if (!DoMute(1))
        break;
      HandleMessages(15000);
      if (!DoMute(0))
        break;
      HandleMessages(15000);
      break;

    case OpHold :
      if (!DoCall(NULL, argv[2]))
        break;
      HandleMessages(15000);
      if (!DoHold())
        break;
      HandleMessages(15000);
      break;

    case OpTransfer :
      if (!DoCall(NULL, argv[2]))
        break;
      HandleMessages(15000);
      if (!DoTransfer(argv[3]))
        break;
      HandleMessages(15000);
      break;

    case OpConsult :
      if (!DoCall(NULL, argv[2]))
        break;
      HandleMessages(15000);
      if (!DoHold())
        break;
      HandleMessages(15000);
      if (!DoCall(NULL, argv[3]))
        break;
      HandleMessages(15000);
      if (!DoTransfer(HeldCallToken))
        break;
      HandleMessages(15000);
      break;

    case OpRegister :
      if (!DoRegister(argv[2], argv[3]))
        break;
      HandleMessages(15000);
      break;

    default :
      break;
  }

  puts("Exiting.\n");

  ShutDownFunction(hOPAL);
  return 0;
}
コード例 #8
0
int main(int argc, char * argv[])
{
    Operations operation;


    if (argc < 2 || (operation = GetOperation(argv[1])) == NumOperations || argc < RequiredArgsForOperation[operation]) {
        fputs("usage: c_api { listen | call | transfer } [ A-party [ B-party ] ]\n", stderr);
        return 1;
    }

    puts("Initialising.\n");

    if (!InitialiseOPAL())
        return 1;

    switch (operation) {
    case OpListen :
        puts("Listening.\n");
        HandleMessages(60000);
        break;

    case OpCall :
        if (!DoCall(argv[2]))
            break;
        HandleMessages(15000);
        break;

    case OpHold :
        if (!DoCall(argv[2]))
            break;
        HandleMessages(15000);
        if (!DoHold())
            break;
        HandleMessages(15000);
        break;

    case OpTransfer :
        if (!DoCall(argv[2]))
            break;
        HandleMessages(15000);
        if (!DoTransfer(argv[3]))
            break;
        HandleMessages(15000);
        break;

    case OpConsult :
        if (!DoCall(argv[2]))
            break;
        HandleMessages(15000);
        if (!DoHold())
            break;
        HandleMessages(15000);
        if (!DoCall(argv[3]))
            break;
        HandleMessages(15000);
        if (!DoTransfer(HeldCallToken))
            break;
        HandleMessages(15000);
        break;

    default :
        break;
    }

    puts("Exiting.\n");

    ShutDownFunction(hOPAL);
    return 0;
}
コード例 #9
0
ファイル: tagdlg.cpp プロジェクト: vicamo/b2g_mozilla-central
void CTagDlg::OnVerifyHtml() 
{
    DoTransfer(TRUE);
    DoVerifyTag((char*)LPCSTR(m_csTagData));
}
コード例 #10
0
/**
* The example to do the scatter gather transfer through polling.
*
* @param	DeviceId is the Device Id of the XAxiCdma instance
*
* @return
* 		- XST_SUCCESS if example finishes successfully
* 		- XST_FAILURE if error occurs
*
* @note		None
*
******************************************************************************/
int XAxiCdma_SgPollExample(u16 DeviceId)
{
	XAxiCdma_Config *CfgPtr;
	int Status;
	u8 *SrcPtr;
	u8 *DstPtr;

	SrcPtr = (u8 *)TransmitBufferPtr;
	DstPtr = (u8 *)ReceiveBufferPtr;

#ifdef __aarch64__
	Xil_SetTlbAttributes(BD_SPACE_BASE, MARK_UNCACHEABLE);
#endif

	/* Initialize the XAxiCdma device.
	 */
	CfgPtr = XAxiCdma_LookupConfig(DeviceId);
	if (!CfgPtr) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Cannot find config structure for device %d\r\n",
			XPAR_AXICDMA_0_DEVICE_ID);

		return XST_FAILURE;
	}

	Status = XAxiCdma_CfgInitialize(&AxiCdmaInstance, CfgPtr,
		CfgPtr->BaseAddress);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Initialization failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	/* Setup the BD ring
	 */
	Status = SetupTransfer(&AxiCdmaInstance);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Setup BD ring failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	Done = 0;
	Error = 0;

	/* Start the DMA transfer
	 */
	Status = DoTransfer(&AxiCdmaInstance);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Do transfer failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	/* Wait until the DMA transfer is done or error occurs
	 */
	while ((CheckCompletion(&AxiCdmaInstance) < NUMBER_OF_BDS_TO_TRANSFER)
		&& !Error) {
		/* Wait */
	}

	if(Error) {
		int TimeOut = RESET_LOOP_COUNT;

		xdbg_printf(XDBG_DEBUG_ERROR, "Transfer has error %x\r\n",
				Error);

		/* Need to reset the hardware to restore to the correct state
		 */
		XAxiCdma_Reset(&AxiCdmaInstance);

		while (TimeOut) {
			if (XAxiCdma_ResetIsDone(&AxiCdmaInstance)) {
				break;
			}
			TimeOut -= 1;
		}

		/* Reset has failed, print a message to notify the user
		 */
		if (!TimeOut) {
			xdbg_printf(XDBG_DEBUG_ERROR,
			    "Reset hardware failed with %d\r\n", Status);

		}

		return XST_FAILURE;
	}

	/* Transfer completed successfully, check data
	 */
	Status = CheckData(SrcPtr, DstPtr,
		MAX_PKT_LEN * NUMBER_OF_BDS_TO_TRANSFER);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR, "Check data failed for sg "
		    "transfer\r\n");
		return XST_FAILURE;
	}

	/* Test finishes successfully, return successfully
	 */
	return XST_SUCCESS;
}
コード例 #11
0
int XAxiCdma_SgIntrExample(XScuGic *IntcInstancePtr, XAxiCdma *InstancePtr,
				u16 DeviceId,u32 IntrId)
#endif
{
	XAxiCdma_Config *CfgPtr;
	int Status;
	u8 *SrcPtr;
	u8 *DstPtr;

	SrcPtr = (u8 *)TransmitBufferPtr;
	DstPtr = (u8 *)ReceiveBufferPtr;

#ifdef __aarch64__
	Xil_SetTlbAttributes(BD_SPACE_BASE, MARK_UNCACHEABLE);
#endif

	/* Initialize the XAxiCdma device.
	 */
	CfgPtr = XAxiCdma_LookupConfig(DeviceId);
	if (!CfgPtr) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Cannot find config structure for device %d\r\n",
			XPAR_AXICDMA_0_DEVICE_ID);

		return XST_FAILURE;
	}

	Status = XAxiCdma_CfgInitialize(InstancePtr, CfgPtr,
						CfgPtr->BaseAddress);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Initialization failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	/* Setup the BD ring
	 */
	Status = SetupTransfer(InstancePtr);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Setup BD ring failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	/* Setup the interrupt system
	 */
	Status = SetupIntrSystem(IntcInstancePtr, InstancePtr, IntrId);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Setup Intr system failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	/* Enable completion and error interrupts
	 */
	XAxiCdma_IntrEnable(InstancePtr, XAXICDMA_XR_IRQ_ALL_MASK);

	/* Start the DMA transfer
	 */
	Status = DoTransfer(InstancePtr);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "Do transfer failed with %d\r\n", Status);

		return XST_FAILURE;
	}

	/* Wait until the DMA transfer is done
	 */

	while ((Done < NUMBER_OF_BDS_TO_TRANSFER) && !Error) {
		/* Wait */
	}

	if(Error) {
		xdbg_printf(XDBG_DEBUG_ERROR, "Transfer has error %x\r\n",
		    (unsigned int)XAxiCdma_GetError(InstancePtr));

		DisableIntrSystem(IntcInstancePtr, IntrId);

		return XST_FAILURE;
	}

	/* Transfer completes successfully, check data
	 */
	Status = CheckData(SrcPtr, DstPtr,
		MAX_PKT_LEN * NUMBER_OF_BDS_TO_TRANSFER);
	if (Status != XST_SUCCESS) {
		xdbg_printf(XDBG_DEBUG_ERROR, "Check data failed for sg "
		    "transfer\r\n");

		DisableIntrSystem(IntcInstancePtr, IntrId);
		return XST_FAILURE;
	}

	/* Test finishes successfully, clean up and return
	 */
	DisableIntrSystem(IntcInstancePtr, IntrId);

	return XST_SUCCESS;
}
コード例 #12
0
// Destroys the window created with Activate()
STDMETHODIMP CPropertyPageEx::PageChanging(LPPROPERTYPAGE pNewPage)
{
	// Do data transfer. If the validation fails return S_FALSE to prevent
	// the page from changing
	return DoTransfer(TRUE) ? NOERROR : ResultFromScode(S_FALSE);
}