text:
/*
** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_pwr_mgt.c#1
*/

/*! \file   "nic_pwr_mgt.c"
    \brief  In this file we define the STATE and EVENT for Power Management FSM.

    The SCAN FSM is responsible for performing SCAN behavior when the Arbiter enter
    ARB_STATE_SCAN. The STATE and EVENT for SCAN FSM are defined here with detail
    description.
*/

/*
** Log: nic_pwr_mgt.c
 *
 * 11 28 2011 cp.wu
 * [WCXRP00001125] [MT6620 Wi-Fi][Firmware] Strengthen Wi-Fi power off sequence to have a clearroom environment when
 * returining to ROM code
 * 1. Due to firmware now stops HIF DMA for powering off, do not try to receive any packet from firmware
 * 2. Take use of prAdapter->fgIsEnterD3ReqIssued for tracking whether it is powering off or not
 *
 * 10 03 2011 cp.wu
 * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality
 * add firmware download path in divided scatters.
 *
 * 08 15 2011 cp.wu
 * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree
 * reuse firmware download logic of MT6620 for MT6628.
 *
 * 05 11 2011 cp.wu
 * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power
 * ACPI APIs migrate to wlan_lib.c for glue layer to invoke.
 *
 * 04 29 2011 cp.wu
 * [WCXRP00000636] [WHQL][MT5931 Driver] 2c_PMHibernate (hang on 2h)
 * fix for compilation error when applied with FW_DOWNLOAD = 0
 *
 * 04 18 2011 cp.wu
 * [WCXRP00000636] [WHQL][MT5931 Driver] 2c_PMHibernate (hang on 2h)
 * 1) add API for glue layer to query ACPI state
 * 2) Windows glue should not access to hardware after switched into D3 state
 *
 * 04 13 2011 cp.wu
 * [WCXRP00000639] [WHQL][MT5931 Driver] 2c_PMStandby test item can not complete
 * refine for MT5931/MT6620 logic separation.
 *
 * 04 13 2011 cp.wu
 * [WCXRP00000639] [WHQL][MT5931 Driver] 2c_PMStandby test item can not complete
 * bugfix: firmware download procedure for ACPI state transition is not complete.
 *
 * 03 15 2011 cp.wu
 * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous
 * memory consumption
 * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK
 * 2. Use common coalescing buffer for both TX/RX directions
 *
 *
 * 03 07 2011 terry.wu
 * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message
 * Toggle non-standard debug messages to comments.
 *
 * 12 31 2010 cp.wu
 * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system
 * scheduling
 * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being
 * loaded
 *
 * 12 31 2010 cp.wu
 * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side
 * check success or failure for setting fw-own
 *
 * 12 30 2010 cp.wu
 * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side
 * host driver not to set FW-own when there is still pending interrupts
 *
 * 10 07 2010 cp.wu
 * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection
 * add firmware download for MT5931.
 *
 * 09 21 2010 cp.wu
 * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS
 * associated
 * Do a complete reset with STA-REC null checking for RF test re-entry
 *
 * 08 30 2010 cp.wu
 * NULL
 * eliminate klockwork errors
 *
 * 08 30 2010 cp.wu
 * NULL
 * reset ACPI power state before waking up MT6620 Wi-Fi firmware.
 *
 * 08 12 2010 cp.wu
 * NULL
 * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G)
 *
 * 08 03 2010 cp.wu
 * NULL
 * Centralize mgmt/system service procedures into independent calls.
 *
 * 07 22 2010 cp.wu
 *
 * 1) refine AIS-FSM indent.
 * 2) when entering RF Test mode, flush 802.1X frames as well
 * 3) when entering D3 state, flush 802.1X frames as well
 *
 * 07 08 2010 cp.wu
 *
 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
 *
 * 06 21 2010 cp.wu
 * [WPD00003833][MT6620 and MT5931] Driver migration
 * change MAC address updating logic.
 *
 * 06 06 2010 kevin.huang
 * [WPD00003832][MT6620 5931] Create driver base
 * [MT6620 5931] Create driver base
 *
 * 05 24 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * 1) when acquiring LP-own, write for clr-own with lower frequency compared to read poll
 * 2) correct address list parsing
 *
 * 05 22 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * sleepy notify is only used for sleepy state,
 * while wake-up state is automatically set when host needs to access device
 *
 * 05 19 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * correct hibernation problem.
 *
 * 04 26 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * 1) surpress compiler warning
 * 2) when acqruing LP-own, keep writing WHLPCR whenever OWN is not acquired yet
 *
 * 04 23 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * surpress compiler warning
 *
 * 04 22 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * when acquiring driver-own, wait for up to 8 seconds.
 *
 * 04 21 2010 jeffrey.chang
 * [WPD00003826]Initial import for Linux port
 * add for private ioctl support
 *
 * 04 20 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * 1) remove redundant firmware image unloading
 *  * 2) use compile-time macros to separate logic related to accquiring own
 *
 * 04 16 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * treat BUS access failure as kind of card removal.
 *
 * 04 07 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * accessing to firmware load/start address, and access to OID handling information
 *  * are now handled in glue layer
 *
 * 04 06 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * ePowerCtrl is not necessary as a glue variable.
 *
 * 04 06 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * add KAL API: kalFlushPendingTxPackets(), and take use of the API
 *
 * 04 06 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
 *
 * 03 24 2010 jeffrey.chang
 * [WPD00003826]Initial import for Linux port
 * initial import for Linux port
 *
 * 03 22 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * always send CMD_NIC_POWER_CTRL packet when nic is being halted
 *
 * 03 19 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * correct typo.
 *
 * 03 19 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * 1) add ACPI D0/D3 state switching support
 *  *  *  *  *  *  *  * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX
 * response
 *
 * 03 08 2010 cp.wu
 * [WPD00001943]Create WiFi test driver framework on WinXP
 * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread.
 *  * 2) change own-back acquiring procedure to wait for up to 16.67 seconds
**  \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-10-13 21:59:15 GMT mtk01084
**  update for new HW design
**  \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-09-09 17:26:36 GMT mtk01084
**  remove CMD52 access
**  \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-05-18 14:50:29 GMT mtk01084
**  modify lines in nicpmSetDriverOwn()
**  \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-23 16:55:37 GMT mtk01084
**  modify nicpmSetDriverOwn()
**  \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-19 18:33:00 GMT mtk01084
**  update for basic power management functions
**  \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-03-19 15:05:32 GMT mtk01084
**  Initial version
**
*/

/*******************************************************************************
*                         C O M P I L E R   F L A G S
********************************************************************************
*/

/*******************************************************************************
*                    E X T E R N A L   R E F E R E N C E S
********************************************************************************
*/
#include "precomp.h"

/*******************************************************************************
*                              C O N S T A N T S
********************************************************************************
*/

/*******************************************************************************
*                             D A T A   T Y P E S
********************************************************************************
*/

/*******************************************************************************
*                            P U B L I C   D A T A
********************************************************************************
*/

/*******************************************************************************
*                           P R I V A T E   D A T A
********************************************************************************
*/

/*******************************************************************************
*                                 M A C R O S
********************************************************************************
*/

/*******************************************************************************
*                   F U N C T I O N   D E C L A R A T I O N S
********************************************************************************
*/

/*******************************************************************************
*                              F U N C T I O N S
********************************************************************************
*/

/*----------------------------------------------------------------------------*/
/*!
* \brief This routine is used to process the POWER ON procedure.
*
* \param[in] pvAdapter Pointer to the Adapter structure.
*
* \return (none)
*/
/*----------------------------------------------------------------------------*/
VOID nicpmSetFWOwn(IN P_ADAPTER_T prAdapter, IN BOOLEAN fgEnableGlobalInt)
{
	UINT_32 u4RegValue;

	ASSERT(prAdapter);

	if (prAdapter->fgIsFwOwn == TRUE) {
		return;
	} else {
		if (nicProcessIST(prAdapter) != WLAN_STATUS_NOT_INDICATING) {
			/* pending interrupts */
			return;
		}
	}

	if (fgEnableGlobalInt) {
		prAdapter->fgIsIntEnableWithLPOwnSet = TRUE;
	} else {
		HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_SET);

		HAL_MCR_RD(prAdapter, MCR_WHLPCR, &u4RegValue);
		if (u4RegValue & WHLPCR_FW_OWN_REQ_SET) {
			/* if set firmware own not successful (possibly pending interrupts), */
			/* indicate an own clear event */
			HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_CLR);

			return;
		}

		prAdapter->fgIsFwOwn = TRUE;
	}
}

/*----------------------------------------------------------------------------*/
/*!
* \brief This routine is used to process the POWER OFF procedure.
*
* \param[in] pvAdapter Pointer to the Adapter structure.
*
* \return (none)
*/
/*----------------------------------------------------------------------------*/
BOOLEAN nicpmSetDriverOwn(IN P_ADAPTER_T prAdapter)
{
#define LP_OWN_BACK_TOTAL_DELAY_MS      8192	/* exponential of 2 */
#define LP_OWN_BACK_LOOP_DELAY_MS       1	/* exponential of 2 */
#define LP_OWN_BACK_CLR_OWN_ITERATION   256	/* exponential of 2 */

	BOOLEAN fgStatus = TRUE;
	UINT_32 i, u4CurrTick;
	UINT_32 u4RegValue = 0;
	GL_HIF_INFO_T *HifInfo;

	ASSERT(prAdapter);

	if (prAdapter->fgIsFwOwn == FALSE)
		return fgStatus;

	HifInfo = &prAdapter->prGlueInfo->rHifInfo;

	u4CurrTick = kalGetTimeTick();
	STATS_DRIVER_OWN_START_RECORD();
	i = 0;

	while (1) {
		HAL_MCR_RD(prAdapter, MCR_WHLPCR, &u4RegValue);

		if (u4RegValue & WHLPCR_FW_OWN_REQ_SET) {
			prAdapter->fgIsFwOwn = FALSE;
			break;
		} else if (kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE
			   || fgIsBusAccessFailed == TRUE
			   || (kalGetTimeTick() - u4CurrTick) > LP_OWN_BACK_TOTAL_DELAY_MS || fgIsResetting == TRUE) {
			/* ERRORLOG(("LP cannot be own back (for %ld ms)", kalGetTimeTick() - u4CurrTick)); */
			fgStatus = FALSE;
			if (fgIsResetting != TRUE) {
				UINT_32 u4FwCnt;
				static unsigned int u4OwnCnt;
				HAL_MCR_RD(prAdapter, MCR_D2HRM2R, &u4RegValue);
				DBGLOG(INIT, WARN, ("<WiFi> MCR_D2HRM2R = 0x%x\n", u4RegValue));
				DBGLOG(INIT, WARN,
					("<WiFi> Fatal error! Driver own fail!!!!!!!!!!!! %d\n", u4OwnCnt++));

				DBGLOG(INIT, WARN, ("CONNSYS FW CPUINFO:\n"));
				for (u4FwCnt = 0; u4FwCnt < 16; u4FwCnt++)
					DBGLOG(INIT, WARN, ("0x%08x ", MCU_REG_READL(HifInfo, CONN_MCU_CPUPCR)));
				/* CONSYS_REG_READ(CONSYS_CPUPCR_REG) */
			}
			break;
		} else {
			if ((i & (LP_OWN_BACK_CLR_OWN_ITERATION - 1)) == 0) {
				/* Software get LP ownership - per 256 iterations */
				HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_CLR);
			}

			/* Delay for LP engine to complete its operation. */
			kalMsleep(LP_OWN_BACK_LOOP_DELAY_MS);
			i++;
		}
	}

	STATS_DRIVER_OWN_END_RECORD();
	STATS_DRIVER_OWN_STOP();

	return fgStatus;
}

