code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
/** ****************************************************************************** * @file stm32f7xx_hal_uart.c * @author MCD Application Team * @brief UART HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Universal Asynchronous Receiver Transmitter Peripheral (UART). * + Initialization and de-initialization functions * + IO operation functions * + Peripheral Control functions * * @verbatim =============================================================================== ##### How to use this driver ##### =============================================================================== [..] The UART HAL driver can be used as follows: (#) Declare a UART_HandleTypeDef handle structure (eg. UART_HandleTypeDef huart). (#) Initialize the UART low level resources by implementing the HAL_UART_MspInit() API: (++) Enable the USARTx interface clock. (++) UART pins configuration: (+++) Enable the clock for the UART GPIOs. (+++) Configure these UART pins as alternate function pull-up. (++) NVIC configuration if you need to use interrupt process (HAL_UART_Transmit_IT() and HAL_UART_Receive_IT() APIs): (+++) Configure the USARTx interrupt priority. (+++) Enable the NVIC USART IRQ handle. (++) UART interrupts handling: -@@- The specific UART interrupts (Transmission complete interrupt, RXNE interrupt, RX/TX FIFOs related interrupts and Error Interrupts) are managed using the macros __HAL_UART_ENABLE_IT() and __HAL_UART_DISABLE_IT() inside the transmit and receive processes. (++) DMA Configuration if you need to use DMA process (HAL_UART_Transmit_DMA() and HAL_UART_Receive_DMA() APIs): (+++) Declare a DMA handle structure for the Tx/Rx channel. (+++) Enable the DMAx interface clock. (+++) Configure the declared DMA handle structure with the required Tx/Rx parameters. (+++) Configure the DMA Tx/Rx channel. (+++) Associate the initialized DMA handle to the UART DMA Tx/Rx handle. (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA Tx/Rx channel. (#) Program the Baud Rate, Word Length, Stop Bit, Parity, Hardware flow control and Mode (Receiver/Transmitter) in the huart handle Init structure. (#) If required, program UART advanced features (TX/RX pins swap, auto Baud rate detection,...) in the huart handle AdvancedInit structure. (#) For the UART asynchronous mode, initialize the UART registers by calling the HAL_UART_Init() API. (#) For the UART Half duplex mode, initialize the UART registers by calling the HAL_HalfDuplex_Init() API. (#) For the UART LIN (Local Interconnection Network) mode, initialize the UART registers by calling the HAL_LIN_Init() API. (#) For the UART Multiprocessor mode, initialize the UART registers by calling the HAL_MultiProcessor_Init() API. (#) For the UART RS485 Driver Enabled mode, initialize the UART registers by calling the HAL_RS485Ex_Init() API. [..] (@) These API's (HAL_UART_Init(), HAL_HalfDuplex_Init(), HAL_LIN_Init(), HAL_MultiProcessor_Init(), also configure the low level Hardware GPIO, CLOCK, CORTEX...etc) by calling the customized HAL_UART_MspInit() API. ##### Callback registration ##### ================================== [..] The compilation define USE_HAL_UART_REGISTER_CALLBACKS when set to 1 allows the user to configure dynamically the driver callbacks. [..] Use Function @ref HAL_UART_RegisterCallback() to register a user callback. Function @ref HAL_UART_RegisterCallback() allows to register following callbacks: (+) TxHalfCpltCallback : Tx Half Complete Callback. (+) TxCpltCallback : Tx Complete Callback. (+) RxHalfCpltCallback : Rx Half Complete Callback. (+) RxCpltCallback : Rx Complete Callback. (+) ErrorCallback : Error Callback. (+) AbortCpltCallback : Abort Complete Callback. (+) AbortTransmitCpltCallback : Abort Transmit Complete Callback. (+) AbortReceiveCpltCallback : Abort Receive Complete Callback. (+) WakeupCallback : Wakeup Callback. (+) RxFifoFullCallback : Rx Fifo Full Callback. (+) TxFifoEmptyCallback : Tx Fifo Empty Callback. (+) MspInitCallback : UART MspInit. (+) MspDeInitCallback : UART MspDeInit. This function takes as parameters the HAL peripheral handle, the Callback ID and a pointer to the user callback function. [..] Use function @ref HAL_UART_UnRegisterCallback() to reset a callback to the default weak (surcharged) function. @ref HAL_UART_UnRegisterCallback() takes as parameters the HAL peripheral handle, and the Callback ID. This function allows to reset following callbacks: (+) TxHalfCpltCallback : Tx Half Complete Callback. (+) TxCpltCallback : Tx Complete Callback. (+) RxHalfCpltCallback : Rx Half Complete Callback. (+) RxCpltCallback : Rx Complete Callback. (+) ErrorCallback : Error Callback. (+) AbortCpltCallback : Abort Complete Callback. (+) AbortTransmitCpltCallback : Abort Transmit Complete Callback. (+) AbortReceiveCpltCallback : Abort Receive Complete Callback. (+) WakeupCallback : Wakeup Callback. (+) RxFifoFullCallback : Rx Fifo Full Callback. (+) TxFifoEmptyCallback : Tx Fifo Empty Callback. (+) MspInitCallback : UART MspInit. (+) MspDeInitCallback : UART MspDeInit. [..] By default, after the @ref HAL_UART_Init() and when the state is HAL_UART_STATE_RESET all callbacks are set to the corresponding weak (surcharged) functions: examples @ref HAL_UART_TxCpltCallback(), @ref HAL_UART_RxHalfCpltCallback(). Exception done for MspInit and MspDeInit functions that are respectively reset to the legacy weak (surcharged) functions in the @ref HAL_UART_Init() and @ref HAL_UART_DeInit() only when these callbacks are null (not registered beforehand). If not, MspInit or MspDeInit are not null, the @ref HAL_UART_Init() and @ref HAL_UART_DeInit() keep and use the user MspInit/MspDeInit callbacks (registered beforehand). [..] Callbacks can be registered/unregistered in HAL_UART_STATE_READY state only. Exception done MspInit/MspDeInit that can be registered/unregistered in HAL_UART_STATE_READY or HAL_UART_STATE_RESET state, thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit. In that case first register the MspInit/MspDeInit user callbacks using @ref HAL_UART_RegisterCallback() before calling @ref HAL_UART_DeInit() or @ref HAL_UART_Init() function. [..] When The compilation define USE_HAL_UART_REGISTER_CALLBACKS is set to 0 or not defined, the callback registration feature is not available and weak (surcharged) callbacks are used. @endverbatim ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f7xx_hal.h" /** @addtogroup STM32F7xx_HAL_Driver * @{ */ /** @defgroup UART UART * @brief HAL UART module driver * @{ */ #ifdef HAL_UART_MODULE_ENABLED /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /** @defgroup UART_Private_Constants UART Private Constants * @{ */ #define USART_CR1_FIELDS ((uint32_t)(USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | \ USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8 )) /*!< UART or USART CR1 fields of parameters set by UART_SetConfig API */ #define USART_CR3_FIELDS ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE | USART_CR3_ONEBIT)) /*!< UART or USART CR3 fields of parameters set by UART_SetConfig API */ #define UART_BRR_MIN 0x10U /* UART BRR minimum authorized value */ #define UART_BRR_MAX 0x0000FFFFU /* UART BRR maximum authorized value */ /** * @} */ /* Private macros ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /** @addtogroup UART_Private_Functions * @{ */ static void UART_EndTxTransfer(UART_HandleTypeDef *huart); static void UART_EndRxTransfer(UART_HandleTypeDef *huart); static void UART_DMATransmitCplt(DMA_HandleTypeDef *hdma); static void UART_DMAReceiveCplt(DMA_HandleTypeDef *hdma); static void UART_DMARxHalfCplt(DMA_HandleTypeDef *hdma); static void UART_DMATxHalfCplt(DMA_HandleTypeDef *hdma); static void UART_DMAError(DMA_HandleTypeDef *hdma); static void UART_DMAAbortOnError(DMA_HandleTypeDef *hdma); static void UART_DMATxAbortCallback(DMA_HandleTypeDef *hdma); static void UART_DMARxAbortCallback(DMA_HandleTypeDef *hdma); static void UART_DMATxOnlyAbortCallback(DMA_HandleTypeDef *hdma); static void UART_DMARxOnlyAbortCallback(DMA_HandleTypeDef *hdma); static void UART_TxISR_8BIT(UART_HandleTypeDef *huart); static void UART_TxISR_16BIT(UART_HandleTypeDef *huart); static void UART_EndTransmit_IT(UART_HandleTypeDef *huart); static void UART_RxISR_8BIT(UART_HandleTypeDef *huart); static void UART_RxISR_16BIT(UART_HandleTypeDef *huart); /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @defgroup UART_Exported_Functions UART Exported Functions * @{ */ /** @defgroup UART_Exported_Functions_Group1 Initialization and de-initialization functions * @brief Initialization and Configuration functions * @verbatim =============================================================================== ##### Initialization and Configuration functions ##### =============================================================================== [..] This subsection provides a set of functions allowing to initialize the USARTx or the UARTy in asynchronous mode. (+) For the asynchronous mode the parameters below can be configured: (++) Baud Rate (++) Word Length (++) Stop Bit (++) Parity: If the parity is enabled, then the MSB bit of the data written in the data register is transmitted but is changed by the parity bit. (++) Hardware flow control (++) Receiver/transmitter modes (++) Over Sampling Method (++) One-Bit Sampling Method (+) For the asynchronous mode, the following advanced features can be configured as well: (++) TX and/or RX pin level inversion (++) data logical level inversion (++) RX and TX pins swap (++) RX overrun detection disabling (++) DMA disabling on RX error (++) MSB first on communication line (++) auto Baud rate detection [..] The HAL_UART_Init(), HAL_HalfDuplex_Init(), HAL_LIN_Init()and HAL_MultiProcessor_Init()API follow respectively the UART asynchronous, UART Half duplex, UART LIN mode and UART multiprocessor mode configuration procedures (details for the procedures are available in reference manual). @endverbatim Depending on the frame length defined by the M1 and M0 bits (7-bit, 8-bit or 9-bit), the possible UART formats are listed in the following table. Table 1. UART frame format. +-----------------------------------------------------------------------+ | M1 bit | M0 bit | PCE bit | UART frame | |---------|---------|-----------|---------------------------------------| | 0 | 0 | 0 | | SB | 8 bit data | STB | | |---------|---------|-----------|---------------------------------------| | 0 | 0 | 1 | | SB | 7 bit data | PB | STB | | |---------|---------|-----------|---------------------------------------| | 0 | 1 | 0 | | SB | 9 bit data | STB | | |---------|---------|-----------|---------------------------------------| | 0 | 1 | 1 | | SB | 8 bit data | PB | STB | | |---------|---------|-----------|---------------------------------------| | 1 | 0 | 0 | | SB | 7 bit data | STB | | |---------|---------|-----------|---------------------------------------| | 1 | 0 | 1 | | SB | 6 bit data | PB | STB | | +-----------------------------------------------------------------------+ * @{ */ /** * @brief Initialize the UART mode according to the specified * parameters in the UART_InitTypeDef and initialize the associated handle. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart) { /* Check the UART handle allocation */ if (huart == NULL) { return HAL_ERROR; } if (huart->Init.HwFlowCtl != UART_HWCONTROL_NONE) { /* Check the parameters */ assert_param(IS_UART_HWFLOW_INSTANCE(huart->Instance)); } else { /* Check the parameters */ assert_param(IS_UART_INSTANCE(huart->Instance)); } if (huart->gState == HAL_UART_STATE_RESET) { /* Allocate lock resource and initialize it */ huart->Lock = HAL_UNLOCKED; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) UART_InitCallbacksToDefault(huart); if (huart->MspInitCallback == NULL) { huart->MspInitCallback = HAL_UART_MspInit; } /* Init the low level hardware */ huart->MspInitCallback(huart); #else /* Init the low level hardware : GPIO, CLOCK */ HAL_UART_MspInit(huart); #endif /* (USE_HAL_UART_REGISTER_CALLBACKS) */ } huart->gState = HAL_UART_STATE_BUSY; __HAL_UART_DISABLE(huart); /* Set the UART Communication parameters */ if (UART_SetConfig(huart) == HAL_ERROR) { return HAL_ERROR; } if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) { UART_AdvFeatureConfig(huart); } /* In asynchronous mode, the following bits must be kept cleared: - LINEN and CLKEN bits in the USART_CR2 register, - SCEN, HDSEL and IREN bits in the USART_CR3 register.*/ CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); CLEAR_BIT(huart->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); __HAL_UART_ENABLE(huart); /* TEACK and/or REACK to check before moving huart->gState and huart->RxState to Ready */ return (UART_CheckIdleState(huart)); } /** * @brief Initialize the half-duplex mode according to the specified * parameters in the UART_InitTypeDef and creates the associated handle. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart) { /* Check the UART handle allocation */ if (huart == NULL) { return HAL_ERROR; } /* Check UART instance */ assert_param(IS_UART_HALFDUPLEX_INSTANCE(huart->Instance)); if (huart->gState == HAL_UART_STATE_RESET) { /* Allocate lock resource and initialize it */ huart->Lock = HAL_UNLOCKED; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) UART_InitCallbacksToDefault(huart); if (huart->MspInitCallback == NULL) { huart->MspInitCallback = HAL_UART_MspInit; } /* Init the low level hardware */ huart->MspInitCallback(huart); #else /* Init the low level hardware : GPIO, CLOCK */ HAL_UART_MspInit(huart); #endif /* (USE_HAL_UART_REGISTER_CALLBACKS) */ } huart->gState = HAL_UART_STATE_BUSY; __HAL_UART_DISABLE(huart); /* Set the UART Communication parameters */ if (UART_SetConfig(huart) == HAL_ERROR) { return HAL_ERROR; } if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) { UART_AdvFeatureConfig(huart); } /* In half-duplex mode, the following bits must be kept cleared: - LINEN and CLKEN bits in the USART_CR2 register, - SCEN and IREN bits in the USART_CR3 register.*/ CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); CLEAR_BIT(huart->Instance->CR3, (USART_CR3_IREN | USART_CR3_SCEN)); /* Enable the Half-Duplex mode by setting the HDSEL bit in the CR3 register */ SET_BIT(huart->Instance->CR3, USART_CR3_HDSEL); __HAL_UART_ENABLE(huart); /* TEACK and/or REACK to check before moving huart->gState and huart->RxState to Ready */ return (UART_CheckIdleState(huart)); } /** * @brief Initialize the LIN mode according to the specified * parameters in the UART_InitTypeDef and creates the associated handle. * @param huart UART handle. * @param BreakDetectLength Specifies the LIN break detection length. * This parameter can be one of the following values: * @arg @ref UART_LINBREAKDETECTLENGTH_10B 10-bit break detection * @arg @ref UART_LINBREAKDETECTLENGTH_11B 11-bit break detection * @retval HAL status */ HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength) { /* Check the UART handle allocation */ if (huart == NULL) { return HAL_ERROR; } /* Check the LIN UART instance */ assert_param(IS_UART_LIN_INSTANCE(huart->Instance)); /* Check the Break detection length parameter */ assert_param(IS_UART_LIN_BREAK_DETECT_LENGTH(BreakDetectLength)); /* LIN mode limited to 16-bit oversampling only */ if (huart->Init.OverSampling == UART_OVERSAMPLING_8) { return HAL_ERROR; } /* LIN mode limited to 8-bit data length */ if (huart->Init.WordLength != UART_WORDLENGTH_8B) { return HAL_ERROR; } if (huart->gState == HAL_UART_STATE_RESET) { /* Allocate lock resource and initialize it */ huart->Lock = HAL_UNLOCKED; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) UART_InitCallbacksToDefault(huart); if (huart->MspInitCallback == NULL) { huart->MspInitCallback = HAL_UART_MspInit; } /* Init the low level hardware */ huart->MspInitCallback(huart); #else /* Init the low level hardware : GPIO, CLOCK */ HAL_UART_MspInit(huart); #endif /* (USE_HAL_UART_REGISTER_CALLBACKS) */ } huart->gState = HAL_UART_STATE_BUSY; __HAL_UART_DISABLE(huart); /* Set the UART Communication parameters */ if (UART_SetConfig(huart) == HAL_ERROR) { return HAL_ERROR; } if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) { UART_AdvFeatureConfig(huart); } /* In LIN mode, the following bits must be kept cleared: - LINEN and CLKEN bits in the USART_CR2 register, - SCEN and IREN bits in the USART_CR3 register.*/ CLEAR_BIT(huart->Instance->CR2, USART_CR2_CLKEN); CLEAR_BIT(huart->Instance->CR3, (USART_CR3_HDSEL | USART_CR3_IREN | USART_CR3_SCEN)); /* Enable the LIN mode by setting the LINEN bit in the CR2 register */ SET_BIT(huart->Instance->CR2, USART_CR2_LINEN); /* Set the USART LIN Break detection length. */ MODIFY_REG(huart->Instance->CR2, USART_CR2_LBDL, BreakDetectLength); __HAL_UART_ENABLE(huart); /* TEACK and/or REACK to check before moving huart->gState and huart->RxState to Ready */ return (UART_CheckIdleState(huart)); } /** * @brief Initialize the multiprocessor mode according to the specified * parameters in the UART_InitTypeDef and initialize the associated handle. * @param huart UART handle. * @param Address UART node address (4-, 6-, 7- or 8-bit long). * @param WakeUpMethod Specifies the UART wakeup method. * This parameter can be one of the following values: * @arg @ref UART_WAKEUPMETHOD_IDLELINE WakeUp by an idle line detection * @arg @ref UART_WAKEUPMETHOD_ADDRESSMARK WakeUp by an address mark * @note If the user resorts to idle line detection wake up, the Address parameter * is useless and ignored by the initialization function. * @note If the user resorts to address mark wake up, the address length detection * is configured by default to 4 bits only. For the UART to be able to * manage 6-, 7- or 8-bit long addresses detection, the API * HAL_MultiProcessorEx_AddressLength_Set() must be called after * HAL_MultiProcessor_Init(). * @retval HAL status */ HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod) { /* Check the UART handle allocation */ if (huart == NULL) { return HAL_ERROR; } /* Check the wake up method parameter */ assert_param(IS_UART_WAKEUPMETHOD(WakeUpMethod)); if (huart->gState == HAL_UART_STATE_RESET) { /* Allocate lock resource and initialize it */ huart->Lock = HAL_UNLOCKED; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) UART_InitCallbacksToDefault(huart); if (huart->MspInitCallback == NULL) { huart->MspInitCallback = HAL_UART_MspInit; } /* Init the low level hardware */ huart->MspInitCallback(huart); #else /* Init the low level hardware : GPIO, CLOCK */ HAL_UART_MspInit(huart); #endif /* (USE_HAL_UART_REGISTER_CALLBACKS) */ } huart->gState = HAL_UART_STATE_BUSY; __HAL_UART_DISABLE(huart); /* Set the UART Communication parameters */ if (UART_SetConfig(huart) == HAL_ERROR) { return HAL_ERROR; } if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) { UART_AdvFeatureConfig(huart); } /* In multiprocessor mode, the following bits must be kept cleared: - LINEN and CLKEN bits in the USART_CR2 register, - SCEN, HDSEL and IREN bits in the USART_CR3 register. */ CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); CLEAR_BIT(huart->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); if (WakeUpMethod == UART_WAKEUPMETHOD_ADDRESSMARK) { /* If address mark wake up method is chosen, set the USART address node */ MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)Address << UART_CR2_ADDRESS_LSB_POS)); } /* Set the wake up method by setting the WAKE bit in the CR1 register */ MODIFY_REG(huart->Instance->CR1, USART_CR1_WAKE, WakeUpMethod); __HAL_UART_ENABLE(huart); /* TEACK and/or REACK to check before moving huart->gState and huart->RxState to Ready */ return (UART_CheckIdleState(huart)); } /** * @brief DeInitialize the UART peripheral. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart) { /* Check the UART handle allocation */ if (huart == NULL) { return HAL_ERROR; } /* Check the parameters */ assert_param(IS_UART_INSTANCE(huart->Instance)); huart->gState = HAL_UART_STATE_BUSY; __HAL_UART_DISABLE(huart); huart->Instance->CR1 = 0x0U; huart->Instance->CR2 = 0x0U; huart->Instance->CR3 = 0x0U; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) if (huart->MspDeInitCallback == NULL) { huart->MspDeInitCallback = HAL_UART_MspDeInit; } /* DeInit the low level hardware */ huart->MspDeInitCallback(huart); #else /* DeInit the low level hardware */ HAL_UART_MspDeInit(huart); #endif /* (USE_HAL_UART_REGISTER_CALLBACKS) */ huart->ErrorCode = HAL_UART_ERROR_NONE; huart->gState = HAL_UART_STATE_RESET; huart->RxState = HAL_UART_STATE_RESET; __HAL_UNLOCK(huart); return HAL_OK; } /** * @brief Initialize the UART MSP. * @param huart UART handle. * @retval None */ __weak void HAL_UART_MspInit(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_MspInit can be implemented in the user file */ } /** * @brief DeInitialize the UART MSP. * @param huart UART handle. * @retval None */ __weak void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_MspDeInit can be implemented in the user file */ } #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /** * @brief Register a User UART Callback * To be used instead of the weak predefined callback * @param huart uart handle * @param CallbackID ID of the callback to be registered * This parameter can be one of the following values: * @arg @ref HAL_UART_TX_HALFCOMPLETE_CB_ID Tx Half Complete Callback ID * @arg @ref HAL_UART_TX_COMPLETE_CB_ID Tx Complete Callback ID * @arg @ref HAL_UART_RX_HALFCOMPLETE_CB_ID Rx Half Complete Callback ID * @arg @ref HAL_UART_RX_COMPLETE_CB_ID Rx Complete Callback ID * @arg @ref HAL_UART_ERROR_CB_ID Error Callback ID * @arg @ref HAL_UART_ABORT_COMPLETE_CB_ID Abort Complete Callback ID * @arg @ref HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID Abort Transmit Complete Callback ID * @arg @ref HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID Abort Receive Complete Callback ID * @arg @ref HAL_UART_WAKEUP_CB_ID Wakeup Callback ID * @arg @ref HAL_UART_RX_FIFO_FULL_CB_ID Rx Fifo Full Callback ID * @arg @ref HAL_UART_TX_FIFO_EMPTY_CB_ID Tx Fifo Empty Callback ID * @arg @ref HAL_UART_MSPINIT_CB_ID MspInit Callback ID * @arg @ref HAL_UART_MSPDEINIT_CB_ID MspDeInit Callback ID * @param pCallback pointer to the Callback function * @retval HAL status */ HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID, pUART_CallbackTypeDef pCallback) { HAL_StatusTypeDef status = HAL_OK; if (pCallback == NULL) { huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; return HAL_ERROR; } __HAL_LOCK(huart); if (huart->gState == HAL_UART_STATE_READY) { switch (CallbackID) { case HAL_UART_TX_HALFCOMPLETE_CB_ID : huart->TxHalfCpltCallback = pCallback; break; case HAL_UART_TX_COMPLETE_CB_ID : huart->TxCpltCallback = pCallback; break; case HAL_UART_RX_HALFCOMPLETE_CB_ID : huart->RxHalfCpltCallback = pCallback; break; case HAL_UART_RX_COMPLETE_CB_ID : huart->RxCpltCallback = pCallback; break; case HAL_UART_ERROR_CB_ID : huart->ErrorCallback = pCallback; break; case HAL_UART_ABORT_COMPLETE_CB_ID : huart->AbortCpltCallback = pCallback; break; case HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID : huart->AbortTransmitCpltCallback = pCallback; break; case HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID : huart->AbortReceiveCpltCallback = pCallback; break; case HAL_UART_WAKEUP_CB_ID : huart->WakeupCallback = pCallback; break; case HAL_UART_MSPINIT_CB_ID : huart->MspInitCallback = pCallback; break; case HAL_UART_MSPDEINIT_CB_ID : huart->MspDeInitCallback = pCallback; break; default : huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; status = HAL_ERROR; break; } } else if (huart->gState == HAL_UART_STATE_RESET) { switch (CallbackID) { case HAL_UART_MSPINIT_CB_ID : huart->MspInitCallback = pCallback; break; case HAL_UART_MSPDEINIT_CB_ID : huart->MspDeInitCallback = pCallback; break; default : huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; status = HAL_ERROR; break; } } else { huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; status = HAL_ERROR; } __HAL_UNLOCK(huart); return status; } /** * @brief Unregister an UART Callback * UART callaback is redirected to the weak predefined callback * @param huart uart handle * @param CallbackID ID of the callback to be unregistered * This parameter can be one of the following values: * @arg @ref HAL_UART_TX_HALFCOMPLETE_CB_ID Tx Half Complete Callback ID * @arg @ref HAL_UART_TX_COMPLETE_CB_ID Tx Complete Callback ID * @arg @ref HAL_UART_RX_HALFCOMPLETE_CB_ID Rx Half Complete Callback ID * @arg @ref HAL_UART_RX_COMPLETE_CB_ID Rx Complete Callback ID * @arg @ref HAL_UART_ERROR_CB_ID Error Callback ID * @arg @ref HAL_UART_ABORT_COMPLETE_CB_ID Abort Complete Callback ID * @arg @ref HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID Abort Transmit Complete Callback ID * @arg @ref HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID Abort Receive Complete Callback ID * @arg @ref HAL_UART_WAKEUP_CB_ID Wakeup Callback ID * @arg @ref HAL_UART_RX_FIFO_FULL_CB_ID Rx Fifo Full Callback ID * @arg @ref HAL_UART_TX_FIFO_EMPTY_CB_ID Tx Fifo Empty Callback ID * @arg @ref HAL_UART_MSPINIT_CB_ID MspInit Callback ID * @arg @ref HAL_UART_MSPDEINIT_CB_ID MspDeInit Callback ID * @retval HAL status */ HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID) { HAL_StatusTypeDef status = HAL_OK; __HAL_LOCK(huart); if (HAL_UART_STATE_READY == huart->gState) { switch (CallbackID) { case HAL_UART_TX_HALFCOMPLETE_CB_ID : huart->TxHalfCpltCallback = HAL_UART_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCallback */ break; case HAL_UART_TX_COMPLETE_CB_ID : huart->TxCpltCallback = HAL_UART_TxCpltCallback; /* Legacy weak TxCpltCallback */ break; case HAL_UART_RX_HALFCOMPLETE_CB_ID : huart->RxHalfCpltCallback = HAL_UART_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCallback */ break; case HAL_UART_RX_COMPLETE_CB_ID : huart->RxCpltCallback = HAL_UART_RxCpltCallback; /* Legacy weak RxCpltCallback */ break; case HAL_UART_ERROR_CB_ID : huart->ErrorCallback = HAL_UART_ErrorCallback; /* Legacy weak ErrorCallback */ break; case HAL_UART_ABORT_COMPLETE_CB_ID : huart->AbortCpltCallback = HAL_UART_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ break; case HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID : huart->AbortTransmitCpltCallback = HAL_UART_AbortTransmitCpltCallback; /* Legacy weak AbortTransmitCpltCallback */ break; case HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID : huart->AbortReceiveCpltCallback = HAL_UART_AbortReceiveCpltCallback; /* Legacy weak AbortReceiveCpltCallback */ break; #if defined(USART_CR1_UESM) case HAL_UART_WAKEUP_CB_ID : huart->WakeupCallback = HAL_UARTEx_WakeupCallback; /* Legacy weak WakeupCallback */ break; #endif /* USART_CR1_UESM */ case HAL_UART_MSPINIT_CB_ID : huart->MspInitCallback = HAL_UART_MspInit; /* Legacy weak MspInitCallback */ break; case HAL_UART_MSPDEINIT_CB_ID : huart->MspDeInitCallback = HAL_UART_MspDeInit; /* Legacy weak MspDeInitCallback */ break; default : huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; status = HAL_ERROR; break; } } else if (HAL_UART_STATE_RESET == huart->gState) { switch (CallbackID) { case HAL_UART_MSPINIT_CB_ID : huart->MspInitCallback = HAL_UART_MspInit; break; case HAL_UART_MSPDEINIT_CB_ID : huart->MspDeInitCallback = HAL_UART_MspDeInit; break; default : huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; status = HAL_ERROR; break; } } else { huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; status = HAL_ERROR; } __HAL_UNLOCK(huart); return status; } #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ /** * @} */ /** @defgroup UART_Exported_Functions_Group2 IO operation functions * @brief UART Transmit/Receive functions * @verbatim =============================================================================== ##### IO operation functions ##### =============================================================================== This subsection provides a set of functions allowing to manage the UART asynchronous and Half duplex data transfers. (#) There are two mode of transfer: (+) Blocking mode: The communication is performed in polling mode. The HAL status of all data processing is returned by the same function after finishing transfer. (+) Non-Blocking mode: The communication is performed using Interrupts or DMA, These API's return the HAL status. The end of the data processing will be indicated through the dedicated UART IRQ when using Interrupt mode or the DMA IRQ when using DMA mode. The HAL_UART_TxCpltCallback(), HAL_UART_RxCpltCallback() user callbacks will be executed respectively at the end of the transmit or Receive process The HAL_UART_ErrorCallback()user callback will be executed when a communication error is detected (#) Blocking mode API's are : (+) HAL_UART_Transmit() (+) HAL_UART_Receive() (#) Non-Blocking mode API's with Interrupt are : (+) HAL_UART_Transmit_IT() (+) HAL_UART_Receive_IT() (+) HAL_UART_IRQHandler() (#) Non-Blocking mode API's with DMA are : (+) HAL_UART_Transmit_DMA() (+) HAL_UART_Receive_DMA() (+) HAL_UART_DMAPause() (+) HAL_UART_DMAResume() (+) HAL_UART_DMAStop() (#) A set of Transfer Complete Callbacks are provided in Non_Blocking mode: (+) HAL_UART_TxHalfCpltCallback() (+) HAL_UART_TxCpltCallback() (+) HAL_UART_RxHalfCpltCallback() (+) HAL_UART_RxCpltCallback() (+) HAL_UART_ErrorCallback() (#) Non-Blocking mode transfers could be aborted using Abort API's : (+) HAL_UART_Abort() (+) HAL_UART_AbortTransmit() (+) HAL_UART_AbortReceive() (+) HAL_UART_Abort_IT() (+) HAL_UART_AbortTransmit_IT() (+) HAL_UART_AbortReceive_IT() (#) For Abort services based on interrupts (HAL_UART_Abortxxx_IT), a set of Abort Complete Callbacks are provided: (+) HAL_UART_AbortCpltCallback() (+) HAL_UART_AbortTransmitCpltCallback() (+) HAL_UART_AbortReceiveCpltCallback() #if defined(USART_CR1_UESM) (#) Wakeup from Stop mode Callback: (+) HAL_UARTEx_WakeupCallback() #endif (#) In Non-Blocking mode transfers, possible errors are split into 2 categories. Errors are handled as follows : (+) Error is considered as Recoverable and non blocking : Transfer could go till end, but error severity is to be evaluated by user : this concerns Frame Error, Parity Error or Noise Error in Interrupt mode reception . Received character is then retrieved and stored in Rx buffer, Error code is set to allow user to identify error type, and HAL_UART_ErrorCallback() user callback is executed. Transfer is kept ongoing on UART side. If user wants to abort it, Abort services should be called by user. (+) Error is considered as Blocking : Transfer could not be completed properly and is aborted. This concerns Overrun Error In Interrupt mode reception and all errors in DMA mode. Error code is set to allow user to identify error type, and HAL_UART_ErrorCallback() user callback is executed. -@- In the Half duplex communication, it is forbidden to run the transmit and receive process in parallel, the UART state HAL_UART_STATE_BUSY_TX_RX can't be useful. @endverbatim * @{ */ /** * @brief Send an amount of data in blocking mode. * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), * the sent data is handled as a set of u16. In this case, Size must indicate the number * of u16 provided through pData. * @param huart UART handle. * @param pData Pointer to data buffer (u8 or u16 data elements). * @param Size Amount of data elements (u8 or u16) to be sent. * @param Timeout Timeout duration. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout) { uint8_t *pdata8bits; uint16_t *pdata16bits; uint32_t tickstart; /* Check that a Tx process is not already ongoing */ if (huart->gState == HAL_UART_STATE_READY) { if ((pData == NULL) || (Size == 0U)) { return HAL_ERROR; } __HAL_LOCK(huart); huart->ErrorCode = HAL_UART_ERROR_NONE; huart->gState = HAL_UART_STATE_BUSY_TX; /* Init tickstart for timeout managment*/ tickstart = HAL_GetTick(); huart->TxXferSize = Size; huart->TxXferCount = Size; /* In case of 9bits/No Parity transfer, pData needs to be handled as a uint16_t pointer */ if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) { pdata8bits = NULL; pdata16bits = (uint16_t *) pData; } else { pdata8bits = pData; pdata16bits = NULL; } __HAL_UNLOCK(huart); while (huart->TxXferCount > 0U) { if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK) { return HAL_TIMEOUT; } if (pdata8bits == NULL) { huart->Instance->TDR = (uint16_t)(*pdata16bits & 0x01FFU); pdata16bits++; } else { huart->Instance->TDR = (uint8_t)(*pdata8bits & 0xFFU); pdata8bits++; } huart->TxXferCount--; } if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TC, RESET, tickstart, Timeout) != HAL_OK) { return HAL_TIMEOUT; } /* At end of Tx process, restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Receive an amount of data in blocking mode. * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), * the received data is handled as a set of u16. In this case, Size must indicate the number * of u16 available through pData. * @param huart UART handle. * @param pData Pointer to data buffer (u8 or u16 data elements). * @param Size Amount of data elements (u8 or u16) to be received. * @param Timeout Timeout duration. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout) { uint8_t *pdata8bits; uint16_t *pdata16bits; uint16_t uhMask; uint32_t tickstart; /* Check that a Rx process is not already ongoing */ if (huart->RxState == HAL_UART_STATE_READY) { if ((pData == NULL) || (Size == 0U)) { return HAL_ERROR; } __HAL_LOCK(huart); huart->ErrorCode = HAL_UART_ERROR_NONE; huart->RxState = HAL_UART_STATE_BUSY_RX; /* Init tickstart for timeout managment*/ tickstart = HAL_GetTick(); huart->RxXferSize = Size; huart->RxXferCount = Size; /* Computation of UART mask to apply to RDR register */ UART_MASK_COMPUTATION(huart); uhMask = huart->Mask; /* In case of 9bits/No Parity transfer, pRxData needs to be handled as a uint16_t pointer */ if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) { pdata8bits = NULL; pdata16bits = (uint16_t *) pData; } else { pdata8bits = pData; pdata16bits = NULL; } __HAL_UNLOCK(huart); /* as long as data have to be received */ while (huart->RxXferCount > 0U) { if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_RXNE, RESET, tickstart, Timeout) != HAL_OK) { return HAL_TIMEOUT; } if (pdata8bits == NULL) { *pdata16bits = (uint16_t)(huart->Instance->RDR & uhMask); pdata16bits++; } else { *pdata8bits = (uint8_t)(huart->Instance->RDR & (uint8_t)uhMask); pdata8bits++; } huart->RxXferCount--; } /* At end of Rx process, restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Send an amount of data in interrupt mode. * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), * the sent data is handled as a set of u16. In this case, Size must indicate the number * of u16 provided through pData. * @param huart UART handle. * @param pData Pointer to data buffer (u8 or u16 data elements). * @param Size Amount of data elements (u8 or u16) to be sent. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) { /* Check that a Tx process is not already ongoing */ if (huart->gState == HAL_UART_STATE_READY) { if ((pData == NULL) || (Size == 0U)) { return HAL_ERROR; } __HAL_LOCK(huart); huart->pTxBuffPtr = pData; huart->TxXferSize = Size; huart->TxXferCount = Size; huart->TxISR = NULL; huart->ErrorCode = HAL_UART_ERROR_NONE; huart->gState = HAL_UART_STATE_BUSY_TX; /* Set the Tx ISR function pointer according to the data word length */ if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) { huart->TxISR = UART_TxISR_16BIT; } else { huart->TxISR = UART_TxISR_8BIT; } __HAL_UNLOCK(huart); /* Enable the Transmit Data Register Empty interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_TXEIE); return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Receive an amount of data in interrupt mode. * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), * the received data is handled as a set of u16. In this case, Size must indicate the number * of u16 available through pData. * @param huart UART handle. * @param pData Pointer to data buffer (u8 or u16 data elements). * @param Size Amount of data elements (u8 or u16) to be received. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) { /* Check that a Rx process is not already ongoing */ if (huart->RxState == HAL_UART_STATE_READY) { if ((pData == NULL) || (Size == 0U)) { return HAL_ERROR; } __HAL_LOCK(huart); huart->pRxBuffPtr = pData; huart->RxXferSize = Size; huart->RxXferCount = Size; huart->RxISR = NULL; /* Computation of UART mask to apply to RDR register */ UART_MASK_COMPUTATION(huart); huart->ErrorCode = HAL_UART_ERROR_NONE; huart->RxState = HAL_UART_STATE_BUSY_RX; /* Enable the UART Error Interrupt: (Frame error, noise error, overrun error) */ SET_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Set the Rx ISR function pointer according to the data word length */ if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) { huart->RxISR = UART_RxISR_16BIT; } else { huart->RxISR = UART_RxISR_8BIT; } __HAL_UNLOCK(huart); /* Enable the UART Parity Error interrupt and Data Register Not Empty interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_PEIE | USART_CR1_RXNEIE); return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Send an amount of data in DMA mode. * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), * the sent data is handled as a set of u16. In this case, Size must indicate the number * of u16 provided through pData. * @param huart UART handle. * @param pData Pointer to data buffer (u8 or u16 data elements). * @param Size Amount of data elements (u8 or u16) to be sent. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) { /* Check that a Tx process is not already ongoing */ if (huart->gState == HAL_UART_STATE_READY) { if ((pData == NULL) || (Size == 0U)) { return HAL_ERROR; } __HAL_LOCK(huart); huart->pTxBuffPtr = pData; huart->TxXferSize = Size; huart->TxXferCount = Size; huart->ErrorCode = HAL_UART_ERROR_NONE; huart->gState = HAL_UART_STATE_BUSY_TX; if (huart->hdmatx != NULL) { /* Set the UART DMA transfer complete callback */ huart->hdmatx->XferCpltCallback = UART_DMATransmitCplt; /* Set the UART DMA Half transfer complete callback */ huart->hdmatx->XferHalfCpltCallback = UART_DMATxHalfCplt; /* Set the DMA error callback */ huart->hdmatx->XferErrorCallback = UART_DMAError; /* Set the DMA abort callback */ huart->hdmatx->XferAbortCallback = NULL; /* Enable the UART transmit DMA channel */ if (HAL_DMA_Start_IT(huart->hdmatx, (uint32_t)huart->pTxBuffPtr, (uint32_t)&huart->Instance->TDR, Size) != HAL_OK) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; __HAL_UNLOCK(huart); /* Restore huart->gState to ready */ huart->gState = HAL_UART_STATE_READY; return HAL_ERROR; } } /* Clear the TC flag in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_TCF); __HAL_UNLOCK(huart); /* Enable the DMA transfer for transmit request by setting the DMAT bit in the UART CR3 register */ SET_BIT(huart->Instance->CR3, USART_CR3_DMAT); return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Receive an amount of data in DMA mode. * @note When the UART parity is enabled (PCE = 1), the received data contain * the parity bit (MSB position). * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), * the received data is handled as a set of u16. In this case, Size must indicate the number * of u16 available through pData. * @param huart UART handle. * @param pData Pointer to data buffer (u8 or u16 data elements). * @param Size Amount of data elements (u8 or u16) to be received. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) { /* Check that a Rx process is not already ongoing */ if (huart->RxState == HAL_UART_STATE_READY) { if ((pData == NULL) || (Size == 0U)) { return HAL_ERROR; } __HAL_LOCK(huart); huart->pRxBuffPtr = pData; huart->RxXferSize = Size; huart->ErrorCode = HAL_UART_ERROR_NONE; huart->RxState = HAL_UART_STATE_BUSY_RX; if (huart->hdmarx != NULL) { /* Set the UART DMA transfer complete callback */ huart->hdmarx->XferCpltCallback = UART_DMAReceiveCplt; /* Set the UART DMA Half transfer complete callback */ huart->hdmarx->XferHalfCpltCallback = UART_DMARxHalfCplt; /* Set the DMA error callback */ huart->hdmarx->XferErrorCallback = UART_DMAError; /* Set the DMA abort callback */ huart->hdmarx->XferAbortCallback = NULL; /* Enable the DMA channel */ if (HAL_DMA_Start_IT(huart->hdmarx, (uint32_t)&huart->Instance->RDR, (uint32_t)huart->pRxBuffPtr, Size) != HAL_OK) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; __HAL_UNLOCK(huart); /* Restore huart->gState to ready */ huart->gState = HAL_UART_STATE_READY; return HAL_ERROR; } } __HAL_UNLOCK(huart); /* Enable the UART Parity Error Interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); /* Enable the UART Error Interrupt: (Frame error, noise error, overrun error) */ SET_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Enable the DMA transfer for the receiver request by setting the DMAR bit in the UART CR3 register */ SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Pause the DMA Transfer. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart) { const HAL_UART_StateTypeDef gstate = huart->gState; const HAL_UART_StateTypeDef rxstate = huart->RxState; __HAL_LOCK(huart); if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && (gstate == HAL_UART_STATE_BUSY_TX)) { /* Disable the UART DMA Tx request */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); } if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && (rxstate == HAL_UART_STATE_BUSY_RX)) { /* Disable PE and ERR (Frame error, noise error, overrun error) interrupts */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Disable the UART DMA Rx request */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); } __HAL_UNLOCK(huart); return HAL_OK; } /** * @brief Resume the DMA Transfer. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart) { __HAL_LOCK(huart); if (huart->gState == HAL_UART_STATE_BUSY_TX) { /* Enable the UART DMA Tx request */ SET_BIT(huart->Instance->CR3, USART_CR3_DMAT); } if (huart->RxState == HAL_UART_STATE_BUSY_RX) { /* Clear the Overrun flag before resuming the Rx transfer */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); /* Reenable PE and ERR (Frame error, noise error, overrun error) interrupts */ SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); SET_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Enable the UART DMA Rx request */ SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); } __HAL_UNLOCK(huart); return HAL_OK; } /** * @brief Stop the DMA Transfer. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart) { /* The Lock is not implemented on this API to allow the user application to call the HAL UART API under callbacks HAL_UART_TxCpltCallback() / HAL_UART_RxCpltCallback() / HAL_UART_TxHalfCpltCallback / HAL_UART_RxHalfCpltCallback: indeed, when HAL_DMA_Abort() API is called, the DMA TX/RX Transfer or Half Transfer complete interrupt is generated if the DMA transfer interruption occurs at the middle or at the end of the stream and the corresponding call back is executed. */ const HAL_UART_StateTypeDef gstate = huart->gState; const HAL_UART_StateTypeDef rxstate = huart->RxState; /* Stop UART DMA Tx request if ongoing */ if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && (gstate == HAL_UART_STATE_BUSY_TX)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Abort the UART DMA Tx channel */ if (huart->hdmatx != NULL) { if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) { if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; return HAL_TIMEOUT; } } } UART_EndTxTransfer(huart); } /* Stop UART DMA Rx request if ongoing */ if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && (rxstate == HAL_UART_STATE_BUSY_RX)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel */ if (huart->hdmarx != NULL) { if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) { if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; return HAL_TIMEOUT; } } } UART_EndRxTransfer(huart); } return HAL_OK; } /** * @brief Abort ongoing transfers (blocking mode). * @param huart UART handle. * @note This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. * This procedure performs following operations : * - Disable UART Interrupts (Tx and Rx) * - Disable the DMA transfer in the peripheral register (if enabled) * - Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode) * - Set handle State to READY * @note This procedure is executed in blocking mode : when exiting function, Abort is considered as completed. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart) { /* Disable TXEIE, TCIE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Disable the UART DMA Tx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Abort the UART DMA Tx channel : use blocking DMA Abort API (no callback) */ if (huart->hdmatx != NULL) { /* Set the UART DMA Abort callback to Null. No call back execution at end of DMA abort procedure */ huart->hdmatx->XferAbortCallback = NULL; if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) { if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; return HAL_TIMEOUT; } } } } /* Disable the UART DMA Rx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel : use blocking DMA Abort API (no callback) */ if (huart->hdmarx != NULL) { /* Set the UART DMA Abort callback to Null. No call back execution at end of DMA abort procedure */ huart->hdmarx->XferAbortCallback = NULL; if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) { if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; return HAL_TIMEOUT; } } } } /* Reset Tx and Rx transfer counters */ huart->TxXferCount = 0U; huart->RxXferCount = 0U; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Discard the received data */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); /* Restore huart->gState and huart->RxState to Ready */ huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; huart->ErrorCode = HAL_UART_ERROR_NONE; return HAL_OK; } /** * @brief Abort ongoing Transmit transfer (blocking mode). * @param huart UART handle. * @note This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode. * This procedure performs following operations : * - Disable UART Interrupts (Tx) * - Disable the DMA transfer in the peripheral register (if enabled) * - Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode) * - Set handle State to READY * @note This procedure is executed in blocking mode : when exiting function, Abort is considered as completed. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart) { /* Disable TXEIE and TCIE interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE)); /* Disable the UART DMA Tx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Abort the UART DMA Tx channel : use blocking DMA Abort API (no callback) */ if (huart->hdmatx != NULL) { /* Set the UART DMA Abort callback to Null. No call back execution at end of DMA abort procedure */ huart->hdmatx->XferAbortCallback = NULL; if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) { if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; return HAL_TIMEOUT; } } } } /* Reset Tx transfer counter */ huart->TxXferCount = 0U; /* Restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; return HAL_OK; } /** * @brief Abort ongoing Receive transfer (blocking mode). * @param huart UART handle. * @note This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode. * This procedure performs following operations : * - Disable UART Interrupts (Rx) * - Disable the DMA transfer in the peripheral register (if enabled) * - Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode) * - Set handle State to READY * @note This procedure is executed in blocking mode : when exiting function, Abort is considered as completed. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart) { /* Disable RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Disable the UART DMA Rx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel : use blocking DMA Abort API (no callback) */ if (huart->hdmarx != NULL) { /* Set the UART DMA Abort callback to Null. No call back execution at end of DMA abort procedure */ huart->hdmarx->XferAbortCallback = NULL; if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) { if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) { /* Set error code to DMA */ huart->ErrorCode = HAL_UART_ERROR_DMA; return HAL_TIMEOUT; } } } } /* Reset Rx transfer counter */ huart->RxXferCount = 0U; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Discard the received data */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); /* Restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; return HAL_OK; } /** * @brief Abort ongoing transfers (Interrupt mode). * @param huart UART handle. * @note This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. * This procedure performs following operations : * - Disable UART Interrupts (Tx and Rx) * - Disable the DMA transfer in the peripheral register (if enabled) * - Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode) * - Set handle State to READY * - At abort completion, call user abort complete callback * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be * considered as completed only when user abort complete callback is executed (not when exiting function). * @retval HAL status */ HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart) { uint32_t abortcplt = 1U; /* Disable interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* If DMA Tx and/or DMA Rx Handles are associated to UART Handle, DMA Abort complete callbacks should be initialised before any call to DMA Abort functions */ /* DMA Tx Handle is valid */ if (huart->hdmatx != NULL) { /* Set DMA Abort Complete callback if UART DMA Tx request if enabled. Otherwise, set it to NULL */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) { huart->hdmatx->XferAbortCallback = UART_DMATxAbortCallback; } else { huart->hdmatx->XferAbortCallback = NULL; } } /* DMA Rx Handle is valid */ if (huart->hdmarx != NULL) { /* Set DMA Abort Complete callback if UART DMA Rx request if enabled. Otherwise, set it to NULL */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { huart->hdmarx->XferAbortCallback = UART_DMARxAbortCallback; } else { huart->hdmarx->XferAbortCallback = NULL; } } /* Disable the UART DMA Tx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) { /* Disable DMA Tx at UART level */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Abort the UART DMA Tx channel : use non blocking DMA Abort API (callback) */ if (huart->hdmatx != NULL) { /* UART Tx DMA Abort callback has already been initialised : will lead to call HAL_UART_AbortCpltCallback() at end of DMA abort procedure */ /* Abort DMA TX */ if (HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK) { huart->hdmatx->XferAbortCallback = NULL; } else { abortcplt = 0U; } } } /* Disable the UART DMA Rx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel : use non blocking DMA Abort API (callback) */ if (huart->hdmarx != NULL) { /* UART Rx DMA Abort callback has already been initialised : will lead to call HAL_UART_AbortCpltCallback() at end of DMA abort procedure */ /* Abort DMA RX */ if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) { huart->hdmarx->XferAbortCallback = NULL; abortcplt = 1U; } else { abortcplt = 0U; } } } /* if no DMA abort complete callback execution is required => call user Abort Complete callback */ if (abortcplt == 1U) { /* Reset Tx and Rx transfer counters */ huart->TxXferCount = 0U; huart->RxXferCount = 0U; /* Clear ISR function pointers */ huart->RxISR = NULL; huart->TxISR = NULL; /* Reset errorCode */ huart->ErrorCode = HAL_UART_ERROR_NONE; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Discard the received data */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); /* Restore huart->gState and huart->RxState to Ready */ huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; /* As no DMA to be aborted, call directly user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort complete callback */ huart->AbortCpltCallback(huart); #else /* Call legacy weak Abort complete callback */ HAL_UART_AbortCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } return HAL_OK; } /** * @brief Abort ongoing Transmit transfer (Interrupt mode). * @param huart UART handle. * @note This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode. * This procedure performs following operations : * - Disable UART Interrupts (Tx) * - Disable the DMA transfer in the peripheral register (if enabled) * - Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode) * - Set handle State to READY * - At abort completion, call user abort complete callback * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be * considered as completed only when user abort complete callback is executed (not when exiting function). * @retval HAL status */ HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart) { /* Disable interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE)); /* Disable the UART DMA Tx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Abort the UART DMA Tx channel : use non blocking DMA Abort API (callback) */ if (huart->hdmatx != NULL) { /* Set the UART DMA Abort callback : will lead to call HAL_UART_AbortCpltCallback() at end of DMA abort procedure */ huart->hdmatx->XferAbortCallback = UART_DMATxOnlyAbortCallback; /* Abort DMA TX */ if (HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK) { /* Call Directly huart->hdmatx->XferAbortCallback function in case of error */ huart->hdmatx->XferAbortCallback(huart->hdmatx); } } else { /* Reset Tx transfer counter */ huart->TxXferCount = 0U; /* Clear TxISR function pointers */ huart->TxISR = NULL; /* Restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; /* As no DMA to be aborted, call directly user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort Transmit Complete Callback */ huart->AbortTransmitCpltCallback(huart); #else /* Call legacy weak Abort Transmit Complete Callback */ HAL_UART_AbortTransmitCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } else { /* Reset Tx transfer counter */ huart->TxXferCount = 0U; /* Clear TxISR function pointers */ huart->TxISR = NULL; /* Restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; /* As no DMA to be aborted, call directly user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort Transmit Complete Callback */ huart->AbortTransmitCpltCallback(huart); #else /* Call legacy weak Abort Transmit Complete Callback */ HAL_UART_AbortTransmitCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } return HAL_OK; } /** * @brief Abort ongoing Receive transfer (Interrupt mode). * @param huart UART handle. * @note This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode. * This procedure performs following operations : * - Disable UART Interrupts (Rx) * - Disable the DMA transfer in the peripheral register (if enabled) * - Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode) * - Set handle State to READY * - At abort completion, call user abort complete callback * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be * considered as completed only when user abort complete callback is executed (not when exiting function). * @retval HAL status */ HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart) { /* Disable RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Disable the UART DMA Rx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel : use non blocking DMA Abort API (callback) */ if (huart->hdmarx != NULL) { /* Set the UART DMA Abort callback : will lead to call HAL_UART_AbortCpltCallback() at end of DMA abort procedure */ huart->hdmarx->XferAbortCallback = UART_DMARxOnlyAbortCallback; /* Abort DMA RX */ if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) { /* Call Directly huart->hdmarx->XferAbortCallback function in case of error */ huart->hdmarx->XferAbortCallback(huart->hdmarx); } } else { /* Reset Rx transfer counter */ huart->RxXferCount = 0U; /* Clear RxISR function pointer */ huart->pRxBuffPtr = NULL; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Discard the received data */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); /* Restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; /* As no DMA to be aborted, call directly user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort Receive Complete Callback */ huart->AbortReceiveCpltCallback(huart); #else /* Call legacy weak Abort Receive Complete Callback */ HAL_UART_AbortReceiveCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } else { /* Reset Rx transfer counter */ huart->RxXferCount = 0U; /* Clear RxISR function pointer */ huart->pRxBuffPtr = NULL; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; /* As no DMA to be aborted, call directly user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort Receive Complete Callback */ huart->AbortReceiveCpltCallback(huart); #else /* Call legacy weak Abort Receive Complete Callback */ HAL_UART_AbortReceiveCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } return HAL_OK; } /** * @brief Handle UART interrupt request. * @param huart UART handle. * @retval None */ void HAL_UART_IRQHandler(UART_HandleTypeDef *huart) { uint32_t isrflags = READ_REG(huart->Instance->ISR); uint32_t cr1its = READ_REG(huart->Instance->CR1); uint32_t cr3its = READ_REG(huart->Instance->CR3); uint32_t errorflags; uint32_t errorcode; /* If no error occurs */ errorflags = (isrflags & (uint32_t)(USART_ISR_PE | USART_ISR_FE | USART_ISR_ORE | USART_ISR_NE | USART_ISR_RTOF)); if (errorflags == 0U) { /* UART in mode Receiver ---------------------------------------------------*/ if (((isrflags & USART_ISR_RXNE) != 0U) && ((cr1its & USART_CR1_RXNEIE) != 0U)) { if (huart->RxISR != NULL) { huart->RxISR(huart); } return; } } /* If some errors occur */ if ((errorflags != 0U) && (((cr3its & USART_CR3_EIE) != 0U) || ((cr1its & (USART_CR1_RXNEIE | USART_CR1_PEIE)) != 0U))) { /* UART parity error interrupt occurred -------------------------------------*/ if (((isrflags & USART_ISR_PE) != 0U) && ((cr1its & USART_CR1_PEIE) != 0U)) { __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_PEF); huart->ErrorCode |= HAL_UART_ERROR_PE; } /* UART frame error interrupt occurred --------------------------------------*/ if (((isrflags & USART_ISR_FE) != 0U) && ((cr3its & USART_CR3_EIE) != 0U)) { __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_FEF); huart->ErrorCode |= HAL_UART_ERROR_FE; } /* UART noise error interrupt occurred --------------------------------------*/ if (((isrflags & USART_ISR_NE) != 0U) && ((cr3its & USART_CR3_EIE) != 0U)) { __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_NEF); huart->ErrorCode |= HAL_UART_ERROR_NE; } /* UART Over-Run interrupt occurred -----------------------------------------*/ if (((isrflags & USART_ISR_ORE) != 0U) && (((cr1its & USART_CR1_RXNEIE) != 0U) || ((cr3its & USART_CR3_EIE) != 0U))) { __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); huart->ErrorCode |= HAL_UART_ERROR_ORE; } /* UART Receiver Timeout interrupt occurred ---------------------------------*/ if (((isrflags & USART_ISR_RTOF) != 0U) && ((cr1its & USART_CR1_RTOIE) != 0U)) { __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); huart->ErrorCode |= HAL_UART_ERROR_RTO; } /* Call UART Error Call back function if need be ----------------------------*/ if (huart->ErrorCode != HAL_UART_ERROR_NONE) { /* UART in mode Receiver --------------------------------------------------*/ if (((isrflags & USART_ISR_RXNE) != 0U) && ((cr1its & USART_CR1_RXNEIE) != 0U)) { if (huart->RxISR != NULL) { huart->RxISR(huart); } } /* If Error is to be considered as blocking : - Receiver Timeout error in Reception - Overrun error in Reception - any error occurs in DMA mode reception */ errorcode = huart->ErrorCode; if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) || ((errorcode & (HAL_UART_ERROR_RTO | HAL_UART_ERROR_ORE)) != 0U)) { /* Blocking error : transfer is aborted Set the UART state ready to be able to start again the process, Disable Rx Interrupts, and disable Rx DMA request, if ongoing */ UART_EndRxTransfer(huart); /* Disable the UART DMA Rx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel */ if (huart->hdmarx != NULL) { /* Set the UART DMA Abort callback : will lead to call HAL_UART_ErrorCallback() at end of DMA abort procedure */ huart->hdmarx->XferAbortCallback = UART_DMAAbortOnError; /* Abort DMA RX */ if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) { /* Call Directly huart->hdmarx->XferAbortCallback function in case of error */ huart->hdmarx->XferAbortCallback(huart->hdmarx); } } else { /* Call user error callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered error callback*/ huart->ErrorCallback(huart); #else /*Call legacy weak error callback*/ HAL_UART_ErrorCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } else { /* Call user error callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered error callback*/ huart->ErrorCallback(huart); #else /*Call legacy weak error callback*/ HAL_UART_ErrorCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } else { /* Non Blocking error : transfer could go on. Error is notified to user through user error callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered error callback*/ huart->ErrorCallback(huart); #else /*Call legacy weak error callback*/ HAL_UART_ErrorCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ huart->ErrorCode = HAL_UART_ERROR_NONE; } } return; } /* End if some error occurs */ #if defined(USART_CR1_UESM) /* UART wakeup from Stop mode interrupt occurred ---------------------------*/ if (((isrflags & USART_ISR_WUF) != 0U) && ((cr3its & USART_CR3_WUFIE) != 0U)) { __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_WUF); /* UART Rx state is not reset as a reception process might be ongoing. If UART handle state fields need to be reset to READY, this could be done in Wakeup callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Wakeup Callback */ huart->WakeupCallback(huart); #else /* Call legacy weak Wakeup Callback */ HAL_UARTEx_WakeupCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ return; } #endif /* USART_CR1_UESM */ /* UART in mode Transmitter ------------------------------------------------*/ if (((isrflags & USART_ISR_TXE) != 0U) && ((cr1its & USART_CR1_TXEIE) != 0U)) { if (huart->TxISR != NULL) { huart->TxISR(huart); } return; } /* UART in mode Transmitter (transmission end) -----------------------------*/ if (((isrflags & USART_ISR_TC) != 0U) && ((cr1its & USART_CR1_TCIE) != 0U)) { UART_EndTransmit_IT(huart); return; } } /** * @brief Tx Transfer completed callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_TxCpltCallback can be implemented in the user file. */ } /** * @brief Tx Half Transfer completed callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE: This function should not be modified, when the callback is needed, the HAL_UART_TxHalfCpltCallback can be implemented in the user file. */ } /** * @brief Rx Transfer completed callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_RxCpltCallback can be implemented in the user file. */ } /** * @brief Rx Half Transfer completed callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE: This function should not be modified, when the callback is needed, the HAL_UART_RxHalfCpltCallback can be implemented in the user file. */ } /** * @brief UART error callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_ErrorCallback can be implemented in the user file. */ } /** * @brief UART Abort Complete callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_AbortCpltCallback can be implemented in the user file. */ } /** * @brief UART Abort Complete callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_AbortTransmitCpltCallback can be implemented in the user file. */ } /** * @brief UART Abort Receive Complete callback. * @param huart UART handle. * @retval None */ __weak void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_AbortReceiveCpltCallback can be implemented in the user file. */ } #if defined(USART_CR1_UESM) /** * @brief UART wakeup from Stop mode callback. * @param huart UART handle. * @retval None */ __weak void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UARTEx_WakeupCallback can be implemented in the user file. */ } #endif /* USART_CR1_UESM */ /** * @} */ /** @defgroup UART_Exported_Functions_Group3 Peripheral Control functions * @brief UART control functions * @verbatim =============================================================================== ##### Peripheral Control functions ##### =============================================================================== [..] This subsection provides a set of functions allowing to control the UART. (+) HAL_UART_ReceiverTimeout_Config() API allows to configure the receiver timeout value on the fly (+) HAL_UART_EnableReceiverTimeout() API enables the receiver timeout feature (+) HAL_UART_DisableReceiverTimeout() API disables the receiver timeout feature (+) HAL_MultiProcessor_EnableMuteMode() API enables mute mode (+) HAL_MultiProcessor_DisableMuteMode() API disables mute mode (+) HAL_MultiProcessor_EnterMuteMode() API enters mute mode (+) UART_SetConfig() API configures the UART peripheral (+) UART_AdvFeatureConfig() API optionally configures the UART advanced features (+) UART_CheckIdleState() API ensures that TEACK and/or REACK are set after initialization (+) HAL_HalfDuplex_EnableTransmitter() API disables receiver and enables transmitter (+) HAL_HalfDuplex_EnableReceiver() API disables transmitter and enables receiver (+) HAL_LIN_SendBreak() API transmits the break characters @endverbatim * @{ */ /** * @brief Update on the fly the receiver timeout value in RTOR register. * @param huart Pointer to a UART_HandleTypeDef structure that contains * the configuration information for the specified UART module. * @param TimeoutValue receiver timeout value in number of baud blocks. The timeout * value must be less or equal to 0x0FFFFFFFF. * @retval None */ void HAL_UART_ReceiverTimeout_Config(UART_HandleTypeDef *huart, uint32_t TimeoutValue) { assert_param(IS_UART_RECEIVER_TIMEOUT_VALUE(TimeoutValue)); MODIFY_REG(huart->Instance->RTOR, USART_RTOR_RTO, TimeoutValue); } /** * @brief Enable the UART receiver timeout feature. * @param huart Pointer to a UART_HandleTypeDef structure that contains * the configuration information for the specified UART module. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_EnableReceiverTimeout(UART_HandleTypeDef *huart) { if (huart->gState == HAL_UART_STATE_READY) { /* Process Locked */ __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Set the USART RTOEN bit */ SET_BIT(huart->Instance->CR2, USART_CR2_RTOEN); huart->gState = HAL_UART_STATE_READY; /* Process Unlocked */ __HAL_UNLOCK(huart); return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Disable the UART receiver timeout feature. * @param huart Pointer to a UART_HandleTypeDef structure that contains * the configuration information for the specified UART module. * @retval HAL status */ HAL_StatusTypeDef HAL_UART_DisableReceiverTimeout(UART_HandleTypeDef *huart) { if (huart->gState == HAL_UART_STATE_READY) { /* Process Locked */ __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Clear the USART RTOEN bit */ CLEAR_BIT(huart->Instance->CR2, USART_CR2_RTOEN); huart->gState = HAL_UART_STATE_READY; /* Process Unlocked */ __HAL_UNLOCK(huart); return HAL_OK; } else { return HAL_BUSY; } } /** * @brief Enable UART in mute mode (does not mean UART enters mute mode; * to enter mute mode, HAL_MultiProcessor_EnterMuteMode() API must be called). * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart) { __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Enable USART mute mode by setting the MME bit in the CR1 register */ SET_BIT(huart->Instance->CR1, USART_CR1_MME); huart->gState = HAL_UART_STATE_READY; return (UART_CheckIdleState(huart)); } /** * @brief Disable UART mute mode (does not mean the UART actually exits mute mode * as it may not have been in mute mode at this very moment). * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart) { __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Disable USART mute mode by clearing the MME bit in the CR1 register */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_MME); huart->gState = HAL_UART_STATE_READY; return (UART_CheckIdleState(huart)); } /** * @brief Enter UART mute mode (means UART actually enters mute mode). * @note To exit from mute mode, HAL_MultiProcessor_DisableMuteMode() API must be called. * @param huart UART handle. * @retval None */ void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart) { __HAL_UART_SEND_REQ(huart, UART_MUTE_MODE_REQUEST); } /** * @brief Enable the UART transmitter and disable the UART receiver. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart) { __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Clear TE and RE bits */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE)); /* Enable the USART's transmit interface by setting the TE bit in the USART CR1 register */ SET_BIT(huart->Instance->CR1, USART_CR1_TE); huart->gState = HAL_UART_STATE_READY; __HAL_UNLOCK(huart); return HAL_OK; } /** * @brief Enable the UART receiver and disable the UART transmitter. * @param huart UART handle. * @retval HAL status. */ HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart) { __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Clear TE and RE bits */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE)); /* Enable the USART's receive interface by setting the RE bit in the USART CR1 register */ SET_BIT(huart->Instance->CR1, USART_CR1_RE); huart->gState = HAL_UART_STATE_READY; __HAL_UNLOCK(huart); return HAL_OK; } /** * @brief Transmit break characters. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart) { /* Check the parameters */ assert_param(IS_UART_LIN_INSTANCE(huart->Instance)); __HAL_LOCK(huart); huart->gState = HAL_UART_STATE_BUSY; /* Send break characters */ __HAL_UART_SEND_REQ(huart, UART_SENDBREAK_REQUEST); huart->gState = HAL_UART_STATE_READY; __HAL_UNLOCK(huart); return HAL_OK; } /** * @} */ /** @defgroup UART_Exported_Functions_Group4 Peripheral State and Error functions * @brief UART Peripheral State functions * @verbatim ============================================================================== ##### Peripheral State and Error functions ##### ============================================================================== [..] This subsection provides functions allowing to : (+) Return the UART handle state. (+) Return the UART handle error code @endverbatim * @{ */ /** * @brief Return the UART handle state. * @param huart Pointer to a UART_HandleTypeDef structure that contains * the configuration information for the specified UART. * @retval HAL state */ HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart) { uint32_t temp1; uint32_t temp2; temp1 = huart->gState; temp2 = huart->RxState; return (HAL_UART_StateTypeDef)(temp1 | temp2); } /** * @brief Return the UART handle error code. * @param huart Pointer to a UART_HandleTypeDef structure that contains * the configuration information for the specified UART. * @retval UART Error Code */ uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart) { return huart->ErrorCode; } /** * @} */ /** * @} */ /** @defgroup UART_Private_Functions UART Private Functions * @{ */ /** * @brief Initialize the callbacks to their default values. * @param huart UART handle. * @retval none */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) void UART_InitCallbacksToDefault(UART_HandleTypeDef *huart) { /* Init the UART Callback settings */ huart->TxHalfCpltCallback = HAL_UART_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCallback */ huart->TxCpltCallback = HAL_UART_TxCpltCallback; /* Legacy weak TxCpltCallback */ huart->RxHalfCpltCallback = HAL_UART_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCallback */ huart->RxCpltCallback = HAL_UART_RxCpltCallback; /* Legacy weak RxCpltCallback */ huart->ErrorCallback = HAL_UART_ErrorCallback; /* Legacy weak ErrorCallback */ huart->AbortCpltCallback = HAL_UART_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ huart->AbortTransmitCpltCallback = HAL_UART_AbortTransmitCpltCallback; /* Legacy weak AbortTransmitCpltCallback */ huart->AbortReceiveCpltCallback = HAL_UART_AbortReceiveCpltCallback; /* Legacy weak AbortReceiveCpltCallback */ #if defined(USART_CR1_UESM) huart->WakeupCallback = HAL_UARTEx_WakeupCallback; /* Legacy weak WakeupCallback */ #endif /* USART_CR1_UESM */ } #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ /** * @brief Configure the UART peripheral. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart) { uint32_t tmpreg; uint16_t brrtemp; UART_ClockSourceTypeDef clocksource; uint32_t usartdiv = 0x00000000U; HAL_StatusTypeDef ret = HAL_OK; uint32_t pclk; /* Check the parameters */ assert_param(IS_UART_BAUDRATE(huart->Init.BaudRate)); assert_param(IS_UART_WORD_LENGTH(huart->Init.WordLength)); assert_param(IS_UART_STOPBITS(huart->Init.StopBits)); assert_param(IS_UART_ONE_BIT_SAMPLE(huart->Init.OneBitSampling)); assert_param(IS_UART_PARITY(huart->Init.Parity)); assert_param(IS_UART_MODE(huart->Init.Mode)); assert_param(IS_UART_HARDWARE_FLOW_CONTROL(huart->Init.HwFlowCtl)); assert_param(IS_UART_OVERSAMPLING(huart->Init.OverSampling)); /*-------------------------- USART CR1 Configuration -----------------------*/ /* Clear M, PCE, PS, TE, RE and OVER8 bits and configure * the UART Word Length, Parity, Mode and oversampling: * set the M bits according to huart->Init.WordLength value * set PCE and PS bits according to huart->Init.Parity value * set TE and RE bits according to huart->Init.Mode value * set OVER8 bit according to huart->Init.OverSampling value */ tmpreg = (uint32_t)huart->Init.WordLength | huart->Init.Parity | huart->Init.Mode | huart->Init.OverSampling ; MODIFY_REG(huart->Instance->CR1, USART_CR1_FIELDS, tmpreg); /*-------------------------- USART CR2 Configuration -----------------------*/ /* Configure the UART Stop Bits: Set STOP[13:12] bits according * to huart->Init.StopBits value */ MODIFY_REG(huart->Instance->CR2, USART_CR2_STOP, huart->Init.StopBits); /*-------------------------- USART CR3 Configuration -----------------------*/ /* Configure * - UART HardWare Flow Control: set CTSE and RTSE bits according * to huart->Init.HwFlowCtl value * - one-bit sampling method versus three samples' majority rule according * to huart->Init.OneBitSampling (not applicable to LPUART) */ tmpreg = (uint32_t)huart->Init.HwFlowCtl; tmpreg |= huart->Init.OneBitSampling; MODIFY_REG(huart->Instance->CR3, USART_CR3_FIELDS, tmpreg); /*-------------------------- USART BRR Configuration -----------------------*/ UART_GETCLOCKSOURCE(huart, clocksource); if (huart->Init.OverSampling == UART_OVERSAMPLING_8) { switch (clocksource) { case UART_CLOCKSOURCE_PCLK1: pclk = HAL_RCC_GetPCLK1Freq(); usartdiv = (uint16_t)(UART_DIV_SAMPLING8(pclk, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_PCLK2: pclk = HAL_RCC_GetPCLK2Freq(); usartdiv = (uint16_t)(UART_DIV_SAMPLING8(pclk, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_HSI: usartdiv = (uint16_t)(UART_DIV_SAMPLING8(HSI_VALUE, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_SYSCLK: pclk = HAL_RCC_GetSysClockFreq(); usartdiv = (uint16_t)(UART_DIV_SAMPLING8(pclk, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_LSE: usartdiv = (uint16_t)(UART_DIV_SAMPLING8(LSE_VALUE, huart->Init.BaudRate)); break; default: ret = HAL_ERROR; break; } /* USARTDIV must be greater than or equal to 0d16 */ if ((usartdiv >= UART_BRR_MIN) && (usartdiv <= UART_BRR_MAX)) { brrtemp = (uint16_t)(usartdiv & 0xFFF0U); brrtemp |= (uint16_t)((usartdiv & (uint16_t)0x000FU) >> 1U); huart->Instance->BRR = brrtemp; } else { ret = HAL_ERROR; } } else { switch (clocksource) { case UART_CLOCKSOURCE_PCLK1: pclk = HAL_RCC_GetPCLK1Freq(); usartdiv = (uint16_t)(UART_DIV_SAMPLING16(pclk, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_PCLK2: pclk = HAL_RCC_GetPCLK2Freq(); usartdiv = (uint16_t)(UART_DIV_SAMPLING16(pclk, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_HSI: usartdiv = (uint16_t)(UART_DIV_SAMPLING16(HSI_VALUE, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_SYSCLK: pclk = HAL_RCC_GetSysClockFreq(); usartdiv = (uint16_t)(UART_DIV_SAMPLING16(pclk, huart->Init.BaudRate)); break; case UART_CLOCKSOURCE_LSE: usartdiv = (uint16_t)(UART_DIV_SAMPLING16(LSE_VALUE, huart->Init.BaudRate)); break; default: ret = HAL_ERROR; break; } /* USARTDIV must be greater than or equal to 0d16 */ if ((usartdiv >= UART_BRR_MIN) && (usartdiv <= UART_BRR_MAX)) { huart->Instance->BRR = usartdiv; } else { ret = HAL_ERROR; } } /* Clear ISR function pointers */ huart->RxISR = NULL; huart->TxISR = NULL; return ret; } /** * @brief Configure the UART peripheral advanced features. * @param huart UART handle. * @retval None */ void UART_AdvFeatureConfig(UART_HandleTypeDef *huart) { /* Check whether the set of advanced features to configure is properly set */ assert_param(IS_UART_ADVFEATURE_INIT(huart->AdvancedInit.AdvFeatureInit)); /* if required, configure TX pin active level inversion */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_TXINVERT_INIT)) { assert_param(IS_UART_ADVFEATURE_TXINV(huart->AdvancedInit.TxPinLevelInvert)); MODIFY_REG(huart->Instance->CR2, USART_CR2_TXINV, huart->AdvancedInit.TxPinLevelInvert); } /* if required, configure RX pin active level inversion */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_RXINVERT_INIT)) { assert_param(IS_UART_ADVFEATURE_RXINV(huart->AdvancedInit.RxPinLevelInvert)); MODIFY_REG(huart->Instance->CR2, USART_CR2_RXINV, huart->AdvancedInit.RxPinLevelInvert); } /* if required, configure data inversion */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_DATAINVERT_INIT)) { assert_param(IS_UART_ADVFEATURE_DATAINV(huart->AdvancedInit.DataInvert)); MODIFY_REG(huart->Instance->CR2, USART_CR2_DATAINV, huart->AdvancedInit.DataInvert); } /* if required, configure RX/TX pins swap */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_SWAP_INIT)) { assert_param(IS_UART_ADVFEATURE_SWAP(huart->AdvancedInit.Swap)); MODIFY_REG(huart->Instance->CR2, USART_CR2_SWAP, huart->AdvancedInit.Swap); } /* if required, configure RX overrun detection disabling */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_RXOVERRUNDISABLE_INIT)) { assert_param(IS_UART_OVERRUN(huart->AdvancedInit.OverrunDisable)); MODIFY_REG(huart->Instance->CR3, USART_CR3_OVRDIS, huart->AdvancedInit.OverrunDisable); } /* if required, configure DMA disabling on reception error */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_DMADISABLEONERROR_INIT)) { assert_param(IS_UART_ADVFEATURE_DMAONRXERROR(huart->AdvancedInit.DMADisableonRxError)); MODIFY_REG(huart->Instance->CR3, USART_CR3_DDRE, huart->AdvancedInit.DMADisableonRxError); } /* if required, configure auto Baud rate detection scheme */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_AUTOBAUDRATE_INIT)) { assert_param(IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(huart->Instance)); assert_param(IS_UART_ADVFEATURE_AUTOBAUDRATE(huart->AdvancedInit.AutoBaudRateEnable)); MODIFY_REG(huart->Instance->CR2, USART_CR2_ABREN, huart->AdvancedInit.AutoBaudRateEnable); /* set auto Baudrate detection parameters if detection is enabled */ if (huart->AdvancedInit.AutoBaudRateEnable == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE) { assert_param(IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(huart->AdvancedInit.AutoBaudRateMode)); MODIFY_REG(huart->Instance->CR2, USART_CR2_ABRMODE, huart->AdvancedInit.AutoBaudRateMode); } } /* if required, configure MSB first on communication line */ if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_MSBFIRST_INIT)) { assert_param(IS_UART_ADVFEATURE_MSBFIRST(huart->AdvancedInit.MSBFirst)); MODIFY_REG(huart->Instance->CR2, USART_CR2_MSBFIRST, huart->AdvancedInit.MSBFirst); } } /** * @brief Check the UART Idle State. * @param huart UART handle. * @retval HAL status */ HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart) { uint32_t tickstart; /* Initialize the UART ErrorCode */ huart->ErrorCode = HAL_UART_ERROR_NONE; /* Init tickstart for timeout managment*/ tickstart = HAL_GetTick(); /* Check if the Transmitter is enabled */ if ((huart->Instance->CR1 & USART_CR1_TE) == USART_CR1_TE) { /* Wait until TEACK flag is set */ if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_TEACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) != HAL_OK) { /* Timeout occurred */ return HAL_TIMEOUT; } } #if defined(USART_ISR_REACK) /* Check if the Receiver is enabled */ if ((huart->Instance->CR1 & USART_CR1_RE) == USART_CR1_RE) { /* Wait until REACK flag is set */ if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_REACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) != HAL_OK) { /* Timeout occurred */ return HAL_TIMEOUT; } } #endif /* Initialize the UART State */ huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; __HAL_UNLOCK(huart); return HAL_OK; } /** * @brief Handle UART Communication Timeout. * @param huart UART handle. * @param Flag Specifies the UART flag to check * @param Status Flag status (SET or RESET) * @param Tickstart Tick start value * @param Timeout Timeout duration * @retval HAL status */ HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Tickstart, uint32_t Timeout) { /* Wait until flag is set */ while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status) { /* Check for the Timeout */ if (Timeout != HAL_MAX_DELAY) { if (((HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U)) { /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; __HAL_UNLOCK(huart); return HAL_TIMEOUT; } if (READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) { if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RTOF) == SET) { /* Clear Receiver Timeout flag*/ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; huart->ErrorCode = HAL_UART_ERROR_RTO; /* Process Unlocked */ __HAL_UNLOCK(huart); return HAL_TIMEOUT; } } } } return HAL_OK; } /** * @brief End ongoing Tx transfer on UART peripheral (following error detection or Transmit completion). * @param huart UART handle. * @retval None */ static void UART_EndTxTransfer(UART_HandleTypeDef *huart) { /* Disable TXEIE and TCIE interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE)); /* At end of Tx process, restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; } /** * @brief End ongoing Rx transfer on UART peripheral (following error detection or Reception completion). * @param huart UART handle. * @retval None */ static void UART_EndRxTransfer(UART_HandleTypeDef *huart) { /* Disable RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* At end of Rx process, restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; /* Reset RxIsr function pointer */ huart->RxISR = NULL; } /** * @brief DMA UART transmit process complete callback. * @param hdma DMA handle. * @retval None */ static void UART_DMATransmitCplt(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); /* DMA Normal mode */ if (hdma->Init.Mode != DMA_CIRCULAR) { huart->TxXferCount = 0U; /* Disable the DMA transfer for transmit request by resetting the DMAT bit in the UART CR3 register */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Enable the UART Transmit Complete Interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); } /* DMA Circular mode */ else { #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Tx complete callback*/ huart->TxCpltCallback(huart); #else /*Call legacy weak Tx complete callback*/ HAL_UART_TxCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } /** * @brief DMA UART transmit process half complete callback. * @param hdma DMA handle. * @retval None */ static void UART_DMATxHalfCplt(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Tx Half complete callback*/ huart->TxHalfCpltCallback(huart); #else /*Call legacy weak Tx Half complete callback*/ HAL_UART_TxHalfCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART receive process complete callback. * @param hdma DMA handle. * @retval None */ static void UART_DMAReceiveCplt(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); /* DMA Normal mode */ if (hdma->Init.Mode != DMA_CIRCULAR) { huart->RxXferCount = 0U; /* Disable PE and ERR (Frame error, noise error, overrun error) interrupts */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Disable the DMA transfer for the receiver request by resetting the DMAR bit in the UART CR3 register */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* At end of Rx process, restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; } #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Rx complete callback*/ huart->RxCpltCallback(huart); #else /*Call legacy weak Rx complete callback*/ HAL_UART_RxCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART receive process half complete callback. * @param hdma DMA handle. * @retval None */ static void UART_DMARxHalfCplt(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Rx Half complete callback*/ huart->RxHalfCpltCallback(huart); #else /*Call legacy weak Rx Half complete callback*/ HAL_UART_RxHalfCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART communication error callback. * @param hdma DMA handle. * @retval None */ static void UART_DMAError(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); const HAL_UART_StateTypeDef gstate = huart->gState; const HAL_UART_StateTypeDef rxstate = huart->RxState; /* Stop UART DMA Tx request if ongoing */ if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && (gstate == HAL_UART_STATE_BUSY_TX)) { huart->TxXferCount = 0U; UART_EndTxTransfer(huart); } /* Stop UART DMA Rx request if ongoing */ if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && (rxstate == HAL_UART_STATE_BUSY_RX)) { huart->RxXferCount = 0U; UART_EndRxTransfer(huart); } huart->ErrorCode |= HAL_UART_ERROR_DMA; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered error callback*/ huart->ErrorCallback(huart); #else /*Call legacy weak error callback*/ HAL_UART_ErrorCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART communication abort callback, when initiated by HAL services on Error * (To be called at end of DMA Abort procedure following error occurrence). * @param hdma DMA handle. * @retval None */ static void UART_DMAAbortOnError(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); huart->RxXferCount = 0U; huart->TxXferCount = 0U; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered error callback*/ huart->ErrorCallback(huart); #else /*Call legacy weak error callback*/ HAL_UART_ErrorCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART Tx communication abort callback, when initiated by user * (To be called at end of DMA Tx Abort procedure following user abort request). * @note When this callback is executed, User Abort complete call back is called only if no * Abort still ongoing for Rx DMA Handle. * @param hdma DMA handle. * @retval None */ static void UART_DMATxAbortCallback(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); huart->hdmatx->XferAbortCallback = NULL; /* Check if an Abort process is still ongoing */ if (huart->hdmarx != NULL) { if (huart->hdmarx->XferAbortCallback != NULL) { return; } } /* No Abort process still ongoing : All DMA channels are aborted, call user Abort Complete callback */ huart->TxXferCount = 0U; huart->RxXferCount = 0U; /* Reset errorCode */ huart->ErrorCode = HAL_UART_ERROR_NONE; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Restore huart->gState and huart->RxState to Ready */ huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; /* Call user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort complete callback */ huart->AbortCpltCallback(huart); #else /* Call legacy weak Abort complete callback */ HAL_UART_AbortCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART Rx communication abort callback, when initiated by user * (To be called at end of DMA Rx Abort procedure following user abort request). * @note When this callback is executed, User Abort complete call back is called only if no * Abort still ongoing for Tx DMA Handle. * @param hdma DMA handle. * @retval None */ static void UART_DMARxAbortCallback(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); huart->hdmarx->XferAbortCallback = NULL; /* Check if an Abort process is still ongoing */ if (huart->hdmatx != NULL) { if (huart->hdmatx->XferAbortCallback != NULL) { return; } } /* No Abort process still ongoing : All DMA channels are aborted, call user Abort Complete callback */ huart->TxXferCount = 0U; huart->RxXferCount = 0U; /* Reset errorCode */ huart->ErrorCode = HAL_UART_ERROR_NONE; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Discard the received data */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); /* Restore huart->gState and huart->RxState to Ready */ huart->gState = HAL_UART_STATE_READY; huart->RxState = HAL_UART_STATE_READY; /* Call user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort complete callback */ huart->AbortCpltCallback(huart); #else /* Call legacy weak Abort complete callback */ HAL_UART_AbortCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART Tx communication abort callback, when initiated by user by a call to * HAL_UART_AbortTransmit_IT API (Abort only Tx transfer) * (This callback is executed at end of DMA Tx Abort procedure following user abort request, * and leads to user Tx Abort Complete callback execution). * @param hdma DMA handle. * @retval None */ static void UART_DMATxOnlyAbortCallback(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); huart->TxXferCount = 0U; /* Restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; /* Call user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort Transmit Complete Callback */ huart->AbortTransmitCpltCallback(huart); #else /* Call legacy weak Abort Transmit Complete Callback */ HAL_UART_AbortTransmitCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief DMA UART Rx communication abort callback, when initiated by user by a call to * HAL_UART_AbortReceive_IT API (Abort only Rx transfer) * (This callback is executed at end of DMA Rx Abort procedure following user abort request, * and leads to user Rx Abort Complete callback execution). * @param hdma DMA handle. * @retval None */ static void UART_DMARxOnlyAbortCallback(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef *huart = (UART_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; huart->RxXferCount = 0U; /* Clear the Error flags in the ICR register */ __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); /* Discard the received data */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); /* Restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; /* Call user Abort complete callback */ #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /* Call registered Abort Receive Complete Callback */ huart->AbortReceiveCpltCallback(huart); #else /* Call legacy weak Abort Receive Complete Callback */ HAL_UART_AbortReceiveCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief TX interrrupt handler for 7 or 8 bits data word length . * @note Function is called under interruption only, once * interruptions have been enabled by HAL_UART_Transmit_IT(). * @param huart UART handle. * @retval None */ static void UART_TxISR_8BIT(UART_HandleTypeDef *huart) { /* Check that a Tx process is ongoing */ if (huart->gState == HAL_UART_STATE_BUSY_TX) { if (huart->TxXferCount == 0U) { /* Disable the UART Transmit Data Register Empty Interrupt */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE); /* Enable the UART Transmit Complete Interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); } else { huart->Instance->TDR = (uint8_t)(*huart->pTxBuffPtr & (uint8_t)0xFF); huart->pTxBuffPtr++; huart->TxXferCount--; } } } /** * @brief TX interrrupt handler for 9 bits data word length. * @note Function is called under interruption only, once * interruptions have been enabled by HAL_UART_Transmit_IT(). * @param huart UART handle. * @retval None */ static void UART_TxISR_16BIT(UART_HandleTypeDef *huart) { uint16_t *tmp; /* Check that a Tx process is ongoing */ if (huart->gState == HAL_UART_STATE_BUSY_TX) { if (huart->TxXferCount == 0U) { /* Disable the UART Transmit Data Register Empty Interrupt */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE); /* Enable the UART Transmit Complete Interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); } else { tmp = (uint16_t *) huart->pTxBuffPtr; huart->Instance->TDR = (((uint32_t)(*tmp)) & 0x01FFUL); huart->pTxBuffPtr += 2U; huart->TxXferCount--; } } } /** * @brief Wrap up transmission in non-blocking mode. * @param huart pointer to a UART_HandleTypeDef structure that contains * the configuration information for the specified UART module. * @retval None */ static void UART_EndTransmit_IT(UART_HandleTypeDef *huart) { /* Disable the UART Transmit Complete Interrupt */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_TCIE); /* Tx process is ended, restore huart->gState to Ready */ huart->gState = HAL_UART_STATE_READY; /* Cleat TxISR function pointer */ huart->TxISR = NULL; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Tx complete callback*/ huart->TxCpltCallback(huart); #else /*Call legacy weak Tx complete callback*/ HAL_UART_TxCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } /** * @brief RX interrrupt handler for 7 or 8 bits data word length . * @param huart UART handle. * @retval None */ static void UART_RxISR_8BIT(UART_HandleTypeDef *huart) { uint16_t uhMask = huart->Mask; uint16_t uhdata; /* Check that a Rx process is ongoing */ if (huart->RxState == HAL_UART_STATE_BUSY_RX) { uhdata = (uint16_t) READ_REG(huart->Instance->RDR); *huart->pRxBuffPtr = (uint8_t)(uhdata & (uint8_t)uhMask); huart->pRxBuffPtr++; huart->RxXferCount--; if (huart->RxXferCount == 0U) { /* Disable the UART Parity Error Interrupt and RXNE interrupts */ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); /* Disable the UART Error Interrupt: (Frame error, noise error, overrun error) */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Rx process is completed, restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; /* Clear RxISR function pointer */ huart->RxISR = NULL; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Rx complete callback*/ huart->RxCpltCallback(huart); #else /*Call legacy weak Rx complete callback*/ HAL_UART_RxCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } else { /* Clear RXNE interrupt flag */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); } } /** * @brief RX interrrupt handler for 9 bits data word length . * @note Function is called under interruption only, once * interruptions have been enabled by HAL_UART_Receive_IT() * @param huart UART handle. * @retval None */ static void UART_RxISR_16BIT(UART_HandleTypeDef *huart) { uint16_t *tmp; uint16_t uhMask = huart->Mask; uint16_t uhdata; /* Check that a Rx process is ongoing */ if (huart->RxState == HAL_UART_STATE_BUSY_RX) { uhdata = (uint16_t) READ_REG(huart->Instance->RDR); tmp = (uint16_t *) huart->pRxBuffPtr ; *tmp = (uint16_t)(uhdata & uhMask); huart->pRxBuffPtr += 2U; huart->RxXferCount--; if (huart->RxXferCount == 0U) { /* Disable the UART Parity Error Interrupt and RXNE interrupt*/ CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); /* Disable the UART Error Interrupt: (Frame error, noise error, overrun error) */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); /* Rx process is completed, restore huart->RxState to Ready */ huart->RxState = HAL_UART_STATE_READY; /* Clear RxISR function pointer */ huart->RxISR = NULL; #if (USE_HAL_UART_REGISTER_CALLBACKS == 1) /*Call registered Rx complete callback*/ huart->RxCpltCallback(huart); #else /*Call legacy weak Rx complete callback*/ HAL_UART_RxCpltCallback(huart); #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ } } else { /* Clear RXNE interrupt flag */ __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); } } /** * @} */ #endif /* HAL_UART_MODULE_ENABLED */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbedmicro/mbed
targets/TARGET_STM/TARGET_STM32F7/STM32Cube_FW/STM32F7xx_HAL_Driver/stm32f7xx_hal_uart.c
C
apache-2.0
119,588
/* * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.plugins.gradle.action; import com.intellij.execution.RunManagerEx; import com.intellij.execution.RunnerAndConfigurationSettings; import com.intellij.execution.executors.DefaultRunExecutor; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.externalSystem.action.ExternalSystemAction; import com.intellij.openapi.externalSystem.action.ExternalSystemActionUtil; import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys; import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings; import com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo; import com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware; import com.intellij.openapi.externalSystem.service.notification.ExternalSystemNotificationManager; import com.intellij.openapi.externalSystem.service.notification.NotificationCategory; import com.intellij.openapi.externalSystem.service.notification.NotificationData; import com.intellij.openapi.externalSystem.service.notification.NotificationSource; import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil; import com.intellij.openapi.externalSystem.util.ExternalSystemUtil; import com.intellij.openapi.externalSystem.view.ExternalSystemNode; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.Function; import com.intellij.util.execution.ParametersListUtil; import org.gradle.cli.CommandLineArgumentException; import org.gradle.cli.CommandLineParser; import org.gradle.cli.ParsedCommandLine; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.gradle.service.execution.cmd.GradleCommandLineOptionsConverter; import org.jetbrains.plugins.gradle.service.task.ExecuteGradleTaskHistoryService; import org.jetbrains.plugins.gradle.service.task.GradleRunTaskDialog; import org.jetbrains.plugins.gradle.util.GradleConstants; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author Vladislav.Soroka * @since 11/25/2014 */ public class GradleExecuteTaskAction extends ExternalSystemAction { @Override protected boolean isVisible(AnActionEvent e) { if (!super.isVisible(e)) return false; return GradleConstants.SYSTEM_ID.equals(getSystemId(e)); } protected boolean isEnabled(AnActionEvent e) { return true; } @Override public void update(@NotNull AnActionEvent e) { Presentation p = e.getPresentation(); p.setVisible(isVisible(e)); p.setEnabled(isEnabled(e)); } @Override public void actionPerformed(@NotNull final AnActionEvent e) { final Project project = e.getRequiredData(CommonDataKeys.PROJECT); ExecuteGradleTaskHistoryService historyService = ExecuteGradleTaskHistoryService.getInstance(project); GradleRunTaskDialog dialog = new GradleRunTaskDialog(project, historyService.getHistory()); String lastWorkingDirectory = historyService.getWorkDirectory(); if (lastWorkingDirectory.length() == 0) { lastWorkingDirectory = obtainAppropriateWorkingDirectory(e); } dialog.setWorkDirectory(lastWorkingDirectory); if (StringUtil.isEmptyOrSpaces(historyService.getCanceledCommand())) { if (historyService.getHistory().size() > 0) { dialog.setCommandLine(historyService.getHistory().get(0)); } } else { dialog.setCommandLine(historyService.getCanceledCommand()); } if (!dialog.showAndGet()) { historyService.setCanceledCommand(dialog.getCommandLine()); return; } historyService.setCanceledCommand(null); String fullCommandLine = dialog.getCommandLine(); fullCommandLine = fullCommandLine.trim(); String workDirectory = dialog.getWorkDirectory(); historyService.addCommand(fullCommandLine, workDirectory); final ExternalTaskExecutionInfo taskExecutionInfo; try { taskExecutionInfo = buildTaskInfo(workDirectory, fullCommandLine); } catch (CommandLineArgumentException ex) { final NotificationData notificationData = new NotificationData( "<b>Command-line arguments cannot be parsed</b>", "<i>" + fullCommandLine + "</i> \n" + ex.getMessage(), NotificationCategory.WARNING, NotificationSource.TASK_EXECUTION ); notificationData.setBalloonNotification(true); ExternalSystemNotificationManager.getInstance(project).showNotification(GradleConstants.SYSTEM_ID, notificationData); return; } RunManagerEx runManager = RunManagerEx.getInstanceEx(project); ExternalSystemUtil.runTask(taskExecutionInfo.getSettings(), taskExecutionInfo.getExecutorId(), project, GradleConstants.SYSTEM_ID); RunnerAndConfigurationSettings configuration = ExternalSystemUtil.createExternalSystemRunnerAndConfigurationSettings(taskExecutionInfo.getSettings(), project, GradleConstants.SYSTEM_ID); if (configuration == null) return; final RunnerAndConfigurationSettings existingConfiguration = runManager.findConfigurationByName(configuration.getName()); if(existingConfiguration == null) { runManager.setTemporaryConfiguration(configuration); } else { runManager.setSelectedConfiguration(existingConfiguration); } } private static ExternalTaskExecutionInfo buildTaskInfo(@NotNull String projectPath, @NotNull String fullCommandLine) throws CommandLineArgumentException { CommandLineParser gradleCmdParser = new CommandLineParser(); GradleCommandLineOptionsConverter commandLineConverter = new GradleCommandLineOptionsConverter(); commandLineConverter.configure(gradleCmdParser); ParsedCommandLine parsedCommandLine = gradleCmdParser.parse(ParametersListUtil.parse(fullCommandLine, true)); final Map<String, List<String>> optionsMap = commandLineConverter.convert(parsedCommandLine, new HashMap<String, List<String>>()); final List<String> systemProperties = optionsMap.remove("system-prop"); final String vmOptions = systemProperties == null ? "" : StringUtil.join(systemProperties, new Function<String, String>() { @Override public String fun(String entry) { return "-D" + entry; } }, " "); final String scriptParameters = StringUtil.join(optionsMap.entrySet(), new Function<Map.Entry<String, List<String>>, String>() { @Override public String fun(Map.Entry<String, List<String>> entry) { final List<String> values = entry.getValue(); final String longOptionName = entry.getKey(); if (values != null && !values.isEmpty()) { return StringUtil.join(values, new Function<String, String>() { @Override public String fun(String entry) { return "--" + longOptionName + ' ' + entry; } }, " "); } else { return "--" + longOptionName; } } }, " "); final List<String> tasks = parsedCommandLine.getExtraArguments(); ExternalSystemTaskExecutionSettings settings = new ExternalSystemTaskExecutionSettings(); settings.setExternalProjectPath(projectPath); settings.setTaskNames(tasks); settings.setScriptParameters(scriptParameters); settings.setVmOptions(vmOptions); settings.setExternalSystemIdString(GradleConstants.SYSTEM_ID.toString()); return new ExternalTaskExecutionInfo(settings, DefaultRunExecutor.EXECUTOR_ID); } private static String obtainAppropriateWorkingDirectory(AnActionEvent e) { final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext()); if (selectedNodes == null || selectedNodes.size() != 1) { final Module module = ExternalSystemActionUtil.getModule(e.getDataContext()); String projectPath = ExternalSystemApiUtil.getExternalProjectPath(module); return projectPath == null ? "" : projectPath; } final ExternalSystemNode<?> node = selectedNodes.get(0); final Object externalData = node.getData(); if (externalData instanceof ExternalConfigPathAware) { return ((ExternalConfigPathAware)externalData).getLinkedExternalProjectPath(); } else { final ExternalConfigPathAware parentExternalConfigPathAware = node.findParentData(ExternalConfigPathAware.class); return parentExternalConfigPathAware != null ? parentExternalConfigPathAware.getLinkedExternalProjectPath() : ""; } } }
akosyakov/intellij-community
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleExecuteTaskAction.java
Java
apache-2.0
9,266
/* * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.cli.compiler.grape; import java.io.File; import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import groovy.lang.GroovyClassLoader; import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.repository.Authentication; import org.eclipse.aether.repository.RemoteRepository; import org.junit.jupiter.api.Test; import org.springframework.boot.cli.compiler.dependencies.SpringBootDependenciesDependencyManagement; import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; /** * Tests for {@link AetherGrapeEngine}. * * @author Andy Wilkinson */ class AetherGrapeEngineTests { private final GroovyClassLoader groovyClassLoader = new GroovyClassLoader(); private final RepositoryConfiguration springMilestone = new RepositoryConfiguration("spring-milestone", URI.create("https://repo.spring.io/milestone"), false); private final RepositoryConfiguration springSnapshot = new RepositoryConfiguration("spring-snapshot", URI.create("https://repo.spring.io/snapshot"), true); private AetherGrapeEngine createGrapeEngine(RepositoryConfiguration... additionalRepositories) { List<RepositoryConfiguration> repositoryConfigurations = new ArrayList<>(); repositoryConfigurations .add(new RepositoryConfiguration("central", URI.create("https://repo1.maven.org/maven2"), false)); repositoryConfigurations.addAll(Arrays.asList(additionalRepositories)); DependencyResolutionContext dependencyResolutionContext = new DependencyResolutionContext(); dependencyResolutionContext.addDependencyManagement(new SpringBootDependenciesDependencyManagement()); return AetherGrapeEngineFactory.create(this.groovyClassLoader, repositoryConfigurations, dependencyResolutionContext, false); } @Test void dependencyResolution() { Map<String, Object> args = new HashMap<>(); createGrapeEngine(this.springMilestone, this.springSnapshot).grab(args, createDependency("org.springframework", "spring-jdbc", null)); assertThat(this.groovyClassLoader.getURLs()).hasSize(5); } @Test void proxySelector() { doWithCustomUserHome(() -> { AetherGrapeEngine grapeEngine = createGrapeEngine(); DefaultRepositorySystemSession session = (DefaultRepositorySystemSession) ReflectionTestUtils .getField(grapeEngine, "session"); assertThat(session.getProxySelector() instanceof CompositeProxySelector).isTrue(); }); } @Test void repositoryMirrors() { doWithCustomUserHome(() -> { List<RemoteRepository> repositories = getRepositories(); assertThat(repositories).hasSize(1); assertThat(repositories.get(0).getId()).isEqualTo("central-mirror"); }); } @Test void repositoryAuthentication() { doWithCustomUserHome(() -> { List<RemoteRepository> repositories = getRepositories(); assertThat(repositories).hasSize(1); Authentication authentication = repositories.get(0).getAuthentication(); assertThat(authentication).isNotNull(); }); } @Test void dependencyResolutionWithExclusions() { Map<String, Object> args = new HashMap<>(); args.put("excludes", Arrays.asList(createExclusion("org.springframework", "spring-core"))); createGrapeEngine(this.springMilestone, this.springSnapshot).grab(args, createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE"), createDependency("org.springframework", "spring-beans", "3.2.4.RELEASE")); assertThat(this.groovyClassLoader.getURLs()).hasSize(3); } @Test void nonTransitiveDependencyResolution() { Map<String, Object> args = new HashMap<>(); createGrapeEngine().grab(args, createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE", false)); assertThat(this.groovyClassLoader.getURLs()).hasSize(1); } @Test void dependencyResolutionWithCustomClassLoader() { Map<String, Object> args = new HashMap<>(); GroovyClassLoader customClassLoader = new GroovyClassLoader(); args.put("classLoader", customClassLoader); createGrapeEngine(this.springMilestone, this.springSnapshot).grab(args, createDependency("org.springframework", "spring-jdbc", null)); assertThat(this.groovyClassLoader.getURLs()).isEmpty(); assertThat(customClassLoader.getURLs()).hasSize(5); } @Test void resolutionWithCustomResolver() { Map<String, Object> args = new HashMap<>(); AetherGrapeEngine grapeEngine = createGrapeEngine(); grapeEngine.addResolver(createResolver("spring-releases", "https://repo.spring.io/release")); Map<String, Object> dependency = createDependency("io.spring.docresources", "spring-doc-resources", "0.1.1.RELEASE"); dependency.put("ext", "zip"); grapeEngine.grab(args, dependency); assertThat(this.groovyClassLoader.getURLs()).hasSize(1); } @Test void differingTypeAndExt() { Map<String, Object> dependency = createDependency("org.grails", "grails-dependencies", "2.4.0"); dependency.put("type", "foo"); dependency.put("ext", "bar"); AetherGrapeEngine grapeEngine = createGrapeEngine(); assertThatIllegalArgumentException().isThrownBy(() -> grapeEngine.grab(Collections.emptyMap(), dependency)); } @Test void pomDependencyResolutionViaType() { Map<String, Object> args = new HashMap<>(); Map<String, Object> dependency = createDependency("org.springframework", "spring-framework-bom", "4.0.5.RELEASE"); dependency.put("type", "pom"); createGrapeEngine().grab(args, dependency); URL[] urls = this.groovyClassLoader.getURLs(); assertThat(urls).hasSize(1); assertThat(urls[0].toExternalForm().endsWith(".pom")).isTrue(); } @Test void pomDependencyResolutionViaExt() { Map<String, Object> args = new HashMap<>(); Map<String, Object> dependency = createDependency("org.springframework", "spring-framework-bom", "4.0.5.RELEASE"); dependency.put("ext", "pom"); createGrapeEngine().grab(args, dependency); URL[] urls = this.groovyClassLoader.getURLs(); assertThat(urls).hasSize(1); assertThat(urls[0].toExternalForm().endsWith(".pom")).isTrue(); } @Test void resolutionWithClassifier() { Map<String, Object> args = new HashMap<>(); Map<String, Object> dependency = createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE", false); dependency.put("classifier", "sources"); createGrapeEngine().grab(args, dependency); URL[] urls = this.groovyClassLoader.getURLs(); assertThat(urls).hasSize(1); assertThat(urls[0].toExternalForm().endsWith("-sources.jar")).isTrue(); } @SuppressWarnings("unchecked") private List<RemoteRepository> getRepositories() { AetherGrapeEngine grapeEngine = createGrapeEngine(); return (List<RemoteRepository>) ReflectionTestUtils.getField(grapeEngine, "repositories"); } private Map<String, Object> createDependency(String group, String module, String version) { Map<String, Object> dependency = new HashMap<>(); dependency.put("group", group); dependency.put("module", module); dependency.put("version", version); return dependency; } private Map<String, Object> createDependency(String group, String module, String version, boolean transitive) { Map<String, Object> dependency = createDependency(group, module, version); dependency.put("transitive", transitive); return dependency; } private Map<String, Object> createResolver(String name, String url) { Map<String, Object> resolver = new HashMap<>(); resolver.put("name", name); resolver.put("root", url); return resolver; } private Map<String, Object> createExclusion(String group, String module) { Map<String, Object> exclusion = new HashMap<>(); exclusion.put("group", group); exclusion.put("module", module); return exclusion; } private void doWithCustomUserHome(Runnable action) { doWithSystemProperty("user.home", new File("src/test/resources").getAbsolutePath(), action); } private void doWithSystemProperty(String key, String value, Runnable action) { String previousValue = setOrClearSystemProperty(key, value); try { action.run(); } finally { setOrClearSystemProperty(key, previousValue); } } private String setOrClearSystemProperty(String key, String value) { if (value != null) { return System.setProperty(key, value); } return System.clearProperty(key); } }
mdeinum/spring-boot
spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java
Java
apache-2.0
9,073
0.0.2 / 2012-12-12 ================== * fix single quotes
tartanguru/alexa-google-search
src/node_modules/x-ray/node_modules/x-ray-parse/node_modules/format-parser/History.md
Markdown
apache-2.0
63
package x; class Ref { String ref; void foo() { String f= "blah" + "ref" + "blah" + "ref"+ref; } }
jwren/intellij-community
java/java-tests/testData/psi/search/findUsages/findUsagesMustNotSwallow/x/Ref.java
Java
apache-2.0
111
// Generated by esidl 0.2.1. // This file is expected to be modified for the Web IDL interface // implementation. Permission to use, copy, modify and distribute // this file in any software license is hereby granted. #ifndef ORG_W3C_DOM_BOOTSTRAP_FLOAT64ARRAYIMP_H_INCLUDED #define ORG_W3C_DOM_BOOTSTRAP_FLOAT64ARRAYIMP_H_INCLUDED #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <org/w3c/dom/typedarray/Float64Array.h> #include "ArrayBufferViewImp.h" #include <org/w3c/dom/typedarray/ArrayBuffer.h> #include <org/w3c/dom/typedarray/ArrayBufferView.h> #include <org/w3c/dom/typedarray/Float64Array.h> namespace org { namespace w3c { namespace dom { namespace bootstrap { class Float64ArrayImp : public ObjectMixin<Float64ArrayImp, ArrayBufferViewImp> { public: // Float64Array unsigned int getLength(); double get(unsigned int index); void set(unsigned int index, double value); void set(typedarray::Float64Array array); void set(typedarray::Float64Array array, unsigned int offset); void set(ObjectArray<double> array); void set(ObjectArray<double> array, unsigned int offset); typedarray::Float64Array subarray(int start, int end); // Object virtual Any message_(uint32_t selector, const char* id, int argc, Any* argv) { return typedarray::Float64Array::dispatch(this, selector, id, argc, argv); } static const char* const getMetaData() { return typedarray::Float64Array::getMetaData(); } }; } } } } #endif // ORG_W3C_DOM_BOOTSTRAP_FLOAT64ARRAYIMP_H_INCLUDED
LambdaLord/es-operating-system
escort/src/typedarray/Float64ArrayImp.h
C
apache-2.0
1,558
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.cli; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.metastore.MetaStoreClient; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.hive.ql.CommandProcessor; public class MetadataProcessor implements CommandProcessor { public int run(String command) { SessionState ss = SessionState.get(); String table_name = command.trim(); if(table_name.equals("")) { return 0; } try { MetaStoreClient msc = new MetaStoreClient(ss.getConf()); if(!msc.tableExists(table_name)) { ss.err.println("table does not exist: " + table_name); return 1; } else { List<FieldSchema> fields = msc.get_fields(table_name); for(FieldSchema f: fields) { ss.out.println(f.getName() + ": " + f.getType()); } } } catch (MetaException err) { ss.err.println("Got meta exception: " + err.getMessage()); return 1; } catch (Exception err) { ss.err.println("Got exception: " + err.getMessage()); return 1; } return 0; } }
sbyoun/i-mapreduce
src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/MetadataProcessor.java
Java
apache-2.0
2,074
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.partial import org.apache.spark._ import org.apache.spark.rdd.RDD import org.apache.spark.scheduler.JobListener /** * A JobListener for an approximate single-result action, such as count() or non-parallel reduce(). * This listener waits up to timeout milliseconds and will return a partial answer even if the * complete answer is not available by then. * * This class assumes that the action is performed on an entire RDD[T] via a function that computes * a result of type U for each partition, and that the action returns a partial or complete result * of type R. Note that the type R must *include* any error bars on it (e.g. see BoundedInt). */ private[spark] class ApproximateActionListener[T, U, R]( rdd: RDD[T], func: (TaskContext, Iterator[T]) => U, evaluator: ApproximateEvaluator[U, R], timeout: Long) extends JobListener { val startTime = System.currentTimeMillis() val totalTasks = rdd.partitions.size var finishedTasks = 0 var failure: Option[Exception] = None // Set if the job has failed (permanently) var resultObject: Option[PartialResult[R]] = None // Set if we've already returned a PartialResult override def taskSucceeded(index: Int, result: Any) { synchronized { evaluator.merge(index, result.asInstanceOf[U]) finishedTasks += 1 if (finishedTasks == totalTasks) { // If we had already returned a PartialResult, set its final value resultObject.foreach(r => r.setFinalValue(evaluator.currentResult())) // Notify any waiting thread that may have called awaitResult this.notifyAll() } } } override def jobFailed(exception: Exception) { synchronized { failure = Some(exception) this.notifyAll() } } /** * Waits for up to timeout milliseconds since the listener was created and then returns a * PartialResult with the result so far. This may be complete if the whole job is done. */ def awaitResult(): PartialResult[R] = synchronized { val finishTime = startTime + timeout while (true) { val time = System.currentTimeMillis() if (failure.isDefined) { throw failure.get } else if (finishedTasks == totalTasks) { return new PartialResult(evaluator.currentResult(), true) } else if (time >= finishTime) { resultObject = Some(new PartialResult(evaluator.currentResult(), false)) return resultObject.get } else { this.wait(finishTime - time) } } // Should never be reached, but required to keep the compiler happy return null } }
yelshater/hadoop-2.3.0
spark-core_2.10-1.0.0-cdh5.1.0/src/main/scala/org/apache/spark/partial/ApproximateActionListener.scala
Scala
apache-2.0
3,425
/* * Copyright 2013, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "sky/engine/core/css/parser/CSSParserValues.h" #include <gtest/gtest.h> using namespace blink; namespace { TEST(CSSParserValuesTest, InitWithEmpty8BitsString) { String string8bit("a"); CSSParserString cssParserString; cssParserString.init(string8bit, 1, 0); ASSERT_EQ(0u, cssParserString.length()); } TEST(CSSParserValuesTest, InitWithEmpty16BitsString) { String string16bit("a"); string16bit.ensure16Bit(); CSSParserString cssParserString; cssParserString.init(string16bit, 1, 0); ASSERT_EQ(0u, cssParserString.length()); } TEST(CSSParserValuesTest, EqualIgnoringCase8BitsString) { CSSParserString cssParserString; String string8bit("sHaDOw"); cssParserString.init(string8bit, 0, string8bit.length()); ASSERT_TRUE(cssParserString.equalIgnoringCase("shadow")); ASSERT_TRUE(cssParserString.equalIgnoringCase("ShaDow")); ASSERT_FALSE(cssParserString.equalIgnoringCase("shadow-all")); ASSERT_FALSE(cssParserString.equalIgnoringCase("sha")); ASSERT_FALSE(cssParserString.equalIgnoringCase("abCD")); } TEST(CSSParserValuesTest, EqualIgnoringCase16BitsString) { String string16bit("sHaDOw"); string16bit.ensure16Bit(); CSSParserString cssParserString; cssParserString.init(string16bit, 0, string16bit.length()); ASSERT_TRUE(cssParserString.equalIgnoringCase("shadow")); ASSERT_TRUE(cssParserString.equalIgnoringCase("ShaDow")); ASSERT_FALSE(cssParserString.equalIgnoringCase("shadow-all")); ASSERT_FALSE(cssParserString.equalIgnoringCase("sha")); ASSERT_FALSE(cssParserString.equalIgnoringCase("abCD")); } TEST(CSSParserValuesTest, CSSParserValuelistClear) { CSSParserValueList list; for (int i = 0; i < 3; ++i) { CSSParserValue value; value.setFromNumber(3); list.addValue(value); } list.clearAndLeakValues(); ASSERT_FALSE(list.size()); ASSERT_FALSE(list.currentIndex()); } } // namespace
mdakin/engine
sky/engine/core/css/parser/CSSParserValuesTest.cpp
C++
bsd-3-clause
3,520
using System.Reflection; using System.Runtime.InteropServices; using System.Security; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Orchard.Media")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Orchard")] [assembly: AssemblyCopyright("Copyright © Outercurve Foundation 2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("26ae646f-4561-40f8-bd01-0962c9e52343")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.8")] [assembly: AssemblyFileVersion("1.8")]
Cphusion/Orchard
src/Orchard.Web/Modules/Orchard.Media/Properties/AssemblyInfo.cs
C#
bsd-3-clause
1,357
<!DOCTYPE html> <meta charset="utf-8"> <title>Testing Available Space in Orthogonal Flows / ICB / tall height scroller</title> <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/"> <link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-auto"> <link rel="match" href="reference/available-size-002-ref.html"> <meta name="assert" content="When an orthogonal flow's parent doesn't have a definite block size, and there's a scroller with height, but that scroller is taller than the ICB, use the ICB instead."> <style> body { margin-top: 0; margin-bottom: 0; } /* Shouldn't matter, but in some browsers does. -007 tests this aspect specifically. */ :root { overflow: hidden; } #ortho { writing-mode: vertical-rl; font-family: monospace; font-size: 20px; position: relative; /* to be a container for #red*/ } .spacer { /* using 5 spacers of 20vh each instead of a single large one, so that the line would wrap between spacers if it ends up being shorter than 100vh*/ display: inline-block; height: calc(20vh - 0.1px); /*Using this instead of 20vh, to account for accumulation of rounding errors, that might make 5*20vh taller than 100vh in some browsers*/ } span { background: green; display: inline-block; /* This should not change it's size or position, but makes the size of the background predictable*/ color: transparent; } #red { /* Not necessary when when comparing to the reference, but makes human judgement easier */ position: absolute; background: red; writing-mode: vertical-rl; z-index: -1; font-family: monospace; font-size: 20px; left: 0; top: 0; } #scroller { overflow: hidden; writing-mode: vertical-lr; height: 120vh; } #parent { writing-mode: horizontal-tb; width: 8em; /* avoid triggering intrinsic sizing bugs */ } </style> <p>Test passes if there is a <strong>green rectangle</strong> below and <strong>no red</strong>. <div id=scroller> <div id=parent> <div id=ortho><aside id="red">0</aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside><aside class="spacer"></aside> <span>0</span></div> </div> </div>
chromium/chromium
third_party/blink/web_tests/external/wpt/css/css-writing-modes/available-size-009.html
HTML
bsd-3-clause
2,372
using Orchard.ContentManagement.MetaData; using Orchard.Data.Migration; namespace Orchard.Search { public class SearchDataMigration : DataMigrationImpl { public int Create() { SchemaBuilder.CreateTable("SearchSettingsPartRecord", table => table .ContentPartRecord() .Column<bool>("FilterCulture") .Column<string>("SearchedFields", c => c.Unlimited()) ); ContentDefinitionManager.AlterTypeDefinition("SearchForm", cfg => cfg .WithPart("SearchFormPart") .WithPart("CommonPart") .WithPart("WidgetPart") .WithSetting("Stereotype", "Widget") ); return 1; } } }
BankNotes/Web
src/Orchard.Web/Modules/Orchard.Search/Migrations.cs
C#
bsd-3-clause
832
// Filename: littleEndian.h // Created by: drose (09Feb00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef LITTLEENDIAN_H #define LITTLEENDIAN_H #include "dtoolbase.h" #include "numeric_types.h" #include "nativeNumericData.h" #include "reversedNumericData.h" //////////////////////////////////////////////////////////////////// // Class : LittleEndian // Description : LittleEndian is a special class that automatically // reverses the byte-order of numeric values for // big-endian machines, and passes them through // unchanged for little-endian machines. //////////////////////////////////////////////////////////////////// #ifdef WORDS_BIGENDIAN typedef ReversedNumericData LittleEndian; #else typedef NativeNumericData LittleEndian; #endif #endif
toontownfunserver/Panda3D-1.9.0
include/littleEndian.h
C
bsd-3-clause
1,195
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.tab; import android.test.suitebuilder.annotation.SmallTest; import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.Tab; import org.chromium.chrome.shell.ChromeShellTestBase; /** * Tests related to the sad tab logic. */ public class SadTabTest extends ChromeShellTestBase { /** * Verify that the sad tab is shown when the renderer crashes. */ @SmallTest @Feature({"SadTab"}) public void testSadTabShownWhenRendererProcessKilled() { launchChromeShellWithBlankPage(); final Tab tab = getActivity().getActiveTab(); assertFalse(tab.isShowingSadTab()); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override public void run() { tab.simulateRendererKilledForTesting(true); } }); assertTrue(tab.isShowingSadTab()); } /** * Verify that the sad tab is not shown when the renderer crashes in the background or the * renderer was killed by the OS out-of-memory killer. */ @SmallTest @Feature({"SadTab"}) public void testSadTabNotShownWhenRendererProcessKilledInBackround() { launchChromeShellWithBlankPage(); final Tab tab = getActivity().getActiveTab(); assertFalse(tab.isShowingSadTab()); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override public void run() { tab.simulateRendererKilledForTesting(false); } }); assertFalse(tab.isShowingSadTab()); } }
guorendong/iridium-browser-ubuntu
chrome/android/javatests_shell/src/org/chromium/chrome/browser/tab/SadTabTest.java
Java
bsd-3-clause
1,799
// Filename: queuedConnectionListener.h // Created by: drose (09Feb00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef QUEUEDCONNECTIONLISTENER_H #define QUEUEDCONNECTIONLISTENER_H #include "pandabase.h" #include "connectionListener.h" #include "connection.h" #include "netAddress.h" #include "queuedReturn.h" #include "pdeque.h" class EXPCL_PANDA_NET ConnectionListenerData { public: // We need these methods to make VC++ happy when we try to // instantiate the template, below. They don't do anything useful. INLINE bool operator == (const ConnectionListenerData &other) const; INLINE bool operator != (const ConnectionListenerData &other) const; INLINE bool operator < (const ConnectionListenerData &other) const; PT(Connection) _rendezvous; NetAddress _address; PT(Connection) _new_connection; }; EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_NET, EXPTP_PANDA_NET, QueuedReturn<ConnectionListenerData>); //////////////////////////////////////////////////////////////////// // Class : QueuedConnectionListener // Description : This flavor of ConnectionListener will queue up all // of the TCP connections it established for later // detection by the client code. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NET QueuedConnectionListener : public ConnectionListener, public QueuedReturn<ConnectionListenerData> { PUBLISHED: QueuedConnectionListener(ConnectionManager *manager, int num_threads); virtual ~QueuedConnectionListener(); BLOCKING bool new_connection_available(); bool get_new_connection(PT(Connection) &rendezvous, NetAddress &address, PT(Connection) &new_connection); bool get_new_connection(PT(Connection) &new_connection); protected: virtual void connection_opened(const PT(Connection) &rendezvous, const NetAddress &address, const PT(Connection) &new_connection); }; #include "queuedConnectionListener.I" #endif
matthiascy/panda3d
panda/src/net/queuedConnectionListener.h
C
bsd-3-clause
2,475
/* http://localhost:1843/modern/theme-base/sass/src/scroll/Indicator.scss:1 */ .x-scroll-indicator { position: absolute; z-index: 3; background-color: #000; opacity: 0.5; border-radius: 3px; margin: 2px; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/Indicator.scss:11 */ .x-scroll-indicator-x { bottom: 0; left: 0; height: 6px; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/Indicator.scss:17 */ .x-scroll-indicator-y { right: 0; top: 0; width: 6px; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/Indicator.scss:25 */ .x-list-light .x-scroll-indicator, .x-dataview-light .x-scroll-indicator { background: #fff; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/TouchScroller.scss:1 */ .x-scroll-view { position: relative; display: block; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/TouchScroller.scss:7 */ .x-scroll-container { position: absolute; width: 100%; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/TouchScroller.scss:13 */ .x-scroll-scroller { position: absolute; min-width: 100%; min-height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/scroll/TouchScroller.scss:21 */ .x-scroll-scroller:not(.x-grid-scrollelement) { height: auto !important; width: auto !important; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:1 */ html, body { font-family: "Helvetica Neue", HelveticaNeue, "Helvetica-Neue", Helvetica, "BBAlpha Sans", sans-serif; font-weight: normal; -webkit-text-size-adjust: none; margin: 0; cursor: default; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:10 */ body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td { margin: 0; padding: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:17 */ table { border-collapse: collapse; border-spacing: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:22 */ fieldset, img { border: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:26 */ address, caption, cite, code, dfn, em, strong, th, var { font-style: normal; font-weight: normal; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:31 */ li { list-style: none; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:35 */ caption, th { text-align: left; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:39 */ h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: normal; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:44 */ q:before, q:after { content: ''; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:49 */ abbr, acronym { border: 0; font-variant: normal; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:54 */ sup { vertical-align: text-top; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:58 */ sub { vertical-align: text-bottom; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:62 */ input, textarea, select { font-family: inherit; font-size: inherit; font-weight: inherit; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:68 */ *:focus { outline: none; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:72 */ body.x-desktop { overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:76 */ @-ms-viewport { width: device-width; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:80 */ *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-drag: none; -webkit-user-select: none; -ms-user-select: none; -ms-touch-action: none; -moz-user-select: -moz-none; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:91 */ input, textarea { -webkit-user-select: text; -ms-user-select: auto; -moz-user-select: text; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:97 */ .x-hidden-visibility { visibility: hidden !important; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:101 */ .x-hidden-display, .x-field-hidden { display: none !important; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:105 */ .x-hidden-offsets { position: absolute !important; left: -10000em; top: -10000em; visibility: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:112 */ .x-no-touch-scroll { touch-action: none; -ms-touch-action: none; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:121 */ .x-html { -webkit-user-select: auto; -webkit-touch-callout: inherit; -ms-user-select: auto; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:126 */ .x-html ul li { list-style-type: circle; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:129 */ .x-html ol li { list-style-type: decimal; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:134 */ @-webkit-keyframes x-loading-spinner-rotate { /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:135 */ 0% { -webkit-transform: rotate(0deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:136 */ 8.32% { -webkit-transform: rotate(0deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:138 */ 8.33% { -webkit-transform: rotate(30deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:139 */ 16.65% { -webkit-transform: rotate(30deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:141 */ 16.66% { -webkit-transform: rotate(60deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:142 */ 24.99% { -webkit-transform: rotate(60deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:144 */ 25% { -webkit-transform: rotate(90deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:145 */ 33.32% { -webkit-transform: rotate(90deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:147 */ 33.33% { -webkit-transform: rotate(120deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:148 */ 41.65% { -webkit-transform: rotate(120deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:150 */ 41.66% { -webkit-transform: rotate(150deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:151 */ 49.99% { -webkit-transform: rotate(150deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:153 */ 50% { -webkit-transform: rotate(180deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:154 */ 58.32% { -webkit-transform: rotate(180deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:156 */ 58.33% { -webkit-transform: rotate(210deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:157 */ 66.65% { -webkit-transform: rotate(210deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:159 */ 66.66% { -webkit-transform: rotate(240deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:160 */ 74.99% { -webkit-transform: rotate(240deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:162 */ 75% { -webkit-transform: rotate(270deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:163 */ 83.32% { -webkit-transform: rotate(270deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:165 */ 83.33% { -webkit-transform: rotate(300deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:166 */ 91.65% { -webkit-transform: rotate(300deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:168 */ 91.66% { -webkit-transform: rotate(330deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:169 */ 100% { -webkit-transform: rotate(330deg); } } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:172 */ @keyframes x-loading-spinner-rotate { /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:173 */ 0% { -ms-transform: rotate(0deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:174 */ 8.32% { -ms-transform: rotate(0deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:176 */ 8.33% { -ms-transform: rotate(30deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:177 */ 16.65% { -ms-transform: rotate(30deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:179 */ 16.66% { -ms-transform: rotate(60deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:180 */ 24.99% { -ms-transform: rotate(60deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:182 */ 25% { -ms-transform: rotate(90deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:183 */ 33.32% { -ms-transform: rotate(90deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:185 */ 33.33% { -ms-transform: rotate(120deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:186 */ 41.65% { -ms-transform: rotate(120deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:188 */ 41.66% { -ms-transform: rotate(150deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:189 */ 49.99% { -ms-transform: rotate(150deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:191 */ 50% { -ms-transform: rotate(180deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:192 */ 58.32% { -ms-transform: rotate(180deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:194 */ 58.33% { -ms-transform: rotate(210deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:195 */ 66.65% { -ms-transform: rotate(210deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:197 */ 66.66% { -ms-transform: rotate(240deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:198 */ 74.99% { -ms-transform: rotate(240deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:200 */ 75% { -ms-transform: rotate(270deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:201 */ 83.32% { -ms-transform: rotate(270deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:203 */ 83.33% { -ms-transform: rotate(300deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:204 */ 91.65% { -ms-transform: rotate(300deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:206 */ 91.66% { -ms-transform: rotate(330deg); } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:207 */ 100% { -ms-transform: rotate(330deg); } } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:210 */ .x-shim { position: absolute; left: 0; top: 0; overflow: hidden; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Component.scss:218 */ .x-css-shadow { position: absolute; -webkit-border-radius: 5px; -moz-border-radius: 5px; -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Abstract.scss:1 */ html, body { position: relative; width: 100%; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Abstract.scss:8 */ .x-fullscreen { position: absolute !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Abstract.scss:12 */ .x-body { position: relative; z-index: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Abstract.scss:17 */ .x-inner, .x-body { width: 100%; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Abstract.scss:23 */ .x-sized { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Abstract.scss:27 */ .x-innerhtml { width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:5 */ .x-layout-box { display: flex; display: -webkit-box; display: -ms-flexbox; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:8 */ .x-layout-box.x-horizontal { -webkit-box-orient: horizontal !important; -ms-flex-direction: row !important; flex-direction: row !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:11 */ .x-layout-box.x-horizontal > .x-layout-box-item.x-flexed { min-width: 0 !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:16 */ .x-layout-box.x-vertical { -webkit-box-orient: vertical !important; -ms-flex-direction: column !important; flex-direction: column !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:19 */ .x-layout-box.x-vertical > .x-layout-box-item.x-flexed { min-height: 0 !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:24 */ .x-layout-box > .x-layout-box-item { display: flex; display: -webkit-box; display: -ms-flexbox; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:28 */ .x-layout-box.x-align-start { -webkit-box-align: start; -ms-flex-align: start; align-items: flex-start; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:32 */ .x-layout-box.x-align-center { -webkit-box-align: center; -ms-flex-align: center; align-items: center; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:36 */ .x-layout-box.x-align-end { -webkit-box-align: end; -ms-flex-align: end; align-items: flex-end; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:40 */ .x-layout-box.x-align-stretch { -webkit-box-align: stretch; -ms-flex-align: stretch; align-items: stretch; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:44 */ .x-layout-box.x-pack-start { -webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:48 */ .x-layout-box.x-pack-center { -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:52 */ .x-layout-box.x-pack-end { -webkit-box-pack: end; -ms-flex-pack: end; justify-content: flex-end; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:56 */ .x-layout-box.x-pack-justify { -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:62 */ .x-layout-box-item.x-sized > .x-inner, .x-layout-box-item.x-sized > .x-body, .x-layout-box-item.x-sized > .x-dock-outer { width: auto; height: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:71 */ .x-webkit .x-layout-box.x-horizontal > .x-layout-box-item.x-flexed { width: 0 !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:75 */ .x-webkit .x-layout-box.x-vertical > .x-layout-box-item.x-flexed { height: 0 !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:84 */ .x-firefox .x-stretched.x-dock-horizontal > .x-dock-body { width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:90 */ .x-firefox .x-stretched.x-dock-vertical > .x-dock-body { height: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:98 */ .x-firefox .x-container .x-dock-horizontal.x-unsized .x-dock-body { -webkit-box-flex: 1; -ms-flex: 1 0 0px; flex: 1 0 0px; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Box.scss:107 */ .x-firefox .x-has-height > .x-dock.x-unsized.x-dock-vertical > .x-dock-body { height: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Card.scss:5 */ .x-layout-card { position: relative; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Card.scss:10 */ .x-layout-card-perspective { -webkit-perspective: 1000px; -ms-perspective: 1000px; perspective: 1000px; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Card.scss:16 */ .x-layout-card-item-container { width: auto; height: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Card.scss:20 */ .x-layout-card-item { position: absolute; top: 0; right: 0; bottom: 0; left: 0; position: absolute !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:5 */ .x-stretched.x-container { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:9 */ .x-stretched.x-container > .x-inner, .x-stretched.x-container > .x-body, .x-stretched.x-container > .x-body > .x-inner { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; min-height: 0px; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:18 */ .x-layout-fit.x-stretched > .x-layout-fit-item { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:25 */ .x-layout-fit { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:30 */ .x-layout-fit-item.x-sized { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:34 */ .x-layout-fit-item.x-unsized { width: 100%; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Fit.scss:44 */ .x-ie .x-stretched > .x-inner, .x-ie .x-stretched > .x-body { min-height: inherit; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:5 */ .x-center, .x-centered { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:12 */ .x-center > *, .x-centered > * { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:16 */ .x-center > .x-floating, .x-centered > .x-floating { position: relative !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:21 */ .x-floating { position: absolute !important; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:25 */ .x-layout-float { overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:28 */ .x-layout-float > .x-layout-float-item { float: left; } /* http://localhost:1843/modern/theme-base/sass/src/layout/Float.scss:33 */ .x-layout-float.x-direction-right > .x-layout-float-item { float: right; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:5 */ .x-mask { min-width: 8.5em; position: absolute; top: 0; left: 0; bottom: 0; right: 0; height: 100%; z-index: 10; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; background: rgba(0, 0, 0, 0.3) center center no-repeat; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:22 */ .x-mask.x-mask-gray { background-color: rgba(0, 0, 0, 0.5); } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:26 */ .x-mask.x-mask-transparent { background-color: transparent; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:30 */ .x-mask .x-mask-inner { position: relative; background: rgba(0, 0, 0, 0.25); color: #fff; text-align: center; padding: .4em; font-size: .95em; font-weight: bold; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:40 */ .x-mask .x-loading-spinner-outer { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; width: 100%; min-width: 8em; height: 8em; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:51 */ .x-mask.x-indicator-hidden .x-mask-inner { padding-bottom: 0 !important; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:54 */ .x-mask.x-indicator-hidden .x-loading-spinner-outer { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:58 */ .x-mask.x-indicator-hidden .x-mask-message { position: relative; bottom: .25em; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:64 */ .x-mask .x-mask-message { position: absolute; bottom: 5px; color: #333; left: 0; right: 0; -webkit-box-flex: 0; -ms-flex: 0 0 auto; flex: 0 0 auto; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:74 */ .x-mask.x-has-message .x-mask-inner { padding-bottom: 2em; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:78 */ .x-mask.x-has-message .x-loading-spinner-outer { height: 168px; } /* http://localhost:1843/modern/theme-base/sass/src/Mask.scss:94 */ .x-ie .x-mask[visibility='visible'] ~ div:not(.x-mask) .x-input-el, .x-ie .x-mask[visibility='visible'] ~ div:not(.x-panel) .x-input-el, .x-ie .x-mask[visibility='visible'] ~ div:not(.x-floating) .x-input-el, .x-ie .x-mask[visibility='visible'] ~ div:not(.x-center) .x-input-el, .x-ie .x-mask[visibility='visible'] ~ div:not(.x-msgbox) .x-input-el, .x-ie .x-mask:not(.x-item-hidden) ~ div:not(.x-mask) .x-input-el, .x-ie .x-mask:not(.x-item-hidden) ~ div:not(.x-panel) .x-input-el, .x-ie .x-mask:not(.x-item-hidden) ~ div:not(.x-floating) .x-input-el, .x-ie .x-mask:not(.x-item-hidden) ~ div:not(.x-center) .x-input-el, .x-ie .x-mask:not(.x-item-hidden) ~ div:not(.x-msgbox) .x-input-el { visibility: collapse; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:5 */ .x-dock { display: flex; display: -webkit-box; display: -ms-flexbox; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:8 */ .x-dock > .x-dock-body { overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:12 */ .x-dock.x-sized, .x-dock.x-sized > .x-dock-body > *, .x-dock.x-sized > .x-dock-body > .x-body > .x-inner { width: auto; height: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:17 */ .x-dock.x-sized > .x-dock-body { position: relative; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:25 */ .x-dock.x-unsized, .x-dock.x-stretched { height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:29 */ .x-dock.x-unsized > .x-dock-body, .x-dock.x-stretched > .x-dock-body { position: relative; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:37 */ .x-dock.x-unsized > .x-dock-body > *, .x-dock.x-stretched > .x-dock-body > * { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:45 */ .x-dock.x-dock-vertical { -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:49 */ .x-dock.x-dock-horizontal { -webkit-box-orient: horizontal !important; -ms-flex-direction: row !important; flex-direction: row !important; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:52 */ .x-dock.x-dock-horizontal > .x-dock-item { display: flex; display: -webkit-box; display: -ms-flexbox; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:56 */ .x-dock.x-dock-horizontal > .x-dock-item.x-sized > .x-inner, .x-dock.x-dock-horizontal > .x-dock-item.x-sized > .x-body { width: auto; height: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:61 */ .x-dock.x-dock-horizontal > .x-dock-item.x-unsized { -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:64 */ .x-dock.x-dock-horizontal > .x-dock-item.x-unsized > * { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:79 */ .x-ie .x-stretched.x-dock-horizontal > .x-dock-body { width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:85 */ .x-ie .x-stretched.x-dock-vertical > .x-dock-body { height: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:92 */ .x-ie .x-has-width > .x-dock.x-unsized.x-dock-horizontal > .x-dock-body { width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Container.scss:98 */ .x-ie .x-has-height > .x-dock.x-unsized.x-dock-vertical > .x-dock-body { height: 0; } /* http://localhost:1843/modern/theme-base/sass/src/viewport/Viewport.scss:42 */ #ext-viewport { margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } /* http://localhost:1843/modern/theme-base/sass/src/Panel.scss:5 */ .x-panel, .x-msgbox { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/Panel.scss:13 */ .x-panel.x-floating .x-panel-inner, .x-panel.x-floating > .x-body, .x-msgbox .x-panel-inner, .x-msgbox > .x-body, .x-form.x-floating .x-panel-inner, .x-form.x-floating > .x-body { z-index: 1; } /* http://localhost:1843/modern/theme-base/sass/src/Panel.scss:19 */ .x-panel.x-floating > .x-dock, .x-msgbox > .x-dock, .x-form.x-floating > .x-dock { z-index: 1; } /* http://localhost:1843/modern/theme-base/sass/src/Panel.scss:25 */ .x-panel.x-floating > .x-dock.x-sized, .x-msgbox > .x-dock.x-sized, .x-form.x-floating > .x-dock.x-sized { margin: 6px; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:5 */ .x-button, .x-tab { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-align: center; -ms-flex-align: center; align-items: center; position: relative; overflow: hidden; z-index: 1; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:14 */ .x-button.x-hasbadge, .x-tab.x-hasbadge { overflow: visible; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:19 */ .x-button-icon { position: relative; background-repeat: no-repeat; background-position: center; text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:26 */ .x-button-icon.x-shown { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:30 */ .x-button-icon.x-hidden { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:35 */ .x-iconalign-left, .x-icon-align-right { -webkit-box-orient: horizontal; -ms-flex-direction: row; flex-direction: row; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:40 */ .x-iconalign-top, .x-iconalign-bottom { -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:45 */ .x-iconalign-bottom, .x-iconalign-right { -webkit-box-direction: reverse; -ms-flex-direction: row-reverse; flex-direction: row-reverse; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:50 */ .x-iconalign-center { -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:55 */ .x-button-label, .x-badge { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; -webkit-box-align: center; -ms-flex-align: center; align-items: center; white-space: nowrap; text-overflow: ellipsis; text-align: center; display: block; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/Button.scss:65 */ .x-badge { z-index: 2; position: absolute; text-overflow: ellipsis; } /* http://localhost:1843/modern/theme-base/sass/src/Sheet.scss:5 */ .x-sheet, .x-sheet-action { height: auto; } /* http://localhost:1843/modern/theme-base/sass/src/Media.scss:5 */ .x-video { height: 100%; width: 100%; background-color: #000; } /* http://localhost:1843/modern/theme-base/sass/src/Media.scss:11 */ .x-video > * { height: 100%; width: 100%; position: absolute; } /* http://localhost:1843/modern/theme-base/sass/src/Media.scss:17 */ .x-video-ghost { -webkit-background-size: 100% auto; background: #000 center center no-repeat; } /* http://localhost:1843/modern/theme-base/sass/src/Media.scss:22 */ audio { width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/Map.scss:5 */ .x-map { background-color: #edeae2; } /* http://localhost:1843/modern/theme-base/sass/src/Map.scss:8 */ .x-map * { -webkit-box-sizing: content-box; box-sizing: content-box; } /* http://localhost:1843/modern/theme-base/sass/src/Map.scss:14 */ .x-mask-map { background: transparent !important; } /* http://localhost:1843/modern/theme-base/sass/src/Map.scss:18 */ .x-map-container { position: absolute !important; top: 0; left: 0; right: 0; bottom: 0; } /* http://localhost:1843/modern/theme-base/sass/src/Img.scss:6 */ .x-img.x-img-image { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/Img.scss:9 */ .x-img.x-img-image img { width: auto; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/Img.scss:15 */ .x-img.x-img-background { background-repeat: no-repeat; background-position: center; background-size: auto 100%; } /* http://localhost:1843/modern/theme-base/sass/src/Menu.scss:1 */ .x-menu { background: #eee; } /* http://localhost:1843/modern/theme-base/sass/src/Toolbar.scss:5 */ .x-toolbar { position: relative; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/Toolbar.scss:10 */ .x-title { text-align: center; max-width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/Toolbar.scss:14 */ .x-title .x-innerhtml { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* http://localhost:1843/modern/theme-base/sass/src/Toolbar.scss:20 */ .x-navigation-bar .x-container { overflow: visible; } /* http://localhost:1843/modern/theme-base/sass/src/Toolbar.scss:27 */ .x-toolbar-inner .x-field .x-component-outer { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; } /* http://localhost:1843/modern/theme-base/sass/src/Toolbar.scss:33 */ .x-ie .x-toolbar-inner { height: 100% !important; } /* http://localhost:1843/modern/theme-base/sass/src/MessageBox.scss:5 */ .x-msgbox { min-width: 15em; max-width: 20em; max-height: 90%; } /* http://localhost:1843/modern/theme-base/sass/src/MessageBox.scss:11 */ .x-msgbox .x-docking-vertical { overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/MessageBox.scss:20 */ .x-ie .x-msgbox .x-dock.x-dock-horizontal.x-unsized > .x-dock-body { -webkit-box-flex: 1; -ms-flex: 1 0 0px; flex: 1 0 0px; } /* http://localhost:1843/modern/theme-base/sass/src/MessageBox.scss:29 */ .x-msgbox-buttons .x-button { min-width: 4.5em; } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:1 */ .x-progressindicator { width: 50%; height: 1.3em; } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:6 */ .x-progressindicator .x-progressindicator-inner { background: #222; padding: 10px; height: 100%; border-radius: 20px; box-shadow: 0px 5px 17px rgba(40, 40, 40, 0.5); box-sizing: content-box; position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:16 */ .x-progressindicator .x-progressindicator-text { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; color: white; text-shadow: 1px 1px 2px black; } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:29 */ .x-progressindicator .x-progressindicator-bar { height: 100%; width: 0%; border-radius: 10px; } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:35 */ .x-progressindicator:not(.x-item-hidden) .x-progressindicator-bar .x-progressindicator-bar-fill { height: 100%; width: 100%; background-color: gray; border-radius: 10px; -webkit-animation-name: progressIndicator; -moz-animation-name: progressIndicator; -ms-animation-name: progressIndicator; -o-animation-name: progressIndicator; animation-name: progressIndicator; -webkit-animation-duration: 1s; -moz-animation-duration: 1s; -ms-animation-duration: 1s; -o-animation-duration: 1s; animation-duration: 1s; -webkit-animation-timing-function: linear; -moz-animation-timing-function: linear; -ms-animation-timing-function: linear; -o-animation-timing-function: linear; animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -moz-animation-iteration-count: infinite; -ms-animation-iteration-count: infinite; -o-animation-iteration-count: infinite; animation-iteration-count: infinite; background-repeat: repeat-x; background-size: 30px 30px; background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:52 */ @-webkit-keyframes progressIndicator { /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:54 */ to { background-position: 30px; } } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:58 */ @-moz-keyframes progressIndicator { /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:60 */ to { background-position: 30px; } } /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:64 */ @keyframes progressIndicator { /* http://localhost:1843/modern/theme-base/sass/src/ProgressIndicator.scss:66 */ to { background-position: 30px; } } /* http://localhost:1843/modern/theme-base/sass/src/Toast.scss:5 */ .x-toast { min-width: 15em; max-width: 20em; max-height: 90%; margin: 6px; } /* http://localhost:1843/modern/theme-base/sass/src/Toast.scss:12 */ .x-toast .x-toast-text { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/Toast.scss:21 */ .x-ie .x-toast .x-dock.x-dock-horizontal.x-unsized > .x-dock-body { -webkit-box-flex: 1; -ms-flex: 1 0 0px; flex: 1 0 0px; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:1 */ .x-carousel-inner { position: relative; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:6 */ .x-carousel-item, .x-carousel-item > * { position: absolute !important; width: 100%; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:13 */ .x-carousel-indicator { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:20 */ .x-carousel-indicator span { display: block; width: 10px; height: 10px; margin: 3px; background-color: #eee; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:27 */ .x-carousel-indicator span.x-carousel-indicator-active { background-color: #ccc; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:33 */ .x-carousel-indicator-horizontal { width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/carousel/Carousel.scss:37 */ .x-carousel-indicator-vertical { -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/DataView.scss:2 */ .x-dataview-inlineblock .x-dataview-item, .x-dataview-inlineblock .x-data-item { display: inline-block; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/DataView.scss:8 */ .x-dataview-nowrap .x-dataview-container { white-space: nowrap !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/DataView.scss:14 */ .x-dataview-nowrap .x-container.x-dataview { white-space: nowrap !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:1 */ .x-indexbar-wrapper { -webkit-box-pack: end !important; -ms-flex-pack: end !important; justify-content: flex-end !important; pointer-events: none; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:6 */ .x-indexbar { pointer-events: auto; z-index: 2; min-height: 0 !important; height: auto !important; -webkit-box-flex: 0 !important; -ms-flex: 0 0 auto !important; flex: 0 0 auto !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:14 */ .x-indexbar > div { font-size: 0.6em; text-align: center; line-height: 1.1em; font-weight: bold; display: block; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:23 */ .x-indexbar-vertical { width: 15px; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; margin-right: 15px; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:29 */ .x-indexbar-horizontal { height: 15px; -webkit-box-orient: horizontal; -ms-flex-direction: row; flex-direction: row; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:35 */ .x-phone.x-landscape .x-indexbar > div { font-size: 0.38em; line-height: 1em; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/IndexBar.scss:41 */ .x-indexbar-pressed { background-color: #ccc; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:1 */ .x-list { overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:4 */ .x-list .x-scroll-scroller { max-width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:8 */ .x-list .x-list-inner { width: 100% !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:12 */ .x-list .x-list-scrolldock-hidden { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:16 */ .x-list .x-list-item { position: absolute !important; left: 0; top: 0; width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:22 */ .x-list .x-list-item > .x-dock { height: auto; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:26 */ .x-list .x-list-item .x-dock-horizontal { border-top: 1px solid #ccc; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:32 */ .x-list .x-list-item.x-list-item-relative { position: relative !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:38 */ .x-list .x-list-header.x-list-item-relative { position: relative !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:43 */ .x-list .x-list-emptytext { text-align: center; pointer-events: none; font-color: #333; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:52 */ .x-list .x-list-scrolldockitem { position: absolute !important; left: 0; top: 0; width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:63 */ .x-ie .x-list-grouped .x-translatable-container .x-list-item:before, .x-ie .x-list-grouped .x-translatable-container .x-list-header:before { content: ". ."; color: transparent; position: absolute; left: 0px; word-spacing: 3000px; opacity: 0; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:74 */ .x-list-header { position: absolute; left: 0; width: 100%; z-index: 2 !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:81 */ .x-ios .x-list-header { -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:85 */ .x-list-grouped .x-list-item.x-list-header-wrap .x-dock-horizontal, .x-list-grouped .x-list-item-tpl.x-list-header-wrap { border-top: 0; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:91 */ .x-list-inlineblock .x-list-item { display: inline-block; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:97 */ .x-list-nowrap .x-list-inner { width: auto; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:101 */ .x-list-nowrap .x-list-container { white-space: nowrap !important; } /* http://localhost:1843/modern/theme-base/sass/src/dataview/List.scss:106 */ .x-list-item-dragging { border-bottom: 1px solid #ccc; background: #fff !important; z-index: 1; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:5 */ .x-sheet.x-picker { padding: 0; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:9 */ .x-sheet.x-picker .x-sheet-inner { background-color: #fff; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:14 */ .x-sheet.x-picker .x-sheet-inner .x-picker-slot .x-body { border-left: 1px solid #999; border-right: 1px solid #acacac; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:20 */ .x-sheet.x-picker .x-sheet-inner .x-picker-slot.x-first .x-body { border-left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:26 */ .x-sheet.x-picker .x-sheet-inner .x-picker-slot.x-last .x-body { border-left: 0; border-right: 0; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:34 */ .x-picker-slot .x-scroll-view { z-index: 2; position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:39 */ .x-picker-mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-align: stretch; -ms-flex-align: stretch; align-items: stretch; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; pointer-events: none; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:53 */ .x-picker-slot-title { position: relative; z-index: 2; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:57 */ .x-picker-slot-title > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:64 */ .x-picker-slot .x-dataview-inner { width: 100% !important; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:68 */ .x-picker-slot .x-dataview-item { vertical-align: middle; height: 30px; line-height: 30px; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:73 */ .x-picker-slot .x-dataview-item.x-item-selected { font-weight: bold; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:78 */ .x-picker-slot .x-picker-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:83 */ .x-ie .x-picker-item { cursor: default; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:87 */ .x-ie .x-picker-item::before { content: ". ."; color: transparent; position: absolute; left: 0px; word-spacing: 3000px; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:95 */ .x-picker-right { text-align: right; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:99 */ .x-picker-center { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/picker/Picker.scss:103 */ .x-picker-left { text-align: left; } /* http://localhost:1843/modern/theme-base/sass/src/slider/Slider.scss:5 */ .x-slider, .x-toggle { position: relative; height: 16px; min-height: 0; min-width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/slider/Slider.scss:12 */ .x-slider > *, .x-toggle > * { position: absolute; width: 100%; height: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/slider/Slider.scss:19 */ .x-thumb { position: absolute; height: 16px; width: 10px; border: 1px solid #ccc; background-color: #ddd; } /* http://localhost:1843/modern/theme-base/sass/src/slider/Slider.scss:28 */ .x-slider:before { content: ''; position: absolute; width: auto; height: 8px; top: 4px; left: 0; right: 0; margin: 0 5px; background-color: #eee; } /* http://localhost:1843/modern/theme-base/sass/src/slider/Slider.scss:35 */ .x-toggle { border: 1px solid #ccc; width: 30px; overflow: hidden; -webkit-box-flex: 0; -ms-flex: 0 0 auto; flex: 0 0 auto; } /* http://localhost:1843/modern/theme-base/sass/src/slider/Slider.scss:42 */ .x-toggle-on { background-color: #eee; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:2 */ .x-form-label { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:5 */ .x-form-label-nowrap .x-form-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:11 */ .x-field { display: flex; display: -webkit-box; display: -ms-flexbox; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:14 */ .x-field .x-field-input { position: relative; min-width: 3.7em; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:19 */ .x-field .x-field-input, .x-field .x-input-el { width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:25 */ .x-field.x-field-labeled .x-form-label { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:30 */ .x-field .x-component-outer { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:35 */ .x-label-align-left, .x-label-align-right { -webkit-box-orient: horizontal !important; -ms-flex-direction: row !important; flex-direction: row !important; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:39 */ .x-label-align-left .x-component-outer, .x-label-align-right .x-component-outer { -webkit-box-flex: 1; -ms-flex: 1 0 0px; flex: 1 0 0px; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:44 */ .x-label-align-right { -webkit-box-direction: reverse; -ms-flex-direction: row-reverse; flex-direction: row-reverse; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:48 */ .x-label-align-top, .x-label-align-bottom { -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:53 */ .x-label-align-bottom { -webkit-box-direction: reverse; -ms-flex-direction: column-reverse; flex-direction: column-reverse; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:57 */ .x-input-el { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:61 */ .x-field-mask { width: auto; height: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:69 */ .x-ie .x-field.x-field-text .x-field-mask, .x-ie .x-field.x-field-textarea .x-field-mask, .x-ie .x-field.x-field-search .x-field-mask { z-index: -1; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:76 */ .x-field-required .x-form-label:after { content: "*"; display: inline; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:88 */ .x-spinner .x-component-outer { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:92 */ .x-spinner .x-component-outer > * { width: auto; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:97 */ .x-spinner .x-field-input { -webkit-box-flex: 1; -ms-flex: 1 0 0px; flex: 1 0 0px; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:100 */ .x-spinner .x-field-input .x-input-el { width: 100%; text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:106 */ .x-spinner .x-field-input input::-webkit-outer-spin-button, .x-spinner .x-field-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:113 */ .x-spinner .x-spinner-button { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:118 */ .x-spinner.x-field-grouped-buttons .x-input-el { text-align: left; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:127 */ .x-select-overlay .x-list-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:135 */ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:140 */ .x-field-number input::-webkit-outer-spin-button, .x-field-number input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:147 */ .x-field-input .x-clear-icon, .x-field-input .x-reveal-icon { display: none; position: absolute; top: 50%; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:154 */ .x-field-clearable .x-clear-icon { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:160 */ .x-field-revealable .x-reveal-icon { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:165 */ .x-android .x-input-el { -webkit-text-fill-color: #000; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:169 */ .x-android .x-empty .x-input-el { -webkit-text-fill-color: #a9a9a9; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:173 */ .x-android .x-item-disabled .x-input-el { -webkit-text-fill-color: #b3b3b3; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:179 */ .x-form-fieldset .x-form-fieldset-inner { border: 1px solid #ccc; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:185 */ .x-form-fieldset .x-dock .x-dock-body { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:191 */ .x-form-fieldset-title { font-weight: bold; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:194 */ .x-form-fieldset-title .x-innerhtml { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:199 */ .x-form-fieldset-instructions { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/form/Panel.scss:204 */ .x-ie .x-field-select .x-field-mask { z-index: 3; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:1 */ .x-grid .x-dock-body > .x-body { width: 100%; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:4 */ .x-grid-header-container { overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:8 */ .x-grid-headergroup-inner { white-space: nowrap; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:10 */ .x-grid-headergroup-inner > .x-innerhtml { text-align: center; overflow: hidden; text-overflow: ellipsis; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:17 */ .x-grid-row { position: absolute; left: 0; top: 0; display: table; table-layout: fixed; width: 0; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:29 */ .x-grid-cell { display: table-cell; vertical-align: middle; overflow: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:35 */ .x-grid-cell-inner { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:41 */ .x-grid-cell-hidden { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:45 */ .x-grid-cell-align-center, .x-grid-column-align-center { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:50 */ .x-grid-cell-align-right, .x-grid-column-align-right { text-align: right; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:55 */ .x-grid-viewoptions { border-width: 0 0 0 1px; border-style: solid; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:59 */ .x-grid-viewoptions .x-list-item.x-item-selected.x-list-item-tpl, .x-grid-viewoptions .x-list-item.x-item-pressed.x-list-item-tpl { background: transparent; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:62 */ .x-grid-viewoptions .x-list-item.x-item-selected.x-list-item-tpl .x-innerhtml, .x-grid-viewoptions .x-list-item.x-item-pressed.x-list-item-tpl .x-innerhtml { background: transparent; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:68 */ .x-grid-columnoptions { border-width: 0 0 1px; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:72 */ .x-grid-multiselection-column { position: relative; padding: 0; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:76 */ .x-grid-multiselection-column:after { position: absolute; top: 0; left: 0; width: 60px; height: 64px; line-height: 64px; font-family: 'Pictos'; font-size: 26px; text-align: center; content: "2"; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:90 */ .x-grid-multiselection-cell { position: relative; padding: 0; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:94 */ .x-grid-multiselection-cell:after { position: absolute; top: 0; left: 0; width: 60px; height: 60px; line-height: 60px; font-family: 'Pictos'; font-size: 20px; text-align: center; content: "_"; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:108 */ .x-item-selected .x-grid-multiselection-cell:after { content: "3"; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:113 */ .x-grid-pagingtoolbar > .x-body { -webkit-box-align: center; -ms-flex-align: center; align-items: center; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:118 */ .x-grid-pagingtoolbar-currentpage { position: relative; height: 22px; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:122 */ .x-grid-pagingtoolbar-currentpage span { position: absolute; right: 0; top: 0; line-height: 22px; height: 22px; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:131 */ .x-grid-summaryrow { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:135 */ .x-grid-summaryrow .x-grid-multiselection-cell:after { content: ''; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:142 */ .x-ie .x-grid-grouped .x-translatable-container .x-grid-row:before, .x-ie .x-grid-grouped .x-translatable-container .x-grid-header:before { content: ". ."; color: transparent; position: absolute; left: 0px; word-spacing: 3000px; opacity: 0; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:153 */ .x-grid-header { position: absolute; left: 0; width: 100%; z-index: 2 !important; } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:160 */ .x-ios .x-grid-header { -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } /* http://localhost:1843/modern/theme-base/sass/src/grid/Grid.scss:164 */ .x-grid-grouped .x-grid-row.x-grid-header-wrap .x-dock-horizontal, .x-grid-grouped .x-grid-row-tpl.x-grid-header-wrap { border-top: 0; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/ListPaging.scss:6 */ .x-list-paging .x-loading-spinner { display: none; margin: auto; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/ListPaging.scss:11 */ .x-list-paging .x-list-paging-msg { text-align: center; clear: both; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/ListPaging.scss:17 */ .x-list-paging.x-loading .x-loading-spinner { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/ListPaging.scss:21 */ .x-list-paging.x-loading .x-list-paging-msg { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:5 */ .x-list-pullrefresh { display: flex; display: -webkit-box; display: -ms-flexbox; -webkit-box-orient: horizontal; -ms-flex-direction: row; flex-direction: row; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; position: absolute; top: -5em; left: 0; width: 100%; height: 4.5em; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:18 */ .x-list-pullrefresh .x-loading-spinner { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:23 */ .x-list-pullrefresh-arrow { width: 2.5em; height: 4.5em; background-color: #bbb; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:29 */ .x-list-pullrefresh-wrap { width: 20em; font-size: 0.7em; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:34 */ .x-list-pullrefresh-message { font-weight: bold; font-size: 1.3em; text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:40 */ .x-list-pullrefresh-updated { text-align: center; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:45 */ .x-list-pullrefresh-loading *.x-loading-spinner { display: block; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:49 */ .x-list-pullrefresh-loading .x-list-pullrefresh-arrow { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/PullRefresh.scss:55 */ .x-android-2 .x-list-pullrefresh-loading *.x-loading-spinner { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/field/PlaceHolderLabel.scss:2 */ .x-placeholderlabel .x-form-label { -webkit-transition: opacity .1s ease-in-out, -webkit-transform .1s ease-in-out; -webkit-transform: translate(0, 2em); opacity: 0; padding: 0.3em; } /* http://localhost:1843/modern/theme-base/sass/src/plugin/field/PlaceHolderLabel.scss:10 */ .x-placeholderlabel.x-show-label .x-form-label { -webkit-transform: translate(0, 0); opacity: 1; } /* http://localhost:1843/modern/theme-base/sass/src/tab/Panel.scss:6 */ .x-tabbar.x-docked-top .x-tab .x-button-icon { position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/tab/Panel.scss:9 */ .x-tabbar.x-docked-top .x-tab .x-button-icon.x-shown { display: inline-block; } /* http://localhost:1843/modern/theme-base/sass/src/tab/Panel.scss:13 */ .x-tabbar.x-docked-top .x-tab .x-button-icon.x-hidden { display: none; } /* http://localhost:1843/modern/theme-base/sass/src/tab/Panel.scss:20 */ .x-tabbar.x-docked-bottom .x-tab .x-button-icon { display: block; position: relative; } /* http://localhost:1843/modern/theme-base/sass/src/tab/Panel.scss:24 */ .x-tabbar.x-docked-bottom .x-tab .x-button-icon.x-shown { visibility: visible; } /* http://localhost:1843/modern/theme-base/sass/src/tab/Panel.scss:28 */ .x-tabbar.x-docked-bottom .x-tab .x-button-icon.x-hidden { visibility: hidden; } /* http://localhost:1843/modern/theme-base/sass/src/table/Table.scss:6 */ .x-table-inner { display: table; width: 100% !important; height: 100% !important; } /* http://localhost:1843/modern/theme-base/sass/src/table/Table.scss:11 */ .x-table-inner.x-fixed-layout { table-layout: fixed !important; } /* http://localhost:1843/modern/theme-base/sass/src/table/Table.scss:16 */ .x-table-row { display: table-row; } /* http://localhost:1843/modern/theme-base/sass/src/table/Table.scss:20 */ .x-table-cell { display: table-cell; vertical-align: middle; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:5 */ @font-face { font-family: 'Pictos'; src: url('font-pictos/fonts/pictos-web.eot'); src: url('font-pictos/fonts/pictos-web.eot?#iefix') format('embedded-opentype'), url('font-pictos/fonts/pictos-web.woff') format('woff'), url('font-pictos/fonts/pictos-web.ttf') format('truetype'); font-weight: normal; font-style: normal; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:15 */ .pictos { font-family: Pictos; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:19 */ .pictos-anchor:before { content: "a"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:20 */ .pictos-box:before { content: "b"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:21 */ .pictos-upload:before { content: "c"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:22 */ .pictos-forbidden:before { content: "d"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:23 */ .pictos-lightning:before { content: "e"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:24 */ .pictos-rss:before { content: "f"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:25 */ .pictos-team:before { content: "g"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:26 */ .pictos-help:before { content: "h"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:27 */ .pictos-info:before { content: "i"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:28 */ .pictos-attachment:before { content: "j"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:29 */ .pictos-heart:before { content: "k"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:30 */ .pictos-list:before { content: "l"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:31 */ .pictos-music:before { content: "m"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:32 */ .pictos-table:before { content: "n"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:33 */ .pictos-folder:before { content: "o"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:34 */ .pictos-pencil:before { content: "p"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:35 */ .pictos-chat2:before { content: "q"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:36 */ .pictos-retweet:before { content: "r"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:37 */ .pictos-search:before { content: "s"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:38 */ .pictos-time:before { content: "t"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:39 */ .pictos-switch:before { content: "u"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:40 */ .pictos-camera:before { content: "v"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:41 */ .pictos-chat:before { content: "w"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:42 */ .pictos-settings2:before { content: "x"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:43 */ .pictos-settings:before { content: "y"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:44 */ .pictos-tags:before { content: "z"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:45 */ .pictos-attachment2:before { content: "A"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:46 */ .pictos-bird:before { content: "B"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:47 */ .pictos-cloud:before { content: "C"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:48 */ .pictos-delete_black1:before { content: "D"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:49 */ .pictos-eye:before { content: "E"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:50 */ .pictos-file:before { content: "F"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:51 */ .pictos-browser:before { content: "G"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:52 */ .pictos-home:before { content: "H"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:53 */ .pictos-inbox:before { content: "I"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:54 */ .pictos-network:before { content: "J"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:55 */ .pictos-key:before { content: "K"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:56 */ .pictos-radio:before { content: "L"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:57 */ .pictos-mail:before { content: "M"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:58 */ .pictos-news:before { content: "N"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:59 */ .pictos-case:before { content: "O"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:60 */ .pictos-photos:before { content: "P"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:61 */ .pictos-power:before { content: "Q"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:62 */ .pictos-action:before { content: "R"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:63 */ .pictos-favorites:before { content: "S"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:64 */ .pictos-plane:before { content: "T"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:65 */ .pictos-user:before { content: "U"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:66 */ .pictos-video:before { content: "V"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:67 */ .pictos-compose:before { content: "W"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:68 */ .pictos-truck:before { content: "X"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:69 */ .pictos-chart2:before { content: "Y"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:70 */ .pictos-chart:before { content: "Z"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:71 */ .pictos-expand:before { content: "`"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:72 */ .pictos-refresh:before { content: "1"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:73 */ .pictos-check:before { content: "2"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:74 */ .pictos-check2:before { content: "3"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:75 */ .pictos-play:before { content: "4"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:76 */ .pictos-pause:before { content: "5"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:77 */ .pictos-stop:before { content: "6"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:78 */ .pictos-forward:before { content: "7"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:79 */ .pictos-rewind:before { content: "8"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:80 */ .pictos-play2:before { content: "9"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:81 */ .pictos-refresh2:before { content: "0"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:82 */ .pictos-minus:before { content: "-"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:83 */ .pictos-battery:before { content: "="; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:84 */ .pictos-left:before { content: "["; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:85 */ .pictos-right:before { content: "]"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:86 */ .pictos-calendar:before { content: "\005C"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:87 */ .pictos-shuffle:before { content: ";"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:88 */ .pictos-wireless:before { content: "'"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:89 */ .pictos-speedometer:before { content: ","; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:90 */ .pictos-more:before { content: "."; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:91 */ .pictos-print:before { content: "/"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:92 */ .pictos-download:before { content: "~"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:93 */ .pictos-warning_black:before { content: "!"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:94 */ .pictos-locate:before { content: "@"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:95 */ .pictos-trash:before { content: "#"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:96 */ .pictos-cart:before { content: "$"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:97 */ .pictos-bank:before { content: "%"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:98 */ .pictos-flag:before { content: "^"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:99 */ .pictos-add:before { content: "&"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:100 */ .pictos-delete:before { content: "*"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:101 */ .pictos-lock:before { content: "("; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:102 */ .pictos-unlock:before { content: ")"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:103 */ .pictos-minus2:before { content: "_"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:104 */ .pictos-add2:before { content: "+"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:105 */ .pictos-up:before { content: "{"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:106 */ .pictos-down:before { content: "}"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:107 */ .pictos-screens:before { content: "|"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:108 */ .pictos-bell:before { content: ":"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:109 */ .pictos-quote:before { content: "\""; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:110 */ .pictos-volume_mute:before { content: "<"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:111 */ .pictos-volume:before { content: ">"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:112 */ .pictos-question:before { content: "?"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:113 */ .pictos-arrow_left:before { content: "["; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:114 */ .pictos-arrow_right:before { content: "]"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:115 */ .pictos-arrow_up:before { content: "{"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:116 */ .pictos-arrow_down:before { content: "}"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:117 */ .pictos-organize:before { content: "I"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:118 */ .pictos-bookmarks:before { content: "I"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:119 */ .pictos-loop2:before { content: "r"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:120 */ .pictos-star:before { content: "S"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:121 */ .pictos-maps:before { content: "@"; } /* http://localhost:1843/packages/font-pictos/sass/src/all.scss:122 */ .pictos-reply:before { content: "R"; } /* http://localhost:1843/modern/theme-device-base/sass/src/Component.scss:1 */ .x-html { line-height: 1.5; color: #333; font-size: .8em; padding: 1.2em; } /* http://localhost:1843/modern/theme-device-base/sass/src/Panel.scss:1 */ .x-msgbox { padding: 6px; background-color: #ccc; } /* http://localhost:1843/modern/theme-device-base/sass/src/Panel.scss:6 */ .x-panel.x-floating, .x-form.x-floating { padding: 6px; } /* http://localhost:1843/modern/theme-device-base/sass/src/Panel.scss:9 */ .x-panel.x-floating > * > .x-dock-body, .x-form.x-floating > * > .x-dock-body { background-color: #fff; } /* http://localhost:1843/modern/theme-device-base/sass/src/Button.scss:1 */ .x-button { background-color: #eee; border: 1px solid #ccc; line-height: normal; foo: 1; } /* http://localhost:1843/modern/theme-device-base/sass/src/Button.scss:8 */ .x-badge { background-color: #ccc; border: 1px solid #aaa; position: absolute !important; width: auto; font-size: .6em; right: 0; top: 0; max-width: 95%; display: inline-block; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:1 */ .x-toolbar { background-color: #eee; min-height: 2.6em; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:5 */ .x-toolbar.x-docked-top { border-bottom: 1px solid; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:9 */ .x-toolbar.x-docked-bottom { border-top: 1px solid; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:13 */ .x-toolbar.x-docked-left { width: 50px; height: auto; border-right: 1px solid; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:19 */ .x-toolbar.x-docked-right { width: 50px; height: auto; border-left: 1px solid; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:26 */ .x-title { font-size: 1.2em; font-weight: bold; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:31 */ .x-title.x-title-align-left { padding-left: 10px; } /* http://localhost:1843/modern/theme-device-base/sass/src/Toolbar.scss:36 */ .x-title.x-title-align-right { padding-right: 10px; } /* http://localhost:1843/modern/theme-device-base/sass/src/MessageBox.scss:1 */ .x-msgbox { border: 1px solid #ccc; margin: 6px; } /* http://localhost:1843/modern/theme-device-base/sass/src/MessageBox.scss:6 */ .x-msgbox .x-toolbar.x-docked-top { border-bottom: 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/MessageBox.scss:10 */ .x-msgbox .x-toolbar.x-docked-bottom { border-top: 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/MessageBox.scss:16 */ .x-msgbox-text { text-align: center; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:3 */ .x-list .x-list-item.x-item-selected .x-dock-horizontal, .x-list .x-list-item.x-item-selected.x-list-item-tpl { background-color: #ccc; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:9 */ .x-list .x-list-item.x-item-pressed.x-list-item-tpl, .x-list .x-list-item.x-item-pressed .x-dock-horizontal { background-color: #ddd; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:15 */ .x-list .x-list-item .x-list-item-body, .x-list .x-list-item.x-list-item-tpl .x-innerhtml { padding: 5px; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:20 */ .x-list .x-item-selected .x-list-disclosure { background-color: #fff; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:24 */ .x-list .x-list-header { background-color: #eee; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; font-weight: bold; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:31 */ .x-list .x-list-disclosure { margin: 5px 15px 5px 0; overflow: visible; width: 20px; height: 20px; border: 1px solid #ccc; background-color: #eee; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:40 */ .x-list .x-list-item-tpl .x-list-disclosure { position: absolute; right: 0px; top: 0px; } /* http://localhost:1843/modern/theme-device-base/sass/src/dataview/List.scss:47 */ .x-list.x-list-indexed .x-list-disclosure { margin-right: 35px; } /* http://localhost:1843/modern/theme-device-base/sass/src/field/Spinner.scss:1 */ .x-spinner-button-down:before { content: '-'; } /* http://localhost:1843/modern/theme-device-base/sass/src/field/Spinner.scss:4 */ .x-spinner-button-up:before { content: '+'; } /* http://localhost:1843/modern/theme-device-base/sass/src/field/Spinner.scss:9 */ .x-spinner .x-spinner-button { border: 1px solid #ccc !important; background-color: #eee; } /* http://localhost:1843/modern/theme-device-base/sass/src/form/Panel.scss:1 */ .x-field-input .x-clear-icon, .x-field-input .x-reveal-icon { width: 10px; height: 10px; right: 0; background-color: #ccc; } /* http://localhost:1843/modern/theme-device-base/sass/src/form/Panel.scss:9 */ .x-form-label span { font-weight: bold; } /* http://localhost:1843/modern/theme-device-base/sass/src/form/Panel.scss:15 */ .x-field-clearable .x-field-input { padding-right: 10px; } /* http://localhost:1843/modern/theme-device-base/sass/src/form/Panel.scss:21 */ .x-field-revealable .x-field-input { padding-right: 10px; } /* http://localhost:1843/modern/theme-device-base/sass/src/form/Panel.scss:27 */ .x-field-clearable.x-field-revealable .x-reveal-icon { right: 20px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:1 */ .x-grid-row { border-width: 0 0 1px 0; border-style: solid; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:6 */ .x-grid-cell { line-height: 60px; padding: 0 8px; height: 60px; border-width: 0 1px 0 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:13 */ .x-grid-summaryrow { height: 32px; font-size: 0.8em; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:17 */ .x-grid-summaryrow .x-grid-cell { height: 32px; line-height: 30px; border-width: 0 0 1px; border-style: solid; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:25 */ .x-grid-header { line-height: 44px; font-weight: bold; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:30 */ .x-grid-header-container { border-width: 0 1px 1px 0; border-style: solid; height: 65px; font-weight: bold; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:36 */ .x-grid-header-container .x-grid-header-container-inner { width: 100000px; position: absolute; top: 0; left: 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:43 */ .x-grid-header-container .x-grid-column { display: inline-block; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:48 */ .x-grid-column { height: 64px; border-width: 1px 1px 0 1px; border-style: solid; line-height: 64px; vertical-align: middle; padding: 0 8px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:56 */ .x-grid-column .x-innerhtml { position: relative; display: inline-block; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:63 */ .x-grid-column.x-column-sorted-asc .x-innerhtml:after, .x-grid-column.x-column-sorted-desc .x-innerhtml:after { position: absolute; width: 12px; line-height: 64px; top: 0; height: 64px; font-family: 'Pictos'; font-size: 12px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:76 */ .x-grid-column.x-column-align-left .x-innerhtml:after, .x-grid-column.x-column-align-center .x-innerhtml:after { right: -16px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:80 */ .x-grid-column.x-column-align-right .x-innerhtml:after { left: -16px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:84 */ .x-grid-column.x-column-sorted-asc .x-innerhtml:after { content: "{"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:87 */ .x-grid-column.x-column-sorted-desc .x-innerhtml:after { content: "}"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:92 */ .x-grid-headergroup { display: inline-block; position: relative; vertical-align: bottom; height: 64px; padding-top: 32px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:99 */ .x-grid-headergroup .x-inner > .x-innerhtml { height: 32px; line-height: 28px; vertical-align: middle; display: block; position: absolute; width: 100%; top: 0; left: 0; border-style: solid; border-width: 1px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:112 */ .x-grid-headergroup .x-grid-column { height: 32px !important; line-height: 27px !important; font-size: 0.7em; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:119 */ .x-grid-headergroup .x-grid-column.x-column-sorted-asc .x-innerhtml:after, .x-grid-headergroup .x-grid-column.x-column-sorted-desc .x-innerhtml:after { line-height: 27px; height: 27px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:127 */ .x-grid-pagingtoolbar-prev { font-family: Pictos; line-height: 1; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins/font-icon.scss:125 */ .x-grid-pagingtoolbar-prev:before { content: "["; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:131 */ .x-grid-pagingtoolbar-next { font-family: Pictos; line-height: 1; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins/font-icon.scss:125 */ .x-grid-pagingtoolbar-next:before { content: "]"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:136 */ .x-grid-viewoptions .x-list-item .x-innerhtml { padding: 0px !important; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:140 */ .x-grid-viewoptions .x-column-options-header { height: 32px; line-height: 28px; vertical-align: middle; border-style: solid; border-width: 1px; overflow: hidden; padding-left: 10px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:150 */ .x-grid-viewoptions .x-column-options-sortablehandle, .x-grid-viewoptions .x-column-options-visibleindicator, .x-grid-viewoptions .x-column-options-groupindicator, .x-grid-viewoptions .x-column-options-folder, .x-grid-viewoptions .x-column-options-leaf { width: 40px; height: 48px; position: absolute; bottom: 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:160 */ .x-grid-viewoptions .x-column-options-sortablehandle:after, .x-grid-viewoptions .x-column-options-visibleindicator:after, .x-grid-viewoptions .x-column-options-groupindicator:after, .x-grid-viewoptions .x-column-options-folder:after, .x-grid-viewoptions .x-column-options-leaf:after { position: absolute; top: 0; left: 0; height: 100%; width: 100%; text-align: center; font-size: 24px; line-height: 48px; vertical-align: middle; font-family: 'Pictos'; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:174 */ .x-grid-viewoptions .x-column-options-sortablehandle { left: 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:176 */ .x-grid-viewoptions .x-column-options-sortablehandle:after { line-height: 54px; content: "l"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:181 */ .x-grid-viewoptions .x-column-options-visibleindicator { right: 0; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:183 */ .x-grid-viewoptions .x-column-options-visibleindicator:after { font-size: 30px; line-height: 54px; content: "E"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:190 */ .x-grid-viewoptions .x-column-options-groupindicator { right: 40px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:192 */ .x-grid-viewoptions .x-column-options-groupindicator:after { font-size: 30px; line-height: 54px; content: "g"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:199 */ .x-grid-viewoptions .x-column-options-folder, .x-grid-viewoptions .x-column-options-leaf { width: 30px; left: 40px; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:204 */ .x-grid-viewoptions .x-column-options-folder:after, .x-grid-viewoptions .x-column-options-leaf:after { line-height: 52px; content: "o"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:210 */ .x-grid-viewoptions .x-column-options-leaf:after { content: "F"; } /* http://localhost:1843/modern/theme-device-base/sass/src/grid/Grid.scss:214 */ .x-grid-viewoptions .x-column-options-text { display: block; height: 30px; margin: 10px 50px 5px 80px; position: relative; vertical-align: middle; line-height: 28px; } /* http://localhost:1843/modern/theme-device-base/sass/src/tab/Panel.scss:1 */ .x-tab { background-color: #eee; border: 1px solid #ccc; min-width: 3.3em; } /* http://localhost:1843/modern/theme-device-base/sass/src/tab/Panel.scss:7 */ .x-tabbar { border-color: #ccc; border-style: solid; border-width: 0; background-color: #eee; } /* http://localhost:1843/modern/theme-device-base/sass/src/tab/Panel.scss:14 */ .x-tabbar.x-docked-top { border-bottom-width: 1px; } /* http://localhost:1843/modern/theme-device-base/sass/src/tab/Panel.scss:18 */ .x-tabbar.x-docked-bottom { border-top-width: 1px; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:5 */ .x-size-monitored { position: relative; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:9 */ .x-size-monitors { position: absolute; left: 0; top: 0; width: 100%; height: 100%; visibility: hidden; overflow: hidden; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:18 */ .x-size-monitors > * { width: 100%; height: 100%; overflow: hidden; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:25 */ .x-size-monitors.scroll > *.shrink::after { content: ''; display: block; width: 200%; height: 200%; min-width: 1px; min-height: 1px; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:34 */ .x-size-monitors.scroll > *.expand::after { content: ''; display: block; width: 100000px; height: 100000px; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:44 */ .x-size-monitors.overflowchanged > *.shrink > * { width: 100%; height: 100%; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:51 */ .x-size-monitors.overflowchanged > *.expand > * { width: 200%; height: 200%; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:59 */ .x-size-change-detector { visibility: hidden; position: absolute; left: 0; top: 0; z-index: -1; width: 100%; height: 100%; overflow: hidden; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:70 */ .x-size-change-detector > * { visibility: hidden; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:74 */ .x-size-change-detector-shrink > * { width: 200%; height: 200%; } /* http://localhost:1843/packages/core/sass/src/util/SizeMonitor.scss:79 */ .x-size-change-detector-expand > * { width: 100000px; height: 100000px; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:5 */ @-webkit-keyframes x-paint-monitor-helper { /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:6 */ from { zoom: 1; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:9 */ to { zoom: 1; } } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:14 */ @keyframes x-paint-monitor-helper { /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:15 */ from { zoom: 1; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:18 */ to { zoom: 1; } } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:23 */ .x-paint-monitored { position: relative; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:27 */ .x-paint-monitor { width: 0 !important; height: 0 !important; visibility: hidden; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:32 */ .x-paint-monitor.cssanimation { -webkit-animation-duration: 0.0001ms; -webkit-animation-name: x-paint-monitor-helper; animation-duration: 0.0001ms; animation-name: x-paint-monitor-helper; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:39 */ .x-paint-monitor.overflowchange { overflow: hidden; } /* http://localhost:1843/packages/core/sass/src/util/PaintMonitor.scss:42 */ .x-paint-monitor.overflowchange::after { content: ''; display: block; width: 1px !important; height: 1px !important; } /* http://localhost:1843/packages/core/sass/src/util/Translatable.scss:5 */ .x-translatable { position: absolute !important; top: 500000px !important; left: 500000px !important; overflow: visible !important; z-index: 1; } /* http://localhost:1843/packages/core/sass/src/util/Translatable.scss:13 */ .x-translatable-hboxfix { position: absolute; min-width: 100%; top: 0; left: 0; } /* http://localhost:1843/packages/core/sass/src/util/Translatable.scss:19 */ .x-translatable-hboxfix > .x-translatable { position: relative !important; } /* http://localhost:1843/packages/core/sass/src/util/Translatable.scss:24 */ .x-translatable-container { overflow: hidden; width: auto; height: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0; } /* http://localhost:1843/packages/core/sass/src/util/Translatable.scss:34 */ .x-translatable-container::before { content: ''; display: block; width: 1000000px; height: 1000000px; visibility: hidden; } /* http://localhost:1843/packages/core/sass/src/scroll/DomScroller.scss:1 */ .x-domscroller-spacer { position: absolute; height: 1px; width: 1px; font-size: 0; line-height: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:531 */ .x-treelist { background-position-x: 22px; overflow: hidden; padding: 0 0 0 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:543 */ .x-treelist-container, .x-treelist-root-container { width: 100%; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:548 */ .x-treelist-toolstrip { display: none; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:553 */ .x-treelist-micro > .x-treelist-toolstrip { display: inline-block; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:556 */ .x-treelist-micro > .x-treelist-root-container { display: none; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:561 */ .x-treelist-item, .x-treelist-container, .x-treelist-root-container { overflow: hidden; list-style: none; padding: 0; margin: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:570 */ .x-treelist-item-tool, .x-treelist-row, .x-treelist-item-wrap { position: relative; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:576 */ .x-treelist-item-icon, .x-treelist-item-expander { display: none; position: absolute; top: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:583 */ .x-treelist-item-expander { right: 0; cursor: pointer; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:588 */ .x-treelist-expander-only .x-treelist-item-expandable > * > .x-treelist-item-wrap > * { cursor: pointer; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:592 */ .x-treelist-item-text { cursor: default; white-space: nowrap; overflow: hidden; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:598 */ .x-treelist-item-collapsed > .x-treelist-container { display: none; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:602 */ .x-treelist-item-expandable > * > * > .x-treelist-item-expander, .x-treelist-item-icon { display: block; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:607 */ .x-treelist-item-floated > * > * > .x-treelist-item-expander, .x-treelist-item-floated > * > * > .x-treelist-item-icon { display: none; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:612 */ .x-treelist-expander-first .x-treelist-item-expander { left: 0; right: auto; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:94 */ .x-treelist-toolstrip { background-color: #f8f8f8; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:134 */ .x-treelist-item-tool { padding-left: 8px; padding-right: 8px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:157 */ .x-treelist-item-icon, .x-treelist-item-tool, .x-treelist-item-expander { line-height: 36px; text-align: center; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:170 */ .x-treelist-item-icon, .x-treelist-item-tool { font-size: 18px; width: 22px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:183 */ .x-treelist-item-tool { width: 38px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:193 */ .x-treelist-item-expander { font-size: 16px; width: 18px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:209 */ .x-treelist-item-expander:after { content: "\f105"; font-family: FontAwesome; line-height: 1; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:213 */ .x-treelist-item-expanded > * > * > .x-treelist-item-expander:after { content: "\f107"; font-family: FontAwesome; line-height: 1; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:222 */ .x-treelist-item-text { margin-left: 26px; margin-right: 18px; line-height: 36px; text-overflow: ellipsis; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:238 */ .x-treelist-row { padding-left: 8px; padding-right: 8px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:269 */ .x-treelist-item-floated .x-treelist-container { width: auto; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:272 */ .x-treelist-item-floated > .x-treelist-row { background-color: #f8f8f8; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:276 */ .x-treelist-item-floated > .x-treelist-container { margin-left: -22px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:279 */ .x-big .x-treelist-item-floated > .x-treelist-container { margin-left: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:285 */ .x-treelist-item-floated > * > * > .x-treelist-item-text { margin-left: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:289 */ .x-treelist-item-floated > * .x-treelist-row { padding-left: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:293 */ .x-treelist-item-floated .x-treelist-row:before { width: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:297 */ .x-treelist-item-floated > .x-treelist-row:hover { background-color: #f8f8f8; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:313 */ .x-treelist-item-expanded > .x-treelist-item-expander:after { content: "\f107"; font-family: FontAwesome; line-height: 1; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:318 */ .x-treelist-item-collapsed > * > .x-treelist-item-expander:after { content: "\f105"; font-family: FontAwesome; line-height: 1; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:324 */ &.x-treelist-highlight-path .x-treelist-item:hover > * > .x-treelist-item-icon { transition: color 0.5s; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:328 */ &.x-treelist-highlight-path .x-treelist-item:hover > * > .x-treelist-item-text { transition: color 0.5s; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:332 */ &.x-treelist-highlight-path .x-treelist-item:hover > * > .x-treelist-item-expander { transition: color 0.5s; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:342 */ .x-treelist-row:hover > * > .x-treelist-item-icon { transition: color 0.5s; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:346 */ .x-treelist-row:hover > * > .x-treelist-item-text { transition: color 0.5s; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:350 */ .x-treelist-row:hover > * > .x-treelist-item-expander { transition: color 0.5s; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:357 */ .x-treelist-expander-first .x-treelist-item-icon { left: 18px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:366 */ .x-treelist-expander-first .x-treelist-item-text { margin-left: 44px; margin-right: 0; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:376 */ .x-treelist-expander-first .x-treelist-item-hide-icon > * > * > .x-treelist-item-text { margin-left: 22px; } /* http://localhost:1843/packages/core/sass/src/list/TreeItem.scss:386 */ .x-treelist-item-hide-icon > * > * > .x-treelist-item-text { margin-left: 4px; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:329 */ @font-face { font-family: 'iOS7'; src: url("fonts/ios7/ios7.eot"); src: url("fonts/ios7/ios7.eot?#iefix") format('embedded-opentype'), url("fonts/ios7/ios7.woff") format('woff'), url("fonts/ios7/ios7.ttf") format('truetype'); font-weight: normal; font-style: normal; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Component.scss:3 */ .x-layout-card-item { background: #fff; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:261 */ .x-loading-spinner { font-size: 250%; height: 1em; width: 1em; position: relative; -webkit-transform-origin: 0.5em 0.5em; transform-origin: 0.5em 0.5em; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:271 */ .x-loading-spinner > span, .x-loading-spinner > span:before, .x-loading-spinner > span:after { display: block; position: absolute; width: .1em; height: .25em; top: 0; -webkit-transform-origin: 0.05em 0.5em; transform-origin: 0.05em 0.5em; content: " "; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:284 */ .x-loading-spinner > span { left: 50%; margin-left: -0.05em; } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:288 */ .x-loading-spinner > span.x-loading-top { background-color: rgba(21, 126, 251, 0.99); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:289 */ .x-loading-spinner > span.x-loading-top::after { background-color: rgba(21, 126, 251, 0.9); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:290 */ .x-loading-spinner > span.x-loading-left::before { background-color: rgba(21, 126, 251, 0.8); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:291 */ .x-loading-spinner > span.x-loading-left { background-color: rgba(21, 126, 251, 0.7); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:292 */ .x-loading-spinner > span.x-loading-left::after { background-color: rgba(21, 126, 251, 0.6); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:293 */ .x-loading-spinner > span.x-loading-bottom::before { background-color: rgba(21, 126, 251, 0.5); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:294 */ .x-loading-spinner > span.x-loading-bottom { background-color: rgba(21, 126, 251, 0.4); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:295 */ .x-loading-spinner > span.x-loading-bottom::after { background-color: rgba(21, 126, 251, 0.35); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:296 */ .x-loading-spinner > span.x-loading-right::before { background-color: rgba(21, 126, 251, 0.3); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:297 */ .x-loading-spinner > span.x-loading-right { background-color: rgba(21, 126, 251, 0.25); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:298 */ .x-loading-spinner > span.x-loading-right::after { background-color: rgba(21, 126, 251, 0.2); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:299 */ .x-loading-spinner > span.x-loading-top::before { background-color: rgba(21, 126, 251, 0.15); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:304 */ .x-loading-spinner > span.x-loading-top { -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:305 */ .x-loading-spinner > span.x-loading-right { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:306 */ .x-loading-spinner > span.x-loading-bottom { -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -ms-transform: rotate(180deg); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:307 */ .x-loading-spinner > span.x-loading-left { -webkit-transform: rotate(270deg); -moz-transform: rotate(270deg); -ms-transform: rotate(270deg); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:310 */ .x-loading-spinner > span::before { -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); -ms-transform: rotate(30deg); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:311 */ .x-loading-spinner > span::after { -webkit-transform: rotate(-30deg); -moz-transform: rotate(-30deg); -ms-transform: rotate(-30deg); } /* http://localhost:1843/modern/theme-base/sass/etc/mixins.scss:314 */ .x-loading-spinner { -webkit-animation-name: x-loading-spinner-rotate; -webkit-animation-duration: .5s; -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: linear; animation-name: x-loading-spinner-rotate; animation-duration: .5s; animation-timing-function: linear; animation-iteration-count: infinite; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Mask.scss:1 */ .x-mask .x-mask-inner { position: relative; background: #fff; color: #157efb; text-align: center; padding: .4em; font-size: .95em; font-weight: 400; -webkit-border-radius: 7px; -moz-border-radius: 7px; -ms-border-radius: 7px; -o-border-radius: 7px; border-radius: 7px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Mask.scss:11 */ .x-mask .x-mask-inner .x-mask-message { color: #157efb; bottom: 15px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Mask.scss:16 */ .x-mask .x-mask-inner .x-loading-spinner > span { margin-left: -.065em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:5 */ .x-panel.x-floating, .x-form.x-floating { padding: 0; -webkit-border-radius: 6px; -moz-border-radius: 6px; -ms-border-radius: 6px; -o-border-radius: 6px; border-radius: 6px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:11 */ .x-panel.x-floating > .x-dock.x-sized, .x-form.x-floating > .x-dock.x-sized { margin: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:16 */ .x-toolbar.x-docked-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:20 */ .x-container.x-floating > .x-dock > .x-toolbar.x-docked-bottom, .x-panel.x-floating > .x-dock > .x-toolbar.x-docked-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:28 */ .x-webkit .x-anchor { position: absolute; overflow: hidden; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:32 */ .x-webkit .x-anchor.x-anchor-top { margin-top: -0.68em; margin-left: -0.8155em; width: 1.631em; height: .7em; -webkit-mask: 0 0 url(images/tip_top.png) no-repeat; -webkit-mask-size: 1.631em .7em; background-color: white; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:42 */ .x-webkit .x-anchor.x-anchor-bottom { margin-left: -0.8155em; width: 1.631em; height: .7em; -webkit-mask: 0 0 url(images/tip_bottom.png) no-repeat; -webkit-mask-size: 1.631em .7em; background-color: white; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:51 */ .x-webkit .x-anchor.x-anchor-left { margin-left: -0.6655em; margin-top: -0.35em; height: 1.631em; width: .7em; -webkit-mask: 0 0 url(images/tip_left.png) no-repeat; -webkit-mask-size: .7em 1.631em; background-color: white; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Panel.scss:61 */ .x-webkit .x-anchor.x-anchor-right { margin-top: -0.35em; height: 1.631em; width: .7em; -webkit-mask: 0 0 url(images/tip_right.png) no-repeat; -webkit-mask-size: .7em 1.631em; background-color: white; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:1 */ .x-button { height: 2.1em; padding: 0 8px; -webkit-border-radius: 6px; -moz-border-radius: 6px; -ms-border-radius: 6px; -o-border-radius: 6px; border-radius: 6px; background-color: #fff; border-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:9 */ .x-button-icon { width: 1.5em; height: 1.5em; color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:14 */ .x-button-icon:before { font-size: 1.4em; line-height: 1.15em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:21 */ .x-button-pressing .x-button-icon { color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:26 */ .x-button-label, .x-badge { font-weight: 400; font-family: "Helvetica Neue", Helvetica, Arial; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:33 */ .x-button-round, .x-button-decline-round, .x-button-confirm-round { -webkit-border-radius: 1.8em; -moz-border-radius: 1.8em; -ms-border-radius: 1.8em; -o-border-radius: 1.8em; border-radius: 1.8em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:39 */ .x-button-small, .x-button-decline-small, .x-button-confirm-small { height: 1.4em; padding: 0 5px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:45 */ .x-button-small .x-button-label, .x-button-small .x-badge, .x-button-decline-small .x-button-label, .x-button-decline-small .x-badge, .x-button-confirm-small .x-button-label, .x-button-confirm-small .x-badge { font-size: 1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:50 */ .x-button, .x-button-round, .x-button-small, .x-button-forward { border-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:56 */ .x-button .x-button-label, .x-button .x-badge, .x-button-round .x-button-label, .x-button-round .x-badge, .x-button-small .x-button-label, .x-button-small .x-badge, .x-button-forward .x-button-label, .x-button-forward .x-badge { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:60 */ .x-button.x-button-pressing, .x-button.x-button-pressed, .x-button-round.x-button-pressing, .x-button-round.x-button-pressed, .x-button-small.x-button-pressing, .x-button-small.x-button-pressed, .x-button-forward.x-button-pressing, .x-button-forward.x-button-pressed { border-color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:64 */ .x-button.x-button-pressing .x-button-label, .x-button.x-button-pressing .x-badge, .x-button.x-button-pressed .x-button-label, .x-button.x-button-pressed .x-badge, .x-button-round.x-button-pressing .x-button-label, .x-button-round.x-button-pressing .x-badge, .x-button-round.x-button-pressed .x-button-label, .x-button-round.x-button-pressed .x-badge, .x-button-small.x-button-pressing .x-button-label, .x-button-small.x-button-pressing .x-badge, .x-button-small.x-button-pressed .x-button-label, .x-button-small.x-button-pressed .x-badge, .x-button-forward.x-button-pressing .x-button-label, .x-button-forward.x-button-pressing .x-badge, .x-button-forward.x-button-pressed .x-button-label, .x-button-forward.x-button-pressed .x-badge { color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:70 */ .x-button-decline, .x-button-decline-round, .x-button-decline-small { border-color: #fc3e39; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:75 */ .x-button-decline .x-button-label, .x-button-decline .x-badge, .x-button-decline-round .x-button-label, .x-button-decline-round .x-badge, .x-button-decline-small .x-button-label, .x-button-decline-small .x-badge { color: #fc3e39; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:79 */ .x-button-decline.x-button-pressing, .x-button-decline.x-button-pressed, .x-button-decline-round.x-button-pressing, .x-button-decline-round.x-button-pressed, .x-button-decline-small.x-button-pressing, .x-button-decline-small.x-button-pressed { border-color: #fed1d0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:83 */ .x-button-decline.x-button-pressing .x-button-label, .x-button-decline.x-button-pressing .x-badge, .x-button-decline.x-button-pressed .x-button-label, .x-button-decline.x-button-pressed .x-badge, .x-button-decline-round.x-button-pressing .x-button-label, .x-button-decline-round.x-button-pressing .x-badge, .x-button-decline-round.x-button-pressed .x-button-label, .x-button-decline-round.x-button-pressed .x-badge, .x-button-decline-small.x-button-pressing .x-button-label, .x-button-decline-small.x-button-pressing .x-badge, .x-button-decline-small.x-button-pressed .x-button-label, .x-button-decline-small.x-button-pressed .x-badge { color: #fed1d0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:89 */ .x-button-confirm, .x-button-confirm-round, .x-button-confirm-small { border-color: #53d769; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:94 */ .x-button-confirm .x-button-label, .x-button-confirm .x-badge, .x-button-confirm-round .x-button-label, .x-button-confirm-round .x-badge, .x-button-confirm-small .x-button-label, .x-button-confirm-small .x-badge { color: #53d769; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:98 */ .x-button-confirm.x-button-pressing, .x-button-confirm.x-button-pressed, .x-button-confirm-round.x-button-pressing, .x-button-confirm-round.x-button-pressed, .x-button-confirm-small.x-button-pressing, .x-button-confirm-small.x-button-pressed { border-color: #cff4d5; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:102 */ .x-button-confirm.x-button-pressing .x-button-label, .x-button-confirm.x-button-pressing .x-badge, .x-button-confirm.x-button-pressed .x-button-label, .x-button-confirm.x-button-pressed .x-badge, .x-button-confirm-round.x-button-pressing .x-button-label, .x-button-confirm-round.x-button-pressing .x-badge, .x-button-confirm-round.x-button-pressed .x-button-label, .x-button-confirm-round.x-button-pressed .x-badge, .x-button-confirm-small.x-button-pressing .x-button-label, .x-button-confirm-small.x-button-pressing .x-badge, .x-button-confirm-small.x-button-pressed .x-button-label, .x-button-confirm-small.x-button-pressed .x-badge { color: #cff4d5; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:109 */ .x-button.x-button-action, .x-button.x-button-action-round, .x-button.x-button-action-small { border-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:114 */ .x-button.x-button-action .x-button-label, .x-button.x-button-action .x-badge, .x-button.x-button-action-round .x-button-label, .x-button.x-button-action-round .x-badge, .x-button.x-button-action-small .x-button-label, .x-button.x-button-action-small .x-badge { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:118 */ .x-button.x-button-action.x-button-pressing, .x-button.x-button-action-round.x-button-pressing, .x-button.x-button-action-small.x-button-pressing { border-color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:121 */ .x-button.x-button-action.x-button-pressing .x-button-label, .x-button.x-button-action.x-button-pressing .x-badge, .x-button.x-button-action-round.x-button-pressing .x-button-label, .x-button.x-button-action-round.x-button-pressing .x-badge, .x-button.x-button-action-small.x-button-pressing .x-button-label, .x-button.x-button-action-small.x-button-pressing .x-badge { color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:128 */ .x-button.x-button-back { border: 0px; color: #157efb; background-color: transparent; margin: 0px; padding: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:135 */ .x-button.x-button-back:before { content: '"'; font-family: 'iOS7'; color: #157efb; font-size: 1.3em; text-align: center; background-color: transparent; line-height: 1.3em; padding-left: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:146 */ .x-button.x-button-back .x-button-label, .x-button.x-button-back .x-badge { font-size: 1.1em; line-height: 1.3em; font-weight: 300; padding-left: 2px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:153 */ .x-button.x-button-back.x-button-pressing { color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:156 */ .x-button.x-button-back.x-button-pressing:before { color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:160 */ .x-button.x-button-back.x-button-pressing .x-button-label, .x-button.x-button-back.x-button-pressing .x-badge { color: #abd1fe; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:168 */ .x-hasbadge { overflow: visible; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Button.scss:171 */ .x-hasbadge .x-badge { top: -5px; right: -6px; max-width: 55%; white-space: nowrap; text-overflow: ellipsis; text-align: center; display: block; overflow: hidden; color: #fff !important; min-width: 18px; font-weight: bold; text-shadow: 0 0 0 !important; font-family: "Helvetica Neue", Helvetica, Arial; font-size: 10px !important; padding: 1px 2px 2px; border: 0px; -webkit-border-radius: 26px; -moz-border-radius: 26px; -ms-border-radius: 26px; -o-border-radius: 26px; border-radius: 26px; background-color: #fc3e39; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Sheet.scss:1 */ .x-sheet-action { padding: 15px; border-top: 1px solid #ccc; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Sheet.scss:7 */ .x-sheet-action .x-button { margin-bottom: 7px; -webkit-border-radius: 6px; -moz-border-radius: 6px; -ms-border-radius: 6px; -o-border-radius: 6px; border-radius: 6px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Sheet.scss:11 */ .x-sheet-action .x-button:last-child { margin-bottom: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:1 */ .x-ios-7.x-standalone .x-menu { padding-top: 35px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:5 */ .x-menu { padding: 15px; border: 1px solid #ccc; border-width: 0; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:12 */ .x-menu .x-button { margin-bottom: 7px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:15 */ .x-menu .x-button:before { content: ''; display: block; position: absolute; bottom: -1px; left: 1em; right: 0px; border-type: solid; border-color: #dbdbe0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:26 */ .x-menu .x-button:last-child { margin-bottom: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:31 */ .x-menu.x-left, .x-menu.x-right { width: 220px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:37 */ .x-menu.x-left:before { border-right-width: 1px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:43 */ .x-menu.x-right:before { border-left-width: 1px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:49 */ .x-menu.x-top:before { border-bottom-width: 1px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Menu.scss:55 */ .x-menu.x-bottom:before { border-top-width: 1px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:1 */ .x-toolbar { background-color: #f8f9f9; min-height: 2.85em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:5 */ .x-toolbar.x-docked-bottom { border-top: 1px solid #ccc; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:9 */ .x-toolbar.x-docked-top { border-bottom: 1px solid #ccc; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:11 */ .x-toolbar.x-docked-top .x-button { padding-top: .15em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:16 */ .x-toolbar.x-docked-left { border-right: 1px solid #ccc; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:20 */ .x-toolbar.x-docked-right { border-left: 1px solid #ccc; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:24 */ .x-toolbar .x-title { color: #000; font-weight: 500; font-size: 1em; padding-top: .3em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:31 */ .x-toolbar .x-button { border: 0; background-color: transparent; margin: 0 5px; height: 2.0em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toolbar.scss:38 */ .x-toolbar .x-button-label, .x-toolbar .x-badge { font-size: 1.1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:8 */ .x-field { min-height: 2.5em; background: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:12 */ .x-field:last-child { border-bottom: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:17 */ .x-field-input { border: 1px solid #ccc; border-radius: 5px; background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:18 */ .x-field-input .x-clear-icon { background: url(images/clear_icon.png) no-repeat; background-position: center center; background-size: 55% 55%; width: 2.2em; height: 2.2em; margin: .5em; margin-top: -1.1em; right: -.5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:35 */ .x-field-clearable .x-field-input { padding-right: 2.2em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:40 */ .x-input-el { background: transparent; padding: .7em .4em .4em .4em; min-height: 2.5em; border-width: 0; -webkit-appearance: none; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:48 */ .x-ie .x-input-el { background: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:53 */ .x-item-disabled .x-form-label, .x-item-disabled input, .x-item-disabled .x-input-el, .x-item-disabled .x-spinner-body, .x-item-disabled select, .x-item-disabled textarea, .x-item-disabled .x-field-clear-container { color: #b3b3b3; pointer-events: none; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:65 */ .x-item-disabled .x-form-label { color: #aaa; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:69 */ .x-item-disabled .x-form-label:after { color: #666 !important; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:74 */ .x-toolbar .x-field { background: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:77 */ .x-toolbar .x-field .x-component-outer { padding: .4em .6em 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:81 */ .x-toolbar .x-field .x-input-el { padding: .3em .6em; min-height: 1.4em; background: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:88 */ .x-toolbar .x-field-input { position: relative; background: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:93 */ .x-toolbar .x-field-clearable .x-field-input { padding-right: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Field.scss:97 */ .x-toolbar .x-clear-icon { position: absolute; top: .9em; right: -.7em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/TextArea.scss:1 */ .x-field-textarea textarea { min-height: 7em; padding-top: .5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:5 */ .x-msgbox { padding: 0px; margin: 0px; max-width: 19em; border: 0px; background-image: -webkit-linear-gradient(top, #e7e8e8 1%, #d8ddde 25%, #e7e8e8 100%); background-image: -moz-linear-gradient(top, #e7e8e8 1%, #d8ddde 25%, #e7e8e8 100%); background-image: -o-linear-gradient(top, #e7e8e8 1%, #d8ddde 25%, #e7e8e8 100%); background-image: -ms-linear-gradient(top, #e7e8e8 1%, #d8ddde 25%, #e7e8e8 100%); } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:13 */ .x-msgbox .x-icon { margin: 0 0.8em 0 0.5em; background: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:19 */ .x-msgbox .x-msgbox-warning .x-button, .x-msgbox x-msgbox-error .x-button { border-color: #fc3e39; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:21 */ .x-msgbox .x-msgbox-warning .x-button .x-button-label, .x-msgbox .x-msgbox-warning .x-button .x-badge, .x-msgbox x-msgbox-error .x-button .x-button-label, .x-msgbox x-msgbox-error .x-button .x-badge { color: #fc3e39; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:27 */ .x-msgbox .x-msgbox-title { margin-top: 5px; margin-left: 10px; margin-right: 10px; min-height: 1.5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:33 */ .x-msgbox .x-msgbox-title .x-title { font-size: 1.2em; padding: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:40 */ .x-msgbox .x-dock-body { margin: 10px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:44 */ .x-msgbox .x-body { background: transparent !important; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:48 */ .x-msgbox .x-toolbar { background: transparent none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:52 */ .x-msgbox .x-toolbar.x-docked-top { } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:57 */ .x-msgbox .x-field { padding-top: .5em; min-height: .8em; margin: 0 0 .6em 0; background: transparent; -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:65 */ .x-msgbox .x-field-input { padding-right: 2.2em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:69 */ .x-msgbox .x-form-field { min-height: .8em; padding: .3em; padding-right: 0 !important; -webkit-appearance: none; background: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:78 */ .x-msgbox-text { color: #000; font-size: .9em; font-weight: 400; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:86 */ .x-msgbox { -webkit-border-radius: 7px; -moz-border-radius: 7px; -ms-border-radius: 7px; -o-border-radius: 7px; border-radius: 7px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:88 */ .x-msgbox .x-msgbox-buttons { padding: 0; height: auto; min-height: auto; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:93 */ .x-msgbox .x-msgbox-buttons .x-toolbar-inner { -webkit-box-align: end; -ms-flex-align: end; align-items: flex-end; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:96 */ .x-msgbox .x-msgbox-buttons .x-toolbar-inner .x-button { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; -o-border-radius: 0px; border-radius: 0px; background-color: transparent; border: 1px solid #9da1a0; border-bottom-width: 0px; height: 40px; margin: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:106 */ .x-msgbox .x-msgbox-buttons .x-toolbar-inner .x-button:first-child { border-left-width: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:110 */ .x-msgbox .x-msgbox-buttons .x-toolbar-inner .x-button:last-child { border-left-width: 0px; border-right-width: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:115 */ .x-msgbox .x-msgbox-buttons .x-toolbar-inner .x-button.x-button-pressing { background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/MessageBox.scss:119 */ .x-msgbox .x-msgbox-buttons .x-toolbar-inner .x-button .x-button-label, .x-msgbox .x-msgbox-buttons .x-toolbar-inner .x-button .x-badge { font-size: .9em; color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/SegmentedButton.scss:2 */ .x-toolbar .x-segmentedbutton .x-button, .x-segmentedbutton .x-button { margin: 0 !important; border: 1px solid #157efb; border-right: 0; -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/SegmentedButton.scss:8 */ .x-toolbar .x-segmentedbutton .x-button.x-button-pressed, .x-segmentedbutton .x-button.x-button-pressed { background-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/SegmentedButton.scss:10 */ .x-toolbar .x-segmentedbutton .x-button.x-button-pressed .x-button-label, .x-toolbar .x-segmentedbutton .x-button.x-button-pressed .x-badge, .x-segmentedbutton .x-button.x-button-pressed .x-button-label, .x-segmentedbutton .x-button.x-button-pressed .x-badge { color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/SegmentedButton.scss:16 */ .x-toolbar .x-segmentedbutton .x-first, .x-segmentedbutton .x-first { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/SegmentedButton.scss:20 */ .x-toolbar .x-segmentedbutton .x-last, .x-segmentedbutton .x-last { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; border-right: 1px solid #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toast.scss:5 */ .x-toast { -webkit-border-radius: 7px; -moz-border-radius: 7px; -ms-border-radius: 7px; -o-border-radius: 7px; border-radius: 7px; padding: 0px; margin: 0px; max-width: 19em; border: 1px; background-color: #fff; border-color: #dbdbe0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/Toast.scss:14 */ .x-toast .x-toast-text { padding: 2em; color: #157efb; font-size: .9em; font-weight: 400; } /* http://localhost:1843/modern/theme-cupertino/sass/src/carousel/Indicator.scss:1 */ .x-carousel-indicator span { -webkit-border-radius: 5px; -moz-border-radius: 5px; -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/carousel/Indicator.scss:4 */ .x-carousel-indicator span.x-carousel-indicator-active { background-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/IndexBar.scss:1 */ .x-indexbar-vertical { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:5 */ .x-list { background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:8 */ .x-list .x-list-disclosure { border: 0px; background-color: transparent; margin: 10px 15px 10px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:13 */ .x-list .x-list-disclosure:before { position: absolute; top: 0; right: 0; bottom: 0; left: 0; content: '!'; font-family: 'iOS7'; color: #ccc; font-size: 14px; text-align: center; background-color: transparent; line-height: 26px; padding-left: 2px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:26 */ .x-list .x-list-item { color: #000; font-weight: 400; border-top: 1px solid transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:31 */ .x-list .x-list-item.x-item-pressed { background-color: #d9d9d9; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:35 */ .x-list .x-list-item.x-item-selected.x-list-item-tpl { background-color: #e6e6e6; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:37 */ .x-list .x-list-item.x-item-selected.x-list-item-tpl .x-list-disclosure { background-color: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:42 */ .x-list .x-list-item .x-list-item-body, .x-list .x-list-item.x-list-item-tpl .x-innerhtml { padding: .7em 1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:47 */ .x-list .x-list-item.x-list-item-tpl:before { content: ''; display: block; position: absolute; bottom: -1px; left: 1em; right: 0px; border-bottom: solid 1px #dbdbe0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:57 */ .x-list .x-list-item.x-item-pressed.x-list-item-tpl:before, .x-list .x-list-item.x-item-selected.x-list-item-tpl:before, .x-list .x-list-item.x-list-footer-wrap.x-list-item-tpl:before { border-bottom: solid 1px transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:63 */ .x-list .x-list-header { background-color: #f7f7f7; border: 0px; padding: 0em 1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/dataview/List.scss:67 */ .x-list .x-list-header .x-innerhtml { font-size: 1.2em; font-weight: 600; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Checkbox.scss:10 */ .x-checkmark-base, .x-field-checkbox .x-field-mask::after, .x-field-radio .x-field-mask::after { position: absolute; top: 0; right: 12px; bottom: 0; content: '3'; font-family: 'Pictos'; font-size: 1.3em; text-align: right; line-height: 2.1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Checkbox.scss:25 */ .x-field-checkbox .x-field-mask::after, .x-field-radio .x-field-mask::after { color: #ccc; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Checkbox.scss:30 */ .x-input-checkbox, .x-input-radio { visibility: hidden; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Checkbox.scss:35 */ .x-input-checkbox:checked + .x-field-mask::after { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Checkbox.scss:40 */ .x-item-disabled .x-input-checkbox:checked + .x-field-mask::after { color: #79b5fd; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:5 */ .x-picker { background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:8 */ .x-picker .x-toolbar { border-top: 1px solid #d9d9d9; -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:14 */ .x-picker .x-picker-inner { background-color: #fff; overflow: hidden; margin: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:20 */ .x-picker-bar { border-top: .12em solid #d9d9d9; border-bottom: .12em solid #d9d9d9; height: 2.5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:27 */ .x-use-titles .x-picker-bar { margin-top: 1.5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:32 */ .x-picker-slot-title { height: 1.5em; padding: 0.2em 1.02em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:36 */ .x-picker-slot-title > div { font-size: 0.8em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:42 */ .x-picker-slot .x-dataview-item { height: 2.5em; line-height: 2.5em; font-weight: bold; padding: 0 10px; color: #000; } /* http://localhost:1843/modern/theme-cupertino/sass/src/picker/Picker.scss:50 */ .x-picker-slot .x-dataview-item.x-item-selected { color: #000; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Radio.scss:5 */ .x-field-radio .x-field-mask::after { color: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Radio.scss:10 */ .x-input-radio:checked + .x-field-mask::after { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Radio.scss:15 */ .x-item-disabled .x-input-radio:checked + .x-field-mask::after { color: #79b5fd; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Select.scss:5 */ .x-panel.x-select-overlay { padding: 8px; background-color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Select.scss:9 */ .x-panel.x-select-overlay > .x-panel-inner { overflow: hidden; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Select.scss:13 */ .x-panel.x-select-overlay .x-list { background: transparent !important; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:8 */ .x-slider, .x-toggle { height: 2.1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:13 */ .x-slider.x-item-disabled { opacity: 0.6; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:17 */ .x-thumb { height: 2.1em; width: 2.1em; background: transparent none; border: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:24 */ .x-thumb:after { content: ''; position: absolute; width: 1.75em; height: 1.75em; top: 0.175em; left: 0.175em; -webkit-box-shadow: 0 2px 1px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 2px 1px rgba(0, 0, 0, 0.3); box-shadow: 0 2px 1px rgba(0, 0, 0, 0.3); -webkit-border-radius: 0.875em; -moz-border-radius: 0.875em; -ms-border-radius: 0.875em; -o-border-radius: 0.875em; border-radius: 0.875em; background-color: #fff; border: .1em solid #dbdbdb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:32 */ .x-thumb.x-dragging { opacity: 1; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:34 */ .x-thumb.x-dragging:after { } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Slider.scss:41 */ .x-slider:before { margin: 0 0.875em; border-bottom: 0; background-color: #b5b5b6; content: ''; position: absolute; width: auto; height: .2em; top: 0.9875em; left: 0; -webkit-border-radius: 0.1em; -moz-border-radius: 0.1em; -ms-border-radius: 0.1em; -o-border-radius: 0.1em; border-radius: 0.1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Slider.scss:7 */ .x-slider-field .x-component-outer, .x-toggle-field .x-component-outer { padding: .6em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:2 */ .x-desktop.x-windows.x-chrome .x-spinner .x-spinner-button-down { line-height: .7em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:6 */ .x-desktop.x-windows.x-chrome .x-spinner .x-spinner-button-up { line-height: .85em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:12 */ .x-spinner .x-spinner-button { margin-top: .25em; margin-bottom: .25em; width: 2em; border: 2px solid #fff !important; -webkit-border-radius: 1em; -moz-border-radius: 1em; -ms-border-radius: 1em; -o-border-radius: 1em; border-radius: 1em; width: 1em; height: 1em; margin: 7px 7px 0 0; color: #fff; font-weight: 200; font-size: 1.8em; line-height: .56em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:19 */ .x-spinner .x-spinner-button.x-spinner-button-down { background-color: #fc3e39; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:23 */ .x-spinner .x-spinner-button.x-spinner-button-up { background-color: #53d769; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:37 */ .x-spinner .x-input-el { color: black; -webkit-text-fill-color: black; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:43 */ .x-spinner.x-item-disabled .x-input-el { color: #b3b3b3; -webkit-text-fill-color: #b3b3b3; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:49 */ .x-spinner.x-item-disabled .x-spinner-button.x-spinner-button-down { background-color: #fea09d; } /* http://localhost:1843/modern/theme-cupertino/sass/src/field/Spinner.scss:53 */ .x-spinner.x-item-disabled .x-spinner-button.x-spinner-button-up { background-color: #a6eab1; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:5 */ .x-toggle { width: 50px; height: 28px; border: 2px solid #e5e5e5; background-color: transparent; -webkit-border-radius: 22px; -moz-border-radius: 22px; -ms-border-radius: 22px; -o-border-radius: 22px; border-radius: 22px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:16 */ .x-toggle:before { -webkit-border-radius: 22px; -moz-border-radius: 22px; -ms-border-radius: 22px; -o-border-radius: 22px; border-radius: 22px; content: ''; background-color: white; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:27 */ .x-toggle .x-thumb { width: 22px; height: 22px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:31 */ .x-toggle .x-thumb.x-dragging { opacity: 1; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:35 */ .x-toggle .x-thumb:after { top: 0px; left: 0px; width: 22px; height: 22px; -webkit-border-radius: 22px; -moz-border-radius: 22px; -ms-border-radius: 22px; -o-border-radius: 22px; border-radius: 22px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:45 */ .x-toggle-on { background-color: #53d769; border-color: #53d769; } /* http://localhost:1843/modern/theme-cupertino/sass/src/slider/Toggle.scss:49 */ .x-toggle-on:before { background-color: #53d769; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:5 */ .x-form-fieldset { margin: 0px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:8 */ .x-form-fieldset .x-form-fieldset-inner { background: #fff; padding: 0; border-color: #dbdbe0; -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:16 */ .x-form-fieldset .x-field { background: transparent; position: relative; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:20 */ .x-form-fieldset .x-field:before { content: ''; display: block; position: absolute; bottom: 0px; left: 1em; right: 0px; border-bottom: solid 1px #dbdbe0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:31 */ .x-form-fieldset .x-field:last-child:before { border-bottom: solid 1px transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:40 */ .x-form-fieldset-title { margin: 2em .5em .5em 1em; color: #555; font-weight: 400; font-size: .9em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/FieldSet.scss:47 */ .x-form-fieldset-instructions { color: #555; margin: 1em; font-size: .8em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:6 */ .x-form .x-scroll-container { background-color: #edebf1; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:10 */ .x-form > input[type=submit] { display: none; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:14 */ .x-form .x-field .x-field-input, .x-form .x-field .x-input-el { font-weight: 300; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:20 */ .x-form.x-floating .x-input-el { padding-top: .5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:25 */ .x-form .x-field .x-field-input { border: 0px; background-color: transparent; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:31 */ .x-form-label { padding: .6em .6em .6em 1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:34 */ .x-form-label span { font-size: 1.1em; font-weight: 400; } /* http://localhost:1843/modern/theme-cupertino/sass/src/form/Panel.scss:40 */ .x-form-fieldset .x-form-fieldset-inner { border-top: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9; overflow: hidden; } /* http://localhost:1843/modern/theme-cupertino/sass/src/grid/Grid.scss:1 */ .x-grid .x-grid-header { background-color: #f7f7f7; border: 0; padding: 0 1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/grid/Grid.scss:5 */ .x-grid .x-grid-header .x-innerhtml { font-size: 1.2em; font-weight: 600; } /* http://localhost:1843/modern/theme-cupertino/sass/src/plugin/PullRefresh.scss:5 */ .x-list-pullrefresh-arrow { background: center center url(images/pullarrow.png.png) no-repeat; background-size: 2em 3em; -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 200ms; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } /* http://localhost:1843/modern/theme-cupertino/sass/src/plugin/PullRefresh.scss:13 */ .x-android-2 .x-list-pullrefresh-arrow { -webkit-transition-property: none; -webkit-transition-duration: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/plugin/PullRefresh.scss:18 */ .x-list-pullrefresh-release .x-list-pullrefresh-arrow { -webkit-transform: rotate(-180deg); -moz-transform: rotate(-180deg); -ms-transform: rotate(-180deg); -o-transform: rotate(-180deg); transform: rotate(-180deg); } /* http://localhost:1843/modern/theme-cupertino/sass/src/plugin/PullRefresh.scss:22 */ .x-list-pullrefresh-message { margin-bottom: 0.1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/plugin/field/PlaceHolderLabel.scss:3 */ .x-placeholderlabel.x-field-focused .x-form-label { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:1 */ .x-tabbar { min-height: 3em; background-color: #f9f9f9; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:5 */ .x-tabbar.x-docked-bottom { min-height: 3.1em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:10 */ .x-tab { height: 2.9em; margin: 0 .2em; border: 0; background: transparent; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:18 */ .x-tab-active { background: rgba(255, 255, 255, 0.15); } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:24 */ .x-tab.x-tab-active x-button-label { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:28 */ .x-tab.x-tab-active .x-button-icon:before, .x-tab.x-tab-active .x-button-label, .x-tab.x-tab-active .x-badge { color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:33 */ .x-tab .x-button-label, .x-tab .x-badge { font-size: .65em; font-weight: 400; color: #929292; line-height: 3em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:40 */ .x-tab .x-button-icon { display: block; width: 1.5em; height: 1.5em; margin: 0 auto; -webkit-text-stroke-width: .35px; -webkit-text-stroke-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:48 */ .x-tab .x-button-icon .x-button-icon.x-hidden { display: none; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:52 */ .x-tab .x-button-icon:before { color: transparent; font-size: 1.8em; line-height: 1.35em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:59 */ .x-tab .x-badge { top: 0px; left: 55%; right: auto; max-width: 55%; font-size: .65em; line-height: 1.5em; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:70 */ .x-tabbar.x-docked-top { padding: 10px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:72 */ .x-tabbar.x-docked-top .x-tab { -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; min-width: 3.3em; height: inherit; background-color: transparent; border: 0; padding: 3px; margin: 0; border: 1px solid #107bfb; color: #fff; padding: 7px; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:85 */ .x-tabbar.x-docked-top .x-tab .x-button-label, .x-tabbar.x-docked-top .x-tab .x-badge { color: #157efb; font-size: .8em; line-height: 1; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:91 */ .x-tabbar.x-docked-top .x-tab.x-tab-active { background-color: #157efb; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:93 */ .x-tabbar.x-docked-top .x-tab.x-tab-active .x-button-label, .x-tabbar.x-docked-top .x-tab.x-tab-active .x-badge { color: #fff; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:98 */ .x-tabbar.x-docked-top .x-tab .x-button-icon::before { display: none; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:102 */ .x-tabbar.x-docked-top .x-tab:first-child { border-radius: 4px 0px 0px 4px; border-right: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:107 */ .x-tabbar.x-docked-top .x-tab:last-child { border-radius: 0px 4px 4px 0px; border-left: 0; } /* http://localhost:1843/modern/theme-cupertino/sass/src/tab/Panel.scss:112 */ .x-tabbar.x-docked-top .x-tab .x-button-icon.x-hidden { display: none; }
sqlwang/DeviceManagementSystem
backend/webapp/ext/build/modern/theme-cupertino/resources/theme-cupertino-all-rtl-debug.css
CSS
bsd-3-clause
157,783
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Copyright 2007 Google Inc. All Rights Reserved. /** * @fileoverview A menu class for showing popups. A single popup can be * attached to multiple anchor points. The menu will try to reposition itself * if it goes outside the viewport. * * Decoration is the same as goog.ui.Menu except that the outer DIV can have a * 'for' property, which is the ID of the element which triggers the popup. * * Decorate Example: * <button id="dButton">Decorated Popup</button> * <div id="dMenu" for="dButton" class="goog-menu"> * <div class="goog-menuitem">A a</div> * <div class="goog-menuitem">B b</div> * <div class="goog-menuitem">C c</div> * <div class="goog-menuitem">D d</div> * <div class="goog-menuitem">E e</div> * <div class="goog-menuitem">F f</div> * </div> * * TESTED=FireFox 2.0, IE6, Opera 9, Chrome. * TODO: Key handling is flakey in Opera and Chrome * * @see ../demos/popupmenu.html */ goog.provide('goog.ui.PopupMenu'); goog.require('goog.events.EventType'); goog.require('goog.positioning.AnchoredViewportPosition'); goog.require('goog.positioning.Corner'); goog.require('goog.positioning.ViewportClientPosition'); goog.require('goog.structs'); goog.require('goog.structs.Map'); goog.require('goog.style'); goog.require('goog.ui.Component.EventType'); goog.require('goog.ui.Menu'); goog.require('goog.ui.PopupBase'); goog.require('goog.userAgent'); /** * A basic menu class. * @param {goog.dom.DomHelper} opt_domHelper Optional DOM helper. * @extends {goog.ui.Menu} * @constructor */ goog.ui.PopupMenu = function(opt_domHelper) { goog.ui.Menu.call(this, opt_domHelper); this.setAllowAutoFocus(true); // Popup menus are hidden by default. this.setVisible(false, true); /** * Map of attachment points for the menu. Key -> Object * @type {!goog.structs.Map} * @private */ this.targets_ = new goog.structs.Map(); }; goog.inherits(goog.ui.PopupMenu, goog.ui.Menu); /** * If true, then if the menu will toggle off if it is already visible. * @type {boolean} * @private */ goog.ui.PopupMenu.prototype.toggleMode_ = false; /** * Time that the menu was last shown. * @type {number} * @private */ goog.ui.PopupMenu.prototype.lastHide_ = 0; /** * Current element where the popup menu is anchored. * @type {Element?} * @private */ goog.ui.PopupMenu.prototype.currentAnchor_ = null; /** * Decorate an existing HTML structure with the menu. Menu items will be * constructed from elements with classname 'goog-menuitem', separators will be * made from HR elements. * @param {Element} element Element to decorate. */ goog.ui.PopupMenu.prototype.decorateInternal = function(element) { goog.ui.PopupMenu.superClass_.decorateInternal.call(this, element); // 'for' is a custom attribute for attaching the menu to a click target var htmlFor = element.getAttribute('for') || element.htmlFor; if (htmlFor) { this.attach( this.getDomHelper().getElement(htmlFor), goog.positioning.Corner.BOTTOM_LEFT); } }; /** * The menu has been added to the document. */ goog.ui.PopupMenu.prototype.enterDocument = function() { goog.ui.PopupMenu.superClass_.enterDocument.call(this); goog.structs.forEach(this.targets_, this.attachEvent_, this); var handler = this.getHandler(); handler.listen( this, goog.ui.Component.EventType.ACTION, this.onAction_); handler.listen(this.getDomHelper().getDocument(), goog.events.EventType.MOUSEDOWN, this.onDocClick, true); // Webkit doesn't fire a mousedown event when opening the context menu, // but we need one to update menu visibility properly. So in Safari handle // contextmenu mouse events like mousedown. // {@link http://bugs.webkit.org/show_bug.cgi?id=6595} if (goog.userAgent.WEBKIT) { handler.listen(this.getDomHelper().getDocument(), goog.events.EventType.CONTEXTMENU, this.onDocClick, true); } }; /** * Attaches the menu to a new popup position and anchor element. A menu can * only be attached to an element once, since attaching the same menu for * multiple positions doesn't make sense. * * @param {Element} element Element whose click event should trigger the menu. * @param {goog.positioning.Corner} opt_targetCorner Corner of the target that * the menu should be anchored to. * @param {goog.positioning.Corner} opt_menuCorner Corner of the menu that * should be anchored. * @param {boolean} opt_contextMenu Whether the menu should show on * {@link goog.events.EventType.CONTEXTMENU} events, false if it should * show on {@link goog.events.EventType.MOUSEDOWN} events. Default is * MOUSEDOWN. * @param {goog.math.Box} opt_margin Margin for the popup used in positioning * algorithms. */ goog.ui.PopupMenu.prototype.attach = function( element, opt_targetCorner, opt_menuCorner, opt_contextMenu, opt_margin) { if (this.isAttachTarget(element)) { // Already in the popup, so just return. return; } var target = this.createAttachTarget(element, opt_targetCorner, opt_menuCorner, opt_contextMenu, opt_margin); if (this.isInDocument()) { this.attachEvent_(target); } }; /** * Creates an object describing how the popup menu should be attached to the * anchoring element based on the given parameters. The created object is * stored, keyed by {@code element} and is retrievable later by invoking * {@link #getAttachTarget(element)} at a later point. * * Subclass may add more properties to the returned object, as needed. * * @param {Element} element Element whose click event should trigger the menu. * @param {goog.positioning.Corner} opt_targetCorner Corner of the target that * the menu should be anchored to. * @param {goog.positioning.Corner} opt_menuCorner Corner of the menu that * should be anchored. * @param {boolean} opt_contextMenu Whether the menu should show on * {@link goog.events.EventType.CONTEXTMENU} events, false if it should * show on {@link goog.events.EventType.MOUSEDOWN} events. Default is * MOUSEDOWN. * @param {goog.math.Box} opt_margin Margin for the popup used in positioning * algorithms. * * @return {Object} An object that describes how the popup menu should be * attached to the anchoring element. * * @protected */ goog.ui.PopupMenu.prototype.createAttachTarget = function( element, opt_targetCorner, opt_menuCorner, opt_contextMenu, opt_margin) { if (!element) { return null; } var target = { element_: element, targetCorner_: opt_targetCorner, menuCorner_: opt_menuCorner, eventType_: opt_contextMenu ? goog.events.EventType.CONTEXTMENU : goog.events.EventType.MOUSEDOWN, margin_: opt_margin }; this.targets_.set(goog.getHashCode(element), target); return target; }; /** * Returns the object describing how the popup menu should be attach to given * element or {@code null}. The object is created and the association is formed * when {@link #attach} is invoked. * * @param {Element} element DOM element. * @return {Object} The object created when {@link attach} is invoked on * {@code element}. Returns {@code null} if the element does not trigger * the menu (i.e. {@link attach} has never been invoked on * {@code element}). * @protected */ goog.ui.PopupMenu.prototype.getAttachTarget = function(element) { return element ? /** @type {Object} */(this.targets_.get(goog.getHashCode(element))) : null; }; /** * @param {Element} element Any DOM element. * @return {boolean} Whether clicking on the given element will trigger the * menu. * * @protected */ goog.ui.PopupMenu.prototype.isAttachTarget = function(element) { return element ? this.targets_.containsKey(goog.getHashCode(element)) : false; }; /** * @return {Element?} The current element where the popup is anchored, if it's * visible. */ goog.ui.PopupMenu.prototype.getAttachedElement = function() { return this.currentAnchor_; }; /** * Attaches an event listener to a target * @param {Object} target The target to attach an event to. * @private */ goog.ui.PopupMenu.prototype.attachEvent_ = function(target) { this.getHandler().listen( target.element_, target.eventType_, this.onTargetClick_); }; /** * Detaches all listeners */ goog.ui.PopupMenu.prototype.detachAll = function() { if (this.isInDocument()) { var keys = this.targets_.getKeys(); for (var i = 0; i < keys.length; i++) { this.detachEvent_(/** @type {Object} */ (this.targets_.get(keys[i]))); } } this.targets_.clear(); }; /** * Detaches a menu from a given element. * @param {Element} element Element whose click event should trigger the menu. */ goog.ui.PopupMenu.prototype.detach = function(element) { if (!this.isAttachTarget(element)) { throw Error('Menu not attached to provided element, unable to detach.'); } var key = goog.getHashCode(element); if (this.isInDocument()) { this.detachEvent_(/** @type {Object} */ (this.targets_.get(key))); } this.targets_.remove(key); }; /** * Detaches an event listener to a target * @param {Object} target The target to detach events from. * @private */ goog.ui.PopupMenu.prototype.detachEvent_ = function(target) { this.getHandler().unlisten( target.element_, target.eventType_, this.onTargetClick_); }; /** * Sets whether the menu should toggle if it is already open. For context * menus this should be false, for toolbar menus it makes more sense to be true. * @param {boolean} toggle The new toggle mode. */ goog.ui.PopupMenu.prototype.setToggleMode = function(toggle) { this.toggleMode_ = toggle; }; /** * Gets whether the menu is in toggle mode * @return {boolean} toggle. */ goog.ui.PopupMenu.prototype.getToggleMode = function() { return this.toggleMode_; }; /** * Show the menu at a given attached target. * @param {Object} target Popup target. * @param {number} x The client-X associated with the show event. * @param {number} y The client-Y associated with the show event. * @protected */ goog.ui.PopupMenu.prototype.showMenu = function(target, x, y) { var isVisible = this.isVisible(); if ((isVisible || this.wasRecentlyHidden()) && this.toggleMode_) { this.hide(); return; } // Notify event handlers that the menu is about to be shown. if (!this.dispatchEvent(goog.ui.Component.EventType.BEFORE_SHOW)) { return; } var position = goog.isDef(target.targetCorner_) ? new goog.positioning.AnchoredViewportPosition(target.element_, target.targetCorner_) : new goog.positioning.ViewportClientPosition(x, y); var menuCorner = goog.isDef(target.menuCorner_) ? target.menuCorner_ : goog.positioning.Corner.TOP_START; // This is a little hacky so that we can position the menu with minimal // flicker. if (!isVisible) { // On IE, setting visibility = 'hidden' on a visible menu // will cause a blur, forcing the menu to close immediately. this.getElement().style.visibility = 'hidden'; } goog.style.showElement(this.getElement(), true); position.reposition(this.getElement(), menuCorner, target.margin_); if (!isVisible) { this.getElement().style.visibility = 'visible'; } this.currentAnchor_ = target.element_; this.setHighlightedIndex(-1); // setVisible dispatches a goog.ui.Component.EventType.SHOW event, which may // be canceled to prevent the menu from being shown. this.setVisible(true); }; /** * Shows the menu immediately at the given client coordinates. * @param {number} x The client-X associated with the show event. * @param {number} y The client-Y associated with the show event. * @param {goog.positioning.Corner} opt_menuCorner Corner of the menu that * should be anchored. */ goog.ui.PopupMenu.prototype.showAt = function(x, y, opt_menuCorner) { this.showMenu({menuCorner_: opt_menuCorner}, x, y); }; /** * Shows the menu immediately attached to the given element * @param {Element} element The element to show at. * @param {goog.positioning.Corner} targetCorner The corner of the target to * anchor to. * @param {goog.positioning.Corner} opt_menuCorner Corner of the menu that * should be anchored. */ goog.ui.PopupMenu.prototype.showAtElement = function(element, targetCorner, opt_menuCorner) { this.showMenu({ menuCorner_: opt_menuCorner, element_: element, targetCorner_: targetCorner }, 0, 0); }; /** * Hides the menu. */ goog.ui.PopupMenu.prototype.hide = function() { // setVisible dispatches a goog.ui.Component.EventType.HIDE event, which may // be canceled to prevent the menu from being hidden. this.setVisible(false); if (!this.isVisible()) { // HIDE event wasn't canceled; the menu is now hidden. this.lastHide_ = goog.now(); this.currentAnchor_ = null; } }; /** * Used to stop the menu toggling back on if the toggleMode == false. * @return {boolean} Whether the menu was recently hidden. * @protected */ goog.ui.PopupMenu.prototype.wasRecentlyHidden = function() { return goog.now() - this.lastHide_ < goog.ui.PopupBase.DEBOUNCE_DELAY_MS; }; /** * Dismiss the popup menu when an action fires. * @param {goog.events.Event} opt_e The optional event. * @private */ goog.ui.PopupMenu.prototype.onAction_ = function(opt_e) { this.hide(); }; /** * Handles a browser event on one of the popup targets * @param {goog.events.BrowserEvent} e The browser event. * @private */ goog.ui.PopupMenu.prototype.onTargetClick_ = function(e) { var keys = this.targets_.getKeys(); for (var i = 0; i < keys.length; i++) { var target = /** @type {Object} */(this.targets_.get(keys[i])); if (target.element_ == e.currentTarget) { this.showMenu(target, /** @type {number} */ (e.clientX), /** @type {number} */ (e.clientY)); e.preventDefault(); e.stopPropagation(); return; } } }; /** * Handles click events that propagate to the document. * @param {goog.events.BrowserEvent} e The browser event. * @protected */ goog.ui.PopupMenu.prototype.onDocClick = function(e) { if (this.isVisible() && !this.containsElement(/** @type {Element} */ (e.target))) { this.hide(); } }; /** * Handles the key event target loosing focus. * @param {goog.events.BrowserEvent} e The browser event. * @protected */ goog.ui.PopupMenu.prototype.handleBlur = function(e) { goog.ui.PopupMenu.superClass_.handleBlur.call(this, e); this.hide(); }; /** @inheritDoc */ goog.ui.PopupMenu.prototype.disposeInternal = function() { // Always call the superclass' disposeInternal() first (Bug 715885). goog.ui.PopupMenu.superClass_.disposeInternal.call(this); // Disposes of the attachment target map. if (this.targets_) { this.targets_.clear(); delete this.targets_; } };
yesudeep/puppy
tools/google-closure-library/closure/goog/ui/popupmenu.js
JavaScript
mit
15,404
# Symfony CMF Standard Edition [![Build Status](https://secure.travis-ci.org/symfony-cmf/standard-edition.png)](http://travis-ci.org/symfony-cmf/standard-edition) [![Latest Stable Version](https://poser.pugx.org/symfony-cmf/standard-edition/version.png)](https://packagist.org/packages/symfony-cmf/standard-edition) [![Total Downloads](https://poser.pugx.org/symfony-cmf/standard-edition/d/total.png)](https://packagist.org/packages/symfony-cmf/standard-edition) The Symfony CMF Standard Edition (SE) is a distribution of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). This distribution is based on all the main CMF components needed for most common use cases, and can be used to create a new Symfony/CMF project from scratch. ## Requirements * Symfony 2.3.x * See also the `require` section of [composer.json](composer.json) ## Documentation For the install guide and reference, see: * [Symfony CMF standard edition documentation](http://symfony.com/doc/master/cmf/book/installation.html) See also: * [All Symfony CMF documentation](http://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference * [Symfony CMF Website](http://cmf.symfony.com/) - introduction, live demo, support and community links ## Contributing Pull requests are welcome. Please see our [CONTRIBUTING](CONTRIBUTING.md) guide. Unit and/or functional tests exist for this bundle. See the [Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html) for a guide to running the tests. Thanks to [everyone who has contributed](https://github.com/symfony-cmf/standard-edition/contributors) already.
GTheron/Clam
SYMFONY_CMF_README.md
Markdown
mit
1,694
require 'test_helper' class CreditCardTest < Test::Unit::TestCase def setup CreditCard.require_verification_value = false @visa = credit_card("4779139500118580", :brand => "visa") @solo = credit_card("676700000000000000", :brand => "solo", :issue_number => '01') end def teardown CreditCard.require_verification_value = false end def test_constructor_should_properly_assign_values c = credit_card assert_equal "4242424242424242", c.number assert_equal 9, c.month assert_equal Time.now.year + 1, c.year assert_equal "Longbob Longsen", c.name assert_equal "visa", c.brand assert_valid c end def test_new_credit_card_should_not_be_valid c = CreditCard.new assert_not_valid c assert_false c.errors.empty? end def test_should_be_a_valid_visa_card assert_valid @visa assert @visa.errors.empty? end def test_should_be_a_valid_solo_card assert_valid @solo assert @solo.errors.empty? end def test_cards_with_empty_names_should_not_be_valid @visa.first_name = '' @visa.last_name = '' assert_not_valid @visa assert_false @visa.errors.empty? end def test_should_be_able_to_access_errors_indifferently @visa.first_name = '' assert_not_valid @visa assert @visa.errors.on(:first_name) assert @visa.errors.on("first_name") end def test_should_be_able_to_liberate_a_bogus_card c = credit_card('', :brand => 'bogus') assert_valid c c.brand = 'visa' assert_not_valid c end def test_should_be_able_to_identify_invalid_card_numbers @visa.number = nil assert_not_valid @visa @visa.number = "11112222333344ff" assert_not_valid @visa assert_false @visa.errors.on(:type) assert_false @visa.errors.on(:brand) assert @visa.errors.on(:number) @visa.number = "111122223333444" assert_not_valid @visa assert_false @visa.errors.on(:type) assert_false @visa.errors.on(:brand) assert @visa.errors.on(:number) @visa.number = "11112222333344444" assert_not_valid @visa assert_false @visa.errors.on(:type) assert_false @visa.errors.on(:brand) assert @visa.errors.on(:number) end def test_should_have_errors_with_invalid_card_brand_for_otherwise_correct_number @visa.brand = 'master' assert_not_valid @visa assert_false @visa.errors.on(:number) assert @visa.errors.on(:brand) assert_equal "does not match the card number", @visa.errors.on(:brand) end def test_should_be_invalid_when_brand_cannot_be_detected @visa.brand = nil @visa.number = nil assert_not_valid @visa assert_false @visa.errors.on(:brand) assert_false @visa.errors.on(:type) assert @visa.errors.on(:number) assert_equal 'is required', @visa.errors.on(:number) @visa.number = "11112222333344ff" assert_not_valid @visa assert_false @visa.errors.on(:type) assert_false @visa.errors.on(:brand) assert @visa.errors.on(:number) @visa.number = "11112222333344444" assert_not_valid @visa assert_false @visa.errors.on(:brand) assert_false @visa.errors.on(:type) assert @visa.errors.on(:number) end def test_should_be_a_valid_card_number @visa.number = "4242424242424242" assert_valid @visa end def test_should_require_a_valid_card_month @visa.month = Time.now.utc.month @visa.year = Time.now.utc.year assert_valid @visa end def test_should_not_be_valid_with_empty_month @visa.month = '' assert_not_valid @visa assert_equal 'is required', @visa.errors.on('month') end def test_should_not_be_valid_for_edge_month_cases @visa.month = 13 @visa.year = Time.now.year assert_not_valid @visa assert @visa.errors.on('month') @visa.month = 0 @visa.year = Time.now.year assert_not_valid @visa assert @visa.errors.on('month') end def test_should_be_invalid_with_empty_year @visa.year = '' assert_not_valid @visa assert_equal 'is required', @visa.errors.on('year') end def test_should_not_be_valid_for_edge_year_cases @visa.year = Time.now.year - 1 assert_not_valid @visa assert @visa.errors.on('year') @visa.year = Time.now.year + 21 assert_not_valid @visa assert @visa.errors.on('year') end def test_should_be_a_valid_future_year @visa.year = Time.now.year + 1 assert_valid @visa end def test_expired_card_should_have_one_error_on_year @visa.year = Time.now.year - 1 assert_not_valid @visa assert_equal 1, @visa.errors['year'].length assert /expired/ =~ @visa.errors['year'].first end def test_should_be_valid_with_start_month_and_year_as_string @solo.start_month = '2' @solo.start_year = '2007' assert_valid @solo end def test_should_identify_wrong_card_brand c = credit_card(:brand => 'master') assert_not_valid c end def test_should_display_number assert_equal 'XXXX-XXXX-XXXX-1234', CreditCard.new(:number => '1111222233331234').display_number assert_equal 'XXXX-XXXX-XXXX-1234', CreditCard.new(:number => '111222233331234').display_number assert_equal 'XXXX-XXXX-XXXX-1234', CreditCard.new(:number => '1112223331234').display_number assert_equal 'XXXX-XXXX-XXXX-', CreditCard.new(:number => nil).display_number assert_equal 'XXXX-XXXX-XXXX-', CreditCard.new(:number => '').display_number assert_equal 'XXXX-XXXX-XXXX-123', CreditCard.new(:number => '123').display_number assert_equal 'XXXX-XXXX-XXXX-1234', CreditCard.new(:number => '1234').display_number assert_equal 'XXXX-XXXX-XXXX-1234', CreditCard.new(:number => '01234').display_number end def test_should_correctly_identify_card_brand assert_equal 'visa', CreditCard.brand?('4242424242424242') assert_equal 'american_express', CreditCard.brand?('341111111111111') assert_nil CreditCard.brand?('') end def test_should_be_able_to_require_a_verification_value CreditCard.require_verification_value = true assert CreditCard.requires_verification_value? end def test_should_not_be_valid_when_requiring_a_verification_value CreditCard.require_verification_value = true card = credit_card('4242424242424242', :verification_value => nil) assert_not_valid card card.verification_value = '123' assert_valid card end def test_should_require_valid_start_date_for_solo_or_switch @solo.start_month = nil @solo.start_year = nil @solo.issue_number = nil assert_not_valid @solo assert @solo.errors.on('start_month') assert @solo.errors.on('start_year') assert @solo.errors.on('issue_number') @solo.start_month = 2 @solo.start_year = 2007 assert_valid @solo end def test_should_require_a_valid_issue_number_for_solo_or_switch @solo.start_month = nil @solo.start_year = 2005 @solo.issue_number = nil assert_not_valid @solo assert @solo.errors.on('start_month') assert_equal "cannot be empty", @solo.errors.on('issue_number') @solo.issue_number = 3 assert_valid @solo end def test_should_require_a_validate_non_empty_issue_number_for_solo_or_switch @solo.issue_number = "invalid" assert_not_valid @solo assert_equal "is invalid", @solo.errors.on('issue_number') @solo.issue_number = 3 assert_valid @solo end def test_should_return_last_four_digits_of_card_number ccn = CreditCard.new(:number => "4779139500118580") assert_equal "8580", ccn.last_digits end def test_bogus_last_digits ccn = CreditCard.new(:number => "1") assert_equal "1", ccn.last_digits end def test_should_return_first_four_digits_of_card_number ccn = CreditCard.new(:number => "4779139500118580") assert_equal "477913", ccn.first_digits end def test_should_return_first_bogus_digit_of_card_number ccn = CreditCard.new(:number => "1") assert_equal "1", ccn.first_digits end def test_should_be_true_when_credit_card_has_a_first_name c = CreditCard.new assert_false c.first_name? c = CreditCard.new(:first_name => 'James') assert c.first_name? end def test_should_be_true_when_credit_card_has_a_last_name c = CreditCard.new assert_false c.last_name? c = CreditCard.new(:last_name => 'Herdman') assert c.last_name? end def test_should_test_for_a_full_name c = CreditCard.new assert_false c.name? c = CreditCard.new(:first_name => 'James', :last_name => 'Herdman') assert c.name? end def test_should_handle_full_name_when_first_or_last_is_missing c = CreditCard.new(:first_name => 'James') assert c.name? assert_equal "James", c.name c = CreditCard.new(:last_name => 'Herdman') assert c.name? assert_equal "Herdman", c.name end def test_should_assign_a_full_name c = CreditCard.new :name => "James Herdman" assert_equal "James", c.first_name assert_equal "Herdman", c.last_name c = CreditCard.new :name => "Rocket J. Squirrel" assert_equal "Rocket J.", c.first_name assert_equal "Squirrel", c.last_name c = CreditCard.new :name => "Twiggy" assert_equal "", c.first_name assert_equal "Twiggy", c.last_name end # The following is a regression for a bug that raised an exception when # a new credit card was validated def test_validate_new_card credit_card = CreditCard.new assert_nothing_raised do credit_card.validate end end # The following is a regression for a bug where the keys of the # credit card card_companies hash were not duped when detecting the brand def test_create_and_validate_credit_card_from_brand credit_card = CreditCard.new(:brand => CreditCard.brand?('4242424242424242')) assert_nothing_raised do credit_card.valid? end end def test_autodetection_of_credit_card_brand credit_card = CreditCard.new(:number => '4242424242424242') credit_card.valid? assert_equal 'visa', credit_card.brand end def test_card_brand_should_not_be_autodetected_when_provided credit_card = CreditCard.new(:number => '4242424242424242', :brand => 'master') credit_card.valid? assert_equal 'master', credit_card.brand end def test_detecting_bogus_card credit_card = CreditCard.new(:number => '1') credit_card.valid? assert_equal 'bogus', credit_card.brand end def test_validating_bogus_card credit_card = credit_card('1', :brand => nil) assert credit_card.valid? end def test_mask_number assert_equal 'XXXX-XXXX-XXXX-5100', CreditCard.mask('5105105105105100') end def test_strip_non_digit_characters card = credit_card('4242-4242 %%%%%%4242......4242') assert card.valid? assert_equal "4242424242424242", card.number end def test_before_validate_handles_blank_number card = credit_card(nil) assert !card.valid? assert_equal "", card.number end def test_brand_is_aliased_as_type assert_deprecation_warning("CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead.", CreditCard) do assert_equal @visa.type, @visa.brand end assert_deprecation_warning("CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead.", CreditCard) do assert_equal @solo.type, @solo.brand end end end
michaelherold/active_merchant
test/unit/credit_card_test.rb
Ruby
mit
11,445
package aima.test.core.unit.probability.full; import org.junit.Test; import aima.core.probability.example.FullJointDistributionBurglaryAlarmModel; import aima.core.probability.example.FullJointDistributionMeningitisStiffNeckModel; import aima.core.probability.example.FullJointDistributionPairFairDiceModel; import aima.core.probability.example.FullJointDistributionToothacheCavityCatchModel; import aima.core.probability.example.FullJointDistributionToothacheCavityCatchWeatherModel; import aima.test.core.unit.probability.CommonFiniteProbabilityModelTests; public class FullJointProbabilityModelTest extends CommonFiniteProbabilityModelTests { // // ProbabilityModel Tests @Test public void test_RollingPairFairDiceModel() { test_RollingPairFairDiceModel(new FullJointDistributionPairFairDiceModel()); } @Test public void test_ToothacheCavityCatchModel() { test_ToothacheCavityCatchModel(new FullJointDistributionToothacheCavityCatchModel()); } @Test public void test_ToothacheCavityCatchWeatherModel() { test_ToothacheCavityCatchWeatherModel(new FullJointDistributionToothacheCavityCatchWeatherModel()); } @Test public void test_MeningitisStiffNeckModel() { test_MeningitisStiffNeckModel(new FullJointDistributionMeningitisStiffNeckModel()); } @Test public void test_BurglaryAlarmModel() { test_BurglaryAlarmModel(new FullJointDistributionBurglaryAlarmModel()); } // // FiniteProbabilityModel Tests @Test public void test_RollingPairFairDiceModel_Distributions() { test_RollingPairFairDiceModel_Distributions(new FullJointDistributionPairFairDiceModel()); } @Test public void test_ToothacheCavityCatchModel_Distributions() { test_ToothacheCavityCatchModel_Distributions(new FullJointDistributionToothacheCavityCatchModel()); } @Test public void test_ToothacheCavityCatchWeatherModel_Distributions() { test_ToothacheCavityCatchWeatherModel_Distributions(new FullJointDistributionToothacheCavityCatchWeatherModel()); } @Test public void test_MeningitisStiffNeckModel_Distributions() { test_MeningitisStiffNeckModel_Distributions(new FullJointDistributionMeningitisStiffNeckModel()); } @Test public void test_BurglaryAlarmModel_Distributions() { test_BurglaryAlarmModel_Distributions(new FullJointDistributionBurglaryAlarmModel()); } }
Iroxsmyth/Brisca-AI-2017
src/test/java/aima/test/core/unit/probability/full/FullJointProbabilityModelTest.java
Java
mit
2,305
module Arel module Visitors class Oracle12 < Arel::Visitors::ToSql private def visit_Arel_Nodes_SelectStatement o, collector # Oracle does not allow LIMIT clause with select for update if o.limit && o.lock raise ArgumentError, <<-MSG 'Combination of limit and lock is not supported. because generated SQL statements `SELECT FOR UPDATE and FETCH FIRST n ROWS` generates ORA-02014.` MSG end super end def visit_Arel_Nodes_SelectOptions o, collector collector = maybe_visit o.offset, collector collector = maybe_visit o.limit, collector collector = maybe_visit o.lock, collector end def visit_Arel_Nodes_Limit o, collector collector << "FETCH FIRST " collector = visit o.expr, collector collector << " ROWS ONLY" end def visit_Arel_Nodes_Offset o, collector collector << "OFFSET " visit o.expr, collector collector << " ROWS" end def visit_Arel_Nodes_Except o, collector collector << "( " collector = infix_value o, collector, " MINUS " collector << " )" end def visit_Arel_Nodes_UpdateStatement o, collector # Oracle does not allow ORDER BY/LIMIT in UPDATEs. if o.orders.any? && o.limit.nil? # However, there is no harm in silently eating the ORDER BY clause if no LIMIT has been provided, # otherwise let the user deal with the error o = o.dup o.orders = [] end super end def visit_Arel_Nodes_BindParam o, collector collector.add_bind(o) { |i| ":a#{i}" } end end end end
afuerstenau/daily-notes
vendor/cache/ruby/2.5.0/gems/arel-7.1.4/lib/arel/visitors/oracle12.rb
Ruby
mit
1,744
require 'spec_helper' describe Mailboxer do it "should be valid" do Mailboxer.should be_a(Module) end end
div/mailboxer
spec/mailboxer_spec.rb
Ruby
mit
115
<?php /** * @package boot */ if(!defined('PHP_VERSION_ID')){ $version = PHP_VERSION; /** * For versions of PHP below 5.2.7, the PHP_VERSION_ID constant, doesn't * exist, so this will just mimic the functionality as described on the * PHP documentation * * @link http://php.net/manual/en/function.phpversion.php * @var integer */ define('PHP_VERSION_ID', ($version{0} * 10000 + $version{2} * 100 + $version{4})); } if (PHP_VERSION_ID >= 50300){ error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); } else{ error_reporting(E_ALL & ~E_NOTICE); } ini_set('magic_quotes_runtime', 0); require_once(DOCROOT . '/symphony/lib/boot/func.utilities.php'); require_once(DOCROOT . '/symphony/lib/boot/defines.php'); if (!file_exists(CONFIG)) { if (file_exists(DOCROOT . '/install/index.php')) { header(sprintf('Location: %s/install/', URL)); exit; } die('<h2>Error</h2><p>Could not locate Symphony configuration file. Please check <code>manifest/config.php</code> exists.</p>'); } include(CONFIG);
eliksir/norske-webapps
www/symphony/lib/boot/bundle.php
PHP
mit
1,065
// Copyright 2006 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview Number format/parse library with locale support. */ /** * Namespace for locale number format functions */ goog.provide('goog.i18n.NumberFormat'); goog.require('goog.i18n.NumberFormatSymbols'); goog.require('goog.i18n.currencyCodeMap'); /** * Constructor of NumberFormat. * @param {number|string} pattern The number that indicates a predefined * number format pattern. * @param {string=} opt_currency Optional international currency code. This * determines the currency code/symbol used in format/parse. If not given, * the currency code for current locale will be used. * @constructor */ goog.i18n.NumberFormat = function(pattern, opt_currency) { this.intlCurrencyCode_ = opt_currency || goog.i18n.NumberFormatSymbols.DEF_CURRENCY_CODE; this.currencySymbol_ = goog.i18n.currencyCodeMap[this.intlCurrencyCode_]; this.maximumIntegerDigits_ = 40; this.minimumIntegerDigits_ = 1; this.maximumFractionDigits_ = 3; // invariant, >= minFractionDigits this.minimumFractionDigits_ = 0; this.minExponentDigits_ = 0; this.useSignForPositiveExponent_ = false; this.positivePrefix_ = ''; this.positiveSuffix_ = ''; this.negativePrefix_ = '-'; this.negativeSuffix_ = ''; // The multiplier for use in percent, per mille, etc. this.multiplier_ = 1; this.groupingSize_ = 3; this.decimalSeparatorAlwaysShown_ = false; this.useExponentialNotation_ = false; if (typeof pattern == 'number') { this.applyStandardPattern_(pattern); } else { this.applyPattern_(pattern); } }; /** * Standard number formatting patterns. * @enum {number} */ goog.i18n.NumberFormat.Format = { DECIMAL: 1, SCIENTIFIC: 2, PERCENT: 3, CURRENCY: 4 }; /** * Apply provided pattern, result are stored in member variables. * * @param {string} pattern String pattern being applied. * @private */ goog.i18n.NumberFormat.prototype.applyPattern_ = function(pattern) { this.pattern_ = pattern.replace(/ /g, '\u00a0'); var pos = [0]; this.positivePrefix_ = this.parseAffix_(pattern, pos); var trunkStart = pos[0]; this.parseTrunk_(pattern, pos); var trunkLen = pos[0] - trunkStart; this.positiveSuffix_ = this.parseAffix_(pattern, pos); if (pos[0] < pattern.length && pattern.charAt(pos[0]) == goog.i18n.NumberFormat.PATTERN_SEPARATOR_) { pos[0]++; this.negativePrefix_ = this.parseAffix_(pattern, pos); // we assume this part is identical to positive part. // user must make sure the pattern is correctly constructed. pos[0] += trunkLen; this.negativeSuffix_ = this.parseAffix_(pattern, pos); } else { // if no negative affix specified, they share the same positive affix this.negativePrefix_ = this.positivePrefix_ + this.negativePrefix_; this.negativeSuffix_ += this.positiveSuffix_; } }; /** * Apply a predefined pattern to NumberFormat object. * @param {number} patternType The number that indicates a predefined number * format pattern. * @private */ goog.i18n.NumberFormat.prototype.applyStandardPattern_ = function(patternType) { switch (patternType) { case goog.i18n.NumberFormat.Format.DECIMAL: this.applyPattern_(goog.i18n.NumberFormatSymbols.DECIMAL_PATTERN); break; case goog.i18n.NumberFormat.Format.SCIENTIFIC: this.applyPattern_(goog.i18n.NumberFormatSymbols.SCIENTIFIC_PATTERN); break; case goog.i18n.NumberFormat.Format.PERCENT: this.applyPattern_(goog.i18n.NumberFormatSymbols.PERCENT_PATTERN); break; case goog.i18n.NumberFormat.Format.CURRENCY: this.applyPattern_(goog.i18n.NumberFormatSymbols.CURRENCY_PATTERN); break; default: throw Error('Unsupported pattern type.'); } }; /** * Parses text string to produce a Number. * * This method attempts to parse text starting from position "opt_pos" if it * is given. Otherwise the parse will start from the beginning of the text. * When opt_pos presents, opt_pos will be updated to the character next to where * parsing stops after the call. If an error occurs, opt_pos won't be updated. * * @param {string} text The string to be parsed. * @param {Array.<number>=} opt_pos Position to pass in and get back. * @return {number} Parsed number. This throws an error if the text cannot be * parsed. */ goog.i18n.NumberFormat.prototype.parse = function(text, opt_pos) { var pos = opt_pos || [0]; var start = pos[0]; var ret = NaN; // we don't want to handle 2 kind of space in parsing, normalize it to nbsp text = text.replace(/ /g, '\u00a0'); var gotPositive = text.indexOf(this.positivePrefix_, pos[0]) == pos[0]; var gotNegative = text.indexOf(this.negativePrefix_, pos[0]) == pos[0]; // check for the longest match if (gotPositive && gotNegative) { if (this.positivePrefix_.length > this.negativePrefix_.length) { gotNegative = false; } else if (this.positivePrefix_.length < this.negativePrefix_.length) { gotPositive = false; } } if (gotPositive) { pos[0] += this.positivePrefix_.length; } else if (gotNegative) { pos[0] += this.negativePrefix_.length; } // process digits or Inf, find decimal position if (text.indexOf(goog.i18n.NumberFormatSymbols.INFINITY, pos[0]) == pos[0]) { pos[0] += goog.i18n.NumberFormatSymbols.INFINITY.length; ret = Infinity; } else { ret = this.parseNumber_(text, pos); } // check for suffix if (gotPositive) { if (!(text.indexOf(this.positiveSuffix_, pos[0]) == pos[0])) { return NaN; } pos[0] += this.positiveSuffix_.length; } else if (gotNegative) { if (!(text.indexOf(this.negativeSuffix_, pos[0]) == pos[0])) { return NaN; } pos[0] += this.negativeSuffix_.length; } return gotNegative ? -ret : ret; }; /** * This function will parse a "localized" text into a Number. It needs to * handle locale specific decimal, grouping, exponent and digits. * * @param {string} text The text that need to be parsed. * @param {Array.<number>} pos In/out parsing position. In case of failure, * pos value won't be changed. * @return {number} Number value, or NaN if nothing can be parsed. * @private */ goog.i18n.NumberFormat.prototype.parseNumber_ = function(text, pos) { var sawDecimal = false; var sawExponent = false; var sawDigit = false; var scale = 1; var decimal = goog.i18n.NumberFormatSymbols.DECIMAL_SEP; var grouping = goog.i18n.NumberFormatSymbols.GROUP_SEP; var exponentChar = goog.i18n.NumberFormatSymbols.EXP_SYMBOL; var normalizedText = ''; for (; pos[0] < text.length; pos[0]++) { var ch = text.charAt(pos[0]); var digit = this.getDigit_(ch); if (digit >= 0 && digit <= 9) { normalizedText += digit; sawDigit = true; } else if (ch == decimal.charAt(0)) { if (sawDecimal || sawExponent) { break; } normalizedText += '.'; sawDecimal = true; } else if (ch == grouping.charAt(0) && ('\u00a0' != grouping.charAt(0) || pos[0] + 1 < text.length && this.getDigit_(text.charAt(pos[0] + 1)) >= 0)) { // Got a grouping character here. When grouping character is nbsp, need // to make sure the character following it is a digit. if (sawDecimal || sawExponent) { break; } continue; } else if (ch == exponentChar.charAt(0)) { if (sawExponent) { break; } normalizedText += 'E'; sawExponent = true; } else if (ch == '+' || ch == '-') { normalizedText += ch; } else if (ch == goog.i18n.NumberFormatSymbols.PERCENT.charAt(0)) { if (scale != 1) { break; } scale = 100; if (sawDigit) { pos[0]++; // eat this character if parse end here break; } } else if (ch == goog.i18n.NumberFormatSymbols.PERMILL.charAt(0)) { if (scale != 1) { break; } scale = 1000; if (sawDigit) { pos[0]++; // eat this character if parse end here break; } } else { break; } } return parseFloat(normalizedText) / scale; }; /** * Formats a Number to produce a string. * * @param {number} number The Number to be formatted. * @return {string} The formatted number string. */ goog.i18n.NumberFormat.prototype.format = function(number) { if (isNaN(number)) { return goog.i18n.NumberFormatSymbols.NAN; } var parts = []; // in icu code, it is commented that certain computation need to keep the // negative sign for 0. var isNegative = number < 0.0 || number == 0.0 && 1 / number < 0.0; parts.push(isNegative ? this.negativePrefix_ : this.positivePrefix_); if (!isFinite(number)) { parts.push(goog.i18n.NumberFormatSymbols.INFINITY); } else { // convert number to non-negative value number *= isNegative ? -1 : 1; number *= this.multiplier_; this.useExponentialNotation_ ? this.subformatExponential_(number, parts) : this.subformatFixed_(number, this.minimumIntegerDigits_, parts); } parts.push(isNegative ? this.negativeSuffix_ : this.positiveSuffix_); return parts.join(''); }; /** * Formats a Number in fraction format. * * @param {number} number Value need to be formated. * @param {number} minIntDigits Minimum integer digits. * @param {Array} parts This array holds the pieces of formatted string. * This function will add its formatted pieces to the array. * @private */ goog.i18n.NumberFormat.prototype.subformatFixed_ = function(number, minIntDigits, parts) { // round the number var power = Math.pow(10, this.maximumFractionDigits_); number = Math.round(number * power); var intValue = Math.floor(number / power); var fracValue = Math.floor(number - intValue * power); var fractionPresent = this.minimumFractionDigits_ > 0 || fracValue > 0; var intPart = ''; var translatableInt = intValue; while (translatableInt > 1E20) { // here it goes beyond double precision, add '0' make it look better intPart = '0' + intPart; translatableInt = Math.round(translatableInt / 10); } intPart = translatableInt + intPart; var decimal = goog.i18n.NumberFormatSymbols.DECIMAL_SEP; var grouping = goog.i18n.NumberFormatSymbols.GROUP_SEP; var zeroCode = goog.i18n.NumberFormatSymbols.ZERO_DIGIT.charCodeAt(0); var digitLen = intPart.length; if (intValue > 0 || minIntDigits > 0) { for (var i = digitLen; i < minIntDigits; i++) { parts.push(goog.i18n.NumberFormatSymbols.ZERO_DIGIT); } for (var i = 0; i < digitLen; i++) { parts.push(String.fromCharCode(zeroCode + intPart.charAt(i) * 1)); if (digitLen - i > 1 && this.groupingSize_ > 0 && ((digitLen - i) % this.groupingSize_ == 1)) { parts.push(grouping); } } } else if (!fractionPresent) { // If there is no fraction present, and we haven't printed any // integer digits, then print a zero. parts.push(goog.i18n.NumberFormatSymbols.ZERO_DIGIT); } // Output the decimal separator if we always do so. if (this.decimalSeparatorAlwaysShown_ || fractionPresent) { parts.push(decimal); } var fracPart = '' + (fracValue + power); var fracLen = fracPart.length; while (fracPart.charAt(fracLen - 1) == '0' && fracLen > this.minimumFractionDigits_ + 1) { fracLen--; } for (var i = 1; i < fracLen; i++) { parts.push(String.fromCharCode(zeroCode + fracPart.charAt(i) * 1)); } }; /** * Formats exponent part of a Number. * * @param {number} exponent Exponential value. * @param {Array.<string>} parts The array that holds the pieces of formatted * string. This function will append more formatted pieces to the array. * @private */ goog.i18n.NumberFormat.prototype.addExponentPart_ = function(exponent, parts) { parts.push(goog.i18n.NumberFormatSymbols.EXP_SYMBOL); if (exponent < 0) { exponent = -exponent; parts.push(goog.i18n.NumberFormatSymbols.MINUS_SIGN); } else if (this.useSignForPositiveExponent_) { parts.push(goog.i18n.NumberFormatSymbols.PLUS_SIGN); } var exponentDigits = '' + exponent; for (var i = exponentDigits.length; i < this.minExponentDigits_; i++) { parts.push(goog.i18n.NumberFormatSymbols.ZERO_DIGIT); } parts.push(exponentDigits); }; /** * Formats Number in exponential format. * * @param {number} number Value need to be formated. * @param {Array.<string>} parts The array that holds the pieces of formatted * string. This function will append more formatted pieces to the array. * @private */ goog.i18n.NumberFormat.prototype.subformatExponential_ = function(number, parts) { if (number == 0.0) { this.subformatFixed_(number, this.minimumIntegerDigits_, parts); this.addExponentPart_(0, parts); return; } var exponent = Math.floor(Math.log(number) / Math.log(10)); number /= Math.pow(10, exponent); var minIntDigits = this.minimumIntegerDigits_; if (this.maximumIntegerDigits_ > 1 && this.maximumIntegerDigits_ > this.minimumIntegerDigits_) { // A repeating range is defined; adjust to it as follows. // If repeat == 3, we have 6,5,4=>3; 3,2,1=>0; 0,-1,-2=>-3; // -3,-4,-5=>-6, etc. This takes into account that the // exponent we have here is off by one from what we expect; // it is for the format 0.MMMMMx10^n. while ((exponent % this.maximumIntegerDigits_) != 0) { number *= 10; exponent--; } minIntDigits = 1; } else { // No repeating range is defined; use minimum integer digits. if (this.minimumIntegerDigits_ < 1) { exponent++; number /= 10; } else { exponent -= this.minimumIntegerDigits_ - 1; number *= Math.pow(10, this.minimumIntegerDigits_ - 1); } } this.subformatFixed_(number, minIntDigits, parts); this.addExponentPart_(exponent, parts); }; /** * Returns the digit value of current character. The character could be either * '0' to '9', or a locale specific digit. * * @param {string} ch Character that represents a digit. * @return {number} The digit value, or -1 on error. * @private */ goog.i18n.NumberFormat.prototype.getDigit_ = function(ch) { var code = ch.charCodeAt(0); // between '0' to '9' if (48 <= code && code < 58) { return code - 48; } else { var zeroCode = goog.i18n.NumberFormatSymbols.ZERO_DIGIT.charCodeAt(0); return zeroCode <= code && code < zeroCode + 10 ? code - zeroCode : -1; } }; // ---------------------------------------------------------------------- // CONSTANTS // ---------------------------------------------------------------------- // Constants for characters used in programmatic (unlocalized) patterns. /** * A zero digit character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_ZERO_DIGIT_ = '0'; /** * A grouping separator character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_ = ','; /** * A decimal separator character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_ = '.'; /** * A per mille character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_PER_MILLE_ = '\u2030'; /** * A percent character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_PERCENT_ = '%'; /** * A digit character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_DIGIT_ = '#'; /** * A separator character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_SEPARATOR_ = ';'; /** * An exponent character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_EXPONENT_ = 'E'; /** * An plus character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_PLUS_ = '+'; /** * A minus character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_MINUS_ = '-'; /** * A quote character. * @type {string} * @private */ goog.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_ = '\u00A4'; /** * A quote character. * @type {string} * @private */ goog.i18n.NumberFormat.QUOTE_ = '\''; /** * Parses affix part of pattern. * * @param {string} pattern Pattern string that need to be parsed. * @param {Array.<number>} pos One element position array to set and receive * parsing position. * * @return {string} Affix received from parsing. * @private */ goog.i18n.NumberFormat.prototype.parseAffix_ = function(pattern, pos) { var affix = ''; var inQuote = false; var len = pattern.length; for (; pos[0] < len; pos[0]++) { var ch = pattern.charAt(pos[0]); if (ch == goog.i18n.NumberFormat.QUOTE_) { if (pos[0] + 1 < len && pattern.charAt(pos[0] + 1) == goog.i18n.NumberFormat.QUOTE_) { pos[0]++; affix += '\''; // 'don''t' } else { inQuote = !inQuote; } continue; } if (inQuote) { affix += ch; } else { switch (ch) { case goog.i18n.NumberFormat.PATTERN_DIGIT_: case goog.i18n.NumberFormat.PATTERN_ZERO_DIGIT_: case goog.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_: case goog.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_: case goog.i18n.NumberFormat.PATTERN_SEPARATOR_: return affix; case goog.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_: if ((pos[0] + 1) < len && pattern.charAt(pos[0] + 1) == goog.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_) { pos[0]++; affix += this.intlCurrencyCode_; } else { affix += this.currencySymbol_; } break; case goog.i18n.NumberFormat.PATTERN_PERCENT_: if (this.multiplier_ != 1) { throw Error('Too many percent/permill'); } this.multiplier_ = 100; affix += goog.i18n.NumberFormatSymbols.PERCENT; break; case goog.i18n.NumberFormat.PATTERN_PER_MILLE_: if (this.multiplier_ != 1) { throw Error('Too many percent/permill'); } this.multiplier_ = 1000; affix += goog.i18n.NumberFormatSymbols.PERMILL; break; default: affix += ch; } } } return affix; }; /** * Parses the trunk part of a pattern. * * @param {string} pattern Pattern string that need to be parsed. * @param {Array.<number>} pos One element position array to set and receive * parsing position. * @private */ goog.i18n.NumberFormat.prototype.parseTrunk_ = function(pattern, pos) { var decimalPos = -1; var digitLeftCount = 0; var zeroDigitCount = 0; var digitRightCount = 0; var groupingCount = -1; var len = pattern.length; for (var loop = true; pos[0] < len && loop; pos[0]++) { var ch = pattern.charAt(pos[0]); switch (ch) { case goog.i18n.NumberFormat.PATTERN_DIGIT_: if (zeroDigitCount > 0) { digitRightCount++; } else { digitLeftCount++; } if (groupingCount >= 0 && decimalPos < 0) { groupingCount++; } break; case goog.i18n.NumberFormat.PATTERN_ZERO_DIGIT_: if (digitRightCount > 0) { throw Error('Unexpected "0" in pattern "' + pattern + '"'); } zeroDigitCount++; if (groupingCount >= 0 && decimalPos < 0) { groupingCount++; } break; case goog.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_: groupingCount = 0; break; case goog.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_: if (decimalPos >= 0) { throw Error('Multiple decimal separators in pattern "' + pattern + '"'); } decimalPos = digitLeftCount + zeroDigitCount + digitRightCount; break; case goog.i18n.NumberFormat.PATTERN_EXPONENT_: if (this.useExponentialNotation_) { throw Error('Multiple exponential symbols in pattern "' + pattern + '"'); } this.useExponentialNotation_ = true; this.minExponentDigits_ = 0; // exponent pattern can have a optional '+'. if ((pos[0] + 1) < len && pattern.charAt(pos[0] + 1) == goog.i18n.NumberFormat.PATTERN_PLUS_) { pos[0]++; this.useSignForPositiveExponent_ = true; } // Use lookahead to parse out the exponential part // of the pattern, then jump into phase 2. while ((pos[0] + 1) < len && pattern.charAt(pos[0] + 1) == goog.i18n.NumberFormat.PATTERN_ZERO_DIGIT_) { pos[0]++; this.minExponentDigits_++; } if ((digitLeftCount + zeroDigitCount) < 1 || this.minExponentDigits_ < 1) { throw Error('Malformed exponential pattern "' + pattern + '"'); } loop = false; break; default: pos[0]--; loop = false; break; } } if (zeroDigitCount == 0 && digitLeftCount > 0 && decimalPos >= 0) { // Handle '###.###' and '###.' and '.###' var n = decimalPos; if (n == 0) { // Handle '.###' n++; } digitRightCount = digitLeftCount - n; digitLeftCount = n - 1; zeroDigitCount = 1; } // Do syntax checking on the digits. if (decimalPos < 0 && digitRightCount > 0 || decimalPos >= 0 && (decimalPos < digitLeftCount || decimalPos > digitLeftCount + zeroDigitCount) || groupingCount == 0) { throw Error('Malformed pattern "' + pattern + '"'); } var totalDigits = digitLeftCount + zeroDigitCount + digitRightCount; this.maximumFractionDigits_ = decimalPos >= 0 ? totalDigits - decimalPos : 0; if (decimalPos >= 0) { this.minimumFractionDigits_ = digitLeftCount + zeroDigitCount - decimalPos; if (this.minimumFractionDigits_ < 0) { this.minimumFractionDigits_ = 0; } } // The effectiveDecimalPos is the position the decimal is at or would be at // if there is no decimal. Note that if decimalPos<0, then digitTotalCount == // digitLeftCount + zeroDigitCount. var effectiveDecimalPos = decimalPos >= 0 ? decimalPos : totalDigits; this.minimumIntegerDigits_ = effectiveDecimalPos - digitLeftCount; if (this.useExponentialNotation_) { this.maximumIntegerDigits_ = digitLeftCount + this.minimumIntegerDigits_; // in exponential display, we need to at least show something. if (this.maximumFractionDigits_ == 0 && this.minimumIntegerDigits_ == 0) { this.minimumIntegerDigits_ = 1; } } this.groupingSize_ = Math.max(0, groupingCount); this.decimalSeparatorAlwaysShown_ = decimalPos == 0 || decimalPos == totalDigits; };
AndrewBarton/WebParrot
transcoders/traceur/third_party/closure-library/closure/goog/i18n/numberformat.js
JavaScript
mit
23,292
/* * nghttp2 - HTTP/2 C Library * * Copyright (c) 2014 Tatsuhiro Tsujikawa * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef H2LOAD_SESSION_H #define H2LOAD_SESSION_H #include "nghttp2_config.h" #include <sys/types.h> #include <cinttypes> #include "h2load.h" namespace h2load { class Session { public: virtual ~Session() {} // Called when the connection was made. virtual void on_connect() = 0; // Called when one request must be issued. virtual void submit_request(RequestStat *req_stat) = 0; // Called when incoming bytes are available. The subclass has to // return the number of bytes read. virtual int on_read(const uint8_t *data, size_t len) = 0; // Called when write is available. Returns 0 on success, otherwise // return -1. virtual int on_write() = 0; // Called when the underlying session must be terminated. virtual void terminate() = 0; }; } // namespace h2load #endif // H2LOAD_SESSION_H
wzyboy/nghttp2
src/h2load_session.h
C
mit
1,979
import { Platform, Dimensions } from "react-native"; import variable from "./../variables/platform"; const deviceHeight = Dimensions.get("window").height; export default (variables = variable) => { const theme = { flex: 1, height: Platform.OS === "ios" ? deviceHeight : deviceHeight - 20 }; return theme; };
tilap/tilapp
tilapp/src/theme/components/Container.js
JavaScript
mit
325
// -*-c++-*- /*! \file cooperative_action.h \brief cooperative action type Header File. */ /* *Copyright: Copyright (C) Hidehisa AKIYAMA This code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *EndCopyright: */ ///////////////////////////////////////////////////////////////////// #ifndef COOPERATIVE_ACTION_H #define COOPERATIVE_ACTION_H #include <rcsc/geom/vector_2d.h> #include <rcsc/game_time.h> #include <rcsc/types.h> #include <boost/shared_ptr.hpp> /*! \class CooperativeAction \brief abstract cooperative action class */ class CooperativeAction { public: typedef boost::shared_ptr< CooperativeAction > Ptr; //!< pointer type typedef boost::shared_ptr< const CooperativeAction > ConstPtr; //!< const pointer type /*! \enum ActionCategory \brief action category enumeration. */ enum ActionCategory { Hold, Dribble, Pass, Shoot, Clear, Move, NoAction, }; private: ActionCategory M_category; //!< action category type int M_index; int M_player_unum; //!< acting player's uniform number int M_target_player_unum; //!< action target player's uniform number rcsc::Vector2D M_target_point; //!< action end point double M_first_ball_speed; //!< first ball speed (if necessary) double M_first_turn_moment; //!< first turn moment (if necessary) double M_first_dash_power; //!< first dash speed (if necessary) rcsc::AngleDeg M_first_dash_angle; //!< first dash angle (relative to body) (if necessary) int M_duration_step; //!< action duration period int M_kick_count; //!< kick count (if necessary) int M_turn_count; //!< dash count (if necessary) int M_dash_count; //!< dash count (if necessary) bool M_final_action; //!< if this value is true, this action is the final one of action chain. const char * M_description; //!< description message for debugging purpose // not used CooperativeAction(); CooperativeAction( const CooperativeAction & ); CooperativeAction & operator=( const CooperativeAction & ); protected: /*! \brief construct with necessary variables \param category action category type \param player_unum action executor player's unum \param target_point action target point \param duration_step this action's duration step \param description description message (must be a literal character string) */ CooperativeAction( const ActionCategory & category, const int player_unum, const rcsc::Vector2D & target_point, const int duration_step, const char * description ); void setCategory( const ActionCategory & category ); void setPlayerUnum( const int unum ); void setTargetPlayerUnum( const int unum ); void setTargetPoint( const rcsc::Vector2D & point ); public: /*! \brief virtual destructor. */ virtual ~CooperativeAction() { } void setIndex( const int i ) { M_index = i; } void setFirstBallSpeed( const double & speed ); void setFirstTurnMoment( const double & moment ); void setFirstDashPower( const double & power ); void setFirstDashAngle( const rcsc::AngleDeg & angle ); void setDurationStep( const int duration_step ); void setKickCount( const int count ); void setTurnCount( const int count ); void setDashCount( const int count ); void setFinalAction( const bool on ); void setDescription( const char * description ); /*! */ const ActionCategory & category() const { return M_category; } /*! */ int index() const { return M_index; } /*! */ const char * description() const { return M_description; } /*! */ int playerUnum() const { return M_player_unum; } /*! */ int targetPlayerUnum() const { return M_target_player_unum; } /*! */ const rcsc::Vector2D & targetPoint() const { return M_target_point; } /*! */ const double & firstBallSpeed() const { return M_first_ball_speed; } /*! */ const double & firstTurnMoment() const { return M_first_turn_moment; } /*! */ const double & firstDashPower() const { return M_first_dash_power; } /*! */ const rcsc::AngleDeg & firstDashAngle() const { return M_first_dash_angle; } /*! */ int durationStep() const { return M_duration_step; } /*! */ int kickCount() const { return M_kick_count; } /*! */ int turnCount() const { return M_turn_count; } /*! */ int dashCount() const { return M_dash_count; } /*! */ bool isFinalAction() const { return M_final_action; } // // // struct DistCompare { const rcsc::Vector2D pos_; private: DistCompare(); public: DistCompare( const rcsc::Vector2D & pos ) : pos_( pos ) { } bool operator()( const Ptr & lhs, const Ptr & rhs ) const { return lhs->targetPoint().dist2( pos_ ) < rhs->targetPoint().dist2( pos_ ); } }; }; #endif
cowhi/HFO
src/chain_action/cooperative_action.h
C
mit
5,877
using System; public static class Program { public static int F () { return 1; } public static void Main (string[] args) { switch (F()) { case 1: Console.WriteLine("1"); switch (F()) { case 1: Console.WriteLine("1"); break; case 2: Console.WriteLine("2"); break; } break; case 2: Console.WriteLine("2"); switch (F()) { case 1: Console.WriteLine("1"); break; case 2: Console.WriteLine("2"); break; } break; } } }
acourtney2015/JSIL
Tests/SimpleTestCases/NestedSwitchStatement.cs
C#
mit
884
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: /Users/ex3ndr/Develop/actor-platform/actor-apps/core/src/main/java/im/actor/model/api/rpc/RequestTerminateSession.java // #ifndef _APRequestTerminateSession_H_ #define _APRequestTerminateSession_H_ #include "J2ObjC_header.h" #include "im/actor/model/network/parser/Request.h" @class BSBserValues; @class BSBserWriter; @class IOSByteArray; #define APRequestTerminateSession_HEADER 82 @interface APRequestTerminateSession : APRequest #pragma mark Public - (instancetype)init; - (instancetype)initWithInt:(jint)id_; + (APRequestTerminateSession *)fromBytesWithByteArray:(IOSByteArray *)data; - (jint)getHeaderKey; - (jint)getId; - (void)parseWithBSBserValues:(BSBserValues *)values; - (void)serializeWithBSBserWriter:(BSBserWriter *)writer; - (NSString *)description; @end J2OBJC_EMPTY_STATIC_INIT(APRequestTerminateSession) J2OBJC_STATIC_FIELD_GETTER(APRequestTerminateSession, HEADER, jint) FOUNDATION_EXPORT APRequestTerminateSession *APRequestTerminateSession_fromBytesWithByteArray_(IOSByteArray *data); FOUNDATION_EXPORT void APRequestTerminateSession_initWithInt_(APRequestTerminateSession *self, jint id_); FOUNDATION_EXPORT APRequestTerminateSession *new_APRequestTerminateSession_initWithInt_(jint id_) NS_RETURNS_RETAINED; FOUNDATION_EXPORT void APRequestTerminateSession_init(APRequestTerminateSession *self); FOUNDATION_EXPORT APRequestTerminateSession *new_APRequestTerminateSession_init() NS_RETURNS_RETAINED; J2OBJC_TYPE_LITERAL_HEADER(APRequestTerminateSession) typedef APRequestTerminateSession ImActorModelApiRpcRequestTerminateSession; #endif // _APRequestTerminateSession_H_
TimurTarasenko/actor-platform
actor-apps/core-async-cocoa/src/im/actor/model/api/rpc/RequestTerminateSession.h
C
mit
1,687
// Copyright (c) 2020-2021 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <streams.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> #include <test/fuzz/util.h> #include <array> #include <cstdint> #include <iostream> #include <optional> #include <string> #include <vector> FUZZ_TARGET(autofile) { FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; FuzzedAutoFileProvider fuzzed_auto_file_provider = ConsumeAutoFile(fuzzed_data_provider); CAutoFile auto_file = fuzzed_auto_file_provider.open(); LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) { CallOneOf( fuzzed_data_provider, [&] { std::array<std::byte, 4096> arr{}; try { auto_file.read({arr.data(), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096)}); } catch (const std::ios_base::failure&) { } }, [&] { const std::array<std::byte, 4096> arr{}; try { auto_file.write({arr.data(), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096)}); } catch (const std::ios_base::failure&) { } }, [&] { try { auto_file.ignore(fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096)); } catch (const std::ios_base::failure&) { } }, [&] { auto_file.fclose(); }, [&] { ReadFromStream(fuzzed_data_provider, auto_file); }, [&] { WriteToStream(fuzzed_data_provider, auto_file); }); } (void)auto_file.Get(); (void)auto_file.GetType(); (void)auto_file.GetVersion(); (void)auto_file.IsNull(); if (fuzzed_data_provider.ConsumeBool()) { FILE* f = auto_file.release(); if (f != nullptr) { fclose(f); } } }
bitcoin/bitcoin
src/test/fuzz/autofile.cpp
C++
mit
2,170
define("rollbar", [], function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var rollbar = __webpack_require__(2); var options = window && window._rollbarConfig; var alias = options && options.globalAlias || 'Rollbar'; var shimRunning = window && window[alias] && typeof window[alias].shimId === 'function' && window[alias].shimId() !== undefined; if (window && !window._rollbarStartTime) { window._rollbarStartTime = (new Date()).getTime(); } if (!shimRunning && options) { var Rollbar = new rollbar(options); window[alias] = Rollbar; } else { window.rollbar = rollbar; window._rollbarDidLoad = true; } module.exports = rollbar; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var Client = __webpack_require__(3); var _ = __webpack_require__(6); var API = __webpack_require__(11); var logger = __webpack_require__(13); var globals = __webpack_require__(16); var transport = __webpack_require__(17); var urllib = __webpack_require__(18); var transforms = __webpack_require__(19); var sharedTransforms = __webpack_require__(23); var predicates = __webpack_require__(24); var errorParser = __webpack_require__(20); var Instrumenter = __webpack_require__(25); function Rollbar(options, client) { this.options = _.extend(true, defaultOptions, options); var api = new API(this.options, transport, urllib); this.client = client || new Client(this.options, api, logger, 'browser'); addTransformsToNotifier(this.client.notifier); addPredicatesToQueue(this.client.queue); if (this.options.captureUncaught || this.options.handleUncaughtExceptions) { globals.captureUncaughtExceptions(window, this); globals.wrapGlobals(window, this); } if (this.options.captureUnhandledRejections || this.options.handleUnhandledRejections) { globals.captureUnhandledRejections(window, this); } this.instrumenter = new Instrumenter(this.options, this.client.telemeter, this, window, document); this.instrumenter.instrument(); } var _instance = null; Rollbar.init = function(options, client) { if (_instance) { return _instance.global(options).configure(options); } _instance = new Rollbar(options, client); return _instance; }; function handleUninitialized(maybeCallback) { var message = 'Rollbar is not initialized'; logger.error(message); if (maybeCallback) { maybeCallback(new Error(message)); } } Rollbar.prototype.global = function(options) { this.client.global(options); return this; }; Rollbar.global = function(options) { if (_instance) { return _instance.global(options); } else { handleUninitialized(); } }; Rollbar.prototype.configure = function(options, payloadData) { var oldOptions = this.options; var payload = {}; if (payloadData) { payload = {payload: payloadData}; } this.options = _.extend(true, {}, oldOptions, options, payload); this.client.configure(options, payloadData); this.instrumenter.configure(options); return this; }; Rollbar.configure = function(options, payloadData) { if (_instance) { return _instance.configure(options, payloadData); } else { handleUninitialized(); } }; Rollbar.prototype.lastError = function() { return this.client.lastError; }; Rollbar.lastError = function() { if (_instance) { return _instance.lastError(); } else { handleUninitialized(); } }; Rollbar.prototype.log = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.log(item); return {uuid: uuid}; }; Rollbar.log = function() { if (_instance) { return _instance.log.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.debug = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.debug(item); return {uuid: uuid}; }; Rollbar.debug = function() { if (_instance) { return _instance.debug.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.info = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.info(item); return {uuid: uuid}; }; Rollbar.info = function() { if (_instance) { return _instance.info.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.warn = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.warn(item); return {uuid: uuid}; }; Rollbar.warn = function() { if (_instance) { return _instance.warn.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.warning = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.warning(item); return {uuid: uuid}; }; Rollbar.warning = function() { if (_instance) { return _instance.warning.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.error = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.error(item); return {uuid: uuid}; }; Rollbar.error = function() { if (_instance) { return _instance.error.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.critical = function() { var item = this._createItem(arguments); var uuid = item.uuid; this.client.critical(item); return {uuid: uuid}; }; Rollbar.critical = function() { if (_instance) { return _instance.critical.apply(_instance, arguments); } else { var maybeCallback = _getFirstFunction(arguments); handleUninitialized(maybeCallback); } }; Rollbar.prototype.handleUncaughtException = function(message, url, lineno, colno, error, context) { var item; var stackInfo = _.makeUnhandledStackInfo( message, url, lineno, colno, error, 'onerror', 'uncaught exception', errorParser ); if (_.isError(error)) { item = this._createItem([message, error, context]); item._unhandledStackInfo = stackInfo; } else if (_.isError(url)) { item = this._createItem([message, url, context]); item._unhandledStackInfo = stackInfo; } else { item = this._createItem([message, context]); item.stackInfo = stackInfo; } item.level = this.options.uncaughtErrorLevel; item._isUncaught = true; this.client.log(item); }; Rollbar.prototype.handleUnhandledRejection = function(reason, promise) { var message = 'unhandled rejection was null or undefined!'; message = reason ? (reason.message || String(reason)) : message; var context = (reason && reason._rollbarContext) || (promise && promise._rollbarContext); var item; if (_.isError(reason)) { item = this._createItem([message, reason, context]); } else { item = this._createItem([message, reason, context]); item.stackInfo = _.makeUnhandledStackInfo( message, '', 0, 0, null, 'unhandledrejection', '', errorParser ); } item.level = this.options.uncaughtErrorLevel; item._isUncaught = true; item._originalArgs = item._originalArgs || []; item._originalArgs.push(promise); this.client.log(item); }; Rollbar.prototype.wrap = function(f, context, _before) { try { var ctxFn; if(_.isFunction(context)) { ctxFn = context; } else { ctxFn = function() { return context || {}; }; } if (!_.isFunction(f)) { return f; } if (f._isWrap) { return f; } if (!f._rollbar_wrapped) { f._rollbar_wrapped = function () { if (_before && _.isFunction(_before)) { _before.apply(this, arguments); } try { return f.apply(this, arguments); } catch(exc) { var e = exc; if (_.isType(e, 'string')) { e = new String(e); } e._rollbarContext = ctxFn() || {}; e._rollbarContext._wrappedSource = f.toString(); window._rollbarWrappedError = e; throw e; } }; f._rollbar_wrapped._isWrap = true; if (f.hasOwnProperty) { for (var prop in f) { if (f.hasOwnProperty(prop)) { f._rollbar_wrapped[prop] = f[prop]; } } } } return f._rollbar_wrapped; } catch (e) { // Return the original function if the wrap fails. return f; } }; Rollbar.wrap = function(f, context) { if (_instance) { return _instance.wrap(f, context); } else { handleUninitialized(); } }; Rollbar.prototype.captureEvent = function(metadata, level) { return this.client.captureEvent(metadata, level); }; Rollbar.captureEvent = function(metadata, level) { if (_instance) { return _instance.captureEvent(metadata, level); } else { handleUninitialized(); } }; // The following two methods are used internally and are not meant for public use Rollbar.prototype.captureDomContentLoaded = function(e, ts) { if (!ts) { ts = new Date(); } return this.client.captureDomContentLoaded(ts); }; Rollbar.prototype.captureLoad = function(e, ts) { if (!ts) { ts = new Date(); } return this.client.captureLoad(ts); }; /* Internal */ function addTransformsToNotifier(notifier) { notifier .addTransform(transforms.handleItemWithError) .addTransform(transforms.ensureItemHasSomethingToSay) .addTransform(transforms.addBaseInfo) .addTransform(transforms.addRequestInfo(window)) .addTransform(transforms.addClientInfo(window)) .addTransform(transforms.addPluginInfo(window)) .addTransform(transforms.addBody) .addTransform(sharedTransforms.addMessageWithError) .addTransform(sharedTransforms.addTelemetryData) .addTransform(transforms.scrubPayload) .addTransform(transforms.userTransform) .addTransform(sharedTransforms.itemToPayload); } function addPredicatesToQueue(queue) { queue .addPredicate(predicates.checkIgnore) .addPredicate(predicates.userCheckIgnore) .addPredicate(predicates.urlIsNotBlacklisted) .addPredicate(predicates.urlIsWhitelisted) .addPredicate(predicates.messageIsIgnored); } Rollbar.prototype._createItem = function(args) { return _.createItem(args, logger, this); }; function _getFirstFunction(args) { for (var i = 0, len = args.length; i < len; ++i) { if (_.isFunction(args[i])) { return args[i]; } } return undefined; } /* global __NOTIFIER_VERSION__:false */ /* global __DEFAULT_BROWSER_SCRUB_FIELDS__:false */ /* global __DEFAULT_LOG_LEVEL__:false */ /* global __DEFAULT_REPORT_LEVEL__:false */ /* global __DEFAULT_UNCAUGHT_ERROR_LEVEL:false */ /* global __DEFAULT_ENDPOINT__:false */ var defaultOptions = { version: ("2.3.1"), scrubFields: (["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","secret_key","secretKey","secretToken"]), logLevel: ("debug"), reportLevel: ("debug"), uncaughtErrorLevel: ("error"), endpoint: ("api.rollbar.com/api/1/item/"), verbose: false, enabled: true }; module.exports = Rollbar; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var RateLimiter = __webpack_require__(4); var Queue = __webpack_require__(5); var Notifier = __webpack_require__(9); var Telemeter = __webpack_require__(10); var _ = __webpack_require__(6); /* * Rollbar - the interface to Rollbar * * @param options * @param api * @param logger */ function Rollbar(options, api, logger, platform) { this.options = _.extend(true, {}, options); this.logger = logger; Rollbar.rateLimiter.configureGlobal(this.options); Rollbar.rateLimiter.setPlatformOptions(platform, this.options); this.queue = new Queue(Rollbar.rateLimiter, api, logger, this.options); this.notifier = new Notifier(this.queue, this.options); this.telemeter = new Telemeter(this.options); this.lastError = null; } var defaultOptions = { maxItems: 0, itemsPerMinute: 60 }; Rollbar.rateLimiter = new RateLimiter(defaultOptions); Rollbar.prototype.global = function(options) { Rollbar.rateLimiter.configureGlobal(options); return this; }; Rollbar.prototype.configure = function(options, payloadData) { this.notifier && this.notifier.configure(options); this.telemeter && this.telemeter.configure(options); var oldOptions = this.options; var payload = {}; if (payloadData) { payload = {payload: payloadData}; } this.options = _.extend(true, {}, oldOptions, options, payload); this.global(this.options); return this; }; Rollbar.prototype.log = function(item) { var level = this._defaultLogLevel(); return this._log(level, item); }; Rollbar.prototype.debug = function(item) { this._log('debug', item); }; Rollbar.prototype.info = function(item) { this._log('info', item); }; Rollbar.prototype.warn = function(item) { this._log('warning', item); }; Rollbar.prototype.warning = function(item) { this._log('warning', item); }; Rollbar.prototype.error = function(item) { this._log('error', item); }; Rollbar.prototype.critical = function(item) { this._log('critical', item); }; Rollbar.prototype.wait = function(callback) { this.queue.wait(callback); }; Rollbar.prototype.captureEvent = function(metadata, level) { return this.telemeter.captureEvent(metadata, level); }; Rollbar.prototype.captureDomContentLoaded = function(ts) { return this.telemeter.captureDomContentLoaded(ts); }; Rollbar.prototype.captureLoad = function(ts) { return this.telemeter.captureLoad(ts); }; /* Internal */ Rollbar.prototype._log = function(defaultLevel, item) { if (this._sameAsLastError(item)) { return; } try { var callback = null; if (item.callback) { callback = item.callback; delete item.callback; } item.level = item.level || defaultLevel; item.telemetryEvents = this.telemeter.copyEvents(); this.telemeter._captureRollbarItem(item); this.notifier.log(item, callback); } catch (e) { this.logger.error(e) } }; Rollbar.prototype._defaultLogLevel = function() { return this.options.logLevel || 'debug'; }; Rollbar.prototype._sameAsLastError = function(item) { if (this.lastError && this.lastError === item.err) { return true; } this.lastError = item.err; return false; }; module.exports = Rollbar; /***/ }), /* 4 */ /***/ (function(module, exports) { 'use strict'; /* * RateLimiter - an object that encapsulates the logic for counting items sent to Rollbar * * @param options - the same options that are accepted by configureGlobal offered as a convenience */ function RateLimiter(options) { this.startTime = (new Date()).getTime(); this.counter = 0; this.perMinCounter = 0; this.platform = null; this.platformOptions = {}; this.configureGlobal(options); } RateLimiter.globalSettings = { startTime: (new Date()).getTime(), maxItems: undefined, itemsPerMinute: undefined }; /* * configureGlobal - set the global rate limiter options * * @param options - Only the following values are recognized: * startTime: a timestamp of the form returned by (new Date()).getTime() * maxItems: the maximum items * itemsPerMinute: the max number of items to send in a given minute */ RateLimiter.prototype.configureGlobal = function(options) { if (options.startTime !== undefined) { RateLimiter.globalSettings.startTime = options.startTime; } if (options.maxItems !== undefined) { RateLimiter.globalSettings.maxItems = options.maxItems; } if (options.itemsPerMinute !== undefined) { RateLimiter.globalSettings.itemsPerMinute = options.itemsPerMinute; } }; /* * shouldSend - determine if we should send a given item based on rate limit settings * * @param item - the item we are about to send * @returns An object with the following structure: * error: (Error|null) * shouldSend: bool * payload: (Object|null) * If shouldSend is false, the item passed as a parameter should not be sent to Rollbar, and * exactly one of error or payload will be non-null. If error is non-null, the returned Error will * describe the situation, but it means that we were already over a rate limit (either globally or * per minute) when this item was checked. If error is null, and therefore payload is non-null, it * means this item put us over the global rate limit and the payload should be sent to Rollbar in * place of the passed in item. */ RateLimiter.prototype.shouldSend = function(item, now) { now = now || (new Date()).getTime(); if (now - this.startTime >= 60000) { this.startTime = now; this.perMinCounter = 0; } var globalRateLimit = RateLimiter.globalSettings.maxItems; var globalRateLimitPerMin = RateLimiter.globalSettings.itemsPerMinute; if (checkRate(item, globalRateLimit, this.counter)) { return shouldSendValue(this.platform, this.platformOptions, globalRateLimit + ' max items reached', false); } else if (checkRate(item, globalRateLimitPerMin, this.perMinCounter)) { return shouldSendValue(this.platform, this.platformOptions, globalRateLimitPerMin + ' items per minute reached', false); } this.counter++; this.perMinCounter++; var shouldSend = !checkRate(item, globalRateLimit, this.counter); shouldSend = shouldSend && !checkRate(item, globalRateLimitPerMin, this.perMinCounter); return shouldSendValue(this.platform, this.platformOptions, null, shouldSend, globalRateLimit); }; RateLimiter.prototype.setPlatformOptions = function(platform, options) { this.platform = platform; this.platformOptions = options; }; /* Helpers */ function checkRate(item, limit, counter) { return !item.ignoreRateLimit && limit >= 1 && counter > limit; } function shouldSendValue(platform, options, error, shouldSend, globalRateLimit) { var payload = null; if (error) { error = new Error(error); } if (!error && !shouldSend) { payload = rateLimitPayload(platform, options, globalRateLimit); } return {error: error, shouldSend: shouldSend, payload: payload}; } function rateLimitPayload(platform, options, globalRateLimit) { var environment = options.environment || (options.payload && options.payload.environment); var item = { body: { message: { body: 'maxItems has been hit. Ignoring errors until reset.', extra: { maxItems: globalRateLimit } } }, language: 'javascript', environment: environment, notifier: { version: (options.notifier && options.notifier.version) || options.version } }; if (platform === 'browser') { item.platform = 'browser'; item.framework = 'browser-js'; item.notifier.name = 'rollbar-browser-js'; } else if (platform === 'server') { item.framework = options.framework || 'node-js'; item.notifier.name = options.notifier.name; } else if (platform === 'react-native') { item.framework = options.framework || 'react-native'; item.notifier.name = options.notifier.name; } return item; } module.exports = RateLimiter; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); /* * Queue - an object which handles which handles a queue of items to be sent to Rollbar. * This object handles rate limiting via a passed in rate limiter, retries based on connection * errors, and filtering of items based on a set of configurable predicates. The communication to * the backend is performed via a given API object. * * @param rateLimiter - An object which conforms to the interface * rateLimiter.shouldSend(item) -> bool * @param api - An object which conforms to the interface * api.postItem(payload, function(err, response)) * @param logger - An object used to log verbose messages if desired * @param options - see Queue.prototype.configure */ function Queue(rateLimiter, api, logger, options) { this.rateLimiter = rateLimiter; this.api = api; this.logger = logger; this.options = options; this.predicates = []; this.pendingItems = []; this.pendingRequests = []; this.retryQueue = []; this.retryHandle = null; this.waitCallback = null; this.waitIntervalID = null; } /* * configure - updates the options this queue uses * * @param options */ Queue.prototype.configure = function(options) { this.api && this.api.configure(options); var oldOptions = this.options; this.options = _.extend(true, {}, oldOptions, options); return this; }; /* * addPredicate - adds a predicate to the end of the list of predicates for this queue * * @param predicate - function(item, options) -> (bool|{err: Error}) * Returning true means that this predicate passes and the item is okay to go on the queue * Returning false means do not add the item to the queue, but it is not an error * Returning {err: Error} means do not add the item to the queue, and the given error explains why * Returning {err: undefined} is equivalent to returning true but don't do that */ Queue.prototype.addPredicate = function(predicate) { if (_.isFunction(predicate)) { this.predicates.push(predicate); } return this; }; Queue.prototype.addPendingItem = function(item) { this.pendingItems.push(item); }; Queue.prototype.removePendingItem = function(item) { var idx = this.pendingItems.indexOf(item); if (idx !== -1) { this.pendingItems.splice(idx, 1); } }; /* * addItem - Send an item to the Rollbar API if all of the predicates are satisfied * * @param item - The payload to send to the backend * @param callback - function(error, repsonse) which will be called with the response from the API * in the case of a success, otherwise response will be null and error will have a value. If both * error and response are null then the item was stopped by a predicate which did not consider this * to be an error condition, but nonetheless did not send the item to the API. * @param originalError - The original error before any transformations that is to be logged if any */ Queue.prototype.addItem = function(item, callback, originalError, originalItem) { if (!callback || !_.isFunction(callback)) { callback = function() { return; }; } var predicateResult = this._applyPredicates(item); if (predicateResult.stop) { this.removePendingItem(originalItem); callback(predicateResult.err); return; } this._maybeLog(item, originalError); this.removePendingItem(originalItem); this.pendingRequests.push(item); try { this._makeApiRequest(item, function(err, resp) { this._dequeuePendingRequest(item); callback(err, resp); }.bind(this)); } catch (e) { this._dequeuePendingRequest(item); callback(e); } }; /* * wait - Stop any further errors from being added to the queue, and get called back when all items * currently processing have finished sending to the backend. * * @param callback - function() called when all pending items have been sent */ Queue.prototype.wait = function(callback) { if (!_.isFunction(callback)) { return; } this.waitCallback = callback; if (this._maybeCallWait()) { return; } if (this.waitIntervalID) { this.waitIntervalID = clearInterval(this.waitIntervalID); } this.waitIntervalID = setInterval(function() { this._maybeCallWait(); }.bind(this), 500); }; /* _applyPredicates - Sequentially applies the predicates that have been added to the queue to the * given item with the currently configured options. * * @param item - An item in the queue * @returns {stop: bool, err: (Error|null)} - stop being true means do not add item to the queue, * the error value should be passed up to a callbak if we are stopping. */ Queue.prototype._applyPredicates = function(item) { var p = null; for (var i = 0, len = this.predicates.length; i < len; i++) { p = this.predicates[i](item, this.options); if (!p || p.err !== undefined) { return {stop: true, err: p.err}; } } return {stop: false, err: null}; }; /* * _makeApiRequest - Send an item to Rollbar, callback when done, if there is an error make an * effort to retry if we are configured to do so. * * @param item - an item ready to send to the backend * @param callback - function(err, response) */ Queue.prototype._makeApiRequest = function(item, callback) { var rateLimitResponse = this.rateLimiter.shouldSend(item); if (rateLimitResponse.shouldSend) { this.api.postItem(item, function(err, resp) { if (err) { this._maybeRetry(err, item, callback); } else { callback(err, resp); } }.bind(this)); } else if (rateLimitResponse.error) { callback(rateLimitResponse.error); } else { this.api.postItem(rateLimitResponse.payload, callback); } }; // These are errors basically mean there is no internet connection var RETRIABLE_ERRORS = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE', 'EAI_AGAIN']; /* * _maybeRetry - Given the error returned by the API, decide if we should retry or just callback * with the error. * * @param err - an error returned by the API transport * @param item - the item that was trying to be sent when this error occured * @param callback - function(err, response) */ Queue.prototype._maybeRetry = function(err, item, callback) { var shouldRetry = false; if (this.options.retryInterval) { for (var i = 0, len = RETRIABLE_ERRORS.length; i < len; i++) { if (err.code === RETRIABLE_ERRORS[i]) { shouldRetry = true; break; } } } if (shouldRetry) { this._retryApiRequest(item, callback); } else { callback(err); } }; /* * _retryApiRequest - Add an item and a callback to a queue and possibly start a timer to process * that queue based on the retryInterval in the options for this queue. * * @param item - an item that failed to send due to an error we deem retriable * @param callback - function(err, response) */ Queue.prototype._retryApiRequest = function(item, callback) { this.retryQueue.push({item: item, callback: callback}); if (!this.retryHandle) { this.retryHandle = setInterval(function() { while (this.retryQueue.length) { var retryObject = this.retryQueue.shift(); this._makeApiRequest(retryObject.item, retryObject.callback); } }.bind(this), this.options.retryInterval); } }; /* * _dequeuePendingRequest - Removes the item from the pending request queue, this queue is used to * enable to functionality of providing a callback that clients can pass to `wait` to be notified * when the pending request queue has been emptied. This must be called when the API finishes * processing this item. If a `wait` callback is configured, it is called by this function. * * @param item - the item previously added to the pending request queue */ Queue.prototype._dequeuePendingRequest = function(item) { var idx = this.pendingRequests.indexOf(item); if (idx !== -1) { this.pendingRequests.splice(idx, 1); this._maybeCallWait(); } }; Queue.prototype._maybeLog = function(data, originalError) { if (this.logger && this.options.verbose) { var message = originalError; message = message || _.get(data, 'body.trace.exception.message'); message = message || _.get(data, 'body.trace_chain.0.exception.message'); if (message) { this.logger.error(message); return; } message = _.get(data, 'body.message.body'); if (message) { this.logger.log(message); } } }; Queue.prototype._maybeCallWait = function() { if (_.isFunction(this.waitCallback) && this.pendingItems.length === 0 && this.pendingRequests.length === 0) { if (this.waitIntervalID) { this.waitIntervalID = clearInterval(this.waitIntervalID); } this.waitCallback(); return true; } return false; }; module.exports = Queue; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var extend = __webpack_require__(7); var RollbarJSON = {}; var __initRollbarJSON = false; function setupJSON() { if (__initRollbarJSON) { return; } __initRollbarJSON = true; if (isDefined(JSON)) { if (isNativeFunction(JSON.stringify)) { RollbarJSON.stringify = JSON.stringify; } if (isNativeFunction(JSON.parse)) { RollbarJSON.parse = JSON.parse; } } if (!isFunction(RollbarJSON.stringify) || !isFunction(RollbarJSON.parse)) { var setupCustomJSON = __webpack_require__(8); setupCustomJSON(RollbarJSON); } } setupJSON(); /* * isType - Given a Javascript value and a string, returns true if the type of the value matches the * given string. * * @param x - any value * @param t - a lowercase string containing one of the following type names: * - undefined * - null * - error * - number * - boolean * - string * - symbol * - function * - object * - array * @returns true if x is of type t, otherwise false */ function isType(x, t) { return t === typeName(x); } /* * typeName - Given a Javascript value, returns the type of the object as a string */ function typeName(x) { var name = typeof x; if (name !== 'object') { return name; } if (!x) { return 'null'; } if (x instanceof Error) { return 'error'; } return ({}).toString.call(x).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); } /* isFunction - a convenience function for checking if a value is a function * * @param f - any value * @returns true if f is a function, otherwise false */ function isFunction(f) { return isType(f, 'function'); } /* isNativeFunction - a convenience function for checking if a value is a native JS function * * @param f - any value * @returns true if f is a native JS function, otherwise false */ function isNativeFunction(f) { var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; var funcMatchString = Function.prototype.toString.call(Object.prototype.hasOwnProperty) .replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?'); var reIsNative = RegExp('^' + funcMatchString + '$'); return isObject(f) && reIsNative.test(f); } /* isObject - Checks if the argument is an object * * @param value - any value * @returns true is value is an object function is an object) */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } /* * isDefined - a convenience function for checking if a value is not equal to undefined * * @param u - any value * @returns true if u is anything other than undefined */ function isDefined(u) { return !isType(u, 'undefined'); } /* * isIterable - convenience function for checking if a value can be iterated, essentially * whether it is an object or an array. * * @param i - any value * @returns true if i is an object or an array as determined by `typeName` */ function isIterable(i) { var type = typeName(i); return (type === 'object' || type === 'array'); } /* * isError - convenience function for checking if a value is of an error type * * @param e - any value * @returns true if e is an error */ function isError(e) { return isType(e, 'error'); } function traverse(obj, func, seen) { var k, v, i; var isObj = isType(obj, 'object'); var isArray = isType(obj, 'array'); var keys = []; if (isObj && seen.indexOf(obj) !== -1) { return obj; } seen.push(obj); if (isObj) { for (k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) { keys.push(k); } } } else if (isArray) { for (i = 0; i < obj.length; ++i) { keys.push(i); } } for (i = 0; i < keys.length; ++i) { k = keys[i]; v = obj[k]; obj[k] = func(k, v, seen); } return obj; } function redact() { return '********'; } // from http://stackoverflow.com/a/8809472/1138191 function uuid4() { var d = now(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); return (c === 'x' ? r : (r & 0x7 | 0x8)).toString(16); }); return uuid; } var LEVELS = { debug: 0, info: 1, warning: 2, error: 3, critical: 4 }; function sanitizeUrl(url) { var baseUrlParts = parseUri(url); // remove a trailing # if there is no anchor if (baseUrlParts.anchor === '') { baseUrlParts.source = baseUrlParts.source.replace('#', ''); } url = baseUrlParts.source.replace('?' + baseUrlParts.query, ''); return url; } var parseUriOptions = { strictMode: false, key: [ 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor' ], q: { name: 'queryKey', parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ } }; function parseUri(str) { if (!isType(str, 'string')) { throw new Error('received invalid input'); } var o = parseUriOptions; var m = o.parser[o.strictMode ? 'strict' : 'loose'].exec(str); var uri = {}; var i = o.key.length; while (i--) { uri[o.key[i]] = m[i] || ''; } uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { if ($1) { uri[o.q.name][$1] = $2; } }); return uri; } function addParamsAndAccessTokenToPath(accessToken, options, params) { params = params || {}; params.access_token = accessToken; var paramsArray = []; var k; for (k in params) { if (Object.prototype.hasOwnProperty.call(params, k)) { paramsArray.push([k, params[k]].join('=')); } } var query = '?' + paramsArray.sort().join('&'); options = options || {}; options.path = options.path || ''; var qs = options.path.indexOf('?'); var h = options.path.indexOf('#'); var p; if (qs !== -1 && (h === -1 || h > qs)) { p = options.path; options.path = p.substring(0,qs) + query + '&' + p.substring(qs+1); } else { if (h !== -1) { p = options.path; options.path = p.substring(0,h) + query + p.substring(h); } else { options.path = options.path + query; } } } function formatUrl(u, protocol) { protocol = protocol || u.protocol; if (!protocol && u.port) { if (u.port === 80) { protocol = 'http:'; } else if (u.port === 443) { protocol = 'https:'; } } protocol = protocol || 'https:'; if (!u.hostname) { return null; } var result = protocol + '//' + u.hostname; if (u.port) { result = result + ':' + u.port; } if (u.path) { result = result + u.path; } return result; } function stringify(obj, backup) { var value, error; try { value = RollbarJSON.stringify(obj); } catch (jsonError) { if (backup && isFunction(backup)) { try { value = backup(obj); } catch (backupError) { error = backupError; } } else { error = jsonError; } } return {error: error, value: value}; } function jsonParse(s) { var value, error; try { value = RollbarJSON.parse(s); } catch (e) { error = e; } return {error: error, value: value}; } function makeUnhandledStackInfo( message, url, lineno, colno, error, mode, backupMessage, errorParser ) { var location = { url: url || '', line: lineno, column: colno }; location.func = errorParser.guessFunctionName(location.url, location.line); location.context = errorParser.gatherContext(location.url, location.line); var href = document && document.location && document.location.href; var useragent = window && window.navigator && window.navigator.userAgent; return { 'mode': mode, 'message': error ? String(error) : (message || backupMessage), 'url': href, 'stack': [location], 'useragent': useragent }; } function wrapCallback(logger, f) { return function(err, resp) { try { f(err, resp); } catch (e) { logger.error(e); } }; } function createItem(args, logger, notifier, requestKeys, lambdaContext) { var message, err, custom, callback, request; var arg; var extraArgs = []; for (var i = 0, l = args.length; i < l; ++i) { arg = args[i]; var typ = typeName(arg); switch (typ) { case 'undefined': break; case 'string': message ? extraArgs.push(arg) : message = arg; break; case 'function': callback = wrapCallback(logger, arg); break; case 'date': extraArgs.push(arg); break; case 'error': case 'domexception': err ? extraArgs.push(arg) : err = arg; break; case 'object': case 'array': if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) { err ? extraArgs.push(arg) : err = arg; break; } if (requestKeys && typ === 'object' && !request) { for (var j = 0, len = requestKeys.length; j < len; ++j) { if (arg[requestKeys[j]] !== undefined) { request = arg; break; } } if (request) { break; } } custom ? extraArgs.push(arg) : custom = arg; break; default: if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) { err ? extraArgs.push(arg) : err = arg; break; } extraArgs.push(arg); } } if (extraArgs.length > 0) { // if custom is an array this turns it into an object with integer keys custom = extend(true, {}, custom); custom.extraArgs = extraArgs; } var item = { message: message, err: err, custom: custom, timestamp: now(), callback: callback, uuid: uuid4() }; if (custom && custom.level !== undefined) { item.level = custom.level; delete custom.level; } if (requestKeys && request) { item.request = request; } if (lambdaContext) { item.lambdaContext = lambdaContext; } item._originalArgs = args; return item; } /* * get - given an obj/array and a keypath, return the value at that keypath or * undefined if not possible. * * @param obj - an object or array * @param path - a string of keys separated by '.' such as 'plugin.jquery.0.message' * which would correspond to 42 in `{plugin: {jquery: [{message: 42}]}}` */ function get(obj, path) { if (!obj) { return undefined; } var keys = path.split('.'); var result = obj; try { for (var i = 0, len = keys.length; i < len; ++i) { result = result[keys[i]]; } } catch (e) { result = undefined; } return result; } function set(obj, path, value) { if (!obj) { return; } var keys = path.split('.'); var len = keys.length; if (len < 1) { return; } if (len === 1) { obj[keys[0]] = value; return; } try { var temp = obj[keys[0]] || {}; var replacement = temp; for (var i = 1; i < len-1; i++) { temp[keys[i]] = temp[keys[i]] || {}; temp = temp[keys[i]]; } temp[keys[len-1]] = value; obj[keys[0]] = replacement; } catch (e) { return; } } function scrub(data, scrubFields) { scrubFields = scrubFields || []; var paramRes = _getScrubFieldRegexs(scrubFields); var queryRes = _getScrubQueryParamRegexs(scrubFields); function redactQueryParam(dummy0, paramPart, dummy1, dummy2, dummy3, valPart) { return paramPart + redact(valPart); } function paramScrubber(v) { var i; if (isType(v, 'string')) { for (i = 0; i < queryRes.length; ++i) { v = v.replace(queryRes[i], redactQueryParam); } } return v; } function valScrubber(k, v) { var i; for (i = 0; i < paramRes.length; ++i) { if (paramRes[i].test(k)) { v = redact(v); break; } } return v; } function scrubber(k, v, seen) { var tmpV = valScrubber(k, v); if (tmpV === v) { if (isType(v, 'object') || isType(v, 'array')) { return traverse(v, scrubber, seen); } return paramScrubber(tmpV); } else { return tmpV; } } traverse(data, scrubber, []); return data; } function _getScrubFieldRegexs(scrubFields) { var ret = []; var pat; for (var i = 0; i < scrubFields.length; ++i) { pat = '\\[?(%5[bB])?' + scrubFields[i] + '\\[?(%5[bB])?\\]?(%5[dD])?'; ret.push(new RegExp(pat, 'i')); } return ret; } function _getScrubQueryParamRegexs(scrubFields) { var ret = []; var pat; for (var i = 0; i < scrubFields.length; ++i) { pat = '\\[?(%5[bB])?' + scrubFields[i] + '\\[?(%5[bB])?\\]?(%5[dD])?'; ret.push(new RegExp('(' + pat + '=)([^&\\n]+)', 'igm')); } return ret; } function formatArgsAsString(args) { var i, len, arg; var result = []; for (i = 0, len = args.length; i < len; i++) { arg = args[i]; if (typeof arg === 'object') { arg = stringify(arg); arg = arg.error || arg.value; if (arg.length > 500) arg = arg.substr(0,500)+'...'; } else if (typeof arg === 'undefined') { arg = 'undefined'; } result.push(arg); } return result.join(' '); } function now() { if (Date.now) { return +Date.now(); } return +new Date(); } module.exports = { isType: isType, typeName: typeName, isFunction: isFunction, isNativeFunction: isNativeFunction, isIterable: isIterable, isError: isError, extend: extend, traverse: traverse, redact: redact, uuid4: uuid4, LEVELS: LEVELS, sanitizeUrl: sanitizeUrl, addParamsAndAccessTokenToPath: addParamsAndAccessTokenToPath, formatUrl: formatUrl, stringify: stringify, jsonParse: jsonParse, makeUnhandledStackInfo: makeUnhandledStackInfo, createItem: createItem, get: get, set: set, scrub: scrub, formatArgsAsString: formatArgsAsString, now: now }; /***/ }), /* 7 */ /***/ (function(module, exports) { 'use strict'; var hasOwn = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var isArray = function isArray(arr) { if (typeof Array.isArray === 'function') { return Array.isArray(arr); } return toStr.call(arr) === '[object Array]'; }; var isPlainObject = function isPlainObject(obj) { if (!obj || toStr.call(obj) !== '[object Object]') { return false; } var hasOwnConstructor = hasOwn.call(obj, 'constructor'); var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); // Not own constructor property must be Object if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for (key in obj) {/**/} return typeof key === 'undefined' || hasOwn.call(obj, key); }; module.exports = function extend() { var options, name, src, copy, copyIsArray, clone, target = arguments[0], i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if (typeof target === 'boolean') { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) { target = {}; } for (; i < length; ++i) { options = arguments[i]; // Only deal with non-null/undefined values if (options != null) { // Extend the base object for (name in options) { src = target[name]; copy = options[name]; // Prevent never-ending loop if (target !== copy) { // Recurse if we're merging plain objects or arrays if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && isArray(src) ? src : []; } else { clone = src && isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[name] = extend(deep, clone, copy); // Don't bring in undefined values } else if (typeof copy !== 'undefined') { target[name] = copy; } } } } } // Return the modified object return target; }; /***/ }), /* 8 */ /***/ (function(module, exports) { // json3.js // 2017-02-21 // Public Domain. // NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. // See http://www.JSON.org/js.html // This code should be minified before deployment. // See http://javascript.crockford.com/jsmin.html // USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO // NOT CONTROL. // This file creates a global JSON object containing two methods: stringify // and parse. This file provides the ES5 JSON capability to ES3 systems. // If a project might run on IE8 or earlier, then this file should be included. // This file does nothing on ES5 systems. // JSON.stringify(value, replacer, space) // value any JavaScript value, usually an object or array. // replacer an optional parameter that determines how object // values are stringified for objects. It can be a // function or an array of strings. // space an optional parameter that specifies the indentation // of nested structures. If it is omitted, the text will // be packed without extra whitespace. If it is a number, // it will specify the number of spaces to indent at each // level. If it is a string (such as "\t" or "&nbsp;"), // it contains the characters used to indent at each level. // This method produces a JSON text from a JavaScript value. // When an object value is found, if the object contains a toJSON // method, its toJSON method will be called and the result will be // stringified. A toJSON method does not serialize: it returns the // value represented by the name/value pair that should be serialized, // or undefined if nothing should be serialized. The toJSON method // will be passed the key associated with the value, and this will be // bound to the value. // For example, this would serialize Dates as ISO strings. // Date.prototype.toJSON = function (key) { // function f(n) { // // Format integers to have at least two digits. // return (n < 10) // ? "0" + n // : n; // } // return this.getUTCFullYear() + "-" + // f(this.getUTCMonth() + 1) + "-" + // f(this.getUTCDate()) + "T" + // f(this.getUTCHours()) + ":" + // f(this.getUTCMinutes()) + ":" + // f(this.getUTCSeconds()) + "Z"; // }; // You can provide an optional replacer method. It will be passed the // key and value of each member, with this bound to the containing // object. The value that is returned from your method will be // serialized. If your method returns undefined, then the member will // be excluded from the serialization. // If the replacer parameter is an array of strings, then it will be // used to select the members to be serialized. It filters the results // such that only members with keys listed in the replacer array are // stringified. // Values that do not have JSON representations, such as undefined or // functions, will not be serialized. Such values in objects will be // dropped; in arrays they will be replaced with null. You can use // a replacer function to replace those with JSON values. // JSON.stringify(undefined) returns undefined. // The optional space parameter produces a stringification of the // value that is filled with line breaks and indentation to make it // easier to read. // If the space parameter is a non-empty string, then that string will // be used for indentation. If the space parameter is a number, then // the indentation will be that many spaces. // Example: // text = JSON.stringify(["e", {pluribus: "unum"}]); // // text is '["e",{"pluribus":"unum"}]' // text = JSON.stringify(["e", {pluribus: "unum"}], null, "\t"); // // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' // text = JSON.stringify([new Date()], function (key, value) { // return this[key] instanceof Date // ? "Date(" + this[key] + ")" // : value; // }); // // text is '["Date(---current time---)"]' // JSON.parse(text, reviver) // This method parses a JSON text to produce an object or array. // It can throw a SyntaxError exception. // This has been modified to use JSON-js/json_parse_state.js as the // parser instead of the one built around eval found in JSON-js/json2.js // The optional reviver parameter is a function that can filter and // transform the results. It receives each of the keys and values, // and its return value is used instead of the original value. // If it returns what it received, then the structure is not modified. // If it returns undefined then the member is deleted. // Example: // // Parse the text. Values that look like ISO date strings will // // be converted to Date objects. // myData = JSON.parse(text, function (key, value) { // var a; // if (typeof value === "string") { // a = // /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); // if (a) { // return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], // +a[5], +a[6])); // } // } // return value; // }); // myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { // var d; // if (typeof value === "string" && // value.slice(0, 5) === "Date(" && // value.slice(-1) === ")") { // d = new Date(value.slice(5, -1)); // if (d) { // return d; // } // } // return value; // }); // This is a reference implementation. You are free to copy, modify, or // redistribute. /*jslint for, this */ /*property JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ var setupCustomJSON = function(JSON) { var rx_one = /^[\],:{}\s]*$/; var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g; var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; var rx_four = /(?:^|:|,)(?:\s*\[)+/g; var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; function f(n) { // Format integers to have at least two digits. return n < 10 ? "0" + n : n; } function this_value() { return this.valueOf(); } if (typeof Date.prototype.toJSON !== "function") { Date.prototype.toJSON = function () { return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null; }; Boolean.prototype.toJSON = this_value; Number.prototype.toJSON = this_value; String.prototype.toJSON = this_value; } var gap; var indent; var meta; var rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. rx_escapable.lastIndex = 0; return rx_escapable.test(string) ? "\"" + string.replace(rx_escapable, function (a) { var c = meta[a]; return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); }) + "\"" : "\"" + string + "\""; } function str(key, holder) { // Produce a string from holder[key]. var i; // The loop counter. var k; // The member key. var v; // The member value. var length; var mind = gap; var partial; var value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === "object" && typeof value.toJSON === "function") { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === "function") { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case "string": return quote(value); case "number": // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : "null"; case "boolean": case "null": // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce "null". The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is "object", we might be dealing with an object or an array or // null. case "object": // Due to a specification blunder in ECMAScript, typeof null is "object", // so watch out for that case. if (!value) { return "null"; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === "[object Array]") { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || "null"; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]"; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === "object") { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === "string") { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + ( gap ? ": " : ":" ) + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + ( gap ? ": " : ":" ) + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}"; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== "function") { meta = { // table of character substitutions "\b": "\\b", "\t": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", "\"": "\\\"", "\\": "\\\\" }; JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ""; indent = ""; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === "number") { for (i = 0; i < space; i += 1) { indent += " "; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === "string") { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) { throw new Error("JSON.stringify"); } // Make a fake root object containing our value under the key of "". // Return the result of stringifying the value. return str("", {"": value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== "function") { JSON.parse = (function () { // This function creates a JSON parse function that uses a state machine rather // than the dangerous eval function to parse a JSON text. var state; // The state of the parser, one of // 'go' The starting state // 'ok' The final, accepting state // 'firstokey' Ready for the first key of the object or // the closing of an empty object // 'okey' Ready for the next key of the object // 'colon' Ready for the colon // 'ovalue' Ready for the value half of a key/value pair // 'ocomma' Ready for a comma or closing } // 'firstavalue' Ready for the first value of an array or // an empty array // 'avalue' Ready for the next value of an array // 'acomma' Ready for a comma or closing ] var stack; // The stack, for controlling nesting. var container; // The current container object or array var key; // The current key var value; // The current value var escapes = { // Escapement translation table "\\": "\\", "\"": "\"", "/": "/", "t": "\t", "n": "\n", "r": "\r", "f": "\f", "b": "\b" }; var string = { // The actions for string tokens go: function () { state = "ok"; }, firstokey: function () { key = value; state = "colon"; }, okey: function () { key = value; state = "colon"; }, ovalue: function () { state = "ocomma"; }, firstavalue: function () { state = "acomma"; }, avalue: function () { state = "acomma"; } }; var number = { // The actions for number tokens go: function () { state = "ok"; }, ovalue: function () { state = "ocomma"; }, firstavalue: function () { state = "acomma"; }, avalue: function () { state = "acomma"; } }; var action = { // The action table describes the behavior of the machine. It contains an // object for each token. Each object contains a method that is called when // a token is matched in a state. An object will lack a method for illegal // states. "{": { go: function () { stack.push({state: "ok"}); container = {}; state = "firstokey"; }, ovalue: function () { stack.push({container: container, state: "ocomma", key: key}); container = {}; state = "firstokey"; }, firstavalue: function () { stack.push({container: container, state: "acomma"}); container = {}; state = "firstokey"; }, avalue: function () { stack.push({container: container, state: "acomma"}); container = {}; state = "firstokey"; } }, "}": { firstokey: function () { var pop = stack.pop(); value = container; container = pop.container; key = pop.key; state = pop.state; }, ocomma: function () { var pop = stack.pop(); container[key] = value; value = container; container = pop.container; key = pop.key; state = pop.state; } }, "[": { go: function () { stack.push({state: "ok"}); container = []; state = "firstavalue"; }, ovalue: function () { stack.push({container: container, state: "ocomma", key: key}); container = []; state = "firstavalue"; }, firstavalue: function () { stack.push({container: container, state: "acomma"}); container = []; state = "firstavalue"; }, avalue: function () { stack.push({container: container, state: "acomma"}); container = []; state = "firstavalue"; } }, "]": { firstavalue: function () { var pop = stack.pop(); value = container; container = pop.container; key = pop.key; state = pop.state; }, acomma: function () { var pop = stack.pop(); container.push(value); value = container; container = pop.container; key = pop.key; state = pop.state; } }, ":": { colon: function () { if (Object.hasOwnProperty.call(container, key)) { throw new SyntaxError("Duplicate key '" + key + "\""); } state = "ovalue"; } }, ",": { ocomma: function () { container[key] = value; state = "okey"; }, acomma: function () { container.push(value); state = "avalue"; } }, "true": { go: function () { value = true; state = "ok"; }, ovalue: function () { value = true; state = "ocomma"; }, firstavalue: function () { value = true; state = "acomma"; }, avalue: function () { value = true; state = "acomma"; } }, "false": { go: function () { value = false; state = "ok"; }, ovalue: function () { value = false; state = "ocomma"; }, firstavalue: function () { value = false; state = "acomma"; }, avalue: function () { value = false; state = "acomma"; } }, "null": { go: function () { value = null; state = "ok"; }, ovalue: function () { value = null; state = "ocomma"; }, firstavalue: function () { value = null; state = "acomma"; }, avalue: function () { value = null; state = "acomma"; } } }; function debackslashify(text) { // Remove and replace any backslash escapement. return text.replace(/\\(?:u(.{4})|([^u]))/g, function (ignore, b, c) { return b ? String.fromCharCode(parseInt(b, 16)) : escapes[c]; }); } return function (source, reviver) { // A regular expression is used to extract tokens from the JSON text. // The extraction process is cautious. var result; var tx = /^[\u0020\t\n\r]*(?:([,:\[\]{}]|true|false|null)|(-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)|"((?:[^\r\n\t\\\"]|\\(?:["\\\/trnfb]|u[0-9a-fA-F]{4}))*)")/; // Set the starting state. state = "go"; // The stack records the container, key, and state for each object or array // that contains another object or array while processing nested structures. stack = []; // If any error occurs, we will catch it and ultimately throw a syntax error. try { // For each token... while (true) { result = tx.exec(source); if (!result) { break; } // result is the result array from matching the tokenizing regular expression. // result[0] contains everything that matched, including any initial whitespace. // result[1] contains any punctuation that was matched, or true, false, or null. // result[2] contains a matched number, still in string form. // result[3] contains a matched string, without quotes but with escapement. if (result[1]) { // Token: Execute the action for this state and token. action[result[1]][state](); } else if (result[2]) { // Number token: Convert the number string into a number value and execute // the action for this state and number. value = +result[2]; number[state](); } else { // String token: Replace the escapement sequences and execute the action for // this state and string. value = debackslashify(result[3]); string[state](); } // Remove the token from the string. The loop will continue as long as there // are tokens. This is a slow process, but it allows the use of ^ matching, // which assures that no illegal tokens slip through. source = source.slice(result[0].length); } // If we find a state/token combination that is illegal, then the action will // cause an error. We handle the error by simply changing the state. } catch (e) { state = e; } // The parsing is finished. If we are not in the final "ok" state, or if the // remaining source contains anything except whitespace, then we did not have //a well-formed JSON text. if (state !== "ok" || (/[^\u0020\t\n\r]/.test(source))) { throw (state instanceof SyntaxError) ? state : new SyntaxError("JSON"); } // If there is a reviver function, we recursively walk the new structure, // passing each name/value pair to the reviver function for possible // transformation, starting with a temporary root object that holds the current // value in an empty key. If there is not a reviver function, we simply return // that value. return (typeof reviver === "function") ? (function walk(holder, key) { var k; var v; var val = holder[key]; if (val && typeof val === "object") { for (k in value) { if (Object.prototype.hasOwnProperty.call(val, k)) { v = walk(val, k); if (v !== undefined) { val[k] = v; } else { delete val[k]; } } } } return reviver.call(holder, key, val); }({"": value}, "")) : value; }; }()); } } module.exports = setupCustomJSON; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); /* * Notifier - the internal object responsible for delegating between the client exposed API, the * chain of transforms necessary to turn an item into something that can be sent to Rollbar, and the * queue which handles the communcation with the Rollbar API servers. * * @param queue - an object that conforms to the interface: addItem(item, callback) * @param options - an object representing the options to be set for this notifier, this should have * any defaults already set by the caller */ function Notifier(queue, options) { this.queue = queue; this.options = options; this.transforms = []; } /* * configure - updates the options for this notifier with the passed in object * * @param options - an object which gets merged with the current options set on this notifier * @returns this */ Notifier.prototype.configure = function(options) { this.queue && this.queue.configure(options); var oldOptions = this.options; this.options = _.extend(true, {}, oldOptions, options); return this; }; /* * addTransform - adds a transform onto the end of the queue of transforms for this notifier * * @param transform - a function which takes three arguments: * * item: An Object representing the data to eventually be sent to Rollbar * * options: The current value of the options for this notifier * * callback: function(err: (Null|Error), item: (Null|Object)) the transform must call this * callback with a null value for error if it wants the processing chain to continue, otherwise * with an error to terminate the processing. The item should be the updated item after this * transform is finished modifying it. */ Notifier.prototype.addTransform = function(transform) { if (_.isFunction(transform)) { this.transforms.push(transform); } return this; }; /* * log - the internal log function which applies the configured transforms and then pushes onto the * queue to be sent to the backend. * * @param item - An object with the following structure: * message [String] - An optional string to be sent to rollbar * error [Error] - An optional error * * @param callback - A function of type function(err, resp) which will be called with exactly one * null argument and one non-null argument. The callback will be called once, either during the * transform stage if an error occurs inside a transform, or in response to the communication with * the backend. The second argument will be the response from the backend in case of success. */ Notifier.prototype.log = function(item, callback) { if (!callback || !_.isFunction(callback)) { callback = function() {}; } if (!this.options.enabled) { return callback(new Error('Rollbar is not enabled')); } this.queue.addPendingItem(item); var originalError = item.err; this._applyTransforms(item, function(err, i) { if (err) { this.queue.removePendingItem(item); return callback(err, null); } this.queue.addItem(i, callback, originalError, item); }.bind(this)); }; /* Internal */ /* * _applyTransforms - Applies the transforms that have been added to this notifier sequentially. See * `addTransform` for more information. * * @param item - An item to be transformed * @param callback - A function of type function(err, item) which will be called with a non-null * error and a null item in the case of a transform failure, or a null error and non-null item after * all transforms have been applied. */ Notifier.prototype._applyTransforms = function(item, callback) { var transformIndex = -1; var transformsLength = this.transforms.length; var transforms = this.transforms; var options = this.options; var cb = function(err, i) { if (err) { callback(err, null); return; } transformIndex++; if (transformIndex === transformsLength) { callback(null, i); return; } transforms[transformIndex](i, options, cb); }; cb(null, item); }; module.exports = Notifier; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); var MAX_EVENTS = 100; function Telemeter(options) { this.queue = []; this.options = _.extend(true, {}, options); var maxTelemetryEvents = this.options.maxTelemetryEvents || MAX_EVENTS; this.maxQueueSize = Math.max(0, Math.min(maxTelemetryEvents, MAX_EVENTS)); } Telemeter.prototype.configure = function(options) { var oldOptions = this.options; this.options = _.extend(true, {}, oldOptions, options); var maxTelemetryEvents = this.options.maxTelemetryEvents || MAX_EVENTS; var newMaxEvents = Math.max(0, Math.min(maxTelemetryEvents, MAX_EVENTS)); var deleteCount = 0; if (this.maxQueueSize > newMaxEvents) { deleteCount = this.maxQueueSize - newMaxEvents; } this.maxQueueSize = newMaxEvents; this.queue.splice(0, deleteCount); }; Telemeter.prototype.copyEvents = function() { return Array.prototype.slice.call(this.queue, 0); }; Telemeter.prototype.capture = function(type, metadata, level, rollbarUUID, timestamp) { var e = { level: getLevel(type, level), type: type, timestamp_ms: timestamp || _.now(), body: metadata, source: 'client' }; if (rollbarUUID) { e.uuid = rollbarUUID; } this.push(e); return e; }; Telemeter.prototype.captureEvent = function(metadata, level, rollbarUUID) { return this.capture('manual', metadata, level, rollbarUUID); }; Telemeter.prototype.captureError = function(err, level, rollbarUUID, timestamp) { var metadata = { message: err.message || String(err) }; if (err.stack) { metadata.stack = err.stack; } return this.capture('error', metadata, level, rollbarUUID, timestamp); }; Telemeter.prototype.captureLog = function(message, level, rollbarUUID, timestamp) { return this.capture('log', { message: message }, level, rollbarUUID, timestamp); }; Telemeter.prototype.captureNetwork = function(metadata, subtype, rollbarUUID) { subtype = subtype || 'xhr'; metadata.subtype = metadata.subtype || subtype; var level = this.levelFromStatus(metadata.status_code); return this.capture('network', metadata, level, rollbarUUID); }; Telemeter.prototype.levelFromStatus = function(statusCode) { if (statusCode >= 200 && statusCode < 400) { return 'info'; } if (statusCode === 0 || statusCode >= 400) { return 'error'; } return 'info'; }; Telemeter.prototype.captureDom = function(subtype, element, value, checked, rollbarUUID) { var metadata = { subtype: subtype, element: element }; if (value !== undefined) { metadata.value = value; } if (checked !== undefined) { metadata.checked = checked; } return this.capture('dom', metadata, 'info', rollbarUUID); }; Telemeter.prototype.captureNavigation = function(from, to, rollbarUUID) { return this.capture('navigation', {from: from, to: to}, 'info', rollbarUUID); }; Telemeter.prototype.captureDomContentLoaded = function(ts) { return this.capture('navigation', {subtype: 'DOMContentLoaded'}, 'info', undefined, ts && ts.getTime()); /** * If we decide to make this a dom event instead, then use the line below: return this.capture('dom', {subtype: 'DOMContentLoaded'}, 'info', undefined, ts && ts.getTime()); */ }; Telemeter.prototype.captureLoad = function(ts) { return this.capture('navigation', {subtype: 'load'}, 'info', undefined, ts && ts.getTime()); /** * If we decide to make this a dom event instead, then use the line below: return this.capture('dom', {subtype: 'load'}, 'info', undefined, ts && ts.getTime()); */ }; Telemeter.prototype.captureConnectivityChange = function(type, rollbarUUID) { return this.captureNetwork({change: type}, 'connectivity', rollbarUUID); }; // Only intended to be used internally by the notifier Telemeter.prototype._captureRollbarItem = function(item) { if (item.err) { return this.captureError(item.err, item.level, item.uuid, item.timestamp); } if (item.message) { return this.captureLog(item.message, item.level, item.uuid, item.timestamp); } if (item.custom) { return this.capture('log', item.custom, item.level, item.uuid, item.timestamp); } }; Telemeter.prototype.push = function(e) { this.queue.push(e); if (this.queue.length > this.maxQueueSize) { this.queue.shift(); } }; function getLevel(type, level) { if (level) { return level; } var defaultLevel = { error: 'error', manual: 'info' }; return defaultLevel[type] || 'info'; } module.exports = Telemeter; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); var helpers = __webpack_require__(12); var defaultOptions = { hostname: 'api.rollbar.com', path: '/api/1/item/', search: null, version: '1', protocol: 'https:', port: 443 }; /** * Api is an object that encapsulates methods of communicating with * the Rollbar API. It is a standard interface with some parts implemented * differently for server or browser contexts. It is an object that should * be instantiated when used so it can contain non-global options that may * be different for another instance of RollbarApi. * * @param options { * accessToken: the accessToken to use for posting items to rollbar * endpoint: an alternative endpoint to send errors to * must be a valid, fully qualified URL. * The default is: https://api.rollbar.com/api/1/item * proxy: if you wish to proxy requests provide an object * with the following keys: * host or hostname (required): foo.example.com * port (optional): 123 * protocol (optional): https * } */ function Api(options, t, u, j) { this.options = options; this.transport = t; this.url = u; this.jsonBackup = j; this.accessToken = options.accessToken; this.transportOptions = _getTransport(options, u); } /** * * @param data * @param callback */ Api.prototype.postItem = function(data, callback) { var transportOptions = helpers.transportOptions(this.transportOptions, 'POST'); var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup); this.transport.post(this.accessToken, transportOptions, payload, callback); }; Api.prototype.configure = function(options) { var oldOptions = this.oldOptions; this.options = _.extend(true, {}, oldOptions, options); this.transportOptions = _getTransport(this.options, this.url); if (this.options.accessToken !== undefined) { this.accessToken = this.options.accessToken; } return this; }; function _getTransport(options, url) { return helpers.getTransportFromOptions(options, defaultOptions, url); } module.exports = Api; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); function buildPayload(accessToken, data, jsonBackup) { if (_.isType(data.context, 'object')) { var contextResult = _.stringify(data.context, jsonBackup); if (contextResult.error) { data.context = 'Error: could not serialize \'context\''; } else { data.context = contextResult.value || ''; } if (data.context.length > 255) { data.context = data.context.substr(0, 255); } } return { access_token: accessToken, data: data }; } function getTransportFromOptions(options, defaults, url) { var hostname = defaults.hostname; var protocol = defaults.protocol; var port = defaults.port; var path = defaults.path; var search = defaults.search; var proxy = options.proxy; if (options.endpoint) { var opts = url.parse(options.endpoint); hostname = opts.hostname; protocol = opts.protocol; port = opts.port; path = opts.pathname; search = opts.search; } return { hostname: hostname, protocol: protocol, port: port, path: path, search: search, proxy: proxy }; } function transportOptions(transport, method) { var protocol = transport.protocol || 'https:'; var port = transport.port || (protocol === 'http:' ? 80 : protocol === 'https:' ? 443 : undefined); var hostname = transport.hostname; var path = transport.path; if (transport.search) { path = path + transport.search; } if (transport.proxy) { path = protocol + '//' + hostname + path; hostname = transport.proxy.host || transport.proxy.hostname; port = transport.proxy.port; protocol = transport.proxy.protocol || protocol; } return { protocol: protocol, hostname: hostname, path: path, port: port, method: method }; } function appendPathToPath(base, path) { var baseTrailingSlash = /\/$/.test(base); var pathBeginningSlash = /^\//.test(path); if (baseTrailingSlash && pathBeginningSlash) { path = path.substring(1); } else if (!baseTrailingSlash && !pathBeginningSlash) { path = '/' + path; } return base + path; } module.exports = { buildPayload: buildPayload, getTransportFromOptions: getTransportFromOptions, transportOptions: transportOptions, appendPathToPath: appendPathToPath }; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /* eslint-disable no-console */ __webpack_require__(14); var detection = __webpack_require__(15); var _ = __webpack_require__(6); function error() { var args = Array.prototype.slice.call(arguments, 0); args.unshift('Rollbar:'); if (detection.ieVersion() <= 8) { console.error(_.formatArgsAsString(args)); } else { console.error.apply(console, args); } } function info() { var args = Array.prototype.slice.call(arguments, 0); args.unshift('Rollbar:'); if (detection.ieVersion() <= 8) { console.info(_.formatArgsAsString(args)); } else { console.info.apply(console, args); } } function log() { var args = Array.prototype.slice.call(arguments, 0); args.unshift('Rollbar:'); if (detection.ieVersion() <= 8) { console.log(_.formatArgsAsString(args)); } else { console.log.apply(console, args); } } /* eslint-enable no-console */ module.exports = { error: error, info: info, log: log }; /***/ }), /* 14 */ /***/ (function(module, exports) { // Console-polyfill. MIT license. // https://github.com/paulmillr/console-polyfill // Make it safe to do console.log() always. (function(global) { 'use strict'; if (!global.console) { global.console = {}; } var con = global.console; var prop, method; var dummy = function() {}; var properties = ['memory']; var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); while (prop = properties.pop()) if (!con[prop]) con[prop] = {}; while (method = methods.pop()) if (!con[method]) con[method] = dummy; // Using `this` for web workers & supports Browserify / Webpack. })(typeof window === 'undefined' ? this : window); /***/ }), /* 15 */ /***/ (function(module, exports) { 'use strict'; // This detection.js module is used to encapsulate any ugly browser/feature // detection we may need to do. // Figure out which version of IE we're using, if any. // This is gleaned from http://stackoverflow.com/questions/5574842/best-way-to-check-for-ie-less-than-9-in-javascript-without-library // Will return an integer on IE (i.e. 8) // Will return undefined otherwise function getIEVersion() { var undef; if (!document) { return undef; } var v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while ( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); return v > 4 ? v : undef; } var Detection = { ieVersion: getIEVersion }; module.exports = Detection; /***/ }), /* 16 */ /***/ (function(module, exports) { 'use strict'; function captureUncaughtExceptions(window, handler, shim) { if (!window) { return; } var oldOnError; if (typeof handler._rollbarOldOnError === 'function') { oldOnError = handler._rollbarOldOnError; } else if (window.onerror && !window.onerror.belongsToShim) { oldOnError = window.onerror; handler._rollbarOldOnError = oldOnError; } var fn = function() { var args = Array.prototype.slice.call(arguments, 0); _rollbarWindowOnError(window, handler, oldOnError, args); }; fn.belongsToShim = shim; window.onerror = fn; } function _rollbarWindowOnError(window, r, old, args) { if (window._rollbarWrappedError) { if (!args[4]) { args[4] = window._rollbarWrappedError; } if (!args[5]) { args[5] = window._rollbarWrappedError._rollbarContext; } window._rollbarWrappedError = null; } r.handleUncaughtException.apply(r, args); if (old) { old.apply(window, args); } } function captureUnhandledRejections(window, handler, shim) { if (!window) { return; } if (typeof window._rollbarURH === 'function' && window._rollbarURH.belongsToShim) { window.removeEventListener('unhandledrejection', window._rollbarURH); } var rejectionHandler = function (event) { var reason = event.reason; var promise = event.promise; var detail = event.detail; if (!reason && detail) { reason = detail.reason; promise = detail.promise; } if (handler && handler.handleUnhandledRejection) { handler.handleUnhandledRejection(reason, promise); } }; rejectionHandler.belongsToShim = shim; window._rollbarURH = rejectionHandler; window.addEventListener('unhandledrejection', rejectionHandler); } function wrapGlobals(window, handler, shim) { if (!window) { return; } // Adapted from https://github.com/bugsnag/bugsnag-js var globals = 'EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload'.split(','); var i, global; for (i = 0; i < globals.length; ++i) { global = globals[i]; if (window[global] && window[global].prototype) { _extendListenerPrototype(handler, window[global].prototype, shim); } } } function _extendListenerPrototype(handler, prototype, shim) { if (prototype.hasOwnProperty && prototype.hasOwnProperty('addEventListener')) { var oldAddEventListener = prototype.addEventListener; while (oldAddEventListener._rollbarOldAdd && oldAddEventListener.belongsToShim) { oldAddEventListener = oldAddEventListener._rollbarOldAdd; } var addFn = function(event, callback, bubble) { oldAddEventListener.call(this, event, handler.wrap(callback), bubble); }; addFn._rollbarOldAdd = oldAddEventListener; addFn.belongsToShim = shim; prototype.addEventListener = addFn; var oldRemoveEventListener = prototype.removeEventListener; while (oldRemoveEventListener._rollbarOldRemove && oldRemoveEventListener.belongsToShim) { oldRemoveEventListener = oldRemoveEventListener._rollbarOldRemove; } var removeFn = function(event, callback, bubble) { oldRemoveEventListener.call(this, event, callback && callback._rollbar_wrapped || callback, bubble); }; removeFn._rollbarOldRemove = oldRemoveEventListener; removeFn.belongsToShim = shim; prototype.removeEventListener = removeFn; } } module.exports = { captureUncaughtExceptions: captureUncaughtExceptions, captureUnhandledRejections: captureUnhandledRejections, wrapGlobals: wrapGlobals }; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); var logger = __webpack_require__(13); /* * accessToken may be embedded in payload but that should not * be assumed * * options: { * hostname * protocol * path * port * method * } * * params is an object containing key/value pairs. These * will be appended to the path as 'key=value&key=value' * * payload is an unserialized object */ function get(accessToken, options, params, callback, requestFactory) { if (!callback || !_.isFunction(callback)) { callback = function() {}; } _.addParamsAndAccessTokenToPath(accessToken, options, params); var method = 'GET'; var url = _.formatUrl(options); _makeRequest(accessToken, url, method, null, callback, requestFactory); } function post(accessToken, options, payload, callback, requestFactory) { if (!callback || !_.isFunction(callback)) { callback = function() {}; } if (!payload) { return callback(new Error('Cannot send empty request')); } var stringifyResult = _.stringify(payload); if (stringifyResult.error) { return callback(stringifyResult.error); } var writeData = stringifyResult.value; var method = 'POST'; var url = _.formatUrl(options); _makeRequest(accessToken, url, method, writeData, callback, requestFactory); } function _makeRequest(accessToken, url, method, data, callback, requestFactory) { var request; if (requestFactory) { request = requestFactory(); } else { request = _createXMLHTTPObject(); } if (!request) { // Give up, no way to send requests return callback(new Error('No way to send a request')); } try { try { var onreadystatechange = function() { try { if (onreadystatechange && request.readyState === 4) { onreadystatechange = undefined; var parseResponse = _.jsonParse(request.responseText); if (_isSuccess(request)) { callback(parseResponse.error, parseResponse.value); return; } else if (_isNormalFailure(request)) { if (request.status === 403) { // likely caused by using a server access token var message = parseResponse.value && parseResponse.value.message; logger.error(message); } // return valid http status codes callback(new Error(String(request.status))); } else { // IE will return a status 12000+ on some sort of connection failure, // so we return a blank error // http://msdn.microsoft.com/en-us/library/aa383770%28VS.85%29.aspx var msg = 'XHR response had no status code (likely connection failure)'; callback(_newRetriableError(msg)); } } } catch (ex) { //jquery source mentions firefox may error out while accessing the //request members if there is a network error //https://github.com/jquery/jquery/blob/a938d7b1282fc0e5c52502c225ae8f0cef219f0a/src/ajax/xhr.js#L111 var exc; if (ex && ex.stack) { exc = ex; } else { exc = new Error(ex); } callback(exc); } }; request.open(method, url, true); if (request.setRequestHeader) { request.setRequestHeader('Content-Type', 'application/json'); request.setRequestHeader('X-Rollbar-Access-Token', accessToken); } request.onreadystatechange = onreadystatechange; request.send(data); } catch (e1) { // Sending using the normal xmlhttprequest object didn't work, try XDomainRequest if (typeof XDomainRequest !== 'undefined') { // Assume we are in a really old browser which has a bunch of limitations: // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx // Extreme paranoia: if we have XDomainRequest then we have a window, but just in case if (!window || !window.location) { return callback(new Error('No window available during request, unknown environment')); } // If the current page is http, try and send over http if (window.location.href.substring(0, 5) === 'http:' && url.substring(0, 5) === 'https') { url = 'http' + url.substring(5); } var xdomainrequest = new XDomainRequest(); xdomainrequest.onprogress = function() {}; xdomainrequest.ontimeout = function() { var msg = 'Request timed out'; var code = 'ETIMEDOUT'; callback(_newRetriableError(msg, code)); }; xdomainrequest.onerror = function() { callback(new Error('Error during request')); }; xdomainrequest.onload = function() { var parseResponse = _.jsonParse(xdomainrequest.responseText); callback(parseResponse.error, parseResponse.value); }; xdomainrequest.open(method, url, true); xdomainrequest.send(data); } else { callback(new Error('Cannot find a method to transport a request')); } } } catch (e2) { callback(e2); } } function _createXMLHTTPObject() { /* global ActiveXObject:false */ var factories = [ function () { return new XMLHttpRequest(); }, function () { return new ActiveXObject('Msxml2.XMLHTTP'); }, function () { return new ActiveXObject('Msxml3.XMLHTTP'); }, function () { return new ActiveXObject('Microsoft.XMLHTTP'); } ]; var xmlhttp; var i; var numFactories = factories.length; for (i = 0; i < numFactories; i++) { /* eslint-disable no-empty */ try { xmlhttp = factories[i](); break; } catch (e) { // pass } /* eslint-enable no-empty */ } return xmlhttp; } function _isSuccess(r) { return r && r.status && r.status === 200; } function _isNormalFailure(r) { return r && _.isType(r.status, 'number') && r.status >= 400 && r.status < 600; } function _newRetriableError(message, code) { var err = new Error(message); err.code = code || 'ENOTFOUND'; return err; } module.exports = { get: get, post: post }; /***/ }), /* 18 */ /***/ (function(module, exports) { 'use strict'; // See https://nodejs.org/docs/latest/api/url.html function parse(url) { var result = { protocol: null, auth: null, host: null, path: null, hash: null, href: url, hostname: null, port: null, pathname: null, search: null, query: null }; var i, last; i = url.indexOf('//'); if (i !== -1) { result.protocol = url.substring(0,i); last = i+2; } else { last = 0; } i = url.indexOf('@', last); if (i !== -1) { result.auth = url.substring(last, i); last = i+1; } i = url.indexOf('/', last); if (i === -1) { i = url.indexOf('?', last); if (i === -1) { i = url.indexOf('#', last); if (i === -1) { result.host = url.substring(last); } else { result.host = url.substring(last, i); result.hash = url.substring(i); } result.hostname = result.host.split(':')[0]; result.port = result.host.split(':')[1]; if (result.port) { result.port = parseInt(result.port, 10); } return result; } else { result.host = url.substring(last, i); result.hostname = result.host.split(':')[0]; result.port = result.host.split(':')[1]; if (result.port) { result.port = parseInt(result.port, 10); } last = i; } } else { result.host = url.substring(last, i); result.hostname = result.host.split(':')[0]; result.port = result.host.split(':')[1]; if (result.port) { result.port = parseInt(result.port, 10); } last = i; } i = url.indexOf('#', last); if (i === -1) { result.path = url.substring(last); } else { result.path = url.substring(last, i); result.hash = url.substring(i); } if (result.path) { var pathParts = result.path.split('?'); result.pathname = pathParts[0]; result.query = pathParts[1]; result.search = result.query ? '?' + result.query : null; } return result; } module.exports = { parse: parse }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); var errorParser = __webpack_require__(20); var logger = __webpack_require__(13); function handleItemWithError(item, options, callback) { item.data = item.data || {}; if (item.err) { try { item.stackInfo = item.err._savedStackTrace || errorParser.parse(item.err); } catch (e) /* istanbul ignore next */ { logger.error('Error while parsing the error object.', e); item.message = item.err.message || item.err.description || item.message || String(item.err); delete item.err; } } callback(null, item); } function ensureItemHasSomethingToSay(item, options, callback) { if (!item.message && !item.stackInfo && !item.custom) { callback(new Error('No message, stack info, or custom data'), null); } callback(null, item); } function addBaseInfo(item, options, callback) { var environment = (options.payload && options.payload.environment) || options.environment; item.data = _.extend(true, {}, item.data, { environment: environment, level: item.level, endpoint: options.endpoint, platform: 'browser', framework: 'browser-js', language: 'javascript', server: {}, uuid: item.uuid, notifier: { name: 'rollbar-browser-js', version: options.version } }); callback(null, item); } function addRequestInfo(window) { return function(item, options, callback) { if (!window || !window.location) { return callback(null, item); } _.set(item, 'data.request', { url: window.location.href, query_string: window.location.search, user_ip: '$remote_ip' }); callback(null, item); }; } function addClientInfo(window) { return function(item, options, callback) { if (!window) { return callback(null, item); } _.set(item, 'data.client', { runtime_ms: item.timestamp - window._rollbarStartTime, timestamp: Math.round(item.timestamp / 1000), javascript: { browser: window.navigator.userAgent, language: window.navigator.language, cookie_enabled: window.navigator.cookieEnabled, screen: { width: window.screen.width, height: window.screen.height } } }); callback(null, item); }; } function addPluginInfo(window) { return function(item, options, callback) { if (!window || !window.navigator) { return callback(null, item); } var plugins = []; var navPlugins = window.navigator.plugins || []; var cur; for (var i=0, l=navPlugins.length; i < l; ++i) { cur = navPlugins[i]; plugins.push({name: cur.name, description: cur.description}); } _.set(item, 'data.client.javascript.plugins', plugins); callback(null, item); }; } function addBody(item, options, callback) { if (item.stackInfo) { addBodyTrace(item, options, callback); } else { addBodyMessage(item, options, callback); } } function addBodyMessage(item, options, callback) { var message = item.message; var custom = item.custom; if (!message) { if (custom) { var scrubFields = options.scrubFields; var messageResult = _.stringify(_.scrub(custom, scrubFields)); message = messageResult.error || messageResult.value || ''; } else { message = ''; } } var result = { body: message }; if (custom) { result.extra = _.extend(true, {}, custom); } _.set(item, 'data.body', {message: result}); callback(null, item); } function addBodyTrace(item, options, callback) { var description = item.data.description; var stackInfo = item.stackInfo; var custom = item.custom; var guess = errorParser.guessErrorClass(stackInfo.message); var className = stackInfo.name || guess[0]; var message = guess[1]; var trace = { exception: { 'class': className, message: message } }; if (description) { trace.exception.description = description; } // Transform a TraceKit stackInfo object into a Rollbar trace var stack = stackInfo.stack; if (stack && stack.length === 0 && item._unhandledStackInfo && item._unhandledStackInfo.stack) { stack = item._unhandledStackInfo.stack; } if (stack) { var stackFrame; var frame; var code; var pre; var post; var contextLength; var i, mid; trace.frames = []; for (i = 0; i < stack.length; ++i) { stackFrame = stack[i]; frame = { filename: stackFrame.url ? _.sanitizeUrl(stackFrame.url) : '(unknown)', lineno: stackFrame.line || null, method: (!stackFrame.func || stackFrame.func === '?') ? '[anonymous]' : stackFrame.func, colno: stackFrame.column }; if (frame.method && frame.method.endsWith && frame.method.endsWith('_rollbar_wrapped')) { continue; } code = pre = post = null; contextLength = stackFrame.context ? stackFrame.context.length : 0; if (contextLength) { mid = Math.floor(contextLength / 2); pre = stackFrame.context.slice(0, mid); code = stackFrame.context[mid]; post = stackFrame.context.slice(mid); } if (code) { frame.code = code; } if (pre || post) { frame.context = {}; if (pre && pre.length) { frame.context.pre = pre; } if (post && post.length) { frame.context.post = post; } } if (stackFrame.args) { frame.args = stackFrame.args; } trace.frames.push(frame); } // NOTE(cory): reverse the frames since rollbar.com expects the most recent call last trace.frames.reverse(); if (custom) { trace.extra = _.extend(true, {}, custom); } _.set(item, 'data.body', {trace: trace}); callback(null, item); } else { item.message = className + ': ' + message; addBodyMessage(item, options, callback); } } function scrubPayload(item, options, callback) { var scrubFields = options.scrubFields; _.scrub(item.data, scrubFields); callback(null, item); } function userTransform(item, options, callback) { var newItem = _.extend(true, {}, item); try { if (_.isFunction(options.transform)) { options.transform(newItem.data); } } catch (e) { options.transform = null; logger.error('Error while calling custom transform() function. Removing custom transform().', e); callback(null, item); return; } callback(null, newItem); } module.exports = { handleItemWithError: handleItemWithError, ensureItemHasSomethingToSay: ensureItemHasSomethingToSay, addBaseInfo: addBaseInfo, addRequestInfo: addRequestInfo, addClientInfo: addClientInfo, addPluginInfo: addPluginInfo, addBody: addBody, scrubPayload: scrubPayload, userTransform: userTransform }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var ErrorStackParser = __webpack_require__(21); var UNKNOWN_FUNCTION = '?'; var ERR_CLASS_REGEXP = new RegExp('^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): '); function guessFunctionName() { return UNKNOWN_FUNCTION; } function gatherContext() { return null; } function Frame(stackFrame) { var data = {}; data._stackFrame = stackFrame; data.url = stackFrame.fileName; data.line = stackFrame.lineNumber; data.func = stackFrame.functionName; data.column = stackFrame.columnNumber; data.args = stackFrame.args; data.context = gatherContext(data.url, data.line); return data; } function Stack(exception) { function getStack() { var parserStack = []; try { parserStack = ErrorStackParser.parse(exception); } catch(e) { parserStack = []; } var stack = []; for (var i = 0; i < parserStack.length; i++) { stack.push(new Frame(parserStack[i])); } return stack; } return { stack: getStack(), message: exception.message, name: exception.name }; } function parse(e) { return new Stack(e); } function guessErrorClass(errMsg) { if (!errMsg) { return ['Unknown error. There was no error message to display.', '']; } var errClassMatch = errMsg.match(ERR_CLASS_REGEXP); var errClass = '(unknown)'; if (errClassMatch) { errClass = errClassMatch[errClassMatch.length - 1]; errMsg = errMsg.replace((errClassMatch[errClassMatch.length - 2] || '') + errClass + ':', ''); errMsg = errMsg.replace(/(^[\s]+|[\s]+$)/g, ''); } return [errClass, errMsg]; } module.exports = { guessFunctionName: guessFunctionName, guessErrorClass: guessErrorClass, gatherContext: gatherContext, parse: parse, Stack: Stack, Frame: Frame }; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. /* istanbul ignore next */ if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(22)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports === 'object') { module.exports = factory(require('stackframe')); } else { root.ErrorStackParser = factory(root.StackFrame); } }(this, function ErrorStackParser(StackFrame) { 'use strict'; var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/; var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m; var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/; function _map(array, fn, thisArg) { if (typeof Array.prototype.map === 'function') { return array.map(fn, thisArg); } else { var output = new Array(array.length); for (var i = 0; i < array.length; i++) { output[i] = fn.call(thisArg, array[i]); } return output; } } function _filter(array, fn, thisArg) { if (typeof Array.prototype.filter === 'function') { return array.filter(fn, thisArg); } else { var output = []; for (var i = 0; i < array.length; i++) { if (fn.call(thisArg, array[i])) { output.push(array[i]); } } return output; } } return { /** * Given an Error object, extract the most information from it. * @param error {Error} * @return Array[StackFrame] */ parse: function ErrorStackParser$$parse(error) { if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') { return this.parseOpera(error); } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) { return this.parseV8OrIE(error); } else if (error.stack) { return this.parseFFOrSafari(error); } else { throw new Error('Cannot parse given Error object'); } }, /** * Separate line and column numbers from a URL-like string. * @param urlLike String * @return Array[String] */ extractLocation: function ErrorStackParser$$extractLocation(urlLike) { // Fail-fast but return locations like "(native)" if (urlLike.indexOf(':') === -1) { return [urlLike]; } var locationParts = urlLike.replace(/[\(\)\s]/g, '').split(':'); var lastNumber = locationParts.pop(); var possibleNumber = locationParts[locationParts.length - 1]; if (!isNaN(parseFloat(possibleNumber)) && isFinite(possibleNumber)) { var lineNumber = locationParts.pop(); return [locationParts.join(':'), lineNumber, lastNumber]; } else { return [locationParts.join(':'), lastNumber, undefined]; } }, parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) { var filtered = _filter(error.stack.split('\n'), function (line) { return !!line.match(CHROME_IE_STACK_REGEXP); }, this); return _map(filtered, function (line) { if (line.indexOf('(eval ') > -1) { // Throw away eval information until we implement stacktrace.js/stackframe#8 line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ''); } var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1); var locationParts = this.extractLocation(tokens.pop()); var functionName = tokens.join(' ') || undefined; var fileName = locationParts[0] === 'eval' ? undefined : locationParts[0]; return new StackFrame(functionName, undefined, fileName, locationParts[1], locationParts[2], line); }, this); }, parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) { var filtered = _filter(error.stack.split('\n'), function (line) { return !line.match(SAFARI_NATIVE_CODE_REGEXP); }, this); return _map(filtered, function (line) { // Throw away eval information until we implement stacktrace.js/stackframe#8 if (line.indexOf(' > eval') > -1) { line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ':$1'); } if (line.indexOf('@') === -1 && line.indexOf(':') === -1) { // Safari eval frames only have function names and nothing else return new StackFrame(line); } else { var tokens = line.split('@'); var locationParts = this.extractLocation(tokens.pop()); var functionName = tokens.shift() || undefined; return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); } }, this); }, parseOpera: function ErrorStackParser$$parseOpera(e) { if (!e.stacktrace || (e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length)) { return this.parseOpera9(e); } else if (!e.stack) { return this.parseOpera10(e); } else { return this.parseOpera11(e); } }, parseOpera9: function ErrorStackParser$$parseOpera9(e) { var lineRE = /Line (\d+).*script (?:in )?(\S+)/i; var lines = e.message.split('\n'); var result = []; for (var i = 2, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); if (match) { result.push(new StackFrame(undefined, undefined, match[2], match[1], undefined, lines[i])); } } return result; }, parseOpera10: function ErrorStackParser$$parseOpera10(e) { var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i; var lines = e.stacktrace.split('\n'); var result = []; for (var i = 0, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); if (match) { result.push(new StackFrame(match[3] || undefined, undefined, match[2], match[1], undefined, lines[i])); } } return result; }, // Opera 10.65+ Error.stack very similar to FF/Safari parseOpera11: function ErrorStackParser$$parseOpera11(error) { var filtered = _filter(error.stack.split('\n'), function (line) { return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/); }, this); return _map(filtered, function (line) { var tokens = line.split('@'); var locationParts = this.extractLocation(tokens.pop()); var functionCall = (tokens.shift() || ''); var functionName = functionCall .replace(/<anonymous function(: (\w+))?>/, '$2') .replace(/\([^\)]*\)/g, '') || undefined; var argsRaw; if (functionCall.match(/\(([^\)]*)\)/)) { argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1'); } var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? undefined : argsRaw.split(','); return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2], line); }, this); } }; })); /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. /* istanbul ignore next */ if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports === 'object') { module.exports = factory(); } else { root.StackFrame = factory(); } }(this, function () { 'use strict'; function _isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function StackFrame(functionName, args, fileName, lineNumber, columnNumber, source) { if (functionName !== undefined) { this.setFunctionName(functionName); } if (args !== undefined) { this.setArgs(args); } if (fileName !== undefined) { this.setFileName(fileName); } if (lineNumber !== undefined) { this.setLineNumber(lineNumber); } if (columnNumber !== undefined) { this.setColumnNumber(columnNumber); } if (source !== undefined) { this.setSource(source); } } StackFrame.prototype = { getFunctionName: function () { return this.functionName; }, setFunctionName: function (v) { this.functionName = String(v); }, getArgs: function () { return this.args; }, setArgs: function (v) { if (Object.prototype.toString.call(v) !== '[object Array]') { throw new TypeError('Args must be an Array'); } this.args = v; }, // NOTE: Property name may be misleading as it includes the path, // but it somewhat mirrors V8's JavaScriptStackTraceApi // https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi and Gecko's // http://mxr.mozilla.org/mozilla-central/source/xpcom/base/nsIException.idl#14 getFileName: function () { return this.fileName; }, setFileName: function (v) { this.fileName = String(v); }, getLineNumber: function () { return this.lineNumber; }, setLineNumber: function (v) { if (!_isNumber(v)) { throw new TypeError('Line Number must be a Number'); } this.lineNumber = Number(v); }, getColumnNumber: function () { return this.columnNumber; }, setColumnNumber: function (v) { if (!_isNumber(v)) { throw new TypeError('Column Number must be a Number'); } this.columnNumber = Number(v); }, getSource: function () { return this.source; }, setSource: function (v) { this.source = String(v); }, toString: function() { var functionName = this.getFunctionName() || '{anonymous}'; var args = '(' + (this.getArgs() || []).join(',') + ')'; var fileName = this.getFileName() ? ('@' + this.getFileName()) : ''; var lineNumber = _isNumber(this.getLineNumber()) ? (':' + this.getLineNumber()) : ''; var columnNumber = _isNumber(this.getColumnNumber()) ? (':' + this.getColumnNumber()) : ''; return functionName + args + fileName + lineNumber + columnNumber; } }; return StackFrame; })); /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); function itemToPayload(item, options, callback) { var payloadOptions = options.payload || {}; if (payloadOptions.body) { delete payloadOptions.body; } var data = _.extend(true, {}, item.data, payloadOptions); if (item._isUncaught) { data._isUncaught = true; } if (item._originalArgs) { data._originalArgs = item._originalArgs; } callback(null, data); } function addTelemetryData(item, options, callback) { if (item.telemetryEvents) { _.set(item, 'data.body.telemetry', item.telemetryEvents); } callback(null, item); } function addMessageWithError(item, options, callback) { if (!item.message) { callback(null, item); return; } var tracePath = 'data.body.trace_chain.0'; var trace = _.get(item, tracePath); if (!trace) { tracePath = 'data.body.trace'; trace = _.get(item, tracePath); } if (trace) { if (!(trace.exception && trace.exception.description)) { _.set(item, tracePath+'.exception.description', item.message); callback(null, item); return; } var extra = _.get(item, tracePath+'.extra') || {}; var newExtra = _.extend(true, {}, extra, {message: item.message}); _.set(item, tracePath+'.extra', newExtra); } callback(null, item); } module.exports = { itemToPayload: itemToPayload, addTelemetryData: addTelemetryData, addMessageWithError: addMessageWithError }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); var logger = __webpack_require__(13); function checkIgnore(item, settings) { var level = item.level; var levelVal = _.LEVELS[level] || 0; var reportLevel = _.LEVELS[settings.reportLevel] || 0; if (levelVal < reportLevel) { return false; } if (_.get(settings, 'plugins.jquery.ignoreAjaxErrors')) { return !_.get(item, 'body.message.extra.isAjax'); } return true; } function userCheckIgnore(item, settings) { var isUncaught = !!item._isUncaught; delete item._isUncaught; var args = item._originalArgs; delete item._originalArgs; try { if (_.isFunction(settings.checkIgnore) && settings.checkIgnore(isUncaught, args, item)) { return false; } } catch (e) { settings.checkIgnore = null; logger.error('Error while calling custom checkIgnore(), removing', e); } return true; } function urlIsNotBlacklisted(item, settings) { return !urlIsOnAList(item, settings, 'blacklist'); } function urlIsWhitelisted(item, settings) { return urlIsOnAList(item, settings, 'whitelist'); } function urlIsOnAList(item, settings, whiteOrBlack) { // whitelist is the default var black = false; if (whiteOrBlack === 'blacklist') { black = true; } var list, trace, frame, filename, frameLength, url, listLength, urlRegex; var i, j; try { list = black ? settings.hostBlackList : settings.hostWhiteList; listLength = list && list.length; trace = _.get(item, 'body.trace'); // These two checks are important to come first as they are defaults // in case the list is missing or the trace is missing or not well-formed if (!list || listLength === 0) { return !black; } if (!trace || !trace.frames) { return !black; } frameLength = trace.frames.length; for (i = 0; i < frameLength; i++) { frame = trace.frames[i]; filename = frame.filename; if (!_.isType(filename, 'string')) { return !black; } for (j = 0; j < listLength; j++) { url = list[j]; urlRegex = new RegExp(url); if (urlRegex.test(filename)) { return true; } } } } catch (e) /* istanbul ignore next */ { if (black) { settings.hostBlackList = null; } else { settings.hostWhiteList = null; } var listName = black ? 'hostBlackList' : 'hostWhiteList'; logger.error('Error while reading your configuration\'s ' + listName + ' option. Removing custom ' + listName + '.', e); return !black; } return false; } function messageIsIgnored(item, settings) { var exceptionMessage, i, ignoredMessages, len, messageIsIgnored, rIgnoredMessage, body, traceMessage, bodyMessage; try { messageIsIgnored = false; ignoredMessages = settings.ignoredMessages; if (!ignoredMessages || ignoredMessages.length === 0) { return true; } body = item.body; traceMessage = _.get(body, 'trace.exception.message'); bodyMessage = _.get(body, 'message.body'); exceptionMessage = traceMessage || bodyMessage; if (!exceptionMessage){ return true; } len = ignoredMessages.length; for (i = 0; i < len; i++) { rIgnoredMessage = new RegExp(ignoredMessages[i], 'gi'); messageIsIgnored = rIgnoredMessage.test(exceptionMessage); if (messageIsIgnored) { break; } } } catch(e) /* istanbul ignore next */ { settings.ignoredMessages = null; logger.error('Error while reading your configuration\'s ignoredMessages option. Removing custom ignoredMessages.'); } return !messageIsIgnored; } module.exports = { checkIgnore: checkIgnore, userCheckIgnore: userCheckIgnore, urlIsNotBlacklisted: urlIsNotBlacklisted, urlIsWhitelisted: urlIsWhitelisted, messageIsIgnored: messageIsIgnored }; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _ = __webpack_require__(6); var urlparser = __webpack_require__(18); var domUtil = __webpack_require__(26); var defaults = { network: true, log: true, dom: true, navigation: true, connectivity: true }; function replace(obj, name, replacement, replacements, type) { var orig = obj[name]; obj[name] = replacement(orig); if (replacements) { replacements[type].push([obj, name, orig]); } } function restore(replacements, type) { var b; while (replacements[type].length) { b = replacements[type].shift(); b[0][b[1]] = b[2]; } } function Instrumenter(options, telemeter, rollbar, _window, _document) { var autoInstrument = options.autoInstrument; if (options.enabled === false || autoInstrument === false) { this.autoInstrument = {}; } else { if (!_.isType(autoInstrument, 'object')) { autoInstrument = defaults; } this.autoInstrument = _.extend(true, {}, defaults, autoInstrument); } this.scrubTelemetryInputs = !!options.scrubTelemetryInputs; this.telemetryScrubber = options.telemetryScrubber; this.telemeter = telemeter; this.rollbar = rollbar; this._window = _window || {}; this._document = _document || {}; this.replacements = { network: [], log: [], navigation: [], connectivity: [] }; this.eventRemovers = { dom: [], connectivity: [] }; this._location = this._window.location; this._lastHref = this._location && this._location.href; } Instrumenter.prototype.configure = function(options) { var autoInstrument = options.autoInstrument; var oldSettings = _.extend(true, {}, this.autoInstrument); if (options.enabled === false || autoInstrument === false) { this.autoInstrument = {}; } else { if (!_.isType(autoInstrument, 'object')) { autoInstrument = defaults; } this.autoInstrument = _.extend(true, {}, defaults, autoInstrument); } this.instrument(oldSettings); if (options.scrubTelemetryInputs !== undefined) { this.scrubTelemetryInputs = !!options.scrubTelemetryInputs; } if (options.telemetryScrubber !== undefined) { this.telemetryScrubber = options.telemetryScrubber; } }; Instrumenter.prototype.instrument = function(oldSettings) { if (this.autoInstrument.network && !(oldSettings && oldSettings.network)) { this.instrumentNetwork(); } else if (!this.autoInstrument.network && oldSettings && oldSettings.network) { this.deinstrumentNetwork(); } if (this.autoInstrument.log && !(oldSettings && oldSettings.log)) { this.instrumentConsole(); } else if (!this.autoInstrument.log && oldSettings && oldSettings.log) { this.deinstrumentConsole(); } if (this.autoInstrument.dom && !(oldSettings && oldSettings.dom)) { this.instrumentDom(); } else if (!this.autoInstrument.dom && oldSettings && oldSettings.dom) { this.deinstrumentDom(); } if (this.autoInstrument.navigation && !(oldSettings && oldSettings.navigation)) { this.instrumentNavigation(); } else if (!this.autoInstrument.navigation && oldSettings && oldSettings.navigation) { this.deinstrumentNavigation(); } if (this.autoInstrument.connectivity && !(oldSettings && oldSettings.connectivity)) { this.instrumentConnectivity(); } else if (!this.autoInstrument.connectivity && oldSettings && oldSettings.connectivity) { this.deinstrumentConnectivity(); } }; Instrumenter.prototype.deinstrumentNetwork = function() { restore(this.replacements, 'network'); }; Instrumenter.prototype.instrumentNetwork = function() { var self = this; function wrapProp(prop, xhr) { if (prop in xhr && _.isFunction(xhr[prop])) { replace(xhr, prop, function(orig) { return self.rollbar.wrap(orig); }); } } if ('XMLHttpRequest' in this._window) { var xhrp = this._window.XMLHttpRequest.prototype; replace(xhrp, 'open', function(orig) { return function(method, url) { if (_.isType(url, 'string')) { this.__rollbar_xhr = { method: method, url: url, status_code: null, start_time_ms: _.now(), end_time_ms: null }; } return orig.apply(this, arguments); }; }, this.replacements, 'network'); replace(xhrp, 'send', function(orig) { /* eslint-disable no-unused-vars */ return function(data) { /* eslint-enable no-unused-vars */ var xhr = this; function onreadystatechangeHandler() { if (xhr.__rollbar_xhr && (xhr.readyState === 1 || xhr.readyState === 4)) { if (xhr.__rollbar_xhr.status_code === null) { xhr.__rollbar_xhr.status_code = 0; xhr.__rollbar_event = self.telemeter.captureNetwork(xhr.__rollbar_xhr, 'xhr'); } if (xhr.readyState === 1) { xhr.__rollbar_xhr.start_time_ms = _.now(); } else { xhr.__rollbar_xhr.end_time_ms = _.now(); } try { var code = xhr.status; code = code === 1223 ? 204 : code; xhr.__rollbar_xhr.status_code = code; xhr.__rollbar_event.level = self.telemeter.levelFromStatus(code); } catch (e) { /* ignore possible exception from xhr.status */ } } } wrapProp('onload', xhr); wrapProp('onerror', xhr); wrapProp('onprogress', xhr); if ('onreadystatechange' in xhr && _.isFunction(xhr.onreadystatechange)) { replace(xhr, 'onreadystatechange', function(orig) { return self.rollbar.wrap(orig, undefined, onreadystatechangeHandler); }); } else { xhr.onreadystatechange = onreadystatechangeHandler; } return orig.apply(this, arguments); } }, this.replacements, 'network'); } if ('fetch' in this._window) { replace(this._window, 'fetch', function(orig) { /* eslint-disable no-unused-vars */ return function(fn, t) { /* eslint-enable no-unused-vars */ var args = new Array(arguments.length); for (var i=0, len=args.length; i < len; i++) { args[i] = arguments[i]; } var input = args[0]; var method = 'GET'; var url; if (_.isType(input, 'string')) { url = input; } else { url = input.url; if (input.method) { method = input.method; } } if (args[1] && args[1].method) { method = args[1].method; } var metadata = { method: method, url: url, status_code: null, start_time_ms: _.now(), end_time_ms: null }; self.telemeter.captureNetwork(metadata, 'fetch'); return orig.apply(this, args).then(function (resp) { metadata.end_time_ms = _.now(); metadata.status_code = resp.status; return resp; }); }; }, this.replacements, 'network'); } }; Instrumenter.prototype.deinstrumentConsole = function() { if (!('console' in this._window && this._window.console.log)) { return; } var b; while (this.replacements['log'].length) { b = this.replacements['log'].shift(); this._window.console[b[0]] = b[1]; } }; Instrumenter.prototype.instrumentConsole = function() { if (!('console' in this._window && this._window.console.log)) { return; } var self = this; var c = this._window.console; function wrapConsole(method) { var orig = c[method]; var origConsole = c; var level = method === 'warn' ? 'warning' : method; c[method] = function() { var args = Array.prototype.slice.call(arguments); var message = _.formatArgsAsString(args); self.telemeter.captureLog(message, level); if (orig) { Function.prototype.apply.call(orig, origConsole, args); } }; self.replacements['log'].push([method, orig]); } var methods = ['debug','info','warn','error','log']; for (var i=0, len=methods.length; i < len; i++) { wrapConsole(methods[i]); } }; Instrumenter.prototype.deinstrumentDom = function() { if (!('addEventListener' in this._window || 'attachEvent' in this._window)) { return; } this.removeListeners('dom'); }; Instrumenter.prototype.instrumentDom = function() { if (!('addEventListener' in this._window || 'attachEvent' in this._window)) { return; } var clickHandler = this.handleClick.bind(this); var blurHandler = this.handleBlur.bind(this); this.addListener('dom', this._window, 'click', 'onclick', clickHandler, true); this.addListener('dom', this._window, 'blur', 'onfocusout', blurHandler, true); }; Instrumenter.prototype.handleClick = function(evt) { try { var e = domUtil.getElementFromEvent(evt, this._document); var hasTag = e && e.tagName; var anchorOrButton = domUtil.isDescribedElement(e, 'a') || domUtil.isDescribedElement(e, 'button'); if (hasTag && (anchorOrButton || domUtil.isDescribedElement(e, 'input', ['button', 'submit']))) { this.captureDomEvent('click', e); } else if (domUtil.isDescribedElement(e, 'input', ['checkbox', 'radio'])) { this.captureDomEvent('input', e, e.value, e.checked); } } catch (exc) { // TODO: Not sure what to do here } }; Instrumenter.prototype.handleBlur = function(evt) { try { var e = domUtil.getElementFromEvent(evt, this._document); if (e && e.tagName) { if (domUtil.isDescribedElement(e, 'textarea')) { this.captureDomEvent('input', e, e.value); } else if (domUtil.isDescribedElement(e, 'select') && e.options && e.options.length) { this.handleSelectInputChanged(e); } else if (domUtil.isDescribedElement(e, 'input') && !domUtil.isDescribedElement(e, 'input', ['button', 'submit', 'hidden', 'checkbox', 'radio'])) { this.captureDomEvent('input', e, e.value); } } } catch (exc) { // TODO: Not sure what to do here } }; Instrumenter.prototype.handleSelectInputChanged = function(elem) { if (elem.multiple) { for (var i = 0; i < elem.options.length; i++) { if (elem.options[i].selected) { this.captureDomEvent('input', elem, elem.options[i].value); } } } else if (elem.selectedIndex >= 0 && elem.options[elem.selectedIndex]) { this.captureDomEvent('input', elem, elem.options[elem.selectedIndex].value); } }; Instrumenter.prototype.captureDomEvent = function(subtype, element, value, isChecked) { if (value !== undefined) { if (this.scrubTelemetryInputs || (domUtil.getElementType(element) === 'password')) { value = '[scrubbed]'; } else if (this.telemetryScrubber) { var description = domUtil.describeElement(element); if (this.telemetryScrubber(description)) { value = '[scrubbed]'; } } } var elementString = domUtil.elementArrayToString(domUtil.treeToArray(element)); this.telemeter.captureDom(subtype, elementString, value, isChecked); }; Instrumenter.prototype.deinstrumentNavigation = function() { var chrome = this._window.chrome; var chromePackagedApp = chrome && chrome.app && chrome.app.runtime; // See https://github.com/angular/angular.js/pull/13945/files var hasPushState = !chromePackagedApp && this._window.history && this._window.history.pushState; if (!hasPushState) { return; } restore(this.replacements, 'navigation'); }; Instrumenter.prototype.instrumentNavigation = function() { var chrome = this._window.chrome; var chromePackagedApp = chrome && chrome.app && chrome.app.runtime; // See https://github.com/angular/angular.js/pull/13945/files var hasPushState = !chromePackagedApp && this._window.history && this._window.history.pushState; if (!hasPushState) { return; } var self = this; replace(this._window, 'onpopstate', function(orig) { return function() { var current = self._location.href; self.handleUrlChange(self._lastHref, current); if (orig) { orig.apply(this, arguments); } }; }, this.replacements, 'navigation'); replace(this._window.history, 'pushState', function(orig) { return function() { var url = arguments.length > 2 ? arguments[2] : undefined; if (url) { self.handleUrlChange(self._lastHref, url + ''); } return orig.apply(this, arguments); }; }, this.replacements, 'navigation'); }; Instrumenter.prototype.handleUrlChange = function(from, to) { var parsedHref = urlparser.parse(this._location.href); var parsedTo = urlparser.parse(to); var parsedFrom = urlparser.parse(from); this._lastHref = to; if (parsedHref.protocol === parsedTo.protocol && parsedHref.host === parsedTo.host) { to = parsedTo.path + (parsedTo.hash || ''); } if (parsedHref.protocol === parsedFrom.protocol && parsedHref.host === parsedFrom.host) { from = parsedFrom.path + (parsedFrom.hash || ''); } this.telemeter.captureNavigation(from, to); }; Instrumenter.prototype.deinstrumentConnectivity = function() { if (!('addEventListener' in this._window || 'body' in this._document)) { return; } if (this._window.addEventListener) { this.removeListeners('connectivity'); } else { restore(this.replacements, 'connectivity'); } }; Instrumenter.prototype.instrumentConnectivity = function() { if (!('addEventListener' in this._window || 'body' in this._document)) { return; } if (this._window.addEventListener) { this.addListener('connectivity', this._window, 'online', undefined, function() { this.telemeter.captureConnectivityChange('online'); }.bind(this), true); this.addListener('connectivity', this._window, 'offline', undefined, function() { this.telemeter.captureConnectivityChange('offline'); }.bind(this), true); } else { var self = this; replace(this._document.body, 'ononline', function(orig) { return function() { self.telemeter.captureConnectivityChange('online'); if (orig) { orig.apply(this, arguments); } } }, this.replacements, 'connectivity'); replace(this._document.body, 'onoffline', function(orig) { return function() { self.telemeter.captureConnectivityChange('offline'); if (orig) { orig.apply(this, arguments); } } }, this.replacements, 'connectivity'); } }; Instrumenter.prototype.addListener = function(section, obj, type, altType, handler, capture) { if (obj.addEventListener) { obj.addEventListener(type, handler, capture); this.eventRemovers[section].push(function() { obj.removeEventListener(type, handler, capture); }); } else if (altType) { obj.attachEvent(altType, handler); this.eventRemovers[section].push(function() { obj.detachEvent(altType, handler); }); } }; Instrumenter.prototype.removeListeners = function(section) { var r; while (this.eventRemovers[section].length) { r = this.eventRemovers[section].shift(); r(); } }; module.exports = Instrumenter; /***/ }), /* 26 */ /***/ (function(module, exports) { 'use strict'; function getElementType(e) { return (e.getAttribute('type') || '').toLowerCase(); } function isDescribedElement(element, type, subtypes) { if (element.tagName.toLowerCase() !== type.toLowerCase()) { return false; } if (!subtypes) { return true; } element = getElementType(element); for (var i = 0; i < subtypes.length; i++) { if (subtypes[i] === element) { return true; } } return false; } function getElementFromEvent(evt, doc) { if (evt.target) { return evt.target; } if (doc && doc.elementFromPoint) { return doc.elementFromPoint(evt.clientX, evt.clientY); } return undefined; } function treeToArray(elem) { var MAX_HEIGHT = 5; var out = []; var nextDescription; for (var height = 0; elem && height < MAX_HEIGHT; height++) { nextDescription = describeElement(elem); if (nextDescription.tagName === 'html') { break; } out.unshift(nextDescription); elem = elem.parentNode; } return out; } function elementArrayToString(a) { var MAX_LENGTH = 80; var separator = ' > ', separatorLength = separator.length; var out = [], len = 0, nextStr, totalLength; for (var i = a.length - 1; i >= 0; i--) { nextStr = descriptionToString(a[i]); totalLength = len + (out.length * separatorLength) + nextStr.length; if (i < a.length - 1 && totalLength >= MAX_LENGTH + 3) { out.unshift('...'); break; } out.unshift(nextStr); len += nextStr.length; } return out.join(separator); } function descriptionToString(desc) { if (!desc || !desc.tagName) { return ''; } var out = [desc.tagName]; if (desc.id) { out.push('#' + desc.id); } if (desc.classes) { out.push('.' + desc.classes.join('.')); } for (var i = 0; i < desc.attributes.length; i++) { out.push('[' + desc.attributes[i].key + '="' + desc.attributes[i].value + '"]'); } return out.join(''); } /** * Input: a dom element * Output: null if tagName is falsey or input is falsey, else * { * tagName: String, * id: String | undefined, * classes: [String] | undefined, * attributes: [ * { * key: OneOf(type, name, title, alt), * value: String * } * ] * } */ function describeElement(elem) { if (!elem || !elem.tagName) { return null; } var out = {}, className, key, attr, i; out.tagName = elem.tagName.toLowerCase(); if (elem.id) { out.id = elem.id; } className = elem.className; if (className && (typeof className === 'string')) { out.classes = className.split(/\s+/); } var attributes = ['type', 'name', 'title', 'alt']; out.attributes = []; for (i = 0; i < attributes.length; i++) { key = attributes[i]; attr = elem.getAttribute(key); if (attr) { out.attributes.push({key: key, value: attr}); } } return out; } module.exports = { describeElement: describeElement, descriptionToString: descriptionToString, elementArrayToString: elementArrayToString, treeToArray: treeToArray, getElementFromEvent: getElementFromEvent, isDescribedElement: isDescribedElement, getElementType: getElementType }; /***/ }) /******/ ])});;
joeyparrish/cdnjs
ajax/libs/rollbar.js/2.3.1/rollbar.named-amd.js
JavaScript
mit
149,943
/*========================================================================= Program: Visualization Toolkit Module: vtkVisibilitySort.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /* * Copyright 2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the * U.S. Government. Redistribution and use in source and binary forms, with * or without modification, are permitted provided that this Notice and any * statement of authorship are reproduced on all copies. */ // .NAME vtkVisibilitySort - Abstract class that can sort cell data along a viewpoint. // // .SECTION Description // vtkVisibilitySort encapsulates a method for depth sorting the cells of a // vtkDataSet for a given viewpoint. It should be noted that subclasses // are not required to give an absolutely correct sorting. Many types of // unstructured grids may have sorting cycles, meaning that there is no // possible correct sorting. Some subclasses also only give an approximate // sorting in the interest of speed. // // .SECTION Note // The Input field of this class tends to causes reference cycles. To help // break these cycles, garbage collection is enabled on this object and the // input parameter is traced. For this to work, though, an object in the // loop holding the visibility sort should also report that to the garbage // collector. // #ifndef __vtkVisibilitySort_h #define __vtkVisibilitySort_h #include "vtkObject.h" class vtkIdTypeArray; class vtkDataSet; class vtkMatrix4x4; class vtkCamera; class VTK_RENDERING_EXPORT vtkVisibilitySort : public vtkObject { public: vtkTypeMacro(vtkVisibilitySort, vtkObject); virtual void PrintSelf(ostream &os, vtkIndent indent); // Description: // To facilitate incremental sorting algorithms, the cells are retrieved // in an iteration process. That is, call InitTraversal to start the // iteration and call GetNextCells to get the cell IDs in order. // However, for efficiencies sake, GetNextCells returns an ordered list // of several id's in once call (but not necessarily all). GetNextCells // will return NULL once the entire sorted list is output. The // vtkIdTypeArray returned from GetNextCells is a cached array, so do not // delete it. At the same note, do not expect the array to be valid // after subsequent calls to GetNextCells. virtual void InitTraversal() = 0; virtual vtkIdTypeArray *GetNextCells() = 0; // Description: // Set/Get the maximum number of cells that GetNextCells will return // in one invocation. vtkSetClampMacro(MaxCellsReturned, int, 1, VTK_LARGE_INTEGER); vtkGetMacro(MaxCellsReturned, int); // Description: // Set/Get the matrix that transforms from object space to world space. // Generally, you get this matrix from a call to GetMatrix of a vtkProp3D // (vtkActor). virtual void SetModelTransform(vtkMatrix4x4 *mat); vtkGetObjectMacro(ModelTransform, vtkMatrix4x4); vtkGetObjectMacro(InverseModelTransform, vtkMatrix4x4); // Description: // Set/Get the camera that specifies the viewing parameters. virtual void SetCamera(vtkCamera *camera); vtkGetObjectMacro(Camera, vtkCamera); // Description: // Set/Get the data set containing the cells to sort. virtual void SetInput(vtkDataSet *data); vtkGetObjectMacro(Input, vtkDataSet); // Description: // Set/Get the sorting direction. Be default, the direction is set // to back to front. vtkGetMacro(Direction, int); vtkSetMacro(Direction, int); void SetDirectionToBackToFront() { this->SetDirection(BACK_TO_FRONT); } void SetDirectionToFrontToBack() { this->SetDirection(FRONT_TO_BACK); } //BTX enum { BACK_TO_FRONT, FRONT_TO_BACK }; //ETX // Description: // Overwritten to enable garbage collection. virtual void Register(vtkObjectBase *o); virtual void UnRegister(vtkObjectBase *o); protected: vtkVisibilitySort(); virtual ~vtkVisibilitySort(); vtkTimeStamp LastSortTime; vtkMatrix4x4 *ModelTransform; vtkMatrix4x4 *InverseModelTransform; vtkCamera *Camera; vtkDataSet *Input; int MaxCellsReturned; int Direction; virtual void ReportReferences(vtkGarbageCollector *collector); private: vtkVisibilitySort(const vtkVisibilitySort &); // Not implemented. void operator=(const vtkVisibilitySort &); // Not implemented. }; #endif //__vtkVisibilitySort_h
byvernault/xnat_osirix_plugin
src/OsiriXAPI.framework/Versions/Current/Headers/vtkVisibilitySort.h
C
mit
4,819
var reporter_1 = require('./reporter'); function isTS14(typescript) { return !('findConfigFile' in typescript); } exports.isTS14 = isTS14; function getFileName(thing) { if (thing.filename) return thing.filename; // TS 1.4 return thing.fileName; // TS 1.5 } exports.getFileName = getFileName; function getDiagnosticsAndEmit(program) { var result = reporter_1.emptyCompilationResult(); if (program.getDiagnostics) { var errors = program.getDiagnostics(); result.syntaxErrors = errors.length; if (!errors.length) { // If there are no syntax errors, check types var checker = program.getTypeChecker(true); var semanticErrors = checker.getDiagnostics(); var emitErrors = checker.emitFiles().diagnostics; errors = semanticErrors.concat(emitErrors); result.semanticErrors = errors.length; } else { result.emitSkipped = true; } return [errors, result]; } else { var errors = program.getSyntacticDiagnostics(); result.syntaxErrors = errors.length; if (errors.length === 0) { errors = program.getGlobalDiagnostics(); // Remove error: "File '...' is not under 'rootDir' '...'. 'rootDir' is expected to contain all source files." // This is handled by ICompiler#correctSourceMap, so this error can be muted. errors = errors.filter(function (item) { return item.code !== 6059; }); result.globalErrors = errors.length; } if (errors.length === 0) { errors = program.getSemanticDiagnostics(); result.semanticErrors = errors.length; } var emitOutput = program.emit(); result.emitErrors = emitOutput.diagnostics.length; result.emitSkipped = emitOutput.emitSkipped; return [errors.concat(emitOutput.diagnostics), result]; } } exports.getDiagnosticsAndEmit = getDiagnosticsAndEmit; function getLineAndCharacterOfPosition(typescript, file, position) { if (file.getLineAndCharacterOfPosition) { var lineAndCharacter = file.getLineAndCharacterOfPosition(position); return { line: lineAndCharacter.line + 1, character: lineAndCharacter.character + 1 }; } else { return file.getLineAndCharacterFromPosition(position); } } exports.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; function createSourceFile(typescript, fileName, content, target, version) { if (version === void 0) { version = '0'; } if (typescript.findConfigFile) { return typescript.createSourceFile(fileName, content, target, true); } else { return typescript.createSourceFile(fileName, content, target, version); } } exports.createSourceFile = createSourceFile; function flattenDiagnosticMessageText(typescript, messageText) { if (typeof messageText === 'string') { return messageText; } else { return typescript.flattenDiagnosticMessageText(messageText, "\n"); } } exports.flattenDiagnosticMessageText = flattenDiagnosticMessageText; function transpile(typescript, input, compilerOptions, fileName, diagnostics) { if (!typescript.transpile) { throw new Error('gulp-typescript: Single file compilation is not supported using TypeScript 1.4'); } return typescript.transpile(input, compilerOptions, fileName, diagnostics); } exports.transpile = transpile;
Gabriel0402/learn-typescript
step_additional_gulp/node_modules/gulp-typescript/release/tsapi.js
JavaScript
mit
3,515
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * Copyright (C) 2004-2011 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.sun.xml.internal.rngom.digested; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.List; import javax.xml.namespace.QName; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import com.sun.xml.internal.rngom.ast.builder.BuildException; import com.sun.xml.internal.rngom.ast.builder.SchemaBuilder; import com.sun.xml.internal.rngom.ast.util.CheckingSchemaBuilder; import com.sun.xml.internal.rngom.nc.NameClass; import com.sun.xml.internal.rngom.nc.NameClassVisitor; import com.sun.xml.internal.rngom.nc.SimpleNameClass; import com.sun.xml.internal.rngom.parse.Parseable; import com.sun.xml.internal.rngom.parse.compact.CompactParseable; import com.sun.xml.internal.rngom.parse.xml.SAXParseable; import com.sun.xml.internal.rngom.xml.util.WellKnownNamespaces; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; /** * Printer of RELAX NG digested model to XML using StAX {@link XMLStreamWriter}. * * @author <A href="mailto:demakov@ispras.ru">Alexey Demakov</A> */ public class DXMLPrinter { protected XMLStreamWriter out; protected String indentStep = "\t"; protected String newLine = System.getProperty("line.separator"); protected int indent; protected boolean afterEnd = false; protected DXMLPrinterVisitor visitor; protected NameClassXMLPrinterVisitor ncVisitor; protected DOMPrinter domPrinter; /** * @param out Output stream. */ public DXMLPrinter(XMLStreamWriter out) { this.out = out; this.visitor = new DXMLPrinterVisitor(); this.ncVisitor = new NameClassXMLPrinterVisitor(); this.domPrinter = new DOMPrinter(out); } /** * Prints grammar enclosed by start/end document. * * @param grammar * @throws XMLStreamException */ public void printDocument(DGrammarPattern grammar) throws XMLStreamException { try { visitor.startDocument(); visitor.on(grammar); visitor.endDocument(); } catch (XMLWriterException e) { if (e.getCause() instanceof XMLStreamException) { throw (XMLStreamException) e.getCause(); } else { throw new XMLStreamException(e); } } } /** * Prints XML fragment for the given pattern. * * @throws XMLStreamException */ public void print(DPattern pattern) throws XMLStreamException { try { pattern.accept(visitor); } catch (XMLWriterException e) { if (e.getCause() instanceof XMLStreamException) { throw (XMLStreamException) e.getCause(); } else { throw new XMLStreamException(e); } } } /** * Prints XML fragment for the given name class. * * @throws XMLStreamException */ public void print(NameClass nc) throws XMLStreamException { try { nc.accept(ncVisitor); } catch (XMLWriterException e) { if (e.getCause() instanceof XMLStreamException) { throw (XMLStreamException) e.getCause(); } else { throw new XMLStreamException(e); } } } public void print(Node node) throws XMLStreamException { domPrinter.print(node); } protected class XMLWriterException extends RuntimeException { protected XMLWriterException(Throwable cause) { super(cause); } } protected class XMLWriter { protected void newLine() { try { out.writeCharacters(newLine); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } protected void indent() { try { for (int i = 0; i < indent; i++) { out.writeCharacters(indentStep); } } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void startDocument() { try { out.writeStartDocument(); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void endDocument() { try { out.writeEndDocument(); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public final void start(String element) { try { newLine(); indent(); out.writeStartElement(element); indent++; afterEnd = false; } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void end() { try { indent--; if (afterEnd) { newLine(); indent(); } out.writeEndElement(); afterEnd = true; } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void attr(String prefix, String ns, String name, String value) { try { out.writeAttribute(prefix, ns, name, value); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void attr(String name, String value) { try { out.writeAttribute(name, value); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void ns(String prefix, String uri) { try { out.writeNamespace(prefix, uri); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } public void body(String text) { try { out.writeCharacters(text); afterEnd = false; } catch (XMLStreamException e) { throw new XMLWriterException(e); } } } protected class DXMLPrinterVisitor extends XMLWriter implements DPatternVisitor<Void> { protected void on(DPattern p) { p.accept(this); } protected void unwrapGroup(DPattern p) { if (p instanceof DGroupPattern && p.getAnnotation() == DAnnotation.EMPTY) { for (DPattern d : (DGroupPattern) p) { on(d); } } else { on(p); } } protected void unwrapChoice(DPattern p) { if (p instanceof DChoicePattern && p.getAnnotation() == DAnnotation.EMPTY) { for (DPattern d : (DChoicePattern) p) { on(d); } } else { on(p); } } protected void on(NameClass nc) { if (nc instanceof SimpleNameClass) { QName qname = ((SimpleNameClass) nc).name; String name = qname.getLocalPart(); if (!qname.getPrefix().equals("")) name = qname.getPrefix() + ":"; attr("name", name); } else { nc.accept(ncVisitor); } } protected void on(DAnnotation ann) { if (ann == DAnnotation.EMPTY) return; for (DAnnotation.Attribute attr : ann.getAttributes().values()) { attr(attr.getPrefix(), attr.getNs(), attr.getLocalName(), attr.getValue()); } for (Element elem : ann.getChildren()) { try { newLine(); indent(); print(elem); } catch (XMLStreamException e) { throw new XMLWriterException(e); } } } public Void onAttribute(DAttributePattern p) { start("attribute"); on(p.getName()); on(p.getAnnotation()); DPattern child = p.getChild(); // do not print default value if (!(child instanceof DTextPattern)) { on(p.getChild()); } end(); return null; } public Void onChoice(DChoicePattern p) { start("choice"); on(p.getAnnotation()); for (DPattern d : p) { on(d); } end(); return null; } public Void onData(DDataPattern p) { List<DDataPattern.Param> params = p.getParams(); DPattern except = p.getExcept(); start("data"); attr("datatypeLibrary", p.getDatatypeLibrary()); attr("type", p.getType()); on(p.getAnnotation()); for (DDataPattern.Param param : params) { start("param"); attr("ns", param.getNs()); attr("name", param.getName()); body(param.getValue()); end(); } if (except != null) { start("except"); unwrapChoice(except); end(); } end(); return null; } public Void onElement(DElementPattern p) { start("element"); on(p.getName()); on(p.getAnnotation()); unwrapGroup(p.getChild()); end(); return null; } public Void onEmpty(DEmptyPattern p) { start("empty"); on(p.getAnnotation()); end(); return null; } public Void onGrammar(DGrammarPattern p) { start("grammar"); ns(null, WellKnownNamespaces.RELAX_NG); on(p.getAnnotation()); start("start"); on(p.getStart()); end(); for (DDefine d : p) { start("define"); attr("name", d.getName()); on(d.getAnnotation()); unwrapGroup(d.getPattern()); end(); } end(); return null; } public Void onGroup(DGroupPattern p) { start("group"); on(p.getAnnotation()); for (DPattern d : p) { on(d); } end(); return null; } public Void onInterleave(DInterleavePattern p) { start("interleave"); on(p.getAnnotation()); for (DPattern d : p) { on(d); } end(); return null; } public Void onList(DListPattern p) { start("list"); on(p.getAnnotation()); unwrapGroup(p.getChild()); end(); return null; } public Void onMixed(DMixedPattern p) { start("mixed"); on(p.getAnnotation()); unwrapGroup(p.getChild()); end(); return null; } public Void onNotAllowed(DNotAllowedPattern p) { start("notAllowed"); on(p.getAnnotation()); end(); return null; } public Void onOneOrMore(DOneOrMorePattern p) { start("oneOrMore"); on(p.getAnnotation()); unwrapGroup(p.getChild()); end(); return null; } public Void onOptional(DOptionalPattern p) { start("optional"); on(p.getAnnotation()); unwrapGroup(p.getChild()); end(); return null; } public Void onRef(DRefPattern p) { start("ref"); attr("name", p.getName()); on(p.getAnnotation()); end(); return null; } public Void onText(DTextPattern p) { start("text"); on(p.getAnnotation()); end(); return null; } public Void onValue(DValuePattern p) { start("value"); if (!p.getNs().equals("")) attr("ns", p.getNs()); attr("datatypeLibrary", p.getDatatypeLibrary()); attr("type", p.getType()); on(p.getAnnotation()); body(p.getValue()); end(); return null; } public Void onZeroOrMore(DZeroOrMorePattern p) { start("zeroOrMore"); on(p.getAnnotation()); unwrapGroup(p.getChild()); end(); return null; } } protected class NameClassXMLPrinterVisitor extends XMLWriter implements NameClassVisitor<Void> { public Void visitChoice(NameClass nc1, NameClass nc2) { // TODO: flatten nested choices start("choice"); nc1.accept(this); nc2.accept(this); end(); return null; } public Void visitNsName(String ns) { start("nsName"); attr("ns", ns); end(); return null; } public Void visitNsNameExcept(String ns, NameClass nc) { start("nsName"); attr("ns", ns); start("except"); nc.accept(this); end(); end(); return null; } public Void visitAnyName() { start("anyName"); end(); return null; } public Void visitAnyNameExcept(NameClass nc) { start("anyName"); start("except"); nc.accept(this); end(); end(); return null; } public Void visitName(QName name) { start("name"); if (!name.getPrefix().equals("")) { body(name.getPrefix() + ":"); } body(name.getLocalPart()); end(); return null; } public Void visitNull() { throw new UnsupportedOperationException("visitNull"); } } public static void main(String[] args) throws Exception { Parseable p; ErrorHandler eh = new DefaultHandler() { @Override public void error(SAXParseException e) throws SAXException { throw e; } }; // the error handler passed to Parseable will receive parsing errors. String path = new File(args[0]).toURL().toString(); if (args[0].endsWith(".rng")) { p = new SAXParseable(new InputSource(path), eh); } else { p = new CompactParseable(new InputSource(path), eh); } // the error handler passed to CheckingSchemaBuilder will receive additional // errors found during the RELAX NG restrictions check. // typically you'd want to pass in the same error handler, // as there's really no distinction between those two kinds of errors. SchemaBuilder sb = new CheckingSchemaBuilder(new DSchemaBuilderImpl(), eh); try { // run the parser DGrammarPattern grammar = (DGrammarPattern) p.parse(sb); OutputStream out = new FileOutputStream(args[1]); XMLOutputFactory factory = XMLOutputFactory.newInstance(); factory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE); XMLStreamWriter output = factory.createXMLStreamWriter(out); DXMLPrinter printer = new DXMLPrinter(output); printer.printDocument(grammar); output.close(); out.close(); } catch (BuildException e) { if (e.getCause() instanceof SAXParseException) { SAXParseException se = (SAXParseException) e.getCause(); System.out.println("(" + se.getLineNumber() + "," + se.getColumnNumber() + "): " + se.getMessage()); return; } else // I found that Crimson doesn't show the proper stack trace // when a RuntimeException happens inside a SchemaBuilder. // the following code shows the actual exception that happened. if (e.getCause() instanceof SAXException) { SAXException se = (SAXException) e.getCause(); if (se.getException() != null) se.getException().printStackTrace(); } throw e; } } }
FauxFaux/jdk9-jaxws
src/jdk.xml.bind/share/classes/com/sun/xml/internal/rngom/digested/DXMLPrinter.java
Java
gpl-2.0
19,385
/* Test the `vst4u32' ARM Neon intrinsic. */ /* This file was autogenerated by neon-testgen. */ /* { dg-do assemble } */ /* { dg-require-effective-target arm_neon_ok } */ /* { dg-options "-save-temps -O0" } */ /* { dg-add-options arm_neon } */ #include "arm_neon.h" void test_vst4u32 (void) { uint32_t *arg0_uint32_t; uint32x2x4_t arg1_uint32x2x4_t; vst4_u32 (arg0_uint32_t, arg1_uint32x2x4_t); } /* { dg-final { scan-assembler "vst4\.32\[ \]+\\\{((\[dD\]\[0-9\]+-\[dD\]\[0-9\]+)|(\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+))\\\}, \\\[\[rR\]\[0-9\]+\\\]!?\(\[ \]+@\[a-zA-Z0-9 \]+\)?\n" } } */ /* { dg-final { cleanup-saved-temps } } */
SanDisk-Open-Source/SSD_Dashboard
uefi/gcc/gcc-4.6.3/gcc/testsuite/gcc.target/arm/neon/vst4u32.c
C
gpl-2.0
671
/* * Page cache for QEMU * The cache is base on a hash of the page address * * Copyright 2012 Red Hat, Inc. and/or its affiliates * * Authors: * Orit Wasserman <owasserm@redhat.com> * * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. * */ #include "qemu/osdep.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "qemu/host-utils.h" #include "page_cache.h" #ifdef DEBUG_CACHE #define DPRINTF(fmt, ...) \ do { fprintf(stdout, "cache: " fmt, ## __VA_ARGS__); } while (0) #else #define DPRINTF(fmt, ...) \ do { } while (0) #endif /* the page in cache will not be replaced in two cycles */ #define CACHED_PAGE_LIFETIME 2 typedef struct CacheItem CacheItem; struct CacheItem { uint64_t it_addr; uint64_t it_age; uint8_t *it_data; }; struct PageCache { CacheItem *page_cache; size_t page_size; size_t max_num_items; size_t num_items; }; PageCache *cache_init(int64_t new_size, size_t page_size, Error **errp) { int64_t i; size_t num_pages = new_size / page_size; PageCache *cache; if (new_size < page_size) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "is smaller than one target page size"); return NULL; } /* round down to the nearest power of 2 */ if (!is_power_of_2(num_pages)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "is not a power of two number of pages"); return NULL; } /* We prefer not to abort if there is no memory */ cache = g_try_malloc(sizeof(*cache)); if (!cache) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "Failed to allocate cache"); return NULL; } cache->page_size = page_size; cache->num_items = 0; cache->max_num_items = num_pages; DPRINTF("Setting cache buckets to %" PRId64 "\n", cache->max_num_items); /* We prefer not to abort if there is no memory */ cache->page_cache = g_try_malloc((cache->max_num_items) * sizeof(*cache->page_cache)); if (!cache->page_cache) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "Failed to allocate page cache"); g_free(cache); return NULL; } for (i = 0; i < cache->max_num_items; i++) { cache->page_cache[i].it_data = NULL; cache->page_cache[i].it_age = 0; cache->page_cache[i].it_addr = -1; } return cache; } void cache_fini(PageCache *cache) { int64_t i; g_assert(cache); g_assert(cache->page_cache); for (i = 0; i < cache->max_num_items; i++) { g_free(cache->page_cache[i].it_data); } g_free(cache->page_cache); cache->page_cache = NULL; g_free(cache); } static size_t cache_get_cache_pos(const PageCache *cache, uint64_t address) { g_assert(cache->max_num_items); return (address / cache->page_size) & (cache->max_num_items - 1); } static CacheItem *cache_get_by_addr(const PageCache *cache, uint64_t addr) { size_t pos; g_assert(cache); g_assert(cache->page_cache); pos = cache_get_cache_pos(cache, addr); return &cache->page_cache[pos]; } uint8_t *get_cached_data(const PageCache *cache, uint64_t addr) { return cache_get_by_addr(cache, addr)->it_data; } bool cache_is_cached(const PageCache *cache, uint64_t addr, uint64_t current_age) { CacheItem *it; it = cache_get_by_addr(cache, addr); if (it->it_addr == addr) { /* update the it_age when the cache hit */ it->it_age = current_age; return true; } return false; } int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata, uint64_t current_age) { CacheItem *it; /* actual update of entry */ it = cache_get_by_addr(cache, addr); if (it->it_data && it->it_addr != addr && it->it_age + CACHED_PAGE_LIFETIME > current_age) { /* the cache page is fresh, don't replace it */ return -1; } /* allocate page */ if (!it->it_data) { it->it_data = g_try_malloc(cache->page_size); if (!it->it_data) { DPRINTF("Error allocating page\n"); return -1; } cache->num_items++; } memcpy(it->it_data, pdata, cache->page_size); it->it_age = current_age; it->it_addr = addr; return 0; }
dslutz/qemu
migration/page_cache.c
C
gpl-2.0
4,555
var class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure = [ [ "GetInventoryAccountIdProcedure", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#a346f026be35152cad36078d0d03b8650", null ], [ "GetInventoryAccountIdProcedure", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#aab6b7e0edfb421bdcddea8df19305302", null ], [ "Execute", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#a0b82a889d67da2a13298239ca9d8c10e", null ], [ "ObjectName", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#a19473ddd383eceffe66b8346fee9e9b8", null ], [ "ObjectNamespace", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#ac8a82a74c80aca9f3e7733f9c2e5733b", null ], [ "_LoginId", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#adbbd19bdfbc09cb9c661736f039b4890", null ], [ "_UserId", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#aafb8c5f4dec1517c42b8a3b24b34dfaf", null ], [ "Catalog", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#a804687413651a975784d8a36c617465b", null ], [ "ItemId", "class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.html#a1d12b0db9c6f62ed7008dcbb1ac6b534", null ] ];
mixerp6/mixerp
docs/api/class_mix_e_r_p_1_1_net_1_1_schemas_1_1_core_1_1_data_1_1_get_inventory_account_id_procedure.js
JavaScript
gpl-2.0
1,599
using System; using Server.Items; namespace Server.Mobiles { [CorpseName( "a sentinel spider corpse" )] public class SentinelSpider : BaseCreature { [Constructable] public SentinelSpider() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) { Name = "a Sentinel spider"; Body = 20; Hue = 2949; BaseSoundID = 0x388; SetStr( 95, 100 ); SetDex( 140, 145 ); SetInt( 40, 45 ); SetHits( 260, 265 ); SetDamage( 15, 22 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 45, 50 ); SetResistance( ResistanceType.Fire, 30, 35 ); SetResistance( ResistanceType.Cold, 30, 35 ); SetResistance( ResistanceType.Poison, 70, 75 ); SetResistance( ResistanceType.Energy, 30, 35 ); SetSkill( SkillName.Anatomy, 85.0, 90.0 ); SetSkill( SkillName.MagicResist, 88.5, 90.0 ); SetSkill( SkillName.Tactics, 102.9, 105.0 ); SetSkill( SkillName.Wrestling, 119.1, 120.0 ); SetSkill( SkillName.Poisoning, 101.0, 102.0 ); Fame = 775; Karma = -775; VirtualArmor = 28; Tamable = true; ControlSlots = 3; MinTameSkill = 74.7; //PackItem( new SpidersSilk( 7 ) ); } public override void GenerateLoot() { AddLoot( LootPack.Meager ); AddLoot( LootPack.Poor ); } public override FoodType FavoriteFood{ get{ return FoodType.Meat; } } public override PackInstinct PackInstinct{ get{ return PackInstinct.Arachnid; } } public override WeaponAbility GetWeaponAbility() { return WeaponAbility.ArmorIgnore; } public SentinelSpider( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); if ( BaseSoundID == 387 ) BaseSoundID = 0x388; } } }
mithril52/Comraich
Scripts/Mobiles/Normal/SentinelSpider.cs
C#
gpl-2.0
1,981
/* * domain_event.h: domain event queue processing helpers * * Copyright (C) 2012-2014 Red Hat, Inc. * Copyright (C) 2008 VirtualIron * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. * * Author: Ben Guthro */ #include "internal.h" #ifndef __DOMAIN_EVENT_H__ # define __DOMAIN_EVENT_H__ # include "object_event.h" # include "domain_conf.h" virObjectEventPtr virDomainEventLifecycleNew(int id, const char *name, const unsigned char *uuid, int type, int detail); virObjectEventPtr virDomainEventLifecycleNewFromDom(virDomainPtr dom, int type, int detail); virObjectEventPtr virDomainEventLifecycleNewFromObj(virDomainObjPtr obj, int type, int detail); virObjectEventPtr virDomainEventLifecycleNewFromDef(virDomainDefPtr def, int type, int detail); virObjectEventPtr virDomainEventRebootNew(int id, const char *name, const unsigned char *uuid); virObjectEventPtr virDomainEventRebootNewFromDom(virDomainPtr dom); virObjectEventPtr virDomainEventRebootNewFromObj(virDomainObjPtr obj); virObjectEventPtr virDomainEventRTCChangeNewFromDom(virDomainPtr dom, long long offset); virObjectEventPtr virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj, long long offset); virObjectEventPtr virDomainEventWatchdogNewFromDom(virDomainPtr dom, int action); virObjectEventPtr virDomainEventWatchdogNewFromObj(virDomainObjPtr obj, int action); virObjectEventPtr virDomainEventIOErrorNewFromDom(virDomainPtr dom, const char *srcPath, const char *devAlias, int action); virObjectEventPtr virDomainEventIOErrorNewFromObj(virDomainObjPtr obj, const char *srcPath, const char *devAlias, int action); virObjectEventPtr virDomainEventIOErrorReasonNewFromDom(virDomainPtr dom, const char *srcPath, const char *devAlias, int action, const char *reason); virObjectEventPtr virDomainEventIOErrorReasonNewFromObj(virDomainObjPtr obj, const char *srcPath, const char *devAlias, int action, const char *reason); virObjectEventPtr virDomainEventGraphicsNewFromDom(virDomainPtr dom, int phase, virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr remote, const char *authScheme, virDomainEventGraphicsSubjectPtr subject); virObjectEventPtr virDomainEventGraphicsNewFromObj(virDomainObjPtr obj, int phase, virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr remote, const char *authScheme, virDomainEventGraphicsSubjectPtr subject); virObjectEventPtr virDomainEventControlErrorNewFromDom(virDomainPtr dom); virObjectEventPtr virDomainEventControlErrorNewFromObj(virDomainObjPtr obj); virObjectEventPtr virDomainEventBlockJobNewFromObj(virDomainObjPtr obj, const char *path, int type, int status); virObjectEventPtr virDomainEventBlockJobNewFromDom(virDomainPtr dom, const char *path, int type, int status); virObjectEventPtr virDomainEventBlockJob2NewFromObj(virDomainObjPtr obj, const char *dst, int type, int status); virObjectEventPtr virDomainEventBlockJob2NewFromDom(virDomainPtr dom, const char *dst, int type, int status); virObjectEventPtr virDomainEventDiskChangeNewFromObj(virDomainObjPtr obj, const char *oldSrcPath, const char *newSrcPath, const char *devAlias, int reason); virObjectEventPtr virDomainEventDiskChangeNewFromDom(virDomainPtr dom, const char *oldSrcPath, const char *newSrcPath, const char *devAlias, int reason); virObjectEventPtr virDomainEventTrayChangeNewFromObj(virDomainObjPtr obj, const char *devAlias, int reason); virObjectEventPtr virDomainEventTrayChangeNewFromDom(virDomainPtr dom, const char *devAlias, int reason); virObjectEventPtr virDomainEventPMWakeupNewFromObj(virDomainObjPtr obj); virObjectEventPtr virDomainEventPMWakeupNewFromDom(virDomainPtr dom, int reason); virObjectEventPtr virDomainEventPMSuspendNewFromObj(virDomainObjPtr obj); virObjectEventPtr virDomainEventPMSuspendNewFromDom(virDomainPtr dom, int reason); virObjectEventPtr virDomainEventBalloonChangeNewFromDom(virDomainPtr dom, unsigned long long actual); virObjectEventPtr virDomainEventBalloonChangeNewFromObj(virDomainObjPtr obj, unsigned long long actual); virObjectEventPtr virDomainEventPMSuspendDiskNewFromObj(virDomainObjPtr obj); virObjectEventPtr virDomainEventPMSuspendDiskNewFromDom(virDomainPtr dom, int reason); virObjectEventPtr virDomainEventDeviceRemovedNewFromObj(virDomainObjPtr obj, const char *devAlias); virObjectEventPtr virDomainEventDeviceRemovedNewFromDom(virDomainPtr dom, const char *devAlias); virObjectEventPtr virDomainEventDeviceAddedNewFromObj(virDomainObjPtr obj, const char *devAlias); virObjectEventPtr virDomainEventDeviceAddedNewFromDom(virDomainPtr dom, const char *devAlias); virObjectEventPtr virDomainEventTunableNewFromObj(virDomainObjPtr obj, virTypedParameterPtr params, int nparams); virObjectEventPtr virDomainEventTunableNewFromDom(virDomainPtr dom, virTypedParameterPtr params, int nparams); virObjectEventPtr virDomainEventAgentLifecycleNewFromObj(virDomainObjPtr obj, int state, int reason); virObjectEventPtr virDomainEventAgentLifecycleNewFromDom(virDomainPtr dom, int state, int reason); int virDomainEventStateRegister(virConnectPtr conn, virObjectEventStatePtr state, virConnectDomainEventCallback callback, void *opaque, virFreeCallback freecb) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virDomainEventStateRegisterID(virConnectPtr conn, virObjectEventStatePtr state, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback cb, void *opaque, virFreeCallback freecb, int *callbackID) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5); int virDomainEventStateRegisterClient(virConnectPtr conn, virObjectEventStatePtr state, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback cb, void *opaque, virFreeCallback freecb, bool legacy, int *callbackID, bool remoteID) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(9); int virDomainEventStateCallbackID(virConnectPtr conn, virObjectEventStatePtr state, virConnectDomainEventCallback callback, int *remoteID) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); int virDomainEventStateDeregister(virConnectPtr conn, virObjectEventStatePtr state, virConnectDomainEventCallback callback) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn, virObjectEventStatePtr state, virDomainPtr dom, const char *event, virConnectDomainQemuMonitorEventCallback cb, void *opaque, virFreeCallback freecb, unsigned int flags, int *callbackID) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(9); virObjectEventPtr virDomainQemuMonitorEventNew(int id, const char *name, const unsigned char *uuid, const char *event, long long seconds, unsigned int micros, const char *details) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); #endif
huzhengchuan/libvirt
src/conf/domain_event.h
C
gpl-2.0
11,481
#line 1 "rx-decode.opc" /* -*- c -*- */ /* Copyright (C) 2012-2016 Free Software Foundation, Inc. Contributed by Red Hat. Written by DJ Delorie. This file is part of the GNU opcodes library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sysdep.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "ansidecl.h" #include "opcode/rx.h" #define RX_OPCODE_BIG_ENDIAN 0 typedef struct { RX_Opcode_Decoded * rx; int (* getbyte)(void *); void * ptr; unsigned char * op; } LocalData; static int trace = 0; #define BSIZE 0 #define WSIZE 1 #define LSIZE 2 /* These are for when the upper bits are "don't care" or "undefined". */ static int bwl[] = { RX_Byte, RX_Word, RX_Long, RX_Bad_Size /* Bogus instructions can have a size field set to 3. */ }; static int sbwl[] = { RX_SByte, RX_SWord, RX_Long, RX_Bad_Size /* Bogus instructions can have a size field set to 3. */ }; static int ubw[] = { RX_UByte, RX_UWord, RX_Bad_Size,/* Bogus instructions can have a size field set to 2. */ RX_Bad_Size /* Bogus instructions can have a size field set to 3. */ }; static int memex[] = { RX_SByte, RX_SWord, RX_Long, RX_UWord }; #define ID(x) rx->id = RXO_##x #define OP(n,t,r,a) (rx->op[n].type = t, \ rx->op[n].reg = r, \ rx->op[n].addend = a ) #define OPs(n,t,r,a,s) (OP (n,t,r,a), \ rx->op[n].size = s ) /* This is for the BWL and BW bitfields. */ static int SCALE[] = { 1, 2, 4, 0 }; /* This is for the prefix size enum. */ static int PSCALE[] = { 4, 1, 1, 1, 2, 2, 2, 3, 4 }; static int flagmap[] = {0, 1, 2, 3, 0, 0, 0, 0, 16, 17, 0, 0, 0, 0, 0, 0 }; static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 }; /* *C a constant (immediate) c *R A register *I Register indirect, no offset *Is Register indirect, with offset *D standard displacement: type (r,[r],dsp8,dsp16 code), register, BWL code *P standard displacement: type (r,[r]), reg, assumes UByte *Pm memex displacement: type (r,[r]), reg, memex code *cc condition code. */ #define DC(c) OP (0, RX_Operand_Immediate, 0, c) #define DR(r) OP (0, RX_Operand_Register, r, 0) #define DI(r,a) OP (0, RX_Operand_Indirect, r, a) #define DIs(r,a,s) OP (0, RX_Operand_Indirect, r, (a) * SCALE[s]) #define DD(t,r,s) rx_disp (0, t, r, bwl[s], ld); #define DF(r) OP (0, RX_Operand_Flag, flagmap[r], 0) #define SC(i) OP (1, RX_Operand_Immediate, 0, i) #define SR(r) OP (1, RX_Operand_Register, r, 0) #define SRR(r) OP (1, RX_Operand_TwoReg, r, 0) #define SI(r,a) OP (1, RX_Operand_Indirect, r, a) #define SIs(r,a,s) OP (1, RX_Operand_Indirect, r, (a) * SCALE[s]) #define SD(t,r,s) rx_disp (1, t, r, bwl[s], ld); #define SP(t,r) rx_disp (1, t, r, (t!=3) ? RX_UByte : RX_Long, ld); P(t, 1); #define SPm(t,r,m) rx_disp (1, t, r, memex[m], ld); rx->op[1].size = memex[m]; #define Scc(cc) OP (1, RX_Operand_Condition, cc, 0) #define S2C(i) OP (2, RX_Operand_Immediate, 0, i) #define S2R(r) OP (2, RX_Operand_Register, r, 0) #define S2I(r,a) OP (2, RX_Operand_Indirect, r, a) #define S2Is(r,a,s) OP (2, RX_Operand_Indirect, r, (a) * SCALE[s]) #define S2D(t,r,s) rx_disp (2, t, r, bwl[s], ld); #define S2P(t,r) rx_disp (2, t, r, (t!=3) ? RX_UByte : RX_Long, ld); P(t, 2); #define S2Pm(t,r,m) rx_disp (2, t, r, memex[m], ld); rx->op[2].size = memex[m]; #define S2cc(cc) OP (2, RX_Operand_Condition, cc, 0) #define BWL(sz) rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = bwl[sz] #define sBWL(sz) rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = sbwl[sz] #define uBW(sz) rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = ubw[sz] #define P(t, n) rx->op[n].size = (t!=3) ? RX_UByte : RX_Long; #define F(f) store_flags(rx, f) #define AU ATTRIBUTE_UNUSED #define GETBYTE() (ld->op [ld->rx->n_bytes++] = ld->getbyte (ld->ptr)) #define SYNTAX(x) rx->syntax = x #define UNSUPPORTED() \ rx->syntax = "*unknown*" #define IMM(sf) immediate (sf, 0, ld) #define IMMex(sf) immediate (sf, 1, ld) static int immediate (int sfield, int ex, LocalData * ld) { unsigned long i = 0, j; switch (sfield) { #define B ((unsigned long) GETBYTE()) case 0: #if RX_OPCODE_BIG_ENDIAN i = B; if (ex && (i & 0x80)) i -= 0x100; i <<= 24; i |= B << 16; i |= B << 8; i |= B; #else i = B; i |= B << 8; i |= B << 16; j = B; if (ex && (j & 0x80)) j -= 0x100; i |= j << 24; #endif break; case 3: #if RX_OPCODE_BIG_ENDIAN i = B << 16; i |= B << 8; i |= B; #else i = B; i |= B << 8; i |= B << 16; #endif if (ex && (i & 0x800000)) i -= 0x1000000; break; case 2: #if RX_OPCODE_BIG_ENDIAN i |= B << 8; i |= B; #else i |= B; i |= B << 8; #endif if (ex && (i & 0x8000)) i -= 0x10000; break; case 1: i |= B; if (ex && (i & 0x80)) i -= 0x100; break; default: abort(); } return i; } static void rx_disp (int n, int type, int reg, int size, LocalData * ld) { int disp; ld->rx->op[n].reg = reg; switch (type) { case 3: ld->rx->op[n].type = RX_Operand_Register; break; case 0: ld->rx->op[n].type = RX_Operand_Zero_Indirect; ld->rx->op[n].addend = 0; break; case 1: ld->rx->op[n].type = RX_Operand_Indirect; disp = GETBYTE (); ld->rx->op[n].addend = disp * PSCALE[size]; break; case 2: ld->rx->op[n].type = RX_Operand_Indirect; disp = GETBYTE (); #if RX_OPCODE_BIG_ENDIAN disp = disp * 256 + GETBYTE (); #else disp = disp + GETBYTE () * 256; #endif ld->rx->op[n].addend = disp * PSCALE[size]; break; default: abort (); } } #define xO 8 #define xS 4 #define xZ 2 #define xC 1 #define F_____ #define F___ZC rx->flags_0 = rx->flags_s = xZ|xC; #define F__SZ_ rx->flags_0 = rx->flags_s = xS|xZ; #define F__SZC rx->flags_0 = rx->flags_s = xS|xZ|xC; #define F_0SZC rx->flags_0 = xO|xS|xZ|xC; rx->flags_s = xS|xZ|xC; #define F_O___ rx->flags_0 = rx->flags_s = xO; #define F_OS__ rx->flags_0 = rx->flags_s = xO|xS; #define F_OSZ_ rx->flags_0 = rx->flags_s = xO|xS|xZ; #define F_OSZC rx->flags_0 = rx->flags_s = xO|xS|xZ|xC; int rx_decode_opcode (unsigned long pc AU, RX_Opcode_Decoded * rx, int (* getbyte)(void *), void * ptr) { LocalData lds, * ld = &lds; unsigned char op[20] = {0}; lds.rx = rx; lds.getbyte = getbyte; lds.ptr = ptr; lds.op = op; memset (rx, 0, sizeof (*rx)); BWL(LSIZE); /*----------------------------------------------------------------------*/ /* MOV */ GETBYTE (); switch (op[0] & 0xff) { case 0x00: { /** 0000 0000 brk */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 0000 brk */", op[0]); } SYNTAX("brk"); #line 1025 "rx-decode.opc" ID(brk); } break; case 0x01: { /** 0000 0001 dbt */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 0001 dbt */", op[0]); } SYNTAX("dbt"); #line 1028 "rx-decode.opc" ID(dbt); } break; case 0x02: { /** 0000 0010 rts */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 0010 rts */", op[0]); } SYNTAX("rts"); #line 806 "rx-decode.opc" ID(rts); /*----------------------------------------------------------------------*/ /* NOP */ } break; case 0x03: { /** 0000 0011 nop */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 0011 nop */", op[0]); } SYNTAX("nop"); #line 812 "rx-decode.opc" ID(nop); /*----------------------------------------------------------------------*/ /* STRING FUNCTIONS */ } break; case 0x04: { /** 0000 0100 bra.a %a0 */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 0100 bra.a %a0 */", op[0]); } SYNTAX("bra.a %a0"); #line 784 "rx-decode.opc" ID(branch); DC(pc + IMMex(3)); } break; case 0x05: { /** 0000 0101 bsr.a %a0 */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 0101 bsr.a %a0 */", op[0]); } SYNTAX("bsr.a %a0"); #line 800 "rx-decode.opc" ID(jsr); DC(pc + IMMex(3)); } break; case 0x06: GETBYTE (); switch (op[1] & 0xff) { case 0x00: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_1: { /** 0000 0110 mx00 00ss rsrc rdst sub %2%S2, %1 */ #line 542 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 542 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 542 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 542 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0000 0110 mx00 00ss rsrc rdst sub %2%S2, %1 */", op[0], op[1], op[2]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("sub %2%S2, %1"); #line 542 "rx-decode.opc" ID(sub); S2Pm(ss, rsrc, mx); SR(rdst); DR(rdst); F_OSZC; } break; } break; case 0x01: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x02: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x03: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x04: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_2: { /** 0000 0110 mx00 01ss rsrc rdst cmp %2%S2, %1 */ #line 530 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 530 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 530 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 530 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0000 0110 mx00 01ss rsrc rdst cmp %2%S2, %1 */", op[0], op[1], op[2]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("cmp %2%S2, %1"); #line 530 "rx-decode.opc" ID(sub); S2Pm(ss, rsrc, mx); SR(rdst); F_OSZC; /*----------------------------------------------------------------------*/ /* SUB */ } break; } break; case 0x05: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x06: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x07: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x08: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_3: { /** 0000 0110 mx00 10ss rsrc rdst add %1%S1, %0 */ #line 506 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 506 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 506 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 506 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0000 0110 mx00 10ss rsrc rdst add %1%S1, %0 */", op[0], op[1], op[2]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("add %1%S1, %0"); #line 506 "rx-decode.opc" ID(add); SPm(ss, rsrc, mx); DR(rdst); F_OSZC; } break; } break; case 0x09: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x0a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x0b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x0c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_4: { /** 0000 0110 mx00 11ss rsrc rdst mul %1%S1, %0 */ #line 649 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 649 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 649 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 649 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0000 0110 mx00 11ss rsrc rdst mul %1%S1, %0 */", op[0], op[1], op[2]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mul %1%S1, %0"); #line 649 "rx-decode.opc" ID(mul); SPm(ss, rsrc, mx); DR(rdst); F_____; } break; } break; case 0x0d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x0e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x0f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x10: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_5: { /** 0000 0110 mx01 00ss rsrc rdst and %1%S1, %0 */ #line 419 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 419 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 419 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 419 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0000 0110 mx01 00ss rsrc rdst and %1%S1, %0 */", op[0], op[1], op[2]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("and %1%S1, %0"); #line 419 "rx-decode.opc" ID(and); SPm(ss, rsrc, mx); DR(rdst); F__SZ_; } break; } break; case 0x11: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x12: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x13: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x14: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_6: { /** 0000 0110 mx01 01ss rsrc rdst or %1%S1, %0 */ #line 437 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 437 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 437 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 437 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0000 0110 mx01 01ss rsrc rdst or %1%S1, %0 */", op[0], op[1], op[2]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("or %1%S1, %0"); #line 437 "rx-decode.opc" ID(or); SPm(ss, rsrc, mx); DR(rdst); F__SZ_; } break; } break; case 0x15: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x16: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x17: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x20: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_7: { /** 0000 0110 mx10 00sp 0000 0000 rsrc rdst sbb %1%S1, %0 */ #line 555 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 555 "rx-decode.opc" int sp AU = op[1] & 0x03; #line 555 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 555 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00sp 0000 0000 rsrc rdst sbb %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" sp = 0x%x,", sp); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("sbb %1%S1, %0"); #line 555 "rx-decode.opc" ID(sbb); SPm(sp, rsrc, mx); DR(rdst); F_OSZC; /*----------------------------------------------------------------------*/ /* ABS */ } break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_8: { /** 0000 0110 mx10 00ss 0000 0100 rsrc rdst max %1%S1, %0 */ #line 594 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 594 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 594 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 594 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 0100 rsrc rdst max %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("max %1%S1, %0"); #line 594 "rx-decode.opc" ID(max); SPm(ss, rsrc, mx); DR(rdst); /*----------------------------------------------------------------------*/ /* MIN */ } break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_9: { /** 0000 0110 mx10 00ss 0000 0101 rsrc rdst min %1%S1, %0 */ #line 606 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 606 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 606 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 606 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 0101 rsrc rdst min %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("min %1%S1, %0"); #line 606 "rx-decode.opc" ID(min); SPm(ss, rsrc, mx); DR(rdst); /*----------------------------------------------------------------------*/ /* MUL */ } break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_10: { /** 0000 0110 mx10 00ss 0000 0110 rsrc rdst emul %1%S1, %0 */ #line 664 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 664 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 664 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 664 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 0110 rsrc rdst emul %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("emul %1%S1, %0"); #line 664 "rx-decode.opc" ID(emul); SPm(ss, rsrc, mx); DR(rdst); /*----------------------------------------------------------------------*/ /* EMULU */ } break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_11: { /** 0000 0110 mx10 00ss 0000 0111 rsrc rdst emulu %1%S1, %0 */ #line 676 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 676 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 676 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 676 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 0111 rsrc rdst emulu %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("emulu %1%S1, %0"); #line 676 "rx-decode.opc" ID(emulu); SPm(ss, rsrc, mx); DR(rdst); /*----------------------------------------------------------------------*/ /* DIV */ } break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_12: { /** 0000 0110 mx10 00ss 0000 1000 rsrc rdst div %1%S1, %0 */ #line 688 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 688 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 688 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 688 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 1000 rsrc rdst div %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("div %1%S1, %0"); #line 688 "rx-decode.opc" ID(div); SPm(ss, rsrc, mx); DR(rdst); F_O___; /*----------------------------------------------------------------------*/ /* DIVU */ } break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_13: { /** 0000 0110 mx10 00ss 0000 1001 rsrc rdst divu %1%S1, %0 */ #line 700 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 700 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 700 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 700 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 1001 rsrc rdst divu %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("divu %1%S1, %0"); #line 700 "rx-decode.opc" ID(divu); SPm(ss, rsrc, mx); DR(rdst); F_O___; /*----------------------------------------------------------------------*/ /* SHIFT */ } break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_14: { /** 0000 0110 mx10 00ss 0000 1100 rsrc rdst tst %1%S1, %2 */ #line 473 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 473 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 473 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 473 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 1100 rsrc rdst tst %1%S1, %2 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("tst %1%S1, %2"); #line 473 "rx-decode.opc" ID(and); SPm(ss, rsrc, mx); S2R(rdst); F__SZ_; /*----------------------------------------------------------------------*/ /* NEG */ } break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_15: { /** 0000 0110 mx10 00ss 0000 1101 rsrc rdst xor %1%S1, %0 */ #line 452 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 452 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 452 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 452 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0000 1101 rsrc rdst xor %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("xor %1%S1, %0"); #line 452 "rx-decode.opc" ID(xor); SPm(ss, rsrc, mx); DR(rdst); F__SZ_; /*----------------------------------------------------------------------*/ /* NOT */ } break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_16: { /** 0000 0110 mx10 00ss 0001 0000 rsrc rdst xchg %1%S1, %0 */ #line 386 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 386 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 386 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 386 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00ss 0001 0000 rsrc rdst xchg %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("xchg %1%S1, %0"); #line 386 "rx-decode.opc" ID(xchg); DR(rdst); SPm(ss, rsrc, mx); /*----------------------------------------------------------------------*/ /* STZ/STNZ */ } break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_17: { /** 0000 0110 mx10 00sd 0001 0001 rsrc rdst itof %1%S1, %0 */ #line 929 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 929 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 929 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 929 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00sd 0001 0001 rsrc rdst itof %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("itof %1%S1, %0"); #line 929 "rx-decode.opc" ID(itof); DR (rdst); SPm(sd, rsrc, mx); F__SZ_; /*----------------------------------------------------------------------*/ /* BIT OPS */ } break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_18: { /** 0000 0110 mx10 00sd 0001 0101 rsrc rdst utof %1%S1, %0 */ #line 1115 "rx-decode.opc" int mx AU = (op[1] >> 6) & 0x03; #line 1115 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 1115 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 1115 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 mx10 00sd 0001 0101 rsrc rdst utof %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" mx = 0x%x,", mx); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("utof %1%S1, %0"); #line 1115 "rx-decode.opc" ID(utof); DR (rdst); SPm(sd, rsrc, mx); F__SZ_; } break; } break; default: UNSUPPORTED(); break; } break; case 0x21: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x22: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x23: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x40: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x41: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x42: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x43: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x44: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x45: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x46: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x47: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x48: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x49: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x4a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x4b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x4c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x4d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x4e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x4f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x50: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x51: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x52: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x53: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x54: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x55: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x56: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x57: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x60: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x61: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x62: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x63: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0x80: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x81: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x82: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x83: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0x84: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x85: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x86: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x87: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0x88: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x89: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x8a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x8b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0x8c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x8d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x8e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x8f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0x90: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x91: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x92: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x93: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0x94: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x95: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x96: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0x97: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0xa0: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x02: GETBYTE (); switch (op[3] & 0x00) { case 0x00: op_semantics_19: { /** 0000 0110 1010 00ss 0000 0010 rsrc rdst adc %1%S1, %0 */ #line 494 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 494 "rx-decode.opc" int rsrc AU = (op[3] >> 4) & 0x0f; #line 494 "rx-decode.opc" int rdst AU = op[3] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x %02x\n", "/** 0000 0110 1010 00ss 0000 0010 rsrc rdst adc %1%S1, %0 */", op[0], op[1], op[2], op[3]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("adc %1%S1, %0"); #line 494 "rx-decode.opc" ID(adc); SPm(ss, rsrc, 2); DR(rdst); F_OSZC; /*----------------------------------------------------------------------*/ /* ADD */ } break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xa1: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x02: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_19; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xa2: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x02: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_19; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xa3: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x02: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_19; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xc0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0xc1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0xc2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0xc3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_1; break; } break; case 0xc4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0xc5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0xc6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0xc7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_2; break; } break; case 0xc8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0xc9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0xca: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0xcb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_3; break; } break; case 0xcc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0xcd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0xce: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0xcf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_4; break; } break; case 0xd0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0xd1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0xd2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0xd3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_5; break; } break; case 0xd4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0xd5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0xd6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0xd7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_6; break; } break; case 0xe0: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xe1: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xe2: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; case 0xe3: GETBYTE (); switch (op[2] & 0xff) { case 0x00: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_7; break; } break; case 0x04: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_8; break; } break; case 0x05: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_9; break; } break; case 0x06: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_10; break; } break; case 0x07: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_11; break; } break; case 0x08: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_12; break; } break; case 0x09: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_13; break; } break; case 0x0c: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_14; break; } break; case 0x0d: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_15; break; } break; case 0x10: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_16; break; } break; case 0x11: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_17; break; } break; case 0x15: GETBYTE (); switch (op[3] & 0x00) { case 0x00: goto op_semantics_18; break; } break; default: UNSUPPORTED(); break; } break; default: UNSUPPORTED(); break; } break; case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: { /** 0000 1dsp bra.s %a0 */ #line 775 "rx-decode.opc" int dsp AU = op[0] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0000 1dsp bra.s %a0 */", op[0]); printf (" dsp = 0x%x\n", dsp); } SYNTAX("bra.s %a0"); #line 775 "rx-decode.opc" ID(branch); DC(pc + dsp3map[dsp]); } break; case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: { /** 0001 n dsp b%1.s %a0 */ #line 765 "rx-decode.opc" int n AU = (op[0] >> 3) & 0x01; #line 765 "rx-decode.opc" int dsp AU = op[0] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0001 n dsp b%1.s %a0 */", op[0]); printf (" n = 0x%x,", n); printf (" dsp = 0x%x\n", dsp); } SYNTAX("b%1.s %a0"); #line 765 "rx-decode.opc" ID(branch); Scc(n); DC(pc + dsp3map[dsp]); } break; case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2f: { /** 0010 cond b%1.b %a0 */ #line 768 "rx-decode.opc" int cond AU = op[0] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0010 cond b%1.b %a0 */", op[0]); printf (" cond = 0x%x\n", cond); } SYNTAX("b%1.b %a0"); #line 768 "rx-decode.opc" ID(branch); Scc(cond); DC(pc + IMMex (1)); } break; case 0x2e: { /** 0010 1110 bra.b %a0 */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0010 1110 bra.b %a0 */", op[0]); } SYNTAX("bra.b %a0"); #line 778 "rx-decode.opc" ID(branch); DC(pc + IMMex(1)); } break; case 0x38: { /** 0011 1000 bra.w %a0 */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0011 1000 bra.w %a0 */", op[0]); } SYNTAX("bra.w %a0"); #line 781 "rx-decode.opc" ID(branch); DC(pc + IMMex(2)); } break; case 0x39: { /** 0011 1001 bsr.w %a0 */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0011 1001 bsr.w %a0 */", op[0]); } SYNTAX("bsr.w %a0"); #line 797 "rx-decode.opc" ID(jsr); DC(pc + IMMex(2)); } break; case 0x3a: case 0x3b: { /** 0011 101c b%1.w %a0 */ #line 771 "rx-decode.opc" int c AU = op[0] & 0x01; if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0011 101c b%1.w %a0 */", op[0]); printf (" c = 0x%x\n", c); } SYNTAX("b%1.w %a0"); #line 771 "rx-decode.opc" ID(branch); Scc(c); DC(pc + IMMex (2)); } break; case 0x3c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_20: { /** 0011 11sz d dst sppp mov%s #%1, %0 */ #line 307 "rx-decode.opc" int sz AU = op[0] & 0x03; #line 307 "rx-decode.opc" int d AU = (op[1] >> 7) & 0x01; #line 307 "rx-decode.opc" int dst AU = (op[1] >> 4) & 0x07; #line 307 "rx-decode.opc" int sppp AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0011 11sz d dst sppp mov%s #%1, %0 */", op[0], op[1]); printf (" sz = 0x%x,", sz); printf (" d = 0x%x,", d); printf (" dst = 0x%x,", dst); printf (" sppp = 0x%x\n", sppp); } SYNTAX("mov%s #%1, %0"); #line 307 "rx-decode.opc" ID(mov); sBWL (sz); DIs(dst, d*16+sppp, sz); SC(IMM(1)); F_____; } break; } break; case 0x3d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_20; break; } break; case 0x3e: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_20; break; } break; case 0x3f: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0011 1111 rega regb rtsd #%1, %2-%0 */ #line 404 "rx-decode.opc" int rega AU = (op[1] >> 4) & 0x0f; #line 404 "rx-decode.opc" int regb AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0011 1111 rega regb rtsd #%1, %2-%0 */", op[0], op[1]); printf (" rega = 0x%x,", rega); printf (" regb = 0x%x\n", regb); } SYNTAX("rtsd #%1, %2-%0"); #line 404 "rx-decode.opc" ID(rtsd); SC(IMM(1) * 4); S2R(rega); DR(regb); /*----------------------------------------------------------------------*/ /* AND */ } break; } break; case 0x40: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_21: { /** 0100 00ss rsrc rdst sub %2%S2, %1 */ #line 539 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 539 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 539 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0100 00ss rsrc rdst sub %2%S2, %1 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("sub %2%S2, %1"); #line 539 "rx-decode.opc" ID(sub); S2P(ss, rsrc); SR(rdst); DR(rdst); F_OSZC; } break; } break; case 0x41: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_21; break; } break; case 0x42: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_21; break; } break; case 0x43: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_21; break; } break; case 0x44: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_22: { /** 0100 01ss rsrc rdst cmp %2%S2, %1 */ #line 527 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 527 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 527 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0100 01ss rsrc rdst cmp %2%S2, %1 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("cmp %2%S2, %1"); #line 527 "rx-decode.opc" ID(sub); S2P(ss, rsrc); SR(rdst); F_OSZC; } break; } break; case 0x45: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_22; break; } break; case 0x46: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_22; break; } break; case 0x47: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_22; break; } break; case 0x48: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_23: { /** 0100 10ss rsrc rdst add %1%S1, %0 */ #line 503 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 503 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 503 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0100 10ss rsrc rdst add %1%S1, %0 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("add %1%S1, %0"); #line 503 "rx-decode.opc" ID(add); SP(ss, rsrc); DR(rdst); F_OSZC; } break; } break; case 0x49: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_23; break; } break; case 0x4a: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_23; break; } break; case 0x4b: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_23; break; } break; case 0x4c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_24: { /** 0100 11ss rsrc rdst mul %1%S1, %0 */ #line 646 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 646 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 646 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0100 11ss rsrc rdst mul %1%S1, %0 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mul %1%S1, %0"); #line 646 "rx-decode.opc" ID(mul); SP(ss, rsrc); DR(rdst); F_____; } break; } break; case 0x4d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_24; break; } break; case 0x4e: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_24; break; } break; case 0x4f: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_24; break; } break; case 0x50: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_25: { /** 0101 00ss rsrc rdst and %1%S1, %0 */ #line 416 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 416 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 416 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0101 00ss rsrc rdst and %1%S1, %0 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("and %1%S1, %0"); #line 416 "rx-decode.opc" ID(and); SP(ss, rsrc); DR(rdst); F__SZ_; } break; } break; case 0x51: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_25; break; } break; case 0x52: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_25; break; } break; case 0x53: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_25; break; } break; case 0x54: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_26: { /** 0101 01ss rsrc rdst or %1%S1, %0 */ #line 434 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 434 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 434 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0101 01ss rsrc rdst or %1%S1, %0 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("or %1%S1, %0"); #line 434 "rx-decode.opc" ID(or); SP(ss, rsrc); DR(rdst); F__SZ_; } break; } break; case 0x55: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_26; break; } break; case 0x56: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_26; break; } break; case 0x57: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_26; break; } break; case 0x58: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_27: { /** 0101 1 s ss rsrc rdst movu%s %1, %0 */ #line 355 "rx-decode.opc" int s AU = (op[0] >> 2) & 0x01; #line 355 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 355 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 355 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0101 1 s ss rsrc rdst movu%s %1, %0 */", op[0], op[1]); printf (" s = 0x%x,", s); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("movu%s %1, %0"); #line 355 "rx-decode.opc" ID(mov); uBW(s); SD(ss, rsrc, s); DR(rdst); F_____; } break; } break; case 0x59: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x5a: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x5b: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x5c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x5d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x5e: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x5f: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_27; break; } break; case 0x60: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0000 immm rdst sub #%2, %0 */ #line 536 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 536 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0000 immm rdst sub #%2, %0 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("sub #%2, %0"); #line 536 "rx-decode.opc" ID(sub); S2C(immm); SR(rdst); DR(rdst); F_OSZC; } break; } break; case 0x61: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0001 immm rdst cmp #%2, %1 */ #line 518 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 518 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0001 immm rdst cmp #%2, %1 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("cmp #%2, %1"); #line 518 "rx-decode.opc" ID(sub); S2C(immm); SR(rdst); F_OSZC; } break; } break; case 0x62: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0010 immm rdst add #%1, %0 */ #line 500 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 500 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0010 immm rdst add #%1, %0 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("add #%1, %0"); #line 500 "rx-decode.opc" ID(add); SC(immm); DR(rdst); F_OSZC; } break; } break; case 0x63: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0011 immm rdst mul #%1, %0 */ #line 612 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 612 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0011 immm rdst mul #%1, %0 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mul #%1, %0"); #line 612 "rx-decode.opc" if (immm == 1 && rdst == 0) { ID(nop2); SYNTAX ("nop\t; mul\t#1, r0"); } else { ID(mul); } DR(rdst); SC(immm); F_____; } break; } break; case 0x64: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0100 immm rdst and #%1, %0 */ #line 410 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 410 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0100 immm rdst and #%1, %0 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("and #%1, %0"); #line 410 "rx-decode.opc" ID(and); SC(immm); DR(rdst); F__SZ_; } break; } break; case 0x65: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0101 immm rdst or #%1, %0 */ #line 428 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 428 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0101 immm rdst or #%1, %0 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("or #%1, %0"); #line 428 "rx-decode.opc" ID(or); SC(immm); DR(rdst); F__SZ_; } break; } break; case 0x66: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 0110 immm rdst mov%s #%1, %0 */ #line 304 "rx-decode.opc" int immm AU = (op[1] >> 4) & 0x0f; #line 304 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 0110 immm rdst mov%s #%1, %0 */", op[0], op[1]); printf (" immm = 0x%x,", immm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mov%s #%1, %0"); #line 304 "rx-decode.opc" ID(mov); DR(rdst); SC(immm); F_____; } break; } break; case 0x67: { /** 0110 0111 rtsd #%1 */ if (trace) { printf ("\033[33m%s\033[0m %02x\n", "/** 0110 0111 rtsd #%1 */", op[0]); } SYNTAX("rtsd #%1"); #line 401 "rx-decode.opc" ID(rtsd); SC(IMM(1) * 4); } break; case 0x68: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_28: { /** 0110 100i mmmm rdst shlr #%2, %0 */ #line 726 "rx-decode.opc" int i AU = op[0] & 0x01; #line 726 "rx-decode.opc" int mmmm AU = (op[1] >> 4) & 0x0f; #line 726 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 100i mmmm rdst shlr #%2, %0 */", op[0], op[1]); printf (" i = 0x%x,", i); printf (" mmmm = 0x%x,", mmmm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shlr #%2, %0"); #line 726 "rx-decode.opc" ID(shlr); S2C(i*16+mmmm); SR(rdst); DR(rdst); F__SZC; } break; } break; case 0x69: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_28; break; } break; case 0x6a: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_29: { /** 0110 101i mmmm rdst shar #%2, %0 */ #line 716 "rx-decode.opc" int i AU = op[0] & 0x01; #line 716 "rx-decode.opc" int mmmm AU = (op[1] >> 4) & 0x0f; #line 716 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 101i mmmm rdst shar #%2, %0 */", op[0], op[1]); printf (" i = 0x%x,", i); printf (" mmmm = 0x%x,", mmmm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shar #%2, %0"); #line 716 "rx-decode.opc" ID(shar); S2C(i*16+mmmm); SR(rdst); DR(rdst); F_0SZC; } break; } break; case 0x6b: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_29; break; } break; case 0x6c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_30: { /** 0110 110i mmmm rdst shll #%2, %0 */ #line 706 "rx-decode.opc" int i AU = op[0] & 0x01; #line 706 "rx-decode.opc" int mmmm AU = (op[1] >> 4) & 0x0f; #line 706 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 110i mmmm rdst shll #%2, %0 */", op[0], op[1]); printf (" i = 0x%x,", i); printf (" mmmm = 0x%x,", mmmm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shll #%2, %0"); #line 706 "rx-decode.opc" ID(shll); S2C(i*16+mmmm); SR(rdst); DR(rdst); F_OSZC; } break; } break; case 0x6d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_30; break; } break; case 0x6e: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 1110 dsta dstb pushm %1-%2 */ #line 368 "rx-decode.opc" int dsta AU = (op[1] >> 4) & 0x0f; #line 368 "rx-decode.opc" int dstb AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 1110 dsta dstb pushm %1-%2 */", op[0], op[1]); printf (" dsta = 0x%x,", dsta); printf (" dstb = 0x%x\n", dstb); } SYNTAX("pushm %1-%2"); #line 368 "rx-decode.opc" ID(pushm); SR(dsta); S2R(dstb); F_____; } break; } break; case 0x6f: GETBYTE (); switch (op[1] & 0x00) { case 0x00: { /** 0110 1111 dsta dstb popm %1-%2 */ #line 365 "rx-decode.opc" int dsta AU = (op[1] >> 4) & 0x0f; #line 365 "rx-decode.opc" int dstb AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0110 1111 dsta dstb popm %1-%2 */", op[0], op[1]); printf (" dsta = 0x%x,", dsta); printf (" dstb = 0x%x\n", dstb); } SYNTAX("popm %1-%2"); #line 365 "rx-decode.opc" ID(popm); SR(dsta); S2R(dstb); F_____; } break; } break; case 0x70: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_31: { /** 0111 00im rsrc rdst add #%1, %2, %0 */ #line 509 "rx-decode.opc" int im AU = op[0] & 0x03; #line 509 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 509 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 00im rsrc rdst add #%1, %2, %0 */", op[0], op[1]); printf (" im = 0x%x,", im); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("add #%1, %2, %0"); #line 509 "rx-decode.opc" ID(add); SC(IMMex(im)); S2R(rsrc); DR(rdst); F_OSZC; } break; } break; case 0x71: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_31; break; } break; case 0x72: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_31; break; } break; case 0x73: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_31; break; } break; case 0x74: GETBYTE (); switch (op[1] & 0xf0) { case 0x00: op_semantics_32: { /** 0111 01im 0000 rsrc cmp #%2, %1%S1 */ #line 521 "rx-decode.opc" int im AU = op[0] & 0x03; #line 521 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 01im 0000 rsrc cmp #%2, %1%S1 */", op[0], op[1]); printf (" im = 0x%x,", im); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("cmp #%2, %1%S1"); #line 521 "rx-decode.opc" ID(sub); SR(rsrc); S2C(IMMex(im)); F_OSZC; } break; case 0x10: op_semantics_33: { /** 0111 01im 0001rdst mul #%1, %0 */ #line 624 "rx-decode.opc" int im AU = op[0] & 0x03; #line 624 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 01im 0001rdst mul #%1, %0 */", op[0], op[1]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mul #%1, %0"); #line 624 "rx-decode.opc" int val = IMMex(im); if (val == 1 && rdst == 0) { SYNTAX("nop\t; mul\t#1, r0"); switch (im) { case 2: ID(nop4); break; case 3: ID(nop5); break; case 0: ID(nop6); break; default: ID(mul); SYNTAX("mul #%1, %0"); break; } } else { ID(mul); } DR(rdst); SC(val); F_____; } break; case 0x20: op_semantics_34: { /** 0111 01im 0010 rdst and #%1, %0 */ #line 413 "rx-decode.opc" int im AU = op[0] & 0x03; #line 413 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 01im 0010 rdst and #%1, %0 */", op[0], op[1]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("and #%1, %0"); #line 413 "rx-decode.opc" ID(and); SC(IMMex(im)); DR(rdst); F__SZ_; } break; case 0x30: op_semantics_35: { /** 0111 01im 0011 rdst or #%1, %0 */ #line 431 "rx-decode.opc" int im AU = op[0] & 0x03; #line 431 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 01im 0011 rdst or #%1, %0 */", op[0], op[1]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("or #%1, %0"); #line 431 "rx-decode.opc" ID(or); SC(IMMex(im)); DR(rdst); F__SZ_; } break; default: UNSUPPORTED(); break; } break; case 0x75: GETBYTE (); switch (op[1] & 0xff) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: goto op_semantics_32; break; case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: goto op_semantics_33; break; case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: goto op_semantics_34; break; case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: goto op_semantics_35; break; case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: { /** 0111 0101 0100 rdst mov%s #%1, %0 */ #line 285 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 0101 0100 rdst mov%s #%1, %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mov%s #%1, %0"); #line 285 "rx-decode.opc" ID(mov); DR(rdst); SC(IMM (1)); F_____; } break; case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: { /** 0111 0101 0101 rsrc cmp #%2, %1 */ #line 524 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 0101 0101 rsrc cmp #%2, %1 */", op[0], op[1]); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("cmp #%2, %1"); #line 524 "rx-decode.opc" ID(sub); SR(rsrc); S2C(IMM(1)); F_OSZC; } break; case 0x60: { /** 0111 0101 0110 0000 int #%1 */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 0101 0110 0000 int #%1 */", op[0], op[1]); } SYNTAX("int #%1"); #line 1031 "rx-decode.opc" ID(int); SC(IMM(1)); } break; case 0x70: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: { /** 0111 0101 0111 0000 0000 immm mvtipl #%1 */ #line 998 "rx-decode.opc" int immm AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 0111 0101 0111 0000 0000 immm mvtipl #%1 */", op[0], op[1], op[2]); printf (" immm = 0x%x\n", immm); } SYNTAX("mvtipl #%1"); #line 998 "rx-decode.opc" ID(mvtipl); SC(immm); } break; default: UNSUPPORTED(); break; } break; default: UNSUPPORTED(); break; } break; case 0x76: GETBYTE (); switch (op[1] & 0xf0) { case 0x00: goto op_semantics_32; break; case 0x10: goto op_semantics_33; break; case 0x20: goto op_semantics_34; break; case 0x30: goto op_semantics_35; break; default: UNSUPPORTED(); break; } break; case 0x77: GETBYTE (); switch (op[1] & 0xf0) { case 0x00: goto op_semantics_32; break; case 0x10: goto op_semantics_33; break; case 0x20: goto op_semantics_34; break; case 0x30: goto op_semantics_35; break; default: UNSUPPORTED(); break; } break; case 0x78: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_36: { /** 0111 100b ittt rdst bset #%1, %0 */ #line 943 "rx-decode.opc" int b AU = op[0] & 0x01; #line 943 "rx-decode.opc" int ittt AU = (op[1] >> 4) & 0x0f; #line 943 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 100b ittt rdst bset #%1, %0 */", op[0], op[1]); printf (" b = 0x%x,", b); printf (" ittt = 0x%x,", ittt); printf (" rdst = 0x%x\n", rdst); } SYNTAX("bset #%1, %0"); #line 943 "rx-decode.opc" ID(bset); BWL(LSIZE); SC(b*16+ittt); DR(rdst); F_____; } break; } break; case 0x79: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_36; break; } break; case 0x7a: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_37: { /** 0111 101b ittt rdst bclr #%1, %0 */ #line 955 "rx-decode.opc" int b AU = op[0] & 0x01; #line 955 "rx-decode.opc" int ittt AU = (op[1] >> 4) & 0x0f; #line 955 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 101b ittt rdst bclr #%1, %0 */", op[0], op[1]); printf (" b = 0x%x,", b); printf (" ittt = 0x%x,", ittt); printf (" rdst = 0x%x\n", rdst); } SYNTAX("bclr #%1, %0"); #line 955 "rx-decode.opc" ID(bclr); BWL(LSIZE); SC(b*16+ittt); DR(rdst); F_____; } break; } break; case 0x7b: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_37; break; } break; case 0x7c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_38: { /** 0111 110b ittt rdst btst #%2, %1 */ #line 967 "rx-decode.opc" int b AU = op[0] & 0x01; #line 967 "rx-decode.opc" int ittt AU = (op[1] >> 4) & 0x0f; #line 967 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 110b ittt rdst btst #%2, %1 */", op[0], op[1]); printf (" b = 0x%x,", b); printf (" ittt = 0x%x,", ittt); printf (" rdst = 0x%x\n", rdst); } SYNTAX("btst #%2, %1"); #line 967 "rx-decode.opc" ID(btst); BWL(LSIZE); S2C(b*16+ittt); SR(rdst); F___ZC; } break; } break; case 0x7d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_38; break; } break; case 0x7e: GETBYTE (); switch (op[1] & 0xf0) { case 0x00: { /** 0111 1110 0000 rdst not %0 */ #line 458 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 0000 rdst not %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("not %0"); #line 458 "rx-decode.opc" ID(xor); DR(rdst); SR(rdst); S2C(~0); F__SZ_; } break; case 0x10: { /** 0111 1110 0001 rdst neg %0 */ #line 479 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 0001 rdst neg %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("neg %0"); #line 479 "rx-decode.opc" ID(sub); DR(rdst); SC(0); S2R(rdst); F_OSZC; } break; case 0x20: { /** 0111 1110 0010 rdst abs %0 */ #line 561 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 0010 rdst abs %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("abs %0"); #line 561 "rx-decode.opc" ID(abs); DR(rdst); SR(rdst); F_OSZ_; } break; case 0x30: { /** 0111 1110 0011 rdst sat %0 */ #line 881 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 0011 rdst sat %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("sat %0"); #line 881 "rx-decode.opc" ID(sat); DR (rdst); } break; case 0x40: { /** 0111 1110 0100 rdst rorc %0 */ #line 741 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 0100 rdst rorc %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("rorc %0"); #line 741 "rx-decode.opc" ID(rorc); DR(rdst); F__SZC; } break; case 0x50: { /** 0111 1110 0101 rdst rolc %0 */ #line 738 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 0101 rdst rolc %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("rolc %0"); #line 738 "rx-decode.opc" ID(rolc); DR(rdst); F__SZC; } break; case 0x80: case 0x90: case 0xa0: { /** 0111 1110 10sz rsrc push%s %1 */ #line 374 "rx-decode.opc" int sz AU = (op[1] >> 4) & 0x03; #line 374 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 10sz rsrc push%s %1 */", op[0], op[1]); printf (" sz = 0x%x,", sz); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("push%s %1"); #line 374 "rx-decode.opc" ID(mov); BWL(sz); OP(0, RX_Operand_Predec, 0, 0); SR(rsrc); F_____; } break; case 0xb0: { /** 0111 1110 1011 rdst pop %0 */ #line 371 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 1011 rdst pop %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("pop %0"); #line 371 "rx-decode.opc" ID(mov); OP(1, RX_Operand_Postinc, 0, 0); DR(rdst); F_____; } break; case 0xc0: case 0xd0: { /** 0111 1110 110 crsrc pushc %1 */ #line 1004 "rx-decode.opc" int crsrc AU = op[1] & 0x1f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 110 crsrc pushc %1 */", op[0], op[1]); printf (" crsrc = 0x%x\n", crsrc); } SYNTAX("pushc %1"); #line 1004 "rx-decode.opc" ID(mov); OP(0, RX_Operand_Predec, 0, 0); SR(crsrc + 16); } break; case 0xe0: case 0xf0: { /** 0111 1110 111 crdst popc %0 */ #line 1001 "rx-decode.opc" int crdst AU = op[1] & 0x1f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1110 111 crdst popc %0 */", op[0], op[1]); printf (" crdst = 0x%x\n", crdst); } SYNTAX("popc %0"); #line 1001 "rx-decode.opc" ID(mov); OP(1, RX_Operand_Postinc, 0, 0); DR(crdst + 16); } break; default: UNSUPPORTED(); break; } break; case 0x7f: GETBYTE (); switch (op[1] & 0xff) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: { /** 0111 1111 0000 rsrc jmp %0 */ #line 791 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 0000 rsrc jmp %0 */", op[0], op[1]); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("jmp %0"); #line 791 "rx-decode.opc" ID(branch); DR(rsrc); } break; case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: { /** 0111 1111 0001 rsrc jsr %0 */ #line 794 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 0001 rsrc jsr %0 */", op[0], op[1]); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("jsr %0"); #line 794 "rx-decode.opc" ID(jsr); DR(rsrc); } break; case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: { /** 0111 1111 0100 rsrc bra.l %0 */ #line 787 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 0100 rsrc bra.l %0 */", op[0], op[1]); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("bra.l %0"); #line 787 "rx-decode.opc" ID(branchrel); DR(rsrc); } break; case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: { /** 0111 1111 0101 rsrc bsr.l %0 */ #line 803 "rx-decode.opc" int rsrc AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 0101 rsrc bsr.l %0 */", op[0], op[1]); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("bsr.l %0"); #line 803 "rx-decode.opc" ID(jsrrel); DR(rsrc); } break; case 0x80: case 0x81: case 0x82: { /** 0111 1111 1000 00sz suntil%s */ #line 827 "rx-decode.opc" int sz AU = op[1] & 0x03; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 00sz suntil%s */", op[0], op[1]); printf (" sz = 0x%x\n", sz); } SYNTAX("suntil%s"); #line 827 "rx-decode.opc" ID(suntil); BWL(sz); F___ZC; } break; case 0x83: { /** 0111 1111 1000 0011 scmpu */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 0011 scmpu */", op[0], op[1]); } SYNTAX("scmpu"); #line 818 "rx-decode.opc" ID(scmpu); F___ZC; } break; case 0x84: case 0x85: case 0x86: { /** 0111 1111 1000 01sz swhile%s */ #line 830 "rx-decode.opc" int sz AU = op[1] & 0x03; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 01sz swhile%s */", op[0], op[1]); printf (" sz = 0x%x\n", sz); } SYNTAX("swhile%s"); #line 830 "rx-decode.opc" ID(swhile); BWL(sz); F___ZC; } break; case 0x87: { /** 0111 1111 1000 0111 smovu */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 0111 smovu */", op[0], op[1]); } SYNTAX("smovu"); #line 821 "rx-decode.opc" ID(smovu); } break; case 0x88: case 0x89: case 0x8a: { /** 0111 1111 1000 10sz sstr%s */ #line 836 "rx-decode.opc" int sz AU = op[1] & 0x03; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 10sz sstr%s */", op[0], op[1]); printf (" sz = 0x%x\n", sz); } SYNTAX("sstr%s"); #line 836 "rx-decode.opc" ID(sstr); BWL(sz); /*----------------------------------------------------------------------*/ /* RMPA */ } break; case 0x8b: { /** 0111 1111 1000 1011 smovb */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 1011 smovb */", op[0], op[1]); } SYNTAX("smovb"); #line 824 "rx-decode.opc" ID(smovb); } break; case 0x8c: case 0x8d: case 0x8e: { /** 0111 1111 1000 11sz rmpa%s */ #line 842 "rx-decode.opc" int sz AU = op[1] & 0x03; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 11sz rmpa%s */", op[0], op[1]); printf (" sz = 0x%x\n", sz); } SYNTAX("rmpa%s"); #line 842 "rx-decode.opc" ID(rmpa); BWL(sz); F_OS__; /*----------------------------------------------------------------------*/ /* HI/LO stuff */ } break; case 0x8f: { /** 0111 1111 1000 1111 smovf */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1000 1111 smovf */", op[0], op[1]); } SYNTAX("smovf"); #line 833 "rx-decode.opc" ID(smovf); } break; case 0x93: { /** 0111 1111 1001 0011 satr */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1001 0011 satr */", op[0], op[1]); } SYNTAX("satr"); #line 884 "rx-decode.opc" ID(satr); /*----------------------------------------------------------------------*/ /* FLOAT */ } break; case 0x94: { /** 0111 1111 1001 0100 rtfi */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1001 0100 rtfi */", op[0], op[1]); } SYNTAX("rtfi"); #line 1019 "rx-decode.opc" ID(rtfi); } break; case 0x95: { /** 0111 1111 1001 0101 rte */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1001 0101 rte */", op[0], op[1]); } SYNTAX("rte"); #line 1022 "rx-decode.opc" ID(rte); } break; case 0x96: { /** 0111 1111 1001 0110 wait */ if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1001 0110 wait */", op[0], op[1]); } SYNTAX("wait"); #line 1034 "rx-decode.opc" ID(wait); /*----------------------------------------------------------------------*/ /* SCcnd */ } break; case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7: case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf: { /** 0111 1111 1010 rdst setpsw %0 */ #line 995 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1010 rdst setpsw %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("setpsw %0"); #line 995 "rx-decode.opc" ID(setpsw); DF(rdst); } break; case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7: case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: { /** 0111 1111 1011 rdst clrpsw %0 */ #line 992 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 0111 1111 1011 rdst clrpsw %0 */", op[0], op[1]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("clrpsw %0"); #line 992 "rx-decode.opc" ID(clrpsw); DF(rdst); } break; default: UNSUPPORTED(); break; } break; case 0x80: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_39: { /** 10sz 0dsp a dst b src mov%s %1, %0 */ #line 332 "rx-decode.opc" int sz AU = (op[0] >> 4) & 0x03; #line 332 "rx-decode.opc" int dsp AU = op[0] & 0x07; #line 332 "rx-decode.opc" int a AU = (op[1] >> 7) & 0x01; #line 332 "rx-decode.opc" int dst AU = (op[1] >> 4) & 0x07; #line 332 "rx-decode.opc" int b AU = (op[1] >> 3) & 0x01; #line 332 "rx-decode.opc" int src AU = op[1] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 10sz 0dsp a dst b src mov%s %1, %0 */", op[0], op[1]); printf (" sz = 0x%x,", sz); printf (" dsp = 0x%x,", dsp); printf (" a = 0x%x,", a); printf (" dst = 0x%x,", dst); printf (" b = 0x%x,", b); printf (" src = 0x%x\n", src); } SYNTAX("mov%s %1, %0"); #line 332 "rx-decode.opc" ID(mov); sBWL(sz); DIs(dst, dsp*4+a*2+b, sz); SR(src); F_____; } break; } break; case 0x81: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x82: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x83: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x84: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x85: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x86: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x87: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x88: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_40: { /** 10sz 1dsp a src b dst mov%s %1, %0 */ #line 329 "rx-decode.opc" int sz AU = (op[0] >> 4) & 0x03; #line 329 "rx-decode.opc" int dsp AU = op[0] & 0x07; #line 329 "rx-decode.opc" int a AU = (op[1] >> 7) & 0x01; #line 329 "rx-decode.opc" int src AU = (op[1] >> 4) & 0x07; #line 329 "rx-decode.opc" int b AU = (op[1] >> 3) & 0x01; #line 329 "rx-decode.opc" int dst AU = op[1] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 10sz 1dsp a src b dst mov%s %1, %0 */", op[0], op[1]); printf (" sz = 0x%x,", sz); printf (" dsp = 0x%x,", dsp); printf (" a = 0x%x,", a); printf (" src = 0x%x,", src); printf (" b = 0x%x,", b); printf (" dst = 0x%x\n", dst); } SYNTAX("mov%s %1, %0"); #line 329 "rx-decode.opc" ID(mov); sBWL(sz); DR(dst); SIs(src, dsp*4+a*2+b, sz); F_____; } break; } break; case 0x89: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x8a: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x8b: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x8c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x8d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x8e: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x8f: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x90: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x91: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x92: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x93: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x94: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x95: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x96: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x97: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0x98: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x99: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x9a: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x9b: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x9c: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x9d: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x9e: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0x9f: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xa0: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa1: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa2: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa3: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa4: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa5: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa6: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa7: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_39; break; } break; case 0xa8: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xa9: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xaa: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xab: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xac: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xad: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xae: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xaf: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_40; break; } break; case 0xb0: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_41: { /** 1011 w dsp a src b dst movu%s %1, %0 */ #line 352 "rx-decode.opc" int w AU = (op[0] >> 3) & 0x01; #line 352 "rx-decode.opc" int dsp AU = op[0] & 0x07; #line 352 "rx-decode.opc" int a AU = (op[1] >> 7) & 0x01; #line 352 "rx-decode.opc" int src AU = (op[1] >> 4) & 0x07; #line 352 "rx-decode.opc" int b AU = (op[1] >> 3) & 0x01; #line 352 "rx-decode.opc" int dst AU = op[1] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 1011 w dsp a src b dst movu%s %1, %0 */", op[0], op[1]); printf (" w = 0x%x,", w); printf (" dsp = 0x%x,", dsp); printf (" a = 0x%x,", a); printf (" src = 0x%x,", src); printf (" b = 0x%x,", b); printf (" dst = 0x%x\n", dst); } SYNTAX("movu%s %1, %0"); #line 352 "rx-decode.opc" ID(mov); uBW(w); DR(dst); SIs(src, dsp*4+a*2+b, w); F_____; } break; } break; case 0xb1: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb2: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb3: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb4: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb5: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb6: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb7: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb8: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xb9: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xba: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xbb: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xbc: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xbd: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xbe: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xbf: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_41; break; } break; case 0xc0: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_42: { /** 11sz sd ss rsrc rdst mov%s %1, %0 */ #line 310 "rx-decode.opc" int sz AU = (op[0] >> 4) & 0x03; #line 310 "rx-decode.opc" int sd AU = (op[0] >> 2) & 0x03; #line 310 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 310 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 310 "rx-decode.opc" int rdst AU = op[1] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 11sz sd ss rsrc rdst mov%s %1, %0 */", op[0], op[1]); printf (" sz = 0x%x,", sz); printf (" sd = 0x%x,", sd); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mov%s %1, %0"); #line 310 "rx-decode.opc" if (sd == 3 && ss == 3 && sz == 2 && rsrc == 0 && rdst == 0) { ID(nop2); SYNTAX ("nop\t; mov.l\tr0, r0"); } else { ID(mov); sBWL(sz); F_____; if ((ss == 3) && (sd != 3)) { SD(ss, rdst, sz); DD(sd, rsrc, sz); } else { SD(ss, rsrc, sz); DD(sd, rdst, sz); } } } break; } break; case 0xc1: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc2: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc3: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc4: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc5: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc6: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc7: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc8: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xc9: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xca: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xcb: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xcc: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xcd: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xce: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xcf: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd0: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd1: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd2: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd3: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd4: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd5: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd6: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd7: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd8: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xd9: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xda: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xdb: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xdc: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xdd: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xde: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xdf: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe0: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe1: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe2: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe3: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe4: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe5: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe6: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe7: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe8: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xe9: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xea: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xeb: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xec: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xed: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xee: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xef: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_42; break; } break; case 0xf0: GETBYTE (); switch (op[1] & 0x08) { case 0x00: op_semantics_43: { /** 1111 00sd rdst 0bit bset #%1, %0%S0 */ #line 935 "rx-decode.opc" int sd AU = op[0] & 0x03; #line 935 "rx-decode.opc" int rdst AU = (op[1] >> 4) & 0x0f; #line 935 "rx-decode.opc" int bit AU = op[1] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 1111 00sd rdst 0bit bset #%1, %0%S0 */", op[0], op[1]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" bit = 0x%x\n", bit); } SYNTAX("bset #%1, %0%S0"); #line 935 "rx-decode.opc" ID(bset); BWL(BSIZE); SC(bit); DD(sd, rdst, BSIZE); F_____; } break; case 0x08: op_semantics_44: { /** 1111 00sd rdst 1bit bclr #%1, %0%S0 */ #line 947 "rx-decode.opc" int sd AU = op[0] & 0x03; #line 947 "rx-decode.opc" int rdst AU = (op[1] >> 4) & 0x0f; #line 947 "rx-decode.opc" int bit AU = op[1] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 1111 00sd rdst 1bit bclr #%1, %0%S0 */", op[0], op[1]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" bit = 0x%x\n", bit); } SYNTAX("bclr #%1, %0%S0"); #line 947 "rx-decode.opc" ID(bclr); BWL(BSIZE); SC(bit); DD(sd, rdst, BSIZE); F_____; } break; } break; case 0xf1: GETBYTE (); switch (op[1] & 0x08) { case 0x00: goto op_semantics_43; break; case 0x08: goto op_semantics_44; break; } break; case 0xf2: GETBYTE (); switch (op[1] & 0x08) { case 0x00: goto op_semantics_43; break; case 0x08: goto op_semantics_44; break; } break; case 0xf3: GETBYTE (); switch (op[1] & 0x08) { case 0x00: goto op_semantics_43; break; case 0x08: goto op_semantics_44; break; } break; case 0xf4: GETBYTE (); switch (op[1] & 0x0c) { case 0x00: case 0x04: op_semantics_45: { /** 1111 01sd rdst 0bit btst #%2, %1%S1 */ #line 959 "rx-decode.opc" int sd AU = op[0] & 0x03; #line 959 "rx-decode.opc" int rdst AU = (op[1] >> 4) & 0x0f; #line 959 "rx-decode.opc" int bit AU = op[1] & 0x07; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 1111 01sd rdst 0bit btst #%2, %1%S1 */", op[0], op[1]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" bit = 0x%x\n", bit); } SYNTAX("btst #%2, %1%S1"); #line 959 "rx-decode.opc" ID(btst); BWL(BSIZE); S2C(bit); SD(sd, rdst, BSIZE); F___ZC; } break; case 0x08: op_semantics_46: { /** 1111 01ss rsrc 10sz push%s %1 */ #line 377 "rx-decode.opc" int ss AU = op[0] & 0x03; #line 377 "rx-decode.opc" int rsrc AU = (op[1] >> 4) & 0x0f; #line 377 "rx-decode.opc" int sz AU = op[1] & 0x03; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 1111 01ss rsrc 10sz push%s %1 */", op[0], op[1]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" sz = 0x%x\n", sz); } SYNTAX("push%s %1"); #line 377 "rx-decode.opc" ID(mov); BWL(sz); OP(0, RX_Operand_Predec, 0, 0); SD(ss, rsrc, sz); F_____; /*----------------------------------------------------------------------*/ /* XCHG */ } break; default: UNSUPPORTED(); break; } break; case 0xf5: GETBYTE (); switch (op[1] & 0x0c) { case 0x00: case 0x04: goto op_semantics_45; break; case 0x08: goto op_semantics_46; break; default: UNSUPPORTED(); break; } break; case 0xf6: GETBYTE (); switch (op[1] & 0x0c) { case 0x00: case 0x04: goto op_semantics_45; break; case 0x08: goto op_semantics_46; break; default: UNSUPPORTED(); break; } break; case 0xf7: GETBYTE (); switch (op[1] & 0x0c) { case 0x00: case 0x04: goto op_semantics_45; break; case 0x08: goto op_semantics_46; break; default: UNSUPPORTED(); break; } break; case 0xf8: GETBYTE (); switch (op[1] & 0x00) { case 0x00: op_semantics_47: { /** 1111 10sd rdst im sz mov%s #%1, %0 */ #line 288 "rx-decode.opc" int sd AU = op[0] & 0x03; #line 288 "rx-decode.opc" int rdst AU = (op[1] >> 4) & 0x0f; #line 288 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 288 "rx-decode.opc" int sz AU = op[1] & 0x03; if (trace) { printf ("\033[33m%s\033[0m %02x %02x\n", "/** 1111 10sd rdst im sz mov%s #%1, %0 */", op[0], op[1]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" im = 0x%x,", im); printf (" sz = 0x%x\n", sz); } SYNTAX("mov%s #%1, %0"); #line 288 "rx-decode.opc" ID(mov); DD(sd, rdst, sz); if ((im == 1 && sz == 0) || (im == 2 && sz == 1) || (im == 0 && sz == 2)) { BWL (sz); SC(IMM(im)); } else { sBWL (sz); SC(IMMex(im)); } F_____; } break; } break; case 0xf9: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_47; break; } break; case 0xfa: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_47; break; } break; case 0xfb: GETBYTE (); switch (op[1] & 0x00) { case 0x00: goto op_semantics_47; break; } break; case 0xfc: GETBYTE (); switch (op[1] & 0xff) { case 0x03: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0000 0011 rsrc rdst sbb %1, %0 */ #line 551 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 551 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0000 0011 rsrc rdst sbb %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("sbb %1, %0"); #line 551 "rx-decode.opc" ID(sbb); SR (rsrc); DR(rdst); F_OSZC; /* FIXME: only supports .L */ } break; } break; case 0x07: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0000 0111 rsrc rdst neg %2, %0 */ #line 482 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 482 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0000 0111 rsrc rdst neg %2, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("neg %2, %0"); #line 482 "rx-decode.opc" ID(sub); DR(rdst); SC(0); S2R(rsrc); F_OSZC; /*----------------------------------------------------------------------*/ /* ADC */ } break; } break; case 0x0b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0000 1011 rsrc rdst adc %1, %0 */ #line 491 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 491 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0000 1011 rsrc rdst adc %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("adc %1, %0"); #line 491 "rx-decode.opc" ID(adc); SR(rsrc); DR(rdst); F_OSZC; } break; } break; case 0x0f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0000 1111 rsrc rdst abs %1, %0 */ #line 564 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 564 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0000 1111 rsrc rdst abs %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("abs %1, %0"); #line 564 "rx-decode.opc" ID(abs); DR(rdst); SR(rsrc); F_OSZ_; /*----------------------------------------------------------------------*/ /* MAX */ } break; } break; case 0x10: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_48: { /** 1111 1100 0001 00ss rsrc rdst max %1%S1, %0 */ #line 583 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 583 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 583 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0001 00ss rsrc rdst max %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("max %1%S1, %0"); #line 583 "rx-decode.opc" if (ss == 3 && rsrc == 0 && rdst == 0) { ID(nop3); SYNTAX("nop\t; max\tr0, r0"); } else { ID(max); SP(ss, rsrc); DR(rdst); } } break; } break; case 0x11: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_48; break; } break; case 0x12: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_48; break; } break; case 0x13: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_48; break; } break; case 0x14: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_49: { /** 1111 1100 0001 01ss rsrc rdst min %1%S1, %0 */ #line 603 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 603 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 603 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0001 01ss rsrc rdst min %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("min %1%S1, %0"); #line 603 "rx-decode.opc" ID(min); SP(ss, rsrc); DR(rdst); } break; } break; case 0x15: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_49; break; } break; case 0x16: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_49; break; } break; case 0x17: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_49; break; } break; case 0x18: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_50: { /** 1111 1100 0001 10ss rsrc rdst emul %1%S1, %0 */ #line 661 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 661 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 661 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0001 10ss rsrc rdst emul %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("emul %1%S1, %0"); #line 661 "rx-decode.opc" ID(emul); SP(ss, rsrc); DR(rdst); } break; } break; case 0x19: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_50; break; } break; case 0x1a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_50; break; } break; case 0x1b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_50; break; } break; case 0x1c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_51: { /** 1111 1100 0001 11ss rsrc rdst emulu %1%S1, %0 */ #line 673 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 673 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 673 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0001 11ss rsrc rdst emulu %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("emulu %1%S1, %0"); #line 673 "rx-decode.opc" ID(emulu); SP(ss, rsrc); DR(rdst); } break; } break; case 0x1d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_51; break; } break; case 0x1e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_51; break; } break; case 0x1f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_51; break; } break; case 0x20: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_52: { /** 1111 1100 0010 00ss rsrc rdst div %1%S1, %0 */ #line 685 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 685 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 685 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0010 00ss rsrc rdst div %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("div %1%S1, %0"); #line 685 "rx-decode.opc" ID(div); SP(ss, rsrc); DR(rdst); F_O___; } break; } break; case 0x21: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_52; break; } break; case 0x22: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_52; break; } break; case 0x23: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_52; break; } break; case 0x24: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_53: { /** 1111 1100 0010 01ss rsrc rdst divu %1%S1, %0 */ #line 697 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 697 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 697 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0010 01ss rsrc rdst divu %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("divu %1%S1, %0"); #line 697 "rx-decode.opc" ID(divu); SP(ss, rsrc); DR(rdst); F_O___; } break; } break; case 0x25: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_53; break; } break; case 0x26: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_53; break; } break; case 0x27: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_53; break; } break; case 0x30: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_54: { /** 1111 1100 0011 00ss rsrc rdst tst %1%S1, %2 */ #line 470 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 470 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 470 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0011 00ss rsrc rdst tst %1%S1, %2 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("tst %1%S1, %2"); #line 470 "rx-decode.opc" ID(and); SP(ss, rsrc); S2R(rdst); F__SZ_; } break; } break; case 0x31: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_54; break; } break; case 0x32: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_54; break; } break; case 0x33: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_54; break; } break; case 0x34: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_55: { /** 1111 1100 0011 01ss rsrc rdst xor %1%S1, %0 */ #line 449 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 449 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 449 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0011 01ss rsrc rdst xor %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("xor %1%S1, %0"); #line 449 "rx-decode.opc" ID(xor); SP(ss, rsrc); DR(rdst); F__SZ_; } break; } break; case 0x35: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_55; break; } break; case 0x36: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_55; break; } break; case 0x37: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_55; break; } break; case 0x3b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0011 1011 rsrc rdst not %1, %0 */ #line 461 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 461 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0011 1011 rsrc rdst not %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("not %1, %0"); #line 461 "rx-decode.opc" ID(xor); DR(rdst); SR(rsrc); S2C(~0); F__SZ_; /*----------------------------------------------------------------------*/ /* TST */ } break; } break; case 0x40: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_56: { /** 1111 1100 0100 00ss rsrc rdst xchg %1%S1, %0 */ #line 383 "rx-decode.opc" int ss AU = op[1] & 0x03; #line 383 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 383 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0100 00ss rsrc rdst xchg %1%S1, %0 */", op[0], op[1], op[2]); printf (" ss = 0x%x,", ss); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("xchg %1%S1, %0"); #line 383 "rx-decode.opc" ID(xchg); DR(rdst); SP(ss, rsrc); } break; } break; case 0x41: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_56; break; } break; case 0x42: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_56; break; } break; case 0x43: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_56; break; } break; case 0x44: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_57: { /** 1111 1100 0100 01sd rsrc rdst itof %1%S1, %0 */ #line 926 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 926 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 926 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0100 01sd rsrc rdst itof %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("itof %1%S1, %0"); #line 926 "rx-decode.opc" ID(itof); DR (rdst); SP(sd, rsrc); F__SZ_; } break; } break; case 0x45: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_57; break; } break; case 0x46: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_57; break; } break; case 0x47: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_57; break; } break; case 0x4b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0100 1011 rsrc rdst stz %1, %0 */ #line 1052 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1052 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0100 1011 rsrc rdst stz %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("stz %1, %0"); #line 1052 "rx-decode.opc" ID(stcc); SR(rsrc); DR(rdst); S2cc(RXC_z); } break; } break; case 0x4f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1100 0100 1111 rsrc rdst stnz %1, %0 */ #line 1055 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1055 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0100 1111 rsrc rdst stnz %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("stnz %1, %0"); #line 1055 "rx-decode.opc" ID(stcc); SR(rsrc); DR(rdst); S2cc(RXC_nz); } break; } break; case 0x54: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_58: { /** 1111 1100 0101 01sd rsrc rdst utof %1%S1, %0 */ #line 1112 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 1112 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1112 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0101 01sd rsrc rdst utof %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("utof %1%S1, %0"); #line 1112 "rx-decode.opc" ID(utof); DR (rdst); SP(sd, rsrc); F__SZ_; } break; } break; case 0x55: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_58; break; } break; case 0x56: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_58; break; } break; case 0x57: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_58; break; } break; case 0x60: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_59: { /** 1111 1100 0110 00sd rdst rsrc bset %1, %0%S0 */ #line 938 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 938 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 938 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0110 00sd rdst rsrc bset %1, %0%S0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("bset %1, %0%S0"); #line 938 "rx-decode.opc" ID(bset); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); F_____; if (sd == 3) /* bset reg,reg */ BWL(LSIZE); } break; } break; case 0x61: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_59; break; } break; case 0x62: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_59; break; } break; case 0x63: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_59; break; } break; case 0x64: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_60: { /** 1111 1100 0110 01sd rdst rsrc bclr %1, %0%S0 */ #line 950 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 950 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 950 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0110 01sd rdst rsrc bclr %1, %0%S0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("bclr %1, %0%S0"); #line 950 "rx-decode.opc" ID(bclr); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); F_____; if (sd == 3) /* bset reg,reg */ BWL(LSIZE); } break; } break; case 0x65: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_60; break; } break; case 0x66: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_60; break; } break; case 0x67: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_60; break; } break; case 0x68: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_61: { /** 1111 1100 0110 10sd rdst rsrc btst %2, %1%S1 */ #line 962 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 962 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 962 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0110 10sd rdst rsrc btst %2, %1%S1 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("btst %2, %1%S1"); #line 962 "rx-decode.opc" ID(btst); BWL(BSIZE); S2R(rsrc); SD(sd, rdst, BSIZE); F___ZC; if (sd == 3) /* bset reg,reg */ BWL(LSIZE); } break; } break; case 0x69: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_61; break; } break; case 0x6a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_61; break; } break; case 0x6b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_61; break; } break; case 0x6c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_62: { /** 1111 1100 0110 11sd rdst rsrc bnot %1, %0%S0 */ #line 974 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 974 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 974 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 0110 11sd rdst rsrc bnot %1, %0%S0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("bnot %1, %0%S0"); #line 974 "rx-decode.opc" ID(bnot); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); if (sd == 3) /* bset reg,reg */ BWL(LSIZE); } break; } break; case 0x6d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_62; break; } break; case 0x6e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_62; break; } break; case 0x6f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_62; break; } break; case 0x80: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_63: { /** 1111 1100 1000 00sd rsrc rdst fsub %1%S1, %0 */ #line 905 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 905 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 905 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1000 00sd rsrc rdst fsub %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fsub %1%S1, %0"); #line 905 "rx-decode.opc" ID(fsub); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0x81: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_63; break; } break; case 0x82: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_63; break; } break; case 0x83: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_63; break; } break; case 0x84: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_64: { /** 1111 1100 1000 01sd rsrc rdst fcmp %1%S1, %0 */ #line 899 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 899 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 899 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1000 01sd rsrc rdst fcmp %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fcmp %1%S1, %0"); #line 899 "rx-decode.opc" ID(fcmp); DR(rdst); SD(sd, rsrc, LSIZE); F_OSZ_; } break; } break; case 0x85: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_64; break; } break; case 0x86: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_64; break; } break; case 0x87: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_64; break; } break; case 0x88: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_65: { /** 1111 1100 1000 10sd rsrc rdst fadd %1%S1, %0 */ #line 893 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 893 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 893 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1000 10sd rsrc rdst fadd %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fadd %1%S1, %0"); #line 893 "rx-decode.opc" ID(fadd); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0x89: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_65; break; } break; case 0x8a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_65; break; } break; case 0x8b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_65; break; } break; case 0x8c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_66: { /** 1111 1100 1000 11sd rsrc rdst fmul %1%S1, %0 */ #line 914 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 914 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 914 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1000 11sd rsrc rdst fmul %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fmul %1%S1, %0"); #line 914 "rx-decode.opc" ID(fmul); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0x8d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_66; break; } break; case 0x8e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_66; break; } break; case 0x8f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_66; break; } break; case 0x90: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_67: { /** 1111 1100 1001 00sd rsrc rdst fdiv %1%S1, %0 */ #line 920 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 920 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 920 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1001 00sd rsrc rdst fdiv %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fdiv %1%S1, %0"); #line 920 "rx-decode.opc" ID(fdiv); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0x91: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_67; break; } break; case 0x92: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_67; break; } break; case 0x93: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_67; break; } break; case 0x94: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_68: { /** 1111 1100 1001 01sd rsrc rdst ftoi %1%S1, %0 */ #line 908 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 908 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 908 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1001 01sd rsrc rdst ftoi %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("ftoi %1%S1, %0"); #line 908 "rx-decode.opc" ID(ftoi); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0x95: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_68; break; } break; case 0x96: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_68; break; } break; case 0x97: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_68; break; } break; case 0x98: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_69: { /** 1111 1100 1001 10sd rsrc rdst round %1%S1, %0 */ #line 923 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 923 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 923 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1001 10sd rsrc rdst round %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("round %1%S1, %0"); #line 923 "rx-decode.opc" ID(round); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0x99: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_69; break; } break; case 0x9a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_69; break; } break; case 0x9b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_69; break; } break; case 0xa0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_70: { /** 1111 1100 1010 00sd rsrc rdst fsqrt %1%S1, %0 */ #line 1106 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 1106 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1106 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1010 00sd rsrc rdst fsqrt %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fsqrt %1%S1, %0"); #line 1106 "rx-decode.opc" ID(fsqrt); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0xa1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_70; break; } break; case 0xa2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_70; break; } break; case 0xa3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_70; break; } break; case 0xa4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_71: { /** 1111 1100 1010 01sd rsrc rdst ftou %1%S1, %0 */ #line 1109 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 1109 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1109 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1010 01sd rsrc rdst ftou %1%S1, %0 */", op[0], op[1], op[2]); printf (" sd = 0x%x,", sd); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("ftou %1%S1, %0"); #line 1109 "rx-decode.opc" ID(ftou); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_; } break; } break; case 0xa5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_71; break; } break; case 0xa6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_71; break; } break; case 0xa7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_71; break; } break; case 0xd0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_72: { /** 1111 1100 1101 sz sd rdst cond sc%1%s %0 */ #line 1040 "rx-decode.opc" int sz AU = (op[1] >> 2) & 0x03; #line 1040 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 1040 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 1040 "rx-decode.opc" int cond AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 1101 sz sd rdst cond sc%1%s %0 */", op[0], op[1], op[2]); printf (" sz = 0x%x,", sz); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" cond = 0x%x\n", cond); } SYNTAX("sc%1%s %0"); #line 1040 "rx-decode.opc" ID(sccnd); BWL(sz); DD (sd, rdst, sz); Scc(cond); /*----------------------------------------------------------------------*/ /* RXv2 enhanced */ } break; } break; case 0xd1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xd9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xda: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xdb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_72; break; } break; case 0xe0: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: op_semantics_73: { /** 1111 1100 111bit sd rdst cond bm%2 #%1, %0%S0 */ #line 983 "rx-decode.opc" int bit AU = (op[1] >> 2) & 0x07; #line 983 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 983 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 983 "rx-decode.opc" int cond AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 111bit sd rdst cond bm%2 #%1, %0%S0 */", op[0], op[1], op[2]); printf (" bit = 0x%x,", bit); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x,", rdst); printf (" cond = 0x%x\n", cond); } SYNTAX("bm%2 #%1, %0%S0"); #line 983 "rx-decode.opc" ID(bmcc); BWL(BSIZE); S2cc(cond); SC(bit); DD(sd, rdst, BSIZE); } break; case 0x0f: op_semantics_74: { /** 1111 1100 111bit sd rdst 1111 bnot #%1, %0%S0 */ #line 971 "rx-decode.opc" int bit AU = (op[1] >> 2) & 0x07; #line 971 "rx-decode.opc" int sd AU = op[1] & 0x03; #line 971 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1100 111bit sd rdst 1111 bnot #%1, %0%S0 */", op[0], op[1], op[2]); printf (" bit = 0x%x,", bit); printf (" sd = 0x%x,", sd); printf (" rdst = 0x%x\n", rdst); } SYNTAX("bnot #%1, %0%S0"); #line 971 "rx-decode.opc" ID(bnot); BWL(BSIZE); SC(bit); DD(sd, rdst, BSIZE); } break; } break; case 0xe1: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe2: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe3: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe4: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe5: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe6: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe7: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe8: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xe9: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xea: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xeb: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xec: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xed: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xee: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xef: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf0: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf1: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf2: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf3: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf4: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf5: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf6: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf7: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf8: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xf9: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xfa: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xfb: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xfc: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xfd: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xfe: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; case 0xff: GETBYTE (); switch (op[2] & 0x0f) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: goto op_semantics_73; break; case 0x0f: goto op_semantics_74; break; } break; default: UNSUPPORTED(); break; } break; case 0xfd: GETBYTE (); switch (op[1] & 0xff) { case 0x00: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_75: { /** 1111 1101 0000 a000 srca srcb mulhi %1, %2, %0 */ #line 848 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 848 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 848 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a000 srca srcb mulhi %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("mulhi %1, %2, %0"); #line 848 "rx-decode.opc" ID(mulhi); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x01: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_76: { /** 1111 1101 0000 a001 srca srcb mullo %1, %2, %0 */ #line 851 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 851 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 851 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a001 srca srcb mullo %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("mullo %1, %2, %0"); #line 851 "rx-decode.opc" ID(mullo); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x02: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_77: { /** 1111 1101 0000 a010 srca srcb mullh %1, %2, %0 */ #line 1079 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1079 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1079 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a010 srca srcb mullh %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("mullh %1, %2, %0"); #line 1079 "rx-decode.opc" ID(mullh); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x03: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_78: { /** 1111 1101 0000 a011 srca srcb emula %1, %2, %0 */ #line 1064 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1064 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1064 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a011 srca srcb emula %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("emula %1, %2, %0"); #line 1064 "rx-decode.opc" ID(emula); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x04: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_79: { /** 1111 1101 0000 a100 srca srcb machi %1, %2, %0 */ #line 854 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 854 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 854 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a100 srca srcb machi %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("machi %1, %2, %0"); #line 854 "rx-decode.opc" ID(machi); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x05: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_80: { /** 1111 1101 0000 a101 srca srcb maclo %1, %2, %0 */ #line 857 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 857 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 857 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a101 srca srcb maclo %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("maclo %1, %2, %0"); #line 857 "rx-decode.opc" ID(maclo); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x06: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_81: { /** 1111 1101 0000 a110 srca srcb maclh %1, %2, %0 */ #line 1067 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1067 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1067 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a110 srca srcb maclh %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("maclh %1, %2, %0"); #line 1067 "rx-decode.opc" ID(maclh); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x07: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_82: { /** 1111 1101 0000 a111 srca srcb emaca %1, %2, %0 */ #line 1058 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1058 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1058 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0000 a111 srca srcb emaca %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("emaca %1, %2, %0"); #line 1058 "rx-decode.opc" ID(emaca); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x08: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_75; break; } break; case 0x09: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_76; break; } break; case 0x0a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_77; break; } break; case 0x0b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_78; break; } break; case 0x0c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_79; break; } break; case 0x0d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_80; break; } break; case 0x0e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_81; break; } break; case 0x0f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_82; break; } break; case 0x17: GETBYTE (); switch (op[2] & 0x70) { case 0x00: { /** 1111 1101 0001 0111 a000 rsrc mvtachi %1, %0 */ #line 860 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 860 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 0111 a000 rsrc mvtachi %1, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("mvtachi %1, %0"); #line 860 "rx-decode.opc" ID(mvtachi); DR(a+32); SR(rsrc); F_____; } break; case 0x10: { /** 1111 1101 0001 0111 a001 rsrc mvtaclo %1, %0 */ #line 863 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 863 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 0111 a001 rsrc mvtaclo %1, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("mvtaclo %1, %0"); #line 863 "rx-decode.opc" ID(mvtaclo); DR(a+32); SR(rsrc); F_____; } break; case 0x30: { /** 1111 1101 0001 0111 a011 rdst mvtacgu %0, %1 */ #line 1085 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 1085 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 0111 a011 rdst mvtacgu %0, %1 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvtacgu %0, %1"); #line 1085 "rx-decode.opc" ID(mvtacgu); DR(a+32); SR(rdst); F_____; } break; default: UNSUPPORTED(); break; } break; case 0x18: GETBYTE (); switch (op[2] & 0x6f) { case 0x00: { /** 1111 1101 0001 1000 a00i 0000 racw #%1, %0 */ #line 875 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 875 "rx-decode.opc" int i AU = (op[2] >> 4) & 0x01; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 1000 a00i 0000 racw #%1, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" i = 0x%x\n", i); } SYNTAX("racw #%1, %0"); #line 875 "rx-decode.opc" ID(racw); SC(i+1); DR(a+32); F_____; /*----------------------------------------------------------------------*/ /* SAT */ } break; case 0x40: { /** 1111 1101 0001 1000 a10i 0000 rdacw #%1, %0 */ #line 1094 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 1094 "rx-decode.opc" int i AU = (op[2] >> 4) & 0x01; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 1000 a10i 0000 rdacw #%1, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" i = 0x%x\n", i); } SYNTAX("rdacw #%1, %0"); #line 1094 "rx-decode.opc" ID(rdacw); SC(i+1); DR(a+32); F_____; } break; default: UNSUPPORTED(); break; } break; case 0x19: GETBYTE (); switch (op[2] & 0x6f) { case 0x00: { /** 1111 1101 0001 1001 a00i 0000 racl #%1, %0 */ #line 1088 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 1088 "rx-decode.opc" int i AU = (op[2] >> 4) & 0x01; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 1001 a00i 0000 racl #%1, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" i = 0x%x\n", i); } SYNTAX("racl #%1, %0"); #line 1088 "rx-decode.opc" ID(racl); SC(i+1); DR(a+32); F_____; } break; case 0x40: { /** 1111 1101 0001 1001 a10i 0000 rdacl #%1, %0 */ #line 1091 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 1091 "rx-decode.opc" int i AU = (op[2] >> 4) & 0x01; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 1001 a10i 0000 rdacl #%1, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" i = 0x%x\n", i); } SYNTAX("rdacl #%1, %0"); #line 1091 "rx-decode.opc" ID(rdacl); SC(i+1); DR(a+32); F_____; } break; default: UNSUPPORTED(); break; } break; case 0x1e: GETBYTE (); switch (op[2] & 0x30) { case 0x00: op_semantics_83: { /** 1111 1101 0001 111i a m00 rdst mvfachi #%2, %1, %0 */ #line 866 "rx-decode.opc" int i AU = op[1] & 0x01; #line 866 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 866 "rx-decode.opc" int m AU = (op[2] >> 6) & 0x01; #line 866 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 111i a m00 rdst mvfachi #%2, %1, %0 */", op[0], op[1], op[2]); printf (" i = 0x%x,", i); printf (" a = 0x%x,", a); printf (" m = 0x%x,", m); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvfachi #%2, %1, %0"); #line 866 "rx-decode.opc" ID(mvfachi); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____; } break; case 0x10: op_semantics_84: { /** 1111 1101 0001 111i a m01 rdst mvfaclo #%2, %1, %0 */ #line 872 "rx-decode.opc" int i AU = op[1] & 0x01; #line 872 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 872 "rx-decode.opc" int m AU = (op[2] >> 6) & 0x01; #line 872 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 111i a m01 rdst mvfaclo #%2, %1, %0 */", op[0], op[1], op[2]); printf (" i = 0x%x,", i); printf (" a = 0x%x,", a); printf (" m = 0x%x,", m); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvfaclo #%2, %1, %0"); #line 872 "rx-decode.opc" ID(mvfaclo); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____; } break; case 0x20: op_semantics_85: { /** 1111 1101 0001 111i a m10 rdst mvfacmi #%2, %1, %0 */ #line 869 "rx-decode.opc" int i AU = op[1] & 0x01; #line 869 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 869 "rx-decode.opc" int m AU = (op[2] >> 6) & 0x01; #line 869 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 111i a m10 rdst mvfacmi #%2, %1, %0 */", op[0], op[1], op[2]); printf (" i = 0x%x,", i); printf (" a = 0x%x,", a); printf (" m = 0x%x,", m); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvfacmi #%2, %1, %0"); #line 869 "rx-decode.opc" ID(mvfacmi); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____; } break; case 0x30: op_semantics_86: { /** 1111 1101 0001 111i a m11 rdst mvfacgu #%2, %1, %0 */ #line 1082 "rx-decode.opc" int i AU = op[1] & 0x01; #line 1082 "rx-decode.opc" int a AU = (op[2] >> 7) & 0x01; #line 1082 "rx-decode.opc" int m AU = (op[2] >> 6) & 0x01; #line 1082 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0001 111i a m11 rdst mvfacgu #%2, %1, %0 */", op[0], op[1], op[2]); printf (" i = 0x%x,", i); printf (" a = 0x%x,", a); printf (" m = 0x%x,", m); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvfacgu #%2, %1, %0"); #line 1082 "rx-decode.opc" ID(mvfacgu); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____; } break; } break; case 0x1f: GETBYTE (); switch (op[2] & 0x30) { case 0x00: goto op_semantics_83; break; case 0x10: goto op_semantics_84; break; case 0x20: goto op_semantics_85; break; case 0x30: goto op_semantics_86; break; } break; case 0x20: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_87: { /** 1111 1101 0010 0p sz rdst rsrc mov%s %1, %0 */ #line 344 "rx-decode.opc" int p AU = (op[1] >> 2) & 0x01; #line 344 "rx-decode.opc" int sz AU = op[1] & 0x03; #line 344 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 344 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0010 0p sz rdst rsrc mov%s %1, %0 */", op[0], op[1], op[2]); printf (" p = 0x%x,", p); printf (" sz = 0x%x,", sz); printf (" rdst = 0x%x,", rdst); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("mov%s %1, %0"); #line 344 "rx-decode.opc" ID(mov); sBWL (sz); SR(rsrc); F_____; OP(0, p ? RX_Operand_Predec : RX_Operand_Postinc, rdst, 0); } break; } break; case 0x21: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_87; break; } break; case 0x22: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_87; break; } break; case 0x24: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_87; break; } break; case 0x25: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_87; break; } break; case 0x26: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_87; break; } break; case 0x27: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0010 0111 rdst rsrc movco %1, [%0] */ #line 1046 "rx-decode.opc" int rdst AU = (op[2] >> 4) & 0x0f; #line 1046 "rx-decode.opc" int rsrc AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0010 0111 rdst rsrc movco %1, [%0] */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" rsrc = 0x%x\n", rsrc); } SYNTAX("movco %1, [%0]"); #line 1046 "rx-decode.opc" ID(movco); SR(rsrc); DR(rdst); F_____; } break; } break; case 0x28: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_88: { /** 1111 1101 0010 1p sz rsrc rdst mov%s %1, %0 */ #line 348 "rx-decode.opc" int p AU = (op[1] >> 2) & 0x01; #line 348 "rx-decode.opc" int sz AU = op[1] & 0x03; #line 348 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 348 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0010 1p sz rsrc rdst mov%s %1, %0 */", op[0], op[1], op[2]); printf (" p = 0x%x,", p); printf (" sz = 0x%x,", sz); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mov%s %1, %0"); #line 348 "rx-decode.opc" ID(mov); sBWL (sz); DR(rdst); F_____; OP(1, p ? RX_Operand_Predec : RX_Operand_Postinc, rsrc, 0); } break; } break; case 0x29: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_88; break; } break; case 0x2a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_88; break; } break; case 0x2c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_88; break; } break; case 0x2d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_88; break; } break; case 0x2e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_88; break; } break; case 0x2f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0010 1111 rsrc rdst movli [%1], %0 */ #line 1049 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1049 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0010 1111 rsrc rdst movli [%1], %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("movli [%1], %0"); #line 1049 "rx-decode.opc" ID(movli); SR(rsrc); DR(rdst); F_____; } break; } break; case 0x38: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_89: { /** 1111 1101 0011 1p sz rsrc rdst movu%s %1, %0 */ #line 358 "rx-decode.opc" int p AU = (op[1] >> 2) & 0x01; #line 358 "rx-decode.opc" int sz AU = op[1] & 0x03; #line 358 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 358 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0011 1p sz rsrc rdst movu%s %1, %0 */", op[0], op[1], op[2]); printf (" p = 0x%x,", p); printf (" sz = 0x%x,", sz); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("movu%s %1, %0"); #line 358 "rx-decode.opc" ID(mov); uBW (sz); DR(rdst); F_____; OP(1, p ? RX_Operand_Predec : RX_Operand_Postinc, rsrc, 0); /*----------------------------------------------------------------------*/ /* PUSH/POP */ } break; } break; case 0x39: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_89; break; } break; case 0x3a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_89; break; } break; case 0x3c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_89; break; } break; case 0x3d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_89; break; } break; case 0x3e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_89; break; } break; case 0x44: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_90: { /** 1111 1101 0100 a100 srca srcb msbhi %1, %2, %0 */ #line 1070 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1070 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1070 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0100 a100 srca srcb msbhi %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("msbhi %1, %2, %0"); #line 1070 "rx-decode.opc" ID(msbhi); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x45: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_91: { /** 1111 1101 0100 a101 srca srcb msblo %1, %2, %0 */ #line 1076 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1076 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1076 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0100 a101 srca srcb msblo %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("msblo %1, %2, %0"); #line 1076 "rx-decode.opc" ID(msblo); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x46: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_92: { /** 1111 1101 0100 a110 srca srcb msblh %1, %2, %0 */ #line 1073 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1073 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1073 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0100 a110 srca srcb msblh %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("msblh %1, %2, %0"); #line 1073 "rx-decode.opc" ID(msblh); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x47: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_93: { /** 1111 1101 0100 a111 srca srcb emsba %1, %2, %0 */ #line 1061 "rx-decode.opc" int a AU = (op[1] >> 3) & 0x01; #line 1061 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1061 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0100 a111 srca srcb emsba %1, %2, %0 */", op[0], op[1], op[2]); printf (" a = 0x%x,", a); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("emsba %1, %2, %0"); #line 1061 "rx-decode.opc" ID(emsba); DR(a+32); SR(srca); S2R(srcb); F_____; } break; } break; case 0x4c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_90; break; } break; case 0x4d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_91; break; } break; case 0x4e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_92; break; } break; case 0x4f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_93; break; } break; case 0x60: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0000 rsrc rdst shlr %2, %0 */ #line 729 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 729 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0000 rsrc rdst shlr %2, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shlr %2, %0"); #line 729 "rx-decode.opc" ID(shlr); S2R(rsrc); SR(rdst); DR(rdst); F__SZC; } break; } break; case 0x61: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0001 rsrc rdst shar %2, %0 */ #line 719 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 719 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0001 rsrc rdst shar %2, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shar %2, %0"); #line 719 "rx-decode.opc" ID(shar); S2R(rsrc); SR(rdst); DR(rdst); F_0SZC; } break; } break; case 0x62: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0010 rsrc rdst shll %2, %0 */ #line 709 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 709 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0010 rsrc rdst shll %2, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shll %2, %0"); #line 709 "rx-decode.opc" ID(shll); S2R(rsrc); SR(rdst); DR(rdst); F_OSZC; } break; } break; case 0x64: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0100 rsrc rdst rotr %1, %0 */ #line 753 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 753 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0100 rsrc rdst rotr %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("rotr %1, %0"); #line 753 "rx-decode.opc" ID(rotr); SR(rsrc); DR(rdst); F__SZC; } break; } break; case 0x65: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0101 rsrc rdst revw %1, %0 */ #line 756 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 756 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0101 rsrc rdst revw %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("revw %1, %0"); #line 756 "rx-decode.opc" ID(revw); SR(rsrc); DR(rdst); } break; } break; case 0x66: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0110 rsrc rdst rotl %1, %0 */ #line 747 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 747 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0110 rsrc rdst rotl %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("rotl %1, %0"); #line 747 "rx-decode.opc" ID(rotl); SR(rsrc); DR(rdst); F__SZC; } break; } break; case 0x67: GETBYTE (); switch (op[2] & 0x00) { case 0x00: { /** 1111 1101 0110 0111 rsrc rdst revl %1, %0 */ #line 759 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 759 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 0111 rsrc rdst revl %1, %0 */", op[0], op[1], op[2]); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("revl %1, %0"); #line 759 "rx-decode.opc" ID(revl); SR(rsrc); DR(rdst); /*----------------------------------------------------------------------*/ /* BRANCH */ } break; } break; case 0x68: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_94: { /** 1111 1101 0110 100c rsrc rdst mvtc %1, %0 */ #line 1010 "rx-decode.opc" int c AU = op[1] & 0x01; #line 1010 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1010 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 100c rsrc rdst mvtc %1, %0 */", op[0], op[1], op[2]); printf (" c = 0x%x,", c); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvtc %1, %0"); #line 1010 "rx-decode.opc" ID(mov); SR(rsrc); DR(c*16+rdst + 16); } break; } break; case 0x69: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_94; break; } break; case 0x6a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_95: { /** 1111 1101 0110 101s rsrc rdst mvfc %1, %0 */ #line 1013 "rx-decode.opc" int s AU = op[1] & 0x01; #line 1013 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 1013 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 101s rsrc rdst mvfc %1, %0 */", op[0], op[1], op[2]); printf (" s = 0x%x,", s); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mvfc %1, %0"); #line 1013 "rx-decode.opc" ID(mov); SR((s*16+rsrc) + 16); DR(rdst); /*----------------------------------------------------------------------*/ /* INTERRUPTS */ } break; } break; case 0x6b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_95; break; } break; case 0x6c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_96: { /** 1111 1101 0110 110i mmmm rdst rotr #%1, %0 */ #line 750 "rx-decode.opc" int i AU = op[1] & 0x01; #line 750 "rx-decode.opc" int mmmm AU = (op[2] >> 4) & 0x0f; #line 750 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 110i mmmm rdst rotr #%1, %0 */", op[0], op[1], op[2]); printf (" i = 0x%x,", i); printf (" mmmm = 0x%x,", mmmm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("rotr #%1, %0"); #line 750 "rx-decode.opc" ID(rotr); SC(i*16+mmmm); DR(rdst); F__SZC; } break; } break; case 0x6d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_96; break; } break; case 0x6e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_97: { /** 1111 1101 0110 111i mmmm rdst rotl #%1, %0 */ #line 744 "rx-decode.opc" int i AU = op[1] & 0x01; #line 744 "rx-decode.opc" int mmmm AU = (op[2] >> 4) & 0x0f; #line 744 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0110 111i mmmm rdst rotl #%1, %0 */", op[0], op[1], op[2]); printf (" i = 0x%x,", i); printf (" mmmm = 0x%x,", mmmm); printf (" rdst = 0x%x\n", rdst); } SYNTAX("rotl #%1, %0"); #line 744 "rx-decode.opc" ID(rotl); SC(i*16+mmmm); DR(rdst); F__SZC; } break; } break; case 0x6f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_97; break; } break; case 0x70: GETBYTE (); switch (op[2] & 0xf0) { case 0x20: op_semantics_98: { /** 1111 1101 0111 im00 0010rdst adc #%1, %0 */ #line 488 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 488 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 0010rdst adc #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("adc #%1, %0"); #line 488 "rx-decode.opc" ID(adc); SC(IMMex(im)); DR(rdst); F_OSZC; } break; case 0x40: op_semantics_99: { /** 1111 1101 0111 im00 0100rdst max #%1, %0 */ #line 570 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 570 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 0100rdst max #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("max #%1, %0"); #line 570 "rx-decode.opc" int val = IMMex (im); if (im == 0 && (unsigned) val == 0x80000000 && rdst == 0) { ID (nop7); SYNTAX("nop\t; max\t#0x80000000, r0"); } else { ID(max); } DR(rdst); SC(val); } break; case 0x50: op_semantics_100: { /** 1111 1101 0111 im00 0101rdst min #%1, %0 */ #line 600 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 600 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 0101rdst min #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("min #%1, %0"); #line 600 "rx-decode.opc" ID(min); DR(rdst); SC(IMMex(im)); } break; case 0x60: op_semantics_101: { /** 1111 1101 0111 im00 0110rdst emul #%1, %0 */ #line 658 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 658 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 0110rdst emul #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("emul #%1, %0"); #line 658 "rx-decode.opc" ID(emul); DR(rdst); SC(IMMex(im)); } break; case 0x70: op_semantics_102: { /** 1111 1101 0111 im00 0111rdst emulu #%1, %0 */ #line 670 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 670 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 0111rdst emulu #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("emulu #%1, %0"); #line 670 "rx-decode.opc" ID(emulu); DR(rdst); SC(IMMex(im)); } break; case 0x80: op_semantics_103: { /** 1111 1101 0111 im00 1000rdst div #%1, %0 */ #line 682 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 682 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 1000rdst div #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("div #%1, %0"); #line 682 "rx-decode.opc" ID(div); DR(rdst); SC(IMMex(im)); F_O___; } break; case 0x90: op_semantics_104: { /** 1111 1101 0111 im00 1001rdst divu #%1, %0 */ #line 694 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 694 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 1001rdst divu #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("divu #%1, %0"); #line 694 "rx-decode.opc" ID(divu); DR(rdst); SC(IMMex(im)); F_O___; } break; case 0xc0: op_semantics_105: { /** 1111 1101 0111 im00 1100rdst tst #%1, %2 */ #line 467 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 467 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 1100rdst tst #%1, %2 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("tst #%1, %2"); #line 467 "rx-decode.opc" ID(and); SC(IMMex(im)); S2R(rdst); F__SZ_; } break; case 0xd0: op_semantics_106: { /** 1111 1101 0111 im00 1101rdst xor #%1, %0 */ #line 446 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 446 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 1101rdst xor #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("xor #%1, %0"); #line 446 "rx-decode.opc" ID(xor); SC(IMMex(im)); DR(rdst); F__SZ_; } break; case 0xe0: op_semantics_107: { /** 1111 1101 0111 im00 1110rdst stz #%1, %0 */ #line 392 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 392 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 1110rdst stz #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("stz #%1, %0"); #line 392 "rx-decode.opc" ID(stcc); SC(IMMex(im)); DR(rdst); S2cc(RXC_z); } break; case 0xf0: op_semantics_108: { /** 1111 1101 0111 im00 1111rdst stnz #%1, %0 */ #line 395 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 395 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im00 1111rdst stnz #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" rdst = 0x%x\n", rdst); } SYNTAX("stnz #%1, %0"); #line 395 "rx-decode.opc" ID(stcc); SC(IMMex(im)); DR(rdst); S2cc(RXC_nz); /*----------------------------------------------------------------------*/ /* RTSD */ } break; default: UNSUPPORTED(); break; } break; case 0x72: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: { /** 1111 1101 0111 0010 0000 rdst fsub #%1, %0 */ #line 902 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 0010 0000 rdst fsub #%1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fsub #%1, %0"); #line 902 "rx-decode.opc" ID(fsub); DR(rdst); SC(IMM(0)); F__SZ_; } break; case 0x10: { /** 1111 1101 0111 0010 0001 rdst fcmp #%1, %0 */ #line 896 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 0010 0001 rdst fcmp #%1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fcmp #%1, %0"); #line 896 "rx-decode.opc" ID(fcmp); DR(rdst); SC(IMM(0)); F_OSZ_; } break; case 0x20: { /** 1111 1101 0111 0010 0010 rdst fadd #%1, %0 */ #line 890 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 0010 0010 rdst fadd #%1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fadd #%1, %0"); #line 890 "rx-decode.opc" ID(fadd); DR(rdst); SC(IMM(0)); F__SZ_; } break; case 0x30: { /** 1111 1101 0111 0010 0011 rdst fmul #%1, %0 */ #line 911 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 0010 0011 rdst fmul #%1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fmul #%1, %0"); #line 911 "rx-decode.opc" ID(fmul); DR(rdst); SC(IMM(0)); F__SZ_; } break; case 0x40: { /** 1111 1101 0111 0010 0100 rdst fdiv #%1, %0 */ #line 917 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 0010 0100 rdst fdiv #%1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x\n", rdst); } SYNTAX("fdiv #%1, %0"); #line 917 "rx-decode.opc" ID(fdiv); DR(rdst); SC(IMM(0)); F__SZ_; } break; default: UNSUPPORTED(); break; } break; case 0x73: GETBYTE (); switch (op[2] & 0xe0) { case 0x00: op_semantics_109: { /** 1111 1101 0111 im11 000crdst mvtc #%1, %0 */ #line 1007 "rx-decode.opc" int im AU = (op[1] >> 2) & 0x03; #line 1007 "rx-decode.opc" int crdst AU = op[2] & 0x1f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 0111 im11 000crdst mvtc #%1, %0 */", op[0], op[1], op[2]); printf (" im = 0x%x,", im); printf (" crdst = 0x%x\n", crdst); } SYNTAX("mvtc #%1, %0"); #line 1007 "rx-decode.opc" ID(mov); SC(IMMex(im)); DR(crdst + 16); } break; default: UNSUPPORTED(); break; } break; case 0x74: GETBYTE (); switch (op[2] & 0xf0) { case 0x20: goto op_semantics_98; break; case 0x40: goto op_semantics_99; break; case 0x50: goto op_semantics_100; break; case 0x60: goto op_semantics_101; break; case 0x70: goto op_semantics_102; break; case 0x80: goto op_semantics_103; break; case 0x90: goto op_semantics_104; break; case 0xc0: goto op_semantics_105; break; case 0xd0: goto op_semantics_106; break; case 0xe0: goto op_semantics_107; break; case 0xf0: goto op_semantics_108; break; default: UNSUPPORTED(); break; } break; case 0x77: GETBYTE (); switch (op[2] & 0xe0) { case 0x00: goto op_semantics_109; break; default: UNSUPPORTED(); break; } break; case 0x78: GETBYTE (); switch (op[2] & 0xf0) { case 0x20: goto op_semantics_98; break; case 0x40: goto op_semantics_99; break; case 0x50: goto op_semantics_100; break; case 0x60: goto op_semantics_101; break; case 0x70: goto op_semantics_102; break; case 0x80: goto op_semantics_103; break; case 0x90: goto op_semantics_104; break; case 0xc0: goto op_semantics_105; break; case 0xd0: goto op_semantics_106; break; case 0xe0: goto op_semantics_107; break; case 0xf0: goto op_semantics_108; break; default: UNSUPPORTED(); break; } break; case 0x7b: GETBYTE (); switch (op[2] & 0xe0) { case 0x00: goto op_semantics_109; break; default: UNSUPPORTED(); break; } break; case 0x7c: GETBYTE (); switch (op[2] & 0xf0) { case 0x20: goto op_semantics_98; break; case 0x40: goto op_semantics_99; break; case 0x50: goto op_semantics_100; break; case 0x60: goto op_semantics_101; break; case 0x70: goto op_semantics_102; break; case 0x80: goto op_semantics_103; break; case 0x90: goto op_semantics_104; break; case 0xc0: goto op_semantics_105; break; case 0xd0: goto op_semantics_106; break; case 0xe0: goto op_semantics_107; break; case 0xf0: goto op_semantics_108; break; default: UNSUPPORTED(); break; } break; case 0x7f: GETBYTE (); switch (op[2] & 0xe0) { case 0x00: goto op_semantics_109; break; default: UNSUPPORTED(); break; } break; case 0x80: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_110: { /** 1111 1101 100immmm rsrc rdst shlr #%2, %1, %0 */ #line 732 "rx-decode.opc" int immmm AU = op[1] & 0x1f; #line 732 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 732 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 100immmm rsrc rdst shlr #%2, %1, %0 */", op[0], op[1], op[2]); printf (" immmm = 0x%x,", immmm); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shlr #%2, %1, %0"); #line 732 "rx-decode.opc" ID(shlr); S2C(immmm); SR(rsrc); DR(rdst); F__SZC; /*----------------------------------------------------------------------*/ /* ROTATE */ } break; } break; case 0x81: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x82: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x83: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x84: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x85: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x86: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x87: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x88: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x89: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x8a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x8b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x8c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x8d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x8e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x8f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x90: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x91: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x92: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x93: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x94: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x95: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x96: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x97: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x98: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x99: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x9a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x9b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x9c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x9d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x9e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0x9f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_110; break; } break; case 0xa0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_111: { /** 1111 1101 101immmm rsrc rdst shar #%2, %1, %0 */ #line 722 "rx-decode.opc" int immmm AU = op[1] & 0x1f; #line 722 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 722 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 101immmm rsrc rdst shar #%2, %1, %0 */", op[0], op[1], op[2]); printf (" immmm = 0x%x,", immmm); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shar #%2, %1, %0"); #line 722 "rx-decode.opc" ID(shar); S2C(immmm); SR(rsrc); DR(rdst); F_0SZC; } break; } break; case 0xa1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xa9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xaa: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xab: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xac: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xad: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xae: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xaf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xb9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xba: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xbb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xbc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xbd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xbe: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xbf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_111; break; } break; case 0xc0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_112: { /** 1111 1101 110immmm rsrc rdst shll #%2, %1, %0 */ #line 712 "rx-decode.opc" int immmm AU = op[1] & 0x1f; #line 712 "rx-decode.opc" int rsrc AU = (op[2] >> 4) & 0x0f; #line 712 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 110immmm rsrc rdst shll #%2, %1, %0 */", op[0], op[1], op[2]); printf (" immmm = 0x%x,", immmm); printf (" rsrc = 0x%x,", rsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("shll #%2, %1, %0"); #line 712 "rx-decode.opc" ID(shll); S2C(immmm); SR(rsrc); DR(rdst); F_OSZC; } break; } break; case 0xc1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xc9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xca: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xcb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xcc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xcd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xce: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xcf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xd9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xda: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xdb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xdc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xdd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xde: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xdf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_112; break; } break; case 0xe0: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: op_semantics_113: { /** 1111 1101 111 bittt cond rdst bm%2 #%1, %0%S0 */ #line 986 "rx-decode.opc" int bittt AU = op[1] & 0x1f; #line 986 "rx-decode.opc" int cond AU = (op[2] >> 4) & 0x0f; #line 986 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 111 bittt cond rdst bm%2 #%1, %0%S0 */", op[0], op[1], op[2]); printf (" bittt = 0x%x,", bittt); printf (" cond = 0x%x,", cond); printf (" rdst = 0x%x\n", rdst); } SYNTAX("bm%2 #%1, %0%S0"); #line 986 "rx-decode.opc" ID(bmcc); BWL(LSIZE); S2cc(cond); SC(bittt); DR(rdst); /*----------------------------------------------------------------------*/ /* CONTROL REGISTERS */ } break; case 0xf0: op_semantics_114: { /** 1111 1101 111bittt 1111 rdst bnot #%1, %0 */ #line 979 "rx-decode.opc" int bittt AU = op[1] & 0x1f; #line 979 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1101 111bittt 1111 rdst bnot #%1, %0 */", op[0], op[1], op[2]); printf (" bittt = 0x%x,", bittt); printf (" rdst = 0x%x\n", rdst); } SYNTAX("bnot #%1, %0"); #line 979 "rx-decode.opc" ID(bnot); BWL(LSIZE); SC(bittt); DR(rdst); } break; } break; case 0xe1: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe2: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe3: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe4: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe5: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe6: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe7: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe8: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xe9: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xea: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xeb: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xec: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xed: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xee: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xef: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf0: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf1: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf2: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf3: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf4: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf5: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf6: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf7: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf8: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xf9: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xfa: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xfb: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xfc: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xfd: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xfe: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; case 0xff: GETBYTE (); switch (op[2] & 0xf0) { case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: goto op_semantics_113; break; case 0xf0: goto op_semantics_114; break; } break; default: UNSUPPORTED(); break; } break; case 0xfe: GETBYTE (); switch (op[1] & 0xff) { case 0x00: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_115: { /** 1111 1110 00sz isrc bsrc rdst mov%s %0, [%1, %2] */ #line 338 "rx-decode.opc" int sz AU = (op[1] >> 4) & 0x03; #line 338 "rx-decode.opc" int isrc AU = op[1] & 0x0f; #line 338 "rx-decode.opc" int bsrc AU = (op[2] >> 4) & 0x0f; #line 338 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1110 00sz isrc bsrc rdst mov%s %0, [%1, %2] */", op[0], op[1], op[2]); printf (" sz = 0x%x,", sz); printf (" isrc = 0x%x,", isrc); printf (" bsrc = 0x%x,", bsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mov%s %0, [%1, %2]"); #line 338 "rx-decode.opc" ID(movbir); sBWL(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____; } break; } break; case 0x01: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x02: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x03: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x04: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x05: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x06: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x07: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x08: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x09: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x0a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x0b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x0c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x0d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x0e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x0f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x10: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x11: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x12: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x13: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x14: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x15: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x16: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x17: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x18: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x19: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x1a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x1b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x1c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x1d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x1e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x1f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x20: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x21: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x22: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x23: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x24: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x25: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x26: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x27: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x28: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x29: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x2a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x2b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x2c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x2d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x2e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x2f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_115; break; } break; case 0x40: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_116: { /** 1111 1110 01sz isrc bsrc rdst mov%s [%1, %2], %0 */ #line 335 "rx-decode.opc" int sz AU = (op[1] >> 4) & 0x03; #line 335 "rx-decode.opc" int isrc AU = op[1] & 0x0f; #line 335 "rx-decode.opc" int bsrc AU = (op[2] >> 4) & 0x0f; #line 335 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1110 01sz isrc bsrc rdst mov%s [%1, %2], %0 */", op[0], op[1], op[2]); printf (" sz = 0x%x,", sz); printf (" isrc = 0x%x,", isrc); printf (" bsrc = 0x%x,", bsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("mov%s [%1, %2], %0"); #line 335 "rx-decode.opc" ID(movbi); sBWL(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____; } break; } break; case 0x41: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x42: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x43: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x44: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x45: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x46: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x47: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x48: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x49: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x4a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x4b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x4c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x4d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x4e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x4f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x50: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x51: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x52: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x53: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x54: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x55: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x56: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x57: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x58: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x59: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x5a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x5b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x5c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x5d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x5e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x5f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x60: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x61: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x62: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x63: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x64: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x65: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x66: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x67: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x68: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x69: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x6a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x6b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x6c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x6d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x6e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0x6f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_116; break; } break; case 0xc0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_117: { /** 1111 1110 11sz isrc bsrc rdst movu%s [%1, %2], %0 */ #line 341 "rx-decode.opc" int sz AU = (op[1] >> 4) & 0x03; #line 341 "rx-decode.opc" int isrc AU = op[1] & 0x0f; #line 341 "rx-decode.opc" int bsrc AU = (op[2] >> 4) & 0x0f; #line 341 "rx-decode.opc" int rdst AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1110 11sz isrc bsrc rdst movu%s [%1, %2], %0 */", op[0], op[1], op[2]); printf (" sz = 0x%x,", sz); printf (" isrc = 0x%x,", isrc); printf (" bsrc = 0x%x,", bsrc); printf (" rdst = 0x%x\n", rdst); } SYNTAX("movu%s [%1, %2], %0"); #line 341 "rx-decode.opc" ID(movbi); uBW(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____; } break; } break; case 0xc1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xc9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xca: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xcb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xcc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xcd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xce: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xcf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xd9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xda: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xdb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xdc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xdd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xde: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xdf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xe9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xea: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xeb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xec: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xed: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xee: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; case 0xef: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_117; break; } break; default: UNSUPPORTED(); break; } break; case 0xff: GETBYTE (); switch (op[1] & 0xff) { case 0x00: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_118: { /** 1111 1111 0000 rdst srca srcb sub %2, %1, %0 */ #line 545 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 545 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 545 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 0000 rdst srca srcb sub %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("sub %2, %1, %0"); #line 545 "rx-decode.opc" ID(sub); DR(rdst); SR(srcb); S2R(srca); F_OSZC; /*----------------------------------------------------------------------*/ /* SBB */ } break; } break; case 0x01: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x02: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x03: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x04: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x05: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x06: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x07: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x08: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x09: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x0a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x0b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x0c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x0d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x0e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x0f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_118; break; } break; case 0x20: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_119: { /** 1111 1111 0010 rdst srca srcb add %2, %1, %0 */ #line 512 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 512 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 512 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 0010 rdst srca srcb add %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("add %2, %1, %0"); #line 512 "rx-decode.opc" ID(add); DR(rdst); SR(srcb); S2R(srca); F_OSZC; /*----------------------------------------------------------------------*/ /* CMP */ } break; } break; case 0x21: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x22: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x23: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x24: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x25: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x26: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x27: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x28: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x29: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x2a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x2b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x2c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x2d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x2e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x2f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_119; break; } break; case 0x30: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_120: { /** 1111 1111 0011 rdst srca srcb mul %2, %1, %0 */ #line 652 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 652 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 652 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 0011 rdst srca srcb mul %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("mul %2, %1, %0"); #line 652 "rx-decode.opc" ID(mul); DR(rdst); SR(srcb); S2R(srca); F_____; /*----------------------------------------------------------------------*/ /* EMUL */ } break; } break; case 0x31: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x32: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x33: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x34: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x35: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x36: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x37: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x38: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x39: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x3a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x3b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x3c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x3d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x3e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x3f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_120; break; } break; case 0x40: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_121: { /** 1111 1111 0100 rdst srca srcb and %2, %1, %0 */ #line 422 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 422 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 422 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 0100 rdst srca srcb and %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("and %2, %1, %0"); #line 422 "rx-decode.opc" ID(and); DR(rdst); SR(srcb); S2R(srca); F__SZ_; /*----------------------------------------------------------------------*/ /* OR */ } break; } break; case 0x41: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x42: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x43: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x44: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x45: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x46: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x47: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x48: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x49: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x4a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x4b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x4c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x4d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x4e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x4f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_121; break; } break; case 0x50: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_122: { /** 1111 1111 0101 rdst srca srcb or %2, %1, %0 */ #line 440 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 440 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 440 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 0101 rdst srca srcb or %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("or %2, %1, %0"); #line 440 "rx-decode.opc" ID(or); DR(rdst); SR(srcb); S2R(srca); F__SZ_; /*----------------------------------------------------------------------*/ /* XOR */ } break; } break; case 0x51: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x52: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x53: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x54: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x55: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x56: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x57: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x58: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x59: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x5a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x5b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x5c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x5d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x5e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x5f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_122; break; } break; case 0x80: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_123: { /** 1111 1111 1000 rdst srca srcb fsub %2, %1, %0 */ #line 1100 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 1100 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1100 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 1000 rdst srca srcb fsub %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("fsub %2, %1, %0"); #line 1100 "rx-decode.opc" ID(fsub); DR(rdst); SR(srcb); S2R(srca); F__SZ_; } break; } break; case 0x81: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x82: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x83: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x84: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x85: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x86: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x87: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x88: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x89: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x8a: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x8b: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x8c: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x8d: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x8e: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0x8f: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_123; break; } break; case 0xa0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_124: { /** 1111 1111 1010 rdst srca srcb fadd %2, %1, %0 */ #line 1097 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 1097 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1097 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 1010 rdst srca srcb fadd %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("fadd %2, %1, %0"); #line 1097 "rx-decode.opc" ID(fadd); DR(rdst); SR(srcb); S2R(srca); F__SZ_; } break; } break; case 0xa1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xa9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xaa: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xab: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xac: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xad: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xae: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xaf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_124; break; } break; case 0xb0: GETBYTE (); switch (op[2] & 0x00) { case 0x00: op_semantics_125: { /** 1111 1111 1011 rdst srca srcb fmul %2, %1, %0 */ #line 1103 "rx-decode.opc" int rdst AU = op[1] & 0x0f; #line 1103 "rx-decode.opc" int srca AU = (op[2] >> 4) & 0x0f; #line 1103 "rx-decode.opc" int srcb AU = op[2] & 0x0f; if (trace) { printf ("\033[33m%s\033[0m %02x %02x %02x\n", "/** 1111 1111 1011 rdst srca srcb fmul %2, %1, %0 */", op[0], op[1], op[2]); printf (" rdst = 0x%x,", rdst); printf (" srca = 0x%x,", srca); printf (" srcb = 0x%x\n", srcb); } SYNTAX("fmul %2, %1, %0"); #line 1103 "rx-decode.opc" ID(fmul); DR(rdst); SR(srcb); S2R(srca); F__SZ_; } break; } break; case 0xb1: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb2: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb3: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb4: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb5: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb6: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb7: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb8: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xb9: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xba: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xbb: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xbc: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xbd: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xbe: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; case 0xbf: GETBYTE (); switch (op[2] & 0x00) { case 0x00: goto op_semantics_125; break; } break; default: UNSUPPORTED(); break; } break; default: UNSUPPORTED(); break; } #line 1118 "rx-decode.opc" return rx->n_bytes; }
swigger/gdb-ios
opcodes/rx-decode.c
C
gpl-2.0
485,336
// -*- c++ -*- // // Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana // University Research and Technology // Corporation. All rights reserved. // Copyright (c) 2004-2005 The University of Tennessee and The University // of Tennessee Research Foundation. All rights // reserved. // Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, // University of Stuttgart. All rights reserved. // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow // // $HEADER$ // class Exception { public: #if 0 /* OMPI_ENABLE_MPI_PROFILING */ inline Exception(int ec) : pmpi_exception(ec) { } int Get_error_code() const; int Get_error_class() const; const char* Get_error_string() const; #else inline Exception(int ec) : error_code(ec), error_string(0), error_class(-1) { (void)MPI_Error_class(error_code, &error_class); int resultlen; error_string = new char[MAX_ERROR_STRING]; (void)MPI_Error_string(error_code, error_string, &resultlen); } inline ~Exception() { delete[] error_string; } // Better put in a copy constructor here since we have a string; // copy by value (from the default copy constructor) would be // disasterous. inline Exception(const Exception& a) : error_code(a.error_code), error_class(a.error_class) { error_string = new char[MAX_ERROR_STRING]; // Rather that force an include of <string.h>, especially this // late in the game (recall that this file is included deep in // other .h files), we'll just do the copy ourselves. for (int i = 0; i < MAX_ERROR_STRING; i++) error_string[i] = a.error_string[i]; } inline int Get_error_code() const { return error_code; } inline int Get_error_class() const { return error_class; } inline const char* Get_error_string() const { return error_string; } #endif protected: #if 0 /* OMPI_ENABLE_MPI_PROFILING */ PMPI::Exception pmpi_exception; #else int error_code; char* error_string; int error_class; #endif };
mads-bertelsen/McCode
support/MacOSX/openmpi/10.9/openmpi-1.6.5/include/openmpi/ompi/mpi/cxx/exception.h
C
gpl-2.0
2,249
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #define pr_fmt(fmt) "BMS: %s: " fmt, __func__ #include <linux/module.h> #include <linux/types.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/of.h> #include <linux/of_device.h> #include <linux/power_supply.h> #include <linux/spmi.h> #include <linux/rtc.h> #include <linux/delay.h> #include <linux/sched.h> #include <linux/qpnp/qpnp-adc.h> #include <linux/qpnp/power-on.h> #include <linux/of_batterydata.h> /* BMS Register Offsets */ #define REVISION1 0x0 #define REVISION2 0x1 #define BMS1_STATUS1 0x8 #define BMS1_MODE_CTL 0X40 /* Coulomb counter clear registers */ #define BMS1_CC_DATA_CTL 0x42 #define BMS1_CC_CLEAR_CTL 0x43 /* BMS Tolerances */ #define BMS1_TOL_CTL 0X44 /* OCV limit registers */ #define BMS1_OCV_USE_LOW_LIMIT_THR0 0x48 #define BMS1_OCV_USE_LOW_LIMIT_THR1 0x49 #define BMS1_OCV_USE_HIGH_LIMIT_THR0 0x4A #define BMS1_OCV_USE_HIGH_LIMIT_THR1 0x4B #define BMS1_OCV_USE_LIMIT_CTL 0x4C /* Delay control */ #define BMS1_S1_DELAY_CTL 0x5A /* OCV interrupt threshold */ #define BMS1_OCV_THR0 0x50 #define BMS1_S2_SAMP_AVG_CTL 0x61 /* SW CC interrupt threshold */ #define BMS1_SW_CC_THR0 0xA0 /* OCV for r registers */ #define BMS1_OCV_FOR_R_DATA0 0x80 #define BMS1_VSENSE_FOR_R_DATA0 0x82 /* Coulomb counter data */ #define BMS1_CC_DATA0 0x8A /* Shadow Coulomb counter data */ #define BMS1_SW_CC_DATA0 0xA8 /* OCV for soc data */ #define BMS1_OCV_FOR_SOC_DATA0 0x90 #define BMS1_VSENSE_PON_DATA0 0x94 #define BMS1_VSENSE_AVG_DATA0 0x98 #define BMS1_VBAT_AVG_DATA0 0x9E /* Extra bms registers */ #define SOC_STORAGE_REG 0xB0 #define IAVG_STORAGE_REG 0xB1 #define BMS_FCC_COUNT 0xB2 #define BMS_FCC_BASE_REG 0xB3 /* FCC updates - 0xB3 to 0xB7 */ #define BMS_CHGCYL_BASE_REG 0xB8 /* FCC chgcyl - 0xB8 to 0xBC */ #define CHARGE_INCREASE_STORAGE 0xBD #define CHARGE_CYCLE_STORAGE_LSB 0xBE /* LSB=0xBE, MSB=0xBF */ /* IADC Channel Select */ #define IADC1_BMS_REVISION2 0x01 #define IADC1_BMS_ADC_CH_SEL_CTL 0x48 #define IADC1_BMS_ADC_INT_RSNSN_CTL 0x49 #define IADC1_BMS_FAST_AVG_EN 0x5B /* Configuration for saving of shutdown soc/iavg */ #define IGNORE_SOC_TEMP_DECIDEG 50 #define IAVG_STEP_SIZE_MA 10 #define IAVG_INVALID 0xFF #define SOC_INVALID 0x7E #define IAVG_SAMPLES 16 /* FCC learning constants */ #define MAX_FCC_CYCLES 5 #define DELTA_FCC_PERCENT 5 #define VALID_FCC_CHGCYL_RANGE 50 #define CHGCYL_RESOLUTION 20 #define FCC_DEFAULT_TEMP 250 #define QPNP_BMS_DEV_NAME "qcom,qpnp-bms" enum { SHDW_CC, CC }; enum { NORESET, RESET }; struct soc_params { int fcc_uah; int cc_uah; int rbatt_mohm; int iavg_ua; int uuc_uah; int ocv_charge_uah; int delta_time_s; }; struct raw_soc_params { uint16_t last_good_ocv_raw; int64_t cc; int64_t shdw_cc; int last_good_ocv_uv; }; struct fcc_sample { int fcc_new; int chargecycles; }; struct bms_irq { unsigned int irq; unsigned long disabled; bool ready; }; struct bms_wakeup_source { struct wakeup_source source; unsigned long disabled; }; struct qpnp_bms_chip { struct device *dev; struct power_supply bms_psy; bool bms_psy_registered; struct power_supply *batt_psy; struct spmi_device *spmi; wait_queue_head_t bms_wait_queue; u16 base; u16 iadc_base; u16 batt_pres_addr; u16 soc_storage_addr; u8 revision1; u8 revision2; u8 iadc_bms_revision1; u8 iadc_bms_revision2; int battery_present; int battery_status; bool batfet_closed; bool new_battery; bool done_charging; bool last_soc_invalid; /* platform data */ int r_sense_uohm; unsigned int v_cutoff_uv; int max_voltage_uv; int r_conn_mohm; int shutdown_soc_valid_limit; int adjust_soc_low_threshold; int chg_term_ua; enum battery_type batt_type; unsigned int fcc_mah; struct single_row_lut *fcc_temp_lut; struct single_row_lut *fcc_sf_lut; struct pc_temp_ocv_lut *pc_temp_ocv_lut; struct sf_lut *pc_sf_lut; struct sf_lut *rbatt_sf_lut; int default_rbatt_mohm; int rbatt_capacitive_mohm; int rbatt_mohm; struct delayed_work calculate_soc_delayed_work; struct work_struct recalc_work; struct work_struct batfet_open_work; struct mutex bms_output_lock; struct mutex last_ocv_uv_mutex; struct mutex vbat_monitor_mutex; struct mutex soc_invalidation_mutex; struct mutex last_soc_mutex; struct mutex status_lock; bool use_external_rsense; bool use_ocv_thresholds; bool ignore_shutdown_soc; bool shutdown_soc_invalid; int shutdown_soc; int shutdown_iavg_ma; struct wake_lock low_voltage_wake_lock; int low_voltage_threshold; int low_soc_calc_threshold; int low_soc_calculate_soc_ms; int low_voltage_calculate_soc_ms; int calculate_soc_ms; struct bms_wakeup_source soc_wake_source; struct wake_lock cv_wake_lock; uint16_t ocv_reading_at_100; uint16_t prev_last_good_ocv_raw; int insertion_ocv_uv; int last_ocv_uv; int charging_adjusted_ocv; int last_ocv_temp; int last_cc_uah; unsigned long last_soc_change_sec; unsigned long tm_sec; unsigned long report_tm_sec; bool first_time_calc_soc; bool first_time_calc_uuc; int64_t software_cc_uah; int64_t software_shdw_cc_uah; int iavg_samples_ma[IAVG_SAMPLES]; int iavg_index; int iavg_num_samples; struct timespec t_soc_queried; int last_soc; int last_soc_est; int last_soc_unbound; bool was_charging_at_sleep; int charge_start_tm_sec; int catch_up_time_sec; struct single_row_lut *adjusted_fcc_temp_lut; struct qpnp_adc_tm_btm_param vbat_monitor_params; struct qpnp_adc_tm_btm_param die_temp_monitor_params; int temperature_margin; unsigned int vadc_v0625; unsigned int vadc_v1250; int system_load_count; int prev_uuc_iavg_ma; int prev_pc_unusable; int ibat_at_cv_ua; int soc_at_cv; int prev_chg_soc; int calculated_soc; int prev_voltage_based_soc; bool use_voltage_soc; bool in_cv_range; int prev_batt_terminal_uv; int high_ocv_correction_limit_uv; int low_ocv_correction_limit_uv; int flat_ocv_threshold_uv; int hold_soc_est; int ocv_high_threshold_uv; int ocv_low_threshold_uv; unsigned long last_recalc_time; struct fcc_sample *fcc_learning_samples; u8 fcc_sample_count; int enable_fcc_learning; int min_fcc_learning_soc; int min_fcc_ocv_pc; int min_fcc_learning_samples; int start_soc; int end_soc; int start_pc; int start_cc_uah; int start_real_soc; int end_cc_uah; uint16_t fcc_new_mah; int fcc_new_batt_temp; uint16_t charge_cycles; u8 charge_increase; int fcc_resolution; bool battery_removed; struct bms_irq sw_cc_thr_irq; struct bms_irq ocv_thr_irq; struct qpnp_vadc_chip *vadc_dev; struct qpnp_iadc_chip *iadc_dev; struct qpnp_adc_tm_chip *adc_tm_dev; }; static struct of_device_id qpnp_bms_match_table[] = { { .compatible = QPNP_BMS_DEV_NAME }, {} }; static char *qpnp_bms_supplicants[] = { "battery" }; static enum power_supply_property msm_bms_power_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_RESISTANCE, POWER_SUPPLY_PROP_CHARGE_COUNTER, POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW, POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, POWER_SUPPLY_PROP_CHARGE_FULL, POWER_SUPPLY_PROP_CYCLE_COUNT, }; static int discard_backup_fcc_data(struct qpnp_bms_chip *chip); static void backup_charge_cycle(struct qpnp_bms_chip *chip); static bool bms_reset; static int qpnp_read_wrapper(struct qpnp_bms_chip *chip, u8 *val, u16 base, int count) { int rc; struct spmi_device *spmi = chip->spmi; rc = spmi_ext_register_readl(spmi->ctrl, spmi->sid, base, val, count); if (rc) { pr_err("SPMI read failed rc=%d\n", rc); return rc; } return 0; } static int qpnp_write_wrapper(struct qpnp_bms_chip *chip, u8 *val, u16 base, int count) { int rc; struct spmi_device *spmi = chip->spmi; rc = spmi_ext_register_writel(spmi->ctrl, spmi->sid, base, val, count); if (rc) { pr_err("SPMI write failed rc=%d\n", rc); return rc; } return 0; } static int qpnp_masked_write_base(struct qpnp_bms_chip *chip, u16 addr, u8 mask, u8 val) { int rc; u8 reg; rc = qpnp_read_wrapper(chip, &reg, addr, 1); if (rc) { pr_err("read failed addr = %03X, rc = %d\n", addr, rc); return rc; } reg &= ~mask; reg |= val & mask; rc = qpnp_write_wrapper(chip, &reg, addr, 1); if (rc) { pr_err("write failed addr = %03X, val = %02x, mask = %02x, reg = %02x, rc = %d\n", addr, val, mask, reg, rc); return rc; } return 0; } static int qpnp_masked_write_iadc(struct qpnp_bms_chip *chip, u16 addr, u8 mask, u8 val) { return qpnp_masked_write_base(chip, chip->iadc_base + addr, mask, val); } static int qpnp_masked_write(struct qpnp_bms_chip *chip, u16 addr, u8 mask, u8 val) { return qpnp_masked_write_base(chip, chip->base + addr, mask, val); } static void bms_stay_awake(struct bms_wakeup_source *source) { if (__test_and_clear_bit(0, &source->disabled)) { __pm_stay_awake(&source->source); pr_debug("enabled source %s\n", source->source.name); } } static void bms_relax(struct bms_wakeup_source *source) { if (!__test_and_set_bit(0, &source->disabled)) { __pm_relax(&source->source); pr_debug("disabled source %s\n", source->source.name); } } static void enable_bms_irq(struct bms_irq *irq) { if (irq->ready && __test_and_clear_bit(0, &irq->disabled)) { enable_irq(irq->irq); pr_debug("enabled irq %d\n", irq->irq); } } static void disable_bms_irq(struct bms_irq *irq) { if (irq->ready && !__test_and_set_bit(0, &irq->disabled)) { disable_irq(irq->irq); pr_debug("disabled irq %d\n", irq->irq); } } static void disable_bms_irq_nosync(struct bms_irq *irq) { if (irq->ready && !__test_and_set_bit(0, &irq->disabled)) { disable_irq_nosync(irq->irq); pr_debug("disabled irq %d\n", irq->irq); } } #define HOLD_OREG_DATA BIT(0) static int lock_output_data(struct qpnp_bms_chip *chip) { int rc; rc = qpnp_masked_write(chip, BMS1_CC_DATA_CTL, HOLD_OREG_DATA, HOLD_OREG_DATA); if (rc) { pr_err("couldnt lock bms output rc = %d\n", rc); return rc; } return 0; } static int unlock_output_data(struct qpnp_bms_chip *chip) { int rc; rc = qpnp_masked_write(chip, BMS1_CC_DATA_CTL, HOLD_OREG_DATA, 0); if (rc) { pr_err("fail to unlock BMS_CONTROL rc = %d\n", rc); return rc; } return 0; } #define V_PER_BIT_MUL_FACTOR 97656 #define V_PER_BIT_DIV_FACTOR 1000 #define VADC_INTRINSIC_OFFSET 0x6000 static int vadc_reading_to_uv(int reading) { if (reading <= VADC_INTRINSIC_OFFSET) return 0; return (reading - VADC_INTRINSIC_OFFSET) * V_PER_BIT_MUL_FACTOR / V_PER_BIT_DIV_FACTOR; } #define VADC_CALIB_UV 625000 #define VBATT_MUL_FACTOR 3 static int adjust_vbatt_reading(struct qpnp_bms_chip *chip, int reading_uv) { s64 numerator, denominator; if (reading_uv == 0) return 0; /* don't adjust if not calibrated */ if (chip->vadc_v0625 == 0 || chip->vadc_v1250 == 0) { pr_debug("No cal yet return %d\n", VBATT_MUL_FACTOR * reading_uv); return VBATT_MUL_FACTOR * reading_uv; } numerator = ((s64)reading_uv - chip->vadc_v0625) * VADC_CALIB_UV; denominator = (s64)chip->vadc_v1250 - chip->vadc_v0625; if (denominator == 0) return reading_uv * VBATT_MUL_FACTOR; return (VADC_CALIB_UV + div_s64(numerator, denominator)) * VBATT_MUL_FACTOR; } static int convert_vbatt_uv_to_raw(struct qpnp_bms_chip *chip, int unadjusted_vbatt) { int scaled_vbatt = unadjusted_vbatt / VBATT_MUL_FACTOR; if (scaled_vbatt <= 0) return VADC_INTRINSIC_OFFSET; return ((scaled_vbatt * V_PER_BIT_DIV_FACTOR) / V_PER_BIT_MUL_FACTOR) + VADC_INTRINSIC_OFFSET; } static inline int convert_vbatt_raw_to_uv(struct qpnp_bms_chip *chip, uint16_t reading) { int64_t uv; int rc; uv = vadc_reading_to_uv(reading); pr_debug("%u raw converted into %lld uv\n", reading, uv); uv = adjust_vbatt_reading(chip, uv); pr_debug("adjusted into %lld uv\n", uv); rc = qpnp_vbat_sns_comp_result(chip->vadc_dev, &uv); if (rc) pr_debug("could not compensate vbatt\n"); pr_debug("compensated into %lld uv\n", uv); return uv; } #define CC_READING_RESOLUTION_N 542535 #define CC_READING_RESOLUTION_D 100000 static s64 cc_reading_to_uv(s64 reading) { return div_s64(reading * CC_READING_RESOLUTION_N, CC_READING_RESOLUTION_D); } #define QPNP_ADC_GAIN_IDEAL 3291LL static s64 cc_adjust_for_gain(s64 uv, uint16_t gain) { s64 result_uv; pr_debug("adjusting_uv = %lld\n", uv); if (gain == 0) { pr_debug("gain is %d, not adjusting\n", gain); return uv; } pr_debug("adjusting by factor: %lld/%hu = %lld%%\n", QPNP_ADC_GAIN_IDEAL, gain, div_s64(QPNP_ADC_GAIN_IDEAL * 100LL, (s64)gain)); result_uv = div_s64(uv * QPNP_ADC_GAIN_IDEAL, (s64)gain); pr_debug("result_uv = %lld\n", result_uv); return result_uv; } static s64 cc_reverse_adjust_for_gain(struct qpnp_bms_chip *chip, s64 uv) { struct qpnp_iadc_calib calibration; int gain; s64 result_uv; qpnp_iadc_get_gain_and_offset(chip->iadc_dev, &calibration); gain = (int)calibration.gain_raw - (int)calibration.offset_raw; pr_debug("reverse adjusting_uv = %lld\n", uv); if (gain == 0) { pr_debug("gain is %d, not adjusting\n", gain); return uv; } pr_debug("adjusting by factor: %hu/%lld = %lld%%\n", gain, QPNP_ADC_GAIN_IDEAL, div64_s64((s64)gain * 100LL, (s64)QPNP_ADC_GAIN_IDEAL)); result_uv = div64_s64(uv * (s64)gain, QPNP_ADC_GAIN_IDEAL); pr_debug("result_uv = %lld\n", result_uv); return result_uv; } static int convert_vsense_to_uv(struct qpnp_bms_chip *chip, int16_t reading) { struct qpnp_iadc_calib calibration; qpnp_iadc_get_gain_and_offset(chip->iadc_dev, &calibration); return cc_adjust_for_gain(cc_reading_to_uv(reading), calibration.gain_raw - calibration.offset_raw); } static int read_vsense_avg(struct qpnp_bms_chip *chip, int *result_uv) { int rc; int16_t reading; rc = qpnp_read_wrapper(chip, (u8 *)&reading, chip->base + BMS1_VSENSE_AVG_DATA0, 2); if (rc) { pr_err("fail to read VSENSE_AVG rc = %d\n", rc); return rc; } *result_uv = convert_vsense_to_uv(chip, reading); return 0; } static int get_battery_current(struct qpnp_bms_chip *chip, int *result_ua) { int rc, vsense_uv = 0; int64_t temp_current; if (chip->r_sense_uohm == 0) { pr_err("r_sense is zero\n"); return -EINVAL; } mutex_lock(&chip->bms_output_lock); lock_output_data(chip); read_vsense_avg(chip, &vsense_uv); unlock_output_data(chip); mutex_unlock(&chip->bms_output_lock); pr_debug("vsense_uv=%duV\n", vsense_uv); /* cast for signed division */ temp_current = div_s64((vsense_uv * 1000000LL), (int)chip->r_sense_uohm); *result_ua = temp_current; rc = qpnp_iadc_comp_result(chip->iadc_dev, &temp_current); if (rc) pr_debug("error compensation failed: %d\n", rc); pr_debug("%d uA err compensated ibat=%llduA\n", *result_ua, temp_current); *result_ua = temp_current; return 0; } static int get_battery_voltage(struct qpnp_bms_chip *chip, int *result_uv) { int rc; struct qpnp_vadc_result adc_result; rc = qpnp_vadc_read(chip->vadc_dev, VBAT_SNS, &adc_result); if (rc) { pr_err("error reading adc channel = %d, rc = %d\n", VBAT_SNS, rc); return rc; } pr_debug("mvolts phy = %lld meas = 0x%llx\n", adc_result.physical, adc_result.measurement); *result_uv = (int)adc_result.physical; return 0; } #define CC_36_BIT_MASK 0xFFFFFFFFFLL static uint64_t convert_s64_to_s36(int64_t raw64) { return (uint64_t) raw64 & CC_36_BIT_MASK; } #define SIGN_EXTEND_36_TO_64_MASK (-1LL ^ CC_36_BIT_MASK) static int64_t convert_s36_to_s64(uint64_t raw36) { raw36 = raw36 & CC_36_BIT_MASK; /* convert 36 bit signed value into 64 signed value */ return (raw36 >> 35) == 0LL ? raw36 : (SIGN_EXTEND_36_TO_64_MASK | raw36); } static int read_cc_raw(struct qpnp_bms_chip *chip, int64_t *reading, int cc_type) { int64_t raw_reading; int rc; if (cc_type == SHDW_CC) rc = qpnp_read_wrapper(chip, (u8 *)&raw_reading, chip->base + BMS1_SW_CC_DATA0, 5); else rc = qpnp_read_wrapper(chip, (u8 *)&raw_reading, chip->base + BMS1_CC_DATA0, 5); if (rc) { pr_err("Error reading cc: rc = %d\n", rc); return -ENXIO; } *reading = convert_s36_to_s64(raw_reading); return 0; } static int calib_vadc(struct qpnp_bms_chip *chip) { int rc, raw_0625, raw_1250; struct qpnp_vadc_result result; rc = qpnp_vadc_read(chip->vadc_dev, REF_625MV, &result); if (rc) { pr_debug("vadc read failed with rc = %d\n", rc); return rc; } raw_0625 = result.adc_code; rc = qpnp_vadc_read(chip->vadc_dev, REF_125V, &result); if (rc) { pr_debug("vadc read failed with rc = %d\n", rc); return rc; } raw_1250 = result.adc_code; chip->vadc_v0625 = vadc_reading_to_uv(raw_0625); chip->vadc_v1250 = vadc_reading_to_uv(raw_1250); pr_debug("vadc calib: 0625 = %d raw (%d uv), 1250 = %d raw (%d uv)\n", raw_0625, chip->vadc_v0625, raw_1250, chip->vadc_v1250); return 0; } static void convert_and_store_ocv(struct qpnp_bms_chip *chip, struct raw_soc_params *raw, int batt_temp) { int rc; pr_debug("prev_last_good_ocv_raw = %d, last_good_ocv_raw = %d\n", chip->prev_last_good_ocv_raw, raw->last_good_ocv_raw); rc = calib_vadc(chip); if (rc) pr_err("Vadc reference voltage read failed, rc = %d\n", rc); chip->prev_last_good_ocv_raw = raw->last_good_ocv_raw; raw->last_good_ocv_uv = convert_vbatt_raw_to_uv(chip, raw->last_good_ocv_raw); chip->last_ocv_uv = raw->last_good_ocv_uv; chip->last_ocv_temp = batt_temp; chip->software_cc_uah = 0; pr_debug("last_good_ocv_uv = %d\n", raw->last_good_ocv_uv); } #define CLEAR_CC BIT(7) #define CLEAR_SHDW_CC BIT(6) /** * reset both cc and sw-cc. * note: this should only be ever called from one thread * or there may be a race condition where CC is never enabled * again */ static void reset_cc(struct qpnp_bms_chip *chip, u8 flags) { int rc; pr_debug("resetting cc manually with flags %hhu\n", flags); mutex_lock(&chip->bms_output_lock); rc = qpnp_masked_write(chip, BMS1_CC_CLEAR_CTL, flags, flags); if (rc) pr_err("cc reset failed: %d\n", rc); /* wait for 100us for cc to reset */ udelay(100); rc = qpnp_masked_write(chip, BMS1_CC_CLEAR_CTL, flags, 0); if (rc) pr_err("cc reenable failed: %d\n", rc); mutex_unlock(&chip->bms_output_lock); } static int get_battery_status(struct qpnp_bms_chip *chip) { union power_supply_propval ret = {0,}; if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the status property */ chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_STATUS, &ret); return ret.intval; } /* Default to false if the battery power supply is not registered. */ pr_debug("battery power supply is not registered\n"); return POWER_SUPPLY_STATUS_UNKNOWN; } static bool is_battery_charging(struct qpnp_bms_chip *chip) { union power_supply_propval ret = {0,}; if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the status property */ chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_CHARGE_TYPE, &ret); return ret.intval != POWER_SUPPLY_CHARGE_TYPE_NONE; } /* Default to false if the battery power supply is not registered. */ pr_debug("battery power supply is not registered\n"); return false; } static bool is_battery_full(struct qpnp_bms_chip *chip) { return get_battery_status(chip) == POWER_SUPPLY_STATUS_FULL; } #define BAT_PRES_BIT BIT(7) static bool is_battery_present(struct qpnp_bms_chip *chip) { union power_supply_propval ret = {0,}; int rc; u8 batt_pres; /* first try to use the batt_pres register if given */ if (chip->batt_pres_addr) { rc = qpnp_read_wrapper(chip, &batt_pres, chip->batt_pres_addr, 1); if (!rc && (batt_pres & BAT_PRES_BIT)) return true; else return false; } if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the present property */ chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_PRESENT, &ret); return ret.intval; } /* Default to false if the battery power supply is not registered. */ pr_debug("battery power supply is not registered\n"); return false; } static int get_battery_insertion_ocv_uv(struct qpnp_bms_chip *chip) { union power_supply_propval ret = {0,}; int rc, vbat; if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the ocv property */ rc = chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_VOLTAGE_OCV, &ret); if (rc) { /* * Default to vbatt if the battery OCV is not * registered. */ pr_debug("Battery psy does not have voltage ocv\n"); rc = get_battery_voltage(chip, &vbat); if (rc) return -EINVAL; return vbat; } return ret.intval; } pr_debug("battery power supply is not registered\n"); return -EINVAL; } static bool is_batfet_closed(struct qpnp_bms_chip *chip) { union power_supply_propval ret = {0,}; if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the online property */ chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_ONLINE, &ret); return !!ret.intval; } /* Default to true if the battery power supply is not registered. */ pr_debug("battery power supply is not registered\n"); return true; } static int get_simultaneous_batt_v_and_i(struct qpnp_bms_chip *chip, int *ibat_ua, int *vbat_uv) { struct qpnp_iadc_result i_result; struct qpnp_vadc_result v_result; enum qpnp_iadc_channels iadc_channel; int rc; iadc_channel = chip->use_external_rsense ? EXTERNAL_RSENSE : INTERNAL_RSENSE; if (is_battery_full(chip)) { rc = get_battery_current(chip, ibat_ua); if (rc) { pr_err("bms current read failed with rc: %d\n", rc); return rc; } rc = qpnp_vadc_read(chip->vadc_dev, VBAT_SNS, &v_result); if (rc) { pr_err("vadc read failed with rc: %d\n", rc); return rc; } *vbat_uv = (int)v_result.physical; } else { rc = qpnp_iadc_vadc_sync_read(chip->iadc_dev, iadc_channel, &i_result, VBAT_SNS, &v_result); if (rc) { pr_err("adc sync read failed with rc: %d\n", rc); return rc; } /* * reverse the current read by the iadc, since the bms uses * flipped battery current polarity. */ *ibat_ua = -1 * (int)i_result.result_ua; *vbat_uv = (int)v_result.physical; } return 0; } static int estimate_ocv(struct qpnp_bms_chip *chip) { int ibat_ua, vbat_uv, ocv_est_uv; int rc; int rbatt_mohm = chip->default_rbatt_mohm + chip->r_conn_mohm + chip->rbatt_capacitive_mohm; rc = get_simultaneous_batt_v_and_i(chip, &ibat_ua, &vbat_uv); if (rc) { pr_err("simultaneous failed rc = %d\n", rc); return rc; } ocv_est_uv = vbat_uv + (ibat_ua * rbatt_mohm) / 1000; pr_debug("estimated pon ocv = %d\n", ocv_est_uv); return ocv_est_uv; } static void reset_for_new_battery(struct qpnp_bms_chip *chip, int batt_temp) { chip->last_ocv_uv = chip->insertion_ocv_uv; mutex_lock(&chip->last_soc_mutex); chip->last_soc = -EINVAL; chip->last_soc_invalid = true; mutex_unlock(&chip->last_soc_mutex); chip->soc_at_cv = -EINVAL; chip->shutdown_soc_invalid = true; chip->shutdown_soc = 0; chip->shutdown_iavg_ma = 0; chip->prev_pc_unusable = -EINVAL; reset_cc(chip, CLEAR_CC | CLEAR_SHDW_CC); chip->software_cc_uah = 0; chip->software_shdw_cc_uah = 0; chip->last_cc_uah = INT_MIN; chip->last_ocv_temp = batt_temp; chip->prev_batt_terminal_uv = 0; if (chip->enable_fcc_learning) { chip->adjusted_fcc_temp_lut = NULL; chip->fcc_new_mah = -EINVAL; /* reset the charge-cycle and charge-increase registers */ chip->charge_increase = 0; chip->charge_cycles = 0; backup_charge_cycle(chip); /* discard all the FCC learnt data and reset the local table */ discard_backup_fcc_data(chip); memset(chip->fcc_learning_samples, 0, chip->min_fcc_learning_samples * sizeof(struct fcc_sample)); } } #define SIGN(x) ((x) < 0 ? -1 : 1) #define UV_PER_SPIN 50000 static int find_ocv_for_pc(struct qpnp_bms_chip *chip, int batt_temp, int pc) { int new_pc; int batt_temp_degc = batt_temp / 10; int ocv_mv; int delta_mv = 5; int max_spin_count; int count = 0; int sign, new_sign; ocv_mv = interpolate_ocv(chip->pc_temp_ocv_lut, batt_temp_degc, pc); new_pc = interpolate_pc(chip->pc_temp_ocv_lut, batt_temp_degc, ocv_mv); pr_debug("test revlookup pc = %d for ocv = %d\n", new_pc, ocv_mv); max_spin_count = 1 + (chip->max_voltage_uv - chip->v_cutoff_uv) / UV_PER_SPIN; sign = SIGN(pc - new_pc); while (abs(new_pc - pc) != 0 && count < max_spin_count) { /* * If the newly interpolated pc is larger than the lookup pc, * the ocv should be reduced and vice versa */ new_sign = SIGN(pc - new_pc); /* * If the sign has changed, then we have passed the lookup pc. * reduce the ocv step size to get finer results. * * If we have already reduced the ocv step size and still * passed the lookup pc, just stop and use the current ocv. * This can only happen if the batterydata profile is * non-monotonic anyways. */ if (new_sign != sign) { if (delta_mv > 1) delta_mv = 1; else break; } sign = new_sign; ocv_mv = ocv_mv + delta_mv * sign; new_pc = interpolate_pc(chip->pc_temp_ocv_lut, batt_temp_degc, ocv_mv); pr_debug("test revlookup pc = %d for ocv = %d\n", new_pc, ocv_mv); count++; } return ocv_mv * 1000; } #define OCV_RAW_UNINITIALIZED 0xFFFF #define MIN_OCV_UV 2000000 static int read_soc_params_raw(struct qpnp_bms_chip *chip, struct raw_soc_params *raw, int batt_temp) { int warm_reset, rc; mutex_lock(&chip->bms_output_lock); lock_output_data(chip); rc = qpnp_read_wrapper(chip, (u8 *)&raw->last_good_ocv_raw, chip->base + BMS1_OCV_FOR_SOC_DATA0, 2); if (rc) { pr_err("Error reading ocv: rc = %d\n", rc); return -ENXIO; } rc = read_cc_raw(chip, &raw->cc, CC); rc = read_cc_raw(chip, &raw->shdw_cc, SHDW_CC); if (rc) { pr_err("Failed to read raw cc data, rc = %d\n", rc); return rc; } unlock_output_data(chip); mutex_unlock(&chip->bms_output_lock); if (chip->prev_last_good_ocv_raw == OCV_RAW_UNINITIALIZED) { convert_and_store_ocv(chip, raw, batt_temp); pr_debug("PON_OCV_UV = %d, cc = %llx\n", chip->last_ocv_uv, raw->cc); warm_reset = qpnp_pon_is_warm_reset(); if (raw->last_good_ocv_uv < MIN_OCV_UV || warm_reset > 0) { pr_debug("OCV is stale or bad, estimating new OCV.\n"); chip->last_ocv_uv = estimate_ocv(chip); raw->last_good_ocv_uv = chip->last_ocv_uv; reset_cc(chip, CLEAR_CC | CLEAR_SHDW_CC); pr_debug("New PON_OCV_UV = %d, cc = %llx\n", chip->last_ocv_uv, raw->cc); } } else if (chip->new_battery) { /* if a new battery was inserted, estimate the ocv */ reset_for_new_battery(chip, batt_temp); raw->cc = 0; raw->shdw_cc = 0; raw->last_good_ocv_uv = chip->last_ocv_uv; chip->new_battery = false; } else if (chip->done_charging) { chip->done_charging = false; /* if we just finished charging, reset CC and fake 100% */ chip->ocv_reading_at_100 = raw->last_good_ocv_raw; chip->last_ocv_uv = find_ocv_for_pc(chip, batt_temp, 100); raw->last_good_ocv_uv = chip->last_ocv_uv; raw->cc = 0; raw->shdw_cc = 0; reset_cc(chip, CLEAR_CC | CLEAR_SHDW_CC); chip->last_ocv_temp = batt_temp; chip->software_cc_uah = 0; chip->software_shdw_cc_uah = 0; chip->last_cc_uah = INT_MIN; pr_debug("EOC Battery full ocv_reading = 0x%x\n", chip->ocv_reading_at_100); } else if (chip->prev_last_good_ocv_raw != raw->last_good_ocv_raw) { convert_and_store_ocv(chip, raw, batt_temp); /* forget the old cc value upon ocv */ chip->last_cc_uah = INT_MIN; } else { raw->last_good_ocv_uv = chip->last_ocv_uv; } /* stop faking a high OCV if we get a new OCV */ if (chip->ocv_reading_at_100 != raw->last_good_ocv_raw) chip->ocv_reading_at_100 = OCV_RAW_UNINITIALIZED; pr_debug("last_good_ocv_raw= 0x%x, last_good_ocv_uv= %duV\n", raw->last_good_ocv_raw, raw->last_good_ocv_uv); pr_debug("cc_raw= 0x%llx\n", raw->cc); return 0; } static int calculate_pc(struct qpnp_bms_chip *chip, int ocv_uv, int batt_temp) { int pc; pc = interpolate_pc(chip->pc_temp_ocv_lut, batt_temp / 10, ocv_uv / 1000); pr_debug("pc = %u %% for ocv = %d uv batt_temp = %d\n", pc, ocv_uv, batt_temp); /* Multiply the initial FCC value by the scale factor. */ return pc; } static int calculate_fcc(struct qpnp_bms_chip *chip, int batt_temp) { int fcc_uah; if (chip->adjusted_fcc_temp_lut == NULL) { /* interpolate_fcc returns a mv value. */ fcc_uah = interpolate_fcc(chip->fcc_temp_lut, batt_temp) * 1000; pr_debug("fcc = %d uAh\n", fcc_uah); return fcc_uah; } else { return 1000 * interpolate_fcc(chip->adjusted_fcc_temp_lut, batt_temp); } } /* calculate remaining charge at the time of ocv */ static int calculate_ocv_charge(struct qpnp_bms_chip *chip, struct raw_soc_params *raw, int fcc_uah) { int ocv_uv, pc; ocv_uv = raw->last_good_ocv_uv; pc = calculate_pc(chip, ocv_uv, chip->last_ocv_temp); pr_debug("ocv_uv = %d pc = %d\n", ocv_uv, pc); return (fcc_uah * pc) / 100; } #define CC_READING_TICKS 56 #define SLEEP_CLK_HZ 32764 #define SECONDS_PER_HOUR 3600 static s64 cc_uv_to_pvh(s64 cc_uv) { /* Note that it is necessary need to multiply by 1000000 to convert * from uvh to pvh here. * However, the maximum Coulomb Counter value is 2^35, which can cause * an over flow. * Multiply by 100000 first to perserve as much precision as possible * then multiply by 10 after doing the division in order to avoid * overflow on the maximum Coulomb Counter value. */ return div_s64(cc_uv * CC_READING_TICKS * 100000, SLEEP_CLK_HZ * SECONDS_PER_HOUR) * 10; } /** * calculate_cc() - converts a hardware coulomb counter reading into uah * @chip: the bms chip pointer * @cc: the cc reading from bms h/w * @cc_type: calcualte cc from regular or shadow coulomb counter * @clear_cc: whether this function should clear the hardware counter * after reading * * Converts the 64 bit hardware coulomb counter into microamp-hour by taking * into account hardware resolution and adc errors. * * Return: the coulomb counter based charge in uAh (micro-amp hour) */ static int calculate_cc(struct qpnp_bms_chip *chip, int64_t cc, int cc_type, int clear_cc) { struct qpnp_iadc_calib calibration; struct qpnp_vadc_result result; int64_t cc_voltage_uv, cc_pvh, cc_uah, *software_counter; int rc; software_counter = cc_type == SHDW_CC ? &chip->software_shdw_cc_uah : &chip->software_cc_uah; rc = qpnp_vadc_read(chip->vadc_dev, DIE_TEMP, &result); if (rc) { pr_err("could not read pmic die temperature: %d\n", rc); return *software_counter; } qpnp_iadc_get_gain_and_offset(chip->iadc_dev, &calibration); pr_debug("%scc = %lld, die_temp = %lld\n", cc_type == SHDW_CC ? "shdw_" : "", cc, result.physical); cc_voltage_uv = cc_reading_to_uv(cc); cc_voltage_uv = cc_adjust_for_gain(cc_voltage_uv, calibration.gain_raw - calibration.offset_raw); cc_pvh = cc_uv_to_pvh(cc_voltage_uv); cc_uah = div_s64(cc_pvh, chip->r_sense_uohm); rc = qpnp_iadc_comp_result(chip->iadc_dev, &cc_uah); if (rc) pr_debug("error compensation failed: %d\n", rc); if (clear_cc == RESET) { pr_debug("software_%scc = %lld, added cc_uah = %lld\n", cc_type == SHDW_CC ? "sw_" : "", *software_counter, cc_uah); *software_counter += cc_uah; reset_cc(chip, cc_type == SHDW_CC ? CLEAR_SHDW_CC : CLEAR_CC); return (int)*software_counter; } else { pr_debug("software_%scc = %lld, cc_uah = %lld, total = %lld\n", cc_type == SHDW_CC ? "shdw_" : "", *software_counter, cc_uah, *software_counter + cc_uah); return *software_counter + cc_uah; } } static int get_rbatt(struct qpnp_bms_chip *chip, int soc_rbatt_mohm, int batt_temp) { int rbatt_mohm, scalefactor; rbatt_mohm = chip->default_rbatt_mohm; if (chip->rbatt_sf_lut == NULL) { pr_debug("RBATT = %d\n", rbatt_mohm); return rbatt_mohm; } /* Convert the batt_temp to DegC from deciDegC */ batt_temp = batt_temp / 10; scalefactor = interpolate_scalingfactor(chip->rbatt_sf_lut, batt_temp, soc_rbatt_mohm); rbatt_mohm = (rbatt_mohm * scalefactor) / 100; rbatt_mohm += chip->r_conn_mohm; rbatt_mohm += chip->rbatt_capacitive_mohm; return rbatt_mohm; } #define IAVG_MINIMAL_TIME 2 static void calculate_iavg(struct qpnp_bms_chip *chip, int cc_uah, int *iavg_ua, int delta_time_s) { int delta_cc_uah = 0; /* * use the battery current if called too quickly */ if (delta_time_s < IAVG_MINIMAL_TIME || chip->last_cc_uah == INT_MIN) { get_battery_current(chip, iavg_ua); goto out; } delta_cc_uah = cc_uah - chip->last_cc_uah; *iavg_ua = div_s64((s64)delta_cc_uah * 3600, delta_time_s); out: pr_debug("delta_cc = %d iavg_ua = %d\n", delta_cc_uah, (int)*iavg_ua); /* remember cc_uah */ chip->last_cc_uah = cc_uah; } static int calculate_termination_uuc(struct qpnp_bms_chip *chip, struct soc_params *params, int batt_temp, int uuc_iavg_ma, int *ret_pc_unusable) { int unusable_uv, pc_unusable, uuc_uah; int i = 0; int ocv_mv; int batt_temp_degc = batt_temp / 10; int rbatt_mohm; int delta_uv; int prev_delta_uv = 0; int prev_rbatt_mohm = 0; int uuc_rbatt_mohm; for (i = 0; i <= 100; i++) { ocv_mv = interpolate_ocv(chip->pc_temp_ocv_lut, batt_temp_degc, i); rbatt_mohm = get_rbatt(chip, i, batt_temp); unusable_uv = (rbatt_mohm * uuc_iavg_ma) + (chip->v_cutoff_uv); delta_uv = ocv_mv * 1000 - unusable_uv; if (delta_uv > 0) break; prev_delta_uv = delta_uv; prev_rbatt_mohm = rbatt_mohm; } uuc_rbatt_mohm = linear_interpolate(rbatt_mohm, delta_uv, prev_rbatt_mohm, prev_delta_uv, 0); unusable_uv = (uuc_rbatt_mohm * uuc_iavg_ma) + (chip->v_cutoff_uv); pc_unusable = calculate_pc(chip, unusable_uv, batt_temp); uuc_uah = (params->fcc_uah * pc_unusable) / 100; pr_debug("For uuc_iavg_ma = %d, unusable_rbatt = %d unusable_uv = %d unusable_pc = %d rbatt_pc = %d uuc = %d\n", uuc_iavg_ma, uuc_rbatt_mohm, unusable_uv, pc_unusable, i, uuc_uah); *ret_pc_unusable = pc_unusable; return uuc_uah; } #define TIME_PER_PERCENT_UUC 60 static int adjust_uuc(struct qpnp_bms_chip *chip, struct soc_params *params, int new_pc_unusable, int new_uuc_uah, int batt_temp) { int new_unusable_mv, new_iavg_ma; int batt_temp_degc = batt_temp / 10; int max_percent_change; max_percent_change = max(params->delta_time_s / TIME_PER_PERCENT_UUC, 1); if (chip->prev_pc_unusable == -EINVAL || abs(chip->prev_pc_unusable - new_pc_unusable) <= max_percent_change) { chip->prev_pc_unusable = new_pc_unusable; return new_uuc_uah; } /* the uuc is trying to change more than 1% restrict it */ if (new_pc_unusable > chip->prev_pc_unusable) chip->prev_pc_unusable += max_percent_change; else chip->prev_pc_unusable -= max_percent_change; new_uuc_uah = (params->fcc_uah * chip->prev_pc_unusable) / 100; /* also find update the iavg_ma accordingly */ new_unusable_mv = interpolate_ocv(chip->pc_temp_ocv_lut, batt_temp_degc, chip->prev_pc_unusable); if (new_unusable_mv < chip->v_cutoff_uv/1000) new_unusable_mv = chip->v_cutoff_uv/1000; new_iavg_ma = (new_unusable_mv * 1000 - chip->v_cutoff_uv) / params->rbatt_mohm; if (new_iavg_ma == 0) new_iavg_ma = 1; chip->prev_uuc_iavg_ma = new_iavg_ma; pr_debug("Restricting UUC to %d (%d%%) unusable_mv = %d iavg_ma = %d\n", new_uuc_uah, chip->prev_pc_unusable, new_unusable_mv, new_iavg_ma); return new_uuc_uah; } #define MIN_IAVG_MA 250 static int calculate_unusable_charge_uah(struct qpnp_bms_chip *chip, struct soc_params *params, int batt_temp) { int uuc_uah_iavg; int i; int uuc_iavg_ma = params->iavg_ua / 1000; int pc_unusable; /* * if called first time, fill all the samples with * the shutdown_iavg_ma */ if (chip->first_time_calc_uuc && chip->shutdown_iavg_ma != 0) { pr_debug("Using shutdown_iavg_ma = %d in all samples\n", chip->shutdown_iavg_ma); for (i = 0; i < IAVG_SAMPLES; i++) chip->iavg_samples_ma[i] = chip->shutdown_iavg_ma; chip->iavg_index = 0; chip->iavg_num_samples = IAVG_SAMPLES; } if (params->delta_time_s >= IAVG_MINIMAL_TIME) { /* * if charging use a nominal avg current to keep * a reasonable UUC while charging */ if (uuc_iavg_ma < MIN_IAVG_MA) uuc_iavg_ma = MIN_IAVG_MA; chip->iavg_samples_ma[chip->iavg_index] = uuc_iavg_ma; chip->iavg_index = (chip->iavg_index + 1) % IAVG_SAMPLES; chip->iavg_num_samples++; if (chip->iavg_num_samples >= IAVG_SAMPLES) chip->iavg_num_samples = IAVG_SAMPLES; } /* now that this sample is added calcualte the average */ uuc_iavg_ma = 0; if (chip->iavg_num_samples != 0) { for (i = 0; i < chip->iavg_num_samples; i++) { pr_debug("iavg_samples_ma[%d] = %d\n", i, chip->iavg_samples_ma[i]); uuc_iavg_ma += chip->iavg_samples_ma[i]; } uuc_iavg_ma = DIV_ROUND_CLOSEST(uuc_iavg_ma, chip->iavg_num_samples); } /* * if we're in bms reset mode, force uuc to be 3% of fcc */ if (bms_reset) return (params->fcc_uah * 3) / 100; uuc_uah_iavg = calculate_termination_uuc(chip, params, batt_temp, uuc_iavg_ma, &pc_unusable); pr_debug("uuc_iavg_ma = %d uuc with iavg = %d\n", uuc_iavg_ma, uuc_uah_iavg); chip->prev_uuc_iavg_ma = uuc_iavg_ma; /* restrict the uuc such that it can increase only by one percent */ uuc_uah_iavg = adjust_uuc(chip, params, pc_unusable, uuc_uah_iavg, batt_temp); return uuc_uah_iavg; } static s64 find_ocv_charge_for_soc(struct qpnp_bms_chip *chip, struct soc_params *params, int soc) { return div_s64((s64)soc * (params->fcc_uah - params->uuc_uah), 100) + params->cc_uah + params->uuc_uah; } static int find_pc_for_soc(struct qpnp_bms_chip *chip, struct soc_params *params, int soc) { int ocv_charge_uah = find_ocv_charge_for_soc(chip, params, soc); int pc; pc = DIV_ROUND_CLOSEST((int)ocv_charge_uah * 100, params->fcc_uah); pc = clamp(pc, 0, 100); pr_debug("soc = %d, fcc = %d uuc = %d rc = %d pc = %d\n", soc, params->fcc_uah, params->uuc_uah, ocv_charge_uah, pc); return pc; } static int get_current_time(unsigned long *now_tm_sec) { struct rtc_time tm; struct rtc_device *rtc; int rc; rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); if (rtc == NULL) { pr_err("%s: unable to open rtc device (%s)\n", __FILE__, CONFIG_RTC_HCTOSYS_DEVICE); return -EINVAL; } rc = rtc_read_time(rtc, &tm); if (rc) { pr_err("Error reading rtc device (%s) : %d\n", CONFIG_RTC_HCTOSYS_DEVICE, rc); goto close_time; } rc = rtc_valid_tm(&tm); if (rc) { pr_err("Invalid RTC time (%s): %d\n", CONFIG_RTC_HCTOSYS_DEVICE, rc); goto close_time; } rtc_tm_to_time(&tm, now_tm_sec); close_time: rtc_class_close(rtc); return rc; } /* Returns estimated battery resistance */ static int get_prop_bms_batt_resistance(struct qpnp_bms_chip *chip) { return chip->rbatt_mohm * 1000; } /* Returns instantaneous current in uA */ static int get_prop_bms_current_now(struct qpnp_bms_chip *chip) { int rc, result_ua; rc = get_battery_current(chip, &result_ua); if (rc) { pr_err("failed to get current: %d\n", rc); return rc; } return result_ua; } /* Returns coulomb counter in uAh */ static int get_prop_bms_charge_counter(struct qpnp_bms_chip *chip) { int64_t cc_raw; mutex_lock(&chip->bms_output_lock); lock_output_data(chip); read_cc_raw(chip, &cc_raw, false); unlock_output_data(chip); mutex_unlock(&chip->bms_output_lock); return calculate_cc(chip, cc_raw, CC, NORESET); } /* Returns shadow coulomb counter in uAh */ static int get_prop_bms_charge_counter_shadow(struct qpnp_bms_chip *chip) { int64_t cc_raw; mutex_lock(&chip->bms_output_lock); lock_output_data(chip); read_cc_raw(chip, &cc_raw, true); unlock_output_data(chip); mutex_unlock(&chip->bms_output_lock); return calculate_cc(chip, cc_raw, SHDW_CC, NORESET); } /* Returns full charge design in uAh */ static int get_prop_bms_charge_full_design(struct qpnp_bms_chip *chip) { return chip->fcc_mah * 1000; } /* Returns the current full charge in uAh */ static int get_prop_bms_charge_full(struct qpnp_bms_chip *chip) { int rc; struct qpnp_vadc_result result; rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &result); if (rc) { pr_err("Unable to read battery temperature\n"); return rc; } return calculate_fcc(chip, (int)result.physical); } static int calculate_delta_time(unsigned long *time_stamp, int *delta_time_s) { unsigned long now_tm_sec = 0; /* default to delta time = 0 if anything fails */ *delta_time_s = 0; if (get_current_time(&now_tm_sec)) { pr_err("RTC read failed\n"); return 0; } *delta_time_s = (now_tm_sec - *time_stamp); /* remember this time */ *time_stamp = now_tm_sec; return 0; } static void calculate_soc_params(struct qpnp_bms_chip *chip, struct raw_soc_params *raw, struct soc_params *params, int batt_temp) { int soc_rbatt, shdw_cc_uah; calculate_delta_time(&chip->tm_sec, &params->delta_time_s); pr_debug("tm_sec = %ld, delta_s = %d\n", chip->tm_sec, params->delta_time_s); params->fcc_uah = calculate_fcc(chip, batt_temp); pr_debug("FCC = %uuAh batt_temp = %d\n", params->fcc_uah, batt_temp); /* calculate remainging charge */ params->ocv_charge_uah = calculate_ocv_charge( chip, raw, params->fcc_uah); pr_debug("ocv_charge_uah = %uuAh\n", params->ocv_charge_uah); /* calculate cc micro_volt_hour */ params->cc_uah = calculate_cc(chip, raw->cc, CC, RESET); shdw_cc_uah = calculate_cc(chip, raw->shdw_cc, SHDW_CC, RESET); pr_debug("cc_uah = %duAh raw->cc = %llx, shdw_cc_uah = %duAh raw->shdw_cc = %llx\n", params->cc_uah, raw->cc, shdw_cc_uah, raw->shdw_cc); soc_rbatt = ((params->ocv_charge_uah - params->cc_uah) * 100) / params->fcc_uah; if (soc_rbatt < 0) soc_rbatt = 0; params->rbatt_mohm = get_rbatt(chip, soc_rbatt, batt_temp); pr_debug("rbatt_mohm = %d\n", params->rbatt_mohm); if (params->rbatt_mohm != chip->rbatt_mohm) { chip->rbatt_mohm = params->rbatt_mohm; if (chip->bms_psy_registered) power_supply_changed(&chip->bms_psy); } calculate_iavg(chip, params->cc_uah, &params->iavg_ua, params->delta_time_s); params->uuc_uah = calculate_unusable_charge_uah(chip, params, batt_temp); pr_debug("UUC = %uuAh\n", params->uuc_uah); } static int bound_soc(int soc) { soc = max(0, soc); soc = min(100, soc); return soc; } #define IBAT_TOL_MASK 0x0F #define OCV_TOL_MASK 0xF0 #define IBAT_TOL_DEFAULT 0x03 #define IBAT_TOL_NOCHG 0x0F #define OCV_TOL_DEFAULT 0x20 #define OCV_TOL_NO_OCV 0x00 static int stop_ocv_updates(struct qpnp_bms_chip *chip) { pr_debug("stopping ocv updates\n"); return qpnp_masked_write(chip, BMS1_TOL_CTL, OCV_TOL_MASK, OCV_TOL_NO_OCV); } static int reset_bms_for_test(struct qpnp_bms_chip *chip) { int ibat_ua = 0, vbat_uv = 0, rc; int ocv_est_uv; if (!chip) { pr_err("BMS driver has not been initialized yet!\n"); return -EINVAL; } rc = get_simultaneous_batt_v_and_i(chip, &ibat_ua, &vbat_uv); /* * Don't include rbatt and rbatt_capacitative since we expect this to * be used with a fake battery which does not have internal resistances */ ocv_est_uv = vbat_uv + (ibat_ua * chip->r_conn_mohm) / 1000; pr_debug("forcing ocv to be %d due to bms reset mode\n", ocv_est_uv); chip->last_ocv_uv = ocv_est_uv; mutex_lock(&chip->last_soc_mutex); chip->last_soc = -EINVAL; chip->last_soc_invalid = true; mutex_unlock(&chip->last_soc_mutex); reset_cc(chip, CLEAR_CC | CLEAR_SHDW_CC); chip->software_cc_uah = 0; chip->software_shdw_cc_uah = 0; chip->last_cc_uah = INT_MIN; stop_ocv_updates(chip); pr_debug("bms reset to ocv = %duv vbat_ua = %d ibat_ua = %d\n", chip->last_ocv_uv, vbat_uv, ibat_ua); return rc; } static int bms_reset_set(const char *val, const struct kernel_param *kp) { int rc; rc = param_set_bool(val, kp); if (rc) { pr_err("Unable to set bms_reset: %d\n", rc); return rc; } if (*(bool *)kp->arg) { struct power_supply *bms_psy = power_supply_get_by_name("bms"); struct qpnp_bms_chip *chip = container_of(bms_psy, struct qpnp_bms_chip, bms_psy); rc = reset_bms_for_test(chip); if (rc) { pr_err("Unable to modify bms_reset: %d\n", rc); return rc; } } return 0; } static struct kernel_param_ops bms_reset_ops = { .set = bms_reset_set, .get = param_get_bool, }; module_param_cb(bms_reset, &bms_reset_ops, &bms_reset, 0644); #define SOC_STORAGE_MASK 0xFE static void backup_soc_and_iavg(struct qpnp_bms_chip *chip, int batt_temp, int soc) { u8 temp; int rc; int iavg_ma = chip->prev_uuc_iavg_ma; if (iavg_ma > MIN_IAVG_MA) temp = (iavg_ma - MIN_IAVG_MA) / IAVG_STEP_SIZE_MA; else temp = 0; rc = qpnp_write_wrapper(chip, &temp, chip->base + IAVG_STORAGE_REG, 1); /* store an invalid soc if temperature is below 5degC */ if (batt_temp > IGNORE_SOC_TEMP_DECIDEG) qpnp_masked_write_base(chip, chip->soc_storage_addr, SOC_STORAGE_MASK, (soc + 1) << 1); else qpnp_masked_write_base(chip, chip->soc_storage_addr, SOC_STORAGE_MASK, SOC_STORAGE_MASK); } static int scale_soc_while_chg(struct qpnp_bms_chip *chip, int chg_time_sec, int catch_up_sec, int new_soc, int prev_soc) { int scaled_soc; int numerator; /* * Don't report a high value immediately slowly scale the * value from prev_soc to the new soc based on a charge time * weighted average */ pr_debug("cts = %d catch_up_sec = %d\n", chg_time_sec, catch_up_sec); if (catch_up_sec == 0) return new_soc; if (chg_time_sec > catch_up_sec) return new_soc; numerator = (catch_up_sec - chg_time_sec) * prev_soc + chg_time_sec * new_soc; scaled_soc = numerator / catch_up_sec; pr_debug("cts = %d new_soc = %d prev_soc = %d scaled_soc = %d\n", chg_time_sec, new_soc, prev_soc, scaled_soc); return scaled_soc; } /* * bms_fake_battery is set in setups where a battery emulator is used instead * of a real battery. This makes the bms driver report a different/fake value * regardless of the calculated state of charge. */ static int bms_fake_battery = -EINVAL; module_param(bms_fake_battery, int, 0644); static int report_voltage_based_soc(struct qpnp_bms_chip *chip) { pr_debug("Reported voltage based soc = %d\n", chip->prev_voltage_based_soc); return chip->prev_voltage_based_soc; } #define SOC_CATCHUP_SEC_MAX 600 #define SOC_CATCHUP_SEC_PER_PERCENT 60 #define MAX_CATCHUP_SOC (SOC_CATCHUP_SEC_MAX / SOC_CATCHUP_SEC_PER_PERCENT) #define SOC_CHANGE_PER_SEC 5 #define REPORT_SOC_WAIT_MS 10000 static int report_cc_based_soc(struct qpnp_bms_chip *chip) { int soc, soc_change; int time_since_last_change_sec, charge_time_sec = 0; unsigned long last_change_sec; struct timespec now; struct qpnp_vadc_result result; int batt_temp; int rc; bool charging, charging_since_last_report; rc = wait_event_interruptible_timeout(chip->bms_wait_queue, chip->calculated_soc != -EINVAL, round_jiffies_relative(msecs_to_jiffies (REPORT_SOC_WAIT_MS))); if (rc == 0 && chip->calculated_soc == -EINVAL) { pr_debug("calculate soc timed out\n"); } else if (rc == -ERESTARTSYS) { pr_err("Wait for SoC interrupted.\n"); return rc; } rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &result); if (rc) { pr_err("error reading adc channel = %d, rc = %d\n", LR_MUX1_BATT_THERM, rc); return rc; } pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical, result.measurement); batt_temp = (int)result.physical; mutex_lock(&chip->last_soc_mutex); soc = chip->calculated_soc; last_change_sec = chip->last_soc_change_sec; calculate_delta_time(&last_change_sec, &time_since_last_change_sec); charging = is_battery_charging(chip); charging_since_last_report = charging || (chip->last_soc_unbound && chip->was_charging_at_sleep); /* * account for charge time - limit it to SOC_CATCHUP_SEC to * avoid overflows when charging continues for extended periods */ if (charging) { if (chip->charge_start_tm_sec == 0) { /* * calculating soc for the first time * after start of chg. Initialize catchup time */ if (abs(soc - chip->last_soc) < MAX_CATCHUP_SOC) chip->catch_up_time_sec = (soc - chip->last_soc) * SOC_CATCHUP_SEC_PER_PERCENT; else chip->catch_up_time_sec = SOC_CATCHUP_SEC_MAX; if (chip->catch_up_time_sec < 0) chip->catch_up_time_sec = 0; chip->charge_start_tm_sec = last_change_sec; } charge_time_sec = min(SOC_CATCHUP_SEC_MAX, (int)last_change_sec - chip->charge_start_tm_sec); /* end catchup if calculated soc and last soc are same */ if (chip->last_soc == soc) chip->catch_up_time_sec = 0; } if (chip->last_soc != -EINVAL) { /* * last_soc < soc ... if we have not been charging at all * since the last time this was called, report previous SoC. * Otherwise, scale and catch up. */ if (chip->last_soc < soc && !charging_since_last_report) soc = chip->last_soc; else if (chip->last_soc < soc && soc != 100) soc = scale_soc_while_chg(chip, charge_time_sec, chip->catch_up_time_sec, soc, chip->last_soc); /* if the battery is close to cutoff allow more change */ if (wake_lock_active(&chip->low_voltage_wake_lock)) soc_change = min((int)abs(chip->last_soc - soc), time_since_last_change_sec); else soc_change = min((int)abs(chip->last_soc - soc), time_since_last_change_sec / SOC_CHANGE_PER_SEC); if (chip->last_soc_unbound) { chip->last_soc_unbound = false; } else { /* * if soc have not been unbound by resume, * only change reported SoC by 1. */ soc_change = min(1, soc_change); } if (soc < chip->last_soc && soc != 0) soc = chip->last_soc - soc_change; if (soc > chip->last_soc && soc != 100) soc = chip->last_soc + soc_change; } if (chip->last_soc != soc && !chip->last_soc_unbound) chip->last_soc_change_sec = last_change_sec; pr_debug("last_soc = %d, calculated_soc = %d, soc = %d, time since last change = %d\n", chip->last_soc, chip->calculated_soc, soc, time_since_last_change_sec); chip->last_soc = bound_soc(soc); backup_soc_and_iavg(chip, batt_temp, chip->last_soc); pr_debug("Reported SOC = %d\n", chip->last_soc); chip->t_soc_queried = now; mutex_unlock(&chip->last_soc_mutex); return soc; } static int report_state_of_charge(struct qpnp_bms_chip *chip) { if (bms_fake_battery != -EINVAL) { pr_debug("Returning Fake SOC = %d%%\n", bms_fake_battery); return bms_fake_battery; } else if (chip->use_voltage_soc) return report_voltage_based_soc(chip); else return report_cc_based_soc(chip); } #define VDD_MAX_ERR 5000 #define VDD_STEP_SIZE 10000 #define MAX_COUNT_BEFORE_RESET_TO_CC 3 static int charging_adjustments(struct qpnp_bms_chip *chip, struct soc_params *params, int soc, int vbat_uv, int ibat_ua, int batt_temp) { int chg_soc, soc_ibat, batt_terminal_uv, weight_ibat, weight_cc; batt_terminal_uv = vbat_uv + (ibat_ua * chip->r_conn_mohm) / 1000; if (chip->soc_at_cv == -EINVAL) { if (batt_terminal_uv >= chip->max_voltage_uv - VDD_MAX_ERR) { chip->soc_at_cv = soc; chip->prev_chg_soc = soc; chip->ibat_at_cv_ua = params->iavg_ua; pr_debug("CC_TO_CV ibat_ua = %d CHG SOC %d\n", ibat_ua, soc); } else { /* In constant current charging return the calc soc */ pr_debug("CC CHG SOC %d\n", soc); } chip->prev_batt_terminal_uv = batt_terminal_uv; chip->system_load_count = 0; return soc; } else if (ibat_ua > 0 && batt_terminal_uv < chip->max_voltage_uv - (VDD_MAX_ERR * 2)) { if (chip->system_load_count > MAX_COUNT_BEFORE_RESET_TO_CC) { chip->soc_at_cv = -EINVAL; pr_debug("Vbat below CV threshold, resetting CC_TO_CV\n"); chip->system_load_count = 0; } else { chip->system_load_count += 1; pr_debug("Vbat below CV threshold, count: %d\n", chip->system_load_count); } return soc; } else if (ibat_ua > 0) { pr_debug("NOT CHARGING SOC %d\n", soc); chip->system_load_count = 0; chip->prev_chg_soc = soc; return soc; } chip->system_load_count = 0; /* * battery is in CV phase - begin linear interpolation of soc based on * battery charge current */ /* * if voltage lessened (possibly because of a system load) * keep reporting the prev chg soc */ if (batt_terminal_uv <= chip->prev_batt_terminal_uv - VDD_STEP_SIZE) { pr_debug("batt_terminal_uv %d < (max = %d - 10000); CC CHG SOC %d\n", batt_terminal_uv, chip->prev_batt_terminal_uv, chip->prev_chg_soc); chip->prev_batt_terminal_uv = batt_terminal_uv; return chip->prev_chg_soc; } soc_ibat = bound_soc(linear_interpolate(chip->soc_at_cv, chip->ibat_at_cv_ua, 100, -1 * chip->chg_term_ua, params->iavg_ua)); weight_ibat = bound_soc(linear_interpolate(1, chip->soc_at_cv, 100, 100, chip->prev_chg_soc)); weight_cc = 100 - weight_ibat; chg_soc = bound_soc(DIV_ROUND_CLOSEST(soc_ibat * weight_ibat + weight_cc * soc, 100)); pr_debug("weight_ibat = %d, weight_cc = %d, soc_ibat = %d, soc_cc = %d\n", weight_ibat, weight_cc, soc_ibat, soc); /* always report a higher soc */ if (chg_soc > chip->prev_chg_soc) { chip->prev_chg_soc = chg_soc; chip->charging_adjusted_ocv = find_ocv_for_pc(chip, batt_temp, find_pc_for_soc(chip, params, chg_soc)); pr_debug("CC CHG ADJ OCV = %d CHG SOC %d\n", chip->charging_adjusted_ocv, chip->prev_chg_soc); } pr_debug("Reporting CHG SOC %d\n", chip->prev_chg_soc); chip->prev_batt_terminal_uv = batt_terminal_uv; return chip->prev_chg_soc; } static void very_low_voltage_check(struct qpnp_bms_chip *chip, int vbat_uv) { /* * if battery is very low (v_cutoff voltage + 20mv) hold * a wakelock untill soc = 0% */ if (vbat_uv <= chip->low_voltage_threshold && !wake_lock_active(&chip->low_voltage_wake_lock)) { pr_debug("voltage = %d low holding wakelock\n", vbat_uv); wake_lock(&chip->low_voltage_wake_lock); } else if (vbat_uv > chip->low_voltage_threshold && wake_lock_active(&chip->low_voltage_wake_lock)) { pr_debug("voltage = %d releasing wakelock\n", vbat_uv); wake_unlock(&chip->low_voltage_wake_lock); } } #define VBATT_ERROR_MARGIN 20000 static void cv_voltage_check(struct qpnp_bms_chip *chip, int vbat_uv) { /* * if battery is very low (v_cutoff voltage + 20mv) hold * a wakelock untill soc = 0% */ if (wake_lock_active(&chip->cv_wake_lock)) { if (chip->soc_at_cv != -EINVAL) { pr_debug("hit CV, releasing cv wakelock\n"); wake_unlock(&chip->cv_wake_lock); } else if (!is_battery_charging(chip)) { pr_debug("charging stopped, releasing cv wakelock\n"); wake_unlock(&chip->cv_wake_lock); } } else if (vbat_uv > chip->max_voltage_uv - VBATT_ERROR_MARGIN && chip->soc_at_cv == -EINVAL && is_battery_charging(chip) && !wake_lock_active(&chip->cv_wake_lock)) { pr_debug("voltage = %d holding cv wakelock\n", vbat_uv); wake_lock(&chip->cv_wake_lock); } } #define NO_ADJUST_HIGH_SOC_THRESHOLD 98 static int adjust_soc(struct qpnp_bms_chip *chip, struct soc_params *params, int soc, int batt_temp) { int ibat_ua = 0, vbat_uv = 0; int ocv_est_uv = 0, soc_est = 0, pc_est = 0, pc = 0; int delta_ocv_uv = 0; int n = 0; int rc_new_uah = 0; int pc_new = 0; int soc_new = 0; int slope = 0; int rc = 0; int delta_ocv_uv_limit = 0; int correction_limit_uv = 0; rc = get_simultaneous_batt_v_and_i(chip, &ibat_ua, &vbat_uv); if (rc < 0) { pr_err("simultaneous vbat ibat failed err = %d\n", rc); goto out; } very_low_voltage_check(chip, vbat_uv); cv_voltage_check(chip, vbat_uv); delta_ocv_uv_limit = DIV_ROUND_CLOSEST(ibat_ua, 1000); ocv_est_uv = vbat_uv + (ibat_ua * params->rbatt_mohm)/1000; pc_est = calculate_pc(chip, ocv_est_uv, batt_temp); soc_est = div_s64((s64)params->fcc_uah * pc_est - params->uuc_uah*100, (s64)params->fcc_uah - params->uuc_uah); soc_est = bound_soc(soc_est); /* never adjust during bms reset mode */ if (bms_reset) { pr_debug("bms reset mode, SOC adjustment skipped\n"); goto out; } if (is_battery_charging(chip)) { soc = charging_adjustments(chip, params, soc, vbat_uv, ibat_ua, batt_temp); /* Skip adjustments if we are in CV or ibat is negative */ if (chip->soc_at_cv != -EINVAL || ibat_ua < 0) goto out; } /* * do not adjust * if soc_est is same as what bms calculated * OR if soc_est > adjust_soc_low_threshold * OR if soc is above 90 * because we might pull it low * and cause a bad user experience */ if (!wake_lock_active(&chip->low_voltage_wake_lock) && (soc_est == soc || soc_est > chip->adjust_soc_low_threshold || soc >= NO_ADJUST_HIGH_SOC_THRESHOLD)) goto out; if (chip->last_soc_est == -EINVAL) chip->last_soc_est = soc; n = min(200, max(1 , soc + soc_est + chip->last_soc_est)); chip->last_soc_est = soc_est; pc = calculate_pc(chip, chip->last_ocv_uv, chip->last_ocv_temp); if (pc > 0) { pc_new = calculate_pc(chip, chip->last_ocv_uv - (++slope * 1000), chip->last_ocv_temp); while (pc_new == pc) { /* start taking 10mV steps */ slope = slope + 10; pc_new = calculate_pc(chip, chip->last_ocv_uv - (slope * 1000), chip->last_ocv_temp); } } else { /* * pc is already at the lowest point, * assume 1 millivolt translates to 1% pc */ pc = 1; pc_new = 0; slope = 1; } delta_ocv_uv = div_s64((soc - soc_est) * (s64)slope * 1000, n * (pc - pc_new)); if (abs(delta_ocv_uv) > delta_ocv_uv_limit) { pr_debug("limiting delta ocv %d limit = %d\n", delta_ocv_uv, delta_ocv_uv_limit); if (delta_ocv_uv > 0) delta_ocv_uv = delta_ocv_uv_limit; else delta_ocv_uv = -1 * delta_ocv_uv_limit; pr_debug("new delta ocv = %d\n", delta_ocv_uv); } if (wake_lock_active(&chip->low_voltage_wake_lock)) { /* when in the cutoff region, do not correct upwards */ delta_ocv_uv = max(0, delta_ocv_uv); goto skip_limits; } if (chip->last_ocv_uv > chip->flat_ocv_threshold_uv) correction_limit_uv = chip->high_ocv_correction_limit_uv; else correction_limit_uv = chip->low_ocv_correction_limit_uv; if (abs(delta_ocv_uv) > correction_limit_uv) { pr_debug("limiting delta ocv %d limit = %d\n", delta_ocv_uv, correction_limit_uv); if (delta_ocv_uv > 0) delta_ocv_uv = correction_limit_uv; else delta_ocv_uv = -correction_limit_uv; pr_debug("new delta ocv = %d\n", delta_ocv_uv); } skip_limits: chip->last_ocv_uv -= delta_ocv_uv; if (chip->last_ocv_uv >= chip->max_voltage_uv) chip->last_ocv_uv = chip->max_voltage_uv; /* calculate the soc based on this new ocv */ pc_new = calculate_pc(chip, chip->last_ocv_uv, chip->last_ocv_temp); rc_new_uah = (params->fcc_uah * pc_new) / 100; soc_new = (rc_new_uah - params->cc_uah - params->uuc_uah)*100 / (params->fcc_uah - params->uuc_uah); soc_new = bound_soc(soc_new); /* * if soc_new is ZERO force it higher so that phone doesnt report soc=0 * soc = 0 should happen only when soc_est is above a set value */ if (soc_new == 0 && soc_est >= chip->hold_soc_est) soc_new = 1; soc = soc_new; out: pr_debug("ibat_ua = %d, vbat_uv = %d, ocv_est_uv = %d, pc_est = %d, soc_est = %d, n = %d, delta_ocv_uv = %d, last_ocv_uv = %d, pc_new = %d, soc_new = %d, rbatt = %d, slope = %d\n", ibat_ua, vbat_uv, ocv_est_uv, pc_est, soc_est, n, delta_ocv_uv, chip->last_ocv_uv, pc_new, soc_new, params->rbatt_mohm, slope); return soc; } static int clamp_soc_based_on_voltage(struct qpnp_bms_chip *chip, int soc) { int rc, vbat_uv; rc = get_battery_voltage(chip, &vbat_uv); if (rc < 0) { pr_err("adc vbat failed err = %d\n", rc); return soc; } if (soc == 0 && vbat_uv > chip->v_cutoff_uv) { pr_debug("clamping soc to 1, vbat (%d) > cutoff (%d)\n", vbat_uv, chip->v_cutoff_uv); return 1; } else { pr_debug("not clamping, using soc = %d, vbat = %d and cutoff = %d\n", soc, vbat_uv, chip->v_cutoff_uv); return soc; } } static int64_t convert_cc_uah_to_raw(struct qpnp_bms_chip *chip, int64_t cc_uah) { int64_t cc_uv, cc_pvh, cc_raw; cc_pvh = cc_uah * chip->r_sense_uohm; cc_uv = div_s64(cc_pvh * SLEEP_CLK_HZ * SECONDS_PER_HOUR, CC_READING_TICKS * 1000000LL); cc_raw = div_s64(cc_uv * CC_READING_RESOLUTION_D, CC_READING_RESOLUTION_N); return cc_raw; } #define CC_STEP_INCREMENT_UAH 1500 #define OCV_STEP_INCREMENT 0x10 static void configure_soc_wakeup(struct qpnp_bms_chip *chip, struct soc_params *params, int batt_temp, int target_soc) { int target_ocv_uv; int64_t target_cc_uah, cc_raw_64, current_shdw_cc_raw_64; int64_t current_shdw_cc_uah, iadc_comp_factor; uint64_t cc_raw, current_shdw_cc_raw; int16_t ocv_raw, current_ocv_raw; current_shdw_cc_raw = 0; mutex_lock(&chip->bms_output_lock); lock_output_data(chip); qpnp_read_wrapper(chip, (u8 *)&current_ocv_raw, chip->base + BMS1_OCV_FOR_SOC_DATA0, 2); unlock_output_data(chip); mutex_unlock(&chip->bms_output_lock); current_shdw_cc_uah = get_prop_bms_charge_counter_shadow(chip); current_shdw_cc_raw_64 = convert_cc_uah_to_raw(chip, current_shdw_cc_uah); /* * Calculate the target shadow coulomb counter threshold for when * the SoC changes. * * Since the BMS driver resets the shadow coulomb counter every * 20 seconds when the device is awake, calculate the threshold as * a delta from the current shadow coulomb count. */ target_cc_uah = (100 - target_soc) * (params->fcc_uah - params->uuc_uah) / 100 - current_shdw_cc_uah; if (target_cc_uah < 0) { /* * If the target cc is below 0, that means we have already * passed the point where SoC should have fallen. * Set a wakeup in a few more mAh and check back again */ target_cc_uah = CC_STEP_INCREMENT_UAH; } iadc_comp_factor = 100000; qpnp_iadc_comp_result(chip->iadc_dev, &iadc_comp_factor); target_cc_uah = div64_s64(target_cc_uah * 100000, iadc_comp_factor); target_cc_uah = cc_reverse_adjust_for_gain(chip, target_cc_uah); cc_raw_64 = convert_cc_uah_to_raw(chip, target_cc_uah); cc_raw = convert_s64_to_s36(cc_raw_64); target_ocv_uv = find_ocv_for_pc(chip, batt_temp, find_pc_for_soc(chip, params, target_soc)); ocv_raw = convert_vbatt_uv_to_raw(chip, target_ocv_uv); /* * If the current_ocv_raw was updated since reaching 100% and is lower * than the calculated target ocv threshold, set the new target * threshold 1.5mAh lower in order to check if the SoC changed yet. */ if (current_ocv_raw != chip->ocv_reading_at_100 && current_ocv_raw < ocv_raw) ocv_raw = current_ocv_raw - OCV_STEP_INCREMENT; qpnp_write_wrapper(chip, (u8 *)&cc_raw, chip->base + BMS1_SW_CC_THR0, 5); qpnp_write_wrapper(chip, (u8 *)&ocv_raw, chip->base + BMS1_OCV_THR0, 2); enable_bms_irq(&chip->ocv_thr_irq); enable_bms_irq(&chip->sw_cc_thr_irq); pr_debug("current sw_cc_raw = 0x%llx, current ocv = 0x%hx\n", current_shdw_cc_raw, (uint16_t)current_ocv_raw); pr_debug("target_cc_uah = %lld, raw64 = 0x%llx, raw 36 = 0x%llx, ocv_raw = 0x%hx\n", target_cc_uah, (uint64_t)cc_raw_64, cc_raw, (uint16_t)ocv_raw); } #define BAD_SOC_THRESH -10 static int calculate_raw_soc(struct qpnp_bms_chip *chip, struct raw_soc_params *raw, struct soc_params *params, int batt_temp) { int soc, remaining_usable_charge_uah; /* calculate remaining usable charge */ remaining_usable_charge_uah = params->ocv_charge_uah - params->cc_uah - params->uuc_uah; pr_debug("RUC = %duAh\n", remaining_usable_charge_uah); soc = DIV_ROUND_CLOSEST((remaining_usable_charge_uah * 100), (params->fcc_uah - params->uuc_uah)); if (chip->first_time_calc_soc && soc > BAD_SOC_THRESH && soc < 0) { /* * first time calcualtion and the pon ocv is too low resulting * in a bad soc. Adjust ocv to get 0 soc */ pr_debug("soc is %d, adjusting pon ocv to make it 0\n", soc); chip->last_ocv_uv = find_ocv_for_pc(chip, batt_temp, find_pc_for_soc(chip, params, 0)); params->ocv_charge_uah = find_ocv_charge_for_soc(chip, params, 0); remaining_usable_charge_uah = params->ocv_charge_uah - params->cc_uah - params->uuc_uah; soc = DIV_ROUND_CLOSEST((remaining_usable_charge_uah * 100), (params->fcc_uah - params->uuc_uah)); pr_debug("DONE for O soc is %d, pon ocv adjusted to %duV\n", soc, chip->last_ocv_uv); } if (soc > 100) soc = 100; if (soc > BAD_SOC_THRESH && soc < 0) { pr_debug("bad rem_usb_chg = %d rem_chg %d, cc_uah %d, unusb_chg %d\n", remaining_usable_charge_uah, params->ocv_charge_uah, params->cc_uah, params->uuc_uah); pr_debug("for bad rem_usb_chg last_ocv_uv = %d batt_temp = %d fcc = %d soc =%d\n", chip->last_ocv_uv, batt_temp, params->fcc_uah, soc); soc = 0; } return soc; } #define SLEEP_RECALC_INTERVAL 3 static int calculate_state_of_charge(struct qpnp_bms_chip *chip, struct raw_soc_params *raw, int batt_temp) { struct soc_params params; int soc, previous_soc, shutdown_soc, new_calculated_soc; int remaining_usable_charge_uah; calculate_soc_params(chip, raw, &params, batt_temp); if (!is_battery_present(chip)) { pr_debug("battery gone, reporting 100\n"); new_calculated_soc = 100; goto done_calculating; } if (params.fcc_uah - params.uuc_uah <= 0) { pr_debug("FCC = %duAh, UUC = %duAh forcing soc = 0\n", params.fcc_uah, params.uuc_uah); new_calculated_soc = 0; goto done_calculating; } soc = calculate_raw_soc(chip, raw, &params, batt_temp); mutex_lock(&chip->soc_invalidation_mutex); shutdown_soc = chip->shutdown_soc; if (chip->first_time_calc_soc && soc != shutdown_soc && !chip->shutdown_soc_invalid) { /* * soc for the first time - use shutdown soc * to adjust pon ocv since it is a small percent away from * the real soc */ pr_debug("soc = %d before forcing shutdown_soc = %d\n", soc, shutdown_soc); chip->last_ocv_uv = find_ocv_for_pc(chip, batt_temp, find_pc_for_soc(chip, &params, shutdown_soc)); params.ocv_charge_uah = find_ocv_charge_for_soc(chip, &params, shutdown_soc); remaining_usable_charge_uah = params.ocv_charge_uah - params.cc_uah - params.uuc_uah; soc = DIV_ROUND_CLOSEST((remaining_usable_charge_uah * 100), (params.fcc_uah - params.uuc_uah)); pr_debug("DONE for shutdown_soc = %d soc is %d, adjusted ocv to %duV\n", shutdown_soc, soc, chip->last_ocv_uv); } mutex_unlock(&chip->soc_invalidation_mutex); pr_debug("SOC before adjustment = %d\n", soc); new_calculated_soc = adjust_soc(chip, &params, soc, batt_temp); /* always clamp soc due to BMS hw/sw immaturities */ new_calculated_soc = clamp_soc_based_on_voltage(chip, new_calculated_soc); /* * If the battery is full, configure the cc threshold so the system * wakes up after SoC changes */ if (is_battery_full(chip)) { configure_soc_wakeup(chip, &params, batt_temp, bound_soc(new_calculated_soc - 1)); } else { disable_bms_irq(&chip->ocv_thr_irq); disable_bms_irq(&chip->sw_cc_thr_irq); } done_calculating: mutex_lock(&chip->last_soc_mutex); previous_soc = chip->calculated_soc; chip->calculated_soc = new_calculated_soc; pr_debug("CC based calculated SOC = %d\n", chip->calculated_soc); if (chip->last_soc_invalid) { chip->last_soc_invalid = false; chip->last_soc = -EINVAL; } /* * Check if more than a long time has passed since the last * calculation (more than n times compared to the soc recalculation * rate, where n is defined by SLEEP_RECALC_INTERVAL). If this is true, * then the system must have gone through a long sleep, and SoC can be * allowed to become unbounded by the last reported SoC */ if (params.delta_time_s * 1000 > chip->calculate_soc_ms * SLEEP_RECALC_INTERVAL && !chip->first_time_calc_soc) { chip->last_soc_unbound = true; chip->last_soc_change_sec = chip->last_recalc_time; pr_debug("last_soc unbound because elapsed time = %d\n", params.delta_time_s); } mutex_unlock(&chip->last_soc_mutex); wake_up_interruptible(&chip->bms_wait_queue); if (new_calculated_soc != previous_soc && chip->bms_psy_registered) { power_supply_changed(&chip->bms_psy); pr_debug("power supply changed\n"); } else { /* * Call report state of charge anyways to periodically update * reported SoC. This prevents reported SoC from being stuck * when calculated soc doesn't change. */ report_state_of_charge(chip); } get_current_time(&chip->last_recalc_time); chip->first_time_calc_soc = 0; chip->first_time_calc_uuc = 0; return chip->calculated_soc; } static int calculate_soc_from_voltage(struct qpnp_bms_chip *chip) { int voltage_range_uv, voltage_remaining_uv, voltage_based_soc; int rc, vbat_uv; rc = get_battery_voltage(chip, &vbat_uv); if (rc < 0) { pr_err("adc vbat failed err = %d\n", rc); return rc; } voltage_range_uv = chip->max_voltage_uv - chip->v_cutoff_uv; voltage_remaining_uv = vbat_uv - chip->v_cutoff_uv; voltage_based_soc = voltage_remaining_uv * 100 / voltage_range_uv; voltage_based_soc = clamp(voltage_based_soc, 0, 100); if (chip->prev_voltage_based_soc != voltage_based_soc && chip->bms_psy_registered) { power_supply_changed(&chip->bms_psy); pr_debug("power supply changed\n"); } chip->prev_voltage_based_soc = voltage_based_soc; pr_debug("vbat used = %duv\n", vbat_uv); pr_debug("Calculated voltage based soc = %d\n", voltage_based_soc); return voltage_based_soc; } static int recalculate_raw_soc(struct qpnp_bms_chip *chip) { int batt_temp, rc, soc; struct qpnp_vadc_result result; struct raw_soc_params raw; struct soc_params params; bms_stay_awake(&chip->soc_wake_source); if (chip->use_voltage_soc) { soc = calculate_soc_from_voltage(chip); } else { if (!chip->batfet_closed) qpnp_iadc_calibrate_for_trim(chip->iadc_dev, false); rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &result); if (rc) { pr_err("error reading vadc LR_MUX1_BATT_THERM = %d, rc = %d\n", LR_MUX1_BATT_THERM, rc); soc = chip->calculated_soc; } else { pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical, result.measurement); batt_temp = (int)result.physical; mutex_lock(&chip->last_ocv_uv_mutex); read_soc_params_raw(chip, &raw, batt_temp); calculate_soc_params(chip, &raw, &params, batt_temp); if (!is_battery_present(chip)) { pr_debug("battery gone\n"); soc = 0; } else if (params.fcc_uah - params.uuc_uah <= 0) { pr_debug("FCC = %duAh, UUC = %duAh forcing soc = 0\n", params.fcc_uah, params.uuc_uah); soc = 0; } else { soc = calculate_raw_soc(chip, &raw, &params, batt_temp); } mutex_unlock(&chip->last_ocv_uv_mutex); } } bms_relax(&chip->soc_wake_source); return soc; } static int recalculate_soc(struct qpnp_bms_chip *chip) { int batt_temp, rc, soc; struct qpnp_vadc_result result; struct raw_soc_params raw; bms_stay_awake(&chip->soc_wake_source); mutex_lock(&chip->vbat_monitor_mutex); if (chip->vbat_monitor_params.state_request != ADC_TM_HIGH_LOW_THR_DISABLE) qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); mutex_unlock(&chip->vbat_monitor_mutex); if (chip->use_voltage_soc) { soc = calculate_soc_from_voltage(chip); } else { if (!chip->batfet_closed) qpnp_iadc_calibrate_for_trim(chip->iadc_dev, false); rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &result); if (rc) { pr_err("error reading vadc LR_MUX1_BATT_THERM = %d, rc = %d\n", LR_MUX1_BATT_THERM, rc); soc = chip->calculated_soc; } else { pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical, result.measurement); batt_temp = (int)result.physical; mutex_lock(&chip->last_ocv_uv_mutex); read_soc_params_raw(chip, &raw, batt_temp); soc = calculate_state_of_charge(chip, &raw, batt_temp); mutex_unlock(&chip->last_ocv_uv_mutex); } } bms_relax(&chip->soc_wake_source); return soc; } static void recalculate_work(struct work_struct *work) { struct qpnp_bms_chip *chip = container_of(work, struct qpnp_bms_chip, recalc_work); recalculate_soc(chip); } static int get_calculation_delay_ms(struct qpnp_bms_chip *chip) { if (wake_lock_active(&chip->low_voltage_wake_lock)) return chip->low_voltage_calculate_soc_ms; else if (chip->calculated_soc < chip->low_soc_calc_threshold) return chip->low_soc_calculate_soc_ms; else return chip->calculate_soc_ms; } static void calculate_soc_work(struct work_struct *work) { struct qpnp_bms_chip *chip = container_of(work, struct qpnp_bms_chip, calculate_soc_delayed_work.work); recalculate_soc(chip); schedule_delayed_work(&chip->calculate_soc_delayed_work, round_jiffies_relative(msecs_to_jiffies (get_calculation_delay_ms(chip)))); } static void configure_vbat_monitor_low(struct qpnp_bms_chip *chip) { mutex_lock(&chip->vbat_monitor_mutex); if (chip->vbat_monitor_params.state_request == ADC_TM_HIGH_LOW_THR_ENABLE) { /* * Battery is now around or below v_cutoff */ pr_debug("battery entered cutoff range\n"); if (!wake_lock_active(&chip->low_voltage_wake_lock)) { pr_debug("voltage low, holding wakelock\n"); wake_lock(&chip->low_voltage_wake_lock); cancel_delayed_work_sync( &chip->calculate_soc_delayed_work); schedule_delayed_work( &chip->calculate_soc_delayed_work, 0); } chip->vbat_monitor_params.state_request = ADC_TM_HIGH_THR_ENABLE; chip->vbat_monitor_params.high_thr = (chip->low_voltage_threshold + VBATT_ERROR_MARGIN); pr_debug("set low thr to %d and high to %d\n", chip->vbat_monitor_params.low_thr, chip->vbat_monitor_params.high_thr); chip->vbat_monitor_params.low_thr = 0; } else if (chip->vbat_monitor_params.state_request == ADC_TM_LOW_THR_ENABLE) { /* * Battery is in normal operation range. */ pr_debug("battery entered normal range\n"); if (wake_lock_active(&chip->cv_wake_lock)) { wake_unlock(&chip->cv_wake_lock); pr_debug("releasing cv wake lock\n"); } chip->in_cv_range = false; chip->vbat_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_ENABLE; chip->vbat_monitor_params.high_thr = chip->max_voltage_uv - VBATT_ERROR_MARGIN; chip->vbat_monitor_params.low_thr = chip->low_voltage_threshold; pr_debug("set low thr to %d and high to %d\n", chip->vbat_monitor_params.low_thr, chip->vbat_monitor_params.high_thr); } qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); mutex_unlock(&chip->vbat_monitor_mutex); } #define CV_LOW_THRESHOLD_HYST_UV 100000 static void configure_vbat_monitor_high(struct qpnp_bms_chip *chip) { mutex_lock(&chip->vbat_monitor_mutex); if (chip->vbat_monitor_params.state_request == ADC_TM_HIGH_LOW_THR_ENABLE) { /* * Battery is around vddmax */ pr_debug("battery entered vddmax range\n"); chip->in_cv_range = true; if (!wake_lock_active(&chip->cv_wake_lock)) { wake_lock(&chip->cv_wake_lock); pr_debug("holding cv wake lock\n"); } schedule_work(&chip->recalc_work); chip->vbat_monitor_params.state_request = ADC_TM_LOW_THR_ENABLE; chip->vbat_monitor_params.low_thr = (chip->max_voltage_uv - CV_LOW_THRESHOLD_HYST_UV); chip->vbat_monitor_params.high_thr = chip->max_voltage_uv * 2; pr_debug("set low thr to %d and high to %d\n", chip->vbat_monitor_params.low_thr, chip->vbat_monitor_params.high_thr); } else if (chip->vbat_monitor_params.state_request == ADC_TM_HIGH_THR_ENABLE) { /* * Battery is in normal operation range. */ pr_debug("battery entered normal range\n"); if (wake_lock_active(&chip->low_voltage_wake_lock)) { pr_debug("voltage high, releasing wakelock\n"); wake_unlock(&chip->low_voltage_wake_lock); } chip->vbat_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_ENABLE; chip->vbat_monitor_params.high_thr = chip->max_voltage_uv - VBATT_ERROR_MARGIN; chip->vbat_monitor_params.low_thr = chip->low_voltage_threshold; pr_debug("set low thr to %d and high to %d\n", chip->vbat_monitor_params.low_thr, chip->vbat_monitor_params.high_thr); } qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); mutex_unlock(&chip->vbat_monitor_mutex); } static void btm_notify_vbat(enum qpnp_tm_state state, void *ctx) { struct qpnp_bms_chip *chip = ctx; int vbat_uv; struct qpnp_vadc_result result; int rc; rc = qpnp_vadc_read(chip->vadc_dev, VBAT_SNS, &result); pr_debug("vbat = %lld, raw = 0x%x\n", result.physical, result.adc_code); get_battery_voltage(chip, &vbat_uv); pr_debug("vbat is at %d, state is at %d\n", vbat_uv, state); if (state == ADC_TM_LOW_STATE) { pr_debug("low voltage btm notification triggered\n"); if (vbat_uv - VBATT_ERROR_MARGIN < chip->vbat_monitor_params.low_thr) { configure_vbat_monitor_low(chip); } else { pr_debug("faulty btm trigger, discarding\n"); qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); } } else if (state == ADC_TM_HIGH_STATE) { pr_debug("high voltage btm notification triggered\n"); if (vbat_uv + VBATT_ERROR_MARGIN > chip->vbat_monitor_params.high_thr) { configure_vbat_monitor_high(chip); } else { pr_debug("faulty btm trigger, discarding\n"); qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); } } else { pr_debug("unknown voltage notification state: %d\n", state); } if (chip->bms_psy_registered) power_supply_changed(&chip->bms_psy); } static int reset_vbat_monitoring(struct qpnp_bms_chip *chip) { int rc; chip->vbat_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_DISABLE; rc = qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); if (rc) { pr_err("tm disable failed: %d\n", rc); return rc; } if (wake_lock_active(&chip->low_voltage_wake_lock)) { pr_debug("battery removed, releasing wakelock\n"); wake_unlock(&chip->low_voltage_wake_lock); } if (chip->in_cv_range) { pr_debug("battery removed, removing in_cv_range state\n"); chip->in_cv_range = false; } return 0; } static int setup_vbat_monitoring(struct qpnp_bms_chip *chip) { int rc; chip->vbat_monitor_params.low_thr = chip->low_voltage_threshold; chip->vbat_monitor_params.high_thr = chip->max_voltage_uv - VBATT_ERROR_MARGIN; chip->vbat_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_ENABLE; chip->vbat_monitor_params.channel = VBAT_SNS; chip->vbat_monitor_params.btm_ctx = (void *)chip; chip->vbat_monitor_params.timer_interval = ADC_MEAS1_INTERVAL_1S; chip->vbat_monitor_params.threshold_notification = &btm_notify_vbat; pr_debug("set low thr to %d and high to %d\n", chip->vbat_monitor_params.low_thr, chip->vbat_monitor_params.high_thr); if (!is_battery_present(chip)) { pr_debug("no battery inserted, do not enable vbat monitoring\n"); chip->vbat_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_DISABLE; } else { rc = qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->vbat_monitor_params); if (rc) { pr_err("tm setup failed: %d\n", rc); return rc; } } pr_debug("setup complete\n"); return 0; } static void readjust_fcc_table(struct qpnp_bms_chip *chip) { struct single_row_lut *temp, *old; int i, fcc, ratio; if (!chip->enable_fcc_learning) return; if (!chip->fcc_temp_lut) { pr_err("The static fcc lut table is NULL\n"); return; } temp = devm_kzalloc(chip->dev, sizeof(struct single_row_lut), GFP_KERNEL); if (!temp) { pr_err("Cannot allocate memory for adjusted fcc table\n"); return; } fcc = interpolate_fcc(chip->fcc_temp_lut, chip->fcc_new_batt_temp); temp->cols = chip->fcc_temp_lut->cols; for (i = 0; i < chip->fcc_temp_lut->cols; i++) { temp->x[i] = chip->fcc_temp_lut->x[i]; ratio = div_u64(chip->fcc_temp_lut->y[i] * 1000, fcc); temp->y[i] = (ratio * chip->fcc_new_mah); temp->y[i] /= 1000; } old = chip->adjusted_fcc_temp_lut; chip->adjusted_fcc_temp_lut = temp; devm_kfree(chip->dev, old); } static int read_fcc_data_from_backup(struct qpnp_bms_chip *chip) { int rc, i; u8 fcc = 0, chgcyl = 0; for (i = 0; i < chip->min_fcc_learning_samples; i++) { rc = qpnp_read_wrapper(chip, &fcc, chip->base + BMS_FCC_BASE_REG + i, 1); rc |= qpnp_read_wrapper(chip, &chgcyl, chip->base + BMS_CHGCYL_BASE_REG + i, 1); if (rc) { pr_err("Unable to read FCC data\n"); return rc; } if (fcc == 0 || (fcc == 0xFF && chgcyl == 0xFF)) { /* FCC invalid/not present */ chip->fcc_learning_samples[i].fcc_new = 0; chip->fcc_learning_samples[i].chargecycles = 0; } else { /* valid FCC data */ chip->fcc_sample_count++; chip->fcc_learning_samples[i].fcc_new = fcc * chip->fcc_resolution; chip->fcc_learning_samples[i].chargecycles = chgcyl * CHGCYL_RESOLUTION; } } return 0; } static int discard_backup_fcc_data(struct qpnp_bms_chip *chip) { int rc = 0, i; u8 temp_u8 = 0; chip->fcc_sample_count = 0; for (i = 0; i < chip->min_fcc_learning_samples; i++) { rc = qpnp_write_wrapper(chip, &temp_u8, chip->base + BMS_FCC_BASE_REG + i, 1); rc |= qpnp_write_wrapper(chip, &temp_u8, chip->base + BMS_CHGCYL_BASE_REG + i, 1); if (rc) { pr_err("Unable to clear FCC data\n"); return rc; } } return 0; } static void average_fcc_samples_and_readjust_fcc_table(struct qpnp_bms_chip *chip) { int i, temp_fcc_avg = 0, temp_fcc_delta = 0, new_fcc_avg = 0; struct fcc_sample *ft; for (i = 0; i < chip->min_fcc_learning_samples; i++) temp_fcc_avg += chip->fcc_learning_samples[i].fcc_new; temp_fcc_avg /= chip->min_fcc_learning_samples; temp_fcc_delta = div_u64(temp_fcc_avg * DELTA_FCC_PERCENT, 100); /* fix the fcc if its an outlier i.e. > 5% of the average */ for (i = 0; i < chip->min_fcc_learning_samples; i++) { ft = &chip->fcc_learning_samples[i]; if (abs(ft->fcc_new - temp_fcc_avg) > temp_fcc_delta) new_fcc_avg += temp_fcc_avg; else new_fcc_avg += ft->fcc_new; } new_fcc_avg /= chip->min_fcc_learning_samples; chip->fcc_new_mah = new_fcc_avg; chip->fcc_new_batt_temp = FCC_DEFAULT_TEMP; pr_info("FCC update: New fcc_mah=%d, fcc_batt_temp=%d\n", new_fcc_avg, FCC_DEFAULT_TEMP); readjust_fcc_table(chip); } static void backup_charge_cycle(struct qpnp_bms_chip *chip) { int rc = 0; if (chip->charge_increase >= 0) { rc = qpnp_write_wrapper(chip, &chip->charge_increase, chip->base + CHARGE_INCREASE_STORAGE, 1); if (rc) pr_err("Unable to backup charge_increase\n"); } if (chip->charge_cycles >= 0) { rc = qpnp_write_wrapper(chip, (u8 *)&chip->charge_cycles, chip->base + CHARGE_CYCLE_STORAGE_LSB, 2); if (rc) pr_err("Unable to backup charge_cycles\n"); } } static bool chargecycles_in_range(struct qpnp_bms_chip *chip) { int i, min_cycle, max_cycle, valid_range; /* find the smallest and largest charge cycle */ max_cycle = min_cycle = chip->fcc_learning_samples[0].chargecycles; for (i = 1; i < chip->min_fcc_learning_samples; i++) { if (min_cycle > chip->fcc_learning_samples[i].chargecycles) min_cycle = chip->fcc_learning_samples[i].chargecycles; if (max_cycle < chip->fcc_learning_samples[i].chargecycles) max_cycle = chip->fcc_learning_samples[i].chargecycles; } /* check if chargecyles are in range to continue with FCC update */ valid_range = DIV_ROUND_UP(VALID_FCC_CHGCYL_RANGE, CHGCYL_RESOLUTION) * CHGCYL_RESOLUTION; if (abs(max_cycle - min_cycle) > valid_range) return false; return true; } static int read_chgcycle_data_from_backup(struct qpnp_bms_chip *chip) { int rc; uint16_t temp_u16 = 0; u8 temp_u8 = 0; rc = qpnp_read_wrapper(chip, &temp_u8, chip->base + CHARGE_INCREASE_STORAGE, 1); if (!rc && temp_u8 != 0xFF) chip->charge_increase = temp_u8; rc = qpnp_read_wrapper(chip, (u8 *)&temp_u16, chip->base + CHARGE_CYCLE_STORAGE_LSB, 2); if (!rc && temp_u16 != 0xFFFF) chip->charge_cycles = temp_u16; return rc; } static void attempt_learning_new_fcc(struct qpnp_bms_chip *chip) { pr_debug("Total FCC sample count=%d\n", chip->fcc_sample_count); /* update FCC if we have the required samples */ if ((chip->fcc_sample_count == chip->min_fcc_learning_samples) && chargecycles_in_range(chip)) average_fcc_samples_and_readjust_fcc_table(chip); } static int calculate_real_soc(struct qpnp_bms_chip *chip, int batt_temp, struct raw_soc_params *raw, int cc_uah) { int fcc_uah, rc_uah; fcc_uah = calculate_fcc(chip, batt_temp); rc_uah = calculate_ocv_charge(chip, raw, fcc_uah); return ((rc_uah - cc_uah) * 100) / fcc_uah; } #define MAX_U8_VALUE ((u8)(~0U)) static int backup_new_fcc(struct qpnp_bms_chip *chip, int fcc_mah, int chargecycles) { int rc, min_cycle, i; u8 fcc_new, chgcyl, pos = 0; struct fcc_sample *ft; if ((fcc_mah > (chip->fcc_resolution * MAX_U8_VALUE)) || (chargecycles > (CHGCYL_RESOLUTION * MAX_U8_VALUE))) { pr_warn("FCC/Chgcyl beyond storage limit. FCC=%d, chgcyl=%d\n", fcc_mah, chargecycles); return -EINVAL; } if (chip->fcc_sample_count == chip->min_fcc_learning_samples) { /* search best location - oldest entry */ min_cycle = chip->fcc_learning_samples[0].chargecycles; for (i = 1; i < chip->min_fcc_learning_samples; i++) { if (min_cycle > chip->fcc_learning_samples[i].chargecycles) pos = i; } } else { /* find an empty location */ for (i = 0; i < chip->min_fcc_learning_samples; i++) { ft = &chip->fcc_learning_samples[i]; if (ft->fcc_new == 0 || (ft->fcc_new == 0xFF && ft->chargecycles == 0xFF)) { pos = i; break; } } chip->fcc_sample_count++; } chip->fcc_learning_samples[pos].fcc_new = fcc_mah; chip->fcc_learning_samples[pos].chargecycles = chargecycles; fcc_new = DIV_ROUND_UP(fcc_mah, chip->fcc_resolution); rc = qpnp_write_wrapper(chip, (u8 *)&fcc_new, chip->base + BMS_FCC_BASE_REG + pos, 1); if (rc) return rc; chgcyl = DIV_ROUND_UP(chargecycles, CHGCYL_RESOLUTION); rc = qpnp_write_wrapper(chip, (u8 *)&chgcyl, chip->base + BMS_CHGCYL_BASE_REG + pos, 1); if (rc) return rc; pr_debug("Backup new FCC: fcc_new=%d, chargecycle=%d, pos=%d\n", fcc_new, chgcyl, pos); return rc; } static void update_fcc_learning_table(struct qpnp_bms_chip *chip, int new_fcc_uah, int chargecycles, int batt_temp) { int rc, fcc_default, fcc_temp; /* convert the fcc at batt_temp to new fcc at FCC_DEFAULT_TEMP */ fcc_default = calculate_fcc(chip, FCC_DEFAULT_TEMP) / 1000; fcc_temp = calculate_fcc(chip, batt_temp) / 1000; new_fcc_uah = (new_fcc_uah / fcc_temp) * fcc_default; rc = backup_new_fcc(chip, new_fcc_uah / 1000, chargecycles); if (rc) { pr_err("Unable to backup new FCC\n"); return; } /* check if FCC can be updated */ attempt_learning_new_fcc(chip); } static bool is_new_fcc_valid(int new_fcc_uah, int fcc_uah) { if ((new_fcc_uah >= (fcc_uah / 2)) && ((new_fcc_uah * 100) <= (fcc_uah * 105))) return true; pr_debug("FCC rejected - not within valid limit\n"); return false; } static void fcc_learning_config(struct qpnp_bms_chip *chip, bool start) { int rc, batt_temp; struct raw_soc_params raw; struct qpnp_vadc_result result; int fcc_uah, new_fcc_uah, delta_cc_uah, delta_soc; rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &result); if (rc) { pr_err("Unable to read batt_temp\n"); return; } else { batt_temp = (int)result.physical; } rc = read_soc_params_raw(chip, &raw, batt_temp); if (rc) { pr_err("Unable to read CC, cannot update FCC\n"); return; } if (start) { chip->start_pc = interpolate_pc(chip->pc_temp_ocv_lut, batt_temp / 10, raw.last_good_ocv_uv / 1000); chip->start_cc_uah = calculate_cc(chip, raw.cc, CC, NORESET); chip->start_real_soc = calculate_real_soc(chip, batt_temp, &raw, chip->start_cc_uah); pr_debug("start_pc=%d, start_cc=%d, start_soc=%d real_soc=%d\n", chip->start_pc, chip->start_cc_uah, chip->start_soc, chip->start_real_soc); } else { chip->end_cc_uah = calculate_cc(chip, raw.cc, CC, NORESET); delta_soc = 100 - chip->start_real_soc; delta_cc_uah = abs(chip->end_cc_uah - chip->start_cc_uah); new_fcc_uah = div_u64(delta_cc_uah * 100, delta_soc); fcc_uah = calculate_fcc(chip, batt_temp); pr_debug("start_soc=%d, start_pc=%d, start_real_soc=%d, start_cc=%d, end_cc=%d, new_fcc=%d\n", chip->start_soc, chip->start_pc, chip->start_real_soc, chip->start_cc_uah, chip->end_cc_uah, new_fcc_uah); if (is_new_fcc_valid(new_fcc_uah, fcc_uah)) update_fcc_learning_table(chip, new_fcc_uah, chip->charge_cycles, batt_temp); } } #define MAX_CAL_TRIES 200 #define MIN_CAL_UA 3000 static void batfet_open_work(struct work_struct *work) { int i; int rc; int result_ua; u8 orig_delay, sample_delay; struct qpnp_bms_chip *chip = container_of(work, struct qpnp_bms_chip, batfet_open_work); rc = qpnp_read_wrapper(chip, &orig_delay, chip->base + BMS1_S1_DELAY_CTL, 1); sample_delay = 0x0; rc = qpnp_write_wrapper(chip, &sample_delay, chip->base + BMS1_S1_DELAY_CTL, 1); /* * In certain PMICs there is a coupling issue which causes * bad calibration value that result in a huge battery current * even when the BATFET is open. Do continious calibrations until * we hit reasonable cal values which result in low battery current */ for (i = 0; (!chip->batfet_closed) && i < MAX_CAL_TRIES; i++) { rc = qpnp_iadc_calibrate_for_trim(chip->iadc_dev, false); /* * Wait 20mS after calibration and before reading battery * current. The BMS h/w uses calibration values in the * next sampling of vsense. */ msleep(20); rc |= get_battery_current(chip, &result_ua); if (rc == 0 && abs(result_ua) <= MIN_CAL_UA) { pr_debug("good cal at %d attempt\n", i); break; } } pr_debug("batfet_closed = %d i = %d result_ua = %d\n", chip->batfet_closed, i, result_ua); rc = qpnp_write_wrapper(chip, &orig_delay, chip->base + BMS1_S1_DELAY_CTL, 1); } static void charging_began(struct qpnp_bms_chip *chip) { mutex_lock(&chip->last_soc_mutex); chip->charge_start_tm_sec = 0; chip->catch_up_time_sec = 0; mutex_unlock(&chip->last_soc_mutex); chip->start_soc = report_state_of_charge(chip); mutex_lock(&chip->last_ocv_uv_mutex); if (chip->enable_fcc_learning) fcc_learning_config(chip, true); chip->soc_at_cv = -EINVAL; chip->prev_chg_soc = -EINVAL; mutex_unlock(&chip->last_ocv_uv_mutex); } static void charging_ended(struct qpnp_bms_chip *chip) { mutex_lock(&chip->last_soc_mutex); chip->charge_start_tm_sec = 0; chip->catch_up_time_sec = 0; mutex_unlock(&chip->last_soc_mutex); chip->end_soc = report_state_of_charge(chip); mutex_lock(&chip->last_ocv_uv_mutex); chip->soc_at_cv = -EINVAL; chip->prev_chg_soc = -EINVAL; /* update the chargecycles */ if (chip->end_soc > chip->start_soc) { chip->charge_increase += (chip->end_soc - chip->start_soc); if (chip->charge_increase > 100) { chip->charge_cycles++; chip->charge_increase = chip->charge_increase % 100; } if (chip->enable_fcc_learning) backup_charge_cycle(chip); } if (get_battery_status(chip) == POWER_SUPPLY_STATUS_FULL) { if (chip->enable_fcc_learning && (chip->start_soc <= chip->min_fcc_learning_soc) && (chip->start_pc <= chip->min_fcc_ocv_pc)) fcc_learning_config(chip, false); chip->done_charging = true; chip->last_soc_invalid = true; } else if (chip->charging_adjusted_ocv > 0) { pr_debug("Charging stopped before full, adjusted OCV = %d\n", chip->charging_adjusted_ocv); chip->last_ocv_uv = chip->charging_adjusted_ocv; } chip->charging_adjusted_ocv = -EINVAL; mutex_unlock(&chip->last_ocv_uv_mutex); } static void battery_status_check(struct qpnp_bms_chip *chip) { int status = get_battery_status(chip); mutex_lock(&chip->status_lock); if (chip->battery_status != status) { pr_debug("status = %d, shadow status = %d\n", status, chip->battery_status); if (status == POWER_SUPPLY_STATUS_CHARGING) { pr_debug("charging started\n"); charging_began(chip); } else if (chip->battery_status == POWER_SUPPLY_STATUS_CHARGING) { pr_debug("charging ended\n"); charging_ended(chip); } if (status == POWER_SUPPLY_STATUS_FULL) { pr_debug("battery full\n"); recalculate_soc(chip); } else if (chip->battery_status == POWER_SUPPLY_STATUS_FULL) { pr_debug("battery not full any more\n"); disable_bms_irq(&chip->ocv_thr_irq); disable_bms_irq(&chip->sw_cc_thr_irq); } chip->battery_status = status; /* battery charge status has changed, so force a soc * recalculation to update the SoC */ schedule_work(&chip->recalc_work); } mutex_unlock(&chip->status_lock); } #define CALIB_WRKARND_DIG_MAJOR_MAX 0x03 static void batfet_status_check(struct qpnp_bms_chip *chip) { bool batfet_closed; batfet_closed = is_batfet_closed(chip); if (chip->batfet_closed != batfet_closed) { chip->batfet_closed = batfet_closed; if (chip->iadc_bms_revision2 > CALIB_WRKARND_DIG_MAJOR_MAX) return; if (batfet_closed == false) { /* batfet opened */ schedule_work(&chip->batfet_open_work); qpnp_iadc_skip_calibration(chip->iadc_dev); } else { /* batfet closed */ qpnp_iadc_calibrate_for_trim(chip->iadc_dev, true); qpnp_iadc_resume_calibration(chip->iadc_dev); } } } static void battery_insertion_check(struct qpnp_bms_chip *chip) { int present = (int)is_battery_present(chip); int insertion_ocv_uv = get_battery_insertion_ocv_uv(chip); int insertion_ocv_taken = (insertion_ocv_uv > 0); mutex_lock(&chip->vbat_monitor_mutex); if (chip->battery_present != present && (present == insertion_ocv_taken || chip->battery_present == -EINVAL)) { pr_debug("status = %d, shadow status = %d, insertion_ocv_uv = %d\n", present, chip->battery_present, insertion_ocv_uv); if (chip->battery_present != -EINVAL) { if (present) { chip->insertion_ocv_uv = insertion_ocv_uv; setup_vbat_monitoring(chip); chip->new_battery = true; } else { reset_vbat_monitoring(chip); } } chip->battery_present = present; /* a new battery was inserted or removed, so force a soc * recalculation to update the SoC */ schedule_work(&chip->recalc_work); } mutex_unlock(&chip->vbat_monitor_mutex); } /* Returns capacity as a SoC percentage between 0 and 100 */ static int get_prop_bms_capacity(struct qpnp_bms_chip *chip) { return report_state_of_charge(chip); } static void qpnp_bms_external_power_changed(struct power_supply *psy) { struct qpnp_bms_chip *chip = container_of(psy, struct qpnp_bms_chip, bms_psy); battery_insertion_check(chip); batfet_status_check(chip); battery_status_check(chip); } static int qpnp_bms_power_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { struct qpnp_bms_chip *chip = container_of(psy, struct qpnp_bms_chip, bms_psy); switch (psp) { case POWER_SUPPLY_PROP_CAPACITY: val->intval = get_prop_bms_capacity(chip); break; case POWER_SUPPLY_PROP_STATUS: val->intval = chip->battery_status; break; case POWER_SUPPLY_PROP_CURRENT_NOW: val->intval = get_prop_bms_current_now(chip); break; case POWER_SUPPLY_PROP_RESISTANCE: val->intval = get_prop_bms_batt_resistance(chip); break; case POWER_SUPPLY_PROP_CHARGE_COUNTER: val->intval = get_prop_bms_charge_counter(chip); break; case POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW: val->intval = get_prop_bms_charge_counter_shadow(chip); break; case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: val->intval = get_prop_bms_charge_full_design(chip); break; case POWER_SUPPLY_PROP_CHARGE_FULL: val->intval = get_prop_bms_charge_full(chip); break; case POWER_SUPPLY_PROP_CYCLE_COUNT: val->intval = chip->charge_cycles; break; default: return -EINVAL; } return 0; } #define OCV_USE_LIMIT_EN BIT(7) static int set_ocv_voltage_thresholds(struct qpnp_bms_chip *chip, int low_voltage_threshold, int high_voltage_threshold) { uint16_t low_voltage_raw, high_voltage_raw; int rc; low_voltage_raw = convert_vbatt_uv_to_raw(chip, low_voltage_threshold); high_voltage_raw = convert_vbatt_uv_to_raw(chip, high_voltage_threshold); rc = qpnp_write_wrapper(chip, (u8 *)&low_voltage_raw, chip->base + BMS1_OCV_USE_LOW_LIMIT_THR0, 2); if (rc) { pr_err("Failed to set ocv low voltage threshold: %d\n", rc); return rc; } rc = qpnp_write_wrapper(chip, (u8 *)&high_voltage_raw, chip->base + BMS1_OCV_USE_HIGH_LIMIT_THR0, 2); if (rc) { pr_err("Failed to set ocv high voltage threshold: %d\n", rc); return rc; } rc = qpnp_masked_write(chip, BMS1_OCV_USE_LIMIT_CTL, OCV_USE_LIMIT_EN, OCV_USE_LIMIT_EN); if (rc) { pr_err("Failed to enabled ocv voltage thresholds: %d\n", rc); return rc; } pr_debug("ocv low threshold set to %d uv or 0x%x raw\n", low_voltage_threshold, low_voltage_raw); pr_debug("ocv high threshold set to %d uv or 0x%x raw\n", high_voltage_threshold, high_voltage_raw); return 0; } static int read_shutdown_iavg_ma(struct qpnp_bms_chip *chip) { u8 iavg; int rc; rc = qpnp_read_wrapper(chip, &iavg, chip->base + IAVG_STORAGE_REG, 1); if (rc) { pr_err("failed to read addr = %d %d assuming %d\n", chip->base + IAVG_STORAGE_REG, rc, MIN_IAVG_MA); return MIN_IAVG_MA; } else if (iavg == IAVG_INVALID) { pr_err("invalid iavg read from BMS1_DATA_REG_1, using %d\n", MIN_IAVG_MA); return MIN_IAVG_MA; } else { if (iavg == 0) return MIN_IAVG_MA; else return MIN_IAVG_MA + IAVG_STEP_SIZE_MA * iavg; } } static int read_shutdown_soc(struct qpnp_bms_chip *chip) { u8 stored_soc; int rc, shutdown_soc; /* * The previous SOC is stored in the first 7 bits of the register as * (Shutdown SOC + 1). This allows for register reset values of both * 0x00 and 0x7F. */ rc = qpnp_read_wrapper(chip, &stored_soc, chip->soc_storage_addr, 1); if (rc) { pr_err("failed to read addr = %d %d\n", chip->soc_storage_addr, rc); return SOC_INVALID; } if ((stored_soc >> 1) > 0) shutdown_soc = (stored_soc >> 1) - 1; else shutdown_soc = SOC_INVALID; pr_debug("stored soc = 0x%02x, shutdown_soc = %d\n", stored_soc, shutdown_soc); return shutdown_soc; } #define BAT_REMOVED_OFFMODE_BIT BIT(6) static bool is_battery_replaced_in_offmode(struct qpnp_bms_chip *chip) { u8 batt_pres; int rc; if (chip->batt_pres_addr) { rc = qpnp_read_wrapper(chip, &batt_pres, chip->batt_pres_addr, 1); pr_debug("offmode removed: %02x\n", batt_pres); if (!rc && (batt_pres & BAT_REMOVED_OFFMODE_BIT)) return true; } return false; } static void load_shutdown_data(struct qpnp_bms_chip *chip) { int calculated_soc, shutdown_soc; bool invalid_stored_soc; bool offmode_battery_replaced; bool shutdown_soc_out_of_limit; /* * Read the saved shutdown SoC from the configured register and * check if the value has been reset */ shutdown_soc = read_shutdown_soc(chip); invalid_stored_soc = (shutdown_soc == SOC_INVALID); /* * Do a quick run of SoC calculation to find whether the shutdown soc * is close enough. */ calculated_soc = recalculate_raw_soc(chip); shutdown_soc_out_of_limit = (abs(shutdown_soc - calculated_soc) > chip->shutdown_soc_valid_limit); pr_debug("calculated_soc = %d, valid_limit = %d\n", calculated_soc, chip->shutdown_soc_valid_limit); /* * Check if the battery has been replaced while the system was powered * down. */ offmode_battery_replaced = is_battery_replaced_in_offmode(chip); /* Invalidate the shutdown SoC if any of these conditions hold true */ if (chip->ignore_shutdown_soc || invalid_stored_soc || offmode_battery_replaced || shutdown_soc_out_of_limit) { chip->battery_removed = true; chip->shutdown_soc_invalid = true; chip->shutdown_iavg_ma = MIN_IAVG_MA; pr_debug("Ignoring shutdown SoC: invalid = %d, offmode = %d, out_of_limit = %d\n", invalid_stored_soc, offmode_battery_replaced, shutdown_soc_out_of_limit); } else { chip->shutdown_iavg_ma = read_shutdown_iavg_ma(chip); chip->shutdown_soc = shutdown_soc; } pr_debug("raw_soc = %d shutdown_soc = %d shutdown_iavg = %d shutdown_soc_invalid = %d, battery_removed = %d\n", calculated_soc, chip->shutdown_soc, chip->shutdown_iavg_ma, chip->shutdown_soc_invalid, chip->battery_removed); } static irqreturn_t bms_ocv_thr_irq_handler(int irq, void *_chip) { struct qpnp_bms_chip *chip = _chip; pr_debug("ocv_thr irq triggered\n"); bms_stay_awake(&chip->soc_wake_source); schedule_work(&chip->recalc_work); return IRQ_HANDLED; } static irqreturn_t bms_sw_cc_thr_irq_handler(int irq, void *_chip) { struct qpnp_bms_chip *chip = _chip; pr_debug("sw_cc_thr irq triggered\n"); disable_bms_irq_nosync(&chip->sw_cc_thr_irq); bms_stay_awake(&chip->soc_wake_source); schedule_work(&chip->recalc_work); return IRQ_HANDLED; } static int64_t read_battery_id(struct qpnp_bms_chip *chip) { int rc; struct qpnp_vadc_result result; rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX2_BAT_ID, &result); if (rc) { pr_err("error reading batt id channel = %d, rc = %d\n", LR_MUX2_BAT_ID, rc); return rc; } return result.physical; } static int set_battery_data(struct qpnp_bms_chip *chip) { int64_t battery_id; int rc = 0, dt_data = false; struct bms_battery_data *batt_data; struct device_node *node; if (chip->batt_type == BATT_DESAY) { batt_data = &desay_5200_data; } else if (chip->batt_type == BATT_PALLADIUM) { batt_data = &palladium_1500_data; } else if (chip->batt_type == BATT_OEM) { batt_data = &oem_batt_data; } else if (chip->batt_type == BATT_QRD_4V35_2000MAH) { batt_data = &QRD_4v35_2000mAh_data; } else if (chip->batt_type == BATT_QRD_4V2_1300MAH) { batt_data = &qrd_4v2_1300mah_data; } else { battery_id = read_battery_id(chip); if (battery_id < 0) { pr_err("cannot read battery id err = %lld\n", battery_id); return battery_id; } node = of_find_node_by_name(chip->spmi->dev.of_node, "qcom,battery-data"); if (!node) { pr_warn("No available batterydata, using palladium 1500\n"); batt_data = &palladium_1500_data; goto assign_data; } batt_data = devm_kzalloc(chip->dev, sizeof(struct bms_battery_data), GFP_KERNEL); if (!batt_data) { pr_err("Could not alloc battery data\n"); batt_data = &palladium_1500_data; goto assign_data; } batt_data->fcc_temp_lut = devm_kzalloc(chip->dev, sizeof(struct single_row_lut), GFP_KERNEL); batt_data->pc_temp_ocv_lut = devm_kzalloc(chip->dev, sizeof(struct pc_temp_ocv_lut), GFP_KERNEL); batt_data->rbatt_sf_lut = devm_kzalloc(chip->dev, sizeof(struct sf_lut), GFP_KERNEL); batt_data->max_voltage_uv = -1; batt_data->cutoff_uv = -1; batt_data->iterm_ua = -1; /* * if the alloced luts are 0s, of_batterydata_read_data ignores * them. */ rc = of_batterydata_read_data(node, batt_data, battery_id); if (rc == 0 && batt_data->fcc_temp_lut && batt_data->pc_temp_ocv_lut && batt_data->rbatt_sf_lut) { dt_data = true; } else { pr_err("battery data load failed, using palladium 1500\n"); devm_kfree(chip->dev, batt_data->fcc_temp_lut); devm_kfree(chip->dev, batt_data->pc_temp_ocv_lut); devm_kfree(chip->dev, batt_data->rbatt_sf_lut); devm_kfree(chip->dev, batt_data); batt_data = &palladium_1500_data; } } assign_data: chip->fcc_mah = batt_data->fcc; chip->fcc_temp_lut = batt_data->fcc_temp_lut; chip->fcc_sf_lut = batt_data->fcc_sf_lut; chip->pc_temp_ocv_lut = batt_data->pc_temp_ocv_lut; chip->pc_sf_lut = batt_data->pc_sf_lut; chip->rbatt_sf_lut = batt_data->rbatt_sf_lut; chip->default_rbatt_mohm = batt_data->default_rbatt_mohm; chip->rbatt_capacitive_mohm = batt_data->rbatt_capacitive_mohm; chip->flat_ocv_threshold_uv = batt_data->flat_ocv_threshold_uv; /* Override battery properties if specified in the battery profile */ if (batt_data->max_voltage_uv >= 0 && dt_data) chip->max_voltage_uv = batt_data->max_voltage_uv; if (batt_data->cutoff_uv >= 0 && dt_data) chip->v_cutoff_uv = batt_data->cutoff_uv; if (batt_data->iterm_ua >= 0 && dt_data) chip->chg_term_ua = batt_data->iterm_ua; if (chip->pc_temp_ocv_lut == NULL) { pr_err("temp ocv lut table has not been loaded\n"); if (dt_data) { devm_kfree(chip->dev, batt_data->fcc_temp_lut); devm_kfree(chip->dev, batt_data->pc_temp_ocv_lut); devm_kfree(chip->dev, batt_data->rbatt_sf_lut); devm_kfree(chip->dev, batt_data); } return -EINVAL; } if (dt_data) devm_kfree(chip->dev, batt_data); return 0; } static int bms_get_adc(struct qpnp_bms_chip *chip, struct spmi_device *spmi) { int rc = 0; chip->vadc_dev = qpnp_get_vadc(&spmi->dev, "bms"); if (IS_ERR(chip->vadc_dev)) { rc = PTR_ERR(chip->vadc_dev); if (rc != -EPROBE_DEFER) pr_err("vadc property missing, rc=%d\n", rc); return rc; } chip->iadc_dev = qpnp_get_iadc(&spmi->dev, "bms"); if (IS_ERR(chip->iadc_dev)) { rc = PTR_ERR(chip->iadc_dev); if (rc != -EPROBE_DEFER) pr_err("iadc property missing, rc=%d\n", rc); return rc; } chip->adc_tm_dev = qpnp_get_adc_tm(&spmi->dev, "bms"); if (IS_ERR(chip->adc_tm_dev)) { rc = PTR_ERR(chip->adc_tm_dev); if (rc != -EPROBE_DEFER) pr_err("adc-tm not ready, defer probe\n"); return rc; } return 0; } #define SPMI_PROP_READ(chip_prop, qpnp_spmi_property, retval) \ do { \ if (retval) \ break; \ retval = of_property_read_u32(chip->spmi->dev.of_node, \ "qcom," qpnp_spmi_property, \ &chip->chip_prop); \ if (retval) { \ pr_err("Error reading " #qpnp_spmi_property \ " property %d\n", rc); \ } \ } while (0) #define SPMI_PROP_READ_BOOL(chip_prop, qpnp_spmi_property) \ do { \ chip->chip_prop = of_property_read_bool(chip->spmi->dev.of_node,\ "qcom," qpnp_spmi_property); \ } while (0) static inline int bms_read_properties(struct qpnp_bms_chip *chip) { int rc = 0; SPMI_PROP_READ(r_sense_uohm, "r-sense-uohm", rc); SPMI_PROP_READ(v_cutoff_uv, "v-cutoff-uv", rc); SPMI_PROP_READ(max_voltage_uv, "max-voltage-uv", rc); SPMI_PROP_READ(r_conn_mohm, "r-conn-mohm", rc); SPMI_PROP_READ(chg_term_ua, "chg-term-ua", rc); SPMI_PROP_READ(shutdown_soc_valid_limit, "shutdown-soc-valid-limit", rc); SPMI_PROP_READ(adjust_soc_low_threshold, "adjust-soc-low-threshold", rc); SPMI_PROP_READ(batt_type, "batt-type", rc); SPMI_PROP_READ(low_soc_calc_threshold, "low-soc-calculate-soc-threshold", rc); SPMI_PROP_READ(low_soc_calculate_soc_ms, "low-soc-calculate-soc-ms", rc); SPMI_PROP_READ(low_voltage_calculate_soc_ms, "low-voltage-calculate-soc-ms", rc); SPMI_PROP_READ(calculate_soc_ms, "calculate-soc-ms", rc); SPMI_PROP_READ(high_ocv_correction_limit_uv, "high-ocv-correction-limit-uv", rc); SPMI_PROP_READ(low_ocv_correction_limit_uv, "low-ocv-correction-limit-uv", rc); SPMI_PROP_READ(hold_soc_est, "hold-soc-est", rc); SPMI_PROP_READ(ocv_high_threshold_uv, "ocv-voltage-high-threshold-uv", rc); SPMI_PROP_READ(ocv_low_threshold_uv, "ocv-voltage-low-threshold-uv", rc); SPMI_PROP_READ(low_voltage_threshold, "low-voltage-threshold", rc); SPMI_PROP_READ(temperature_margin, "tm-temp-margin", rc); chip->use_external_rsense = of_property_read_bool( chip->spmi->dev.of_node, "qcom,use-external-rsense"); chip->ignore_shutdown_soc = of_property_read_bool( chip->spmi->dev.of_node, "qcom,ignore-shutdown-soc"); chip->use_voltage_soc = of_property_read_bool(chip->spmi->dev.of_node, "qcom,use-voltage-soc"); chip->use_ocv_thresholds = of_property_read_bool( chip->spmi->dev.of_node, "qcom,use-ocv-thresholds"); if (chip->adjust_soc_low_threshold >= 45) chip->adjust_soc_low_threshold = 45; SPMI_PROP_READ_BOOL(enable_fcc_learning, "enable-fcc-learning"); if (chip->enable_fcc_learning) { SPMI_PROP_READ(min_fcc_learning_soc, "min-fcc-learning-soc", rc); SPMI_PROP_READ(min_fcc_ocv_pc, "min-fcc-ocv-pc", rc); SPMI_PROP_READ(min_fcc_learning_samples, "min-fcc-learning-samples", rc); SPMI_PROP_READ(fcc_resolution, "fcc-resolution", rc); if (chip->min_fcc_learning_samples > MAX_FCC_CYCLES) chip->min_fcc_learning_samples = MAX_FCC_CYCLES; chip->fcc_learning_samples = devm_kzalloc(&chip->spmi->dev, (sizeof(struct fcc_sample) * chip->min_fcc_learning_samples), GFP_KERNEL); if (chip->fcc_learning_samples == NULL) return -ENOMEM; pr_debug("min-fcc-soc=%d, min-fcc-pc=%d, min-fcc-cycles=%d\n", chip->min_fcc_learning_soc, chip->min_fcc_ocv_pc, chip->min_fcc_learning_samples); } if (rc) { pr_err("Missing required properties.\n"); return rc; } pr_debug("dts data: r_sense_uohm:%d, v_cutoff_uv:%d, max_v:%d\n", chip->r_sense_uohm, chip->v_cutoff_uv, chip->max_voltage_uv); pr_debug("r_conn:%d, shutdown_soc: %d, adjust_soc_low:%d\n", chip->r_conn_mohm, chip->shutdown_soc_valid_limit, chip->adjust_soc_low_threshold); pr_debug("chg_term_ua:%d, batt_type:%d\n", chip->chg_term_ua, chip->batt_type); pr_debug("ignore_shutdown_soc:%d, use_voltage_soc:%d\n", chip->ignore_shutdown_soc, chip->use_voltage_soc); pr_debug("use external rsense: %d\n", chip->use_external_rsense); return 0; } static inline void bms_initialize_constants(struct qpnp_bms_chip *chip) { chip->prev_pc_unusable = -EINVAL; chip->soc_at_cv = -EINVAL; chip->calculated_soc = -EINVAL; chip->last_soc = -EINVAL; chip->last_soc_est = -EINVAL; chip->battery_present = -EINVAL; chip->battery_status = POWER_SUPPLY_STATUS_UNKNOWN; chip->last_cc_uah = INT_MIN; chip->ocv_reading_at_100 = OCV_RAW_UNINITIALIZED; chip->prev_last_good_ocv_raw = OCV_RAW_UNINITIALIZED; chip->first_time_calc_soc = 1; chip->first_time_calc_uuc = 1; } #define SPMI_FIND_IRQ(chip, irq_name) \ do { \ chip->irq_name##_irq.irq = spmi_get_irq_byname(chip->spmi, \ resource, #irq_name); \ if (chip->irq_name##_irq.irq < 0) { \ pr_err("Unable to get " #irq_name " irq\n"); \ return -ENXIO; \ } \ } while (0) static int bms_find_irqs(struct qpnp_bms_chip *chip, struct spmi_resource *resource) { SPMI_FIND_IRQ(chip, sw_cc_thr); SPMI_FIND_IRQ(chip, ocv_thr); return 0; } #define SPMI_REQUEST_IRQ(chip, rc, irq_name) \ do { \ rc = devm_request_irq(chip->dev, chip->irq_name##_irq.irq, \ bms_##irq_name##_irq_handler, \ IRQF_TRIGGER_RISING, #irq_name, chip); \ if (rc < 0) { \ pr_err("Unable to request " #irq_name " irq: %d\n", rc);\ return -ENXIO; \ } \ chip->irq_name##_irq.ready = true; \ } while (0) static int bms_request_irqs(struct qpnp_bms_chip *chip) { int rc; SPMI_REQUEST_IRQ(chip, rc, sw_cc_thr); enable_irq_wake(chip->sw_cc_thr_irq.irq); SPMI_REQUEST_IRQ(chip, rc, ocv_thr); enable_irq_wake(chip->ocv_thr_irq.irq); return 0; } #define REG_OFFSET_PERP_TYPE 0x04 #define REG_OFFSET_PERP_SUBTYPE 0x05 #define BMS_BMS_TYPE 0xD #define BMS_BMS1_SUBTYPE 0x1 #define BMS_IADC_TYPE 0x8 #define BMS_IADC1_SUBTYPE 0x3 #define BMS_IADC2_SUBTYPE 0x5 static int register_spmi(struct qpnp_bms_chip *chip, struct spmi_device *spmi) { struct spmi_resource *spmi_resource; struct resource *resource; int rc; u8 type, subtype; chip->dev = &(spmi->dev); chip->spmi = spmi; spmi_for_each_container_dev(spmi_resource, spmi) { if (!spmi_resource) { pr_err("qpnp_bms: spmi resource absent\n"); return -ENXIO; } resource = spmi_get_resource(spmi, spmi_resource, IORESOURCE_MEM, 0); if (!(resource && resource->start)) { pr_err("node %s IO resource absent!\n", spmi->dev.of_node->full_name); return -ENXIO; } pr_debug("Node name = %s\n", spmi_resource->of_node->name); if (strcmp("qcom,batt-pres-status", spmi_resource->of_node->name) == 0) { chip->batt_pres_addr = resource->start; continue; } else if (strcmp("qcom,soc-storage-reg", spmi_resource->of_node->name) == 0) { chip->soc_storage_addr = resource->start; continue; } rc = qpnp_read_wrapper(chip, &type, resource->start + REG_OFFSET_PERP_TYPE, 1); if (rc) { pr_err("Peripheral type read failed rc=%d\n", rc); return rc; } rc = qpnp_read_wrapper(chip, &subtype, resource->start + REG_OFFSET_PERP_SUBTYPE, 1); if (rc) { pr_err("Peripheral subtype read failed rc=%d\n", rc); return rc; } if (type == BMS_BMS_TYPE && subtype == BMS_BMS1_SUBTYPE) { chip->base = resource->start; rc = bms_find_irqs(chip, spmi_resource); if (rc) { pr_err("Could not find irqs\n"); return rc; } } else if (type == BMS_IADC_TYPE && (subtype == BMS_IADC1_SUBTYPE || subtype == BMS_IADC2_SUBTYPE)) { chip->iadc_base = resource->start; } else { pr_err("Invalid peripheral start=0x%x type=0x%x, subtype=0x%x\n", resource->start, type, subtype); } } if (chip->base == 0) { dev_err(&spmi->dev, "BMS peripheral was not registered\n"); return -EINVAL; } if (chip->iadc_base == 0) { dev_err(&spmi->dev, "BMS_IADC peripheral was not registered\n"); return -EINVAL; } if (chip->soc_storage_addr == 0) { /* default to dvdd backed BMS data reg0 */ chip->soc_storage_addr = chip->base + SOC_STORAGE_REG; } pr_debug("bms-base = 0x%04x, iadc-base = 0x%04x, bat-pres-reg = 0x%04x, soc-storage-reg = 0x%04x\n", chip->base, chip->iadc_base, chip->batt_pres_addr, chip->soc_storage_addr); return 0; } #define ADC_CH_SEL_MASK 0x7 #define ADC_INT_RSNSN_CTL_MASK 0x3 #define ADC_INT_RSNSN_CTL_VALUE_EXT_RENSE 0x2 #define FAST_AVG_EN_MASK 0x80 #define FAST_AVG_EN_VALUE_EXT_RSENSE 0x80 static int read_iadc_channel_select(struct qpnp_bms_chip *chip) { u8 iadc_channel_select; int32_t rds_rsense_nohm; int rc; rc = qpnp_read_wrapper(chip, &iadc_channel_select, chip->iadc_base + IADC1_BMS_ADC_CH_SEL_CTL, 1); if (rc) { pr_err("Error reading bms_iadc channel register %d\n", rc); return rc; } iadc_channel_select &= ADC_CH_SEL_MASK; if (iadc_channel_select != EXTERNAL_RSENSE && iadc_channel_select != INTERNAL_RSENSE) { pr_err("IADC1_BMS_IADC configured incorrectly. Selected channel = %d\n", iadc_channel_select); return -EINVAL; } if (chip->use_external_rsense) { pr_debug("External rsense selected\n"); if (iadc_channel_select == INTERNAL_RSENSE) { pr_debug("Internal rsense detected; Changing rsense to external\n"); rc = qpnp_masked_write_iadc(chip, IADC1_BMS_ADC_CH_SEL_CTL, ADC_CH_SEL_MASK, EXTERNAL_RSENSE); if (rc) { pr_err("Unable to set IADC1_BMS channel %x to %x: %d\n", IADC1_BMS_ADC_CH_SEL_CTL, EXTERNAL_RSENSE, rc); return rc; } reset_cc(chip, CLEAR_CC | CLEAR_SHDW_CC); chip->software_cc_uah = 0; chip->software_shdw_cc_uah = 0; } } else { pr_debug("Internal rsense selected\n"); if (iadc_channel_select == EXTERNAL_RSENSE) { pr_debug("External rsense detected; Changing rsense to internal\n"); rc = qpnp_masked_write_iadc(chip, IADC1_BMS_ADC_CH_SEL_CTL, ADC_CH_SEL_MASK, INTERNAL_RSENSE); if (rc) { pr_err("Unable to set IADC1_BMS channel %x to %x: %d\n", IADC1_BMS_ADC_CH_SEL_CTL, INTERNAL_RSENSE, rc); return rc; } reset_cc(chip, CLEAR_CC | CLEAR_SHDW_CC); chip->software_shdw_cc_uah = 0; } rc = qpnp_iadc_get_rsense(chip->iadc_dev, &rds_rsense_nohm); if (rc) { pr_err("Unable to read RDS resistance value from IADC; rc = %d\n", rc); return rc; } chip->r_sense_uohm = rds_rsense_nohm/1000; pr_debug("rds_rsense = %d nOhm, saved as %d uOhm\n", rds_rsense_nohm, chip->r_sense_uohm); } /* prevent shorting of leads by IADC_BMS when external Rsense is used */ if (chip->use_external_rsense) { if (chip->iadc_bms_revision2 > CALIB_WRKARND_DIG_MAJOR_MAX) { rc = qpnp_masked_write_iadc(chip, IADC1_BMS_ADC_INT_RSNSN_CTL, ADC_INT_RSNSN_CTL_MASK, ADC_INT_RSNSN_CTL_VALUE_EXT_RENSE); if (rc) { pr_err("Unable to set batfet config %x to %x: %d\n", IADC1_BMS_ADC_INT_RSNSN_CTL, ADC_INT_RSNSN_CTL_VALUE_EXT_RENSE, rc); return rc; } } else { /* In older PMICS use FAST_AVG_EN register bit 7 */ rc = qpnp_masked_write_iadc(chip, IADC1_BMS_FAST_AVG_EN, FAST_AVG_EN_MASK, FAST_AVG_EN_VALUE_EXT_RSENSE); if (rc) { pr_err("Unable to set batfet config %x to %x: %d\n", IADC1_BMS_FAST_AVG_EN, FAST_AVG_EN_VALUE_EXT_RSENSE, rc); return rc; } } } return 0; } static int refresh_die_temp_monitor(struct qpnp_bms_chip *chip) { struct qpnp_vadc_result result; int rc; rc = qpnp_vadc_read(chip->vadc_dev, DIE_TEMP, &result); pr_debug("low = %lld, high = %lld\n", result.physical - chip->temperature_margin, result.physical + chip->temperature_margin); chip->die_temp_monitor_params.high_temp = result.physical + chip->temperature_margin; chip->die_temp_monitor_params.low_temp = result.physical - chip->temperature_margin; chip->die_temp_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_ENABLE; return qpnp_adc_tm_channel_measure(chip->adc_tm_dev, &chip->die_temp_monitor_params); } static void btm_notify_die_temp(enum qpnp_tm_state state, void *ctx) { struct qpnp_bms_chip *chip = ctx; struct qpnp_vadc_result result; int rc; rc = qpnp_vadc_read(chip->vadc_dev, DIE_TEMP, &result); if (state == ADC_TM_LOW_STATE) pr_debug("low state triggered\n"); else if (state == ADC_TM_HIGH_STATE) pr_debug("high state triggered\n"); pr_debug("die temp = %lld, raw = 0x%x\n", result.physical, result.adc_code); schedule_work(&chip->recalc_work); refresh_die_temp_monitor(chip); } static int setup_die_temp_monitoring(struct qpnp_bms_chip *chip) { int rc; chip->die_temp_monitor_params.channel = DIE_TEMP; chip->die_temp_monitor_params.btm_ctx = (void *)chip; chip->die_temp_monitor_params.timer_interval = ADC_MEAS1_INTERVAL_1S; chip->die_temp_monitor_params.threshold_notification = &btm_notify_die_temp; rc = refresh_die_temp_monitor(chip); if (rc) { pr_err("tm setup failed: %d\n", rc); return rc; } pr_debug("setup complete\n"); return 0; } static int __devinit qpnp_bms_probe(struct spmi_device *spmi) { struct qpnp_bms_chip *chip; bool warm_reset; int rc, vbatt; chip = devm_kzalloc(&spmi->dev, sizeof(struct qpnp_bms_chip), GFP_KERNEL); if (chip == NULL) { pr_err("kzalloc() failed.\n"); return -ENOMEM; } rc = bms_get_adc(chip, spmi); if (rc < 0) goto error_read; mutex_init(&chip->bms_output_lock); mutex_init(&chip->last_ocv_uv_mutex); mutex_init(&chip->vbat_monitor_mutex); mutex_init(&chip->soc_invalidation_mutex); mutex_init(&chip->last_soc_mutex); mutex_init(&chip->status_lock); init_waitqueue_head(&chip->bms_wait_queue); warm_reset = qpnp_pon_is_warm_reset(); rc = warm_reset; if (rc < 0) goto error_read; rc = register_spmi(chip, spmi); if (rc) { pr_err("error registering spmi resource %d\n", rc); goto error_resource; } rc = qpnp_read_wrapper(chip, &chip->revision1, chip->base + REVISION1, 1); if (rc) { pr_err("error reading version register %d\n", rc); goto error_read; } rc = qpnp_read_wrapper(chip, &chip->revision2, chip->base + REVISION2, 1); if (rc) { pr_err("Error reading version register %d\n", rc); goto error_read; } pr_debug("BMS version: %hhu.%hhu\n", chip->revision2, chip->revision1); rc = qpnp_read_wrapper(chip, &chip->iadc_bms_revision2, chip->iadc_base + REVISION2, 1); if (rc) { pr_err("Error reading version register %d\n", rc); goto error_read; } rc = qpnp_read_wrapper(chip, &chip->iadc_bms_revision1, chip->iadc_base + REVISION1, 1); if (rc) { pr_err("Error reading version register %d\n", rc); goto error_read; } pr_debug("IADC_BMS version: %hhu.%hhu\n", chip->iadc_bms_revision2, chip->iadc_bms_revision1); rc = bms_read_properties(chip); if (rc) { pr_err("Unable to read all bms properties, rc = %d\n", rc); goto error_read; } rc = read_iadc_channel_select(chip); if (rc) { pr_err("Unable to get iadc selected channel = %d\n", rc); goto error_read; } if (chip->use_ocv_thresholds) { rc = set_ocv_voltage_thresholds(chip, chip->ocv_low_threshold_uv, chip->ocv_high_threshold_uv); if (rc) { pr_err("Could not set ocv voltage thresholds: %d\n", rc); goto error_read; } } rc = set_battery_data(chip); if (rc) { pr_err("Bad battery data %d\n", rc); goto error_read; } bms_initialize_constants(chip); wakeup_source_init(&chip->soc_wake_source.source, "qpnp_soc_wake"); wake_lock_init(&chip->low_voltage_wake_lock, WAKE_LOCK_SUSPEND, "qpnp_low_voltage_lock"); wake_lock_init(&chip->cv_wake_lock, WAKE_LOCK_SUSPEND, "qpnp_cv_lock"); INIT_DELAYED_WORK(&chip->calculate_soc_delayed_work, calculate_soc_work); INIT_WORK(&chip->recalc_work, recalculate_work); INIT_WORK(&chip->batfet_open_work, batfet_open_work); dev_set_drvdata(&spmi->dev, chip); device_init_wakeup(&spmi->dev, 1); load_shutdown_data(chip); if (chip->enable_fcc_learning) { if (chip->battery_removed) { rc = discard_backup_fcc_data(chip); if (rc) pr_err("Could not discard backed-up FCC data\n"); } else { rc = read_chgcycle_data_from_backup(chip); if (rc) pr_err("Unable to restore charge-cycle data\n"); rc = read_fcc_data_from_backup(chip); if (rc) pr_err("Unable to restore FCC-learning data\n"); else attempt_learning_new_fcc(chip); } } rc = setup_vbat_monitoring(chip); if (rc < 0) { pr_err("failed to set up voltage notifications: %d\n", rc); goto error_setup; } rc = setup_die_temp_monitoring(chip); if (rc < 0) { pr_err("failed to set up die temp notifications: %d\n", rc); goto error_setup; } rc = bms_request_irqs(chip); if (rc) { pr_err("error requesting bms irqs, rc = %d\n", rc); goto error_setup; } battery_insertion_check(chip); batfet_status_check(chip); battery_status_check(chip); calculate_soc_work(&(chip->calculate_soc_delayed_work.work)); /* setup & register the battery power supply */ chip->bms_psy.name = "bms"; chip->bms_psy.type = POWER_SUPPLY_TYPE_BMS; chip->bms_psy.properties = msm_bms_power_props; chip->bms_psy.num_properties = ARRAY_SIZE(msm_bms_power_props); chip->bms_psy.get_property = qpnp_bms_power_get_property; chip->bms_psy.external_power_changed = qpnp_bms_external_power_changed; chip->bms_psy.supplied_to = qpnp_bms_supplicants; chip->bms_psy.num_supplicants = ARRAY_SIZE(qpnp_bms_supplicants); rc = power_supply_register(chip->dev, &chip->bms_psy); if (rc < 0) { pr_err("power_supply_register bms failed rc = %d\n", rc); goto unregister_dc; } chip->bms_psy_registered = true; vbatt = 0; rc = get_battery_voltage(chip, &vbatt); if (rc) { pr_err("error reading vbat_sns adc channel = %d, rc = %d\n", VBAT_SNS, rc); goto unregister_dc; } pr_info("probe success: soc =%d vbatt = %d ocv = %d r_sense_uohm = %u warm_reset = %d\n", get_prop_bms_capacity(chip), vbatt, chip->last_ocv_uv, chip->r_sense_uohm, warm_reset); return 0; unregister_dc: chip->bms_psy_registered = false; power_supply_unregister(&chip->bms_psy); error_setup: dev_set_drvdata(&spmi->dev, NULL); wakeup_source_trash(&chip->soc_wake_source.source); wake_lock_destroy(&chip->low_voltage_wake_lock); wake_lock_destroy(&chip->cv_wake_lock); error_resource: error_read: return rc; } static int qpnp_bms_remove(struct spmi_device *spmi) { dev_set_drvdata(&spmi->dev, NULL); return 0; } static int bms_suspend(struct device *dev) { struct qpnp_bms_chip *chip = dev_get_drvdata(dev); cancel_delayed_work_sync(&chip->calculate_soc_delayed_work); chip->was_charging_at_sleep = is_battery_charging(chip); return 0; } static int bms_resume(struct device *dev) { int rc; int soc_calc_period; int time_until_next_recalc = 0; unsigned long time_since_last_recalc; unsigned long tm_now_sec; struct qpnp_bms_chip *chip = dev_get_drvdata(dev); rc = get_current_time(&tm_now_sec); if (rc) { pr_err("Could not read current time: %d\n", rc); } else { soc_calc_period = get_calculation_delay_ms(chip); time_since_last_recalc = tm_now_sec - chip->last_recalc_time; pr_debug("Time since last recalc: %lu\n", time_since_last_recalc); time_until_next_recalc = max(0, soc_calc_period - (int)(time_since_last_recalc * 1000)); } if (time_until_next_recalc == 0) bms_stay_awake(&chip->soc_wake_source); schedule_delayed_work(&chip->calculate_soc_delayed_work, round_jiffies_relative(msecs_to_jiffies (time_until_next_recalc))); return 0; } static const struct dev_pm_ops qpnp_bms_pm_ops = { .resume = bms_resume, .suspend = bms_suspend, }; static struct spmi_driver qpnp_bms_driver = { .probe = qpnp_bms_probe, .remove = __devexit_p(qpnp_bms_remove), .driver = { .name = QPNP_BMS_DEV_NAME, .owner = THIS_MODULE, .of_match_table = qpnp_bms_match_table, .pm = &qpnp_bms_pm_ops, }, }; static int __init qpnp_bms_init(void) { pr_info("QPNP BMS INIT\n"); return spmi_driver_register(&qpnp_bms_driver); } static void __exit qpnp_bms_exit(void) { pr_info("QPNP BMS EXIT\n"); return spmi_driver_unregister(&qpnp_bms_driver); } module_init(qpnp_bms_init); module_exit(qpnp_bms_exit); MODULE_DESCRIPTION("QPNP BMS Driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:" QPNP_BMS_DEV_NAME);
moongtaeng/android_kernel_pantech_ef56s
drivers/power/qpnp-bms.c
C
gpl-2.0
126,236
// $Id: SOCK_Netlink.h 80826 2008-03-04 14:51:23Z wotte $ //============================================================================= /** * @file SOCK_Netlink.h * * $Id: SOCK_Netlink.h 80826 2008-03-04 14:51:23Z wotte $ * * @author Robert Iakobashvilli <coroberti@gmail.com> * @author Raz Ben Yehuda <raziebe@013.net.il> */ //============================================================================= #ifndef ACE_SOCK_NETLINK_H #define ACE_SOCK_NETLINK_H #include /**/ "ace/pre.h" #include /**/ "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #ifdef ACE_HAS_NETLINK #include "ace/SOCK.h" #include "ace/Netlink_Addr.h" #include "ace/Addr.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_SOCK_Netlink * * @brief Defines the member functions for the ACE_SOCK Netlink * abstraction. * Netlink sockets are used in Linux as a communication facilty of kernel to user * and user to kernel. * This code was created so one could use ACE reactor * as a gateway to a linux kernel. * */ class ACE_Export ACE_SOCK_Netlink : public ACE_SOCK { public: // = Initialization and termination methods. /// Default constructor. ACE_SOCK_Netlink(void); ~ACE_SOCK_Netlink(void); ACE_SOCK_Netlink (ACE_Netlink_Addr &local, int protocol_family, int protocol); /** * opens a RAW socket over an ACE_SOCK and binds it * **/ int open (ACE_Netlink_Addr &local, int protocol_family, int protocol); /** * receives abuffer with the size n */ ssize_t recv (void *buf, size_t n, int flags) const; /** * send a buffer of size n bytes * */ ssize_t send (void *buf, size_t n, int flags) const; /** * Recieves an iovec of size @a n to the netlink socket */ ssize_t recv (iovec iov[], int n, ACE_Addr &addr, int flags = 0) const; /** * Sends an iovec of size @a n to the netlink socket */ ssize_t send (const iovec iov[], int n, const ACE_Addr &addr, int flags = 0) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/SOCK_Netlink.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_NETLINK */ #include /**/ "ace/post.h" #endif /* ACE_SOCK_NETLINK_H */
skyne/NeoCore
dep/ACE_wrappers/ace/SOCK_Netlink.h
C
gpl-2.0
2,521
source_sh ${srcdir}/emulparams/elf64btsmip.sh source_sh ${srcdir}/emulparams/elf_fbsd.sh OUTPUT_FORMAT="elf64-tradbigmips-freebsd" BIG_OUTPUT_FORMAT="elf64-tradbigmips-freebsd" LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips-freebsd"
mattstock/binutils-bexkat1
ld/emulparams/elf64btsmip_fbsd.sh
Shell
gpl-2.0
229
"""Tables, Widgets, and Groups! An example of tables and most of the included widgets. """ import pygame from pygame.locals import * # the following line is not needed if pgu is installed import sys; sys.path.insert(0, "..") from pgu import gui # Load an alternate theme to show how it is done. You can also # specify a path (absolute or relative) to your own custom theme: # # app = gui.Desktop(theme=gui.Theme("path/to/theme")) # app = gui.Desktop() app.connect(gui.QUIT,app.quit,None) ##The table code is entered much like HTML. ##:: c = gui.Table() c.tr() c.td(gui.Label("Gui Widgets"),colspan=4) def cb(): print("Clicked!") btn = gui.Button("Click Me!") btn.connect(gui.CLICK, cb) c.tr() c.td(gui.Label("Button")) c.td(btn,colspan=3) ## c.tr() c.td(gui.Label("Switch")) c.td(gui.Switch(False),colspan=3) c.tr() c.td(gui.Label("Checkbox")) ##Note how Groups are used for Radio buttons, Checkboxes, and Tools. ##:: g = gui.Group(value=[1,3]) c.td(gui.Checkbox(g,value=1)) c.td(gui.Checkbox(g,value=2)) c.td(gui.Checkbox(g,value=3)) ## c.tr() c.td(gui.Label("Radio")) g = gui.Group() c.td(gui.Radio(g,value=1)) c.td(gui.Radio(g,value=2)) c.td(gui.Radio(g,value=3)) c.tr() c.td(gui.Label("Select")) e = gui.Select() e.add("Goat",'goat') e.add("Horse",'horse') e.add("Dog",'dog') e.add("Pig",'pig') c.td(e,colspan=3) c.tr() c.td(gui.Label("Tool")) g = gui.Group(value='b') c.td(gui.Tool(g,gui.Label('A'),value='a')) c.td(gui.Tool(g,gui.Label('B'),value='b')) c.td(gui.Tool(g,gui.Label('C'),value='c')) c.tr() c.td(gui.Label("Input")) def cb(): print("Input received") w = gui.Input(value='Cuzco',size=8) w.connect("activate", cb) c.td(w,colspan=3) c.tr() c.td(gui.Label("Slider")) c.td(gui.HSlider(value=23,min=0,max=100,size=20,width=120),colspan=3) c.tr() c.td(gui.Label("Keysym")) c.td(gui.Keysym(),colspan=3) c.tr() c.td(gui.Label("Text Area"), colspan=4, align=-1) c.tr() c.td(gui.TextArea(value="Cuzco the Goat", width=150, height=70), colspan=4) app.run(c)
danstoner/python_experiments
pgu/examples/gui5.py
Python
gpl-2.0
1,996
/*** This file is part of systemd. Copyright 2010 Lennart Poettering systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <errno.h> #include <stdarg.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <syslog.h> #include "alloc-util.h" #include "escape.h" #include "extract-word.h" #include "log.h" #include "macro.h" #include "string-util.h" #include "utf8.h" int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags) { _cleanup_free_ char *s = NULL; size_t allocated = 0, sz = 0; char c; int r; char quote = 0; /* 0 or ' or " */ bool backslash = false; /* whether we've just seen a backslash */ assert(p); assert(ret); /* Bail early if called after last value or with no input */ if (!*p) goto finish; c = **p; if (!separators) separators = WHITESPACE; /* Parses the first word of a string, and returns it in * *ret. Removes all quotes in the process. When parsing fails * (because of an uneven number of quotes or similar), leaves * the pointer *p at the first invalid character. */ if (flags & EXTRACT_DONT_COALESCE_SEPARATORS) if (!GREEDY_REALLOC(s, allocated, sz+1)) return -ENOMEM; for (;; (*p)++, c = **p) { if (c == 0) goto finish_force_terminate; else if (strchr(separators, c)) { if (flags & EXTRACT_DONT_COALESCE_SEPARATORS) { (*p)++; goto finish_force_next; } } else { /* We found a non-blank character, so we will always * want to return a string (even if it is empty), * allocate it here. */ if (!GREEDY_REALLOC(s, allocated, sz+1)) return -ENOMEM; break; } } for (;; (*p)++, c = **p) { if (backslash) { if (!GREEDY_REALLOC(s, allocated, sz+7)) return -ENOMEM; if (c == 0) { if ((flags & EXTRACT_CUNESCAPE_RELAX) && (!quote || flags & EXTRACT_RELAX)) { /* If we find an unquoted trailing backslash and we're in * EXTRACT_CUNESCAPE_RELAX mode, keep it verbatim in the * output. * * Unbalanced quotes will only be allowed in EXTRACT_RELAX * mode, EXTRACT_CUNESCAPE_RELAX mode does not allow them. */ s[sz++] = '\\'; goto finish_force_terminate; } if (flags & EXTRACT_RELAX) goto finish_force_terminate; return -EINVAL; } if (flags & EXTRACT_CUNESCAPE) { bool eight_bit = false; char32_t u; r = cunescape_one(*p, (size_t) -1, &u, &eight_bit); if (r < 0) { if (flags & EXTRACT_CUNESCAPE_RELAX) { s[sz++] = '\\'; s[sz++] = c; } else return -EINVAL; } else { (*p) += r - 1; if (eight_bit) s[sz++] = u; else sz += utf8_encode_unichar(s + sz, u); } } else s[sz++] = c; backslash = false; } else if (quote) { /* inside either single or double quotes */ for (;; (*p)++, c = **p) { if (c == 0) { if (flags & EXTRACT_RELAX) goto finish_force_terminate; return -EINVAL; } else if (c == quote) { /* found the end quote */ quote = 0; break; } else if (c == '\\' && !(flags & EXTRACT_RETAIN_ESCAPE)) { backslash = true; break; } else { if (!GREEDY_REALLOC(s, allocated, sz+2)) return -ENOMEM; s[sz++] = c; } } } else { for (;; (*p)++, c = **p) { if (c == 0) goto finish_force_terminate; else if ((c == '\'' || c == '"') && (flags & EXTRACT_QUOTES)) { quote = c; break; } else if (c == '\\' && !(flags & EXTRACT_RETAIN_ESCAPE)) { backslash = true; break; } else if (strchr(separators, c)) { if (flags & EXTRACT_DONT_COALESCE_SEPARATORS) { (*p)++; goto finish_force_next; } /* Skip additional coalesced separators. */ for (;; (*p)++, c = **p) { if (c == 0) goto finish_force_terminate; if (!strchr(separators, c)) break; } goto finish; } else { if (!GREEDY_REALLOC(s, allocated, sz+2)) return -ENOMEM; s[sz++] = c; } } } } finish_force_terminate: *p = NULL; finish: if (!s) { *p = NULL; *ret = NULL; return 0; } finish_force_next: s[sz] = 0; *ret = s; s = NULL; return 1; } int extract_first_word_and_warn( const char **p, char **ret, const char *separators, ExtractFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue) { /* Try to unquote it, if it fails, warn about it and try again * but this time using EXTRACT_CUNESCAPE_RELAX to keep the * backslashes verbatim in invalid escape sequences. */ const char *save; int r; save = *p; r = extract_first_word(p, ret, separators, flags); if (r >= 0) return r; if (r == -EINVAL && !(flags & EXTRACT_CUNESCAPE_RELAX)) { /* Retry it with EXTRACT_CUNESCAPE_RELAX. */ *p = save; r = extract_first_word(p, ret, separators, flags|EXTRACT_CUNESCAPE_RELAX); if (r >= 0) { /* It worked this time, hence it must have been an invalid escape sequence. */ log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Ignoring unknown escape sequences: \"%s\"", *ret); return r; } /* If it's still EINVAL; then it must be unbalanced quoting, report this. */ if (r == -EINVAL) return log_syntax(unit, LOG_ERR, filename, line, r, "Unbalanced quoting, ignoring: \"%s\"", rvalue); } /* Can be any error, report it */ return log_syntax(unit, LOG_ERR, filename, line, r, "Unable to decode word \"%s\", ignoring: %m", rvalue); } /* We pass ExtractFlags as unsigned int (to avoid undefined behaviour when passing * an object that undergoes default argument promotion as an argument to va_start). * Let's make sure that ExtractFlags fits into an unsigned int. */ assert_cc(sizeof(enum ExtractFlags) <= sizeof(unsigned)); int extract_many_words(const char **p, const char *separators, unsigned flags, ...) { va_list ap; char **l; int n = 0, i, c, r; /* Parses a number of words from a string, stripping any * quotes if necessary. */ assert(p); /* Count how many words are expected */ va_start(ap, flags); for (;;) { if (!va_arg(ap, char **)) break; n++; } va_end(ap); if (n <= 0) return 0; /* Read all words into a temporary array */ l = newa0(char*, n); for (c = 0; c < n; c++) { r = extract_first_word(p, &l[c], separators, flags); if (r < 0) { int j; for (j = 0; j < c; j++) free(l[j]); return r; } if (r == 0) break; } /* If we managed to parse all words, return them in the passed * in parameters */ va_start(ap, flags); for (i = 0; i < n; i++) { char **v; v = va_arg(ap, char **); assert(v); *v = l[i]; } va_end(ap); return c; }
mbiebl/systemd
src/basic/extract-word.c
C
gpl-2.0
11,544
/* * acsi_slm.c -- Device driver for the Atari SLM laser printer * * Copyright 1995 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. * */ /* Notes: The major number for SLM printers is 28 (like ACSI), but as a character device, not block device. The minor number is the number of the printer (if you have more than one SLM; currently max. 2 (#define-constant) SLMs are supported). The device can be opened for reading and writing. If reading it, you get some status infos (MODE SENSE data). Writing mode is used for the data to be printed. Some ioctls allow to get the printer status and to tune printer modes and some internal variables. A special problem of the SLM driver is the timing and thus the buffering of the print data. The problem is that all the data for one page must be present in memory when printing starts, else --when swapping occurs-- the timing could not be guaranteed. There are several ways to assure this: 1) Reserve a buffer of 1196k (maximum page size) statically by atari_stram_alloc(). The data are collected there until they're complete, and then printing starts. Since the buffer is reserved, no further considerations about memory and swapping are needed. So this is the simplest method, but it needs a lot of memory for just the SLM. An striking advantage of this method is (supposed the SLM_CONT_CNT_REPROG method works, see there), that there are no timing problems with the DMA anymore. 2) The other method would be to reserve the buffer dynamically each time printing is required. I could think of looking at mem_map where the largest unallocted ST-RAM area is, taking the area, and then extending it by swapping out the neighbored pages, until the needed size is reached. This requires some mm hacking, but seems possible. The only obstacle could be pages that cannot be swapped out (reserved pages)... 3) Another possibility would be to leave the real data in user space and to work with two dribble buffers of about 32k in the driver: While the one buffer is DMAed to the SLM, the other can be filled with new data. But to keep the timing, that requires that the user data remain in memory and are not swapped out. Requires mm hacking, too, but maybe not so bad as method 2). */ #include <linux/module.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/timer.h> #include <linux/fs.h> #include <linux/major.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/time.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #include <asm/pgtable.h> #include <asm/system.h> #include <asm/uaccess.h> #include <asm/atarihw.h> #include <asm/atariints.h> #include <asm/atari_acsi.h> #include <asm/atari_stdma.h> #include <asm/atari_stram.h> #include <asm/atari_SLM.h> #undef DEBUG /* Define this if the page data are continuous in physical memory. That * requires less reprogramming of the ST-DMA */ #define SLM_CONTINUOUS_DMA /* Use continuous reprogramming of the ST-DMA counter register. This is * --strictly speaking-- not allowed, Atari recommends not to look at the * counter register while a DMA is going on. But I don't know if that applies * only for reading the register, or also writing to it. Writing only works * fine for me... The advantage is that the timing becomes absolutely * uncritical: Just update each, say 200ms, the counter reg to its maximum, * and the DMA will work until the status byte interrupt occurs. */ #define SLM_CONT_CNT_REPROG #define MAJOR_NR ACSI_MAJOR #define CMDSET_TARG_LUN(cmd,targ,lun) \ do { \ cmd[0] = (cmd[0] & ~0xe0) | (targ)<<5; \ cmd[1] = (cmd[1] & ~0xe0) | (lun)<<5; \ } while(0) #define START_TIMER(to) mod_timer(&slm_timer, jiffies + (to)) #define STOP_TIMER() del_timer(&slm_timer) static char slmreqsense_cmd[6] = { 0x03, 0, 0, 0, 0, 0 }; static char slmprint_cmd[6] = { 0x0a, 0, 0, 0, 0, 0 }; static char slminquiry_cmd[6] = { 0x12, 0, 0, 0, 0, 0x80 }; static char slmmsense_cmd[6] = { 0x1a, 0, 0, 0, 255, 0 }; #if 0 static char slmmselect_cmd[6] = { 0x15, 0, 0, 0, 0, 0 }; #endif #define MAX_SLM 2 static struct slm { unsigned target; /* target number */ unsigned lun; /* LUN in target controller */ unsigned wbusy : 1; /* output part busy */ unsigned rbusy : 1; /* status part busy */ } slm_info[MAX_SLM]; int N_SLM_Printers = 0; /* printer buffer */ static unsigned char *SLMBuffer; /* start of buffer */ static unsigned char *BufferP; /* current position in buffer */ static int BufferSize; /* length of buffer for page size */ typedef enum { IDLE, FILLING, PRINTING } SLMSTATE; static SLMSTATE SLMState; static int SLMBufOwner; /* SLM# currently using the buffer */ /* DMA variables */ #ifndef SLM_CONT_CNT_REPROG static unsigned long SLMCurAddr; /* current base addr of DMA chunk */ static unsigned long SLMEndAddr; /* expected end addr */ static unsigned long SLMSliceSize; /* size of one DMA chunk */ #endif static int SLMError; /* wait queues */ static DECLARE_WAIT_QUEUE_HEAD(slm_wait); /* waiting for buffer */ static DECLARE_WAIT_QUEUE_HEAD(print_wait); /* waiting for printing finished */ /* status codes */ #define SLMSTAT_OK 0x00 #define SLMSTAT_ORNERY 0x02 #define SLMSTAT_TONER 0x03 #define SLMSTAT_WARMUP 0x04 #define SLMSTAT_PAPER 0x05 #define SLMSTAT_DRUM 0x06 #define SLMSTAT_INJAM 0x07 #define SLMSTAT_THRJAM 0x08 #define SLMSTAT_OUTJAM 0x09 #define SLMSTAT_COVER 0x0a #define SLMSTAT_FUSER 0x0b #define SLMSTAT_IMAGER 0x0c #define SLMSTAT_MOTOR 0x0d #define SLMSTAT_VIDEO 0x0e #define SLMSTAT_SYSTO 0x10 #define SLMSTAT_OPCODE 0x12 #define SLMSTAT_DEVNUM 0x15 #define SLMSTAT_PARAM 0x1a #define SLMSTAT_ACSITO 0x1b /* driver defined */ #define SLMSTAT_NOTALL 0x1c /* driver defined */ static char *SLMErrors[] = { /* 0x00 */ "OK and ready", /* 0x01 */ NULL, /* 0x02 */ "ornery printer", /* 0x03 */ "toner empty", /* 0x04 */ "warming up", /* 0x05 */ "paper empty", /* 0x06 */ "drum empty", /* 0x07 */ "input jam", /* 0x08 */ "through jam", /* 0x09 */ "output jam", /* 0x0a */ "cover open", /* 0x0b */ "fuser malfunction", /* 0x0c */ "imager malfunction", /* 0x0d */ "motor malfunction", /* 0x0e */ "video malfunction", /* 0x0f */ NULL, /* 0x10 */ "printer system timeout", /* 0x11 */ NULL, /* 0x12 */ "invalid operation code", /* 0x13 */ NULL, /* 0x14 */ NULL, /* 0x15 */ "invalid device number", /* 0x16 */ NULL, /* 0x17 */ NULL, /* 0x18 */ NULL, /* 0x19 */ NULL, /* 0x1a */ "invalid parameter list", /* 0x1b */ "ACSI timeout", /* 0x1c */ "not all printed" }; #define N_ERRORS (sizeof(SLMErrors)/sizeof(*SLMErrors)) /* real (driver caused) error? */ #define IS_REAL_ERROR(x) (x > 0x10) static struct { char *name; int w, h; } StdPageSize[] = { { "Letter", 2400, 3180 }, { "Legal", 2400, 4080 }, { "A4", 2336, 3386 }, { "B5", 2016, 2914 } }; #define N_STD_SIZES (sizeof(StdPageSize)/sizeof(*StdPageSize)) #define SLM_BUFFER_SIZE (2336*3386/8) /* A4 for now */ #define SLM_DMA_AMOUNT 255 /* #sectors to program the DMA for */ #ifdef SLM_CONTINUOUS_DMA # define SLM_DMA_INT_OFFSET 0 /* DMA goes until seccnt 0, no offs */ # define SLM_DMA_END_OFFSET 32 /* 32 Byte ST-DMA FIFO */ # define SLM_SLICE_SIZE(w) (255*512) #else # define SLM_DMA_INT_OFFSET 32 /* 32 Byte ST-DMA FIFO */ # define SLM_DMA_END_OFFSET 32 /* 32 Byte ST-DMA FIFO */ # define SLM_SLICE_SIZE(w) ((254*512)/(w/8)*(w/8)) #endif /* calculate the number of jiffies to wait for 'n' bytes */ #ifdef SLM_CONT_CNT_REPROG #define DMA_TIME_FOR(n) 50 #define DMA_STARTUP_TIME 0 #else #define DMA_TIME_FOR(n) (n/1400-1) #define DMA_STARTUP_TIME 650 #endif /***************************** Prototypes *****************************/ static char *slm_errstr( int stat ); static int slm_getstats( char *buffer, int device ); static ssize_t slm_read( struct file* file, char *buf, size_t count, loff_t *ppos ); static void start_print( int device ); static void slm_interrupt(int irc, void *data, struct pt_regs *fp); static void slm_test_ready( unsigned long dummy ); static void set_dma_addr( unsigned long paddr ); static unsigned long get_dma_addr( void ); static ssize_t slm_write( struct file *file, const char *buf, size_t count, loff_t *ppos ); static int slm_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg ); static int slm_open( struct inode *inode, struct file *file ); static int slm_release( struct inode *inode, struct file *file ); static int slm_req_sense( int device ); static int slm_mode_sense( int device, char *buffer, int abs_flag ); #if 0 static int slm_mode_select( int device, char *buffer, int len, int default_flag ); #endif static int slm_get_pagesize( int device, int *w, int *h ); /************************* End of Prototypes **************************/ static struct timer_list slm_timer = { function: slm_test_ready }; static struct file_operations slm_fops = { owner: THIS_MODULE, read: slm_read, write: slm_write, ioctl: slm_ioctl, open: slm_open, release: slm_release, }; /* ---------------------------------------------------------------------- */ /* Status Functions */ static char *slm_errstr( int stat ) { char *p; static char str[22]; stat &= 0x1f; if (stat >= 0 && stat < N_ERRORS && (p = SLMErrors[stat])) return( p ); sprintf( str, "unknown status 0x%02x", stat ); return( str ); } static int slm_getstats( char *buffer, int device ) { int len = 0, stat, i, w, h; unsigned char buf[256]; stat = slm_mode_sense( device, buf, 0 ); if (IS_REAL_ERROR(stat)) return( -EIO ); #define SHORTDATA(i) ((buf[i] << 8) | buf[i+1]) #define BOOLDATA(i,mask) ((buf[i] & mask) ? "on" : "off") w = SHORTDATA( 3 ); h = SHORTDATA( 1 ); len += sprintf( buffer+len, "Status\t\t%s\n", slm_errstr( stat ) ); len += sprintf( buffer+len, "Page Size\t%dx%d", w, h ); for( i = 0; i < N_STD_SIZES; ++i ) { if (w == StdPageSize[i].w && h == StdPageSize[i].h) break; } if (i < N_STD_SIZES) len += sprintf( buffer+len, " (%s)", StdPageSize[i].name ); buffer[len++] = '\n'; len += sprintf( buffer+len, "Top/Left Margin\t%d/%d\n", SHORTDATA( 5 ), SHORTDATA( 7 ) ); len += sprintf( buffer+len, "Manual Feed\t%s\n", BOOLDATA( 9, 0x01 ) ); len += sprintf( buffer+len, "Input Select\t%d\n", (buf[9] >> 1) & 7 ); len += sprintf( buffer+len, "Auto Select\t%s\n", BOOLDATA( 9, 0x10 ) ); len += sprintf( buffer+len, "Prefeed Paper\t%s\n", BOOLDATA( 9, 0x20 ) ); len += sprintf( buffer+len, "Thick Pixels\t%s\n", BOOLDATA( 9, 0x40 ) ); len += sprintf( buffer+len, "H/V Resol.\t%d/%d dpi\n", SHORTDATA( 12 ), SHORTDATA( 10 ) ); len += sprintf( buffer+len, "System Timeout\t%d\n", buf[14] ); len += sprintf( buffer+len, "Scan Time\t%d\n", SHORTDATA( 15 ) ); len += sprintf( buffer+len, "Page Count\t%d\n", SHORTDATA( 17 ) ); len += sprintf( buffer+len, "In/Out Cap.\t%d/%d\n", SHORTDATA( 19 ), SHORTDATA( 21 ) ); len += sprintf( buffer+len, "Stagger Output\t%s\n", BOOLDATA( 23, 0x01 ) ); len += sprintf( buffer+len, "Output Select\t%d\n", (buf[23] >> 1) & 7 ); len += sprintf( buffer+len, "Duplex Print\t%s\n", BOOLDATA( 23, 0x10 ) ); len += sprintf( buffer+len, "Color Sep.\t%s\n", BOOLDATA( 23, 0x20 ) ); return( len ); } static ssize_t slm_read( struct file *file, char *buf, size_t count, loff_t *ppos ) { struct inode *node = file->f_dentry->d_inode; loff_t pos = *ppos; unsigned long page; int length; int end; if (count < 0) return( -EINVAL ); if (!(page = __get_free_page( GFP_KERNEL ))) return( -ENOMEM ); length = slm_getstats( (char *)page, MINOR(node->i_rdev) ); if (length < 0) { count = length; goto out; } if (pos != (unsigned) pos || pos >= length) { count = 0; goto out; } if (count > length - pos) count = length - pos; end = count + pos; if (copy_to_user(buf, (char *)page + pos, count)) { count = -EFAULT; goto out; } *ppos = end; out: free_page( page ); return( count ); } /* ---------------------------------------------------------------------- */ /* Printing */ static void start_print( int device ) { struct slm *sip = &slm_info[device]; unsigned char *cmd; unsigned long paddr; int i; stdma_lock( slm_interrupt, NULL ); CMDSET_TARG_LUN( slmprint_cmd, sip->target, sip->lun ); cmd = slmprint_cmd; paddr = virt_to_phys( SLMBuffer ); dma_cache_maintenance( paddr, virt_to_phys(BufferP)-paddr, 1 ); DISABLE_IRQ(); /* Low on A1 */ dma_wd.dma_mode_status = 0x88; MFPDELAY(); /* send the command bytes except the last */ for( i = 0; i < 5; ++i ) { DMA_LONG_WRITE( *cmd++, 0x8a ); udelay(20); if (!acsi_wait_for_IRQ( HZ/2 )) { SLMError = 1; return; /* timeout */ } } /* last command byte */ DMA_LONG_WRITE( *cmd++, 0x82 ); MFPDELAY(); /* set DMA address */ set_dma_addr( paddr ); /* program DMA for write and select sector counter reg */ dma_wd.dma_mode_status = 0x192; MFPDELAY(); /* program for 255*512 bytes and start DMA */ DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 ); #ifndef SLM_CONT_CNT_REPROG SLMCurAddr = paddr; SLMEndAddr = paddr + SLMSliceSize + SLM_DMA_INT_OFFSET; #endif START_TIMER( DMA_STARTUP_TIME + DMA_TIME_FOR( SLMSliceSize )); #if !defined(SLM_CONT_CNT_REPROG) && defined(DEBUG) printk( "SLM: CurAddr=%#lx EndAddr=%#lx timer=%ld\n", SLMCurAddr, SLMEndAddr, DMA_TIME_FOR( SLMSliceSize ) ); #endif ENABLE_IRQ(); } /* Only called when an error happened or at the end of a page */ static void slm_interrupt(int irc, void *data, struct pt_regs *fp) { unsigned long addr; int stat; STOP_TIMER(); addr = get_dma_addr(); stat = acsi_getstatus(); SLMError = (stat < 0) ? SLMSTAT_ACSITO : (addr < virt_to_phys(BufferP)) ? SLMSTAT_NOTALL : stat; dma_wd.dma_mode_status = 0x80; MFPDELAY(); #ifdef DEBUG printk( "SLM: interrupt, addr=%#lx, error=%d\n", addr, SLMError ); #endif wake_up( &print_wait ); stdma_release(); ENABLE_IRQ(); } static void slm_test_ready( unsigned long dummy ) { #ifdef SLM_CONT_CNT_REPROG /* program for 255*512 bytes again */ dma_wd.fdc_acces_seccount = SLM_DMA_AMOUNT; START_TIMER( DMA_TIME_FOR(0) ); #ifdef DEBUG printk( "SLM: reprogramming timer for %d jiffies, addr=%#lx\n", DMA_TIME_FOR(0), get_dma_addr() ); #endif #else /* !SLM_CONT_CNT_REPROG */ unsigned long flags, addr; int d, ti; #ifdef DEBUG struct timeval start_tm, end_tm; int did_wait = 0; #endif save_flags(flags); cli(); addr = get_dma_addr(); if ((d = SLMEndAddr - addr) > 0) { restore_flags(flags); /* slice not yet finished, decide whether to start another timer or to * busy-wait */ ti = DMA_TIME_FOR( d ); if (ti > 0) { #ifdef DEBUG printk( "SLM: reprogramming timer for %d jiffies, rest %d bytes\n", ti, d ); #endif START_TIMER( ti ); return; } /* wait for desired end address to be reached */ #ifdef DEBUG do_gettimeofday( &start_tm ); did_wait = 1; #endif cli(); while( get_dma_addr() < SLMEndAddr ) barrier(); } /* slice finished, start next one */ SLMCurAddr += SLMSliceSize; #ifdef SLM_CONTINUOUS_DMA /* program for 255*512 bytes again */ dma_wd.fdc_acces_seccount = SLM_DMA_AMOUNT; #else /* set DMA address; * add 2 bytes for the ones in the SLM controller FIFO! */ set_dma_addr( SLMCurAddr + 2 ); /* toggle DMA to write and select sector counter reg */ dma_wd.dma_mode_status = 0x92; MFPDELAY(); dma_wd.dma_mode_status = 0x192; MFPDELAY(); /* program for 255*512 bytes and start DMA */ DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 ); #endif restore_flags(flags); #ifdef DEBUG if (did_wait) { int ms; do_gettimeofday( &end_tm ); ms = (end_tm.tv_sec*1000000+end_tm.tv_usec) - (start_tm.tv_sec*1000000+start_tm.tv_usec); printk( "SLM: did %ld.%ld ms busy waiting for %d bytes\n", ms/1000, ms%1000, d ); } else printk( "SLM: didn't wait (!)\n" ); #endif if ((unsigned char *)PTOV( SLMCurAddr + SLMSliceSize ) >= BufferP) { /* will be last slice, no timer necessary */ #ifdef DEBUG printk( "SLM: CurAddr=%#lx EndAddr=%#lx last slice -> no timer\n", SLMCurAddr, SLMEndAddr ); #endif } else { /* not last slice */ SLMEndAddr = SLMCurAddr + SLMSliceSize + SLM_DMA_INT_OFFSET; START_TIMER( DMA_TIME_FOR( SLMSliceSize )); #ifdef DEBUG printk( "SLM: CurAddr=%#lx EndAddr=%#lx timer=%ld\n", SLMCurAddr, SLMEndAddr, DMA_TIME_FOR( SLMSliceSize ) ); #endif } #endif /* SLM_CONT_CNT_REPROG */ } static void set_dma_addr( unsigned long paddr ) { unsigned long flags; save_flags(flags); cli(); dma_wd.dma_lo = (unsigned char)paddr; paddr >>= 8; MFPDELAY(); dma_wd.dma_md = (unsigned char)paddr; paddr >>= 8; MFPDELAY(); if (ATARIHW_PRESENT( EXTD_DMA )) st_dma_ext_dmahi = (unsigned short)paddr; else dma_wd.dma_hi = (unsigned char)paddr; MFPDELAY(); restore_flags(flags); } static unsigned long get_dma_addr( void ) { unsigned long addr; addr = dma_wd.dma_lo & 0xff; MFPDELAY(); addr |= (dma_wd.dma_md & 0xff) << 8; MFPDELAY(); addr |= (dma_wd.dma_hi & 0xff) << 16; MFPDELAY(); return( addr ); } static ssize_t slm_write( struct file *file, const char *buf, size_t count, loff_t *ppos ) { struct inode *node = file->f_dentry->d_inode; int device = MINOR( node->i_rdev ); int n, filled, w, h; while( SLMState == PRINTING || (SLMState == FILLING && SLMBufOwner != device) ) { interruptible_sleep_on( &slm_wait ); if (signal_pending(current)) return( -ERESTARTSYS ); } if (SLMState == IDLE) { /* first data of page: get current page size */ if (slm_get_pagesize( device, &w, &h )) return( -EIO ); BufferSize = w*h/8; if (BufferSize > SLM_BUFFER_SIZE) return( -ENOMEM ); SLMState = FILLING; SLMBufOwner = device; } n = count; filled = BufferP - SLMBuffer; if (filled + n > BufferSize) n = BufferSize - filled; if (copy_from_user(BufferP, buf, n)) return -EFAULT; BufferP += n; filled += n; if (filled == BufferSize) { /* Check the paper size again! The user may have switched it in the * time between starting the data and finishing them. Would end up in * a trashy page... */ if (slm_get_pagesize( device, &w, &h )) return( -EIO ); if (BufferSize != w*h/8) { printk( KERN_NOTICE "slm%d: page size changed while printing\n", device ); return( -EAGAIN ); } SLMState = PRINTING; /* choose a slice size that is a multiple of the line size */ #ifndef SLM_CONT_CNT_REPROG SLMSliceSize = SLM_SLICE_SIZE(w); #endif start_print( device ); sleep_on( &print_wait ); if (SLMError && IS_REAL_ERROR(SLMError)) { printk( KERN_ERR "slm%d: %s\n", device, slm_errstr(SLMError) ); n = -EIO; } SLMState = IDLE; BufferP = SLMBuffer; wake_up_interruptible( &slm_wait ); } return( n ); } /* ---------------------------------------------------------------------- */ /* ioctl Functions */ static int slm_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg ) { int device = MINOR( inode->i_rdev ), err; /* I can think of setting: * - manual feed * - paper format * - copy count * - ... * but haven't implemented that yet :-) * BTW, has anybody better docs about the MODE SENSE/MODE SELECT data? */ switch( cmd ) { case SLMIORESET: /* reset buffer, i.e. empty the buffer */ if (!(file->f_mode & 2)) return( -EINVAL ); if (SLMState == PRINTING) return( -EBUSY ); SLMState = IDLE; BufferP = SLMBuffer; wake_up_interruptible( &slm_wait ); return( 0 ); case SLMIOGSTAT: { /* get status */ int stat; char *str; stat = slm_req_sense( device ); if (arg) { str = slm_errstr( stat ); if (put_user(stat, (long *)&((struct SLM_status *)arg)->stat)) return -EFAULT; if (copy_to_user( ((struct SLM_status *)arg)->str, str, strlen(str) + 1)) return -EFAULT; } return( stat ); } case SLMIOGPSIZE: { /* get paper size */ int w, h; if ((err = slm_get_pagesize( device, &w, &h ))) return( err ); if (put_user(w, (long *)&((struct SLM_paper_size *)arg)->width)) return -EFAULT; if (put_user(h, (long *)&((struct SLM_paper_size *)arg)->height)) return -EFAULT; return( 0 ); } case SLMIOGMFEED: /* get manual feed */ return( -EINVAL ); case SLMIOSPSIZE: /* set paper size */ return( -EINVAL ); case SLMIOSMFEED: /* set manual feed */ return( -EINVAL ); } return( -EINVAL ); } /* ---------------------------------------------------------------------- */ /* Opening and Closing */ static int slm_open( struct inode *inode, struct file *file ) { int device; struct slm *sip; device = MINOR(inode->i_rdev); if (device >= N_SLM_Printers) return( -ENXIO ); sip = &slm_info[device]; if (file->f_mode & 2) { /* open for writing is exclusive */ if (sip->wbusy) return( -EBUSY ); sip->wbusy = 1; } if (file->f_mode & 1) { /* open for writing is exclusive */ if (sip->rbusy) return( -EBUSY ); sip->rbusy = 1; } return( 0 ); } static int slm_release( struct inode *inode, struct file *file ) { int device; struct slm *sip; device = MINOR(inode->i_rdev); sip = &slm_info[device]; lock_kernel(); if (file->f_mode & 2) sip->wbusy = 0; if (file->f_mode & 1) sip->rbusy = 0; unlock_kernel(); return( 0 ); } /* ---------------------------------------------------------------------- */ /* ACSI Primitives for the SLM */ static int slm_req_sense( int device ) { int stat, rv; struct slm *sip = &slm_info[device]; stdma_lock( NULL, NULL ); CMDSET_TARG_LUN( slmreqsense_cmd, sip->target, sip->lun ); if (!acsicmd_nodma( slmreqsense_cmd, 0 ) || (stat = acsi_getstatus()) < 0) rv = SLMSTAT_ACSITO; else rv = stat & 0x1f; ENABLE_IRQ(); stdma_release(); return( rv ); } static int slm_mode_sense( int device, char *buffer, int abs_flag ) { unsigned char stat, len; int rv = 0; struct slm *sip = &slm_info[device]; stdma_lock( NULL, NULL ); CMDSET_TARG_LUN( slmmsense_cmd, sip->target, sip->lun ); slmmsense_cmd[5] = abs_flag ? 0x80 : 0; if (!acsicmd_nodma( slmmsense_cmd, 0 )) { rv = SLMSTAT_ACSITO; goto the_end; } if (!acsi_extstatus( &stat, 1 )) { acsi_end_extstatus(); rv = SLMSTAT_ACSITO; goto the_end; } if (!acsi_extstatus( &len, 1 )) { acsi_end_extstatus(); rv = SLMSTAT_ACSITO; goto the_end; } buffer[0] = len; if (!acsi_extstatus( buffer+1, len )) { acsi_end_extstatus(); rv = SLMSTAT_ACSITO; goto the_end; } acsi_end_extstatus(); rv = stat & 0x1f; the_end: ENABLE_IRQ(); stdma_release(); return( rv ); } #if 0 /* currently unused */ static int slm_mode_select( int device, char *buffer, int len, int default_flag ) { int stat, rv; struct slm *sip = &slm_info[device]; stdma_lock( NULL, NULL ); CMDSET_TARG_LUN( slmmselect_cmd, sip->target, sip->lun ); slmmselect_cmd[5] = default_flag ? 0x80 : 0; if (!acsicmd_nodma( slmmselect_cmd, 0 )) { rv = SLMSTAT_ACSITO; goto the_end; } if (!default_flag) { unsigned char c = len; if (!acsi_extcmd( &c, 1 )) { rv = SLMSTAT_ACSITO; goto the_end; } if (!acsi_extcmd( buffer, len )) { rv = SLMSTAT_ACSITO; goto the_end; } } stat = acsi_getstatus(); rv = (stat < 0 ? SLMSTAT_ACSITO : stat); the_end: ENABLE_IRQ(); stdma_release(); return( rv ); } #endif static int slm_get_pagesize( int device, int *w, int *h ) { char buf[256]; int stat; stat = slm_mode_sense( device, buf, 0 ); ENABLE_IRQ(); stdma_release(); if (stat != SLMSTAT_OK) return( -EIO ); *w = (buf[3] << 8) | buf[4]; *h = (buf[1] << 8) | buf[2]; return( 0 ); } /* ---------------------------------------------------------------------- */ /* Initialization */ int attach_slm( int target, int lun ) { static int did_register; int len; if (N_SLM_Printers >= MAX_SLM) { printk( KERN_WARNING "Too much SLMs\n" ); return( 0 ); } /* do an INQUIRY */ udelay(100); CMDSET_TARG_LUN( slminquiry_cmd, target, lun ); if (!acsicmd_nodma( slminquiry_cmd, 0 )) { inq_timeout: printk( KERN_ERR "SLM inquiry command timed out.\n" ); inq_fail: acsi_end_extstatus(); return( 0 ); } /* read status and header of return data */ if (!acsi_extstatus( SLMBuffer, 6 )) goto inq_timeout; if (SLMBuffer[1] != 2) { /* device type == printer? */ printk( KERN_ERR "SLM inquiry returned device type != printer\n" ); goto inq_fail; } len = SLMBuffer[5]; /* read id string */ if (!acsi_extstatus( SLMBuffer, len )) goto inq_timeout; acsi_end_extstatus(); SLMBuffer[len] = 0; if (!did_register) { did_register = 1; } slm_info[N_SLM_Printers].target = target; slm_info[N_SLM_Printers].lun = lun; slm_info[N_SLM_Printers].wbusy = 0; slm_info[N_SLM_Printers].rbusy = 0; printk( KERN_INFO " Printer: %s\n", SLMBuffer ); printk( KERN_INFO "Detected slm%d at id %d lun %d\n", N_SLM_Printers, target, lun ); N_SLM_Printers++; return( 1 ); } static devfs_handle_t devfs_handle; int slm_init( void ) { if (devfs_register_chrdev( MAJOR_NR, "slm", &slm_fops )) { printk( KERN_ERR "Unable to get major %d for ACSI SLM\n", MAJOR_NR ); return -EBUSY; } if (!(SLMBuffer = atari_stram_alloc( SLM_BUFFER_SIZE, "SLM" ))) { printk( KERN_ERR "Unable to get SLM ST-Ram buffer.\n" ); devfs_unregister_chrdev( MAJOR_NR, "slm" ); return -ENOMEM; } BufferP = SLMBuffer; SLMState = IDLE; devfs_handle = devfs_mk_dir (NULL, "slm", NULL); devfs_register_series (devfs_handle, "%u", MAX_SLM, DEVFS_FL_DEFAULT, MAJOR_NR, 0, S_IFCHR | S_IRUSR | S_IWUSR, &slm_fops, NULL); return 0; } #ifdef MODULE /* from acsi.c */ void acsi_attach_SLMs( int (*attach_func)( int, int ) ); int init_module(void) { int err; if ((err = slm_init())) return( err ); /* This calls attach_slm() for every target/lun where acsi.c detected a * printer */ acsi_attach_SLMs( attach_slm ); return( 0 ); } void cleanup_module(void) { devfs_unregister (devfs_handle); if (devfs_unregister_chrdev( MAJOR_NR, "slm" ) != 0) printk( KERN_ERR "acsi_slm: cleanup_module failed\n"); atari_stram_free( SLMBuffer ); } #endif
jmesmon/linux-2.4.37.y
drivers/block/acsi_slm.c
C
gpl-2.0
26,681
<?php // $Id: user_bulk_display.php,v 1.1.2.1 2007/11/13 09:02:12 skodak Exp $ require_once('../../config.php'); require_once($CFG->libdir.'/adminlib.php'); $sort = optional_param('sort', 'fullname', PARAM_ALPHA); $dir = optional_param('dir', 'asc', PARAM_ALPHA); admin_externalpage_setup('userbulk'); $return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php'; if (empty($SESSION->bulk_users)) { redirect($return); } $users = $SESSION->bulk_users; $usertotal = get_users(false); $usercount = count($users); $strnever = get_string('never'); admin_externalpage_print_header(); $countries = get_list_of_countries(); foreach ($users as $key => $id) { $user = get_record('user', 'id', $id, null, null, null, null, 'id, firstname, lastname, username, email, country, lastaccess, city'); $user->fullname = fullname($user, true); $user->country = @$countries[$user->country]; unset($user->firstname); unset($user->lastname); $users[$key] = $user; } unset($countries); // Need to sort by date function sort_compare($a, $b) { global $sort, $dir; if($sort == 'lastaccess') { $rez = $b->lastaccess - $a->lastaccess; } else { $rez = strcasecmp(@$a->$sort, @$b->$sort); } return $dir == 'desc' ? -$rez : $rez; } usort($users, 'sort_compare'); $table->width = "95%"; $columns = array('fullname', /*'username', */'email', 'city', 'country', 'lastaccess'); foreach ($columns as $column) { $strtitle = get_string($column); if ($sort != $column) { $columnicon = ''; $columndir = 'asc'; } else { $columndir = $dir == 'asc' ? 'desc' : 'asc'; $columnicon = ' <img src="'.$CFG->pixpath.'/t/'.($dir == 'asc' ? 'down' : 'up' ).'.gif" alt="" />'; } $table->head[] = '<a href="user_bulk_display.php?sort='.$column.'&amp;dir='.$columndir.'">'.$strtitle.'</a>'.$columnicon; $table->align[] = 'left'; } foreach($users as $user) { $table->data[] = array ( '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.SITEID.'">'.$user->fullname.'</a>', // $user->username, $user->email, $user->city, $user->country, $user->lastaccess ? format_time(time() - $user->lastaccess) : $strnever ); } print_heading("$usercount / $usertotal ".get_string('users')); print_table($table); print_continue($return); admin_externalpage_print_footer(); ?>
damasiorafael/inppnet
cursos/admin/user/user_bulk_display.php
PHP
gpl-2.0
2,415
<?php // $Id$ /**#@+ * Authorize.net payment methods. * * Credit Card (cc) * eCheck (echeck) */ define('AN_METHOD_CC', 'cc'); define('AN_METHOD_ECHECK', 'echeck'); /**#@-*/ /**#@+ * Order status used in enrol_authorize table. * * NONE: New order or order is in progress. TransactionID hasn't received yet. * AUTH: Authorized/Pending Capture. * CAPTURE: Captured. * AUTHCAPTURE: Authorized/Captured * CREDIT: Refunded. * VOID: Cancelled. * EXPIRE: Expired. Orders be expired unless be accepted within 30 days. * * These are valid only for ECHECK: * UNDERREVIEW: Hold for review. * APPROVEDREVIEW: Approved review. * REVIEWFAILED: Review failed. * TEST: Tested (dummy status). Created in TEST mode and TransactionID is 0. */ define('AN_STATUS_NONE', 0x00); define('AN_STATUS_AUTH', 0x01); define('AN_STATUS_CAPTURE', 0x02); define('AN_STATUS_AUTHCAPTURE', 0x03); define('AN_STATUS_CREDIT', 0x04); define('AN_STATUS_VOID', 0x08); define('AN_STATUS_EXPIRE', 0x10); define('AN_STATUS_UNDERREVIEW', 0x20); define('AN_STATUS_APPROVEDREVIEW', 0x40); define('AN_STATUS_REVIEWFAILED', 0x80); define('AN_STATUS_TEST', 0xff); // dummy status /**#@-*/ /**#@+ * Actions used in authorize_action() function. * * NONE: No action. Function always returns false. * AUTH_ONLY: Used to authorize only, don't capture. * CAPTURE_ONLY: Authorization code was received from a bank over the phone. * AUTH_CAPTURE: Used to authorize and capture (default action). * PRIOR_AUTH_CAPTURE: Used to capture, it was authorized before. * CREDIT: Used to return funds to a customer's credit card. * VOID: Used to cancel an exiting pending transaction. * * Credit rules: * 1. It can be credited within 120 days after the original authorization was obtained. * 2. Amount can be any amount up to the original amount charged. * 3. Captured/pending settlement transactions cannot be credited, * instead a void must be issued to cancel the settlement. * NOTE: It assigns a new transactionID to the original transaction. * We should save it, so admin can cancel new transaction if it is a mistake return. * * Void rules: * 1. These requests effectively cancel the Capture request that would start the funds transfer process. * 2. It mustn't be settled. Please set up settlement date correctly. * 3. These transactions can be voided: * authorized/pending capture, captured/pending settlement, credited/pending settlement */ define('AN_ACTION_NONE', 0); define('AN_ACTION_AUTH_ONLY', 1); define('AN_ACTION_CAPTURE_ONLY', 2); define('AN_ACTION_AUTH_CAPTURE', 3); define('AN_ACTION_PRIOR_AUTH_CAPTURE', 4); define('AN_ACTION_CREDIT', 5); define('AN_ACTION_VOID', 6); /**#@-*/ /**#@+ * Return codes for authorize_action() function. * * AN_RETURNZERO: No connection was made on authorize.net. * AN_APPROVED: The transaction was accepted. * AN_DECLINED: The transaction was declined. * AN_REVIEW: The transaction was held for review. */ define('AN_RETURNZERO', 0); define('AN_APPROVED', 1); define('AN_DECLINED', 2); define('AN_ERROR', 3); define('AN_REVIEW', 4); /**#@-*/ ?>
XSCE/moodle-xs
enrol/authorize/const.php
PHP
gpl-2.0
3,275
/* { dg-compile } */ typedef int __attribute__((vector_size(16))) v4si; typedef float __attribute__((vector_size(16))) v4sf; v4si toint (v4sf a) { v4si out = (v4si){ (int)a[0], (int)a[1], (int)a[2], (int)a[3] }; return out; } /* { dg-final { scan-assembler-times "vcfeb\t%v24,%v24,0,5" 1 } } */ v4sf tofloat (v4si a) { v4sf out = (v4sf){ (float)a[0], (float)a[1], (float)a[2], (float)a[3] }; return out; } /* { dg-final { scan-assembler-times "vcefb\t%v24,%v24,0,0" 1 } } */
Gurgel100/gcc
gcc/testsuite/gcc.target/s390/arch13/fp-signedint-convert-1.c
C
gpl-2.0
488
/*--------------------------------------------------------------------*/ /*--- Platform-specific syscalls stuff. syswrap-ppc32-linux.c ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2005-2017 Nicholas Nethercote <njn@valgrind.org> Copyright (C) 2005-2017 Cerion Armour-Brown <cerion@open-works.co.uk> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #if defined(VGP_ppc32_linux) #include "pub_core_basics.h" #include "pub_core_vki.h" #include "pub_core_vkiscnums.h" #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" #include "pub_core_debuglog.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" #include "pub_core_libcproc.h" #include "pub_core_libcsignal.h" #include "pub_core_options.h" #include "pub_core_scheduler.h" #include "pub_core_sigframe.h" // For VG_(sigframe_destroy)() #include "pub_core_signals.h" #include "pub_core_syscall.h" #include "pub_core_syswrap.h" #include "pub_core_tooliface.h" #include "priv_types_n_macros.h" #include "priv_syswrap-generic.h" /* for decls of generic wrappers */ #include "priv_syswrap-linux.h" /* for decls of linux-ish wrappers */ #include "priv_syswrap-main.h" /* --------------------------------------------------------------------- clone() handling ------------------------------------------------------------------ */ /* Call f(arg1), but first switch stacks, using 'stack' as the new stack, and use 'retaddr' as f's return-to address. Also, clear all the integer registers before entering f.*/ __attribute__((noreturn)) void ML_(call_on_new_stack_0_1) ( Addr stack, Addr retaddr, void (*f)(Word), Word arg1 ); // r3 = stack // r4 = retaddr // r5 = f // r6 = arg1 asm( ".text\n" ".globl vgModuleLocal_call_on_new_stack_0_1\n" "vgModuleLocal_call_on_new_stack_0_1:\n" " mr %r1,%r3\n\t" // stack to %sp " mtlr %r4\n\t" // retaddr to %lr " mtctr %r5\n\t" // f to count reg " mr %r3,%r6\n\t" // arg1 to %r3 " li 0,0\n\t" // zero all GP regs " li 4,0\n\t" " li 5,0\n\t" " li 6,0\n\t" " li 7,0\n\t" " li 8,0\n\t" " li 9,0\n\t" " li 10,0\n\t" " li 11,0\n\t" " li 12,0\n\t" " li 13,0\n\t" " li 14,0\n\t" " li 15,0\n\t" " li 16,0\n\t" " li 17,0\n\t" " li 18,0\n\t" " li 19,0\n\t" " li 20,0\n\t" " li 21,0\n\t" " li 22,0\n\t" " li 23,0\n\t" " li 24,0\n\t" " li 25,0\n\t" " li 26,0\n\t" " li 27,0\n\t" " li 28,0\n\t" " li 29,0\n\t" " li 30,0\n\t" " li 31,0\n\t" " mtxer 0\n\t" // CAB: Need this? " mtcr 0\n\t" // CAB: Need this? " bctr\n\t" // jump to dst " trap\n" // should never get here ".previous\n" ); /* Perform a clone system call. clone is strange because it has fork()-like return-twice semantics, so it needs special handling here. Upon entry, we have: int (fn)(void*) in r3 void* child_stack in r4 int flags in r5 void* arg in r6 pid_t* child_tid in r7 pid_t* parent_tid in r8 void* ??? in r9 System call requires: int $__NR_clone in r0 (sc number) int flags in r3 (sc arg1) void* child_stack in r4 (sc arg2) pid_t* parent_tid in r5 (sc arg3) ?? child_tls in r6 (sc arg4) pid_t* child_tid in r7 (sc arg5) void* ??? in r8 (sc arg6) Returns an Int encoded in the linux-ppc32 way, not a SysRes. */ #define __NR_CLONE VG_STRINGIFY(__NR_clone) #define __NR_EXIT VG_STRINGIFY(__NR_exit) // See priv_syswrap-linux.h for arg profile. asm( ".text\n" ".globl do_syscall_clone_ppc32_linux\n" "do_syscall_clone_ppc32_linux:\n" " stwu 1,-32(1)\n" " stw 29,20(1)\n" " stw 30,24(1)\n" " stw 31,28(1)\n" " mr 30,3\n" // preserve fn " mr 31,6\n" // preserve arg // setup child stack " rlwinm 4,4,0,~0xf\n" // trim sp to multiple of 16 bytes " li 0,0\n" " stwu 0,-16(4)\n" // make initial stack frame " mr 29,4\n" // preserve sp // setup syscall " li 0,"__NR_CLONE"\n" // syscall number " mr 3,5\n" // syscall arg1: flags // r4 already setup // syscall arg2: child_stack " mr 5,8\n" // syscall arg3: parent_tid " mr 6,2\n" // syscall arg4: REAL THREAD tls " mr 7,7\n" // syscall arg5: child_tid " mr 8,8\n" // syscall arg6: ???? " mr 9,9\n" // syscall arg7: ???? " sc\n" // clone() " mfcr 4\n" // return CR in r4 (low word of ULong) " cmpwi 3,0\n" // child if retval == 0 " bne 1f\n" // jump if !child /* CHILD - call thread function */ /* Note: 2.4 kernel doesn't set the child stack pointer, so we do it here. That does leave a small window for a signal to be delivered on the wrong stack, unfortunately. */ " mr 1,29\n" " mtctr 30\n" // ctr reg = fn " mr 3,31\n" // r3 = arg " bctrl\n" // call fn() // exit with result " li 0,"__NR_EXIT"\n" " sc\n" // Exit returned?! " .long 0\n" // PARENT or ERROR - return "1: lwz 29,20(1)\n" " lwz 30,24(1)\n" " lwz 31,28(1)\n" " addi 1,1,32\n" " blr\n" ".previous\n" ); #undef __NR_CLONE #undef __NR_EXIT /* --------------------------------------------------------------------- More thread stuff ------------------------------------------------------------------ */ void VG_(cleanup_thread) ( ThreadArchState* arch ) { } /* --------------------------------------------------------------------- PRE/POST wrappers for ppc32/Linux-specific syscalls ------------------------------------------------------------------ */ #define PRE(name) DEFN_PRE_TEMPLATE(ppc32_linux, name) #define POST(name) DEFN_POST_TEMPLATE(ppc32_linux, name) /* Add prototypes for the wrappers declared here, so that gcc doesn't harass us for not having prototypes. Really this is a kludge -- the right thing to do is to make these wrappers 'static' since they aren't visible outside this file, but that requires even more macro magic. */ DECL_TEMPLATE(ppc32_linux, sys_mmap); DECL_TEMPLATE(ppc32_linux, sys_mmap2); DECL_TEMPLATE(ppc32_linux, sys_stat64); DECL_TEMPLATE(ppc32_linux, sys_lstat64); DECL_TEMPLATE(ppc32_linux, sys_fstatat64); DECL_TEMPLATE(ppc32_linux, sys_fstat64); DECL_TEMPLATE(ppc32_linux, sys_sigreturn); DECL_TEMPLATE(ppc32_linux, sys_rt_sigreturn); DECL_TEMPLATE(ppc32_linux, sys_sigsuspend); DECL_TEMPLATE(ppc32_linux, sys_spu_create); DECL_TEMPLATE(ppc32_linux, sys_spu_run); PRE(sys_mmap) { SysRes r; PRINT("sys_mmap ( %#lx, %lu, %lu, %lu, %lu, %lu )", ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ); PRE_REG_READ6(long, "mmap", unsigned long, start, unsigned long, length, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, offset); r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, (Off64T)ARG6 ); SET_STATUS_from_SysRes(r); } PRE(sys_mmap2) { SysRes r; // Exactly like old_mmap() except: // - the file offset is specified in 4K units rather than bytes, // so that it can be used for files bigger than 2^32 bytes. PRINT("sys_mmap2 ( %#lx, %lu, %lu, %lu, %lu, %lu )", ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ); PRE_REG_READ6(long, "mmap2", unsigned long, start, unsigned long, length, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, offset); r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, 4096 * (Off64T)ARG6 ); SET_STATUS_from_SysRes(r); } // XXX: lstat64/fstat64/stat64 are generic, but not necessarily // applicable to every architecture -- I think only to 32-bit archs. // We're going to need something like linux/core_os32.h for such // things, eventually, I think. --njn PRE(sys_stat64) { PRINT("sys_stat64 ( %#lx, %#lx )",ARG1,ARG2); PRE_REG_READ2(long, "stat64", char *, file_name, struct stat64 *, buf); PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 ); PRE_MEM_WRITE( "stat64(buf)", ARG2, sizeof(struct vki_stat64) ); } POST(sys_stat64) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); } PRE(sys_lstat64) { PRINT("sys_lstat64 ( %#lx(%s), %#lx )", ARG1, (HChar*)ARG1, ARG2); PRE_REG_READ2(long, "lstat64", char *, file_name, struct stat64 *, buf); PRE_MEM_RASCIIZ( "lstat64(file_name)", ARG1 ); PRE_MEM_WRITE( "lstat64(buf)", ARG2, sizeof(struct vki_stat64) ); } POST(sys_lstat64) { vg_assert(SUCCESS); if (RES == 0) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); } } PRE(sys_fstatat64) { PRINT("sys_fstatat64 ( %ld, %#lx(%s), %#lx )", SARG1, ARG2, (HChar*)ARG2, ARG3); PRE_REG_READ3(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); } POST(sys_fstatat64) { POST_MEM_WRITE( ARG3, sizeof(struct vki_stat64) ); } PRE(sys_fstat64) { PRINT("sys_fstat64 ( %lu, %#lx )", ARG1, ARG2); PRE_REG_READ2(long, "fstat64", unsigned long, fd, struct stat64 *, buf); PRE_MEM_WRITE( "fstat64(buf)", ARG2, sizeof(struct vki_stat64) ); } POST(sys_fstat64) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); } //.. PRE(old_select, MayBlock) //.. { //.. /* struct sel_arg_struct { //.. unsigned long n; //.. fd_set *inp, *outp, *exp; //.. struct timeval *tvp; //.. }; //.. */ //.. PRE_REG_READ1(long, "old_select", struct sel_arg_struct *, args); //.. PRE_MEM_READ( "old_select(args)", ARG1, 5*sizeof(UWord) ); //.. //.. { //.. UInt* arg_struct = (UInt*)ARG1; //.. UInt a1, a2, a3, a4, a5; //.. //.. a1 = arg_struct[0]; //.. a2 = arg_struct[1]; //.. a3 = arg_struct[2]; //.. a4 = arg_struct[3]; //.. a5 = arg_struct[4]; //.. //.. PRINT("old_select ( %d, %p, %p, %p, %p )", a1,a2,a3,a4,a5); //.. if (a2 != (Addr)NULL) //.. PRE_MEM_READ( "old_select(readfds)", a2, a1/8 /* __FD_SETSIZE/8 */ ); //.. if (a3 != (Addr)NULL) //.. PRE_MEM_READ( "old_select(writefds)", a3, a1/8 /* __FD_SETSIZE/8 */ ); //.. if (a4 != (Addr)NULL) //.. PRE_MEM_READ( "old_select(exceptfds)", a4, a1/8 /* __FD_SETSIZE/8 */ ); //.. if (a5 != (Addr)NULL) //.. PRE_MEM_READ( "old_select(timeout)", a5, sizeof(struct vki_timeval) ); //.. } //.. } PRE(sys_sigreturn) { /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for an explanation of what follows. */ //ThreadState* tst; PRINT("sys_sigreturn ( )"); vg_assert(VG_(is_valid_tid)(tid)); vg_assert(tid >= 1 && tid < VG_N_THREADS); vg_assert(VG_(is_running_thread)(tid)); ///* Adjust esp to point to start of frame; skip back up over // sigreturn sequence's "popl %eax" and handler ret addr */ //tst = VG_(get_ThreadState)(tid); //tst->arch.vex.guest_ESP -= sizeof(Addr)+sizeof(Word); // Should we do something equivalent on ppc32? Who knows. ///* This is only so that the EIP is (might be) useful to report if // something goes wrong in the sigreturn */ //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch); // Should we do something equivalent on ppc32? Who knows. /* Restore register state from frame and remove it */ VG_(sigframe_destroy)(tid, False); /* Tell the driver not to update the guest state with the "result", and set a bogus result to keep it happy. */ *flags |= SfNoWriteResult; SET_STATUS_Success(0); /* Check to see if any signals arose as a result of this. */ *flags |= SfPollAfter; } PRE(sys_rt_sigreturn) { /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for an explanation of what follows. */ //ThreadState* tst; PRINT("rt_sigreturn ( )"); vg_assert(VG_(is_valid_tid)(tid)); vg_assert(tid >= 1 && tid < VG_N_THREADS); vg_assert(VG_(is_running_thread)(tid)); ///* Adjust esp to point to start of frame; skip back up over handler // ret addr */ //tst = VG_(get_ThreadState)(tid); //tst->arch.vex.guest_ESP -= sizeof(Addr); // Should we do something equivalent on ppc32? Who knows. ///* This is only so that the EIP is (might be) useful to report if // something goes wrong in the sigreturn */ //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch); // Should we do something equivalent on ppc32? Who knows. /* Restore register state from frame and remove it */ VG_(sigframe_destroy)(tid, True); /* Tell the driver not to update the guest state with the "result", and set a bogus result to keep it happy. */ *flags |= SfNoWriteResult; SET_STATUS_Success(0); /* Check to see if any signals arose as a result of this. */ *flags |= SfPollAfter; } //.. PRE(sys_modify_ldt, Special) //.. { //.. PRINT("sys_modify_ldt ( %d, %p, %d )", ARG1,ARG2,ARG3); //.. PRE_REG_READ3(int, "modify_ldt", int, func, void *, ptr, //.. unsigned long, bytecount); //.. //.. if (ARG1 == 0) { //.. /* read the LDT into ptr */ //.. PRE_MEM_WRITE( "modify_ldt(ptr)", ARG2, ARG3 ); //.. } //.. if (ARG1 == 1 || ARG1 == 0x11) { //.. /* write the LDT with the entry pointed at by ptr */ //.. PRE_MEM_READ( "modify_ldt(ptr)", ARG2, sizeof(vki_modify_ldt_t) ); //.. } //.. /* "do" the syscall ourselves; the kernel never sees it */ //.. SET_RESULT( VG_(sys_modify_ldt)( tid, ARG1, (void*)ARG2, ARG3 ) ); //.. //.. if (ARG1 == 0 && !VG_(is_kerror)(RES) && RES > 0) { //.. POST_MEM_WRITE( ARG2, RES ); //.. } //.. } //.. PRE(sys_set_thread_area, Special) //.. { //.. PRINT("sys_set_thread_area ( %p )", ARG1); //.. PRE_REG_READ1(int, "set_thread_area", struct user_desc *, u_info) //.. PRE_MEM_READ( "set_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) ); //.. //.. /* "do" the syscall ourselves; the kernel never sees it */ //.. SET_RESULT( VG_(sys_set_thread_area)( tid, (void *)ARG1 ) ); //.. } //.. PRE(sys_get_thread_area, Special) //.. { //.. PRINT("sys_get_thread_area ( %p )", ARG1); //.. PRE_REG_READ1(int, "get_thread_area", struct user_desc *, u_info) //.. PRE_MEM_WRITE( "get_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) ); //.. //.. /* "do" the syscall ourselves; the kernel never sees it */ //.. SET_RESULT( VG_(sys_get_thread_area)( tid, (void *)ARG1 ) ); //.. //.. if (!VG_(is_kerror)(RES)) { //.. POST_MEM_WRITE( ARG1, sizeof(vki_modify_ldt_t) ); //.. } //.. } //.. // Parts of this are ppc32-specific, but the *PEEK* cases are generic. //.. // XXX: Why is the memory pointed to by ARG3 never checked? //.. PRE(sys_ptrace, 0) //.. { //.. PRINT("sys_ptrace ( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4); //.. PRE_REG_READ4(int, "ptrace", //.. long, request, long, pid, long, addr, long, data); //.. switch (ARG1) { //.. case VKI_PTRACE_PEEKTEXT: //.. case VKI_PTRACE_PEEKDATA: //.. case VKI_PTRACE_PEEKUSR: //.. PRE_MEM_WRITE( "ptrace(peek)", ARG4, //.. sizeof (long)); //.. break; //.. case VKI_PTRACE_GETREGS: //.. PRE_MEM_WRITE( "ptrace(getregs)", ARG4, //.. sizeof (struct vki_user_regs_struct)); //.. break; //.. case VKI_PTRACE_GETFPREGS: //.. PRE_MEM_WRITE( "ptrace(getfpregs)", ARG4, //.. sizeof (struct vki_user_i387_struct)); //.. break; //.. case VKI_PTRACE_GETFPXREGS: //.. PRE_MEM_WRITE( "ptrace(getfpxregs)", ARG4, //.. sizeof(struct vki_user_fxsr_struct) ); //.. break; //.. case VKI_PTRACE_SETREGS: //.. PRE_MEM_READ( "ptrace(setregs)", ARG4, //.. sizeof (struct vki_user_regs_struct)); //.. break; //.. case VKI_PTRACE_SETFPREGS: //.. PRE_MEM_READ( "ptrace(setfpregs)", ARG4, //.. sizeof (struct vki_user_i387_struct)); //.. break; //.. case VKI_PTRACE_SETFPXREGS: //.. PRE_MEM_READ( "ptrace(setfpxregs)", ARG4, //.. sizeof(struct vki_user_fxsr_struct) ); //.. break; //.. default: //.. break; //.. } //.. } //.. POST(sys_ptrace) //.. { //.. switch (ARG1) { //.. case VKI_PTRACE_PEEKTEXT: //.. case VKI_PTRACE_PEEKDATA: //.. case VKI_PTRACE_PEEKUSR: //.. POST_MEM_WRITE( ARG4, sizeof (long)); //.. break; //.. case VKI_PTRACE_GETREGS: //.. POST_MEM_WRITE( ARG4, sizeof (struct vki_user_regs_struct)); //.. break; //.. case VKI_PTRACE_GETFPREGS: //.. POST_MEM_WRITE( ARG4, sizeof (struct vki_user_i387_struct)); //.. break; //.. case VKI_PTRACE_GETFPXREGS: //.. POST_MEM_WRITE( ARG4, sizeof(struct vki_user_fxsr_struct) ); //.. break; //.. default: //.. break; //.. } //.. } /* NB: This is an almost identical clone of versions for x86-linux and arm-linux, which are themselves literally identical. */ PRE(sys_sigsuspend) { /* The C library interface to sigsuspend just takes a pointer to a signal mask but this system call only takes the first word of the signal mask as an argument so only 32 signals are supported. In fact glibc normally uses rt_sigsuspend if it is available as that takes a pointer to the signal mask so supports more signals. */ *flags |= SfMayBlock; PRINT("sys_sigsuspend ( %lu )", ARG1 ); PRE_REG_READ1(int, "sigsuspend", vki_old_sigset_t, mask); } PRE(sys_spu_create) { PRE_MEM_RASCIIZ("stat64(filename)", ARG1); } POST(sys_spu_create) { vg_assert(SUCCESS); } PRE(sys_spu_run) { *flags |= SfMayBlock; if (ARG2 != 0) PRE_MEM_WRITE("npc", ARG2, sizeof(unsigned int)); PRE_MEM_READ("event", ARG3, sizeof(unsigned int)); } POST(sys_spu_run) { if (ARG2 != 0) POST_MEM_WRITE(ARG2, sizeof(unsigned int)); } #undef PRE #undef POST /* --------------------------------------------------------------------- The ppc32/Linux syscall table ------------------------------------------------------------------ */ /* Add an ppc32-linux specific wrapper to a syscall table. */ #define PLAX_(sysno, name) WRAPPER_ENTRY_X_(ppc32_linux, sysno, name) #define PLAXY(sysno, name) WRAPPER_ENTRY_XY(ppc32_linux, sysno, name) // This table maps from __NR_xxx syscall numbers (from // linux/include/asm-ppc/unistd.h) to the appropriate PRE/POST sys_foo() // wrappers on ppc32 (as per sys_call_table in linux/arch/ppc/kernel/entry.S). // // For those syscalls not handled by Valgrind, the annotation indicate its // arch/OS combination, eg. */* (generic), */Linux (Linux only), ?/? // (unknown). static SyscallTableEntry syscall_table[] = { //.. (restart_syscall) // 0 GENX_(__NR_exit, sys_exit), // 1 GENX_(__NR_fork, sys_fork), // 2 GENXY(__NR_read, sys_read), // 3 GENX_(__NR_write, sys_write), // 4 GENXY(__NR_open, sys_open), // 5 GENXY(__NR_close, sys_close), // 6 GENXY(__NR_waitpid, sys_waitpid), // 7 GENXY(__NR_creat, sys_creat), // 8 GENX_(__NR_link, sys_link), // 9 GENX_(__NR_unlink, sys_unlink), // 10 GENX_(__NR_execve, sys_execve), // 11 GENX_(__NR_chdir, sys_chdir), // 12 GENXY(__NR_time, sys_time), // 13 GENX_(__NR_mknod, sys_mknod), // 14 //.. GENX_(__NR_chmod, sys_chmod), // 15 GENX_(__NR_lchown, sys_lchown), // 16 ## P //.. GENX_(__NR_break, sys_ni_syscall), // 17 //.. // (__NR_oldstat, sys_stat), // 18 (obsolete) LINX_(__NR_lseek, sys_lseek), // 19 //.. GENX_(__NR_getpid, sys_getpid), // 20 LINX_(__NR_mount, sys_mount), // 21 LINX_(__NR_umount, sys_oldumount), // 22 GENX_(__NR_setuid, sys_setuid), // 23 ## P GENX_(__NR_getuid, sys_getuid), // 24 ## P //.. //.. // (__NR_stime, sys_stime), // 25 * (SVr4,SVID,X/OPEN) //.. PLAXY(__NR_ptrace, sys_ptrace), // 26 GENX_(__NR_alarm, sys_alarm), // 27 //.. // (__NR_oldfstat, sys_fstat), // 28 * L -- obsolete GENX_(__NR_pause, sys_pause), // 29 //.. LINX_(__NR_utime, sys_utime), // 30 //.. GENX_(__NR_stty, sys_ni_syscall), // 31 //.. GENX_(__NR_gtty, sys_ni_syscall), // 32 GENX_(__NR_access, sys_access), // 33 //.. GENX_(__NR_nice, sys_nice), // 34 //.. //.. GENX_(__NR_ftime, sys_ni_syscall), // 35 GENX_(__NR_sync, sys_sync), // 36 GENX_(__NR_kill, sys_kill), // 37 GENX_(__NR_rename, sys_rename), // 38 GENX_(__NR_mkdir, sys_mkdir), // 39 GENX_(__NR_rmdir, sys_rmdir), // 40 GENXY(__NR_dup, sys_dup), // 41 LINXY(__NR_pipe, sys_pipe), // 42 GENXY(__NR_times, sys_times), // 43 //.. GENX_(__NR_prof, sys_ni_syscall), // 44 //.. GENX_(__NR_brk, sys_brk), // 45 GENX_(__NR_setgid, sys_setgid), // 46 GENX_(__NR_getgid, sys_getgid), // 47 //.. // (__NR_signal, sys_signal), // 48 */* (ANSI C) GENX_(__NR_geteuid, sys_geteuid), // 49 GENX_(__NR_getegid, sys_getegid), // 50 //.. GENX_(__NR_acct, sys_acct), // 51 LINX_(__NR_umount2, sys_umount), // 52 //.. GENX_(__NR_lock, sys_ni_syscall), // 53 LINXY(__NR_ioctl, sys_ioctl), // 54 //.. LINXY(__NR_fcntl, sys_fcntl), // 55 //.. GENX_(__NR_mpx, sys_ni_syscall), // 56 GENX_(__NR_setpgid, sys_setpgid), // 57 //.. GENX_(__NR_ulimit, sys_ni_syscall), // 58 //.. // (__NR_oldolduname, sys_olduname), // 59 Linux -- obsolete GENX_(__NR_umask, sys_umask), // 60 GENX_(__NR_chroot, sys_chroot), // 61 //.. // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 GENX_(__NR_getpgrp, sys_getpgrp), // 65 GENX_(__NR_setsid, sys_setsid), // 66 LINXY(__NR_sigaction, sys_sigaction), // 67 //.. // (__NR_sgetmask, sys_sgetmask), // 68 */* (ANSI C) //.. // (__NR_ssetmask, sys_ssetmask), // 69 */* (ANSI C) //.. GENX_(__NR_setreuid, sys_setreuid), // 70 GENX_(__NR_setregid, sys_setregid), // 71 PLAX_(__NR_sigsuspend, sys_sigsuspend), // 72 LINXY(__NR_sigpending, sys_sigpending), // 73 //.. // (__NR_sethostname, sys_sethostname), // 74 */* //.. GENX_(__NR_setrlimit, sys_setrlimit), // 75 //.. GENXY(__NR_getrlimit, sys_old_getrlimit), // 76 GENXY(__NR_getrusage, sys_getrusage), // 77 GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 //.. GENX_(__NR_settimeofday, sys_settimeofday), // 79 //.. GENXY(__NR_getgroups, sys_getgroups), // 80 GENX_(__NR_setgroups, sys_setgroups), // 81 //.. PLAX_(__NR_select, old_select), // 82 GENX_(__NR_symlink, sys_symlink), // 83 //.. // (__NR_oldlstat, sys_lstat), // 84 -- obsolete //.. GENX_(__NR_readlink, sys_readlink), // 85 //.. // (__NR_uselib, sys_uselib), // 86 */Linux //.. // (__NR_swapon, sys_swapon), // 87 */Linux //.. // (__NR_reboot, sys_reboot), // 88 */Linux //.. // (__NR_readdir, old_readdir), // 89 -- superseded PLAX_(__NR_mmap, sys_mmap), // 90 GENXY(__NR_munmap, sys_munmap), // 91 GENX_(__NR_truncate, sys_truncate), // 92 GENX_(__NR_ftruncate, sys_ftruncate), // 93 GENX_(__NR_fchmod, sys_fchmod), // 94 GENX_(__NR_fchown, sys_fchown), // 95 GENX_(__NR_getpriority, sys_getpriority), // 96 GENX_(__NR_setpriority, sys_setpriority), // 97 //.. GENX_(__NR_profil, sys_ni_syscall), // 98 GENXY(__NR_statfs, sys_statfs), // 99 //.. GENXY(__NR_fstatfs, sys_fstatfs), // 100 //.. LINX_(__NR_ioperm, sys_ioperm), // 101 LINXY(__NR_socketcall, sys_socketcall), // 102 LINXY(__NR_syslog, sys_syslog), // 103 GENXY(__NR_setitimer, sys_setitimer), // 104 GENXY(__NR_getitimer, sys_getitimer), // 105 GENXY(__NR_stat, sys_newstat), // 106 GENXY(__NR_lstat, sys_newlstat), // 107 GENXY(__NR_fstat, sys_newfstat), // 108 //.. // (__NR_olduname, sys_uname), // 109 -- obsolete //.. //.. GENX_(__NR_iopl, sys_iopl), // 110 LINX_(__NR_vhangup, sys_vhangup), // 111 //.. GENX_(__NR_idle, sys_ni_syscall), // 112 //.. // (__NR_vm86old, sys_vm86old), // 113 x86/Linux-only GENXY(__NR_wait4, sys_wait4), // 114 //.. //.. // (__NR_swapoff, sys_swapoff), // 115 */Linux LINXY(__NR_sysinfo, sys_sysinfo), // 116 LINXY(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux //.. LINX_(__NR_clone, sys_clone), // 120 //.. // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) GENXY(__NR_uname, sys_newuname), // 122 //.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 LINXY(__NR_adjtimex, sys_adjtimex), // 124 GENXY(__NR_mprotect, sys_mprotect), // 125 LINXY(__NR_sigprocmask, sys_sigprocmask), // 126 GENX_(__NR_create_module, sys_ni_syscall), // 127 LINX_(__NR_init_module, sys_init_module), // 128 LINX_(__NR_delete_module, sys_delete_module), // 129 //.. //.. // Nb: get_kernel_syms() was removed 2.4-->2.6 //.. GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 //.. LINX_(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 GENX_(__NR_fchdir, sys_fchdir), // 133 //.. // (__NR_bdflush, sys_bdflush), // 134 */Linux //.. //.. // (__NR_sysfs, sys_sysfs), // 135 SVr4 LINX_(__NR_personality, sys_personality), // 136 //.. GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 LINX_(__NR_setfsuid, sys_setfsuid), // 138 LINX_(__NR_setfsgid, sys_setfsgid), // 139 LINXY(__NR__llseek, sys_llseek), // 140 GENXY(__NR_getdents, sys_getdents), // 141 GENX_(__NR__newselect, sys_select), // 142 GENX_(__NR_flock, sys_flock), // 143 GENX_(__NR_msync, sys_msync), // 144 //.. GENXY(__NR_readv, sys_readv), // 145 GENX_(__NR_writev, sys_writev), // 146 GENX_(__NR_getsid, sys_getsid), // 147 GENX_(__NR_fdatasync, sys_fdatasync), // 148 LINXY(__NR__sysctl, sys_sysctl), // 149 //.. GENX_(__NR_mlock, sys_mlock), // 150 GENX_(__NR_munlock, sys_munlock), // 151 GENX_(__NR_mlockall, sys_mlockall), // 152 LINX_(__NR_munlockall, sys_munlockall), // 153 LINXY(__NR_sched_setparam, sys_sched_setparam), // 154 //.. LINXY(__NR_sched_getparam, sys_sched_getparam), // 155 LINX_(__NR_sched_setscheduler, sys_sched_setscheduler), // 156 LINX_(__NR_sched_getscheduler, sys_sched_getscheduler), // 157 LINX_(__NR_sched_yield, sys_sched_yield), // 158 LINX_(__NR_sched_get_priority_max, sys_sched_get_priority_max),// 159 LINX_(__NR_sched_get_priority_min, sys_sched_get_priority_min),// 160 LINXY(__NR_sched_rr_get_interval, sys_sched_rr_get_interval), // 161 GENXY(__NR_nanosleep, sys_nanosleep), // 162 GENX_(__NR_mremap, sys_mremap), // 163 LINX_(__NR_setresuid, sys_setresuid), // 164 LINXY(__NR_getresuid, sys_getresuid), // 165 //.. GENX_(__NR_query_module, sys_ni_syscall), // 166 GENXY(__NR_poll, sys_poll), // 167 //.. // (__NR_nfsservctl, sys_nfsservctl), // 168 */Linux //.. LINX_(__NR_setresgid, sys_setresgid), // 169 LINXY(__NR_getresgid, sys_getresgid), // 170 LINXY(__NR_prctl, sys_prctl), // 171 PLAX_(__NR_rt_sigreturn, sys_rt_sigreturn), // 172 LINXY(__NR_rt_sigaction, sys_rt_sigaction), // 173 LINXY(__NR_rt_sigprocmask, sys_rt_sigprocmask), // 174 LINXY(__NR_rt_sigpending, sys_rt_sigpending), // 175 LINXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait), // 176 LINXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo), // 177 LINX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 178 GENXY(__NR_pread64, sys_pread64), // 179 GENX_(__NR_pwrite64, sys_pwrite64), // 180 GENX_(__NR_chown, sys_chown), // 181 GENXY(__NR_getcwd, sys_getcwd), // 182 LINXY(__NR_capget, sys_capget), // 183 LINX_(__NR_capset, sys_capset), // 184 GENXY(__NR_sigaltstack, sys_sigaltstack), // 185 LINXY(__NR_sendfile, sys_sendfile), // 186 //.. GENXY(__NR_getpmsg, sys_getpmsg), // 187 //.. GENX_(__NR_putpmsg, sys_putpmsg), // 188 // Nb: we treat vfork as fork GENX_(__NR_vfork, sys_fork), // 189 GENXY(__NR_ugetrlimit, sys_getrlimit), // 190 LINX_(__NR_readahead, sys_readahead), // 191 */Linux PLAX_(__NR_mmap2, sys_mmap2), // 192 GENX_(__NR_truncate64, sys_truncate64), // 193 GENX_(__NR_ftruncate64, sys_ftruncate64), // 194 //.. PLAXY(__NR_stat64, sys_stat64), // 195 PLAXY(__NR_lstat64, sys_lstat64), // 196 PLAXY(__NR_fstat64, sys_fstat64), // 197 // __NR_pciconfig_read // 198 // __NR_pciconfig_write // 199 // __NR_pciconfig_iobase // 200 // __NR_multiplexer // 201 GENXY(__NR_getdents64, sys_getdents64), // 202 LINX_(__NR_pivot_root, sys_pivot_root), // 203 LINXY(__NR_fcntl64, sys_fcntl64), // 204 GENX_(__NR_madvise, sys_madvise), // 205 GENXY(__NR_mincore, sys_mincore), // 206 LINX_(__NR_gettid, sys_gettid), // 207 //.. LINX_(__NR_tkill, sys_tkill), // 208 */Linux LINX_(__NR_setxattr, sys_setxattr), // 209 LINX_(__NR_lsetxattr, sys_lsetxattr), // 210 LINX_(__NR_fsetxattr, sys_fsetxattr), // 211 LINXY(__NR_getxattr, sys_getxattr), // 212 LINXY(__NR_lgetxattr, sys_lgetxattr), // 213 LINXY(__NR_fgetxattr, sys_fgetxattr), // 214 LINXY(__NR_listxattr, sys_listxattr), // 215 LINXY(__NR_llistxattr, sys_llistxattr), // 216 LINXY(__NR_flistxattr, sys_flistxattr), // 217 LINX_(__NR_removexattr, sys_removexattr), // 218 LINX_(__NR_lremovexattr, sys_lremovexattr), // 219 LINX_(__NR_fremovexattr, sys_fremovexattr), // 220 LINXY(__NR_futex, sys_futex), // 221 LINX_(__NR_sched_setaffinity, sys_sched_setaffinity), // 222 LINXY(__NR_sched_getaffinity, sys_sched_getaffinity), // 223 /* 224 currently unused */ // __NR_tuxcall // 225 LINXY(__NR_sendfile64, sys_sendfile64), // 226 //.. LINX_(__NR_io_setup, sys_io_setup), // 227 LINX_(__NR_io_destroy, sys_io_destroy), // 228 LINXY(__NR_io_getevents, sys_io_getevents), // 229 LINX_(__NR_io_submit, sys_io_submit), // 230 LINXY(__NR_io_cancel, sys_io_cancel), // 231 //.. LINX_(__NR_set_tid_address, sys_set_tid_address), // 232 LINX_(__NR_fadvise64, sys_fadvise64), // 233 */(Linux?) LINX_(__NR_exit_group, sys_exit_group), // 234 //.. GENXY(__NR_lookup_dcookie, sys_lookup_dcookie), // 235 LINXY(__NR_epoll_create, sys_epoll_create), // 236 LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 237 LINXY(__NR_epoll_wait, sys_epoll_wait), // 238 //.. // (__NR_remap_file_pages, sys_remap_file_pages), // 239 */Linux LINXY(__NR_timer_create, sys_timer_create), // 240 LINXY(__NR_timer_settime, sys_timer_settime), // 241 LINXY(__NR_timer_gettime, sys_timer_gettime), // 242 LINX_(__NR_timer_getoverrun, sys_timer_getoverrun), // 243 LINX_(__NR_timer_delete, sys_timer_delete), // 244 LINX_(__NR_clock_settime, sys_clock_settime), // 245 LINXY(__NR_clock_gettime, sys_clock_gettime), // 246 LINXY(__NR_clock_getres, sys_clock_getres), // 247 LINXY(__NR_clock_nanosleep, sys_clock_nanosleep), // 248 // __NR_swapcontext // 249 LINXY(__NR_tgkill, sys_tgkill), // 250 */Linux //.. GENX_(__NR_utimes, sys_utimes), // 251 GENXY(__NR_statfs64, sys_statfs64), // 252 GENXY(__NR_fstatfs64, sys_fstatfs64), // 253 LINX_(__NR_fadvise64_64, sys_fadvise64_64), // 254 */(Linux?) // __NR_rtas // 255 /* Number 256 is reserved for sys_debug_setcontext */ /* Number 257 is reserved for vserver */ /* Number 258 is reserved for new sys_remap_file_pages */ LINX_(__NR_mbind, sys_mbind), // 259 LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 260 LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 261 LINXY(__NR_mq_open, sys_mq_open), // 262 LINX_(__NR_mq_unlink, sys_mq_unlink), // 263 LINX_(__NR_mq_timedsend, sys_mq_timedsend), // 264 LINXY(__NR_mq_timedreceive, sys_mq_timedreceive), // 265 LINX_(__NR_mq_notify, sys_mq_notify), // 266 LINXY(__NR_mq_getsetattr, sys_mq_getsetattr), // 267 // __NR_kexec_load // 268 /* Number 269 is reserved for sys_add_key */ /* Number 270 is reserved for sys_request_key */ /* Number 271 is reserved for sys_keyctl */ /* Number 272 is reserved for sys_waitid */ LINX_(__NR_ioprio_set, sys_ioprio_set), // 273 LINX_(__NR_ioprio_get, sys_ioprio_get), // 274 LINX_(__NR_inotify_init, sys_inotify_init), // 275 LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 276 LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 277 PLAXY(__NR_spu_run, sys_spu_run), // 278 PLAX_(__NR_spu_create, sys_spu_create), // 279 LINXY(__NR_pselect6, sys_pselect6), // 280 LINXY(__NR_ppoll, sys_ppoll), // 281 LINXY(__NR_openat, sys_openat), // 286 LINX_(__NR_mkdirat, sys_mkdirat), // 287 LINX_(__NR_mknodat, sys_mknodat), // 288 LINX_(__NR_fchownat, sys_fchownat), // 289 LINX_(__NR_futimesat, sys_futimesat), // 290 PLAXY(__NR_fstatat64, sys_fstatat64), // 291 LINX_(__NR_unlinkat, sys_unlinkat), // 292 LINX_(__NR_renameat, sys_renameat), // 293 LINX_(__NR_linkat, sys_linkat), // 294 LINX_(__NR_symlinkat, sys_symlinkat), // 295 LINX_(__NR_readlinkat, sys_readlinkat), // 296 LINX_(__NR_fchmodat, sys_fchmodat), // 297 LINX_(__NR_faccessat, sys_faccessat), // 298 LINX_(__NR_set_robust_list, sys_set_robust_list), // 299 LINXY(__NR_get_robust_list, sys_get_robust_list), // 300 LINXY(__NR_move_pages, sys_move_pages), // 301 LINXY(__NR_getcpu, sys_getcpu), // 302 LINXY(__NR_epoll_pwait, sys_epoll_pwait), // 303 LINX_(__NR_utimensat, sys_utimensat), // 304 LINXY(__NR_signalfd, sys_signalfd), // 305 LINXY(__NR_timerfd_create, sys_timerfd_create), // 306 LINXY(__NR_eventfd, sys_eventfd), // 307 LINX_(__NR_sync_file_range2, sys_sync_file_range2), // 308 LINX_(__NR_fallocate, sys_fallocate), // 309 // LINXY(__NR_subpage_prot, sys_ni_syscall), // 310 LINXY(__NR_timerfd_settime, sys_timerfd_settime), // 311 LINXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 312 LINXY(__NR_signalfd4, sys_signalfd4), // 313 LINXY(__NR_eventfd2, sys_eventfd2), // 314 LINXY(__NR_epoll_create1, sys_epoll_create1), // 315 LINXY(__NR_dup3, sys_dup3), // 316 LINXY(__NR_pipe2, sys_pipe2), // 317 LINXY(__NR_inotify_init1, sys_inotify_init1), // 318 LINXY(__NR_perf_event_open, sys_perf_event_open), // 319 LINXY(__NR_preadv, sys_preadv), // 320 LINX_(__NR_pwritev, sys_pwritev), // 321 LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322 LINXY(__NR_socket, sys_socket), // 326 LINX_(__NR_bind, sys_bind), // 327 LINX_(__NR_connect, sys_connect), // 328 LINX_(__NR_listen, sys_listen), // 329 LINXY(__NR_accept, sys_accept), // 330 LINXY(__NR_getsockname, sys_getsockname), // 331 LINXY(__NR_getpeername, sys_getpeername), // 332 LINX_(__NR_send, sys_send), // 334 LINX_(__NR_sendto, sys_sendto), // 335 LINXY(__NR_recv, sys_recv), // 336 LINXY(__NR_recvfrom, sys_recvfrom), // 337 LINX_(__NR_shutdown, sys_shutdown), // 338 LINX_(__NR_setsockopt, sys_setsockopt), // 339 LINXY(__NR_recvmmsg, sys_recvmmsg), // 343 LINXY(__NR_accept4, sys_accept4), // 344 LINX_(__NR_clock_adjtime, sys_clock_adjtime), // 347 LINX_(__NR_syncfs, sys_syncfs), // 348 LINXY(__NR_sendmmsg, sys_sendmmsg), // 349 LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351 LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352 LINXY(__NR_getrandom, sys_getrandom), // 359 LINXY(__NR_memfd_create, sys_memfd_create) // 360 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) { const UInt syscall_table_size = sizeof(syscall_table) / sizeof(syscall_table[0]); /* Is it in the contiguous initial section of the table? */ if (sysno < syscall_table_size) { SyscallTableEntry* sys = &syscall_table[sysno]; if (sys->before == NULL) return NULL; /* no entry */ else return sys; } /* Can't find a wrapper */ return NULL; } #endif // defined(VGP_ppc32_linux) /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/
svn2github/Valgrind3
coregrind/m_syswrap/syswrap-ppc32-linux.c
C
gpl-2.0
43,702
/* * This file is part of libbluray * Copyright (C) 2010 William Hahne * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ package org.bluray.ti; import javax.tv.service.SIElement; import javax.tv.service.navigation.ServiceComponent; public abstract interface PlayItem extends SIElement { public abstract ServiceComponent[] getComponents(); }
xucp/mpc_hc
src/thirdparty/LAVFilters/src/libbluray/src/libbluray/bdj/java/org/bluray/ti/PlayItem.java
Java
gpl-3.0
979
/** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #pragma once /** * FELIXprinters v2.0/3.0 (RAMPS v1.4) pin assignments */ #if HOTENDS > 2 || E_STEPPERS > 2 #error "Felix 2.0+ supports up to 2 hotends / E-steppers. Comment out this line to continue." #endif #define BOARD_INFO_NAME "Felix 2.0+" // // Heaters / Fans // // Power outputs EFBF or EFBE #define MOSFET_D_PIN 7 #include "pins_RAMPS.h" // // Misc. Functions // #define SDPOWER_PIN 1 #define PS_ON_PIN 12 // // LCD / Controller // #if IS_ULTRA_LCD && IS_NEWPANEL #define SD_DETECT_PIN 6 #endif // // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are not valid with this board #undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN
thinkyhead/Marlin
Marlin/src/pins/ramps/pins_FELIX2.h
C
gpl-3.0
1,688
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /* * lpc_masking_model.h * * LPC functions * */ #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_LPC_MASKING_MODEL_H_ #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_LPC_MASKING_MODEL_H_ #ifdef __cplusplus extern "C" { #endif #include "structs.h" void WebRtcIsacfix_GetVars(const int16_t *input, const int16_t *pitchGains_Q12, uint32_t *oldEnergy, int16_t *varscale); void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0, int16_t *inHiQ0, MaskFiltstr_enc *maskdata, int16_t snrQ10, const int16_t *pitchGains_Q12, int32_t *gain_lo_hiQ17, int16_t *lo_coeffQ15, int16_t *hi_coeffQ15); typedef int32_t (*CalculateResidualEnergy)(int lpc_order, int32_t q_val_corr, int q_val_polynomial, int16_t* a_polynomial, int32_t* corr_coeffs, int* q_val_residual_energy); extern CalculateResidualEnergy WebRtcIsacfix_CalculateResidualEnergy; int32_t WebRtcIsacfix_CalculateResidualEnergyC(int lpc_order, int32_t q_val_corr, int q_val_polynomial, int16_t* a_polynomial, int32_t* corr_coeffs, int* q_val_residual_energy); #if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) int32_t WebRtcIsacfix_CalculateResidualEnergyNeon(int lpc_order, int32_t q_val_corr, int q_val_polynomial, int16_t* a_polynomial, int32_t* corr_coeffs, int* q_val_residual_energy); #endif #ifdef __cplusplus } /* extern "C" */ #endif #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_LPC_MASKING_MODEL_H_ */
liyouchang/webrtc-qt
webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h
C
gpl-3.0
2,827
/* God I hate Microsoft! */ #header #cart { width: 400px; } #header #cart .heading { position: relative; right: 172px; margin-right: 0px; } #header #cart .content { } .success, .warning, .attention, .information { position: relative; } .success .close, .warning .close, .attention .close, .information .close { position: absolute; right: 10px; } .button{ min-width:45px!important; } .ym-g25{ width:24.9%; }
atpshxc/shcoyee
mobile/catalog/view/theme/new/stylesheet/ie7.css
CSS
gpl-3.0
419
/** * Copyright (C) 2009, 2010 SC 4ViewSoft SRL * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.achartengine.util; import java.util.ArrayList; import java.util.List; import java.util.TreeMap; /** * This class requires sorted x values */ public class IndexXYMap<K, V> extends TreeMap<K, V> { private final List<K> indexList = new ArrayList<K>(); private double maxXDifference = 0; public IndexXYMap() { super(); } public V put(K key, V value) { indexList.add(key); updateMaxXDifference(); return super.put(key, value); } private void updateMaxXDifference() { if (indexList.size() < 2) { maxXDifference = 0; return; } if (Math.abs((Double) indexList.get(indexList.size() - 1) - (Double) indexList.get(indexList.size() - 2)) > maxXDifference) maxXDifference = Math.abs((Double) indexList.get(indexList.size() - 1) - (Double) indexList.get(indexList.size() - 2)); } public double getMaxXDifference() { return maxXDifference; } public void clear() { updateMaxXDifference(); super.clear(); indexList.clear(); } /** * Returns X-value according to the given index * * @param index * @return */ public K getXByIndex(int index) { return indexList.get(index); } /** * Returns Y-value according to the given index * * @param index * @return */ public V getYByIndex(int index) { K key = indexList.get(index); return this.get(key); } /** * Returns XY-entry according to the given index * * @param index * @return */ public XYEntry<K, V> getByIndex(int index) { K key = indexList.get(index); return new XYEntry<K, V>(key, this.get(key)); } /** * Removes entry from map by index * * @param index */ public XYEntry<K, V> removeByIndex(int index) { K key = indexList.remove(index); return new XYEntry<K, V>(key, this.remove(key)); } public int getIndexForKey(K key) { return indexList.indexOf(key); } }
pabloem/Anki-Android
src/org/achartengine/util/IndexXYMap.java
Java
gpl-3.0
2,564
.tipsy { padding: 5px; position: absolute; z-index: 100000; cursor: default; } .tipsy-inner { padding: 5px 8px 4px 8px; /*background-color: #e8f2f8;*/ background-color: #fff; border: solid 1px #a7d7f9; color: #000; max-width: 15em; border-radius: 4px; /* -moz-box-shadow: 0px 2px 8px #cccccc; -webkit-box-shadow: 0px 2px 8px #cccccc; box-shadow: 0px 2px 8px #cccccc; -ms-filter: "progid:DXImageTransform.Microsoft.DropShadow(OffX=0, OffY=2, Strength=6, Direction=90, Color='#cccccc')"; filter: progid:DXImageTransform.Microsoft.DropShadow(OffX=0, OffY=2, Strength=6, Direction=90, Color='#cccccc'); */ } .tipsy-arrow { position: absolute; /* @embed */ background: url( images/tipsy.png ) no-repeat top left; width: 11px; height: 6px; } /* @noflip */ .tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -5px; } /* @noflip */ .tipsy-nw .tipsy-arrow { top: 0; left: 10px; } /* @noflip */ .tipsy-ne .tipsy-arrow { top: 0; right: 10px; } /* @noflip */ .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; background-position: bottom left; } /* @noflip */ .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; } /* @noflip */ .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; } /* @noflip */ .tipsy-e .tipsy-arrow { top: 50%; margin-top: -5px; right: 0; width: 6px; height: 11px; background-position: top right; } /* @noflip */ .tipsy-w .tipsy-arrow { top: 50%; margin-top: -5px; left: 0; width: 6px; height: 11px; }
Electro-Light/ElectroLight-WebSite
wiki/resources/src/jquery.tipsy/jquery.tipsy.css
CSS
gpl-3.0
1,539
----------------------------------- -- Area: Lufaise Meadows -- NPC: Jemmoquel, R.K. -- Outpost Conquest Guards -- @pos -542.418 -7.124 -53.521 24 ----------------------------------- package.loaded["scripts/zones/Lufaise_Meadows/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Lufaise_Meadows/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = TAVNAZIANARCH; local csid = 0x7ffb; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
nesstea/darkstar
scripts/zones/Lufaise_Meadows/npcs/Jemmoquel_RK.lua
Lua
gpl-3.0
3,331
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <script src="/resources/testharness.js"></script> <title>Restrictions on return value from `async_test`</title> </head> <body> <script> function makeTest(...bodies) { const closeScript = '<' + '/script>'; let src = ` <!DOCTYPE HTML> <html> <head> <title>Document title</title> <script src="/resources/testharness.js?${Math.random()}">${closeScript} </head> <body> <div id="log"></div>`; bodies.forEach((body) => { src += '<script>(' + body + ')();' + closeScript; }); const iframe = document.createElement('iframe'); document.body.appendChild(iframe); iframe.contentDocument.write(src); return new Promise((resolve) => { window.addEventListener('message', function onMessage(e) { if (e.source !== iframe.contentWindow) { return; } if (!e.data || e.data.type !=='complete') { return; } window.removeEventListener('message', onMessage); resolve(e.data); }); iframe.contentDocument.close(); }).then(({ tests, status }) => { const summary = { harness: { status: getEnumProp(status, status.status), message: status.message }, tests: {} }; tests.forEach((test) => { summary.tests[test.name] = getEnumProp(test, test.status); }); return summary; }); } function getEnumProp(object, value) { for (let property in object) { if (!/^[A-Z]+$/.test(property)) { continue; } if (object[property] === value) { return property; } } } promise_test(() => { return makeTest( () => { async_test((t) => {t.done(); return undefined;}, 'before'); async_test((t) => {t.done(); return null;}, 'null'); async_test((t) => {t.done(); return undefined;}, 'after'); } ).then(({harness, tests}) => { assert_equals(harness.status, 'ERROR'); assert_equals( harness.message, 'Test named "null" passed a function to `async_test` that returned a value.' ); assert_equals(tests.before, 'PASS'); assert_equals(tests.null, 'PASS'); // This test did not get the chance to start. assert_equals(tests.after, undefined); }); }, 'test returning `null`'); promise_test(() => { return makeTest( () => { async_test((t) => {t.done(); return undefined;}, 'before'); async_test((t) => {t.done(); return {};}, 'object'); async_test((t) => {t.done(); return undefined;}, 'after'); } ).then(({harness, tests}) => { assert_equals(harness.status, 'ERROR'); assert_equals( harness.message, 'Test named "object" passed a function to `async_test` that returned a value.' ); assert_equals(tests.before, 'PASS'); assert_equals(tests.object, 'PASS'); // This test did not get the chance to start. assert_equals(tests.after, undefined); }); }, 'test returning an ordinary object'); promise_test(() => { return makeTest( () => { async_test((t) => {t.done(); return undefined;}, 'before'); async_test((t) => {t.done(); return Promise.resolve(5);}, 'thenable'); async_test((t) => {t.done(); return undefined;}, 'after'); } ).then(({harness, tests}) => { assert_equals(harness.status, 'ERROR'); assert_equals( harness.message, 'Test named "thenable" passed a function to `async_test` that returned a value. ' + 'Consider using `promise_test` instead when using Promises or async/await.' ); assert_equals(tests.before, 'PASS'); assert_equals(tests.thenable, 'PASS'); // This test did not get a chance to start. assert_equals(tests.after, undefined); }); }, 'test returning a thenable object'); </script> </body> </html>
asajeffrey/servo
tests/wpt/web-platform-tests/resources/test/tests/unit/async-test-return-restrictions.html
HTML
mpl-2.0
3,823
class ChangeCountsOnImports < ActiveRecord::Migration def change change_table :imports do |t| t.remove :success_count t.remove :fail_count t.integer :row_count, default: 0 end end end
davidleach/onebody
db/migrate/20150827000058_change_counts_on_imports.rb
Ruby
agpl-3.0
214
/* * ProActive Parallel Suite(TM): * The Open Source library for parallel and distributed * Workflows & Scheduling, Orchestration, Cloud Automation * and Big Data Analysis on Enterprise Grids & Clouds. * * Copyright (c) 2007 - 2017 ActiveEon * Contact: contact@activeeon.com * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License * as published by the Free Software Foundation: version 3 of * the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * If needed, contact us to obtain a release under GPL Version 2 or 3 * or a different license than the AGPL. */ package org.ow2.proactive_grid_cloud_portal.cli.cmd.rm; import static org.ow2.proactive_grid_cloud_portal.cli.HttpResponseStatus.OK; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.ow2.proactive_grid_cloud_portal.cli.ApplicationContext; import org.ow2.proactive_grid_cloud_portal.cli.CLIException; import org.ow2.proactive_grid_cloud_portal.cli.cmd.AbstractCommand; import org.ow2.proactive_grid_cloud_portal.cli.cmd.Command; import org.ow2.proactive_grid_cloud_portal.cli.json.TopologyView; import org.ow2.proactive_grid_cloud_portal.cli.utils.HttpResponseWrapper; import org.ow2.proactive_grid_cloud_portal.cli.utils.StringUtility; public class GetTopologyCommand extends AbstractCommand implements Command { @Override public void execute(ApplicationContext currentContext) throws CLIException { HttpGet request = new HttpGet(currentContext.getResourceUrl("topology")); HttpResponseWrapper response = execute(request, currentContext); if (statusCode(OK) == statusCode(response)) { TopologyView topology = readValue(response, TopologyView.class, currentContext); resultStack(currentContext).push(topology); if (!currentContext.isSilent()) { writeLine(currentContext, "%s", StringUtility.string(topology)); } } else { handleError("An error occurred while retrieving the topology:", response, currentContext); } } }
laurianed/scheduling
rest/rest-cli/src/main/java/org/ow2/proactive_grid_cloud_portal/cli/cmd/rm/GetTopologyCommand.java
Java
agpl-3.0
2,520
/* * Copyright (C) 2015 Dato, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FAULT_QUERY_OBJECT_HPP #define FAULT_QUERY_OBJECT_HPP #include <vector> #include <cstdlib> #include <stdint.h> #include <fault/zmq/zmq_msg_vector.hpp> #include <fault/message_types.hpp> namespace libfault { class query_object_server; struct query_object_server_master; struct query_object_server_replica; /** * \ingroup fault */ class query_object { public: query_object():version(0) { } virtual ~query_object() { } /** * Processes a query message which may not make changes to the object. * \param msg A pointer to the query message. * \param msglen The length of the query message * \param outreply An output parameter which should contain the reply message. * Reply should be written to (*outreply). * (*outreply) will be NULL and should be allocated * using malloc() * \param outreplylen An output parameter which should contain the length of * the reply message in (*outreply) */ virtual void query(char* msg, size_t msglen, char** outreply, size_t *outreplylen) = 0; /** * Processes an update message which may make changes to the object. * Returns true if the object was modified. The return value may be * conservative. As in, update() could always return true whether or not * the object was modified. * \param msg A pointer to the query message. * \param msglen The length of the query message * \param outreply An output parameter which should contain the reply message. * Reply should be written to (*outreply). * (*outreply) will be NULL and should be allocated * using malloc() * \param outreplylen An output parameter which should contain the length of * the reply message in (*outreply) * \retval True If the query modified the object. * \retval False If the query did not modify the object. */ virtual bool update(char* msg, size_t msglen, char** outreply, size_t *outreplylen) = 0; /** * Processes a query message which may not make changes to the object. * \param msg A pointer to the query message. * \param msglen The length of the query message * This need not be implemented. The default implementation simply * calls the full update() function, but immediately drops the reply. */ inline virtual void query(char* msg, size_t msglen) { char* outreply = NULL; size_t outreplylen = 0; query(msg, msglen, &outreply, &outreplylen); if (outreply) free(outreply); } /** * Processes an update message which may make changes to the object, * and does not need a reply message. * Returns true if the object was modified. The return value may be * conservative. As in, update() could always return true whether or not * the object was modified. * This need not be implemented. The default implementation simply * calls the full update() function, but immediately drops the reply. * \param msg A pointer to the query message. * \param msglen The length of the query message * \retval True If the query modified the object. * \retval False If the query did not modify the object. */ inline virtual bool update(char* msg, size_t msglen) { char* outreply = NULL; size_t outreplylen = 0; bool ret = update(msg, msglen, &outreply, &outreplylen); if (outreply) free(outreply); return ret; } /** * Serializes the object to a string. * \param outbuf An output parameter which should contain the serialized * representation of the object. * (*outbuf) will be NULL and should be allocated * using malloc() * \param outbuflen An output parameter which should contain the length of * the serialized representation in outbuf */ virtual void serialize(char** outbuf, size_t *outbuflen) = 0; /** * Deserializes the object from a string. * The deserialized object must not retain any state prior to the call * to deserialize. i.e. \ref serialize and \ref deserialize are fully * symmetric. * \param buf The memory buffer to deserialize from. * \param buflen The length of the buffer. */ virtual void deserialize(const char* buf, size_t buflen) = 0; /** * Optional. Called if the object was upgraded to a master. */ virtual void upgrade_to_master() { } inline uint64_t get_version() { return version; } protected: uint64_t version; /** * Wraps the query/update calls, giving it a zeromq interface. * Also detaches the additional tracking information attached to the message, * and attaches the tracking information required in the reply. * * Since the actual query, and its reply have additional headers attached, * it is important to use the query_client object to communicate with the * query_object. * Returns true if the object changed. False otherwise. * * \note * Equivalent to * parse_message(msg, qmsg); * qomsg.header.flags |= flags_override * process_message(qmsg, reply, hasreply); */ bool message_wrapper(zmq_msg_vector& message, zmq_msg_vector& reply, bool* hasreply, uint64_t flags_override = 0); /// Converts a zeromq message to a query_object_message void parse_message(zmq_msg_vector& message, query_object_message& qmsg); /// process the query_object message and returns the reply bool process_message(query_object_message& qmsg, zmq_msg_vector& reply, bool* hasreply); /** * A wrapper around serialize giving it a zeromq interface */ void serialize_wrapper(zmq_msg_vector& output); /** * A wrapper around deserialize giving it a zeromq interface */ void deserialize_wrapper(zmq_msg_vector& input); friend class query_object_server; friend struct query_object_server_master; friend struct query_object_server_replica; }; } // libfault #endif
fmacias64/Dato-Core
src/fault/query_object.hpp
C++
agpl-3.0
6,813
--?!MAP=556 assert(include("SethekkHalls.lua") , "Failed to load SethekkHalls.lua") local mod = require("DUNGEON_AUCHINDOUN.INSTANCE_SETHEKK_HALLS") assert(mod) module(mod._NAME..".DARKWEAVER_SYTH",package.seeall) local self = getfenv(1) function OnCombat(unit,_,mTarget) self[tostring(unit)] = { shock = math.random(2,6), chain = math.random(10,15), summon_phase = 1, isHeroic = (mTarget:IsPlayer() and mTarget:IsHeroic() ) } unit:RegisterAIUpdateEvent(1000) local say_text = math.random(1,3) if(say_text == 1) then unit:MonsterYell("Hrrmm.. Time to.. hrrm.. make my move.") unit:PlaySoundToSet(10503) elseif(say_text == 2) then unit:MonsterYell("Nice pets..hrm.. Yes!") unit:PlaySoundToSet(10504) else unit:MonsterYell("Nice pets have.. weapons. No so...nice.") unit:PlaySoundToSet(10505) end end function OnWipe(unit) unit:RemoveAIUpdateEvent() self[tostring(unit)] = nil end function OnTargetKill(unit) local say_text = math.random() if(say_text) then unit:MonsterYell("Death.. meeting life is..") unit:PlaySoundToSet(10506) else unit:MonsterYell("Uhn... Be free..") unit:PlaySoundToSet(10507) end end function OnDeath(unit) unit:MonsterYell("No more life... hrm. No more pain.") unit:PlaySoundToSet(10508) end function AIUpdate(unit) if(unit:IsCasting() ) then return end if(unit:GetNextTarget() == nil) then unit:WipeThreatList() return end local vars = self[tostring(unit)] vars.shock = vars.shock -1 vars.chain = vars.chain - 1 if(vars.chain <= 0) then local target = unit:GetRandomEnemy() if(vars.isHeroic) then unit:FullCastSpellOnTarget(15659,target) else unit:FullCastSpellOnTarget(15305,target) end vars.chain = math.random(10,20) elseif(vars.shock <=0) then local target = unit:GetRandomEnemy() local spelltocast = math.random(4) if(spelltocast == 1) then if(vars.isHeroic) then unit:FullCastSpellOnTarget(38135,target) else unit:FullCastSpellOnTarget(33534,target) end elseif(spelltocast == 2) then if(vars.isHeroic) then unit:FullCastSpellOnTarget(15616,target) else unit:FullCastSpellOnTarget(15039,target) end elseif(spelltocast == 3) then if(vars.isHeroic) then unit:FullCastSpellOnTarget(21401,target) else unit:FullCastSpellOnTarget(12548,target) end else if(vars.isHeroic) then unit:FullCastSpellOnTarget(38136,target) else unit:FullCastSpellOnTarget(33620,target) end end vars.shock = math.random(5,15) else local hp = unit:GetHealthPct() if( (hp <= 90 and vars.summon_phase == 1) or (hp <= 55 and vars.summon_phase == 2) or (hp <= 10 and vars.summon_phase == 3) ) then local summon_spells = {33538,33537,33539,33540} local angle = 0 for i = 1,4 do local radius = math.random(5,10) local x = unit:GetX()+math.cos(math.rad(angle))*radius local y = unit:GetY()+math.sin(math.rad(angle))*radius unit:CastSpellAoF(x,y,unit:GetZ(),summon_spells[i]) angle = angle+90 end unit:MonsterYell("I have pets of my own!") unit:PlaySoundToSet(10502) vars.summon_phase = vars.summon_phase + 1 end end end RegisterUnitEvent(18472,1,OnCombat) RegisterUnitEvent(18472,2,OnWipe) RegisterUnitEvent(18472,3,OnTargetKill) RegisterUnitEvent(18472,4,OnDeath) RegisterUnitEvent(18472,21,AIUpdate) function Elemental_Cast(unit,spell) unit:FullCastSpell(spell) end function Elemental_OnSpawn(unit) local entry = unit:GetEntry() if(entry == 19205) then unit:RegisterLuaEvent(Elemental_Cast,math.random(7,15)*1000,0,38138) elseif(entry == 19203) then unit:RegisterLuaEvent(Elemental_Cast,math.random(7,15)*1000,0,38141) elseif(entry == 19204) then unit:RegisterLuaEvent(Elemental_Cast,math.random(7,15)*1000,0,38142) else unit:RegisterLuaEvent(Elemental_Cast,math.random(7,15)*1000,0,38143) end local creator = unit:GetCreator() if(creator) then unit:AttackReaction(creator:GetNextTarget(),1,0) else unit:AttackReaction(unit:GetRandomEnemy(),1,0) end end function Elemental_OnWipe(unit) unit:RemoveLuaEvents() unit:Despawn(1000,0) end RegisterUnitEvent(19205,18,Elemental_OnSpawn) RegisterUnitEvent(19205,2,Elemental_OnWipe) RegisterUnitEvent(19203,18,Elemental_OnSpawn) RegisterUnitEvent(19203,2,Elemental_OnWipe) RegisterUnitEvent(19204,18,Elemental_OnSpawn) RegisterUnitEvent(19204,2,Elemental_OnWipe) RegisterUnitEvent(19206,18,Elemental_OnSpawn) RegisterUnitEvent(19206,2,Elemental_OnWipe)
arcemu-ng/arcemu
src/scripts/lua/LuaBridge/AUCHINDOUN/SETHEKK_HALLS/syth.lua
Lua
agpl-3.0
4,429
/** * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER within this package. */ #ifndef _SYSTEMTOPOLOGY_H_ #define _SYSTEMTOPOLOGY_H_ #include <apiset.h> #include <apisetcconv.h> #include <minwindef.h> #include <minwinbase.h> #ifdef __cplusplus extern "C" { #endif #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) WINBASEAPI WINBOOL WINAPI GetNumaHighestNodeNumber (PULONG HighestNodeNumber); #if _WIN32_WINNT >= 0x0601 WINBASEAPI WINBOOL WINAPI GetNumaNodeProcessorMaskEx (USHORT Node, PGROUP_AFFINITY ProcessorMask); #endif #endif #ifdef __cplusplus } #endif #endif
sdlBasic/sdlbrt
win32/mingw/i686-w64-mingw32/include/systemtopologyapi.h
C
lgpl-2.1
641
// This line keeps the nasty error message away (FireFox Bug) //DWREngine.setMethod(DWREngine.IFrame); var wsNamesMap = {}; function setFavourite(name, type, image){ var img = image.src; var isFavourite; if (img.substring(img.length-12, img.length) == 'unactive.gif') { isFavourite = false; } else { isFavourite = true; } AjaxServices.setFavourite(name, type, isFavourite); // already a favourite. turning off. if (isFavourite) { image.src='images/star_unactive.gif'; image.title='Set as favourite'; // not a favourite. turn on. } else { image.src='images/star_active.gif'; image.title='This is a favourite'; } } function precomputeTemplate(templateName){ document.getElementById('precompute_'+templateName).innerHTML="Precomputing.."; AjaxServices.preCompute(templateName,function(str) { document.getElementById('precompute_'+templateName).style.color="#777"; document.getElementById('precompute_'+templateName).innerHTML="Precomputed"; }); } function summariseTemplate(templateName){ document.getElementById('summarise_'+templateName).innerHTML="Summarising.."; AjaxServices.summarise(templateName,function(str) { document.getElementById('summarise_'+templateName).style.color="#777"; document.getElementById('summarise_'+templateName).innerHTML="Summarised"; }); } function editName(name){ document.getElementById('form_'+name).style.display="block"; document.getElementById('name_'+name).style.display="none"; } function renameElement(name, type, index){ var uid = name + type; var selectionInput; document.getElementById('form_' + uid).style.display="none"; document.getElementById('name_' + uid).innerHTML="<i>saving...</i>"; document.getElementById('name_' + uid).style.display="block"; AjaxServices.rename(name,type, (document.getElementById('newName_' + uid).value).replace(/^\s*|\s*$/g,""), function(str){ document.getElementById('name_' + uid).innerHTML=str; if (document.getElementById('selected_' + type + '_' + index) != null) { // coming from bags/templates pages document.getElementById('selected_' + type + '_' + index).value=str; } else { // coming from mymine if (selectionInput = document.getElementById('selected_user_' + type + '_' + index)) { selectionInput.value = str; } } // reload so that new "IDs" based on the name match if (str.indexOf('<i>') != -1) { setTimeout(function() {window.location.reload();}, 1000); } else { window.location.reload(); } }); } function changeViewPathDescription(pathName){ var pathString = pathName.replace(/\@sep\@/g,"."); var pathEnd = pathString.substring(pathString.lastIndexOf('.') + 1); document.getElementById('form_'+pathName).style.display = "none"; document.getElementById('name_'+pathName+'_inner').innerHTML = "<i>saving...</i>"; document.getElementById('name_'+pathName).style.display = "block"; var newDescription = document.getElementById('newName_' + pathName).value; var callBack = function(prefixDescription){ if (prefixDescription == null) { prefixDescription = '(no description)'; } document.getElementById('name_' + pathName + '_inner').innerHTML = '<span class="viewPathDescription">' + prefixDescription + '</span> &gt; ' + pathEnd; } AjaxServices.changeViewPathDescription(pathString, newDescription, callBack); } function saveBagDescription(bagName){ var textarea = document.getElementById('textarea').value; textarea = textarea.replace(/[\n\r]+/g, "\n\r<br/>"); document.getElementById('bagDescriptionDiv').innerHTML = '<i>Saving...</i>'; AjaxServices.saveBagDescription(bagName,textarea, function(str){ document.getElementById('bagDescriptionDiv').innerHTML = str; }); jQuery('textarea#textarea').toggle(); jQuery('div#bagDescriptionDiv').toggle(); } function roundToSignificantDecimal(n) { var log10n = Math.log(Math.abs(n)) / Math.log(10); if(log10n<1 && n!=0) { var rf = 100*Math.pow(10,-Math.round(log10n)); return rf; } else return 100; } function updateCountInColumnSummary() { var countString = document.resultsCountText; if (countString == null) { setTimeout("updateCountInColumnSummary()", 1000); return; } jQuery('#summary_row_count').html("<p>" + countString + "</p>"); var est = document.getElementById('resultsCountEstimate'); if (est == null || est.style.display != 'none') { setTimeout("updateCountInColumnSummary()", 500); return; } } function updateUniqueCountInColumnSummary(uniqueCountQid) { getResultsSize(uniqueCountQid, 1000, resultsCountCallback, null, true); } function resultsCountCallback(size) { if (size > 1) { var summaryUniqueCountElement = document.getElementById('summary_unique_count'); if(summaryUniqueCountElement != null) { summaryUniqueCountElement.style.display='inline'; summaryUniqueCountElement.innerHTML='<p>Total unique values: ' + size + "</p>"; } } return true; } var dialog=null; function getColumnSummary(tableName, columnName, columnDisplayName) { if (dialog == null) { dialog = new Boxy("<img src=\"images/wait18.gif\" title=\"loading icon\" style=\"margin:25px 50px;\">&nbsp;Loading...",{title:"Column Summary", draggable: true}); } else { dialog.setContent("<img src=\"images/wait18.gif\" title=\"loading icon\" style=\"margin:25px 50px;\">&nbsp;Loading..."); if(!dialog.isVisible()) { dialog.show(); } } AjaxServices.getColumnSummary(tableName, columnName, function(str){ var rows = str[0]; var uniqueCountQid = str[1]; var summaryRowsCount = str[2]; function rounder(cell) { if (cell==null) { return "[no value]" ; } if (! isNaN(cell)) { var rf = roundToSignificantDecimal(cell+0); return Math.round(cell*rf)/rf; } else { return cell; } } var headerText; if (rows[0] == null) { headerText = '<tr><th>No results found in this column</th></tr>'; } else if(rows[0].length == 2){ headerText = '<tr><th>Value</th><th>Count</th></tr>'; } else { headerText = '<tr><th>Min</th><th>Max</th><th>Sample Mean</th><th>Standard Deviation</th></tr>'; } var bodyText = ''; for (rowIndex = 0; rowIndex < rows.length; rowIndex++) { var row = rows[rowIndex]; bodyText += '<tr>'; for (colIndex = 0; colIndex < row.length; colIndex++) { var cellValue = rounder(row[colIndex]); bodyText += '<td>' + cellValue + '</td>'; } bodyText += '</tr>'; } var content = '<div class="box"> \ <div class="summaryhead"> \ <h3>Column Summary for ' + columnDisplayName + '</h3> \ </div> \ <div id="summary_row_count"></div> \ <div id="summary_unique_count"></div> \ <br/> \ <table class="results summary" cellpadding="0" cellspacing="0"> \ <thead id="summary_head">' + headerText +'</thead> \ <tbody id="summary_table">' + bodyText + '</tbody> \ </table>'; if (summaryRowsCount > 10) { content += '<div><p>Note: showing only the first 10 rows of summary.</p></div>'; } content += '<p><a href="columnSummary.do?tableName=' + tableName + '&summaryPath=' + columnName + '">View all</a></p></div>'; dialog.setContent(content); setTimeout("updateCountInColumnSummary()", 200); setTimeout("updateUniqueCountInColumnSummary(" + uniqueCountQid + ")", 300); }); } var qid, timeout, userCallback; function getResultsPoller(qid, timeout, userCallback) { var callback = function(results) { if (results == null) { // try again getResultsSize(qid, timeout, userCallback); } else { if (!userCallback(results)) { getResultsSize(qid, timeout, userCallback); } } } AjaxServices.getResultsSize(qid, callback); } function getResultsSize(qid1, timeout1, usercallback1) { qid = qid1; timeout = timeout1; userCallback = usercallback1; //Passing variables directly doesn't work in Safari setTimeout("getResultsPoller(qid, timeout, userCallback, true)", timeout); } // not needed for now: // function getResults(qid1, timeout1, usercallback1) { // qid = qid1; // timeout = timeout1; // userCallback = usercallback1; // //Passing variables directly doesn't work in Safari // setTimeout("getResultsPoller(qid, timeout, userCallback, false)", timeout); // } // function getResults(qid1,timeout1,usercallback1) { // qid = qid1; // timeout = timeout1; // userCallback = usercallback1; // //Passing variables directly doesn't work in Safari // setTimeout("getResultsPoller(qid, timeout, userCallback, false)", timeout); // } // delete all the child nodes of the node given by parentElement and create a child // element of type childTag, setting the text in the new child element to be // childText function setChild(parentElement, childText, childTag) { var newChild = document.createElement(childTag); newChild.innerHTML = childText; if (parentElement.firstChild != null) { while (parentElement.hasChildNodes()) { parentElement.removeChild(parentElement.firstChild); } } parentElement.appendChild(newChild); return newChild; } var callId = 1; // Give each ajax call an id and remember what our current pending id is var currentFilterCallbacks = new Array(); // Give each setTimeout call an id and remember what our current pending id is var futureFilterCalls = new Array(); function filterWebSearchablesHandler(event, object, type, wsListId) { var scope = document.getElementById('filterScope_'+wsListId+'_'+type).value; if (window.event) { event = window.event; } if (event) { if (event.keyCode == 27) { object.value = ''; clearFilter(type, wsListId); return; } if (event.keyCode == 13 || event.keyCode == 16 || event.keyCode == 17 || event.keyCode == 33 || event.keyCode == 34 || event.keyCode == 35 || event.keyCode == 36 || event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 39 ||event.keyCode == 40) { return false; } } futureFilterCalls[wsListId + "_" + type] = callId; if (tags == null) { tags = []; } // if (object.value=='') { // showAll(wsListId,type); // } setTimeout('filterWebSearchables("' + object.id + '", "' + scope + '","' + type + '","' + callId + '","' + wsListId + '")', 500); callId++; } // given a list of WebSearchables names,scores and descriptions, filter the // wsFilterList given by the wsListId and type parameters function do_filtering(filteredList, type, wsListId) { setItemsFiltered(true); if (filteredList.length == 0) { document.getElementById(wsListId+'_'+type+'_no_matches').style.display='block'; $(wsListId + '_' + type + '_spinner').style.display = 'none'; $(wsListId + '_' + type + '_container').style.display = 'none'; } else { var scoreHash = new Array(); var descHash = new Array(); var hitHash = new Array(); for (var el in filteredList) { var wsName = filteredList[el][0]; var wsDesc = filteredList[el][1]; descHash[wsListId + '_' + type + '_item_line_' + wsName] = wsDesc; var wsScore = filteredList[el][2]; scoreHash[wsListId + '_' + type + '_item_line_' + wsName] = wsScore; hitHash[wsListId + '_' + type + '_item_line_' + wsName] = 1; } for(var name in wsNamesMap) { var div = wsNamesMap[name]; if (hitHash[div.id]) { div.style.display='block'; var highlightText = descHash[div.id]; if (highlightText) { var descId = wsListId + '_' + type + '_item_description_' + name; var desc = $(descId); desc.style.display = 'none'; var descHighlightId = wsListId + '_' + type + '_item_description_' + name + '_highlight'; var descHighlight = $(descHighlightId); descHighlight.style.display = 'block'; var descChild = setChild(descHighlight, highlightText, 'p'); if(scoreHash.length == 0) { var scoreId = wsListId + '_' + type + '_item_score_' + name; var scoreSpan = $(scoreId); // we do this instead of scoreSpan.innerHTML = "stuff" // because it's buggy in Internet Explorer setChild(scoreSpan, '', 'span'); } } if (scoreHash[div.id]) { var scoreWsName = name; var score = scoreHash[div.id]; var intScore = parseInt(score * 10); var scoreId = wsListId + '_' + type + '_item_score_' + scoreWsName; var scoreSpan = $(scoreId); // we do this instead of scoreSpan.innerHTML = "stuff" // because it's buggy in Internet Explorer var heatImage = 'heat' + intScore + '.gif'; var heatText = '<img height="10" width="' + (intScore * 3) + '" src="images/' + heatImage + '"/>'; setChild(scoreSpan, heatText, 'span'); } } else if (document.getElementById(wsListId + '_' + type + '_chck_' + name).checked != true){ div.style.display='none'; } } showWSList(wsListId, type); function sortWsFilter(el1, el2) { var el1score = scoreHash[el1.id]; var el2score = scoreHash[el2.id] if (el1score > el2score) { return -1; } else { if (el1score < el2score) { return 1; } else { return 0; } } } var parent = $(wsListId + '_' + type + '_ws_list'); var divs = new Array(); for (var i = 0; i < parent.childNodes.length; i++) { var child = parent.childNodes[i]; if (child.tagName == 'DIV' && scoreHash[child.id]) { divs.push(child); } } divs.sort(sortWsFilter); for (var i = 0; i < divs.length; i++) { parent.appendChild(divs[i]); } $(wsListId + '_' + type + '_spinner').style.display = 'none'; $(wsListId + '_' + type + '_container').style.display = 'block'; showDescriptions(wsListId, type, isDescriptionShown()); } } function showElement(el, show) { if (el) { if (show) { el.style.display = 'block'; } else { el.style.display = 'none'; } } } descriptionShown = true; function showDescriptions(listId, type, show) { descriptionShown = show; var prefix = listId + '_' + type + '_item_description'; var divs = document.getElementsByTagName('div'); var i = 0; for (i = 0; i < divs.length; i++) { var el = divs[i]; // it is div with description if (el.id.match(prefix) != null) { // there are 2 descriptions: normal and highlighted // Results returned from Lucene search are crazy, sometimes the highlighted // description is empty after Lucene search and that's why this complicated // logic is needed - normal description is hidden if the highlighted is not empty if (areItemsFiltered()) { if (el.id.match('_highlight') != null) { showElement(el, show); } else { if (document.getElementById(el.id + '_highlight').innerHTML.length != 0) { showElement(el, false); } } } else { if ((el.id.match('_highlight') != null)) { showElement(el, false); } else { showElement(el, show); } } } } AjaxServices.setState(prefix, show); } // un-hide all the rows in the webSearchableList function showAll(wsListId, type) { for(var name in wsNamesMap) { var div = wsNamesMap[name]; div.style.display='block'; var scoreId = wsListId + '_' + type + '_item_score_' + name; var scoreSpan = $(scoreId); // we do this instead of scoreSpan.innerHTML = "stuff" // because it's buggy in Internet Explorer setChild(scoreSpan, '', 'span'); var descId = wsListId + '_' + type + '_item_description_' + name; var desc = $(descId); desc.style.display = 'block'; var descHighlightId = wsListId + '_' + type + '_item_description_' + name + '_highlight'; var descHighlight = $(descHighlightId); descHighlight.style.display = 'none'; } $(wsListId + '_' + type + '_spinner').style.display = 'none'; $(wsListId + '_' + type + '_container').style.display = 'block'; $(wsListId + '_' + type + '_no_matches').style.display='none'; } itemsFiltered = false; function areItemsFiltered() { return itemsFiltered; } function setItemsFiltered(filtered) { itemsFiltered = filtered; } function isDescriptionShown() { if (descriptionShown) { return descriptionShown; } else { return false; } } // call AjaxServices.filterWebSearchables() then hide those WebSearchables in // the webSearchableList that don't match function filterWebSearchables(objectId, scope, type, callId, wsListId) { if (futureFilterCalls[wsListId + "_" + type] != callId) { // filterWebSearchablesHandler() has been called again since this // timeout was set, so ignore as another timeout will be along // shortly return; } var object = document.getElementById(objectId); var value = object.value; var filterAction = document.getElementById('filterAction' + '_' + wsListId + '_' + type).value; if ( (value != null) || (tags != null && tags.length > 1)) { function filterCallBack(cbResult) { var callId = cbResult[0]; var filteredList = cbResult.slice(1); if (currentFilterCallbacks[wsListId + "_" + type] != callId) { // we've started another call since this one started, so // ignore this one return; } do_filtering(filteredList, type, wsListId); } $(wsListId+'_'+type+'_no_matches').style.display='none'; $(wsListId + '_' + type + '_spinner').style.display = 'block'; $(wsListId + '_' + type + '_container').style.display = 'none'; currentFilterCallbacks[wsListId + "_" + type] = callId; var tagList = null; /* We need to transform our map into a proper Array */ tagList = new Array(); if(tags['favourites_' + wsListId] != null && tags['favourites_' + wsListId] != '') { tagList[tagList.length]=tags['favourites_' + wsListId]; } if(tags['aspects_' + wsListId] != null && tags['aspect_' + wsListId] != '') { tagList[tagList.length]=tags['aspects_' + wsListId]; } if (typeof selectedUserTag != "undefined" && selectedUserTag != null) { tagList[tagList.length] = selectedUserTag; } /* filterAction toggles favourites off and on */ AjaxServices.filterWebSearchables(scope, type, tagList, object.value, filterAction, callId++, filterCallBack); } else { showAll(wsListId, type); } futureFilterCalls[wsListId + "_" + type] = 0; } var tags = new Array(); function filterFavourites(type, wsListId) { var id = 'filterAction_'+wsListId+'_'+type; // var tags = ''; var scope = document.getElementById('filterScope_'+wsListId+'_'+type).value; // favourites OFF if(document.getElementById(id).value == "favourites") { document.getElementById(id).value = ""; document.getElementById('filter_favourites_'+wsListId+'_'+type).src = 'images/filter_favourites.png'; delete tags['favourites_' + wsListId]; // favourites ON } else { document.getElementById(id).value = "favourites"; document.getElementById('filter_favourites_'+wsListId+'_'+type).src = 'images/filter_favourites_active.png'; tags['favourites_' + wsListId] = 'im:favourite'; } var filterTextElement = document.getElementById('filterText'); return filterWebSearchablesHandler(null, filterTextElement, type, wsListId); } function filterAspect(type, wsListId) { var id = 'filterAction_'+wsListId+'_'+type; var aspect = document.getElementById(wsListId+'_'+type+'_filter_aspect').value; var scope = document.getElementById('filterScope_'+wsListId+'_'+type).value; // aspects ON if(aspect != null && aspect.length > 1) { aspect = 'im:aspect:'+ aspect; tags['aspects_' + wsListId] = aspect; } else { delete tags['aspects_' + wsListId] } var filterTextElement = document.getElementById('filterText'); return filterWebSearchablesHandler(null, filterTextElement, type, wsListId); } function filterByUserTag(type, wsListId, tag) { // it is checked in filterWebSearchablesHandler selectedUserTag = tag; // boring stuff to reload new filtered web searchables from server var filterTextElement = document.getElementById('filterText'); return filterWebSearchablesHandler(null, filterTextElement, type, wsListId); } function changeScope(type, wsListId) { var id = 'filterScope_'+wsListId+'_'+type; var scope = document.getElementById(id).value; if(scope == 'all') { document.getElementById(id).value = 'user'; document.getElementById('filter_scope_'+wsListId+'_'+type).src = 'images/filter_my_active.png'; } else if(scope == 'user') { document.getElementById(id).value = 'all'; document.getElementById('filter_scope_'+wsListId+'_'+type).src = 'images/filter_all.png'; } var filterTextElement = document.getElementById('filterText'); return filterWebSearchablesHandler(null, filterTextElement, type, wsListId); } function clearFilter(type, wsListId) { setItemsFiltered(false); var scopeId = 'filterScope_'+wsListId+'_'+type; var favId = 'filterAction_'+wsListId+'_'+type; var aspectId = wsListId+'_'+type+'_filter_aspect'; document.getElementById(scopeId).value = 'all'; var scopeElement = document.getElementById('filter_scope_'+wsListId+'_'+type); if (scopeElement != null) { scopeElement.src = 'images/filter_all.png'; } delete tags['favourites_' + wsListId]; document.getElementById(favId).value = ""; var favElement = document.getElementById('filter_favourites_'+wsListId+'_'+type); if (favElement != null) { favElement.src = 'images/filter_favourites.png'; } delete tags['aspects_' + wsListId]; if ($(aspectId) != null) { $(aspectId).value = ''; } var filterTextElement = document.getElementById('filterText'); filterTextElement.value = ''; showAll(wsListId, type); var checkbox = document.getElementById("showCheckbox"); if (checkbox) { checkbox.checked = 'checked'; } return false; } function setWsNamesMap(wsNames, wsListId, type) { // initialise wsNamesMap so that the values are the corresponding DIV // elements for (var name in wsNames) { wsNamesMap[name] = $(wsListId + '_' + type + '_item_line_' + name); } 1; } // used on list analysis page function getConvertCountForBag(bagName, type, idname) { AjaxServices.getConvertCountForBag(bagName, type, function(count) { dwr.util.setValue(type + '_convertcount_'+idname, count) }); } // I don't think this is used anymore function getURL(bagName, type, idname) { AjaxServices.getConvertCountForBag(bagName, type, function(count) { dwr.util.setValue(type + '_convertcount_'+idname, count) }); } function getCustomConverterCounts(bagName, converter, callback) { AjaxServices.getCustomConverterCounts(bagName, converter, function(resultsArray) { callback.call(window, resultsArray); }); } function saveToggleState(elementId) { var display = document.getElementById(elementId).style.display; var opened; if(display=='none') { opened = false; } else { opened = true; } AjaxServices.saveToggleState(elementId, opened); } function showDirectionDiv() { jQuery("#directionDiv").show(); } function hideDirectionDiv() { jQuery("#directionDiv").hide(); } // historyBagView.jsp, wsFilterList.jsp function validateBagOperations(formName, operation) { if (Event && (Event.keyCode == 13 || Event.keyCode == 33 || Event.keyCode == 34 || Event.keyCode == 35 || Event.keyCode == 36 || Event.keyCode == 37 || Event.keyCode == 38 || Event.keyCode == 39 || Event.keyCode == 40)) { return; } var bagName = ''; var frm = document.forms[formName]; if (frm.newBagName) { bagName = frm.newBagName.value; } var selectedBags = []; var i = 0; var j = 0; if (frm.selectedBags) { // if there is only one item checked, then javascript doesn't work with it as a with array if (!frm.selectedBags.length) { selectedBags[0] = frm.selectedBags.value; } else { for (i = 0; i < frm.selectedBags.length; i++){ if (frm.selectedBags[i].checked) { selectedBags[j] = frm.selectedBags[i].value; j++; } } } } AjaxServices.validateBagOperations(bagName, selectedBags, operation, function(errMsg) { if (errMsg != '') { var msgBagInUse = "You are trying to delete the list"; // if the list they are trying to delete is in use, prompt for response // then delete list if the user clicks OK if (operation == 'delete' && errMsg.substring(0,33) == msgBagInUse) { Boxy.confirm(errMsg, function() { frm.listsButton.value = operation; frm.submit(); }, {title: 'Warning', modal: false}); } else { Boxy.alert(errMsg, null, {title: 'Error', modal: false}); if (operation == 'asymmetricdifference') { jQuery("#directionDiv input[name='asymmetricDirection']:checked").each(function() { jQuery(this).prop('checked', false); }); } } } else { jQuery('table.boxy-wrapper').hide(); frm.listsButton.value = operation; frm.submit(); } }); return false; } // table.jsp, bagUploadConfirm.jsp function validateBagName(formName) { if (Event && (Event.keyCode == 33 || Event.keyCode == 34 || Event.keyCode == 35 || Event.keyCode == 36 || Event.keyCode == 37 || Event.keyCode == 38 || Event.keyCode == 39 || Event.keyCode == 40)) { return; } var frm = document.forms[formName]; var bagName = frm.newBagName.value; AjaxServices.validateBagName(bagName, function(errMsg) { if (errMsg != '') { jQuery('#bigGreen').removeClass('clicked'); var newError = jQuery('<div class="error-message">' + errMsg + "</div>"); var errorContainer = jQuery('#error_msg'); errorContainer.fadeOut('fast', function() { errorContainer.find('.error-message').remove(); errorContainer.append(newError).fadeIn('fast'); }); } else { if (frm.operationButton) { frm.operationButton.value="saveNewBag"; } frm.submit(); } }); } /*function switchJoin(element) { var pathName = element.id.replace('join_arrow_',''); var elementid = element.id; AjaxServices.setOuterJoin(pathName,function(newPathName){ // replace all children ids with the updated path jQuery.each(jQuery('.joinLink'), function(index, item) { if(item.id.match("^" + elementid)) { item.id = item.id.replace(pathName, newPathName); } }); reDrawConstraintLogic(); }); if(jQuery(element).attr('src').indexOf('hollow')>-1) { jQuery(element).attr('src','images/join_full.png'); } else { jQuery(element).attr('src','images/join_hollow.png'); } }*/ function setConstraintLogic(expression) { AjaxServices.setConstraintLogic(expression, function(messages) { if (messages != "") { jQuery('#msg').append(messages); jQuery('#msg').fadeIn(2000); } reDrawConstraintLogic(); jQuery('#constraintLogic').toggle(); jQuery('#editConstraintLogic').toggle(); }); } function reDrawConstraintLogic() { AjaxServices.getConstraintLogic(function(expression) { expression = expression.replace('[','').replace(']','').replace(',',' and'); jQuery('#constraintLogic').text(expression); jQuery('span#editConstraintLogic input#expr').val(expression); }); } /** @deprecated */ function refreshSavedBagStatus() { AjaxServices.getSavedBagStatus(function(savedBagStatus) { var allCurrent = true; if (savedBagStatus) { var jSONObject = jQuery.parseJSON(savedBagStatus); jQuery.each(jSONObject, function(key, entry) { var bagName = entry['bagName']; var status = entry['status']; if (status == 'NOT_CURRENT' || status == 'UPGRADING') allCurrent = false; document.getElementById("status_" + bagName).innerHTML = getHTML(status, bagName); document.getElementById("size_" + bagName).innerHTML = entry['size']; if (status == 'CURRENT') { document.getElementById("linkBag_" + bagName).innerHTML = '<a href="bagDetails.do?bagName=' + bagName + '">' + bagName + '</html:link>'; hrefEdit='<a href="javascript:editName(\'' + bagName + '\');"><img border="0" src="images/edit.gif" width="13" height="13" title="Click here to rename this item"/></a>'; document.getElementById("editName_" + bagName).innerHTML = hrefEdit; } if (status == 'TO_UPGRADE') { document.getElementById("linkBag_" + bagName).innerHTML = '<a href="bagUpgrade.do?bagName=' + bagName + '" class="bagToUpgrade">' + bagName + '</html:link>'; } }) if (!allCurrent) { setTimeout('refreshSavedBagStatus()', 1000); } } }); } function getHTML(status, bagName) { if (status == 'CURRENT') return "Current"; else if (status == 'NOT_CURRENT') return "Not current"; else if (status == 'UPGRADING') return "Upgrading..."; else if (status == 'TO_UPGRADE') return "<a href='bagUpgrade.do?bagName=" + bagName + "' class='bagToUpgrade'>Upgrade</html:link>"; } function updateTemplate(field, value) { AjaxServices.updateTemplate(field, value); }
JoeCarlson/intermine
intermine/webapp/main/resources/webapp/js/imdwr.js
JavaScript
lgpl-2.1
32,913
/* Copyright (C) 2005, 2005 Alexander Kellett <lypanov@kde.org> 2008 Rob Buis <buis@kde.org> This file is part of the WebKit project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #if ENABLE(SVG) #include "SVGImageLoader.h" #include "Event.h" #include "EventNames.h" #include "SVGImageElement.h" #include "RenderImage.h" namespace WebCore { SVGImageLoader::SVGImageLoader(SVGImageElement* node) : ImageLoader(node) { } SVGImageLoader::~SVGImageLoader() { } void SVGImageLoader::dispatchLoadEvent() { if (image()->errorOccurred()) element()->dispatchEvent(Event::create(eventNames().errorEvent, false, false)); else { SVGImageElement* imageElement = static_cast<SVGImageElement*>(element()); if (imageElement->externalResourcesRequiredBaseValue()) imageElement->sendSVGLoadEventIfPossible(true); } } String SVGImageLoader::sourceURI(const AtomicString& attr) const { return deprecatedParseURL(KURL(element()->baseURI(), attr).string()); } } #endif // ENABLE(SVG)
pocketbook-free/browser
webkit-1.2.5/WebCore/svg/SVGImageLoader.cpp
C++
lgpl-2.1
1,812
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.spring.interceptor; import org.apache.camel.CamelContext; import org.apache.camel.processor.interceptor.AdviceWithTwoRoutesContextScopedOnExceptionTest; import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext; /** * */ public class SpringAdviceWithTwoRoutesContextScopedOnExceptionTest extends AdviceWithTwoRoutesContextScopedOnExceptionTest { @Override protected CamelContext createCamelContext() throws Exception { return createSpringCamelContext(this, "org/apache/camel/spring/interceptor/SpringAdviceWithTwoRoutesContextScopedOnExceptionTest.xml"); } }
adessaigne/camel
components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringAdviceWithTwoRoutesContextScopedOnExceptionTest.java
Java
apache-2.0
1,462
/* Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Package throttle provides a net.Listener that returns // artificially-delayed connections for testing real-world // connectivity. package throttle import ( "fmt" "net" "sync" "time" ) const unitSize = 1400 // read/write chunk size. ~MTU size. type Rate struct { KBps int // or 0, to not rate-limit bandwidth Latency time.Duration } // byteTime returns the time required for n bytes. func (r Rate) byteTime(n int) time.Duration { if r.KBps == 0 { return 0 } return time.Duration(float64(n)/1024/float64(r.KBps)) * time.Second } type Listener struct { net.Listener Down Rate // server Writes to Client Up Rate // server Reads from client } func (ln *Listener) Accept() (net.Conn, error) { c, err := ln.Listener.Accept() time.Sleep(ln.Up.Latency) if err != nil { return nil, err } tc := &conn{Conn: c, Down: ln.Down, Up: ln.Up} tc.start() return tc, nil } type nErr struct { n int err error } type writeReq struct { writeAt time.Time p []byte resc chan nErr } type conn struct { net.Conn Down Rate // for reads Up Rate // for writes wchan chan writeReq closeOnce sync.Once closeErr error } func (c *conn) start() { c.wchan = make(chan writeReq, 1024) go c.writeLoop() } func (c *conn) writeLoop() { for req := range c.wchan { time.Sleep(req.writeAt.Sub(time.Now())) var res nErr for len(req.p) > 0 && res.err == nil { writep := req.p if len(writep) > unitSize { writep = writep[:unitSize] } n, err := c.Conn.Write(writep) time.Sleep(c.Up.byteTime(len(writep))) res.n += n res.err = err req.p = req.p[n:] } req.resc <- res } } func (c *conn) Close() error { c.closeOnce.Do(func() { err := c.Conn.Close() close(c.wchan) c.closeErr = err }) return c.closeErr } func (c *conn) Write(p []byte) (n int, err error) { defer func() { if e := recover(); e != nil { n = 0 err = fmt.Errorf("%v", err) return } }() resc := make(chan nErr, 1) c.wchan <- writeReq{time.Now().Add(c.Up.Latency), p, resc} res := <-resc return res.n, res.err } func (c *conn) Read(p []byte) (n int, err error) { const max = 1024 if len(p) > max { p = p[:max] } n, err = c.Conn.Read(p) time.Sleep(c.Down.byteTime(n)) return }
ginabythebay/camlistore
pkg/throttle/throttle.go
GO
apache-2.0
2,800
/** * Copyright (c) 2014, 2016, Oracle and/or its affiliates. * The Universal Permissive License (UPL), Version 1.0 */ "use strict";var l={"SPM":["SPM","Saint-Pierre en Miquelon"],"CYM":["CYM","Caymaneilanden"],"DOM":["DOM","Dominicaanse Republiek"],"VGB":["VGB","Maagdeneilanden, V.K."],"TCA":["TCA","Turks- en Caicoseilanden"],"HTI":["HTI","Ha\u00EFti"],"KNA":["KNA","Saint Kitts en Nevis"],"VCT":["VCT","Saint Vincent en de Grenadines"],"BHS":["BHS","Bahama's"],"USA":["USA","Verenigde Staten"],"ATG":["ATG","Antigua en Barbuda"],"VIR":["VIR","Maagdeneilanden, V.S."]};(this?this:window)['DvtBaseMapManager']['_UNPROCESSED_MAPS'][2].push(["northAmerica","countries",l]);
JDT2016-Hackathon/hr
src/main/resources/static/js/libs/oj/v2.0.1/resources/internal-deps/dvt/thematicMap/resourceBundles/NorthAmericaCountriesBundle_nl.js
JavaScript
apache-2.0
676
// @strict: true // Repro from #20196 type A = { a: (x: number) => string }; type B = { a: (x: boolean) => string }; function call0(p: A | B) { p.a("s"); // Error } function callN<T extends A | B>(p: T) { p.a("s"); // Error var a: T["a"] = p.a; a(""); // Error a("", "", "", ""); // Error }
domchen/typescript-plus
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts
TypeScript
apache-2.0
333
/* Prefer faster, non-thread-safe stdio functions if available. Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify
retrography/scancode-toolkit
tests/cluecode/data/ics/bison-lib/unlocked-io.h
C
apache-2.0
208
/* * Copyright 2016-present Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Performance test application for the flow subsystem. */ package org.onosproject.flowperf;
donNewtonAlpha/onos
apps/test/flow-perf/src/main/java/org/onosproject/flowperf/package-info.java
Java
apache-2.0
717
package com.thinkaurelius.titan.graphdb.schema; import com.thinkaurelius.titan.core.Cardinality; import com.thinkaurelius.titan.core.Multiplicity; import org.apache.tinkerpop.gremlin.structure.Direction; /** * @author Matthias Broecheler (me@matthiasb.com) */ public abstract class RelationTypeDefinition extends SchemaElementDefinition { private final Multiplicity multiplicity; public RelationTypeDefinition(String name, long id, Multiplicity multiplicity) { super(name, id); this.multiplicity = multiplicity; } public Multiplicity getMultiplicity() { return multiplicity; } public Cardinality getCardinality() { return multiplicity.getCardinality(); } public abstract boolean isUnidirected(Direction dir); }
CYPP/titan
titan-core/src/main/java/com/thinkaurelius/titan/graphdb/schema/RelationTypeDefinition.java
Java
apache-2.0
785
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Microsoft.Owin.Host.HttpListener.RequestProcessing { internal sealed partial class CallEnvironment : IDictionary<string, object> { private static readonly IDictionary<string, object> WeakNilEnvironment = new NilDictionary(); private readonly IPropertySource _propertySource; private IDictionary<string, object> _extra = WeakNilEnvironment; internal CallEnvironment(IPropertySource propertySource) { _propertySource = propertySource; } internal IDictionary<string, object> Extra { get { return _extra; } } private IDictionary<string, object> StrongExtra { get { if (_extra == WeakNilEnvironment) { _extra = new Dictionary<string, object>(); } return _extra; } } internal bool IsExtraDictionaryCreated { get { return _extra != WeakNilEnvironment; } } public object this[string key] { get { object value; return PropertiesTryGetValue(key, out value) ? value : Extra[key]; } set { if (!PropertiesTrySetValue(key, value)) { StrongExtra[key] = value; } } } public void Add(string key, object value) { if (!PropertiesTrySetValue(key, value)) { StrongExtra.Add(key, value); } } public bool ContainsKey(string key) { return PropertiesContainsKey(key) || Extra.ContainsKey(key); } public ICollection<string> Keys { get { return PropertiesKeys().Concat(Extra.Keys).ToArray(); } } public bool Remove(string key) { // Although this is a mutating operation, Extra is used instead of StrongExtra, // because if a real dictionary has not been allocated the default behavior of the // nil dictionary is perfectly fine. return PropertiesTryRemove(key) || Extra.Remove(key); } public bool TryGetValue(string key, out object value) { return PropertiesTryGetValue(key, out value) || Extra.TryGetValue(key, out value); } public ICollection<object> Values { get { return PropertiesValues().Concat(Extra.Values).ToArray(); } } public void Add(KeyValuePair<string, object> item) { ((IDictionary<string, object>)this).Add(item.Key, item.Value); } public void Clear() { foreach (var key in PropertiesKeys()) { PropertiesTryRemove(key); } Extra.Clear(); } public bool Contains(KeyValuePair<string, object> item) { object value; return ((IDictionary<string, object>)this).TryGetValue(item.Key, out value) && Object.Equals(value, item.Value); } public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex) { PropertiesEnumerable().Concat(Extra).ToArray().CopyTo(array, arrayIndex); } public int Count { get { return PropertiesKeys().Count() + Extra.Count; } } public bool IsReadOnly { get { return false; } } public bool Remove(KeyValuePair<string, object> item) { return ((IDictionary<string, object>)this).Contains(item) && ((IDictionary<string, object>)this).Remove(item.Key); } IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator() { return PropertiesEnumerable().Concat(Extra).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return ((IDictionary<string, object>)this).GetEnumerator(); } } }
HongJunRen/katanaproject
src/Microsoft.Owin.Host.HttpListener/RequestProcessing/CallEnvironment.cs
C#
apache-2.0
4,376
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CSSTokenizer_h #define CSSTokenizer_h #include "core/CoreExport.h" #include "core/css/parser/CSSParserToken.h" #include "core/html/parser/InputStreamPreprocessor.h" #include "wtf/text/WTFString.h" #include <climits> namespace blink { class CSSTokenizerInputStream; class CSSParserObserverWrapper; struct CSSParserString; class CSSParserTokenRange; class CORE_EXPORT CSSTokenizer { WTF_MAKE_NONCOPYABLE(CSSTokenizer); WTF_MAKE_FAST_ALLOCATED(CSSTokenizer); public: class CORE_EXPORT Scope { public: Scope(const String&); Scope(const String&, CSSParserObserverWrapper&); // For the inspector CSSParserTokenRange tokenRange(); unsigned tokenCount(); private: void storeString(const String& string) { m_stringPool.append(string); } Vector<CSSParserToken> m_tokens; // We only allocate strings when escapes are used. Vector<String> m_stringPool; String m_string; friend class CSSTokenizer; }; private: CSSTokenizer(CSSTokenizerInputStream&, Scope&); CSSParserToken nextToken(); UChar consume(); void consume(unsigned); void reconsume(UChar); CSSParserToken consumeNumericToken(); CSSParserToken consumeIdentLikeToken(); CSSParserToken consumeNumber(); CSSParserToken consumeStringTokenUntil(UChar); CSSParserToken consumeUnicodeRange(); CSSParserToken consumeUrlToken(); void consumeBadUrlRemnants(); void consumeUntilNonWhitespace(); void consumeSingleWhitespaceIfNext(); void consumeUntilCommentEndFound(); bool consumeIfNext(UChar); CSSParserString consumeName(); UChar32 consumeEscape(); bool nextTwoCharsAreValidEscape(); bool nextCharsAreNumber(UChar); bool nextCharsAreNumber(); bool nextCharsAreIdentifier(UChar); bool nextCharsAreIdentifier(); CSSParserToken blockStart(CSSParserTokenType); CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType, CSSParserString); CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType); typedef CSSParserToken (CSSTokenizer::*CodePoint)(UChar); static const CodePoint codePoints[]; Vector<CSSParserTokenType> m_blockStack; CSSParserToken whiteSpace(UChar); CSSParserToken leftParenthesis(UChar); CSSParserToken rightParenthesis(UChar); CSSParserToken leftBracket(UChar); CSSParserToken rightBracket(UChar); CSSParserToken leftBrace(UChar); CSSParserToken rightBrace(UChar); CSSParserToken plusOrFullStop(UChar); CSSParserToken comma(UChar); CSSParserToken hyphenMinus(UChar); CSSParserToken asterisk(UChar); CSSParserToken lessThan(UChar); CSSParserToken solidus(UChar); CSSParserToken colon(UChar); CSSParserToken semiColon(UChar); CSSParserToken hash(UChar); CSSParserToken circumflexAccent(UChar); CSSParserToken dollarSign(UChar); CSSParserToken verticalLine(UChar); CSSParserToken tilde(UChar); CSSParserToken commercialAt(UChar); CSSParserToken reverseSolidus(UChar); CSSParserToken asciiDigit(UChar); CSSParserToken letterU(UChar); CSSParserToken nameStart(UChar); CSSParserToken stringStart(UChar); CSSParserToken endOfFile(UChar); CSSParserString registerString(const String&); CSSTokenizerInputStream& m_input; Scope& m_scope; }; } // namespace blink #endif // CSSTokenizer_h
zero-rp/miniblink49
third_party/WebKit/Source/core/css/parser/CSSTokenizer.h
C
apache-2.0
3,601
-include ../tools.mk all: $(call STATICLIB,foo) $(call STATICLIB,bar) $(RUSTC) main.rs $(call RUN,main)
Ryman/rust
src/test/run-make/no-duplicate-libs/Makefile
Makefile
apache-2.0
108
using System; using System.Diagnostics; using System.Resources; using System.Windows; using System.Windows.Markup; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using TwoButtons.WinPhone.Resources; namespace TwoButtons.WinPhone { public partial class App : Application { /// <summary> /// Provides easy access to the root frame of the Phone Application. /// </summary> /// <returns>The root frame of the Phone Application.</returns> public static PhoneApplicationFrame RootFrame { get; private set; } /// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Language display initialization InitializeLanguage(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Application.Current.Host.Settings.EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Prevent the screen from turning off while under the debugger by disabling // the application's idle detection. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } } // Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { } // Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { } // Code to execute when the application is deactivated (sent to background) // This code will not execute when the application is closing private void Application_Deactivated(object sender, DeactivatedEventArgs e) { } // Code to execute when the application is closing (eg, user hit Back) // This code will not execute when the application is deactivated private void Application_Closing(object sender, ClosingEventArgs e) { } // Code to execute if a navigation fails private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { if (Debugger.IsAttached) { // A navigation has failed; break into the debugger Debugger.Break(); } } // Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } } #region Phone application initialization // Avoid double-initialization private bool phoneApplicationInitialized = false; // Do not add any additional code to this method private void InitializePhoneApplication() { if (phoneApplicationInitialized) return; // Create the frame but don't set it as RootVisual yet; this allows the splash // screen to remain active until the application is ready to render. RootFrame = new PhoneApplicationFrame(); RootFrame.Navigated += CompleteInitializePhoneApplication; // Handle navigation failures RootFrame.NavigationFailed += RootFrame_NavigationFailed; // Handle reset requests for clearing the backstack RootFrame.Navigated += CheckForResetNavigation; // Ensure we don't initialize again phoneApplicationInitialized = true; } // Do not add any additional code to this method private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) { // Set the root visual to allow the application to render if (RootVisual != RootFrame) RootVisual = RootFrame; // Remove this handler since it is no longer needed RootFrame.Navigated -= CompleteInitializePhoneApplication; } private void CheckForResetNavigation(object sender, NavigationEventArgs e) { // If the app has received a 'reset' navigation, then we need to check // on the next navigation to see if the page stack should be reset if (e.NavigationMode == NavigationMode.Reset) RootFrame.Navigated += ClearBackStackAfterReset; } private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) { // Unregister the event so it doesn't get called again RootFrame.Navigated -= ClearBackStackAfterReset; // Only clear the stack for 'new' (forward) and 'refresh' navigations if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) return; // For UI consistency, clear the entire page stack while (RootFrame.RemoveBackEntry() != null) { ; // do nothing } } #endregion // Initialize the app's font and flow direction as defined in its localized resource strings. // // To ensure that the font of your application is aligned with its supported languages and that the // FlowDirection for each of those languages follows its traditional direction, ResourceLanguage // and ResourceFlowDirection should be initialized in each resx file to match these values with that // file's culture. For example: // // AppResources.es-ES.resx // ResourceLanguage's value should be "es-ES" // ResourceFlowDirection's value should be "LeftToRight" // // AppResources.ar-SA.resx // ResourceLanguage's value should be "ar-SA" // ResourceFlowDirection's value should be "RightToLeft" // // For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072. // private void InitializeLanguage() { try { // Set the font to match the display language defined by the // ResourceLanguage resource string for each supported language. // // Fall back to the font of the neutral language if the Display // language of the phone is not supported. // // If a compiler error is hit then ResourceLanguage is missing from // the resource file. RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage); // Set the FlowDirection of all elements under the root frame based // on the ResourceFlowDirection resource string for each // supported language. // // If a compiler error is hit then ResourceFlowDirection is missing from // the resource file. FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection); RootFrame.FlowDirection = flow; } catch { // If an exception is caught here it is most likely due to either // ResourceLangauge not being correctly set to a supported language // code or ResourceFlowDirection is set to a value other than LeftToRight // or RightToLeft. if (Debugger.IsAttached) { Debugger.Break(); } throw; } } } }
YOTOV-LIMITED/xamarin-forms-book-preview-2
Chapter06/TwoButtons/TwoButtons/TwoButtons.WinPhone/App.xaml.cs
C#
apache-2.0
9,050
/* * Copyright 2000-2009 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.psi; import org.jetbrains.annotations.NotNull; /** * Represents an array used as a value of an annotation element. For example: * {@code @Endorsers({"Children", "Unscrupulous dentists"})} * * @author ven */ public interface PsiArrayInitializerMemberValue extends PsiAnnotationMemberValue { /** * Returns the list of elements in the initializer array. * * @return the initializer array elements. */ PsiAnnotationMemberValue @NotNull [] getInitializers(); }
ingokegel/intellij-community
java/java-psi-api/src/com/intellij/psi/PsiArrayInitializerMemberValue.java
Java
apache-2.0
1,101
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jackrabbit.oak.remote.http.handler; import org.apache.jackrabbit.oak.remote.RemoteRevision; import org.apache.jackrabbit.oak.remote.RemoteSession; import javax.servlet.http.HttpServletRequest; import java.util.regex.Matcher; import java.util.regex.Pattern; class SearchSpecificRevisionHandler extends SearchRevisionHandler { private static final Pattern REQUEST_PATTERN = Pattern.compile("^/revisions/([^/]+)/tree$"); @Override protected RemoteRevision readRevision(HttpServletRequest request, RemoteSession session) { Matcher matcher = REQUEST_PATTERN.matcher(request.getPathInfo()); if (matcher.matches()) { return session.readRevision(matcher.group(1)); } throw new IllegalStateException("handler bound at the wrong path"); } }
AndreasAbdi/jackrabbit-oak
oak-remote/src/main/java/org/apache/jackrabbit/oak/remote/http/handler/SearchSpecificRevisionHandler.java
Java
apache-2.0
1,621
/* * (C) 2007-2012 Alibaba Group Holding Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * Authors: * wuhua <wq163@163.com> */ package com.taobao.metamorphosis.metaslave; import java.util.List; import java.util.Map; import java.util.Set; import org.I0Itec.zkclient.IZkDataListener; import org.I0Itec.zkclient.ZkClient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.taobao.metamorphosis.cluster.Broker; import com.taobao.metamorphosis.cluster.Partition; import com.taobao.metamorphosis.server.assembly.MetaMorphosisBroker; import com.taobao.metamorphosis.utils.MetaZookeeper; /** * ¸ºÔð¸úzk½»»¥,²¢¼à¿ØmasterÔÚzkÉϵÄ×¢²á * * @author ÎÞ»¨,dennis * @since 2011-6-24 ÏÂÎç05:46:36 */ class SlaveZooKeeper { private static final Log log = LogFactory.getLog(SlaveZooKeeper.class); private final MetaMorphosisBroker broker; private final SubscribeHandler subscribeHandler; private final MasterBrokerIdListener masterBrokerIdListener; private final String masterBrokerIdsPath; private final String masterConfigFileChecksumPath; public SlaveZooKeeper(final MetaMorphosisBroker broker, final SubscribeHandler subscribeHandler) { this.broker = broker; this.subscribeHandler = subscribeHandler; int brokerId = this.broker.getMetaConfig().getBrokerId(); this.masterBrokerIdsPath = this.getMetaZookeeper().brokerIdsPathOf(brokerId, -1); this.masterConfigFileChecksumPath = this.getMetaZookeeper().masterConfigChecksum(brokerId); this.masterBrokerIdListener = new MasterBrokerIdListener(); } public void start() { // ¶©ÔÄzkÐÅÏ¢±ä»¯ this.getZkClient().subscribeDataChanges(this.masterBrokerIdsPath, this.masterBrokerIdListener); this.getZkClient().subscribeDataChanges(this.masterConfigFileChecksumPath, this.masterBrokerIdListener); } public String getMasterServerUrl() { final Broker masterBroker = this.getMetaZookeeper().getMasterBrokerById(this.broker.getMetaConfig().getBrokerId()); return masterBroker != null ? masterBroker.getZKString() : null; } public Map<String, List<Partition>> getPartitionsForTopicsFromMaster() { return this.getMetaZookeeper().getPartitionsForSubTopicsFromMaster(this.getMasterTopics(), this.broker.getMetaConfig().getBrokerId()); } private Set<String> getMasterTopics() { return this.getMetaZookeeper().getTopicsByBrokerIdFromMaster(this.broker.getMetaConfig().getBrokerId()); } private ZkClient getZkClient() { return this.broker.getBrokerZooKeeper().getZkClient(); } private MetaZookeeper getMetaZookeeper() { return this.broker.getBrokerZooKeeper().getMetaZookeeper(); } private final class MasterBrokerIdListener implements IZkDataListener { @Override public synchronized void handleDataChange(final String dataPath, final Object data) throws Exception { int zkSyncTimeMs; try { zkSyncTimeMs = SlaveZooKeeper.this.broker.getMetaConfig().getZkConfig().zkSyncTimeMs; } catch (final Exception e) { zkSyncTimeMs = 5000; // ignore } // µÈ´ýzkÊý¾Ýͬ²½Íê±ÏÔÙÆô¶¯¶©ÔÄ Thread.sleep(zkSyncTimeMs); if (dataPath.equals(SlaveZooKeeper.this.masterBrokerIdsPath)) { // ÓÃÓÚslaveÏÈÆô¶¯£¬masterºóÆô¶¯Ê± log.info("data changed in zk,path=" + dataPath); SlaveZooKeeper.this.subscribeHandler.start(); } else if (dataPath.equals(SlaveZooKeeper.this.masterConfigFileChecksumPath)) { log.info("Restart slave..."); SlaveZooKeeper.this.subscribeHandler.restart(); log.info("Restart slave successfully."); } else { log.warn("Unknown data path:" + dataPath); } } @Override public void handleDataDeleted(final String dataPath) throws Exception { log.info("data deleted in zk,path=" + dataPath); if (dataPath.equals(SlaveZooKeeper.this.masterBrokerIdsPath)) { // °´ÕÕRemotingClientWrapperµÄ»úÖÆ,closeµÄ´ÎÊýÒªµÈÓÚconnectµÄ´ÎÊý²ÅÄÜÕæÕý¹Ø±ÕµôÁ¬½Ó, // ÒªÓÉÓÚÔÚ¶©ÔÄmasterÏûϢǰÁ¬½ÓÁËÒ»´Î,ËùÒÔÒªÔÚÕâÀï¹Ø±ÕÒ»´Î // ÆäËûµÄÁ¬½ÓºÍ¹Ø±ÕÓиºÔؾùºâ¸ºÔð SlaveZooKeeper.this.subscribeHandler.closeConnectIfNeed(); } } } }
fool-persen/Metamorphosis
metamorphosis-server-wrapper/src/main/java/com/taobao/metamorphosis/metaslave/SlaveZooKeeper.java
Java
apache-2.0
5,108
/* * Zed Attack Proxy (ZAP) and its related class files. * * ZAP is an HTTP/HTTPS proxy for assessing web application security. * * Copyright The ZAP Development Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.zaproxy.zap.view; import java.awt.Frame; import java.util.regex.Pattern; import org.apache.commons.httpclient.URI; import org.apache.commons.httpclient.URIException; import org.apache.log4j.Logger; import org.parosproxy.paros.Constant; import org.parosproxy.paros.model.Model; import org.parosproxy.paros.model.SiteNode; import org.zaproxy.zap.model.Context; import org.zaproxy.zap.utils.DisplayUtils; public class ContextCreateDialog extends StandardFieldsDialog { private static final long serialVersionUID = 1L; private static final String NAME_FIELD = "context.label.name"; private static final String DESC_FIELD = "context.label.desc"; private static final String TOP_NODE = "context.label.top"; private static final String IN_SCOPE_FIELD = "context.inscope.label"; private SiteNode topNode = null; private Logger logger = Logger.getLogger(ContextCreateDialog.class); public ContextCreateDialog(Frame owner) { super(owner, "context.create.title", DisplayUtils.getScaledDimension(400,300)); this.addTextField(NAME_FIELD, null); this.addNodeSelectField(TOP_NODE, null, false, false); this.addMultilineField(DESC_FIELD, ""); this.addCheckBoxField(IN_SCOPE_FIELD, true); } @Override public void siteNodeSelected(String field, SiteNode node) { topNode = node; if (node != null && this.isEmptyField(NAME_FIELD)) { // They havnt chosen a context name yet, default to the name of the node they chose this.setFieldValue(NAME_FIELD, node.getNodeName()); } } @Override public void save() { Context ctx = Model.getSingleton().getSession().getNewContext(this.getStringValue(NAME_FIELD)); ctx.setDescription(this.getStringValue(DESC_FIELD)); ctx.setInScope(this.getBoolValue(IN_SCOPE_FIELD)); if (topNode != null) { String url; try { url = new URI(topNode.getHierarchicNodeName(), false).toString(); if (topNode.isLeaf()) { url = Pattern.quote(url); } else { url = Pattern.quote(url) + ".*"; } ctx.addIncludeInContextRegex(url); } catch (URIException e) { logger.error("Bad context start url " + this.getStringValue(TOP_NODE), e); } } Model.getSingleton().getSession().saveContext(ctx); } @Override public String validateFields() { if (this.isEmptyField(NAME_FIELD)) { return Constant.messages.getString("context.create.warning.noname"); } return null; } }
jorik041/zaproxy
src/org/zaproxy/zap/view/ContextCreateDialog.java
Java
apache-2.0
3,203
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! "Object safety" refers to the ability for a trait to be converted //! to an object. In general, traits may only be converted to an //! object if all of their methods meet certain criteria. In particular, //! they must: //! //! - have a suitable receiver from which we can extract a vtable; //! - not reference the erased type `Self` except for in this receiver; //! - not have generic type parameters use super::supertraits; use super::elaborate_predicates; use middle::subst::{self, SelfSpace, TypeSpace}; use middle::traits; use middle::ty::{self, ToPolyTraitRef, Ty}; use std::rc::Rc; use syntax::ast; #[derive(Debug)] pub enum ObjectSafetyViolation<'tcx> { /// Self : Sized declared on the trait SizedSelf, /// Supertrait reference references `Self` an in illegal location /// (e.g. `trait Foo : Bar<Self>`) SupertraitSelf, /// Method has something illegal Method(Rc<ty::Method<'tcx>>, MethodViolationCode), } /// Reasons a method might not be object-safe. #[derive(Copy,Clone,Debug)] pub enum MethodViolationCode { /// e.g., `fn foo()` StaticMethod, /// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self` ReferencesSelf, /// e.g., `fn foo<A>()` Generic, } pub fn is_object_safe<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId) -> bool { // Because we query yes/no results frequently, we keep a cache: let def = tcx.lookup_trait_def(trait_def_id); let result = def.object_safety().unwrap_or_else(|| { let result = object_safety_violations(tcx, trait_def_id).is_empty(); // Record just a yes/no result in the cache; this is what is // queried most frequently. Note that this may overwrite a // previous result, but always with the same thing. def.set_object_safety(result); result }); debug!("is_object_safe({:?}) = {}", trait_def_id, result); result } pub fn object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId) -> Vec<ObjectSafetyViolation<'tcx>> { traits::supertrait_def_ids(tcx, trait_def_id) .flat_map(|def_id| object_safety_violations_for_trait(tcx, def_id)) .collect() } fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId) -> Vec<ObjectSafetyViolation<'tcx>> { // Check methods for violations. let mut violations: Vec<_> = tcx.trait_items(trait_def_id).iter() .flat_map(|item| { match *item { ty::MethodTraitItem(ref m) => { object_safety_violation_for_method(tcx, trait_def_id, &**m) .map(|code| ObjectSafetyViolation::Method(m.clone(), code)) .into_iter() } _ => None.into_iter(), } }) .collect(); // Check the trait itself. if trait_has_sized_self(tcx, trait_def_id) { violations.push(ObjectSafetyViolation::SizedSelf); } if supertraits_reference_self(tcx, trait_def_id) { violations.push(ObjectSafetyViolation::SupertraitSelf); } debug!("object_safety_violations_for_trait(trait_def_id={:?}) = {:?}", trait_def_id, violations); violations } fn supertraits_reference_self<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId) -> bool { let trait_def = tcx.lookup_trait_def(trait_def_id); let trait_ref = trait_def.trait_ref.clone(); let trait_ref = trait_ref.to_poly_trait_ref(); let predicates = tcx.lookup_super_predicates(trait_def_id); predicates .predicates .into_iter() .map(|predicate| predicate.subst_supertrait(tcx, &trait_ref)) .any(|predicate| { match predicate { ty::Predicate::Trait(ref data) => { // In the case of a trait predicate, we can skip the "self" type. data.0.trait_ref.substs.types.get_slice(TypeSpace) .iter() .cloned() .any(is_self) } ty::Predicate::Projection(..) | ty::Predicate::TypeOutlives(..) | ty::Predicate::RegionOutlives(..) | ty::Predicate::Equate(..) => { false } } }) } fn trait_has_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId) -> bool { let trait_def = tcx.lookup_trait_def(trait_def_id); let trait_predicates = tcx.lookup_predicates(trait_def_id); generics_require_sized_self(tcx, &trait_def.generics, &trait_predicates) } fn generics_require_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>, generics: &ty::Generics<'tcx>, predicates: &ty::GenericPredicates<'tcx>) -> bool { let sized_def_id = match tcx.lang_items.sized_trait() { Some(def_id) => def_id, None => { return false; /* No Sized trait, can't require it! */ } }; // Search for a predicate like `Self : Sized` amongst the trait bounds. let free_substs = tcx.construct_free_substs(generics, ast::DUMMY_NODE_ID); let predicates = predicates.instantiate(tcx, &free_substs).predicates.into_vec(); elaborate_predicates(tcx, predicates) .any(|predicate| { match predicate { ty::Predicate::Trait(ref trait_pred) if trait_pred.def_id() == sized_def_id => { is_self(trait_pred.0.self_ty()) } ty::Predicate::Projection(..) | ty::Predicate::Trait(..) | ty::Predicate::Equate(..) | ty::Predicate::RegionOutlives(..) | ty::Predicate::TypeOutlives(..) => { false } } }) } /// Returns `Some(_)` if this method makes the containing trait not object safe. fn object_safety_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId, method: &ty::Method<'tcx>) -> Option<MethodViolationCode> { // Any method that has a `Self : Sized` requisite is otherwise // exempt from the regulations. if generics_require_sized_self(tcx, &method.generics, &method.predicates) { return None; } virtual_call_violation_for_method(tcx, trait_def_id, method) } /// We say a method is *vtable safe* if it can be invoked on a trait /// object. Note that object-safe traits can have some /// non-vtable-safe methods, so long as they require `Self:Sized` or /// otherwise ensure that they cannot be used when `Self=Trait`. pub fn is_vtable_safe_method<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId, method: &ty::Method<'tcx>) -> bool { virtual_call_violation_for_method(tcx, trait_def_id, method).is_none() } /// Returns `Some(_)` if this method cannot be called on a trait /// object; this does not necessarily imply that the enclosing trait /// is not object safe, because the method might have a where clause /// `Self:Sized`. fn virtual_call_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId, method: &ty::Method<'tcx>) -> Option<MethodViolationCode> { // The method's first parameter must be something that derefs (or // autorefs) to `&self`. For now, we only accept `self`, `&self` // and `Box<Self>`. match method.explicit_self { ty::StaticExplicitSelfCategory => { return Some(MethodViolationCode::StaticMethod); } ty::ByValueExplicitSelfCategory | ty::ByReferenceExplicitSelfCategory(..) | ty::ByBoxExplicitSelfCategory => { } } // The `Self` type is erased, so it should not appear in list of // arguments or return type apart from the receiver. let ref sig = method.fty.sig; for &input_ty in &sig.0.inputs[1..] { if contains_illegal_self_type_reference(tcx, trait_def_id, input_ty) { return Some(MethodViolationCode::ReferencesSelf); } } if let ty::FnConverging(result_type) = sig.0.output { if contains_illegal_self_type_reference(tcx, trait_def_id, result_type) { return Some(MethodViolationCode::ReferencesSelf); } } // We can't monomorphize things like `fn foo<A>(...)`. if !method.generics.types.is_empty_in(subst::FnSpace) { return Some(MethodViolationCode::Generic); } None } fn contains_illegal_self_type_reference<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def_id: ast::DefId, ty: Ty<'tcx>) -> bool { // This is somewhat subtle. In general, we want to forbid // references to `Self` in the argument and return types, // since the value of `Self` is erased. However, there is one // exception: it is ok to reference `Self` in order to access // an associated type of the current trait, since we retain // the value of those associated types in the object type // itself. // // ```rust // trait SuperTrait { // type X; // } // // trait Trait : SuperTrait { // type Y; // fn foo(&self, x: Self) // bad // fn foo(&self) -> Self // bad // fn foo(&self) -> Option<Self> // bad // fn foo(&self) -> Self::Y // OK, desugars to next example // fn foo(&self) -> <Self as Trait>::Y // OK // fn foo(&self) -> Self::X // OK, desugars to next example // fn foo(&self) -> <Self as SuperTrait>::X // OK // } // ``` // // However, it is not as simple as allowing `Self` in a projected // type, because there are illegal ways to use `Self` as well: // // ```rust // trait Trait : SuperTrait { // ... // fn foo(&self) -> <Self as SomeOtherTrait>::X; // } // ``` // // Here we will not have the type of `X` recorded in the // object type, and we cannot resolve `Self as SomeOtherTrait` // without knowing what `Self` is. let mut supertraits: Option<Vec<ty::PolyTraitRef<'tcx>>> = None; let mut error = false; ty.maybe_walk(|ty| { match ty.sty { ty::TyParam(ref param_ty) => { if param_ty.space == SelfSpace { error = true; } false // no contained types to walk } ty::TyProjection(ref data) => { // This is a projected type `<Foo as SomeTrait>::X`. // Compute supertraits of current trait lazily. if supertraits.is_none() { let trait_def = tcx.lookup_trait_def(trait_def_id); let trait_ref = ty::Binder(trait_def.trait_ref.clone()); supertraits = Some(traits::supertraits(tcx, trait_ref).collect()); } // Determine whether the trait reference `Foo as // SomeTrait` is in fact a supertrait of the // current trait. In that case, this type is // legal, because the type `X` will be specified // in the object type. Note that we can just use // direct equality here because all of these types // are part of the formal parameter listing, and // hence there should be no inference variables. let projection_trait_ref = ty::Binder(data.trait_ref.clone()); let is_supertrait_of_current_trait = supertraits.as_ref().unwrap().contains(&projection_trait_ref); if is_supertrait_of_current_trait { false // do not walk contained types, do not report error, do collect $200 } else { true // DO walk contained types, POSSIBLY reporting an error } } _ => true, // walk contained types, if any } }); error } fn is_self<'tcx>(ty: Ty<'tcx>) -> bool { match ty.sty { ty::TyParam(ref data) => data.space == subst::SelfSpace, _ => false, } }
reem/rust
src/librustc/middle/traits/object_safety.rs
Rust
apache-2.0
13,456
class HerokuToolbelt < Formula desc "Everything you need to get started with Heroku" homepage "https://toolbelt.heroku.com/other" url "https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client-3.37.1.tgz" sha256 "a9d7ecface5363a945498b3d274533c4436c6f6529852939a0835620a415d420" head "https://github.com/heroku/heroku.git" depends_on :ruby => "1.9" def install libexec.install Dir["*"] # turn off autoupdates (off by default in HEAD) if build.stable? inreplace libexec/"bin/heroku", "Heroku::Updater.inject_libpath", "Heroku::Updater.disable(\"Use `brew upgrade heroku-toolbelt` to update\")" end bin.write_exec_script libexec/"bin/heroku" end test do system "#{bin}/heroku", "version" end end
ingmarv/homebrew
Library/Formula/heroku-toolbelt.rb
Ruby
bsd-2-clause
760
cask "rotki" do version "1.23.0" sha256 "ae2dd080a3ea85991dbf9a6efc2efe98ed6dae4774df4d3ca42f781c092d70d2" url "https://github.com/rotki/rotki/releases/download/v#{version}/rotki-darwin_x64-v#{version}.dmg", verified: "github.com/rotki/rotki/" name "Rotki" desc "Portfolio tracking and accounting tool" homepage "https://rotki.com/" app "rotki.app" zap trash: [ "~/Library/Application Support/rotki", "~/Library/Preferences/com.rotki.app.plist", "~/Library/Saved Application State/com.rotki.app.savedState", ] end
nrlquaker/homebrew-cask
Casks/rotki.rb
Ruby
bsd-2-clause
553
# simple __init__.py from .pidSVG import *
ptosco/rdkit
rdkit/sping/SVG/__init__.py
Python
bsd-3-clause
44
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @package Zend_Authentication */ namespace ZendTest\Authentication\Adapter\Http\TestAsset; use Zend\Authentication\Result as AuthenticationResult; use Zend\Authentication\Adapter\Http\ResolverInterface; class BasicAuthObjectResolver implements ResolverInterface { public function resolve($username, $realm, $password = null) { if ($username == 'Bryce' && $password == 'ThisIsNotMyPassword') { $identity = new \stdClass(); return new AuthenticationResult( AuthenticationResult::SUCCESS, $identity, array('Authentication successful.') ); } return new AuthenticationResult( AuthenticationResult::FAILURE, null, array('Authentication failed.') ); } }
altira/AltiraIDE
vendor/zendframework/zendframework/tests/ZendTest/Authentication/Adapter/Http/TestAsset/BasicAuthObjectResolver.php
PHP
bsd-3-clause
1,126
#!/bin/bash fw_depends crystal crystal deps install crystal server-postgres.cr &
F3Community/FrameworkBenchmarks
frameworks/Crystal/moonshine/setup-postgres.sh
Shell
bsd-3-clause
84
/* This file is part of the Console++ by Ivan De Marino <http://ivandemarino.me>. Copyright (c) 2014, Ivan De Marino <http://ivandemarino.me> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ if (console.LEVELS) { // Already loaded. No need to manipulate the "console" further. // NOTE: NodeJS already caches modules. This is just defensive coding. exports = console; return; } // private: var _ANSICODES = { 'reset' : '\033[0m', 'bold' : '\033[1m', 'italic' : '\033[3m', 'underline' : '\033[4m', 'blink' : '\033[5m', 'black' : '\033[30m', 'red' : '\033[31m', 'green' : '\033[32m', 'yellow' : '\033[33m', 'blue' : '\033[34m', 'magenta' : '\033[35m', 'cyan' : '\033[36m', 'white' : '\033[37m' }, _LEVELS = { NONE : 0, OFF : 0, //< alias for "NONE" ERROR : 1, WARN : 2, WARNING : 2, //< alias for "WARN" INFO : 3, INFORMATION : 3, //< alias for "INFO" DEBUG : 4 }, _LEVELS_COLOR = [ //< _LEVELS_COLOR position matches the _LEVELS values "red", "yellow", "cyan", "green" ], _LEVELS_NAME = [ //< _LEVELS_NAME position matches the _LEVELS values "NONE", "ERROR", "WARN ", "INFO ", "DEBUG" ], _console = { error : console.error, warn : console.warn, info : console.info, debug : console.log, log : console.log }, _level = _LEVELS.DEBUG, _colored = true, _messageColored = false, _timed = true, _onOutput = null; /** * Take a string and apply console ANSI colors for expressions "#color{msg}" * NOTE: Does nothing if "console.colored === false". * * @param str Input String * @returns Same string but with colors applied */ var _applyColors = function(str) { var tag = /#([a-z]+)\{|\}/, cstack = [], matches = null, orig = null, name = null, code = null; while (tag.test(str)) { matches = tag.exec(str); orig = matches[0]; if (console.isColored()) { if (orig === '}') { cstack.pop(); } else { name = matches[1]; if (name in _ANSICODES) { code = _ANSICODES[name]; cstack.push(code); } } str = str.replace(orig, _ANSICODES.reset + cstack.join('')); } else { str = str.replace(orig, ''); } } return str; }; /** * Decorate the Arguments passed to the console methods we override. * First element, the message, is now colored, timed and more (based on config). * * @param argsArray Array of arguments to decorate * @param level Logging level to apply (regulates coloring and text) * @returns Array of Arguments, decorated. */ var _decorateArgs = function(argsArray, level) { var args = Array.prototype.slice.call(argsArray, 1), msg = argsArray[0], levelMsg; if (console.isColored()) { levelMsg = _applyColors("#" + console.getLevelColor(level) + "{" + console.getLevelName(level) + "}"); msg = _applyColors(msg); if (console.isMessageColored()) { msg = _applyColors("#" + console.getLevelColor(level) + "{" + msg + "}"); } } else { levelMsg = console.getLevelName(level); } msg = _formatMessage(msg, levelMsg); args.splice(0, 0, msg); return args; }; /** * Formats the Message content. * @param msg The message itself * @param levelMsg The portion of message that contains the Level (maybe colored) * @retuns The formatted message */ var _formatMessage = function(msg, levelMsg) { if (console.isTimestamped()) { return "[" + levelMsg + " - " + new Date().toJSON() + "] " + msg; } else { return "[" + levelMsg + "] " + msg; } }; /** * Invokes the "console.onOutput()" callback, if it was set by user. * This is useful in case the user wants to write the console output to another media as well. * * The callback is invoked with 2 parameters: * - formattedMessage: formatted message, ready for output * - levelName: the name of the logging level, to inform the user * * @param msg The Message itself * @param level The Message Level (Number) */ var _invokeOnOutput = function(msg, level) { var formattedMessage, levelName; if (_onOutput !== null && typeof(_onOutput) === "function") { levelName = console.getLevelName(level); formattedMessage = _formatMessage(msg, levelName); _onOutput.call(null, formattedMessage, levelName); } }; // public: // CONSTANT: Logging Levels console.LEVELS = _LEVELS; // Set/Get Level console.setLevel = function(level) { _level = level; }; console.getLevel = function() { return _level; }; console.getLevelName = function(level) { return _LEVELS_NAME[typeof(level) === "undefined" ? _level : level]; }; console.getLevelColor = function(level) { return _LEVELS_COLOR[typeof(level) === "undefined" ? _level : level]; }; console.isLevelVisible = function(levelToCompare) { return _level >= levelToCompare; }; // Enable/Disable Colored Output console.enableColor = function() { _colored = true; }; console.disableColor = function() { _colored = false; }; console.isColored = function() { return _colored; }; // Enable/Disable Colored Message Output console.enableMessageColor = function() { _messageColored = true; }; console.disableMessageColor = function() { _messageColored = false; }; console.isMessageColored = function() { return _messageColored; }; // Enable/Disable Timestamped Output console.enableTimestamp = function() { _timed = true; }; console.disableTimestamp = function() { _timed = false; }; console.isTimestamped = function() { return _timed; }; // Set OnOutput Callback (useful to write to file or something) // Callback: `function(formattedMessage, levelName)` console.onOutput = function(callback) { _onOutput = callback; }; // Decodes coloring markup in string console.str2clr = function(str) { return console.isColored() ? _applyColors(str): str; }; // Overrides some key "console" Object methods console.error = function(msg) { if (arguments.length > 0 && this.isLevelVisible(_LEVELS.ERROR)) { _console.error.apply(this, _decorateArgs(arguments, _LEVELS.ERROR)); _invokeOnOutput(msg, _LEVELS.ERROR); } }; console.warn = function(msg) { if (arguments.length > 0 && this.isLevelVisible(_LEVELS.WARN)) { _console.warn.apply(this, _decorateArgs(arguments, _LEVELS.WARN)); _invokeOnOutput(msg, _LEVELS.WARN); } }; console.info = function(msg) { if (arguments.length > 0 && this.isLevelVisible(_LEVELS.INFO)) { _console.info.apply(this, _decorateArgs(arguments, _LEVELS.INFO)); _invokeOnOutput(msg, _LEVELS.INFO); } }; console.debug = function(msg) { if (arguments.length > 0 && this.isLevelVisible(_LEVELS.DEBUG)) { _console.debug.apply(this, _decorateArgs(arguments, _LEVELS.DEBUG)); _invokeOnOutput(msg, _LEVELS.DEBUG); } }; console.log = function(msg) { if (arguments.length > 0) { _console.log.apply(this, arguments); } }; exports = console;
mxOBS/deb-pkg_trusty_phantomjs
src/ghostdriver/third_party/console++.js
JavaScript
bsd-3-clause
8,754
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) International Business Machines Corp., 2000-2004 */ /* * Module: jfs_mount.c * * note: file system in transition to aggregate/fileset: * * file system mount is interpreted as the mount of aggregate, * if not already mounted, and mount of the single/only fileset in * the aggregate; * * a file system/aggregate is represented by an internal inode * (aka mount inode) initialized with aggregate superblock; * each vfs represents a fileset, and points to its "fileset inode * allocation map inode" (aka fileset inode): * (an aggregate itself is structured recursively as a filset: * an internal vfs is constructed and points to its "fileset inode * allocation map inode" (aka aggregate inode) where each inode * represents a fileset inode) so that inode number is mapped to * on-disk inode in uniform way at both aggregate and fileset level; * * each vnode/inode of a fileset is linked to its vfs (to facilitate * per fileset inode operations, e.g., unmount of a fileset, etc.); * each inode points to the mount inode (to facilitate access to * per aggregate information, e.g., block size, etc.) as well as * its file set inode. * * aggregate * ipmnt * mntvfs -> fileset ipimap+ -> aggregate ipbmap -> aggregate ipaimap; * fileset vfs -> vp(1) <-> ... <-> vp(n) <->vproot; */ #include <linux/fs.h> #include <linux/buffer_head.h> #include <linux/blkdev.h> #include <linux/log2.h> #include "jfs_incore.h" #include "jfs_filsys.h" #include "jfs_superblock.h" #include "jfs_dmap.h" #include "jfs_imap.h" #include "jfs_metapage.h" #include "jfs_debug.h" /* * forward references */ static int chkSuper(struct super_block *); static int logMOUNT(struct super_block *sb); /* * NAME: jfs_mount(sb) * * FUNCTION: vfs_mount() * * PARAMETER: sb - super block * * RETURN: -EBUSY - device already mounted or open for write * -EBUSY - cvrdvp already mounted; * -EBUSY - mount table full * -ENOTDIR- cvrdvp not directory on a device mount * -ENXIO - device open failure */ int jfs_mount(struct super_block *sb) { int rc = 0; /* Return code */ struct jfs_sb_info *sbi = JFS_SBI(sb); struct inode *ipaimap = NULL; struct inode *ipaimap2 = NULL; struct inode *ipimap = NULL; struct inode *ipbmap = NULL; /* * read/validate superblock * (initialize mount inode from the superblock) */ if ((rc = chkSuper(sb))) { goto out; } ipaimap = diReadSpecial(sb, AGGREGATE_I, 0); if (ipaimap == NULL) { jfs_err("jfs_mount: Failed to read AGGREGATE_I"); rc = -EIO; goto out; } sbi->ipaimap = ipaimap; jfs_info("jfs_mount: ipaimap:0x%p", ipaimap); /* * initialize aggregate inode allocation map */ if ((rc = diMount(ipaimap))) { jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc); goto err_ipaimap; } /* * open aggregate block allocation map */ ipbmap = diReadSpecial(sb, BMAP_I, 0); if (ipbmap == NULL) { rc = -EIO; goto err_umount_ipaimap; } jfs_info("jfs_mount: ipbmap:0x%p", ipbmap); sbi->ipbmap = ipbmap; /* * initialize aggregate block allocation map */ if ((rc = dbMount(ipbmap))) { jfs_err("jfs_mount: dbMount failed w/rc = %d", rc); goto err_ipbmap; } /* * open the secondary aggregate inode allocation map * * This is a duplicate of the aggregate inode allocation map. * * hand craft a vfs in the same fashion as we did to read ipaimap. * By adding INOSPEREXT (32) to the inode number, we are telling * diReadSpecial that we are reading from the secondary aggregate * inode table. This also creates a unique entry in the inode hash * table. */ if ((sbi->mntflag & JFS_BAD_SAIT) == 0) { ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1); if (!ipaimap2) { jfs_err("jfs_mount: Failed to read AGGREGATE_I"); rc = -EIO; goto err_umount_ipbmap; } sbi->ipaimap2 = ipaimap2; jfs_info("jfs_mount: ipaimap2:0x%p", ipaimap2); /* * initialize secondary aggregate inode allocation map */ if ((rc = diMount(ipaimap2))) { jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d", rc); goto err_ipaimap2; } } else /* Secondary aggregate inode table is not valid */ sbi->ipaimap2 = NULL; /* * mount (the only/single) fileset */ /* * open fileset inode allocation map (aka fileset inode) */ ipimap = diReadSpecial(sb, FILESYSTEM_I, 0); if (ipimap == NULL) { jfs_err("jfs_mount: Failed to read FILESYSTEM_I"); /* open fileset secondary inode allocation map */ rc = -EIO; goto err_umount_ipaimap2; } jfs_info("jfs_mount: ipimap:0x%p", ipimap); /* map further access of per fileset inodes by the fileset inode */ sbi->ipimap = ipimap; /* initialize fileset inode allocation map */ if ((rc = diMount(ipimap))) { jfs_err("jfs_mount: diMount failed w/rc = %d", rc); goto err_ipimap; } return rc; /* * unwind on error */ err_ipimap: /* close fileset inode allocation map inode */ diFreeSpecial(ipimap); err_umount_ipaimap2: /* close secondary aggregate inode allocation map */ if (ipaimap2) diUnmount(ipaimap2, 1); err_ipaimap2: /* close aggregate inodes */ if (ipaimap2) diFreeSpecial(ipaimap2); err_umount_ipbmap: /* close aggregate block allocation map */ dbUnmount(ipbmap, 1); err_ipbmap: /* close aggregate inodes */ diFreeSpecial(ipbmap); err_umount_ipaimap: /* close aggregate inode allocation map */ diUnmount(ipaimap, 1); err_ipaimap: /* close aggregate inodes */ diFreeSpecial(ipaimap); out: if (rc) jfs_err("Mount JFS Failure: %d", rc); return rc; } /* * NAME: jfs_mount_rw(sb, remount) * * FUNCTION: Completes read-write mount, or remounts read-only volume * as read-write */ int jfs_mount_rw(struct super_block *sb, int remount) { struct jfs_sb_info *sbi = JFS_SBI(sb); int rc; /* * If we are re-mounting a previously read-only volume, we want to * re-read the inode and block maps, since fsck.jfs may have updated * them. */ if (remount) { if (chkSuper(sb) || (sbi->state != FM_CLEAN)) return -EINVAL; truncate_inode_pages(sbi->ipimap->i_mapping, 0); truncate_inode_pages(sbi->ipbmap->i_mapping, 0); diUnmount(sbi->ipimap, 1); if ((rc = diMount(sbi->ipimap))) { jfs_err("jfs_mount_rw: diMount failed!"); return rc; } dbUnmount(sbi->ipbmap, 1); if ((rc = dbMount(sbi->ipbmap))) { jfs_err("jfs_mount_rw: dbMount failed!"); return rc; } } /* * open/initialize log */ if ((rc = lmLogOpen(sb))) return rc; /* * update file system superblock; */ if ((rc = updateSuper(sb, FM_MOUNT))) { jfs_err("jfs_mount: updateSuper failed w/rc = %d", rc); lmLogClose(sb); return rc; } /* * write MOUNT log record of the file system */ logMOUNT(sb); return rc; } /* * chkSuper() * * validate the superblock of the file system to be mounted and * get the file system parameters. * * returns * 0 with fragsize set if check successful * error code if not successful */ static int chkSuper(struct super_block *sb) { int rc = 0; struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_superblock *j_sb; struct buffer_head *bh; int AIM_bytesize, AIT_bytesize; int expected_AIM_bytesize, expected_AIT_bytesize; s64 AIM_byte_addr, AIT_byte_addr, fsckwsp_addr; s64 byte_addr_diff0, byte_addr_diff1; s32 bsize; if ((rc = readSuper(sb, &bh))) return rc; j_sb = (struct jfs_superblock *)bh->b_data; /* * validate superblock */ /* validate fs signature */ if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) || le32_to_cpu(j_sb->s_version) > JFS_VERSION) { rc = -EINVAL; goto out; } bsize = le32_to_cpu(j_sb->s_bsize); #ifdef _JFS_4K if (bsize != PSIZE) { jfs_err("Currently only 4K block size supported!"); rc = -EINVAL; goto out; } #endif /* _JFS_4K */ jfs_info("superblock: flag:0x%08x state:0x%08x size:0x%Lx", le32_to_cpu(j_sb->s_flag), le32_to_cpu(j_sb->s_state), (unsigned long long) le64_to_cpu(j_sb->s_size)); /* validate the descriptors for Secondary AIM and AIT */ if ((j_sb->s_flag & cpu_to_le32(JFS_BAD_SAIT)) != cpu_to_le32(JFS_BAD_SAIT)) { expected_AIM_bytesize = 2 * PSIZE; AIM_bytesize = lengthPXD(&(j_sb->s_aim2)) * bsize; expected_AIT_bytesize = 4 * PSIZE; AIT_bytesize = lengthPXD(&(j_sb->s_ait2)) * bsize; AIM_byte_addr = addressPXD(&(j_sb->s_aim2)) * bsize; AIT_byte_addr = addressPXD(&(j_sb->s_ait2)) * bsize; byte_addr_diff0 = AIT_byte_addr - AIM_byte_addr; fsckwsp_addr = addressPXD(&(j_sb->s_fsckpxd)) * bsize; byte_addr_diff1 = fsckwsp_addr - AIT_byte_addr; if ((AIM_bytesize != expected_AIM_bytesize) || (AIT_bytesize != expected_AIT_bytesize) || (byte_addr_diff0 != AIM_bytesize) || (byte_addr_diff1 <= AIT_bytesize)) j_sb->s_flag |= cpu_to_le32(JFS_BAD_SAIT); } if ((j_sb->s_flag & cpu_to_le32(JFS_GROUPCOMMIT)) != cpu_to_le32(JFS_GROUPCOMMIT)) j_sb->s_flag |= cpu_to_le32(JFS_GROUPCOMMIT); /* validate fs state */ if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && !sb_rdonly(sb)) { jfs_err("jfs_mount: Mount Failure: File System Dirty."); rc = -EINVAL; goto out; } sbi->state = le32_to_cpu(j_sb->s_state); sbi->mntflag = le32_to_cpu(j_sb->s_flag); /* * JFS always does I/O by 4K pages. Don't tell the buffer cache * that we use anything else (leave s_blocksize alone). */ sbi->bsize = bsize; sbi->l2bsize = le16_to_cpu(j_sb->s_l2bsize); /* check some fields for possible corruption */ if (sbi->l2bsize != ilog2((u32)bsize) || j_sb->pad != 0 || le32_to_cpu(j_sb->s_state) > FM_STATE_MAX) { rc = -EINVAL; jfs_err("jfs_mount: Mount Failure: superblock is corrupt!"); goto out; } /* * For now, ignore s_pbsize, l2bfactor. All I/O going through buffer * cache. */ sbi->nbperpage = PSIZE >> sbi->l2bsize; sbi->l2nbperpage = L2PSIZE - sbi->l2bsize; sbi->l2niperblk = sbi->l2bsize - L2DISIZE; if (sbi->mntflag & JFS_INLINELOG) sbi->logpxd = j_sb->s_logpxd; else { sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev)); uuid_copy(&sbi->uuid, &j_sb->s_uuid); uuid_copy(&sbi->loguuid, &j_sb->s_loguuid); } sbi->fsckpxd = j_sb->s_fsckpxd; sbi->ait2 = j_sb->s_ait2; out: brelse(bh); return rc; } /* * updateSuper() * * update synchronously superblock if it is mounted read-write. */ int updateSuper(struct super_block *sb, uint state) { struct jfs_superblock *j_sb; struct jfs_sb_info *sbi = JFS_SBI(sb); struct buffer_head *bh; int rc; if (sbi->flag & JFS_NOINTEGRITY) { if (state == FM_DIRTY) { sbi->p_state = state; return 0; } else if (state == FM_MOUNT) { sbi->p_state = sbi->state; state = FM_DIRTY; } else if (state == FM_CLEAN) { state = sbi->p_state; } else jfs_err("updateSuper: bad state"); } else if (sbi->state == FM_DIRTY) return 0; if ((rc = readSuper(sb, &bh))) return rc; j_sb = (struct jfs_superblock *)bh->b_data; j_sb->s_state = cpu_to_le32(state); sbi->state = state; if (state == FM_MOUNT) { /* record log's dev_t and mount serial number */ j_sb->s_logdev = cpu_to_le32(new_encode_dev(sbi->log->bdev->bd_dev)); j_sb->s_logserial = cpu_to_le32(sbi->log->serial); } else if (state == FM_CLEAN) { /* * If this volume is shared with OS/2, OS/2 will need to * recalculate DASD usage, since we don't deal with it. */ if (j_sb->s_flag & cpu_to_le32(JFS_DASD_ENABLED)) j_sb->s_flag |= cpu_to_le32(JFS_DASD_PRIME); } mark_buffer_dirty(bh); sync_dirty_buffer(bh); brelse(bh); return 0; } /* * readSuper() * * read superblock by raw sector address */ int readSuper(struct super_block *sb, struct buffer_head **bpp) { /* read in primary superblock */ *bpp = sb_bread(sb, SUPER1_OFF >> sb->s_blocksize_bits); if (*bpp) return 0; /* read in secondary/replicated superblock */ *bpp = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits); if (*bpp) return 0; return -EIO; } /* * logMOUNT() * * function: write a MOUNT log record for file system. * * MOUNT record keeps logredo() from processing log records * for this file system past this point in log. * it is harmless if mount fails. * * note: MOUNT record is at aggregate level, not at fileset level, * since log records of previous mounts of a fileset * (e.g., AFTER record of extent allocation) have to be processed * to update block allocation map at aggregate level. */ static int logMOUNT(struct super_block *sb) { struct jfs_log *log = JFS_SBI(sb)->log; struct lrd lrd; lrd.logtid = 0; lrd.backchain = 0; lrd.type = cpu_to_le16(LOG_MOUNT); lrd.length = 0; lrd.aggregate = cpu_to_le32(new_encode_dev(sb->s_bdev->bd_dev)); lmLog(log, NULL, &lrd, NULL); return 0; }
rperier/linux
fs/jfs/jfs_mount.c
C
gpl-2.0
12,627
<?php namespace Guzzle\Tests\Service\Command\LocationVisitor\Response; use Guzzle\Service\Description\Parameter; use Guzzle\Http\Message\Response; use Guzzle\Service\Command\LocationVisitor\Response\BodyVisitor as Visitor; /** * @covers Guzzle\Service\Command\LocationVisitor\Response\BodyVisitor */ class BodyVisitorTest extends AbstractResponseVisitorTest { public function testVisitsLocation() { $visitor = new Visitor(); $param = new Parameter(array('location' => 'body', 'name' => 'foo')); $visitor->visit($this->command, $this->response, $param, $this->value); $this->assertEquals('Foo', (string) $this->value['foo']); } }
jiteshtandel/04CP018_no_son
wp-content/themes/getknowtion/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/BodyVisitorTest.php
PHP
gpl-2.0
678
// // ExtraTrackDetailsPage.cs // // Author: // Aaron Bockover <abockover@novell.com> // // Copyright (C) 2008 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Unix; using Gtk; using Banshee.Collection; namespace Banshee.Gui.TrackEditor { public class ExtraTrackDetailsPage : FieldPage, ITrackEditorPage { public int Order { get { return 20; } } public string Title { get { return Catalog.GetString ("Extra"); } } protected override void AddFields () { AddField (this, new TextEntry ("CoreTracks", "Composer"), Catalog.GetString ("Set all composers to this value"), delegate { return Catalog.GetString ("C_omposer:"); }, delegate (EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.Composer; }, delegate (EditorTrackInfo track, Widget widget) { track.Composer = ((TextEntry)widget).Text; } ); AddField (this, new TextEntry ("CoreTracks", "Conductor"), Catalog.GetString ("Set all conductors to this value"), delegate { return Catalog.GetString ("Con_ductor:"); }, delegate (EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.Conductor; }, delegate (EditorTrackInfo track, Widget widget) { track.Conductor = ((TextEntry)widget).Text; } ); HBox box = new HBox (); box.Spacing = 12; box.Show (); PackStart (box, false, false, 0); AddField (box, new TextEntry ("CoreTracks", "Grouping"), Catalog.GetString ("Set all groupings to this value"), delegate { return Catalog.GetString ("_Grouping:"); }, delegate (EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.Grouping; }, delegate (EditorTrackInfo track, Widget widget) { track.Grouping = ((TextEntry)widget).Text; } ); SpinButtonEntry bpm_entry = new SpinButtonEntry (0, 999, 1); bpm_entry.Digits = 0; bpm_entry.MaxLength = 3; bpm_entry.Numeric = true; AddField (box, bpm_entry, Catalog.GetString ("Set all beats per minute to this value"), delegate { return Catalog.GetString ("Bea_ts Per Minute:"); }, delegate (EditorTrackInfo track, Widget widget) { ((SpinButtonEntry)widget).Value = track.Bpm; }, delegate (EditorTrackInfo track, Widget widget) { track.Bpm = ((SpinButtonEntry)widget).ValueAsInt; }, FieldOptions.Shrink | FieldOptions.NoSync ); HBox copyright_box = new HBox (); copyright_box.Spacing = 12; copyright_box.Show (); PackStart (copyright_box, true, true, 0); AddField (copyright_box, new TextEntry ("CoreTracks", "Copyright"), Catalog.GetString ("Set all copyrights to this value"), delegate { return Catalog.GetString ("Copyrig_ht:"); }, delegate (EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.Copyright; }, delegate (EditorTrackInfo track, Widget widget) { track.Copyright = ((TextEntry)widget).Text; } ); AddField (copyright_box, new LicenseEntry (), Catalog.GetString ("Set all licenses to this value"), delegate { return Catalog.GetString ("_License URI:"); }, delegate (EditorTrackInfo track, Widget widget) { ((LicenseEntry)widget).Value = track.LicenseUri; }, delegate (EditorTrackInfo track, Widget widget) { track.LicenseUri = ((LicenseEntry)widget).Value; } ); TextViewEntry comment_entry = new TextViewEntry (); comment_entry.HscrollbarPolicy = PolicyType.Automatic; comment_entry.TextView.WrapMode = WrapMode.WordChar; AddField (this, comment_entry, Catalog.GetString ("Set all comments to this value"), delegate { return Catalog.GetString ("Co_mment:"); }, delegate (EditorTrackInfo track, Widget widget) { ((TextViewEntry)widget).Text = track.Comment; }, delegate (EditorTrackInfo track, Widget widget) { track.Comment = ((TextViewEntry)widget).Text; } ); } } }
mono-soc-2011/banshee
src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ExtraTrackDetailsPage.cs
C#
mit
5,525
/** * This class should not be used directly by an application developer. Instead, use * {@link Location}. * * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different * platforms * that angular supports. For example, the default `PlatformLocation` is {@link * BrowserPlatformLocation}, * however when you run your app in a WebWorker you use {@link WebWorkerPlatformLocation}. * * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy} * when * they need to interact with the DOM apis like pushState, popState, etc... * * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly * by * the {@link Router} in order to navigate between routes. Since all interactions between {@link * Router} / * {@link Location} / {@link LocationStrategy} and DOM apis flow through the `PlatformLocation` * class * they are all platform independent. */ export class PlatformLocation { /* abstract */ get pathname() { return null; } /* abstract */ get search() { return null; } /* abstract */ get hash() { return null; } }
bluejaye/test
node_modules/angular2/es6/prod/src/router/location/platform_location.js
JavaScript
mit
1,264
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Security\Http\Firewall\SwitchUserListener; class SwitchUserTest extends AbstractWebTestCase { /** * @dataProvider getTestParameters */ public function testSwitchUser($originalUser, $authenticatorManagerEnabled, $targetUser, $expectedUser, $expectedStatus) { $client = $this->createAuthenticatedClient($originalUser, ['enable_authenticator_manager' => $authenticatorManagerEnabled]); $client->request('GET', '/profile?_switch_user='.$targetUser); $this->assertEquals($expectedStatus, $client->getResponse()->getStatusCode()); $this->assertEquals($expectedUser, $client->getProfile()->getCollector('security')->getUser()); } /** * @dataProvider provideSecuritySystems */ public function testSwitchedUserCanSwitchToOther(array $options) { $client = $this->createAuthenticatedClient('user_can_switch', $options); $client->request('GET', '/profile?_switch_user=user_cannot_switch_1'); $client->request('GET', '/profile?_switch_user=user_cannot_switch_2'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals('user_cannot_switch_2', $client->getProfile()->getCollector('security')->getUser()); } /** * @dataProvider provideSecuritySystems */ public function testSwitchedUserExit(array $options) { $client = $this->createAuthenticatedClient('user_can_switch', $options); $client->request('GET', '/profile?_switch_user=user_cannot_switch_1'); $client->request('GET', '/profile?_switch_user='.SwitchUserListener::EXIT_VALUE); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals('user_can_switch', $client->getProfile()->getCollector('security')->getUser()); } /** * @dataProvider provideSecuritySystems */ public function testSwitchUserStateless(array $options) { $client = $this->createClient(['test_case' => 'JsonLogin', 'root_config' => 'switchuser_stateless.yml'] + $options); $client->request('POST', '/chk', [], [], ['HTTP_X_SWITCH_USER' => 'dunglas', 'CONTENT_TYPE' => 'application/json'], '{"user": {"login": "user_can_switch", "password": "test"}}'); $response = $client->getResponse(); $this->assertInstanceOf(JsonResponse::class, $response); $this->assertSame(200, $response->getStatusCode()); $this->assertSame(['message' => 'Welcome @dunglas!'], json_decode($response->getContent(), true)); $this->assertSame('dunglas', $client->getProfile()->getCollector('security')->getUser()); } public function getTestParameters() { return [ 'unauthorized_user_cannot_switch' => ['user_cannot_switch_1', true, 'user_cannot_switch_1', 'user_cannot_switch_1', 403], 'legacy_unauthorized_user_cannot_switch' => ['user_cannot_switch_1', false, 'user_cannot_switch_1', 'user_cannot_switch_1', 403], 'authorized_user_can_switch' => ['user_can_switch', true, 'user_cannot_switch_1', 'user_cannot_switch_1', 200], 'legacy_authorized_user_can_switch' => ['user_can_switch', false, 'user_cannot_switch_1', 'user_cannot_switch_1', 200], 'authorized_user_cannot_switch_to_non_existent' => ['user_can_switch', true, 'user_does_not_exist', 'user_can_switch', 403], 'legacy_authorized_user_cannot_switch_to_non_existent' => ['user_can_switch', false, 'user_does_not_exist', 'user_can_switch', 403], 'authorized_user_can_switch_to_himself' => ['user_can_switch', true, 'user_can_switch', 'user_can_switch', 200], 'legacy_authorized_user_can_switch_to_himself' => ['user_can_switch', false, 'user_can_switch', 'user_can_switch', 200], ]; } protected function createAuthenticatedClient($username, array $options = []) { $client = $this->createClient(['test_case' => 'StandardFormLogin', 'root_config' => 'switchuser.yml'] + $options); $client->followRedirects(true); $form = $client->request('GET', '/login')->selectButton('login')->form(); $form['_username'] = $username; $form['_password'] = 'test'; $client->submit($form); return $client; } }
gonzalovilaseca/symfony
src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
PHP
mit
4,639
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // </auto-generated> namespace Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models { using System.Linq; /// <summary> /// Replication provider specific settings. /// </summary> public partial class ReplicationProviderSpecificSettings { /// <summary> /// Initializes a new instance of the /// ReplicationProviderSpecificSettings class. /// </summary> public ReplicationProviderSpecificSettings() { CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); } }
shahabhijeet/azure-sdk-for-net
src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/ReplicationProviderSpecificSettings.cs
C#
mit
1,032
// Copyright (c) 2018-2021 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <map> #include <dbwrapper.h> #include <index/blockfilterindex.h> #include <node/blockstorage.h> #include <util/system.h> using node::UndoReadFromDisk; /* The index database stores three items for each block: the disk location of the encoded filter, * its dSHA256 hash, and the header. Those belonging to blocks on the active chain are indexed by * height, and those belonging to blocks that have been reorganized out of the active chain are * indexed by block hash. This ensures that filter data for any block that becomes part of the * active chain can always be retrieved, alleviating timing concerns. * * The filters themselves are stored in flat files and referenced by the LevelDB entries. This * minimizes the amount of data written to LevelDB and keeps the database values constant size. The * disk location of the next block filter to be written (represented as a FlatFilePos) is stored * under the DB_FILTER_POS key. * * Keys for the height index have the type [DB_BLOCK_HEIGHT, uint32 (BE)]. The height is represented * as big-endian so that sequential reads of filters by height are fast. * Keys for the hash index have the type [DB_BLOCK_HASH, uint256]. */ constexpr uint8_t DB_BLOCK_HASH{'s'}; constexpr uint8_t DB_BLOCK_HEIGHT{'t'}; constexpr uint8_t DB_FILTER_POS{'P'}; constexpr unsigned int MAX_FLTR_FILE_SIZE = 0x1000000; // 16 MiB /** The pre-allocation chunk size for fltr?????.dat files */ constexpr unsigned int FLTR_FILE_CHUNK_SIZE = 0x100000; // 1 MiB /** Maximum size of the cfheaders cache * We have a limit to prevent a bug in filling this cache * potentially turning into an OOM. At 2000 entries, this cache * is big enough for a 2,000,000 length block chain, which * we should be enough until ~2047. */ constexpr size_t CF_HEADERS_CACHE_MAX_SZ{2000}; namespace { struct DBVal { uint256 hash; uint256 header; FlatFilePos pos; SERIALIZE_METHODS(DBVal, obj) { READWRITE(obj.hash, obj.header, obj.pos); } }; struct DBHeightKey { int height; explicit DBHeightKey(int height_in) : height(height_in) {} template<typename Stream> void Serialize(Stream& s) const { ser_writedata8(s, DB_BLOCK_HEIGHT); ser_writedata32be(s, height); } template<typename Stream> void Unserialize(Stream& s) { const uint8_t prefix{ser_readdata8(s)}; if (prefix != DB_BLOCK_HEIGHT) { throw std::ios_base::failure("Invalid format for block filter index DB height key"); } height = ser_readdata32be(s); } }; struct DBHashKey { uint256 hash; explicit DBHashKey(const uint256& hash_in) : hash(hash_in) {} SERIALIZE_METHODS(DBHashKey, obj) { uint8_t prefix{DB_BLOCK_HASH}; READWRITE(prefix); if (prefix != DB_BLOCK_HASH) { throw std::ios_base::failure("Invalid format for block filter index DB hash key"); } READWRITE(obj.hash); } }; }; // namespace static std::map<BlockFilterType, BlockFilterIndex> g_filter_indexes; BlockFilterIndex::BlockFilterIndex(BlockFilterType filter_type, size_t n_cache_size, bool f_memory, bool f_wipe) : m_filter_type(filter_type) { const std::string& filter_name = BlockFilterTypeName(filter_type); if (filter_name.empty()) throw std::invalid_argument("unknown filter_type"); fs::path path = gArgs.GetDataDirNet() / "indexes" / "blockfilter" / filter_name; fs::create_directories(path); m_name = filter_name + " block filter index"; m_db = std::make_unique<BaseIndex::DB>(path / "db", n_cache_size, f_memory, f_wipe); m_filter_fileseq = std::make_unique<FlatFileSeq>(std::move(path), "fltr", FLTR_FILE_CHUNK_SIZE); } bool BlockFilterIndex::Init() { if (!m_db->Read(DB_FILTER_POS, m_next_filter_pos)) { // Check that the cause of the read failure is that the key does not exist. Any other errors // indicate database corruption or a disk failure, and starting the index would cause // further corruption. if (m_db->Exists(DB_FILTER_POS)) { return error("%s: Cannot read current %s state; index may be corrupted", __func__, GetName()); } // If the DB_FILTER_POS is not set, then initialize to the first location. m_next_filter_pos.nFile = 0; m_next_filter_pos.nPos = 0; } return BaseIndex::Init(); } bool BlockFilterIndex::CommitInternal(CDBBatch& batch) { const FlatFilePos& pos = m_next_filter_pos; // Flush current filter file to disk. CAutoFile file(m_filter_fileseq->Open(pos), SER_DISK, CLIENT_VERSION); if (file.IsNull()) { return error("%s: Failed to open filter file %d", __func__, pos.nFile); } if (!FileCommit(file.Get())) { return error("%s: Failed to commit filter file %d", __func__, pos.nFile); } batch.Write(DB_FILTER_POS, pos); return BaseIndex::CommitInternal(batch); } bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, BlockFilter& filter) const { CAutoFile filein(m_filter_fileseq->Open(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) { return false; } uint256 block_hash; std::vector<uint8_t> encoded_filter; try { filein >> block_hash >> encoded_filter; filter = BlockFilter(GetFilterType(), block_hash, std::move(encoded_filter)); } catch (const std::exception& e) { return error("%s: Failed to deserialize block filter from disk: %s", __func__, e.what()); } return true; } size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter& filter) { assert(filter.GetFilterType() == GetFilterType()); size_t data_size = GetSerializeSize(filter.GetBlockHash(), CLIENT_VERSION) + GetSerializeSize(filter.GetEncodedFilter(), CLIENT_VERSION); // If writing the filter would overflow the file, flush and move to the next one. if (pos.nPos + data_size > MAX_FLTR_FILE_SIZE) { CAutoFile last_file(m_filter_fileseq->Open(pos), SER_DISK, CLIENT_VERSION); if (last_file.IsNull()) { LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile); return 0; } if (!TruncateFile(last_file.Get(), pos.nPos)) { LogPrintf("%s: Failed to truncate filter file %d\n", __func__, pos.nFile); return 0; } if (!FileCommit(last_file.Get())) { LogPrintf("%s: Failed to commit filter file %d\n", __func__, pos.nFile); return 0; } pos.nFile++; pos.nPos = 0; } // Pre-allocate sufficient space for filter data. bool out_of_space; m_filter_fileseq->Allocate(pos, data_size, out_of_space); if (out_of_space) { LogPrintf("%s: out of disk space\n", __func__); return 0; } CAutoFile fileout(m_filter_fileseq->Open(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) { LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile); return 0; } fileout << filter.GetBlockHash() << filter.GetEncodedFilter(); return data_size; } bool BlockFilterIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex) { CBlockUndo block_undo; uint256 prev_header; if (pindex->nHeight > 0) { if (!UndoReadFromDisk(block_undo, pindex)) { return false; } std::pair<uint256, DBVal> read_out; if (!m_db->Read(DBHeightKey(pindex->nHeight - 1), read_out)) { return false; } uint256 expected_block_hash = pindex->pprev->GetBlockHash(); if (read_out.first != expected_block_hash) { return error("%s: previous block header belongs to unexpected block %s; expected %s", __func__, read_out.first.ToString(), expected_block_hash.ToString()); } prev_header = read_out.second.header; } BlockFilter filter(m_filter_type, block, block_undo); size_t bytes_written = WriteFilterToDisk(m_next_filter_pos, filter); if (bytes_written == 0) return false; std::pair<uint256, DBVal> value; value.first = pindex->GetBlockHash(); value.second.hash = filter.GetHash(); value.second.header = filter.ComputeHeader(prev_header); value.second.pos = m_next_filter_pos; if (!m_db->Write(DBHeightKey(pindex->nHeight), value)) { return false; } m_next_filter_pos.nPos += bytes_written; return true; } static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, const std::string& index_name, int start_height, int stop_height) { DBHeightKey key(start_height); db_it.Seek(key); for (int height = start_height; height <= stop_height; ++height) { if (!db_it.GetKey(key) || key.height != height) { return error("%s: unexpected key in %s: expected (%c, %d)", __func__, index_name, DB_BLOCK_HEIGHT, height); } std::pair<uint256, DBVal> value; if (!db_it.GetValue(value)) { return error("%s: unable to read value in %s at key (%c, %d)", __func__, index_name, DB_BLOCK_HEIGHT, height); } batch.Write(DBHashKey(value.first), std::move(value.second)); db_it.Next(); } return true; } bool BlockFilterIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_tip) { assert(current_tip->GetAncestor(new_tip->nHeight) == new_tip); CDBBatch batch(*m_db); std::unique_ptr<CDBIterator> db_it(m_db->NewIterator()); // During a reorg, we need to copy all filters for blocks that are getting disconnected from the // height index to the hash index so we can still find them when the height index entries are // overwritten. if (!CopyHeightIndexToHashIndex(*db_it, batch, m_name, new_tip->nHeight, current_tip->nHeight)) { return false; } // The latest filter position gets written in Commit by the call to the BaseIndex::Rewind. // But since this creates new references to the filter, the position should get updated here // atomically as well in case Commit fails. batch.Write(DB_FILTER_POS, m_next_filter_pos); if (!m_db->WriteBatch(batch)) return false; return BaseIndex::Rewind(current_tip, new_tip); } static bool LookupOne(const CDBWrapper& db, const CBlockIndex* block_index, DBVal& result) { // First check if the result is stored under the height index and the value there matches the // block hash. This should be the case if the block is on the active chain. std::pair<uint256, DBVal> read_out; if (!db.Read(DBHeightKey(block_index->nHeight), read_out)) { return false; } if (read_out.first == block_index->GetBlockHash()) { result = std::move(read_out.second); return true; } // If value at the height index corresponds to an different block, the result will be stored in // the hash index. return db.Read(DBHashKey(block_index->GetBlockHash()), result); } static bool LookupRange(CDBWrapper& db, const std::string& index_name, int start_height, const CBlockIndex* stop_index, std::vector<DBVal>& results) { if (start_height < 0) { return error("%s: start height (%d) is negative", __func__, start_height); } if (start_height > stop_index->nHeight) { return error("%s: start height (%d) is greater than stop height (%d)", __func__, start_height, stop_index->nHeight); } size_t results_size = static_cast<size_t>(stop_index->nHeight - start_height + 1); std::vector<std::pair<uint256, DBVal>> values(results_size); DBHeightKey key(start_height); std::unique_ptr<CDBIterator> db_it(db.NewIterator()); db_it->Seek(DBHeightKey(start_height)); for (int height = start_height; height <= stop_index->nHeight; ++height) { if (!db_it->Valid() || !db_it->GetKey(key) || key.height != height) { return false; } size_t i = static_cast<size_t>(height - start_height); if (!db_it->GetValue(values[i])) { return error("%s: unable to read value in %s at key (%c, %d)", __func__, index_name, DB_BLOCK_HEIGHT, height); } db_it->Next(); } results.resize(results_size); // Iterate backwards through block indexes collecting results in order to access the block hash // of each entry in case we need to look it up in the hash index. for (const CBlockIndex* block_index = stop_index; block_index && block_index->nHeight >= start_height; block_index = block_index->pprev) { uint256 block_hash = block_index->GetBlockHash(); size_t i = static_cast<size_t>(block_index->nHeight - start_height); if (block_hash == values[i].first) { results[i] = std::move(values[i].second); continue; } if (!db.Read(DBHashKey(block_hash), results[i])) { return error("%s: unable to read value in %s at key (%c, %s)", __func__, index_name, DB_BLOCK_HASH, block_hash.ToString()); } } return true; } bool BlockFilterIndex::LookupFilter(const CBlockIndex* block_index, BlockFilter& filter_out) const { DBVal entry; if (!LookupOne(*m_db, block_index, entry)) { return false; } return ReadFilterFromDisk(entry.pos, filter_out); } bool BlockFilterIndex::LookupFilterHeader(const CBlockIndex* block_index, uint256& header_out) { LOCK(m_cs_headers_cache); bool is_checkpoint{block_index->nHeight % CFCHECKPT_INTERVAL == 0}; if (is_checkpoint) { // Try to find the block in the headers cache if this is a checkpoint height. auto header = m_headers_cache.find(block_index->GetBlockHash()); if (header != m_headers_cache.end()) { header_out = header->second; return true; } } DBVal entry; if (!LookupOne(*m_db, block_index, entry)) { return false; } if (is_checkpoint && m_headers_cache.size() < CF_HEADERS_CACHE_MAX_SZ) { // Add to the headers cache if this is a checkpoint height. m_headers_cache.emplace(block_index->GetBlockHash(), entry.header); } header_out = entry.header; return true; } bool BlockFilterIndex::LookupFilterRange(int start_height, const CBlockIndex* stop_index, std::vector<BlockFilter>& filters_out) const { std::vector<DBVal> entries; if (!LookupRange(*m_db, m_name, start_height, stop_index, entries)) { return false; } filters_out.resize(entries.size()); auto filter_pos_it = filters_out.begin(); for (const auto& entry : entries) { if (!ReadFilterFromDisk(entry.pos, *filter_pos_it)) { return false; } ++filter_pos_it; } return true; } bool BlockFilterIndex::LookupFilterHashRange(int start_height, const CBlockIndex* stop_index, std::vector<uint256>& hashes_out) const { std::vector<DBVal> entries; if (!LookupRange(*m_db, m_name, start_height, stop_index, entries)) { return false; } hashes_out.clear(); hashes_out.reserve(entries.size()); for (const auto& entry : entries) { hashes_out.push_back(entry.hash); } return true; } BlockFilterIndex* GetBlockFilterIndex(BlockFilterType filter_type) { auto it = g_filter_indexes.find(filter_type); return it != g_filter_indexes.end() ? &it->second : nullptr; } void ForEachBlockFilterIndex(std::function<void (BlockFilterIndex&)> fn) { for (auto& entry : g_filter_indexes) fn(entry.second); } bool InitBlockFilterIndex(BlockFilterType filter_type, size_t n_cache_size, bool f_memory, bool f_wipe) { auto result = g_filter_indexes.emplace(std::piecewise_construct, std::forward_as_tuple(filter_type), std::forward_as_tuple(filter_type, n_cache_size, f_memory, f_wipe)); return result.second; } bool DestroyBlockFilterIndex(BlockFilterType filter_type) { return g_filter_indexes.erase(filter_type); } void DestroyAllBlockFilterIndexes() { g_filter_indexes.clear(); }
sstone/bitcoin
src/index/blockfilterindex.cpp
C++
mit
16,767
!function ($) { $(function(){ map = new GMaps({ div: '#gmap_geocoding', lat: 40.0000, lng: -100.0000, zoom: 4 }); map.addMarker({ lat: 40.0000, lng: -100.0000, title: 'Marker', infoWindow: { content: 'Info content here...' } }); $('#geocoding_form').submit(function(e){ e.preventDefault(); GMaps.geocode({ address: $('#address').val().trim(), callback: function(results, status){ if(status=='OK'){ var latlng = results[0].geometry.location; map.setCenter(latlng.lat(), latlng.lng()); map.addMarker({ lat: latlng.lat(), lng: latlng.lng() }); } } }); }); }); }(window.jQuery);
seekmas/makoto.refactor
web/note/js/maps/demo.js
JavaScript
mit
721
<?php return array( /* |-------------------------------------------------------------------------- | Validation Language Lines |-------------------------------------------------------------------------- | | The following language lines contain the default error messages used by | the validator class. Some of these rules have multiple versions such | such as the size rules. Feel free to tweak each of these messages. | */ "accepted" => "The :attribute must be accepted.", "active_url" => "The :attribute is not a valid URL.", "after" => "The :attribute must be a date after :date.", "alpha" => "The :attribute may only contain letters.", "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", "alpha_num" => "The :attribute may only contain letters and numbers.", "before" => "The :attribute must be a date before :date.", "between" => array( "numeric" => "The :attribute must be between :min - :max.", "file" => "The :attribute must be between :min - :max kilobytes.", "string" => "The :attribute must be between :min - :max characters.", ), "confirmed" => "The :attribute confirmation does not match.", "date" => "The :attribute is not a valid date.", "date_format" => "The :attribute does not match the format :format.", "different" => "The :attribute and :other must be different.", "digits" => "The :attribute must be :digits digits.", "digits_between" => "The :attribute must be between :min and :max digits.", "email" => "The :attribute format is invalid.", "exists" => "The selected :attribute is invalid.", "image" => "The :attribute must be an image.", "in" => "The selected :attribute is invalid.", "integer" => "The :attribute must be an integer.", "ip" => "The :attribute must be a valid IP address.", "max" => array( "numeric" => "The :attribute may not be greater than :max.", "file" => "The :attribute may not be greater than :max kilobytes.", "string" => "The :attribute may not be greater than :max characters.", ), "mimes" => "The :attribute must be a file of type: :values.", "min" => array( "numeric" => "The :attribute must be at least :min.", "file" => "The :attribute must be at least :min kilobytes.", "string" => "The :attribute must be at least :min characters.", ), "not_in" => "The selected :attribute is invalid.", "numeric" => "The :attribute must be a number.", "regex" => "The :attribute format is invalid.", "required" => "The :attribute field is required.", "required_if" => "The :attribute field is required when :other is :value.", "required_with" => "The :attribute field is required when :values is present.", "required_without" => "The :attribute field is required when :values is not present.", "same" => "The :attribute and :other must match.", "size" => array( "numeric" => "The :attribute must be :size.", "file" => "The :attribute must be :size kilobytes.", "string" => "The :attribute must be :size characters.", ), "unique" => "The :attribute has already been taken.", "url" => "The :attribute format is invalid.", /* |-------------------------------------------------------------------------- | Custom Validation Language Lines |-------------------------------------------------------------------------- | | Here you may specify custom validation messages for attributes using the | convention "attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'custom' => [ 'tags' => [ 'required' => 'You must choose at least one tag.', 'max_tags' => 'You may not use more than 3 tags.', ], ], /* |-------------------------------------------------------------------------- | Custom Validation Attributes |-------------------------------------------------------------------------- | | The following language lines are used to swap attribute place-holders | with something more reader friendly such as E-Mail Address instead | of "email". This simply helps us make messages a little cleaner. | */ 'attributes' => array(), );
dprevite/laravel.io
resources/lang/en/validation.php
PHP
mit
4,406
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // </auto-generated> namespace Microsoft.Azure.Batch.Protocol.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// <summary> /// Additional parameters for Exists operation. /// </summary> public partial class JobScheduleExistsOptions { /// <summary> /// Initializes a new instance of the JobScheduleExistsOptions class. /// </summary> public JobScheduleExistsOptions() { CustomInit(); } /// <summary> /// Initializes a new instance of the JobScheduleExistsOptions class. /// </summary> /// <param name="timeout">The maximum time that the server can spend /// processing the request, in seconds. The default is 30 /// seconds.</param> /// <param name="clientRequestId">The caller-generated request /// identity, in the form of a GUID with no decoration such as curly /// braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.</param> /// <param name="returnClientRequestId">Whether the server should /// return the client-request-id in the response.</param> /// <param name="ocpDate">The time the request was issued. Client /// libraries typically set this to the current system clock time; set /// it explicitly if you are calling the REST API directly.</param> /// <param name="ifMatch">An ETag value associated with the version of /// the resource known to the client. The operation will be performed /// only if the resource's current ETag on the service exactly matches /// the value specified by the client.</param> /// <param name="ifNoneMatch">An ETag value associated with the version /// of the resource known to the client. The operation will be /// performed only if the resource's current ETag on the service does /// not match the value specified by the client.</param> /// <param name="ifModifiedSince">A timestamp indicating the last /// modified time of the resource known to the client. The operation /// will be performed only if the resource on the service has been /// modified since the specified time.</param> /// <param name="ifUnmodifiedSince">A timestamp indicating the last /// modified time of the resource known to the client. The operation /// will be performed only if the resource on the service has not been /// modified since the specified time.</param> public JobScheduleExistsOptions(int? timeout = default(int?), System.Guid? clientRequestId = default(System.Guid?), bool? returnClientRequestId = default(bool?), System.DateTime? ocpDate = default(System.DateTime?), string ifMatch = default(string), string ifNoneMatch = default(string), System.DateTime? ifModifiedSince = default(System.DateTime?), System.DateTime? ifUnmodifiedSince = default(System.DateTime?)) { Timeout = timeout; ClientRequestId = clientRequestId; ReturnClientRequestId = returnClientRequestId; OcpDate = ocpDate; IfMatch = ifMatch; IfNoneMatch = ifNoneMatch; IfModifiedSince = ifModifiedSince; IfUnmodifiedSince = ifUnmodifiedSince; CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); /// <summary> /// Gets or sets the maximum time that the server can spend processing /// the request, in seconds. The default is 30 seconds. /// </summary> [Newtonsoft.Json.JsonIgnore] public int? Timeout { get; set; } /// <summary> /// Gets or sets the caller-generated request identity, in the form of /// a GUID with no decoration such as curly braces, e.g. /// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. /// </summary> [Newtonsoft.Json.JsonIgnore] public System.Guid? ClientRequestId { get; set; } /// <summary> /// Gets or sets whether the server should return the client-request-id /// in the response. /// </summary> [Newtonsoft.Json.JsonIgnore] public bool? ReturnClientRequestId { get; set; } /// <summary> /// Gets or sets the time the request was issued. Client libraries /// typically set this to the current system clock time; set it /// explicitly if you are calling the REST API directly. /// </summary> [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] [Newtonsoft.Json.JsonIgnore] public System.DateTime? OcpDate { get; set; } /// <summary> /// Gets or sets an ETag value associated with the version of the /// resource known to the client. The operation will be performed only /// if the resource's current ETag on the service exactly matches the /// value specified by the client. /// </summary> [Newtonsoft.Json.JsonIgnore] public string IfMatch { get; set; } /// <summary> /// Gets or sets an ETag value associated with the version of the /// resource known to the client. The operation will be performed only /// if the resource's current ETag on the service does not match the /// value specified by the client. /// </summary> [Newtonsoft.Json.JsonIgnore] public string IfNoneMatch { get; set; } /// <summary> /// Gets or sets a timestamp indicating the last modified time of the /// resource known to the client. The operation will be performed only /// if the resource on the service has been modified since the /// specified time. /// </summary> [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] [Newtonsoft.Json.JsonIgnore] public System.DateTime? IfModifiedSince { get; set; } /// <summary> /// Gets or sets a timestamp indicating the last modified time of the /// resource known to the client. The operation will be performed only /// if the resource on the service has not been modified since the /// specified time. /// </summary> [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] [Newtonsoft.Json.JsonIgnore] public System.DateTime? IfUnmodifiedSince { get; set; } } }
DheerendraRathor/azure-sdk-for-net
src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleExistsOptions.cs
C#
mit
6,898
<?php namespace SMW\Tests\Utils; /** * * @group SMW * @group SMWExtension * * @license GNU GPL v2+ * @since 2.0 */ class StringBuilder { private $string = ''; /** * @since 2.0 */ public function addnewLine() { $this->string = $this->string . "\n"; return $this; } /** * @since 2.0 */ public function addString( $string ) { $this->string = $this->string . $string; return $this; } /** * @since 2.0 */ public function getString() { $string = $this->string; $this->string = ''; return $string; } }
owen-kellie-smith/mediawiki
wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/StringBuilder.php
PHP
mit
548
html { -webkit-box-sizing: border-box; box-sizing: border-box; font-family: sans-serif; line-height: 1.15; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; -ms-overflow-style: scrollbar; -webkit-tap-highlight-color: transparent; } *, *::before, *::after { -webkit-box-sizing: inherit; box-sizing: inherit; } @-ms-viewport { width: device-width; } body { margin: 0; font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 1rem; font-weight: normal; line-height: 1.5; color: #292b2c; background-color: #fff; } [tabindex="-1"]:focus { outline: none !important; } hr { -webkit-box-sizing: content-box; box-sizing: content-box; height: 0; overflow: visible; } h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: .5rem; } p { margin-top: 0; margin-bottom: 1rem; } abbr[title], abbr[data-original-title] { text-decoration: underline; text-decoration: underline dotted; cursor: help; border-bottom: 0; } address { margin-bottom: 1rem; font-style: normal; line-height: inherit; } ol, ul, dl { margin-top: 0; margin-bottom: 1rem; } ol ol, ul ul, ol ul, ul ol { margin-bottom: 0; } dt { font-weight: bold; } dd { margin-bottom: .5rem; margin-left: 0; } blockquote { margin: 0 0 1rem; } dfn { font-style: italic; } b, strong { font-weight: bolder; } small { font-size: 80%; } sub, sup { position: relative; font-size: 75%; line-height: 0; vertical-align: baseline; } sub { bottom: -.25em; } sup { top: -.5em; } a { color: #0275d8; text-decoration: none; background-color: transparent; -webkit-text-decoration-skip: objects; } a:hover { color: #014c8c; text-decoration: underline; } a:not([href]):not([tabindex]) { color: inherit; text-decoration: none; } a:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover { color: inherit; text-decoration: none; } a:not([href]):not([tabindex]):focus { outline: 0; } pre, code, kbd, samp { font-family: monospace, monospace; font-size: 1em; } pre { margin-top: 0; margin-bottom: 1rem; overflow: auto; } figure { margin: 0 0 1rem; } img { vertical-align: middle; border-style: none; } svg:not(:root) { overflow: hidden; } a, area, button, [role="button"], input, label, select, summary, textarea { -ms-touch-action: manipulation; touch-action: manipulation; } table { border-collapse: collapse; } caption { padding-top: 0.75rem; padding-bottom: 0.75rem; color: #636c72; text-align: left; caption-side: bottom; } th { text-align: left; } label { display: inline-block; margin-bottom: .5rem; } button:focus { outline: 1px dotted; outline: 5px auto -webkit-focus-ring-color; } input, button, select, optgroup, textarea { margin: 0; font-family: inherit; font-size: inherit; line-height: inherit; } button, input { overflow: visible; } button, select { text-transform: none; } button, html [type="button"], [type="reset"], [type="submit"] { -webkit-appearance: button; } button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { padding: 0; border-style: none; } input[type="radio"], input[type="checkbox"] { -webkit-box-sizing: border-box; box-sizing: border-box; padding: 0; } input[type="radio"]:disabled, input[type="checkbox"]:disabled { cursor: not-allowed; } input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { -webkit-appearance: listbox; } textarea { overflow: auto; resize: vertical; } fieldset { min-width: 0; padding: 0; margin: 0; border: 0; } legend { display: block; width: 100%; max-width: 100%; padding: 0; margin-bottom: .5rem; font-size: 1.5rem; line-height: inherit; color: inherit; white-space: normal; } progress { vertical-align: baseline; } [type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { height: auto; } [type="search"] { outline-offset: -2px; -webkit-appearance: none; } [type="search"]::-webkit-search-cancel-button, [type="search"]::-webkit-search-decoration { -webkit-appearance: none; } ::-webkit-file-upload-button { font: inherit; -webkit-appearance: button; } output { display: inline-block; } summary { display: list-item; } template { display: none; } [hidden] { display: none !important; } /*# sourceMappingURL=bootstrap-reboot.css.map */
dennismoon/ng-mdbootstrap
src/vendor/bootstrap/css/bootstrap-reboot.css
CSS
mit
4,590