/*----------------------------------------------------------------------------*/
/*!
* \brief This routine is used to set ACPI power mode to D0.
*
* \param[in] pvAdapter Pointer to the Adapter structure.
*
* \return (none)
*/
/*----------------------------------------------------------------------------*/
BOOLEAN nicpmSetAcpiPowerD0(IN P_ADAPTER_T prAdapter)
{
	WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS;
	UINT_32 u4Value = 0, u4WHISR = 0;
	UINT_8 aucTxCount[8];
	UINT_32 i;
#if CFG_ENABLE_FW_DOWNLOAD
	UINT_32 u4FwImgLength, u4FwLoadAddr, u4ImgSecSize;
	PVOID prFwMappingHandle;
	PVOID pvFwImageMapFile = NULL;
#if CFG_ENABLE_FW_DIVIDED_DOWNLOAD
	UINT_32 j;
	P_FIRMWARE_DIVIDED_DOWNLOAD_T prFwHead;
	BOOLEAN fgValidHead;
	const UINT_32 u4CRCOffset = offsetof(FIRMWARE_DIVIDED_DOWNLOAD_T, u4NumOfEntries);
#endif
#endif

	DEBUGFUNC("nicpmSetAcpiPowerD0");
	ASSERT(prAdapter);

	do {
		/* 0. Reset variables in ADAPTER_T */
		prAdapter->fgIsFwOwn = TRUE;
		prAdapter->fgWiFiInSleepyState = FALSE;
		prAdapter->rAcpiState = ACPI_STATE_D0;
		prAdapter->fgIsEnterD3ReqIssued = FALSE;

#if defined(MT6620) || defined(MT6628)
		/* 1. Request Ownership to enter F/W download state */
		ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter);
#if !CFG_ENABLE_FULL_PM
		nicpmSetDriverOwn(prAdapter);
#endif

		/* 2. Initialize the Adapter */
		u4Status = nicInitializeAdapter(prAdapter);
		if (u4Status != WLAN_STATUS_SUCCESS) {
			DBGLOG(INIT, ERROR, ("nicInitializeAdapter failed!\n"));
			u4Status = WLAN_STATUS_FAILURE;
			break;
		}
#endif

#if CFG_ENABLE_FW_DOWNLOAD
		prFwMappingHandle = kalFirmwareImageMapping(prAdapter->prGlueInfo, &pvFwImageMapFile, &u4FwImgLength);
		if (!prFwMappingHandle) {
			DBGLOG(INIT, ERROR, ("Fail to load FW image from file!\n"));
			pvFwImageMapFile = NULL;
		}
#if defined(MT6620) || defined(MT6628)
		if (pvFwImageMapFile == NULL) {
			u4Status = WLAN_STATUS_FAILURE;
			break;
		}

		/* 3.1 disable interrupt, download is done by polling mode only */
		nicDisableInterrupt(prAdapter);

		/* 3.2 Initialize Tx Resource to fw download state */
		nicTxInitResetResource(prAdapter);

		/* 3.3 FW download here */
		u4FwLoadAddr = kalGetFwLoadAddress(prAdapter->prGlueInfo);

#if CFG_ENABLE_FW_DIVIDED_DOWNLOAD
		/* 3a. parse file header for decision of divided firmware download or not */
		prFwHead = (P_FIRMWARE_DIVIDED_DOWNLOAD_T) pvFwImageMapFile;

		if (prFwHead->u4Signature == MTK_WIFI_SIGNATURE &&
		    prFwHead->u4CRC == wlanCRC32((PUINT_8) pvFwImageMapFile + u4CRCOffset,
						 u4FwImgLength - u4CRCOffset)) {
			fgValidHead = TRUE;
		} else {
			fgValidHead = FALSE;
		}

		/* 3b. engage divided firmware downloading */
		if (fgValidHead == TRUE) {
			for (i = 0; i < prFwHead->u4NumOfEntries; i++) {
#if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION
				if (wlanImageSectionDownloadAggregated(prAdapter,
					prFwHead->arSection[i].u4DestAddr,
					prFwHead->arSection[i].u4Length,
					(PUINT_8) pvFwImageMapFile +
					prFwHead->arSection[i].u4Offset) !=
					WLAN_STATUS_SUCCESS) {
					DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n"));
					u4Status = WLAN_STATUS_FAILURE;
				}
#else
				for (j = 0; j < prFwHead->arSection[i].u4Length; j += CMD_PKT_SIZE_FOR_IMAGE) {
					if (j + CMD_PKT_SIZE_FOR_IMAGE < prFwHead->arSection[i].u4Length)
						u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE;
					else
						u4ImgSecSize = prFwHead->arSection[i].u4Length - j;

					if (wlanImageSectionDownload(prAdapter,
						prFwHead->arSection[i].u4DestAddr + j,
						u4ImgSecSize,
						(PUINT_8) pvFwImageMapFile +
						prFwHead->arSection[i].u4Offset + j) != WLAN_STATUS_SUCCESS) {
						DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n"));
						u4Status = WLAN_STATUS_FAILURE;
						break;
					}
				}
#endif
				/* escape from loop if any pending error occurs */
				if (u4Status == WLAN_STATUS_FAILURE)
					break;
			}
		} else
#endif
#if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION
		if (wlanImageSectionDownloadAggregated(prAdapter,
			u4FwLoadAddr,
			u4FwImgLength,
			(PUINT_8) pvFwImageMapFile) != WLAN_STATUS_SUCCESS) {
			DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n"));
			u4Status = WLAN_STATUS_FAILURE;
		}
#else
			for (i = 0; i < u4FwImgLength; i += CMD_PKT_SIZE_FOR_IMAGE) {
				if (i + CMD_PKT_SIZE_FOR_IMAGE < u4FwImgLength)
					u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE;
				else
					u4ImgSecSize = u4FwImgLength - i;

				if (wlanImageSectionDownload(prAdapter,
					u4FwLoadAddr + i,
					u4ImgSecSize,
					(PUINT_8) pvFwImageMapFile + i) != WLAN_STATUS_SUCCESS) {
					DBGLOG(INIT, ERROR, ("wlanImageSectionDownload failed!\n"));
					u4Status = WLAN_STATUS_FAILURE;
					break;
				}
			}
#endif

		if (u4Status != WLAN_STATUS_SUCCESS) {
			kalFirmwareImageUnmapping(prAdapter->prGlueInfo, prFwMappingHandle, pvFwImageMapFile);
			break;
		}
#if !CFG_ENABLE_FW_DOWNLOAD_ACK
		/* Send INIT_CMD_ID_QUERY_PENDING_ERROR command and wait for response */
		if (wlanImageQueryStatus(prAdapter) != WLAN_STATUS_SUCCESS) {
			kalFirmwareImageUnmapping(prAdapter->prGlueInfo, prFwMappingHandle, pvFwImageMapFile);
			u4Status = WLAN_STATUS_FAILURE;
			break;
		}
#endif
		kalFirmwareImageUnmapping(prAdapter->prGlueInfo, prFwMappingHandle, pvFwImageMapFile);

		/* 4. send Wi-Fi Start command */
#if CFG_OVERRIDE_FW_START_ADDRESS
		wlanConfigWifiFunc(prAdapter, TRUE, kalGetFwStartAddress(prAdapter->prGlueInfo));
#else
		wlanConfigWifiFunc(prAdapter, FALSE, 0);
#endif
#endif /* if defined(MT6620) || defined(MT6628) */
#endif /* if CFG_ENABLE_FW_DOWNLOAD */

		/* 5. check Wi-Fi FW asserts ready bit */
		DBGLOG(INIT, TRACE, ("wlanAdapterStart(): Waiting for Ready bit..\n"));
		i = 0;
		while (1) {
			HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value);

			if (u4Value & WCIR_WLAN_READY) {
				DBGLOG(INIT, TRACE, ("Ready bit asserted\n"));
				break;
			} else if (kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE || fgIsBusAccessFailed == TRUE) {
				u4Status = WLAN_STATUS_FAILURE;
				break;
			} else if (i >= CFG_RESPONSE_POLLING_TIMEOUT) {
				DBGLOG(INIT, ERROR, ("Waiting for Ready bit: Timeout\n"));
				u4Status = WLAN_STATUS_FAILURE;
				break;
			} else {
				i++;
				kalMsleep(10);
			}
		}

		if (u4Status == WLAN_STATUS_SUCCESS) {
			/* 6.1 reset interrupt status */
			HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8) & u4WHISR);
			if (HAL_IS_TX_DONE_INTR(u4WHISR))
				HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount);

			/* 6.2 reset TX Resource for normal operation */
			nicTxResetResource(prAdapter);

			/* 6.3 Enable interrupt */
			nicEnableInterrupt(prAdapter);

			/* 6.4 Override network address */
			wlanUpdateNetworkAddress(prAdapter);

			/* 6.5 indicate disconnection as default status */
			kalIndicateStatusAndComplete(prAdapter->prGlueInfo, WLAN_STATUS_MEDIA_DISCONNECT, NULL, 0);
		}

		RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE);

		/* MGMT Initialization */
		nicInitMGMT(prAdapter, NULL);

	} while (FALSE);

	if (u4Status != WLAN_STATUS_SUCCESS)
		return FALSE;
	else
		return TRUE;
}

/*----------------------------------------------------------------------------*/
/*!
* @brief This routine is used to set ACPI power mode to D3.
*
* @param prAdapter pointer to the Adapter handler
*
* @return (none)
*/
/*----------------------------------------------------------------------------*/
BOOLEAN nicpmSetAcpiPowerD3(IN P_ADAPTER_T prAdapter)
{
	UINT_32 i;

	ASSERT(prAdapter);

	/* 1. MGMT - unitialization */
	nicUninitMGMT(prAdapter);

	/* 2. Disable Interrupt */
	nicDisableInterrupt(prAdapter);

	/* 3. emit CMD_NIC_POWER_CTRL command packet */
	wlanSendNicPowerCtrlCmd(prAdapter, 1);

	/* 4. Clear Interrupt Status */
	i = 0;
	while (i < CFG_IST_LOOP_COUNT && nicProcessIST(prAdapter) != WLAN_STATUS_NOT_INDICATING) {
		i++;
	};

	/* 5. Remove pending TX */
	nicTxRelease(prAdapter);

	/* 5.1 clear pending Security / Management Frames */
	kalClearSecurityFrames(prAdapter->prGlueInfo);
	kalClearMgmtFrames(prAdapter->prGlueInfo);

	/* 5.2 clear pending TX packet queued in glue layer */
	kalFlushPendingTxPackets(prAdapter->prGlueInfo);

	/* 6. Set Onwership to F/W */
	nicpmSetFWOwn(prAdapter, FALSE);

	/* 7. Set variables */
	prAdapter->rAcpiState = ACPI_STATE_D3;

	return TRUE;
}


text:
/*----------------- GENERAL CSS ------------------*/

/*Configure the tab buttons*/
.sheet-banner{
    background-image: url(https://i.pinimg.com/564x/ad/ce/f3/adcef371d608bdabd95fca1ee9a37ec4.jpg);
    background-color: white;
    background-size: 50% 100%;
    background-position: center top;
    background-repeat: no-repeat;
    text-align: center;
}
.sheet-attributes,
.sheet-attacks,
.sheet-abilities,
.sheet-transformations {
	display: none;
}

/* show the selected tab */
.sheet-tabstoggle[value="attributes"] ~ div.sheet-attributes,
.sheet-tabstoggle[value="attacks"] ~ div.sheet-attacks,
.sheet-tabstoggle[value="abilities"] ~ div.sheet-abilities,
.sheet-tabstoggle[value="transformations"] ~ div.sheet-transformations {
	display: block;
}

.sheet-equipmentTable{
    display: grid;
    border: 1px solid seagreen;
    border-top: none;
    grid-template-areas:
    'gear1 gear2 gear3';
}

.sheet-abilities{
    background-image: url(https://i.pinimg.com/564x/72/f0/30/72f0303e2a534937e94d4390269d13d4.jpg);
    background-position: center;
    background-repeat: no-repeat;
    background-color: #0A0A0A;
    text-align: center;
}

.sheet-transformations-table{
    display: grid;
    border: 2px solid silver;
    justify-content: space-around;
    grid-template-areas:
    'tname tagi tins tper tpot tsch tspi tstr tten';
}

.sheet-tten{
    grid-area: tten;
}

.sheet-tstr{
    grid-area: tstr;
}

.sheet-tspi{
    grid-area: tspi;
}

.sheet-tsch{
    grid-area: tsch;
}

.sheet-tpot{
    grid-area: tpot;
}

.sheet-tper{
    grid-area: tper;
}

.sheet-tins{
    grid-area: tins;
}

.sheet-tagi{
    grid-area: tagi;
}

.sheet-ttype{
    grid-area: ttype;
}

.sheet-tname{
    grid-area: tname;
}

.sheet-transformations-bot{
    grid-area: transformations-bot;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sheet-transformations-top{
    grid-area: transformations-top;
    display: grid;
    grid-template-areas:
    'tn ta ti tpe tpo tsc tsp tst tte';
}

.sheet-transformations-page{
    display: grid;
    border: 3px solid silver;
    grid-template-areas:
    'transformations-top'
    'transformations-bot';
}

button[type="roll"].sheet-stress-button:before{
    content: ' ';
  }

button[type="roll"].sheet-stress-button:hover{
    background-position: 0;
  }

button[type="roll"].sheet-stress-button{
    background-image: url(https://i.pinimg.com/564x/e2/3d/e8/e23de8081ca4de637306e28c58f521e4.jpg);
    background-size: 30px 30px;
    background-repeat: no-repeat;
    width: 30px;
    height: 30px;
    border-style: none;
    background-color: transparent;
    margin-left: 5px;
}

button[type="roll"].sheet-attack-button:before{
    content: ' ';
  }

button[type="roll"].sheet-attack-button:hover{
    background-position: 0;
  }

button[type="roll"].sheet-attack-button{
    background-image: url(https://i.pinimg.com/564x/24/79/d7/2479d70c7483283648c3af85b1da948d.jpg);
    background-size: 30px 30px;
    background-repeat: no-repeat;
    width: 30px;
    height: 30px;
    border-style: none;
    background-color: transparent;
    margin-left: 5px;
}

.sheet-transformations{
    background-image: url(https://i.pinimg.com/564x/75/a2/d4/75a2d435cf7687fc839860f45cc4ac1e.jpg);
    background-position: center;
    background-repeat: no-repeat;
    background-color: #070602;
    text-align: center;
}

.sheet-ccol7{
    grid-area: ccol7;
}

.sheet-ccol6{
    grid-area: ccol6;
}

.sheet-ccol5{
    grid-area: ccol5;
    justify-content: center;
}

.sheet-ccol4{
    grid-area: ccol4;
    justify-content: center;
}

.sheet-ccol3{
    grid-area: ccol3;
    justify-content: center;
}

.sheet-ccol2{
    grid-area: ccol2;
    justify-content: center;
}
.sheet-ccol1{
    grid-area: ccol1;
    justify-content: center;
}
.sheet-saves{
    display: grid;
    grid-template-areas:
    'save1 save2 save3 save4';
}
.sheet-custom-attack-table{
    display: grid;
    border: 2px solid rgb(156, 155, 155);
    justify-content: space-around;
    grid-template-areas:
    'ccol1 ccol2 ccol3 ccol4 ccol5';
}

.sheet-custom-attacks-hcol7{
    grid-area: hcol7;
}

.sheet-custom-attacks-hcol6{
    grid-area: hcol6;
}

.sheet-custom-attacks-hcol5{
    grid-area: hcol5;
}

.sheet-custom-attacks-hcol4{
    grid-area: hcol4;
}

.sheet-custom-attacks-hcol3{
    grid-area: hcol3;
}

.sheet-custom-attacks-hcol2{
    grid-area: hcol2;
}

.sheet-custom-attacks-hcol1{
    grid-area: hcol1;
}

.sheet-custom-attacks-top{
    display: grid;
    grid-area: custom-attacks-top;
    grid-column: auto;
    grid-template-areas:
    'hcol1 hcol2 hcol3 hcol4 hcol5';
}

.sheet-custom-attack-bottom{
    grid-area: custom-attacks-bottom;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sheet-custom-attacks{
    display: grid;
    grid-row: auto;
    grid-template-areas:
    'custom-attacks-top'
    'custom-attacks-bottom';
    border: 3px solid rgb(156, 155, 155);
}

.sheet-basic-attacks-row{
    border: 1px inset rgb(156, 155, 155);
    border-left-style: none;
    border-right-style: none;
    height: 35px;
}

.sheet-basic-attack-col4{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center top;
    border: 1px inset rgb(156, 155, 155);
    grid-area: col4;
}

.sheet-basic-attack-col3{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center top;
    border: 1px inset rgb(156, 155, 155);
    grid-area: col3;
}

.sheet-basic-attack-col2{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center top;
    border: 1px inset rgb(156, 155, 155);
    grid-area: col2;
}

.sheet-basic-attack-col1{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center top;
    border: 1px inset rgb(156, 155, 155);
    grid-area: col1;
}

.sheet-basic-attack{
    display: grid;
    grid-template-areas:
    'col1 col2 col3 col4';
    border: 3px solid rgb(156, 155, 155);
}

.sheet-attacks{
    background-image: url(https://i.pinimg.com/564x/cf/db/99/cfdb99728dfe48c17957810e9c65f23a.jpg);
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgb(38, 44, 58);
    text-align: center;
}

.sheet-character{
    background-image: url(https://i.pinimg.com/564x/90/77/29/9077291c252a3177ae7f138c7ad718aa.jpg);
    background-position: center;
    background-color: rgb(237, 109, 0);
    background-repeat: no-repeat;
    text-align: center;
}

.sheet-skill2{
    grid-area: skill2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-left: 6px;
    border: 1px inset darkred;
}

.sheet-skill1{
    grid-area: skill1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-left: 6px;
    border: 1px inset darkred;
}

.sheet-skill-label{
    color: rgb(27, 92, 129);
}

button[type="roll"].sheet-skill:before{
    content: ' ';
  }

button[type="roll"].sheet-skill:hover{
    background-position: 0;
  }

button[type="roll"].sheet-skill{
    background-image: url(https://i.pinimg.com/564x/c4/79/b1/c479b192840cbf0bebedd912fde8b53f.jpg);
    background-size: 20px 20px;
    background-repeat: no-repeat;
    width: 20px;
    height: 20px;
    border-style: none;
    background-color: transparent;
    margin-left: 5px;
}

.sheet-stat-ten{
    display: flex;
    grid-area: stat-ten;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-pot{
    display: flex;
    grid-area: stat-pot;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-per{
    display: flex;
    grid-area: stat-per;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-spi{
    display: flex;
    grid-area: stat-spi;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-str{
    display: flex;
    grid-area: stat-str;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-sch{
    display: flex;
    grid-area: stat-sch;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-agi{
    display: flex;
    grid-area: stat-agi;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-stat-ins{
    grid-area: stat-ins;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px inset darkred;
}

.sheet-all-stats{
    grid-area: all-stats;
}

.sheet-all-skills{
    grid-area: all-skills;
    display: grid;
    grid-template-areas:
    'skill1' 'skill2';
}

.sheet-stats{
    display: grid;
    border: 2px solid darkred;
    grid-template-areas:
    'all-stats skill1 skill2';
}

.sheet-attr-head{
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    grid-area: attr-head;
}

.sheet-attr-top{
    display: flex;
    justify-content: center;
    align-content: space-between;
    grid-area: attr-top;
}

.sheet-attr-bot{
    display: flex;
    justify-content: center;
    align-content: space-between;
    grid-area: attr-bottom;
}
.sheet-info{
    display: grid;
    border: 3px solid darkred;
    grid-row: 25px;
    grid-template-areas:
    'attr-head'
    'attr-top'
    'attr-bottom';
}

.sheet-j-label{
    color: rgb(15, 56, 80);
}

.sheet-j-h3{
    color: rgb(15, 56, 80);
    font-size: 1.5em;
}

h1{
    font-size: 3em;
    color: navy;
}

h2{
    font-size: 2em;
    color: navy;
}

h3{
    font-size: 1.5em;
    text-align: center;
    color: navy;
}

h4{
    font-size: 1em;
    color: navy;
}

label{
    color: navy;
    display: inline-block;
}

redpajama_set_name: RedPajamaGithub


text:
virtualenv .slotty
source .slotty/bin/activate

#ARCHFLAGS: macosx specific
#Xcode 5.1 changed the way clang treats invalid compiler options.
#many python or ruby native extensions don't treat this change yet ...
#in the meantime we switch off the error
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install --upgrade -e .
pip install --upgrade -r requirements-dev.txt


text:
@interface MockUIApplication : NSObject

-(UIWindow *)keyWindow;

@end

@implementation MockUIApplication

- (UIWindow *)keyWindow {
	return [UIWindow new];
}

@end

@interface MockUINavigationController : RNNNavigationController
@property (nonatomic, strong) NSArray* willReturnVCs;
@end

@implementation MockUINavigationController

-(NSArray<UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated {
	return self.willReturnVCs;
}

-(NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
	return self.willReturnVCs;
}

@end

@interface RNNCommandsHandlerTest : XCTestCase

@property (nonatomic, strong) id store;
@property (nonatomic, strong) RNNCommandsHandler* uut;
@property (nonatomic, strong) RNNRootViewController* vc1;
@property (nonatomic, strong) RNNRootViewController* vc2;
@property (nonatomic, strong) RNNRootViewController* vc3;
@property (nonatomic, strong) MockUINavigationController* nvc;
@property (nonatomic, strong) id mainWindow;
@property (nonatomic, strong) id sharedApplication;
@property (nonatomic, strong) id controllerFactory;
@property (nonatomic, strong) id overlayManager;
@property (nonatomic, strong) id eventEmmiter;

@end

@implementation RNNCommandsHandlerTest

- (void)setUp {
	[super setUp];
	self.mainWindow = [OCMockObject partialMockForObject:[UIWindow new]];
	self.store = [OCMockObject partialMockForObject:[[RNNStore alloc] init]];
	self.eventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
	self.overlayManager = [OCMockObject partialMockForObject:[RNNOverlayManager new]];
	self.controllerFactory = [OCMockObject partialMockForObject:[[RNNControllerFactory alloc] initWithRootViewCreator:nil eventEmitter:self.eventEmmiter store:self.store componentRegistry:nil andBridge:nil]];
	self.uut = [[RNNCommandsHandler alloc] initWithStore:self.store controllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:[RNNModalManager new] overlayManager:self.overlayManager mainWindow:_mainWindow];
	self.vc1 = [RNNRootViewController new];
	self.vc2 = [RNNRootViewController new];
	self.vc3 = [RNNRootViewController new];
	_nvc = [[MockUINavigationController alloc] init];
	[_nvc setViewControllers:@[self.vc1, self.vc2, self.vc3]];
	[self.store setComponent:self.vc1 componentId:@"vc1"];
	[self.store setComponent:self.vc2 componentId:@"vc2"];
	[self.store setComponent:self.vc3 componentId:@"vc3"];
	OCMStub([self.sharedApplication keyWindow]).andReturn(self.mainWindow);
}

- (void)testAssertReadyForEachMethodThrowsExceptoins {
	NSArray* methods = [self getPublicMethodNamesForObject:self.uut];
	[self.store setReadyToReceiveCommands:false];
	for (NSString* methodName in methods) {
		SEL s = NSSelectorFromString(methodName);
		IMP imp = [self.uut methodForSelector:s];
		void (*func)(id, SEL, id, id, id) = (void *)imp;

		XCTAssertThrowsSpecificNamed(func(self.uut,s, nil, nil, nil), NSException, @"BridgeNotLoadedError");
	}
}

-(NSArray*) getPublicMethodNamesForObject:(NSObject*)obj{
	NSMutableArray* skipMethods = [NSMutableArray new];

	[skipMethods addObject:@"initWithStore:controllerFactory:eventEmitter:stackManager:modalManager:overlayManager:mainWindow:"];
	[skipMethods addObject:@"assertReady"];
	[skipMethods addObject:@"removePopedViewControllers:"];
	[skipMethods addObject:@".cxx_destruct"];
	[skipMethods addObject:@"dismissedModal:"];
	[skipMethods addObject:@"dismissedMultipleModals:"];

	NSMutableArray* result = [NSMutableArray new];

	// count and names:
	int i=0;
	unsigned int mc = 0;
	Method * mlist = class_copyMethodList(object_getClass(obj), &mc);

	for(i=0; i<mc; i++) {
		NSString *methodName = [NSString stringWithUTF8String:sel_getName(method_getName(mlist[i]))];

		// filter skippedMethods
		if (methodName && ![skipMethods containsObject:methodName]) {
			[result addObject:methodName];
		}
	}

	return result;
}

-(void)testDynamicStylesMergeWithStaticStyles {
	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
	initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
	RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
	RNNTestRootViewCreator* creator = [[RNNTestRootViewCreator alloc] init];

	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:creator eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];

	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithLayoutInfo:nil creator:creator childViewControllers:@[vc] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[[RNNNavigationControllerPresenter alloc] init]];

	[vc viewWillAppear:false];
	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);

	[self.store setReadyToReceiveCommands:true];
	[self.store setComponent:vc componentId:@"componentId"];

	NSDictionary* dictFromJs = @{@"topBar": @{@"background" : @{@"color" : @(0xFFFF0000)}}};
	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];

	[self.uut mergeOptions:@"componentId" options:dictFromJs completion:^{
		XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
		XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
	}];
}

- (void)testMergeOptions_shouldOverrideOptions {
	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
	initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];

	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:[[RNNTestRootViewCreator alloc] init] eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];

	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
	[vc viewWillAppear:false];
	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);

	[self.store setReadyToReceiveCommands:true];
	[self.store setComponent:vc componentId:@"componentId"];

	NSDictionary* dictFromJs = @{@"topBar": @{@"title" : @{@"text" : @"new title"}}};

	[self.uut mergeOptions:@"componentId" options:dictFromJs completion:^{
		XCTAssertTrue([vc.navigationItem.title isEqual:@"new title"]);
	}];
}

- (void)testPop_removeTopVCFromStore {
	[self.store setReadyToReceiveCommands:true];
	XCTestExpectation *expectation = [self expectationWithDescription:@"Testing Async Method"];

	[self.uut pop:@"vc3" mergeOptions:nil completion:^{
		XCTAssertNil([self.store findComponentForId:@"vc3"]);
		XCTAssertNotNil([self.store findComponentForId:@"vc2"]);
		XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
		[expectation fulfill];
	} rejection:^(NSString *code, NSString *message, NSError *error) {

	}];

	[self waitForExpectationsWithTimeout:1 handler:nil];
}

- (void)testPopToSpecificVC_removeAllPopedVCFromStore {
	[self.store setReadyToReceiveCommands:true];
	XCTestExpectation *expectation = [self expectationWithDescription:@"Testing Async Method"];
	_nvc.willReturnVCs = @[self.vc2, self.vc3];
	[self.uut popTo:@"vc1" mergeOptions:nil completion:^{
		XCTAssertNil([self.store findComponentForId:@"vc2"]);
		XCTAssertNil([self.store findComponentForId:@"vc3"]);
		XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
		[expectation fulfill];
	} rejection:nil];

	[self waitForExpectationsWithTimeout:1 handler:nil];
}

- (void)testPopToRoot_removeAllTopVCsFromStore {
	[self.store setReadyToReceiveCommands:true];
	_nvc.willReturnVCs = @[self.vc2, self.vc3];
	XCTestExpectation *expectation = [self expectationWithDescription:@"Testing Async Method"];
	[self.uut popToRoot:@"vc3" mergeOptions:nil completion:^{
		XCTAssertNil([self.store findComponentForId:@"vc2"]);
		XCTAssertNil([self.store findComponentForId:@"vc3"]);
		XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
		[expectation fulfill];
	} rejection:nil];

	[self waitForExpectationsWithTimeout:1 handler:nil];
}

- (void)testShowOverlay_createLayout {
	[self.store setReadyToReceiveCommands:true];
	OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
	NSDictionary* layout = @{};

	[[self.controllerFactory expect] createLayout:layout];
	[self.uut showOverlay:layout completion:^{}];
	[self.controllerFactory verify];
}

- (void)testShowOverlay_saveToStore {
	[self.store setReadyToReceiveCommands:true];
	OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]);

	[[self.controllerFactory expect] createLayout:[OCMArg any]];
	[self.uut showOverlay:@{} completion:^{}];
	[self.overlayManager verify];
}

- (void)testShowOverlay_withCreatedLayout {
	[self.store setReadyToReceiveCommands:true];
	UIViewController* layoutVC = [RNNRootViewController new];
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(layoutVC);

	[[self.overlayManager expect] showOverlayWindow:[OCMArg any]];
	[self.uut showOverlay:@{} completion:^{}];
	[self.overlayManager verify];
}

- (void)testShowOverlay_invokeNavigationCommandEventWithLayout {
	[self.store setReadyToReceiveCommands:true];
	OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
	id mockedVC = [OCMockObject partialMockForObject:self.vc1];
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);

	NSDictionary* layout = @{};

	[[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"showOverlay" params:[OCMArg any]];
	[self.uut showOverlay:layout completion:^{}];
	[self.eventEmmiter verify];
}

- (void)testDismissOverlay_findComponentFromStore {
	[self.store setReadyToReceiveCommands:true];
	NSString* componentId = @"componentId";
	[[self.store expect] findComponentForId:componentId];
	[self.uut dismissOverlay:componentId completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
	[self.store verify];
}

- (void)testDismissOverlay_dismissReturnedViewController {
	[self.store setReadyToReceiveCommands:true];
	NSString* componentId = @"componentId";
	UIViewController* returnedView = [UIViewController new];
	OCMStub([self.store findComponentForId:componentId]).andReturn(returnedView);

	[[self.overlayManager expect] dismissOverlay:returnedView];
	[self.uut dismissOverlay:componentId completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
	[self.overlayManager verify];
}

- (void)testDismissOverlay_handleErrorIfNoOverlayExists {
	[self.store setReadyToReceiveCommands:true];
	NSString* componentId = @"componentId";
	id errorHandlerMockClass = [OCMockObject mockForClass:[RNNErrorHandler class]];

	[[errorHandlerMockClass expect] reject:[OCMArg any] withErrorCode:1010 errorDescription:[OCMArg any]];
	[self.uut dismissOverlay:componentId completion:[OCMArg any] rejection:[OCMArg any]];
	[errorHandlerMockClass verify];
}

- (void)testDismissOverlay_invokeNavigationCommandEvent {
	[self.store setReadyToReceiveCommands:true];
	NSString* componentId = @"componentId";
	OCMStub([self.store findComponentForId:componentId]).andReturn([UIViewController new]);

	[[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"dismissOverlay" params:[OCMArg any]];
	[self.uut dismissOverlay:componentId completion:^{

	} rejection:^(NSString *code, NSString *message, NSError *error) {}];

	[self.eventEmmiter verify];
}

- (void)testSetRoot_setRootViewControllerOnMainWindow {
	[self.store setReadyToReceiveCommands:true];
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(self.vc1);

	[[self.mainWindow expect] setRootViewController:self.vc1];
	[self.uut setRoot:@{} completion:^{}];
	[self.mainWindow verify];
}

- (void)testSetRoot_removeAllComponentsFromMainWindow {
	[self.store setReadyToReceiveCommands:true];
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(self.vc1);

	[[self.store expect] removeAllComponentsFromWindow:self.mainWindow];
	[self.uut setRoot:@{} completion:^{}];
	[self.store verify];
}

- (void)testSetStackRoot_resetStackWithSingleComponent {
	OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(@[self.vc2]);
	[self.store setReadyToReceiveCommands:true];
	[self.uut setStackRoot:@"vc1" children:nil completion:^{

	} rejection:^(NSString *code, NSString *message, NSError *error) {

	}];
	XCTAssertEqual(_nvc.viewControllers.firstObject, self.vc2);
	XCTAssertEqual(_nvc.viewControllers.count, 1);
}

- (void)testSetStackRoot_setMultipleChildren {
	NSArray* newViewControllers = @[_vc1, _vc3];
	OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
	[self.store setReadyToReceiveCommands:true];
	[self.uut setStackRoot:@"vc1" children:nil completion:^{

	} rejection:^(NSString *code, NSString *message, NSError *error) {

	}];
	XCTAssertTrue([_nvc.viewControllers isEqual:newViewControllers]);
}

- (void)testSetRoot_waitForRenderTrue {
	[self.store setReadyToReceiveCommands:true];
	self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
	self.vc1.options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];

	id mockedVC = [OCMockObject partialMockForObject:self.vc1];
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);

	[[mockedVC expect] renderTreeAndWait:YES perform:[OCMArg any]];
	[self.uut setRoot:@{} completion:^{}];
	[mockedVC verify];
}

- (void)testSetRoot_waitForRenderFalse {
	[self.store setReadyToReceiveCommands:true];
	self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
	self.vc1.options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:NO];

	id mockedVC = [OCMockObject partialMockForObject:self.vc1];
	OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);

	[[mockedVC expect] renderTreeAndWait:NO perform:[OCMArg any]];
	[self.uut setRoot:@{} completion:^{}];
	[mockedVC verify];
}

@end


text:
<!DOCTYPE html>

    <title>Document</title>

                    Nav list

Nav sub list

Nav sub list

Nav sub list

Nav sub list

Date

Nav sub list

Nav sub list

Nav sub list

Nav list

Nav sub2 list

Nav sub2 list

Nav sub2 list

Nav sub2 list

Nav list

Nav list

Neque porro quisquam est qui dolorem ipsum quia dolor sit amet

            A human is big than his dreams...

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer
                vel augue at enim rhoncus gravida. Nulla facilisi.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo blanditiis nostrum deleniti explicabo accusamus, sunt, sit officia iure quos iusto nam nulla pariatur impedit voluptatibus, magnam temporibus omnis maiores voluptates?

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

        <input type="button" value="Click me" disabled="disabled" />

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

        <input type="checkbox" id="ossm" />
        CSS is Awesome

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

        <input type="text" value="test-124" />

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

        <input type="checkbox" />

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

        <input type="text" value="test-125" />

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

        <input type="checkbox" />

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam neque sit amet lorem sagittis elementum. Donec sed turpis nisl, vel pharetra massa. Integer semper erat arcu. Vivamus nec leo eleifend dui bibendum volutpat. Integer vel
            augue at enim rhoncus gravida. Nulla facilisi.

Date of this footer

        21.11.2016

404 error page


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>CLI: command_line_history.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>

Main Page

Namespaces

Classes

Files

File List

File Members

command_line_history.cpp

00001
00026
00027
00028 #include "cli/pch.h"
00029
00030 #include "cli/assert.h"
00031 #include "cli/resource_string.h"
00032
00033 #include "constraints.h"
00034 #include "command_line_history.h"
00035
00036
00037 CLI_NS_USE(cli)
00038
00039
00040 CmdLineHistory::CmdLineHistory(const unsigned int UI_StackSize)
00041   : m_uiStackSize(UI_StackSize),
00042     m_qHistory(UI_StackSize + 1),   // History stack owns UI_HistoryCount + 1 elements for UI_HistoryCount previous and another one for the current line.
00043     m_uiNavigationIndex(0), m_bNavigation(false)
00044 {
00045     m_qHistory.AddHead(CmdLineEdition());
00046 }
00047
00048 CmdLineHistory::~CmdLineHistory(void)
00049 {
00050 }
00051
00052 const bool CmdLineHistory::Push(const CmdLineEdition& CLI_Line)
00053 {
00054     if (// Check the line is not empty.
00055         (! CLI_Line.GetLine().IsEmpty())
00056         // Check it is not the same as the previous one.
00057         && ((m_qHistory.GetCount() <= 1) || (CLI_Line.GetLine() != GetLine(1).GetLine())))
00058     {
00059         // Limit to HISTORY_STACK_SIZE.
00060         while (m_qHistory.GetCount() > m_uiStackSize)
00061         {
00062             m_qHistory.RemoveTail();
00063         }
00064
00065         // Ensure there is at least one element.
00066         if (m_qHistory.IsEmpty())
00067         {
00068             if (! m_qHistory.AddTail(CmdLineEdition()))
00069             {
00070                 return false;
00071             }
00072         }
00073
00074         // Backup the current line.
00075         m_qHistory.GetHead() = CLI_Line;
00076
00077         // Add a new empty element.
00078         m_qHistory.AddHead(CmdLineEdition());
00079     }
00080
00081     m_uiNavigationIndex = 0;
00082     m_bNavigation = false;
00083
00084     return true;
00085 }
00086
00087 const bool CmdLineHistory::Clear(void)
00088 {
00089     while (! m_qHistory.IsEmpty())
00090     {
00091         m_qHistory.RemoveHead();
00092     }
00093     m_qHistory.AddHead(CmdLineEdition());
00094
00095     return true;
00096 }
00097
00098 const CmdLineEdition& CmdLineHistory::GetLine(const unsigned int UI_BackwardIndex) const
00099 {
00100     int i = 0;
00101     tk::Queue<CmdLineEdition>::Iterator it = m_qHistory.GetIterator();
00102     for (i=UI_BackwardIndex; i>0; i--)
00103     {
00104         if (! m_qHistory.MoveNext(it))
00105         {
00106             break;
00107         }
00108     }
00109
00110     if ((i==0) && m_qHistory.IsValid(it))
00111     {
00112         return m_qHistory.GetAt(it);
00113     }
00114     else
00115     {
00116         static CmdLineEdition cli_Error;
00117         CLI_ASSERT(false);
00118         return cli_Error;
00119     }
00120 }
00121
00122 const unsigned int CmdLineHistory::GetCount(void) const
00123 {
00124     return m_qHistory.GetCount();
00125 }
00126
00127 const bool CmdLineHistory::SaveCurrentLine(const CmdLineEdition& CLI_CurrentLine)
00128 {
00129     m_qHistory.GetHead() = CLI_CurrentLine;
00130     return true;
00131 }
00132
00133 const bool CmdLineHistory::Navigate(
00134         CmdLineEdition& CLI_CmdLine, const OutputDevice& CLI_Stream,
00135         const int I_Navigation)
00136 {
00137     bool b_Res = false;
00138
00139     if (! m_qHistory.IsEmpty())
00140     {
00141         b_Res = true;
00142
00143         // Initialize navigation if needed.
00144         if (! m_bNavigation)
00145         {
00146             m_uiNavigationIndex = 0;
00147             m_bNavigation = true;
00148         }
00149
00150         // Determine which history line to select.
00151         int i_NavigationIndex = ((int) m_uiNavigationIndex) + I_Navigation;
00152         if (i_NavigationIndex >= ((int) m_qHistory.GetCount()))
00153         {
00154             i_NavigationIndex = ((int) m_qHistory.GetCount()) - 1;
00155             b_Res = false;
00156         }
00157         if (i_NavigationIndex < 0)
00158         {
00159             i_NavigationIndex = 0;
00160             b_Res = false;
00161         }
00162
00163         // If this is the current line, save it into the history stack.
00164         if (m_uiNavigationIndex == 0)
00165         {
00166             m_qHistory.GetHead() = CLI_CmdLine;
00167         }
00168         // Clean up the current line.
00169         CLI_CmdLine.CleanAll(CLI_Stream);
00170         // Translate the history index.
00171         m_uiNavigationIndex = (unsigned int) i_NavigationIndex;
00172         // Print out this line.
00173         CLI_CmdLine = GetLine(m_uiNavigationIndex);
00174         CLI_CmdLine.PrintCmdLine(CLI_Stream);
00175     }
00176
00177     return b_Res;
00178 }
00179
00180 void CmdLineHistory::EnableNavigationMemory(const bool B_NavigationMemory)
00181 {
00182     m_bNavigation = B_NavigationMemory;
00183 }

<address class="footer">Generated on Wed Jul 24 2013 08:23:20 for CLI by

 1.7.1 </address>


text:
layout: post
---

    {% if page.date %}

Presented on {{ page.date | date: '%B %d, %Y' }} {% if page.location %}at {{page.location.name}}{% endif %}.

    {% endif %}
    {{ content }}
    {{ page.cta }}


text:
import TypecheckWorker from '.';
import { launch } from 'stagehand/lib/adapters/child-process';

launch(new TypecheckWorker());


text:
<?php

namespace GraphAware\Neo4j\OGM\Tests\Integration;

use GraphAware\Neo4j\OGM\Proxy\LazyCollection;
use GraphAware\Neo4j\OGM\Tests\Integration\Models\MoviesDemo\Movie;
use GraphAware\Neo4j\OGM\Tests\Integration\Models\MoviesDemo\Person;

/**
 * Class MovieDatasetTest.
 *
 * @group movies-it
 */
class MovieDatasetTest extends IntegrationTestCase
{
    public function setUp()
    {
        parent::setUp();
        $this->clearDb();
        $this->playMovies();
    }

    public function testPersonCanBeLoadWithMovies()
    {
        /** @var Person $tom */
        $tom = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        $this->assertInstanceOf(Person::class, $tom);
        $this->assertCount(12, $tom->getMovies());

        foreach ($tom->getMovies() as $movie) {
            $this->assertTrue($movie->getActors()->contains($tom));
            $this->assertSame(spl_object_hash($tom), spl_object_hash($movie->getActor('Tom Hanks')));
        }
    }

    public function testActorNameCanBeChangedWhenRetrievedFromMovie()
    {
        /** @var Movie $castAway */
        $castAway = $this->em->getRepository(Movie::class)->findOneBy(['title' => 'Cast Away']);
        $this->assertInstanceOf(Movie::class, $castAway);
        $tom = $castAway->getActor('Tom Hanks');
        $tom->setName('Tom Hanks Modified');
        $this->em->flush();

        $this->assertGraphExist('(n:Person {name:"Tom Hanks Modified"})');
    }

    public function testMovieNameCanBeChangedWhenLoadedFromActor()
    {
        /** @var Person $tom */
        $tom = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        $this->assertInstanceOf(Person::class, $tom);
        $cast = null;
        foreach ($tom->getMovies() as $movie) {
            if ($movie->getTitle() === 'Cast Away') {
                $cast = $movie;
            }
        }
        $this->assertInstanceOf(Movie::class, $cast);
        $cast->setTitle('Cast Away 2');
        $this->em->flush();
        $this->assertGraphExist('(m:Movie {title: "Cast Away 2"})');
    }

    /**
     * @see https://github.com/graphaware/neo4j-php-ogm/issues/56
     */
    public function testActorCanBeAddedToMovie()
    {
        $person = new Person('Johnny Depp');
        $this->em->persist($person);
        $movie = new Movie('Pirates Of The Caribbean');
        $this->em->persist($movie);
        $this->em->flush();
        $this->em->clear();

        $johnny = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Johnny Depp']);
        $this->assertInstanceOf(Person::class, $johnny);

        /** @var Movie $pirates */
        $pirates = $this->em->getRepository(Movie::class)->findOneBy(['title' => 'Pirates Of The Caribbean']);
        $this->assertInstanceOf(Movie::class, $pirates);

        $pirates->getActors()->add($johnny);
        $this->em->flush();
        $this->assertGraphExist('(m:Movie {title:"Pirates Of The Caribbean"})<-[:ACTED_IN]-(p:Person {name:"Johnny Depp"})');
        $this->assertCount(1, $this->em->getRepository(Person::class)->findBy(['name' => 'Johnny Depp']));
    }

    /**
     * @see https://github.com/graphaware/neo4j-php-ogm/issues/104
     * @group issue-104
     */
    public function testRelationshipReferencesCanBeRemoved()
    {
        /** @var Person $person */
        $person = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        /** @var Movie $movie */
        $movie = $this->em->getRepository(Movie::class)->findOneBy(['title' => 'Cast Away']);

        $castFromPerson = null;
        foreach ($person->getMovies() as $m) {
            if ('Cast Away' === $m->getTitle()) {
                $castFromPerson = $m;
            }
        }
        $this->assertNotNull($castFromPerson);
        $c = count($person->getMovies());
        $this->assertEquals(spl_object_hash($castFromPerson), spl_object_hash($movie));
        $person->getMovies()->removeElement($movie);
        $movie->getActors()->removeElement($person);
        $this->assertEquals($c-1, count($person->getMovies()));
        $this->em->flush();

        $this->assertGraphNotExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Cast Away"})');
    }

    public function testRelationshipReferencesCanBeRemovedTwice()
    {
        /** @var Person $person */
        $person = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        /** @var Movie $movie */
        $movie = $this->em->getRepository(Movie::class)->findOneBy(['title' => 'Cast Away']);

        $castFromPerson = null;
        foreach ($person->getMovies() as $m) {
            if ('Cast Away' === $m->getTitle()) {
                $castFromPerson = $m;
            }
        }
        $this->assertNotNull($castFromPerson);
        $c = count($person->getMovies());
        $this->assertEquals(spl_object_hash($castFromPerson), spl_object_hash($movie));
        $person->getMovies()->removeElement($movie);
        $movie->getActors()->removeElement($person);
        $this->assertEquals($c-1, count($person->getMovies()));
        $this->em->flush();
        $this->em->flush();

        $this->assertGraphNotExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Cast Away"})');
    }

    public function testRelationshipReferenceCanBeReAddedAndRemoved()
    {
        /** @var Person $person */
        $person = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        /** @var Movie $movie */
        $movie = $this->em->getRepository(Movie::class)->findOneBy(['title' => 'Cast Away']);

        $castFromPerson = null;
        foreach ($person->getMovies() as $m) {
            if ('Cast Away' === $m->getTitle()) {
                $castFromPerson = $m;
            }
        }
        $this->assertNotNull($castFromPerson);
        $c = count($person->getMovies());
        $this->assertEquals(spl_object_hash($castFromPerson), spl_object_hash($movie));
        $person->getMovies()->removeElement($movie);
        $movie->getActors()->removeElement($person);
        $this->assertEquals($c-1, count($person->getMovies()));
        $this->em->flush();
        $this->assertGraphNotExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Cast Away"})');
        $person->getMovies()->add($movie);
        $movie->getActors()->add($person);
        $this->em->flush();
        $this->assertGraphExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Cast Away"})');
        $person->getMovies()->removeElement($movie);
        $movie->getActors()->removeElement($person);
        $this->em->flush();
        $this->assertGraphNotExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Cast Away"})');
    }

    public function testRelationshipReferenceCanBeRemovedAfterNewCreation()
    {
        /** @var Person $person */
        $person = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        $movie = new Movie('Super Movie');
        $person->getMovies()->add($movie);
        $movie->getActors()->add($person);
        $person->getMovies()->first();
        $this->em->flush();
        $this->assertGraphExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Super Movie"})');
        $person->getMovies()->removeElement($movie);
        $movie->getActors()->removeElement($person);
        $this->em->flush();
        $this->assertGraphNotExist('(p:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie {title:"Super Movie"})');
    }

    public function testThatGetterShouldNotBeCalledToTriggerLazyLoading()
    {
        /** @var Person $person */
        $person = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        $this->assertInstanceOf(LazyCollection::class, $person->movies);

        /** @var Movie $movie */
        $movie = $this->em->getRepository(Movie::class)->findOneBy(['title' => 'The Matrix']);
        $this->assertInstanceOf(LazyCollection::class, $movie->actors);
    }

    public function testDegreeOfNodeIsReturned()
    {
        $degree = $this->client->run('MATCH (n:Person {name:"Tom Hanks"}) RETURN size((n)-[:ACTED_IN]->()) AS c')->firstRecord()->get('c');
        /** @var Person $person */
        $person = $this->em->getRepository(Person::class)->findOneBy(['name' => 'Tom Hanks']);
        $this->assertEquals($degree, $person->getMovies()->count());

    }
}


text:
'use strict'

var _ = require('lodash')
var Eraro = require('eraro')
var Common = require('./common')
var Errors = require('./errors')

var internals = {
  error: Eraro({
    package: 'seneca',
    msgmap: Errors,
    override: true
  })
}

exports.fail = function make_legacy_fail (so) {
  return function () {
    var args = Common.arrayify(arguments)

    var cb = _.isFunction(arguments[arguments.length - 1])
      ? arguments[arguments.length - 1] : null

    if (cb) {
      args.pop()
    }

    if (_.isObject(args[0])) {
      var code = args[0].code
      if (_.isString(code)) {
        args.unshift(code)
      }
    }

    var err = internals.error.apply(null, args)
    err.callpoint = new Error().stack.match(/^.*\n.*\n\s*(.*)/)[1]
    err.seneca = { code: err.code, valmap: err.details }

    this.log.error(err)
    if (so.errhandler) {
      so.errhandler.call(this, err)
    }

    if (cb) {
      cb.call(this, err)
    }

    return err
  }
}


text:
package eightbitlab.com.blurview;

import android.graphics.Bitmap;
import android.graphics.Canvas;

import androidx.annotation.NonNull;

// Serves purely as a marker of a Canvas used in BlurView
// to skip drawing itself and other BlurViews on the View hierarchy snapshot
public class BlurViewCanvas extends Canvas {
    public BlurViewCanvas(@NonNull Bitmap bitmap) {
        super(bitmap);
    }
}


text:
package v1

import (
	v1 "github.com/openshift/api/security/v1"
	corev1 "k8s.io/api/core/v1"
)

// SELinuxContextStrategyOptionsApplyConfiguration represents an declarative configuration of the SELinuxContextStrategyOptions type for use
// with apply.
type SELinuxContextStrategyOptionsApplyConfiguration struct {
	Type           *v1.SELinuxContextStrategyType `json:"type,omitempty"`
	SELinuxOptions *corev1.SELinuxOptions         `json:"seLinuxOptions,omitempty"`
}

// SELinuxContextStrategyOptionsApplyConfiguration constructs an declarative configuration of the SELinuxContextStrategyOptions type for use with
// apply.
func SELinuxContextStrategyOptions() *SELinuxContextStrategyOptionsApplyConfiguration {
	return &SELinuxContextStrategyOptionsApplyConfiguration{}
}

// WithType sets the Type field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Type field is set to the value of the last call.
func (b *SELinuxContextStrategyOptionsApplyConfiguration) WithType(value v1.SELinuxContextStrategyType) *SELinuxContextStrategyOptionsApplyConfiguration {
	b.Type = &value
	return b
}

// WithSELinuxOptions sets the SELinuxOptions field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SELinuxOptions field is set to the value of the last call.
func (b *SELinuxContextStrategyOptionsApplyConfiguration) WithSELinuxOptions(value corev1.SELinuxOptions) *SELinuxContextStrategyOptionsApplyConfiguration {
	b.SELinuxOptions = &value
	return b
}


text:
using System.Diagnostics;
using SpiceSharp.Attributes;

namespace SpiceSharp.Simulations
{
    /// <summary>
    /// Statistics for a <see cref="BaseSimulationStatistics" />.
    /// </summary>
    public class BaseSimulationStatistics : Statistics
    {
        /// <summary>
        /// Gets the total number of iterations.
        /// </summary>
        [ParameterName("iterations"), ParameterName("niter"), ParameterInfo("The total number of iterations")]
        public int Iterations { get; set; }

        /// <summary>
        /// Gets a stopwatch that keeps the total time spent solving equations.
        /// </summary>
        [ParameterName("tsolve"), ParameterInfo("The time spent solving equations")]
        public Stopwatch SolveTime { get; } = new Stopwatch();

        /// <summary>
        /// Gets a stopwatch that keeps the total time spent loading the equation matrix.
        /// </summary>
        [ParameterName("tload"), ParameterInfo("The time spent loading the equation matrix")]
        public Stopwatch LoadTime { get; } = new Stopwatch();

        /// <summary>
        /// Gets a stopwatch that keeps the total time spent reordering the equation matrix.
        /// </summary>
        [ParameterName("treorder"), ParameterInfo("The time spent reordering the equation matrix")]
        public Stopwatch ReorderTime { get; } = new Stopwatch();

        /// <summary>
        /// Gets a stopwatch that keeps the total time spent on decomposition of the matrix.
        /// </summary>
        [ParameterName("tdecomposition"), ParameterInfo("The time spent on equation matrix decomposition")]
        public Stopwatch DecompositionTime { get; } = new Stopwatch();

        /// <summary>
        /// Reset simulation statistics.
        /// </summary>
        public override void Reset()
        {
            Iterations = 0;
            SolveTime.Reset();
            LoadTime.Reset();
            ReorderTime.Reset();
            DecompositionTime.Reset();
        }
    }
}


text:
import { connect } from 'react-redux'
import { getSouthEasternStreams } from '../Bubbles/Bubbles.state'
import { getStreamDictionary } from './StreamList.selectors'

import StreamDetailsContainer from './StreamDetails.component'

const mapActionCreators = {
  getSouthEasternStreams
}

const mapStateToProps = (state) => {
  return {
    streams: getStreamDictionary(state)
  }
}

export default connect(mapStateToProps, mapActionCreators)(StreamDetailsContainer)


text:
import React from 'react';
import PropTypes from 'prop-types';

import classNames from 'classnames';
import styles from './styles.css';
import Icon from '../Icon';
import Typography from '../Typography';

function PopoverMenuAnchor3(props) {
    return (
        <div
            className={classNames(styles.wrapper, {[props.className]: props.className})}
            onClick={props.onClick}
        >

            <Typography
                className={styles.text}
                type="ingressStrong"
            >
                {props.children}
            </Typography>
            <Icon
                icon="icon-arrow_drop_down"
                size="standard"
            />
        </div>
    );
}

PopoverMenuAnchor3.propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    onClick: PropTypes.func
};

export default PopoverMenuAnchor3;


text:
import org.antlr.v4.runtime.ParserRuleContext;
import org.testng.Assert;
import org.testng.annotations.Test;

public class TestMixins extends TestBase
{
  @Test
   public void testMixin()
  {
    String [] lines = {
        "@mixin something-awesome {}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "something-awesome");
  }

  @Test
  public void testMixinProperties()
  {
    String [] lines = {
        "@mixin test {",
        "  display: $hello;",
        "}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "test");
    Assert.assertEquals(context.block().property(0).identifier().getText(), "display");
    Assert.assertEquals(context.block().property(0).values().commandStatement(0).expression(0)
                            .variableName().Identifier().getText(), "hello");
  }

  @Test
  public void testMixinNesting()
  {
    String [] lines = {
        "@mixin test {",
        "  @mixin hello {}",
        "}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "test");

    ScssParser.MixinDeclarationContext innerContext = context.block().statement(0).mixinDeclaration();
    Assert.assertEquals(innerContext.Identifier().getText(), "hello");
  }

  @Test
  public void testMixinParams()
  {
    String [] lines = {
        "@mixin test ($val1, $val2) {}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "test");
    Assert.assertEquals(context.params().param(0).variableName().getText(), "$val1");
    Assert.assertEquals(context.params().param(1).variableName().getText(), "$val2");

  }

  @Test
  public void testMixinParamWithValues()
  {
    String [] lines = {
        "@mixin test ($val1 : 3px, $val2) {}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "test");
    Assert.assertEquals(context.params().param(0).variableName().getText(), "$val1");
    Assert.assertEquals(context.params().param(0).paramOptionalValue().expression(0)
                            .measurement().Number().getText(), "3");
    Assert.assertEquals(context.params().param(0).paramOptionalValue().expression(0)
                            .measurement().Unit().getText(), "px");

    Assert.assertEquals(context.params().param(1).variableName().getText(), "$val2");

  }

  @Test
  public void testMixinParamWithElipses()
  {
    String [] lines = {
        "@mixin test ($val1, $val2...) {}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "test");
    Assert.assertEquals(context.params().param(0).variableName().getText(), "$val1");
    Assert.assertEquals(context.params().param(1).variableName().getText(), "$val2");
    Assert.assertEquals(context.params().Ellipsis().getText(), "...");
  }

  @Test
  public void testMixinParamAndBody()
  {
    String [] lines = {
        "@mixin box-shadow ($shadows...) {",
        "  -moz-box-shadow: $shadows;",
        "  -webkit-box-shadow: $shadows;",
        "  box-shadow: $shadows;",
        "}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "box-shadow");
    Assert.assertEquals(context.params().param(0).variableName().getText(), "$shadows");
    Assert.assertNotNull(context.params().Ellipsis());

    Assert.assertEquals(context.block().property(0).identifier().getText(), "-moz-box-shadow");
    Assert.assertEquals(context.block().property(0).values().commandStatement(0)
                            .expression(0).variableName().Identifier().getText(), "shadows");

    Assert.assertEquals(context.block().property(1).identifier().getText(), "-webkit-box-shadow");
    Assert.assertEquals(context.block().property(1).values().commandStatement(0)
                            .expression(0).variableName().Identifier().getText(), "shadows");

    Assert.assertEquals(context.block().property(2).identifier().getText(), "box-shadow");
    Assert.assertEquals(context.block().property(2).values().commandStatement(0)
                            .expression(0).variableName().Identifier().getText(), "shadows");

  }

  @Test
  public void testMixinPropertyAndRule()
  {
    String [] lines = {
        "@mixin clearfix {",
        "  display: inline-block;",
        "  &:after {",
        "    content: \".\";",
        "    display: block;",
        "    height: 0;",
        "    clear: both;",
        "    visibility: hidden;",
        "  }",
        "  * html & { height: 1px }",
        "}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "clearfix");

    Assert.assertEquals(context.block().property(0).identifier().getText(), "display");
    Assert.assertEquals(context.block().property(0).values().commandStatement(0)
                            .expression(0).identifier().getText(), "inline-block");

    Assert.assertEquals(context.block().statement(0).ruleset().selectors()
                            .selector(0).element(0).getText(), "&");
    Assert.assertEquals(context.block().statement(0).ruleset().selectors()
                            .selector(0).pseudo().Identifier().getText(), "after");

    Assert.assertEquals(context.block().statement(1).ruleset().selectors()
                            .selector(0).element(0).getText(), "*");
    Assert.assertEquals(context.block().statement(1).ruleset().selectors()
                            .selector(0).element(1).identifier().getText(), "html");
    Assert.assertEquals(context.block().statement(1).ruleset().selectors()
                            .selector(0).element(2).getText(), "&");

    Assert.assertEquals(context.block().statement(1).ruleset().block().property(0).identifier().getText(), "height");
    Assert.assertEquals(context.block().statement(1).ruleset().block().property(0).values()
                            .commandStatement(0).expression(0).measurement().getText(), "1px");

  }

  @Test
  public void testMixinBlockInterpolation()
  {
    String [] lines = {
        "@mixin test () {",
        "  #{$attr}-color: blue;"
        ,"}"
    };
    ScssParser.MixinDeclarationContext context = parseImport(lines);
    Assert.assertEquals(context.Identifier().getText(), "test");
    Assert.assertEquals(context.block().property(0).identifier().identifierVariableName().getText(), "$attr");
    Assert.assertEquals(context.block().property(0).identifier().identifierPart(0).IdentifierAfter().getText(), "-color");
  }

  @Test
  public void testNoErrors()
  {
    String lines = "@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: false) {\n" +
        "  @if $asset-pipeline {\n" +
        "    background-image: image-url(\"#{$filename}.#{$extension}\");\n" +
        "  }\n" +
        "  @else {\n" +
        "    background-image:       url(\"#{$filename}.#{$extension}\");\n" +
        "  }\n" +
        "\n" +
        "  @include hidpi {\n" +
        "    @if $asset-pipeline {\n" +
        "      @if $retina-filename {\n" +
        "        background-image: image-url(\"#{$retina-filename}.#{$extension}\");\n" +
        "      }\n" +
        "      @else {\n" +
        "        background-image: image-url(\"#{$filename}#{$retina-suffix}.#{$extension}\");\n" +
        "      }\n" +
        "    }\n" +
        "\n" +
        "    @else {\n" +
        "      @if $retina-filename {\n" +
        "        background-image: url(\"#{$retina-filename}.#{$extension}\");\n" +
        "      }\n" +
        "      @else {\n" +
        "        background-image: url(\"#{$filename}#{$retina-suffix}.#{$extension}\");\n" +
        "      }\n" +
        "    }\n" +
        "\n" +
        "    background-size: $background-size;\n" +
        "\n" +
        "  }\n" +
        "}";

    ScssParser.StylesheetContext context = parse(lines);
    for (ParserRuleContext child : context.getRuleContexts(ParserRuleContext.class))
    {

    }

  }

  private void assertNoErrors(ParserRuleContext context)
  {

  }

  private ScssParser.MixinDeclarationContext parseImport(String ... lines)
  {
    ScssParser.StylesheetContext context = parse(lines);
    return context.statement(0).mixinDeclaration();
  }
}


text:
package ch.hearc.pokerface.gui;

import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import ch.hearc.pokerface.gui.gamescreen.table.board.JPanelGameBoard;
import ch.hearc.pokerface.gui.menuscreens.JOPTableConfiguration;
import ch.hearc.pokerface.gui.menuscreens.JPanelMainMenu;
import ch.hearc.pokerface.gui.menuscreens.JPanelProfile;
import ch.hearc.pokerface.gui.options.JPanelTopBar;
import ch.hearc.pokerface.gui.tools.ImageShop;

public class JFrameMain extends JFrame
{
	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	private JPanelProfile	panelProfile;
	private JPanelMainMenu	panelMainMenu;
	private JPanelGameBoard	panelGameBoard;
	private CardLayout		layout;

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/

	/**
	 * The game's main frame. Contains the CardLayout in which all panels are displayed.
	 */
	public JFrameMain()
	{
		JPanelTopBar.getInstance().setFrameMain(this);

		geometry();
		control();
		appearance();
	}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	// CARD MANIPULATIONS
	public void setCard(String card)
	{
		if (card == "panelGameBoard")
		{
			JOPTableConfiguration tableConfig = new JOPTableConfiguration(this, panelGameBoard);
			if (!tableConfig.switchToGame()) { return; // Abort the process of switching to gameBoard
			}
			// Game is launching

			panelGameBoard.refreshAllComponents();
			setFullscreen(true);
		}
		else if (card == "panelProfile")
		{
			panelProfile.refreshProfilesData();
		}

		else if (card == "panelMainMenu")
		{
			panelMainMenu.refreshPlayButtonStatus();
		}
		layout.show(this.getContentPane(), card);
	}

	/**
	 * Transitions the game from the board to the main menu. Unsets fullscreen and tries to stop the game engine.
	 */
	public void gameToMainMenu()
	{
		setFullscreen(false);
		setSize(1200, (int)(1200 * 0.75));
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation((int)((dim.getWidth() - getWidth()) / 2), (int)((dim.getHeight() - getHeight()) / 2));

		panelMainMenu.refreshTopBar();
		setCard("panelMainMenu");
		panelGameBoard.stop();
	}

	/**
	 * Kills the game's process but asks for confirmation first.
	 */
	public void closeApp()
	{
		panelProfile.serializeProfiles();
		if (JOptionPane.showConfirmDialog(null, "Confirm quit?") != 0) { return; }
		System.exit(0);
	}

	/*------------------------------*\
	|*				Set				*|
	\*------------------------------*/

	/*------------------------------*\
	|*				Get				*|
	\*------------------------------*/

	public JPanelProfile getProfilePanel()
	{
		return panelProfile;
	}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private void setFullscreen(boolean isFullscreened)
	{
		setVisible(false);
		dispose();
		if (isFullscreened)
		{
			setExtendedState(MAXIMIZED_BOTH);
		}
		else
		{
			setExtendedState(NORMAL);
			setSize(1200, (int)(1200 * 0.75));
		}
		/*setUndecorated(!isUndecorated());
		if (isFullscreened)
		{
			GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);
		}
		else
		{
			GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null);
		}*/
		setVisible(true);
	}

	private void geometry()
	{

		/**
		 * Layout
		 */
		layout = new CardLayout();
		setLayout(layout);

		/**
		 * Instanciations
		 */
		try
		{
			panelProfile = new JPanelProfile(this);
			panelMainMenu = new JPanelMainMenu(this);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		panelGameBoard = new JPanelGameBoard();

		/**
		 * Adds
		 */

		add(panelProfile, "panelProfile");
		add(panelGameBoard, "panelGameBoard");
		add(panelMainMenu, "panelMainMenu");
	}

	private void control()
	{
		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

		addWindowListener(new WindowAdapter()
		{
			@Override
			public void windowClosing(WindowEvent arg0)
			{
				closeApp();
			}
		});
	}

	private void appearance()
	{
		setSize(1200, (int)(1200 * 0.75));
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation((int)((dim.getWidth() - getWidth()) / 2), (int)((dim.getHeight() - getHeight()) / 2));

		setTitle("\u2666 \u2665 \u2660 \u2663 Pokerface \u2663 \u2660 \u2665 \u2666");

		setResizable(false);

		layout.show(this.getContentPane(), "panelProfile");

		//setUndecorated(true);
		this.setVisible(true);
		validate();

		setIconImage(ImageShop.IMAGE_APPICON);
	}
}


text:
import EmberObject from "@ember/object";
import Evented from "@ember/object/evented";
import RouterDSL from "@ember/routing/-private/router-dsl";
import Transition from "@ember/routing/-private/transition";
import RouterService from "@ember/routing/router-service";

/**
 * The `Ember.Router` class manages the application state and URLs. Refer to
 * the [routing guide](http://emberjs.com/guides/routing/) for documentation.
 */
export default class Router extends EmberObject.extend(Evented) {
    /**
     * The `Router.map` function allows you to define mappings from URLs to routes
     * in your application. These mappings are defined within the
     * supplied callback function using `this.route`.
     */
    static map(callback: (this: RouterDSL) => void): void;
    /**
     * The `location` property determines the type of URL's that your
     * application will use.
     */
    location: string;
    /**
     * Represents the URL of the root of the application, often '/'. This prefix is
     * assumed on all routes defined on this router.
     */
    rootURL: string;
    /**
     * Handles updating the paths and notifying any listeners of the URL
     * change.
     */
    didTransition(): any;
    /**
     * Handles notifying any listeners of an impending URL
     * change.
     */
    willTransition(): any;
    /**
     * Transition the application into another route. The route may
     * be either a single route or route path:
     */
    transitionTo(name: string, options?: {}): Transition;
    transitionTo(name: string, ...models: any[]): Transition;
    transitionTo(name: string, options: {}): Transition;
}

declare module '@ember/service' {
    interface Registry {
        'router': RouterService;
    }
}


text:
.class Lcom/android/server/am/ActivityManagerService$DbBinder;
.super Landroid/os/Binder;
.source "ActivityManagerService.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/am/ActivityManagerService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "DbBinder"
.end annotation

# instance fields
.field mActivityManagerService:Lcom/android/server/am/ActivityManagerService;

# direct methods
.method constructor <init>(Lcom/android/server/am/ActivityManagerService;)V
    .locals 0

    invoke-direct {p0}, Landroid/os/Binder;-><init>()V

    iput-object p1, p0, Lcom/android/server/am/ActivityManagerService$DbBinder;->mActivityManagerService:Lcom/android/server/am/ActivityManagerService;

    return-void
.end method

# virtual methods
.method protected dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V
    .locals 2

    iget-object v0, p0, Lcom/android/server/am/ActivityManagerService$DbBinder;->mActivityManagerService:Lcom/android/server/am/ActivityManagerService;

    iget-object v0, v0, Lcom/android/server/am/ActivityManagerService;->mContext:Landroid/content/Context;

    const-string/jumbo v1, "dbinfo"

    invoke-static {v0, v1, p2}, Lcom/android/internal/util/DumpUtils;->checkDumpAndUsageStatsPermission(Landroid/content/Context;Ljava/lang/String;Ljava/io/PrintWriter;)Z

    move-result v0

    if-nez v0, :cond_0

    return-void

    :cond_0
    iget-object v0, p0, Lcom/android/server/am/ActivityManagerService$DbBinder;->mActivityManagerService:Lcom/android/server/am/ActivityManagerService;

    invoke-virtual {v0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->dumpDbInfo(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V

    return-void
.end method


text:
//
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802
// Vedere http://java.sun.com/xml/jaxb
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
// Generato il: 2015.05.07 alle 12:32:49 PM CEST
//

package eu.fbk.dkm.premon.premonitor.propbank;

import javax.xml.bind.annotation.XmlRegistry;

/**
 * This object contains factory methods for each
 * Java content interface and Java element interface
 * generated in the eu.fbk.dkm.pikes.resources.ontonotes.frames package.
 *
An ObjectFactory allows you to programatically
 * construct new instances of the Java representation
 * for XML content. The Java representation of XML
 * content can consist of schema derived interfaces
 * and classes representing the binding of schema
 * type definitions, element declarations and model
 * groups.  Factory methods for each of these are
 * provided in this class.
 */
@XmlRegistry public class ObjectFactory {

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: eu.fbk.dkm.pikes.resources.ontonotes.frames
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link Note }
     */
    public Note createNote() {
        return new Note();
    }

    /**
     * Create an instance of {@link Predicate }
     */
    public Predicate createPredicate() {
        return new Predicate();
    }

    /**
     * Create an instance of {@link Roleset }
     */
    public Roleset createRoleset() {
        return new Roleset();
    }

    /**
     * Create an instance of {@link Vnrole }
     */
    public Vnrole createVnrole() {
        return new Vnrole();
    }

    /**
     * Create an instance of {@link Role }
     */
    public Role createRole() {
        return new Role();
    }

    /**
     * Create an instance of {@link Frameset }
     */
    public Frameset createFrameset() {
        return new Frameset();
    }

    /**
     * Create an instance of {@link Roles }
     */
    public Roles createRoles() {
        return new Roles();
    }

    /**
     * Create an instance of {@link Arg }
     */
    public Arg createArg() {
        return new Arg();
    }

    /**
     * Create an instance of {@link Rel }
     */
    public Rel createRel() {
        return new Rel();
    }

    /**
     * Create an instance of {@link Text }
     */
    public Text createText() {
        return new Text();
    }

    /**
     * Create an instance of {@link Example }
     */
    public Example createExample() {
        return new Example();
    }

    /**
     * Create an instance of {@link Inflection }
     */
    public Inflection createInflection() {
        return new Inflection();
    }

}


text:
using System;
using System.Collections.Generic;
using Gallio.Common.Collections;

namespace Gallio.Framework.Data
{
    /// <summary>
    /// A data item is an opaque representation of a collection of values
    /// and metadata that may be retrieved using data bindings that encode
    /// the appropriate lookup rules into the item.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Data items may have very different forms:
    /// <list type="bullet">
    /// <item>Scalar-like items: Items that always yield a single value, possibly a constant</item>
    /// <item>Row-like items: Items that yield several values in response to index-based
    /// data bindings or named column paths</item>
    /// <item>Structured items: Items that yield values by binding to paths within the item
    /// or by resolving custom data binding expressions</item>
    /// </list>
    /// </para>
    /// </remarks>
    /// <seealso cref="IDataAccessor"/>
    public interface IDataItem
    {
        /// <summary>
        /// Returns true if the item contains data that is obtained dynamically from sources
        /// whose content may change over time or may be expensive to query ahead of time.
        /// </summary>
        /// <remarks>
        /// <para>
        /// For example, data obtained from a database should be considered dynamic.
        /// On the other hand, data obtained from declarative metadata defined as part
        /// of the test should be considered static.
        /// </para>
        /// </remarks>
        bool IsDynamic { get; }

        /// <summary>
        /// Populates the specified metadata map with key/value pairs associated with
        /// the data item, if any.
        /// </summary>
        /// <remarks>
        /// <para>
        /// For example, the metadata may contain a description that serves
        /// as documentation of the contents of the data item or of the test
        /// scenario that is exercised by the contents of the data item.
        /// This metadata may be injected into test instances created with
        /// the contents of this data item.
        /// </para>
        /// </remarks>
        /// <param name="map">The metadata map.</param>
        void PopulateMetadata(PropertyBag map);

        /// <summary>
        /// Gets the value of the specified binding.
        /// </summary>
        /// <param name="binding">The data binding, never null.</param>
        /// <returns>The value.</returns>
        /// <exception cref="DataBindingException">Thrown if the <paramref name="binding"/>
        /// cannot be resolved or if its value cannot be obtained.</exception>
        object GetValue(DataBinding binding);

        /// <summary>
        /// Gets an enumeration of the data bindings that may be queried to informally describe
        /// its contents.  The enumeration of bindings may not be complete.
        /// </summary>
        /// <returns>The enumeration of bindings.</returns>
        IEnumerable<DataBinding> GetBindingsForInformalDescription();
    }
}


text:
/*
 * IRC.h
 *
 *  Created on: 09.06.2010
 *      Author: fkrauthan
 */

#ifndef IRC_H_
#define IRC_H_

#include <string>
#include <map>
#include <vector>
#include <boost/thread.hpp>
#include <sigc++/sigc++.h>

#include "IRCMessage.h"
#include "IRCChannel.h"
#include "IRCExceptions.h"

class IRCConnection;

class IRC {
	public:
		IRC();
		~IRC();

		IRCConnection* connect(const std::string& id, const std::string& server, const std::string& nick, unsigned int port = 6667, bool foreceIPv6=false);
		void disconect(const std::string& id);
		void disconect(IRCConnection* connection);
		void disconectAll();

		void setClientName(const std::string& name);
		const std::string& getClientName();
		void setClientVersion(const std::string& version);
		const std::string& getClientVersion();
		void setClientOS(const std::string& os);
		const std::string& getClientOS();

		IRCConnection* getConnection(const std::string& id);
		std::map<std::string, IRCConnection*>& getConnections();

		void run();

	public:
		//Signals IRC
		sigc::signal<void, IRC&, IRCConnection&> onServerConnect;
		sigc::signal<void, IRC&, IRCConnection&> onServerDisconnect;

	public:
		//Signals IRCConnection
		sigc::signal<void, IRC&, IRCConnection&> onConnect;

		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&, const std::string&> onCTCPRequest;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&, const std::string&> onCTCPAnswer;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&, const std::string&> onCTCPAction;

		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onPart;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onKick;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onJoin;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onQuit;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onKill;

		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onMessage;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onPrivateMessage;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onChannelMessage;

		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onTopicChanged;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onNickChanged;

		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onInvite;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&> onNotice;

		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&, const std::string&, IRCUserModeEnum::Enumeration> onUserObtainMode;
		sigc::signal<void, IRC&, IRCConnection&, IRCMessage&, const std::string&, IRCUserModeEnum::Enumeration> onUserLoseMode;

	private:
		void disconnectIntern(IRCConnection* connection);

	private:
		std::string mClientName;
		std::string mClientVersion;
		std::string mClientOS;

		std::map<std::string, IRCConnection*> mConnections;
		std::map<std::string, boost::thread*> mConnectionThreads;

		std::vector<IRCConnection*> mConnectionDelList;

		boost::mutex mMutex;
		boost::mutex mMutexDelList;

		boost::condition_variable mCV;
};

#endif /* IRC_H_ */