text:
//*****************************************************************************
//
//! \addtogroup peripheral_group
//! @{
//! \addtogroup uart_api
//! @{
//
//*****************************************************************************

#ifndef __UART_H__
#define __UART_H__

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_types.h"
#include "../inc/hw_uart.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "interrupt.h"
#include "debug.h"

//*****************************************************************************
//
// Support for DriverLib in ROM:
// This section renames all functions that are not "static inline", so that
// calling these functions will default to implementation in flash. At the end
// of this file a second renaming will change the defaults to implementation in
// ROM for available functions.
//
// To force use of the implementation in flash, e.g. for debugging:
// - Globally: Define DRIVERLIB_NOROM at project level
// - Per function: Use prefix "NOROM_" when calling the function
//
//*****************************************************************************
#if !defined(DOXYGEN)
    #define UARTFIFOLevelGet                NOROM_UARTFIFOLevelGet
    #define UARTConfigSetExpClk             NOROM_UARTConfigSetExpClk
    #define UARTConfigGetExpClk             NOROM_UARTConfigGetExpClk
    #define UARTDisable                     NOROM_UARTDisable
    #define UARTCharGetNonBlocking          NOROM_UARTCharGetNonBlocking
    #define UARTCharGet                     NOROM_UARTCharGet
    #define UARTCharPutNonBlocking          NOROM_UARTCharPutNonBlocking
    #define UARTCharPut                     NOROM_UARTCharPut
    #define UARTIntRegister                 NOROM_UARTIntRegister
    #define UARTIntUnregister               NOROM_UARTIntUnregister
#endif

//*****************************************************************************
//
// Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear
// as the ui32IntFlags parameter, and returned from UARTIntStatus.
//
//*****************************************************************************
#define UART_INT_OE    ( UART_IMSC_OEIM   ) // Overrun Error Interrupt Mask
#define UART_INT_BE    ( UART_IMSC_BEIM   ) // Break Error Interrupt Mask
#define UART_INT_PE    ( UART_IMSC_PEIM   ) // Parity Error Interrupt Mask
#define UART_INT_FE    ( UART_IMSC_FEIM   ) // Framing Error Interrupt Mask
#define UART_INT_RT    ( UART_IMSC_RTIM   ) // Receive Timeout Interrupt Mask
#define UART_INT_TX    ( UART_IMSC_TXIM   ) // Transmit Interrupt Mask
#define UART_INT_RX    ( UART_IMSC_RXIM   ) // Receive Interrupt Mask
#define UART_INT_CTS   ( UART_IMSC_CTSMIM ) // CTS Modem Interrupt Mask

//*****************************************************************************
//
// Values that can be passed to UARTConfigSetExpClk as the ui32Config parameter
// and returned by UARTConfigGetExpClk in the pui32Config parameter.
// Additionally, the UART_CONFIG_PAR_* subset can be passed to
// UARTParityModeSet as the ui32Parity parameter, and are returned by
// UARTParityModeGet.
//
//*****************************************************************************
#define UART_CONFIG_WLEN_MASK   0x00000060  // Mask for extracting word length
#define UART_CONFIG_WLEN_8      0x00000060  // 8 bit data
#define UART_CONFIG_WLEN_7      0x00000040  // 7 bit data
#define UART_CONFIG_WLEN_6      0x00000020  // 6 bit data
#define UART_CONFIG_WLEN_5      0x00000000  // 5 bit data
#define UART_CONFIG_STOP_MASK   0x00000008  // Mask for extracting stop bits
#define UART_CONFIG_STOP_ONE    0x00000000  // One stop bit
#define UART_CONFIG_STOP_TWO    0x00000008  // Two stop bits
#define UART_CONFIG_PAR_MASK    0x00000086  // Mask for extracting parity
#define UART_CONFIG_PAR_NONE    0x00000000  // No parity
#define UART_CONFIG_PAR_EVEN    0x00000006  // Even parity
#define UART_CONFIG_PAR_ODD     0x00000002  // Odd parity
#define UART_CONFIG_PAR_ONE     0x00000082  // Parity bit is one
#define UART_CONFIG_PAR_ZERO    0x00000086  // Parity bit is zero

//*****************************************************************************
//
// Values that can be passed to UARTFIFOLevelSet as the ui32TxLevel parameter
// and returned by UARTFIFOLevelGet in the pui32TxLevel.
//
//*****************************************************************************
#define UART_FIFO_TX1_8         0x00000000  // Transmit interrupt at 1/8 Full
#define UART_FIFO_TX2_8         0x00000001  // Transmit interrupt at 1/4 Full
#define UART_FIFO_TX4_8         0x00000002  // Transmit interrupt at 1/2 Full
#define UART_FIFO_TX6_8         0x00000003  // Transmit interrupt at 3/4 Full
#define UART_FIFO_TX7_8         0x00000004  // Transmit interrupt at 7/8 Full

//*****************************************************************************
//
// Values that can be passed to UARTFIFOLevelSet as the ui32RxLevel parameter
// and returned by UARTFIFOLevelGet in the pui32RxLevel.
//
//*****************************************************************************
#define UART_FIFO_RX1_8         0x00000000  // Receive interrupt at 1/8 Full
#define UART_FIFO_RX2_8         0x00000008  // Receive interrupt at 1/4 Full
#define UART_FIFO_RX4_8         0x00000010  // Receive interrupt at 1/2 Full
#define UART_FIFO_RX6_8         0x00000018  // Receive interrupt at 3/4 Full
#define UART_FIFO_RX7_8         0x00000020  // Receive interrupt at 7/8 Full

//*****************************************************************************
//
// Values that can be passed to UARTDMAEnable() and UARTDMADisable().
//
//*****************************************************************************
#define UART_DMA_ERR_RXSTOP     0x00000004  // Stop DMA receive if UART error
#define UART_DMA_TX             0x00000002  // Enable DMA for transmit
#define UART_DMA_RX             0x00000001  // Enable DMA for receive

//*****************************************************************************
//
// Values returned from UARTRxErrorGet().
//
//*****************************************************************************
#define UART_RXERROR_OVERRUN    0x00000008
#define UART_RXERROR_BREAK      0x00000004
#define UART_RXERROR_PARITY     0x00000002
#define UART_RXERROR_FRAMING    0x00000001

//*****************************************************************************
//
// Values returned from the UARTBusy().
//
//*****************************************************************************
#define UART_BUSY               0x00000001
#define UART_IDLE               0x00000000

//*****************************************************************************
//
// API Functions and prototypes
//
//*****************************************************************************

#ifdef DRIVERLIB_DEBUG
//*****************************************************************************
//
//! \internal
//!
//! \brief Checks a UART base address.
//!
//! This function determines if a UART port base address is valid.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns \c true if the base address is valid and \c false
//! otherwise.
//
//*****************************************************************************
static bool
UARTBaseValid(uint32_t ui32Base)
{
    return(( ui32Base == UART0_BASE ) || ( ui32Base == UART0_NONBUF_BASE ));
}
#endif

//*****************************************************************************
//
//! \brief Sets the type of parity.
//!
//! This function sets the type of parity to use for transmitting and expect
//! when receiving.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32Parity specifies the type of parity to use. The last two allow
//! direct control of the parity bit; it is always either one or zero based on
//! the mode.
//! - \ref UART_CONFIG_PAR_NONE
//! - \ref UART_CONFIG_PAR_EVEN
//! - \ref UART_CONFIG_PAR_ODD
//! - \ref UART_CONFIG_PAR_ONE
//! - \ref UART_CONFIG_PAR_ZERO
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTParityModeSet(uint32_t ui32Base, uint32_t ui32Parity)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));
    ASSERT((ui32Parity == UART_CONFIG_PAR_NONE) ||
           (ui32Parity == UART_CONFIG_PAR_EVEN) ||
           (ui32Parity == UART_CONFIG_PAR_ODD) ||
           (ui32Parity == UART_CONFIG_PAR_ONE) ||
           (ui32Parity == UART_CONFIG_PAR_ZERO));

    // Set the parity mode.
    HWREG(ui32Base + UART_O_LCRH) = ((HWREG(ui32Base + UART_O_LCRH) &
                                      ~(UART_LCRH_SPS | UART_LCRH_EPS |
                                        UART_LCRH_PEN)) | ui32Parity);
}

//*****************************************************************************
//
//! \brief Gets the type of parity currently being used.
//!
//! This function gets the type of parity used for transmitting data and
//! expected when receiving data.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns the current parity settings, specified as one of:
//! - \ref UART_CONFIG_PAR_NONE
//! - \ref UART_CONFIG_PAR_EVEN
//! - \ref UART_CONFIG_PAR_ODD
//! - \ref UART_CONFIG_PAR_ONE
//! - \ref UART_CONFIG_PAR_ZERO
//
//*****************************************************************************
__STATIC_INLINE uint32_t
UARTParityModeGet(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Return the current parity setting
    return(HWREG(ui32Base + UART_O_LCRH) &
           (UART_LCRH_SPS | UART_LCRH_EPS | UART_LCRH_PEN));
}

//*****************************************************************************
//
//! \brief Sets the FIFO level at which interrupts are generated.
//!
//! This function sets the FIFO level at which transmit and receive interrupts
//! are generated.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32TxLevel is the transmit FIFO interrupt level, specified as one of:
//! - \ref UART_FIFO_TX1_8
//! - \ref UART_FIFO_TX2_8
//! - \ref UART_FIFO_TX4_8
//! - \ref UART_FIFO_TX6_8
//! - \ref UART_FIFO_TX7_8
//! \param ui32RxLevel is the receive FIFO interrupt level, specified as one of:
//! - \ref UART_FIFO_RX1_8
//! - \ref UART_FIFO_RX2_8
//! - \ref UART_FIFO_RX4_8
//! - \ref UART_FIFO_RX6_8
//! - \ref UART_FIFO_RX7_8
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTFIFOLevelSet(uint32_t ui32Base, uint32_t ui32TxLevel,
                 uint32_t ui32RxLevel)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));
    ASSERT((ui32TxLevel == UART_FIFO_TX1_8) ||
           (ui32TxLevel == UART_FIFO_TX2_8) ||
           (ui32TxLevel == UART_FIFO_TX4_8) ||
           (ui32TxLevel == UART_FIFO_TX6_8) ||
           (ui32TxLevel == UART_FIFO_TX7_8));
    ASSERT((ui32RxLevel == UART_FIFO_RX1_8) ||
           (ui32RxLevel == UART_FIFO_RX2_8) ||
           (ui32RxLevel == UART_FIFO_RX4_8) ||
           (ui32RxLevel == UART_FIFO_RX6_8) ||
           (ui32RxLevel == UART_FIFO_RX7_8));

    // Set the FIFO interrupt levels.
    HWREG(ui32Base + UART_O_IFLS) = ui32TxLevel | ui32RxLevel;
}

//*****************************************************************************
//
//! \brief Gets the FIFO level at which interrupts are generated.
//!
//! This function gets the FIFO level at which transmit and receive interrupts
//! are generated.
//!
//! \param ui32Base is the base address of the UART port.
//! \param pui32TxLevel is a pointer to storage for the transmit FIFO level,
//! returned as one of:
//! - \ref UART_FIFO_TX1_8
//! - \ref UART_FIFO_TX2_8
//! - \ref UART_FIFO_TX4_8
//! - \ref UART_FIFO_TX6_8
//! - \ref UART_FIFO_TX7_8
//! \param pui32RxLevel is a pointer to storage for the receive FIFO level,
//! returned as one of:
//! - \ref UART_FIFO_RX1_8
//! - \ref UART_FIFO_RX2_8
//! - \ref UART_FIFO_RX4_8
//! - \ref UART_FIFO_RX6_8
//! - \ref UART_FIFO_RX7_8
//!
//! \return None
//
//*****************************************************************************
extern void UARTFIFOLevelGet(uint32_t ui32Base, uint32_t *pui32TxLevel,
                             uint32_t *pui32RxLevel);

//*****************************************************************************
//
//! \brief Sets the configuration of a UART.
//!
//! This function configures the UART for operation in the specified data
//! format.
//!
//! \note The peripheral clock is not necessarily the same as the processor
//! clock. The frequency of the peripheral clock is set by the system control.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32UARTClk is the rate of the clock supplied to the UART module.
//! \param ui32Baud is the desired baud rate.
//! - Minimum baud rate: ui32Baud >= ceil(ui32UARTClk / 1,048,559.875)
//! - Maximum baud rate: ui32Baud <= floor(ui32UARTClk / 15.875)
//! \param ui32Config is the data format for the port.
//! The parameter is the bitwise OR of three values:
//! - Number of data bits
//!   - \ref UART_CONFIG_WLEN_8 : 8 data bits per byte.
//!   - \ref UART_CONFIG_WLEN_7 : 7 data bits per byte.
//!   - \ref UART_CONFIG_WLEN_6 : 6 data bits per byte.
//!   - \ref UART_CONFIG_WLEN_5 : 5 data bits per byte.
//! - Number of stop bits
//!   - \ref UART_CONFIG_STOP_ONE : One stop bit.
//!   - \ref UART_CONFIG_STOP_TWO : Two stop bits.
//! - Parity
//!   - \ref UART_CONFIG_PAR_NONE
//!   - \ref UART_CONFIG_PAR_EVEN
//!   - \ref UART_CONFIG_PAR_ODD
//!   - \ref UART_CONFIG_PAR_ONE
//!   - \ref UART_CONFIG_PAR_ZERO
//!
//! \return None
//
//*****************************************************************************
extern void UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,
                                uint32_t ui32Baud, uint32_t ui32Config);

//*****************************************************************************
//
//! \brief Gets the current configuration of a UART.
//!
//! The baud rate and data format for the UART is determined, given an
//! explicitly provided peripheral clock (hence the ExpClk suffix). The
//! returned baud rate is the actual baud rate; it may not be the exact baud
//! rate requested or an "official" baud rate. The data format returned in
//! \c pui32Config is enumerated the same as the \c ui32Config parameter of
//! \ref UARTConfigSetExpClk().
//!
//! \note The peripheral clock is not necessarily the same as the processor
//! clock. The frequency of the peripheral clock is set by the system control.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32UARTClk is the rate of the clock supplied to the UART module.
//! \param pui32Baud is a pointer to storage for the baud rate.
//! \param pui32Config is a pointer to storage for the data format.
//!
//! \return None
//
//*****************************************************************************
extern void UARTConfigGetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,
                                uint32_t *pui32Baud, uint32_t *pui32Config);

//*****************************************************************************
//
//! \brief Enables transmitting and receiving.
//!
//! This function sets the UARTEN, TXE, and RXE bits, and enables the transmit
//! and receive FIFOs.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTEnable(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Enable the FIFO.
    HWREG(ui32Base + UART_O_LCRH) |= UART_LCRH_FEN;

    // Enable RX, TX, and the UART.
    HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_UARTEN | UART_CTL_TXE |
                                     UART_CTL_RXE);
}

//*****************************************************************************
//
//! \brief Disables transmitting and receiving.
//!
//! This function clears the UARTEN, TXE, and RXE bits, waits for the end of
//! transmission of the current character, and flushes the transmit FIFO.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
extern void UARTDisable(uint32_t ui32Base);

//*****************************************************************************
//
//! \brief Enables the transmit and receive FIFOs.
//!
//! This functions enables the transmit and receive FIFOs in the UART.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTFIFOEnable(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Enable the FIFO.
    HWREG(ui32Base + UART_O_LCRH) |= UART_LCRH_FEN;
}

//*****************************************************************************
//
//! \brief Disables the transmit and receive FIFOs.
//!
//! This functions disables the transmit and receive FIFOs in the UART.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTFIFODisable(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Disable the FIFO.
    HWREG(ui32Base + UART_O_LCRH) &= ~(UART_LCRH_FEN);
}

//*****************************************************************************
//
//! \brief Determines if there are any characters in the receive FIFO.
//!
//! This function returns a flag indicating whether or not there is data
//! available in the receive FIFO.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns status of the receive FIFO.
//! - \c true  : There is data in the receive FIFO.
//! - \c false : There is no data in the receive FIFO.
//
//*****************************************************************************
__STATIC_INLINE bool
UARTCharsAvail(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Return the availability of characters.
    return((HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE) ? false : true);
}

//*****************************************************************************
//
//! \brief Determines if there is any space in the transmit FIFO.
//!
//! This function returns a flag indicating whether or not there is space
//! available in the transmit FIFO.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns status of the transmit FIFO.
//! - \c true  : There is space available in the transmit FIFO.
//! - \c false : There is no space available in the transmit FIFO.
//
//*****************************************************************************
__STATIC_INLINE bool
UARTSpaceAvail(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Return the availability of space.
    return((HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF) ? false : true);
}

//*****************************************************************************
//
//! \brief Receives a character from the specified port.
//!
//! This function gets a character from the receive FIFO for the specified
//! port.
//!
//! \note The \ref UARTCharsAvail() function should be called before
//! attempting to call this function.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns the character read from the specified port, cast as an
//! \c int32_t. A \c -1 is returned if there are no characters present in the
//! receive FIFO.
//!
//! \sa \ref UARTCharsAvail()
//
//*****************************************************************************
extern int32_t UARTCharGetNonBlocking(uint32_t ui32Base);

//*****************************************************************************
//
//! \brief Waits for a character from the specified port.
//!
//! This function gets a character from the receive FIFO for the specified
//! port. If there are no characters available, this function waits until a
//! character is received before returning.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns the character read from the specified port, cast as an
//! \c int32_t.
//
//*****************************************************************************
extern int32_t UARTCharGet(uint32_t ui32Base);

//*****************************************************************************
//
//! \brief Sends a character to the specified port.
//!
//! This function writes the character \c ui8Data to the transmit FIFO for the
//! specified port. This function does not block, so if there is no space
//! available, then a \c false is returned, and the application must retry the
//! function later.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui8Data is the character to be transmitted.
//!
//! \return Returns status of the character transmit.
//! - \c true  : The character was successfully placed in the transmit FIFO.
//! - \c false : There was no space available in the transmit FIFO. Try again later.
//
//*****************************************************************************
extern bool UARTCharPutNonBlocking(uint32_t ui32Base, uint8_t ui8Data);

//*****************************************************************************
//
//! \brief Waits to send a character from the specified port.
//!
//! This function sends the character \c ui8Data to the transmit FIFO for the
//! specified port. If there is no space available in the transmit FIFO, this
//! function waits until there is space available before returning.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui8Data is the character to be transmitted.
//!
//! \return None
//
//*****************************************************************************
extern void UARTCharPut(uint32_t ui32Base, uint8_t ui8Data);

//*****************************************************************************
//
//! \brief Determines whether the UART transmitter is busy or not.
//!
//! Allows the caller to determine whether all transmitted bytes have cleared
//! the transmitter hardware. If \c false is returned, the transmit FIFO is
//! empty and all bits of the last transmitted character, including all stop
//! bits, have left the hardware shift register.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns status of UART transmitter.
//! - \c true  : UART is transmitting.
//! - \c false : All transmissions are complete.
//
//*****************************************************************************
__STATIC_INLINE bool
UARTBusy(uint32_t ui32Base)
{
    // Check the argument.
    ASSERT(UARTBaseValid(ui32Base));

    // Determine if the UART is busy.
    return((HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY) ?
           UART_BUSY : UART_IDLE);
}

//*****************************************************************************
//
//! \brief Causes a BREAK to be sent.
//!
//! \note For proper transmission of a break
//! command, the break must be asserted for at least two complete frames.
//!
//! \param ui32Base is the base address of the UART port.
//! \param bBreakState controls the output level.
//! - \c true  : Asserts a break condition on the UART.
//! - \c false : Removes the break condition.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTBreakCtl(uint32_t ui32Base, bool bBreakState)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Set the break condition as requested.
    HWREG(ui32Base + UART_O_LCRH) =
         (bBreakState ?
         (HWREG(ui32Base + UART_O_LCRH) | UART_LCRH_BRK) :
         (HWREG(ui32Base + UART_O_LCRH) & ~(UART_LCRH_BRK)));
}

//*****************************************************************************
//
//! \brief Registers an interrupt handler for a UART interrupt.
//!
//! This function does the actual registering of the interrupt handler.  This
//! function enables the global interrupt in the interrupt controller; specific
//! UART interrupts must be enabled via \ref UARTIntEnable(). It is the interrupt
//! handler's responsibility to clear the interrupt source.
//!
//! \param ui32Base is the base address of the UART port.
//! \param pfnHandler is a pointer to the function to be called when the
//! UART interrupt occurs.
//!
//! \return None
//!
//! \sa \ref IntRegister() for important information about registering interrupt
//! handlers.
//
//*****************************************************************************
extern void UARTIntRegister(uint32_t ui32Base, void (*pfnHandler)(void));

//*****************************************************************************
//
//! \brief Unregisters an interrupt handler for a UART interrupt.
//!
//! This function does the actual unregistering of the interrupt handler. It
//! clears the handler to be called when a UART interrupt occurs.  This
//! function also masks off the interrupt in the interrupt controller so that
//! the interrupt handler no longer is called.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//!
//! \sa \ref IntRegister() for important information about registering interrupt
//! handlers.
//
//*****************************************************************************
extern void UARTIntUnregister(uint32_t ui32Base);

//*****************************************************************************
//
//! \brief Enables individual UART interrupt sources.
//!
//! This function enables the indicated UART interrupt sources. Only the
//! sources that are enabled can be reflected to the processor interrupt;
//! disabled sources have no effect on the processor.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32IntFlags is the bit mask of the interrupt sources to be enabled.
//! The parameter is the bitwise OR of any of the following:
//! - \ref UART_INT_OE  : Overrun Error interrupt.
//! - \ref UART_INT_BE  : Break Error interrupt.
//! - \ref UART_INT_PE  : Parity Error interrupt.
//! - \ref UART_INT_FE  : Framing Error interrupt.
//! - \ref UART_INT_RT  : Receive Timeout interrupt.
//! - \ref UART_INT_TX  : Transmit interrupt.
//! - \ref UART_INT_RX  : Receive interrupt.
//! - \ref UART_INT_CTS : CTS interrupt.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Enable the specified interrupts.
    HWREG(ui32Base + UART_O_IMSC) |= ui32IntFlags;
}

//*****************************************************************************
//
//! \brief Disables individual UART interrupt sources.
//!
//! This function disables the indicated UART interrupt sources. Only the
//! sources that are enabled can be reflected to the processor interrupt;
//! disabled sources have no effect on the processor.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32IntFlags is the bit mask of the interrupt sources to be disabled.
//! - \ref UART_INT_OE  : Overrun Error interrupt.
//! - \ref UART_INT_BE  : Break Error interrupt.
//! - \ref UART_INT_PE  : Parity Error interrupt.
//! - \ref UART_INT_FE  : Framing Error interrupt.
//! - \ref UART_INT_RT  : Receive Timeout interrupt.
//! - \ref UART_INT_TX  : Transmit interrupt.
//! - \ref UART_INT_RX  : Receive interrupt.
//! - \ref UART_INT_CTS : CTS interrupt.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Disable the specified interrupts.
    HWREG(ui32Base + UART_O_IMSC) &= ~(ui32IntFlags);
}

//*****************************************************************************
//
//! \brief Gets the current interrupt status.
//!
//! This function returns the interrupt status for the specified UART. Either
//! the raw interrupt status or the status of interrupts that are allowed to
//! reflect to the processor can be returned.
//!
//! \param ui32Base is the base address of the UART port.
//! \param bMasked selects either raw or masked interrupt.
//! - \c true  : Masked interrupt status is required.
//! - \c false : Raw interrupt status is required.
//!
//! \return Returns the current interrupt status, enumerated as a bit field of:
//! - \ref UART_INT_OE  : Overrun Error interrupt.
//! - \ref UART_INT_BE  : Break Error interrupt.
//! - \ref UART_INT_PE  : Parity Error interrupt.
//! - \ref UART_INT_FE  : Framing Error interrupt.
//! - \ref UART_INT_RT  : Receive Timeout interrupt.
//! - \ref UART_INT_TX  : Transmit interrupt.
//! - \ref UART_INT_RX  : Receive interrupt.
//! - \ref UART_INT_CTS : CTS interrupt.
//
//*****************************************************************************
__STATIC_INLINE uint32_t
UARTIntStatus(uint32_t ui32Base, bool bMasked)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Return either the interrupt status or the raw interrupt status as
    // requested.
    if(bMasked)
    {
        return(HWREG(ui32Base + UART_O_MIS));
    }
    else
    {
        return(HWREG(ui32Base + UART_O_RIS));
    }
}

//*****************************************************************************
//
//! \brief Clears UART interrupt sources.
//!
//! The specified UART interrupt sources are cleared, so that they no longer
//! assert. This function must be called in the interrupt handler to keep the
//! interrupt from being recognized again immediately upon exit.
//!
//! \note Due to write buffers and synchronizers in the system it may take several
//! clock cycles from a register write clearing an event in a module and until the
//! event is actually cleared in the NVIC of the system CPU. It is recommended to
//! clear the event source early in the interrupt service routine (ISR) to allow
//! the event clear to propagate to the NVIC before returning from the ISR.
//! At the same time, an early event clear allows new events of the same type to be
//! pended instead of ignored if the event is cleared later in the ISR.
//! It is the responsibility of the programmer to make sure that enough time has passed
//! before returning from the ISR to avoid false re-triggering of the cleared event.
//! A simple, although not necessarily optimal, way of clearing an event before
//! returning from the ISR is:
//! -# Write to clear event (interrupt source). (buffered write)
//! -# Dummy read from the event source module. (making sure the write has propagated)
//! -# Wait two system CPU clock cycles (user code or two NOPs). (allowing cleared event to propagate through any synchronizers)
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32IntFlags is a bit mask of the interrupt sources to be cleared.
//! - \ref UART_INT_OE  : Overrun Error interrupt.
//! - \ref UART_INT_BE  : Break Error interrupt.
//! - \ref UART_INT_PE  : Parity Error interrupt.
//! - \ref UART_INT_FE  : Framing Error interrupt.
//! - \ref UART_INT_RT  : Receive Timeout interrupt.
//! - \ref UART_INT_TX  : Transmit interrupt.
//! - \ref UART_INT_RX  : Receive interrupt.
//! - \ref UART_INT_CTS : CTS interrupt.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
{
    // Check the arguments
    ASSERT(UARTBaseValid(ui32Base));

    // Clear the requested interrupt sources
    HWREG(ui32Base + UART_O_ICR) = ui32IntFlags;
}

//*****************************************************************************
//
//! \brief Enable UART DMA operation.
//!
//! The specified UART DMA features are enabled. The UART can be
//! configured to use DMA for transmit or receive, and to disable
//! receive if an error occurs.
//!
//! \note The uDMA controller must also be set up before DMA can be used
//! with the UART.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32DMAFlags is a bit mask of the DMA features to enable.
//! The parameter is the bitwise OR of any of the following values:
//! - UART_DMA_RX         : Enable DMA for receive.
//! - UART_DMA_TX         : Enable DMA for transmit.
//! - UART_DMA_ERR_RXSTOP : Disable DMA receive on UART error.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Set the requested bits in the UART DMA control register.
    HWREG(ui32Base + UART_O_DMACTL) |= ui32DMAFlags;
}

//*****************************************************************************
//
//! \brief Disable UART DMA operation.
//!
//! This function is used to disable UART DMA features that were enabled
//! by \ref UARTDMAEnable(). The specified UART DMA features are disabled.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32DMAFlags is a bit mask of the DMA features to disable.
//! The parameter is the bitwise OR of any of the following values:
//! - UART_DMA_RX         : Enable DMA for receive.
//! - UART_DMA_TX         : Enable DMA for transmit.
//! - UART_DMA_ERR_RXSTOP : Disable DMA receive on UART error.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTDMADisable(uint32_t ui32Base, uint32_t ui32DMAFlags)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Clear the requested bits in the UART DMA control register.
    HWREG(ui32Base + UART_O_DMACTL) &= ~ui32DMAFlags;
}

//*****************************************************************************
//
//! \brief Gets current receiver errors.
//!
//! This function returns the current state of each of the 4 receiver error
//! sources. The returned errors are equivalent to the four error bits
//! returned via the previous call to \ref UARTCharGet() or \ref UARTCharGetNonBlocking()
//! with the exception that the overrun error is set immediately the overrun
//! occurs rather than when a character is next read.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return Returns a bitwise OR combination of the receiver error flags:
//! - \ref UART_RXERROR_FRAMING
//! - \ref UART_RXERROR_PARITY
//! - \ref UART_RXERROR_BREAK
//! - \ref UART_RXERROR_OVERRUN
//
//*****************************************************************************
__STATIC_INLINE uint32_t
UARTRxErrorGet(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Return the current value of the receive status register.
    return(HWREG(ui32Base + UART_O_RSR) & 0x0000000F);
}

//*****************************************************************************
//
//! \brief Clears all reported receiver errors.
//!
//! This function is used to clear all receiver error conditions reported via
//! \ref UARTRxErrorGet(). If using the overrun, framing error, parity error or
//! break interrupts, this function must be called after clearing the interrupt
//! to ensure that later errors of the same type trigger another interrupt.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTRxErrorClear(uint32_t ui32Base)
{
    // Check the arguments.
    ASSERT(UARTBaseValid(ui32Base));

    // Any write to the Error Clear Register will clear all bits which are
    // currently set.
    HWREG(ui32Base + UART_O_ECR) = 0;
}

//*****************************************************************************
//
//! \brief Enables hardware flow control for both CTS and RTS
//!
//! Hardware flow control is disabled by default.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTHwFlowControlEnable( uint32_t ui32Base )
{
    // Check the arguments.
    ASSERT( UARTBaseValid( ui32Base ));

    HWREG( ui32Base + UART_O_CTL ) |= ( UART_CTL_CTSEN | UART_CTL_RTSEN );
}

//*****************************************************************************
//
//! \brief Disables hardware flow control for both CTS and RTS
//!
//! Hardware flow control is disabled by default.
//!
//! \param ui32Base is the base address of the UART port.
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
UARTHwFlowControlDisable( uint32_t ui32Base )
{
    // Check the arguments.
    ASSERT( UARTBaseValid( ui32Base ));

    HWREG( ui32Base + UART_O_CTL ) &= ~( UART_CTL_CTSEN | UART_CTL_RTSEN );
}

//*****************************************************************************
//
// Support for DriverLib in ROM:
// Redirect to implementation in ROM when available.
//
//*****************************************************************************
#if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
    #include "../driverlib/rom.h"
    #ifdef ROM_UARTFIFOLevelGet
        #undef  UARTFIFOLevelGet
        #define UARTFIFOLevelGet                ROM_UARTFIFOLevelGet
    #endif
    #ifdef ROM_UARTConfigSetExpClk
        #undef  UARTConfigSetExpClk
        #define UARTConfigSetExpClk             ROM_UARTConfigSetExpClk
    #endif
    #ifdef ROM_UARTConfigGetExpClk
        #undef  UARTConfigGetExpClk
        #define UARTConfigGetExpClk             ROM_UARTConfigGetExpClk
    #endif
    #ifdef ROM_UARTDisable
        #undef  UARTDisable
        #define UARTDisable                     ROM_UARTDisable
    #endif
    #ifdef ROM_UARTCharGetNonBlocking
        #undef  UARTCharGetNonBlocking
        #define UARTCharGetNonBlocking          ROM_UARTCharGetNonBlocking
    #endif
    #ifdef ROM_UARTCharGet
        #undef  UARTCharGet
        #define UARTCharGet                     ROM_UARTCharGet
    #endif
    #ifdef ROM_UARTCharPutNonBlocking
        #undef  UARTCharPutNonBlocking
        #define UARTCharPutNonBlocking          ROM_UARTCharPutNonBlocking
    #endif
    #ifdef ROM_UARTCharPut
        #undef  UARTCharPut
        #define UARTCharPut                     ROM_UARTCharPut
    #endif
    #ifdef ROM_UARTIntRegister
        #undef  UARTIntRegister
        #define UARTIntRegister                 ROM_UARTIntRegister
    #endif
    #ifdef ROM_UARTIntUnregister
        #undef  UARTIntUnregister
        #define UARTIntUnregister               ROM_UARTIntUnregister
    #endif
#endif

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif //  __UART_H__

//*****************************************************************************
//
//! Close the Doxygen group.
//! @}
//! @}
//
//*****************************************************************************


text:
module Main where

import qualified Data.ByteString.Lazy as B
import qualified Codec.Compression.GZip as GZip

main = B.interact $ GZip.compressWith GZip.defaultCompressParams {
                      GZip.compressLevel = GZip.BestCompression
                    }

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Sloths\Application;
use Sloths\Application\Service\ServiceManager;
use Sloths\Http\RequestInterface;
use Sloths\Http\ResponseInterface;
use Sloths\Misc\ConfigurableInterface;
use Sloths\Observer\ObserverInterface;
use Sloths\Routing\Router;

interface ApplicationInterface extends ObserverInterface, ConfigurableInterface
{
    /**
     * @return string
     */
    public function getEnv();

    /**
     * @param string $directory
     * @throws \InvalidArgumentException
     */
    public function setDirectory($directory);

    /**
     * @return string
     */
    public function getDirectory();

    /**
     * @param string $baseUrl
     * @return $this
     */
    public function setBaseUrl($baseUrl);

    /**
     * @return string
     */
    public function getBaseUrl();

    /**
     * @param string $name
     * @return string
     */
    public function getPath($name);

    /**
     * @param \Sloths\Http\RequestInterface $request
     * @return $this
     */
    public function setRequest(RequestInterface $request);

    /**
     * @return \Sloths\Http\RequestInterface
     */
    public function getRequest();

    /**
     * @param \Sloths\Http\ResponseInterface $response
     * @return $this
     */
    public function setResponse(ResponseInterface $response);

    /**
     * @return \Sloths\Http\ResponseInterface
     */
    public function getResponse();

    /**
     * @param Router $router
     * @return mixed
     */
    public function setRouter(Router $router);

    /**
     * @return \Sloths\Routing\Router
     */
    public function getRouter();

    /**
     * @param ServiceManager $manager
     * @return $this
     */
    public function setServiceManager(ServiceManager $manager);

    /**
     * @return ServiceManager
     */
    public function getServiceManager();

    /**
     * @param ConfigLoader $configLoaderLoader
     * @return mixed
     */
    public function setConfigLoader(ConfigLoader $configLoaderLoader);

    /**
     * @return \Sloths\Application\ConfigLoader
     */
    public function getConfigLoader();

    /**
     * @event before[$this]
     * @event after[$this]
     *
     * @return $this
     */
    public function run();
}


text:
<?php

namespace Sylius\Component\Metadata\Renderer;

use Sylius\Component\Metadata\Model\MetadataInterface;

/**
 * @author Kamil Kokot <kamil.kokot@lakion.com>
 */
interface MetadataRendererInterface
{
    /**
     * @param MetadataInterface $metadata
     * @param array $options
     *
     * @return string
     */
    public function render(MetadataInterface $metadata, array $options = []);

    /**
     * @param MetadataInterface $metadata
     * @param array $options
     *
     * @return bool
     */
    public function supports(MetadataInterface $metadata, array $options = []);
}


text:
namespace asio {
namespace detail {

class epoll_reactor
  : public asio::detail::service_base<epoll_reactor>
{
public:
  enum { read_op = 0, write_op = 1,
    connect_op = 1, except_op = 2, max_ops = 3 };

  // Per-descriptor queues.
  class descriptor_state
  {
    friend class epoll_reactor;
    friend class object_pool_access;
    mutex mutex_;
    op_queue<reactor_op> op_queue_[max_ops];
    bool shutdown_;
    descriptor_state* next_;
    descriptor_state* prev_;
  };

  // Per-descriptor data.
  typedef descriptor_state* per_descriptor_data;

  // Constructor.
  ASIO_DECL epoll_reactor(asio::io_service& io_service);

  // Destructor.
  ASIO_DECL ~epoll_reactor();

  // Destroy all user-defined handler objects owned by the service.
  ASIO_DECL void shutdown_service();

  // Initialise the task.
  ASIO_DECL void init_task();

  // Register a socket with the reactor. Returns 0 on success, system error
  // code on failure.
  ASIO_DECL int register_descriptor(socket_type descriptor,
      per_descriptor_data& descriptor_data);

  // Post a reactor operation for immediate completion.
  void post_immediate_completion(reactor_op* op)
  {
    io_service_.post_immediate_completion(op);
  }

  // Start a new operation. The reactor operation will be performed when the
  // given descriptor is flagged as ready, or an error has occurred.
  ASIO_DECL void start_op(int op_type, socket_type descriptor,
      per_descriptor_data& descriptor_data,
      reactor_op* op, bool allow_speculative);

  // Cancel all operations associated with the given descriptor. The
  // handlers associated with the descriptor will be invoked with the
  // operation_aborted error.
  ASIO_DECL void cancel_ops(socket_type descriptor,
      per_descriptor_data& descriptor_data);

  // Cancel any operations that are running against the descriptor and remove
  // its registration from the reactor.
  ASIO_DECL void close_descriptor(socket_type descriptor,
      per_descriptor_data& descriptor_data);

  // Add a new timer queue to the reactor.
  template <typename Time_Traits>
  void add_timer_queue(timer_queue<Time_Traits>& timer_queue);

  // Remove a timer queue from the reactor.
  template <typename Time_Traits>
  void remove_timer_queue(timer_queue<Time_Traits>& timer_queue);

  // Schedule a new operation in the given timer queue to expire at the
  // specified absolute time.
  template <typename Time_Traits>
  void schedule_timer(timer_queue<Time_Traits>& queue,
      const typename Time_Traits::time_type& time,
      typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op);

  // Cancel the timer operations associated with the given token. Returns the
  // number of operations that have been posted or dispatched.
  template <typename Time_Traits>
  std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
      typename timer_queue<Time_Traits>::per_timer_data& timer);

  // Run epoll once until interrupted or events are ready to be dispatched.
  ASIO_DECL void run(bool block, op_queue<operation>& ops);

  // Interrupt the select loop.
  ASIO_DECL void interrupt();

private:
  // The hint to pass to epoll_create to size its data structures.
  enum { epoll_size = 20000 };

  // Create the epoll file descriptor. Throws an exception if the descriptor
  // cannot be created.
  ASIO_DECL static int do_epoll_create();

  // Helper function to add a new timer queue.
  ASIO_DECL void do_add_timer_queue(timer_queue_base& queue);

  // Helper function to remove a timer queue.
  ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue);

  // Called to recalculate and update the timeout.
  ASIO_DECL void update_timeout();

  // Get the timeout value for the epoll_wait call. The timeout value is
  // returned as a number of milliseconds. A return value of -1 indicates
  // that epoll_wait should block indefinitely.
  ASIO_DECL int get_timeout();

#if defined(ASIO_HAS_TIMERFD)
  // Get the timeout value for the timer descriptor. The return value is the
  // flag argument to be used when calling timerfd_settime.
  ASIO_DECL int get_timeout(itimerspec& ts);
#endif // defined(ASIO_HAS_TIMERFD)

  // The io_service implementation used to post completions.
  io_service_impl& io_service_;

  // Mutex to protect access to internal data.
  mutex mutex_;

  // The epoll file descriptor.
  int epoll_fd_;

  // The timer file descriptor.
  int timer_fd_;

  // The interrupter is used to break a blocking epoll_wait call.
  select_interrupter interrupter_;

  // The timer queues.
  timer_queue_set timer_queues_;

  // Whether the service has been shut down.
  bool shutdown_;

  // Mutex to protect access to the registered descriptors.
  mutex registered_descriptors_mutex_;

  // Keep track of all registered descriptors.
  object_pool<descriptor_state> registered_descriptors_;
};

} // namespace detail
} // namespace asio

#include "RCF/external/asio/asio/detail/pop_options.hpp"

#include "RCF/external/asio/asio/detail/impl/epoll_reactor.hpp"
#if defined(ASIO_HEADER_ONLY)
# include "RCF/external/asio/asio/detail/impl/epoll_reactor.ipp"
#endif // defined(ASIO_HEADER_ONLY)

#endif // defined(ASIO_HAS_EPOLL)

#endif // ASIO_DETAIL_EPOLL_REACTOR_HPP


text:
/* Couleurs
    Base marron = #5C2E05
    Marron light = #BEAAA0
*/
div,
button,
textarea,
span,
input,
select,
table,
tr,
td,
th{
    box-sizing: border-box;
    font-family: Verdana;
    font-size: 12px;
    /* vertical-align:top; */
}
div.sheet-mainBg{
    width: 832px;
    background-color: white;
    text-align: center;
    /* border:1px solid #5C2E05; */
}
table{
    width:100%;
    border-collapse: collapse;
}
table.sheet-tabsep{
    border-collapse: separate;
    border-spacing: 4px 2px;
}
.sheet-imghr{
    width: 820px;
    height: 5px;
    padding: 0px;
    /* box-shadow: 1px 1px 8px #555; */
}
.sheet-boxtitre{
    background-color: #5C2E05;
    text-align: center;
    font-style: normal;
    font-weight: bold;
    text-transform: capitalize;
    color: white;
    border:none;
    white-space: nowrap;
    padding: 2px 4px 2px 4px;
}
.sheet-boxtitresmall{
    background-color: #5C2E05;
    text-align: center;
    font-style: normal;
    font-size: 12px;
    font-weight: normal;
    color: white;
    border:none;
    white-space: nowrap;
    padding: 1px 2px 1px 2px;
    vertical-align: top;
}
.sheet-boxinput{
    background-color: white;
    text-align: center;
    font-style: normal;
    font-weight: normal;
    color: black;
    border: 1px solid #5C2E05;
    white-space: nowrap;
}
.sheet-boxinputleft{
    background-color: white;
    text-align: left;
    font-style: normal;
    font-weight: normal;
    color: black;
    border: 1px solid #5C2E05;
    white-space: nowrap;
}
.sheet-boxinputlight{
    background-color: white;
    text-align: center;
    font-style: normal;
    font-weight: normal;
    color: black;
    border: 1px solid #BEAAA0;
    white-space: nowrap;
}
.sheet-boxvoie{
    background-color: white;
    text-align: left;
    font-style: normal;
    font-weight: normal;
    color: black;
    border-top: none;
    border-bottom: 1px dotted #5C2E05;
    border-left: 1px solid #5C2E05;
    border-right: 1px solid #5C2E05;
    white-space: nowrap;
}
.sheet-textfat{
    font-weight: bold;
    color: #5C2E05;
    border: none;
    text-align: center;
}
.sheet-textfatleft{
    font-weight: bold;
    color: #5C2E05;
    border: none;
    text-align: left;
    padding-left: 4px;
    padding-right: 4px;
}
.sheet-textbase{
    color: #5C2E05;
    border: none;
    text-align: center;
}
.sheet-textbasesmall{
    color: #5C2E05;
    border: none;
    font-size:11px;
}
.sheet-texttitresmall{
    color: white;
    font-size: 8px;
    font-weight: normal;
}
button[type="roll"].sheet-boxtitre{
    height:20px;
    font-size:11px;
    font-family: Verdana;
    font-weight: bold;
    text-decoration:none;
    background:none;
    background-image:none;
    border: none;
    box-shadow: none;
    text-shadow: none;
}
button[type="roll"].sheet-boxtitre:hover{
    background-color:#BEAAA0;
    border: 1px solide white;
}
button[type="roll"].sheet-neutre{
    color: #5C2E05;
    font-weight: normal;
    font-size: 20px;
    text-decoration:none;
    background:none;
    background-image:none;
    border: none;
    box-shadow: none;
    text-shadow: none;
    padding: 0px;
    margin: 0px;
}
button[type="roll"].sheet-neutre:hover{
    font-weight: bold;
}
input, select{
    border: none;
    box-shadow: none;
    max-height: 22px;
    padding: 0px;
    margin: 0px;
}
select.sheet-carac{
    width: 62px;
}
select.sheet-selectmin{
    width: 18px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
input[type="number"]{
    width: 60px;
    text-align: right;
}
input[type="text"]{
    width: 100%;
    text-align: left;
    padding-left: 4px;
}
input[disabled]{
    background-color: white;
    font-style: italic;
}
input:not([disabled]):hover{
    background-color: #BEAAA0;
}
select:not([disabled]):hover{
    background-color: #BEAAA0;
}
input.sheet-nobox{
    border-bottom: 2px dotted #5C2E05;
}
textarea{
    border: none;
    box-shadow: none;
    padding: 1px;
    margin: 0px;
    height: 1.5em;
    resize: vertical;
    vertical-align:top;
}
textarea.sheet-voixdesc{
    resize: none;
    height: 100%;
    overflow-y: auto;
}
/* TEMPLATES */
.sheet-rolltemplate-co1 .sheet-imghr{
    width: 176px;
    height: 4px;
    padding: 0px;
    margin: 0px;
}
.sheet-rolltemplate-co1 table {
    width: 189px;
    padding: 2px;
    border: 1px solid #5C2E05;
    border-radius: 6px;
    background-color: #ffffff;
}
.sheet-rolltemplate-co1 th {
    color: #5C2E05;
    margin: 0px;
    padding: 0px 5px 0px 5px;
    font-size: 13px;
    text-align: left;
    font-family: 'Verdana';
    font-variant: small-caps;
    font-weight: bold;
    white-space: nowrap;
}
.sheet-rolltemplate-co1 .sheet-subheader {
    color: #000;
    font-size: 12px;
    font-style: italic;
    font-family: 'Verdana';
    font-variant: small-caps;
    text-align: right;
    white-space: nowrap;
}
.sheet-rolltemplate-co1 .sheet-tcat {
    font-family: 'Verdana';
    font-size: 12px;
    font-weight: normal;
    text-align: right;
    padding-right: 2px;
}
.sheet-rolltemplate-co1 td {
    margin: 0px;
    padding: 0px 5px 0px 5px;
    font-family: 'Verdana';
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
}
.sheet-rolltemplate-co1 .inlinerollresult  {
    background-color: rgba(255,255,255,0.9);
    border-width: 1px;
    border-color: #BEAAA0;
    border-style: solid;
    border-radius: 50%;
}
.sheet-rolltemplate-co1 .inlinerollresult.fullcrit {
    color: #3FB315;
    border-width: 2px;
    border-color: #3FB315;
    border-style: solid;
    border-radius: 50%;
}
.sheet-rolltemplate-co1 .inlinerollresult.fullfail {
    color: #B31515;
    border-width: 2px;
    border-color: #B31515;
    border-style: solid;
    border-radius: 50%;
}
.sheet-rolltemplate-co1 .inlinerollresult.importantroll {
    color: #5C2E05;
    border-width: 2px;
    border-color: #5C2E05;
    border-style: solid;
    border-radius: 50%;
}


text:
package as;

import org.junit.Test;

/**
 * Feature tests for AS Namespaces.
 */
public class ASVariableTests extends ASFeatureTestsBase
{
    @Test
    public void ASVariableTests_stringInitializeEmptyString()
    {
    	// all tests can assume that flash.display.Sprite
    	// flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "public static const foo:String = ''",
        };
        String[] testCode = new String[]
        {
            "assertEqual('empty string', foo, '');",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndRun(source);
    }

    @Test
    public void ASVariableTests_stringInitializeNull()
    {
    	// all tests can assume that flash.display.Sprite
    	// flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "public static const foo:String = null",
        };
        String[] testCode = new String[]
        {
            "assertEqual('null', foo, null);",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndRun(source);
    }

    @Test
    public void ASVariableTests_stringInitializeUndefined()
    {
    	// all tests can assume that flash.display.Sprite
    	// flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "public static const foo:String = undefined",
        };
        String[] testCode = new String[]
        {
            "assertEqual('null', foo, null);",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndRun(source);
    }

    @Test
    public void ASVariableTests_AnyInitializeUndefined()
    {
    	// all tests can assume that flash.display.Sprite
    	// flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "public static const foo:* = undefined",
        };
        String[] testCode = new String[]
        {
            "assertEqual('null', foo, undefined);",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndRun(source);
    }

    @Test
    public void ASVariableTests_localVarSameNameAsPrivateMethodError()
    {
        // all tests can assume that flash.display.Sprite
        // flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "private function isVertical():Boolean { return false; }",
        };
        String[] testCode = new String[]
        {
            // this threw an exception when the generated code
            // tried to call the value of the local var.
            // mxmlc will generate a call to the method
            // without require a this.isVertical to reference
            // the instance method.
            "var isVertical:Boolean = isVertical();",
            "assertEqual('null', isVertical, false);",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndExpectErrors(source, false, false, false, new String[0],
                "Call to isVertical is not a function.\n");
    }

    @Test
    public void ASVariableTests_constIsClassCastFunction()
    {
        // all tests can assume that flash.display.Sprite
        // flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "private const innerClass:InnerClass = null;",
        };
        String[] testCode = new String[]
        {
            "if (false) { var test:Object = innerClass('foo')};",
        };
        String[] extraCode = new String[]
        {
            "class InnerClass",
            "{",
            "    public function InnerClass(obj:Object)",
            "    {",
            "    }",
            "}"
        };
        String source = getAS(imports, declarations, testCode, extraCode);
        compileAndRun(source);
    }

    @Test
    public void ASVariableTests_localVarSameNameAsPrivateMethod()
    {
        // all tests can assume that flash.display.Sprite
        // flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "private function isVertical():Boolean { return false; }",
        };
        String[] testCode = new String[]
        {
            // this threw an exception when the generated code
            // tried to call the value of the local var.
            // mxmlc will generate a call to the method
            // without require a this.isVertical to reference
            // the instance method.
            "var isVertical:Boolean = isVertical();",
            "assertEqual('null', isVertical, false);",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndRun(source, false, false, false, new String[]{ "-compiler.mxml.compatibility-version=4.6.0" } );
    }

    /*
    public void ASVariableTests_VectorInitializer()
    {
    	// all tests can assume that flash.display.Sprite
    	// flash.system.System and flash.events.Event have been imported
        String[] imports = new String[]
        {
        };
        String[] declarations = new String[]
        {
            "public static var arr:Array = Array('foo', 'bar', 'baz');",
            "public static var foo:Vector.<String> = new Vector.<String>('foo', 'bar', 'baz');",
            "public static var bar:Vector.<String> = Vector.<String>('foo', 'bar', 'baz');",
        };
        String[] testCode = new String[]
        {
            "assertEqual('length', foo.length, 3, 4);",
        };
        String source = getAS(imports, declarations, testCode, new String[0]);
        compileAndRun(source);
    }
    */
}


text:
package xdroid.collections;

import java.util.Iterator;

import static xdroid.core.ObjectUtils.notNull;

/**
 * @author Oleksii Kropachov (o.kropachov@shamanland.com)
 */
public class IndexedIterator<E> implements Iterator<E> {
    private final Indexed<E> mIndexed;
    private int mCursor;

    public IndexedIterator(Indexed<E> indexed) {
        mIndexed = notNull(indexed);
        mCursor = -1;
    }

    @Override
    public boolean hasNext() {
        return mCursor + 1 < mIndexed.size();
    }

    @Override
    public E next() {
        return mIndexed.get(++mCursor);
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }
}


text:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/navigation_header"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.copycat.MainActivity"
    tools:ignore="MergeRootFrame">

    <fragment
        class="com.copycat.MainFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <android.support.design.widget.NavigationView
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/navigation_view"
        app:menu="@menu/menu_navigation"
        android:layout_gravity="start"
        app:headerLayout="@layout/navigation_header">

    </android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>


text:
package core;

public enum StatusE {
	SUCCESS, FAIL, ERROR, NO_SUCH_FILE
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2-70-
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.02.02 at 03:31:08 PM MEZ
//

package reactionruleml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for repo.type complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="repo.type">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <group ref="{http://www.ruleml.org/1.0/xsd}repo.content"/>
 *       <attGroup ref="{http://www.ruleml.org/1.0/xsd}repo.attlist"/>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "repo.type", propOrder = {
    "var",
    "plex"
})
public class RepoType {

    @XmlElement(name = "Var")
    protected VarType var;
    @XmlElement(name = "Plex")
    protected PlexRepoType plex;

    /**
     * Gets the value of the var property.
     *
     * @return
     *     possible object is
     *     {@link VarType }
     *
     */
    public VarType getVar() {
        return var;
    }

    /**
     * Sets the value of the var property.
     *
     * @param value
     *     allowed object is
     *     {@link VarType }
     *
     */
    public void setVar(VarType value) {
        this.var = value;
    }

    /**
     * Gets the value of the plex property.
     *
     * @return
     *     possible object is
     *     {@link PlexRepoType }
     *
     */
    public PlexRepoType getPlex() {
        return plex;
    }

    /**
     * Sets the value of the plex property.
     *
     * @param value
     *     allowed object is
     *     {@link PlexRepoType }
     *
     */
    public void setPlex(PlexRepoType value) {
        this.plex = value;
    }

}


text:
<mat-card class="oppia-editor-card-with-avatar">

Classroom details

      <mat-spinner class="loading-spinner"
                   *ngIf="!pageIsInitialized"
                   [diameter]="30">
      </mat-spinner>

        No classroom exists at this moment.

            {{ classroom.value }}

           0">
            {{ this.tempClassroomData.getClassroomName() }}

            [New Classroom]

          <button mat-button matSuffix mat-icon-button
                  aria-label="Clear"
                  *ngIf="!classroomEditorMode"
                  (click)="deleteClassroom(classroom.key); $event.stopPropagation()">
            <mat-icon matListIcon>close</mat-icon>
          </button>

              

              Name

                {{tempClassroomData.getClassroomName()}}

              <textarea *ngIf="classroomEditorMode"
                        [(ngModel)]="tempClassroomData._name"
                        (blur)="updateClassroomField()"
                        (ngModelChange)="classroomAdminDataService.validateClassroom(tempClassroomData, classroomData)"
                        rows="1">
              </textarea>

 0" class="oppia-warning-text">
                {{ classroomAdminDataService.nameValidationError }}

              URL fragment

                {{tempClassroomData.getClassroomUrlFragment()}}

              <textarea *ngIf="classroomEditorMode"
                        [(ngModel)]="tempClassroomData._urlFragment"
                        (blur)="updateClassroomField()"
                        (ngModelChange)="classroomAdminDataService.validateClassroom(tempClassroomData, classroomData)"
                        rows="1">
              </textarea>

 0" class="oppia-warning-text">
                {{ classroomAdminDataService.urlValidationError }}

              Course details

              {{ tempClassroomData.getCourseDetails() }}

            <textarea *ngIf="classroomEditorMode"
                      [(ngModel)]="tempClassroomData._courseDetails"
                      (blur)="updateClassroomField()"
                      (ngModelChange)="classroomAdminDataService.validateClassroom(tempClassroomData, classroomData)"
                      rows="6"
                      class="classroom-field">
            </textarea>

              Topic list intro

                {{tempClassroomData.getTopicListIntro()}}

            <textarea *ngIf="classroomEditorMode"
                      [(ngModel)]="tempClassroomData._topicListIntro"
                      (blur)="updateClassroomField()"
                      (ngModelChange)="classroomAdminDataService.validateClassroom(tempClassroomData, classroomData)"
                      rows="4"
                      class="classroom-field">
            </textarea>

Topics and their prerequisites

                The prerequisite topics below are used to generate the diagnostic test.

              No topics are currently added in the classroom.

                      {{ topicName }}

                          No Prerequisites

                        <mat-chip-list>
                          <mat-chip *ngFor="let prerequisiteTopic of topicNameToPrerequisiteTopicNames[topicName]">
                            {{ prerequisiteTopic }}
                          </mat-chip>
                        </mat-chip-list>

                        <mat-form-field class="topics-form-field"
                                        appearance="fill">
                          <mat-label>Prerequisites</mat-label>

                          <mat-chip-list #chipList aria-label="Prerequisites list">
                            <mat-chip *ngFor="let prerequisiteTopic of topicNameToPrerequisiteTopicNames[topicName]"
                                      (removed)="removeDependencyFromTopic(topicName, prerequisiteTopic)">
                              {{ prerequisiteTopic }}
                              <mat-icon matChipRemove>cancel</mat-icon>
                            </mat-chip>

                            <input placeholder="Select prerequisites"
                                   [matAutocomplete]="auto"
                                   [matChipInputFor]="chipList"
                                   [matChipInputSeparatorKeyCodes]="separatorKeysCodes"
                                   [(ngModel)]="prerequisiteInput"
                                   (ngModelChange)="onPrerequisiteInputChange()"
                                   (click)="getEligibleTopicPrerequisites(topicName)">
                          </mat-chip-list>

                          <mat-autocomplete #auto="matAutocomplete"
                                            (optionSelected)="addDependencyForTopic(topicName, $event.option.value)">

                            <mat-option *ngFor="let option of tempEligibleTopicNamesForPrerequisites"
                                        [value]="option">
                              {{ option }}
                            </mat-option>
                          </mat-autocomplete>
                        </mat-form-field>

                        <button (click)="deleteTopic(topicName)"
                                mat-button matSuffix mat-icon-button
                                aria-label="Clear">
                          <mat-icon matListIcon>close</mat-icon>
                        </button>

 0 && currentTopicOnEdit === topicName"
                     class="oppia-warning-text cyclic-check-error">
                    {{ classroomAdminDataService.topicsGraphValidationError }}

                <input [(ngModel)]="newTopicId"
                       class="form-control new-topic-input e2e-test-add-topic-to-classroom-input"
                       (ngModelChange)="onNewTopicInputModelChange()">
                <button (click)="removeNewTopicInputField()"
                        class="btn btn-secondary">
                  Cancel
                </button>
                <button (click)="addTopicId(newTopicId)"
                        class="btn btn-success e2e-test-submit-topic-id-to-classroom-button"
                        [disabled]="newTopicId.length === 0">
                  Submit
                </button>

              <button (click)="showNewTopicInputField()"
                      *ngIf="!newTopicCanBeAdded"
                      class="btn btn-secondary add-new-topic e2e-test-add-topic-to-classroom-button">
                Add Topic
              </button>

                Topic with given ID does not exist.

            <button class="btn btn-secondary view-graph-button"
                    (click)="viewGraph()"
                    *ngIf="tempClassroomData.getTopicsCount() > 0">
              View Graph
            </button>
            <button class="btn btn-secondary cancel-classroom-changes"
                    (click)="closeClassroomConfigEditor()"
                    [disabled]="classroomDataSaveInProgress">
              Cancel
            </button>
            <button class="btn btn-success save-classroom-changes e2e-test-save-classroom-config-button"
                    [disabled]="!(classroomDataIsChanged && tempClassroomData.isClassroomDataValid())"
                    (click)="saveClassroomData(classroom.key)">
              Save
              <mat-spinner *ngIf="classroomDataSaveInProgress"
                           class="oppia-save-classroom-spinning-button"
                           [diameter]="22">
              </mat-spinner>
            </button>

      <button class="btn add-new-classroom e2e-test-add-new-classroom-config"
              (click)="createNewClassroom()"
              [disabled]="classroomEditorMode">
        + ADD NEW CLASSROOM
      </button>

</mat-card>


text:
Programming-Mobile-Applications-for-Android-Handheld-Systems
============================================================

The assignments for the course Programming Mobile Applications for Android Handheld Systems at coursera


text:
package io.datarouter.job.web;

import java.util.stream.Stream;

import javax.inject.Inject;
import javax.inject.Singleton;

import io.datarouter.job.scheduler.JobPackage;
import io.datarouter.job.scheduler.JobPackageTracker;
import io.datarouter.util.string.StringTool;

@Singleton
public class JobPackageFilter{

	@Inject
	private JobPackageTracker jobPackageTracker;

	public Stream<JobPackage> streamMatches(
			String categoryName,
			String keyword,
			boolean hideEnabled,
			boolean hideDisabled){
		return jobPackageTracker.getJobPackages().stream()
				.filter(jobPackage -> matchesEnabled(jobPackage, hideEnabled, hideDisabled))
				.filter(jobPackage -> matchesCategoryName(jobPackage, categoryName))
				.filter(jobPackage -> matchesKeyword(jobPackage, keyword));
	}

	private static boolean matchesEnabled(JobPackage jobPackage, boolean hideEnabled, boolean hideDisabled){
		boolean enabled = jobPackage.shouldRunSupplier.get();
		if(hideEnabled && enabled){
			return false;
		}
		if(hideDisabled && !enabled){
			return false;
		}
		return true;
	}

	private static boolean matchesCategoryName(JobPackage jobPackage, String categoryName){
		if(StringTool.isNullOrEmptyOrWhitespace(categoryName)){
			return true;
		}
		return StringTool.equalsCaseInsensitive(jobPackage.jobCategoryName, categoryName);
	}

	private static boolean matchesKeyword(JobPackage jobPackage, String keyword){
		if(StringTool.isEmpty(keyword)){
			return true;
		}
		return jobPackage.jobClass.getSimpleName().toLowerCase().contains(keyword.toLowerCase());
	}

}


text:
package ru.javavlad.list;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class ConvertList2Array {

    public int[][] toArray(List<Integer> list, int rows) {
        int cells = (list.size() % rows == 0) ? list.size() / rows : ((int) Math.ceil(list.size() / rows)) + 1;
        int[][] array = new int[rows][cells];
        int i = 0;
        int j = 0;
        for (int cell : list) {
            array[i][j++] = cell;
            if (j == cells) {
                i++;
                j = 0;
            }
        }
        return array;
    }

    public List<Integer> convert(List<int[]> list) {
        return list.stream()
                .map(array -> Arrays.stream(array).boxed().collect(Collectors.toList()))
                .flatMap(List::stream)
                .collect(Collectors.toList());
    }
}


text:
package org.optaplanner.core.api.score.buildin.simplebigdecimal;

import java.math.BigDecimal;

import org.kie.api.runtime.rule.RuleContext;
import org.optaplanner.core.api.score.Score;
import org.optaplanner.core.api.score.holder.AbstractScoreHolder;

/**
 * @see SimpleBigDecimalScore
 */
public class SimpleBigDecimalScoreHolder extends AbstractScoreHolder {

    protected BigDecimal score;

    public SimpleBigDecimalScoreHolder(boolean constraintMatchEnabled) {
        super(constraintMatchEnabled);
    }

    public BigDecimal getScore() {
        return score;
    }

    @Deprecated
    public void setScore(BigDecimal score) {
        this.score = score;
    }

    // ************************************************************************
    // Worker methods
    // ************************************************************************

    public void addConstraintMatch(RuleContext kcontext, final BigDecimal weight) {
        score = score.add(weight);
        registerBigDecimalConstraintMatch(kcontext, 0, weight, new Runnable() {
            public void run() {
                score = score.subtract(weight);
            }
        });
    }

    public Score extractScore() {
        return SimpleBigDecimalScore.valueOf(score);
    }

}


text:
package cn.byhieg.algorithmtutorialtest;

import cn.byhieg.algorithmtutorial.GraphMatrix;
import junit.framework.TestCase;

/**
 * Created by shiqifeng on 2017/4/5.
 * Mail byhieg@gmail.com
 */
public class GraphMatrixTest extends TestCase {

    GraphMatrix graphMatrix;
    GraphMatrix.Weight[][] weights;
    public void setUp() throws Exception {
        super.setUp();
        weights = new GraphMatrix.Weight[5][5];
        for (int i = 0 ; i < weights.length;i++)
            for (int j = 0 ; j < weights[i].length;j++){
                weights[i][j] = new GraphMatrix.Weight();
                weights[j][i] = new GraphMatrix.Weight();
            }

        weights[0][1] = new GraphMatrix.Weight(100);
        weights[1][2] = new GraphMatrix.Weight(10);
        weights[2][3] = new GraphMatrix.Weight(20);
        weights[3][1] = new GraphMatrix.Weight(25);
        weights[2][4] = new GraphMatrix.Weight(20);

        weights[1][0] = new GraphMatrix.Weight(100);
        weights[2][1] = new GraphMatrix.Weight(10);
        weights[3][2] = new GraphMatrix.Weight(20);
        weights[1][3] = new GraphMatrix.Weight(25);
        weights[4][2] = new GraphMatrix.Weight(20);

        graphMatrix = new GraphMatrix(weights);
    }

    public void tearDown() throws Exception {

    }

    public void testBFS() throws Exception {
        graphMatrix.BFS(4);

    }

    public void testDFS() throws Exception {
        graphMatrix.DFS(0);
    }

    public void testDijkstra() throws Exception {
        graphMatrix.dijkstra(1,2);
    }

}


text:
import ConfigParser
import logging
import os
import unittest

from pheme.util.config import Config, configure_logging

class TestConfig(unittest.TestCase):
    """Tests for the Config class"""

    # Bogus configuration files for test
    config_files = ('bogus.conf',
                    os.path.expanduser('~/bogus.conf'))

    def tearDown(self):
        # make sure we don't leave bogus config files around
        for f in self.config_files:
            try:
                os.remove(f)
            except:
                pass

    def test_absent(self):
        "no config files present shouldn't raise"
        c = Config(self.config_files)
        self.assertTrue(c)

    def test_override(self):
        "same key in second file should override"
        section = 'SECTION'
        key = 'unittest'
        for i in range(2):
            cp = ConfigParser.RawConfigParser()
            cp.add_section(section)
            cp.set(section, key, i)
            with open(self.config_files[i], 'w') as f:
                cp.write(f)
        c = Config(self.config_files)
        self.assertEquals(1, c.get(section, key))

    def test_truthiness(self):
        "truth value should be case insensitive"
        section = 'SECTION'
        key = 'unittest'
        values = ['TRUE', 'true', 'True', ' t ']
        cp = ConfigParser.RawConfigParser()
        cp.add_section(section)
        for i in range(len(values)):
            cp.set(section, key+str(i), values[i])
        with open(self.config_files[0], 'w') as f:
            cp.write(f)
        c = Config(self.config_files)
        for i in range(len(values)):
            self.assertEquals(True, c.get(section, key+str(i)))

    def test_falseness(self):
        "false values should be case insensitive"
        section = 'SECTION'
        key = 'unittest'
        values = ['FALSE', 'false', 'False', ' f ']
        cp = ConfigParser.RawConfigParser()
        cp.add_section(section)
        for i in range(len(values)):
            cp.set(section, key+str(i), values[i])
        with open(self.config_files[0], 'w') as f:
            cp.write(f)
        c = Config(self.config_files)
        for i in range(len(values)):
            self.assertEquals(False, c.get(section, key+str(i)))

    def test_default(self):
        "Asking for missing value with a default"
        c = Config(self.config_files)
        self.assertEquals(42, c.get('Lifes', 'Answer',  42))

    def test_float(self):
        "Looks like a float, should be one"
        section = 'SECTION'
        key = 'unittest'
        values = ['0.01', '42.0', '-67.3']
        cp = ConfigParser.RawConfigParser()
        cp.add_section(section)
        for i in range(len(values)):
            cp.set(section, key+str(i), values[i])
        with open(self.config_files[0], 'w') as f:
            cp.write(f)
        c = Config(self.config_files)
        for i in range(len(values)):
            self.assertEquals(float(values[i]),
                              c.get(section, key+str(i)))

    def test_int(self):
        "Looks like an int, should be one (including 0,1)"
        section = 'SECTION'
        key = 'unittest'
        values = ['0', '1', '-67', 42, -1]
        cp = ConfigParser.RawConfigParser()
        cp.add_section(section)
        for i in range(len(values)):
            cp.set(section, key+str(i), values[i])
        with open(self.config_files[0], 'w') as f:
            cp.write(f)
        c = Config(self.config_files)
        for i in range(len(values)):
            self.assertEquals(int(values[i]),
                              c.get(section, key+str(i)))

    def test_missing(self):
        "Asking for missing value without a default should raise"
        c = Config(self.config_files)
        self.assertRaises(RuntimeError, c.get, 'section', 'value')

    def test_tilde(self):
        "support tilde in directory paths"
        section = 'SECTION'
        key = 'unittest'
        value = "~/tempfile"
        cp = ConfigParser.RawConfigParser()
        cp.add_section(section)
        cp.set(section, key, value)
        with open(self.config_files[0], 'w') as f:
            cp.write(f)
        c = Config(self.config_files)
        self.assertEquals(os.path.expanduser("~/tempfile"),
                          c.get(section, key))

def test_configure_logging():
    logfile = configure_logging(verbosity=2, logfile='unittest.log',
                                append=False)
    logging.debug("just testing")
    # Thanks to nose working so hard to capture logging, it's quite
    # difficult to test - hand verified.
    assert(logfile == os.path.join(Config().get('general', 'log_dir'),
                                   'unittest.log'))

if '__main__' == __name__:  # pragma: no cover
    unittest.main()


text:
import { ChangeDetectorRef, Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AlertComponent, AlertConfig, AlertModule  } from '../index';

@Component({selector: 'alert-test', template: ''})
class TestAlertComponent extends AlertComponent {
  constructor(config: AlertConfig, changeDetection: ChangeDetectorRef) {
    super(config, changeDetection);
  }
}

describe('Component: Alert', () => {
  let fixture: ComponentFixture<TestAlertComponent>;
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  let context: any;
  const overTemplate = `

      <button *ngIf="dismissible" type="button" class="close btn-close" (click)="onClose()" (touch)="onClose()">
        ×
        Close
      </button>

  `;

  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [TestAlertComponent],
      imports: [AlertModule.forRoot()]
    });
    TestBed.overrideComponent(TestAlertComponent, {
      set: {template: overTemplate}
    });
    fixture = TestBed.createComponent(TestAlertComponent);
    context = fixture.debugElement.componentInstance;
    fixture.detectChanges();
  });

  it('should have a default type alert-warning', () => {
    context.ngOnInit();
    expect(context.type).toEqual(`warning`);
  });

  it('should have class dismissible if dismissible=true', () => {
    context.dismissible = true;
    context.ngOnInit();
    expect(context.classes).toEqual(`alert-dismissible`);
  });

  it('should be dismissed by timeout', (done: () => void) => {
    context.dismissOnTimeout = 1000;
    context.onClosed.subscribe(() => {
      expect(context.isOpen).toBeFalsy();
      done();
    });
    context.ngOnInit();
  });

  it('should be closed by public method onClose', () => {
    context.ngOnInit();
    expect(context.isOpen).toBeTruthy();
    context.close();
    expect(context.isOpen).toBeFalsy();
  });
});


text:
package elasticapi.elastic.smoketest

import elasticapi.elastic.ElasticApiChainBuilder
import gatling.blueprint.{ConfigurableSimulation, DefaultHttpProtocolBuilder}
import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder

class Test extends ConfigurableSimulation {

  private val elasticTsv = tsv(resolveFile("elastic.tsv"))

  val scenarioBuilder: ScenarioBuilder = scenario("Elastic Smoke Test")
    .repeat(elasticTsv.readRecords.length) {
      feed(elasticTsv.queue)
        .exec(
          ElasticApiChainBuilder.create("smoketest")
        )
    }

  setUp(scenarioBuilder.inject(atOnceUsers(1)))
    .protocols(DefaultHttpProtocolBuilder.create())
    .assertions(global.failedRequests.count.is(0))
}


text:
import Element from "core/Element"
import {TestAction,SyncComponentOption} from "./../vuex/actions"
import Component from "vue-class-component"
import {log,int} from "util/zUtil"
import {defaultOtion,getVueComponent} from "util/componentStrategy"
import zIndexCommon from "./zIndexCommon"
import $ from "jquery"
import Chart from "./Chart/index"
import Tables from "./Table/index"
import Zlay from "core/Zlay"
import RC from "util/ResourcesConfig"
@Component({
	props : {
		options:{
			type:Object,
			default: function () {
	           return { }
	        }
		},
		isView:{
			type : Boolean,
			default : true
		},
	},
    vuex:{
        getters:{
            screenParamSize : ({app}) => app.globalData.size
        },
		actions:{
			TestAction,SyncComponentOption
		}
	},
	components:{
		Chart,Tables
	},
	computed:{
		compH(){
			return this.h - 30
		}
	},
	template:`
		<Element :zid="zid" :maxnum='1' :w="w" :h="h" :x="x"  :y="y" >
			 <component v-ref:comps :is="compName" :option="myOption" :w="w" :h="compH"></component>
		</Element>
	`
})
export default class BaseComponent extends Element{
	data(){
		var compName = getVueComponent(this.options.content.type)
		return {
			compName:compName,
            myOption : {},
            isRunTime:true
		}
	}
    created(){
        this.myOption = Object.assign({component:{}},this.options);
        this.createComponent();

		var zid = this.zid ;
		if(Zlay.isRunTime){
			zid =  zid + "_view"
		}
		Zlay.Zids.push(zid);
        Zlay.Z[zid] = this;
    }
	ready(){
        this.initScreenSize();
	}

	createComponent(){
        let width = int( this.myOption.coordinate.width);
		let height = int( this.myOption.coordinate.height);
		let top = int( this.myOption.coordinate.y);
		let left = int( this.myOption.coordinate.x);
		this.w = width ;
        this.h = height ;
        this.x = left ;
        this.y = top;
        this.zid = this.myOption.zid;
		this.componentType = this.myOption.content.type;

        // 设置属性
		var op = defaultOtion(this.componentType,this.myOption);
        //log(op);
        // 同步到跟store
		this.SyncComponentOption(op);

        this.myOption = op;

        // 设置组件的zindex
        zIndexCommon.put($(this.$el),this.myOption.levelIndex)

	}

    // 初始化屏幕占比数 为自适应做处理
    initScreenSize(){
        var size = this.getBoundSize();
        var screenSize = {
            w : size.w,
            h : size.h ,
            left : size.left,
            top : size.top >= 50 ? size.top - 50 : size.top,
            containerH : this.isRunTime ? this.screenParamSize.height : size.parentHeight ,
            containerW : this.isRunTime ? this.screenParamSize.width :size.parentWidth
        }
		this.screenSize = screenSize;
    }

	// 加载数据
	loadDataSource(){
		var op, fn = function(){};
		var me = this;
		if(arguments.length){
			if(arguments.length == 1){
				if(typeof arguments[0] == "object"){
					op = arguments[0];
				}else{
					fn = arguments[0];
				}
			}else if(arguments.length ==2){
				op = arguments[0];
				fn = arguments[1];
			}
		}
		var datasets =[];

		if($.isArray(op)){
			datasets = op;
		}else{
			datasets = me.myOption.content.datasets;
		}
		// 主模块数据源 ,动态标题数据源
		var mainDs=[],textDs=[];
		if(datasets == null){
			return ;
		}
		datasets.forEach(function(it){
			if(it.type =="1"){
				//计算伸缩表格初始化行数
				if(me.componentType == RC.ZCOMP_TYPE.TABLE ){
					if(me.myOption.content.chartType == "z_table_showHide"){
						it.rows = Math.round($(window).height()/120-1);
					}
					//分页表格
					if(me.myOption.content.chartType== "z_table_page"){
						it.page = 1;
						it.rows = 10 ;
					}
				}
				mainDs.push(it);
			}else if(it.type == "2"){
				textDs.push(it);
			}
		});

		// 文本特殊查询textDs
		if(me.componentType == RC.ZCOMP_TYPE.TEXT){
			var isEmptyParam =false;
			textDs.forEach(function(it){
				if(it.paramStr.length == 0){
					isEmptyParam = true;
				}
			})
			Zlay.common.loadDataSource({datasets : textDs},function(reply){
				me.titleDidLoader && me.titleDidLoader(reply);
				(fn && typeof fn === "function" ) && fn();
			});
			return ;
		}

		Zlay.common.loadDataSource({datasets : mainDs},function(reply,type){
			mainCallback(reply,type);
		});

		function getCascadeData(type,data){
			// 2返回最后一个
			return type == 2 ? data[data.length-1] : data[0];
		}

		var mainCallback = function(reply,type){
			var replyData = reply.rows;
			// 获取当前级联选择方向
			var cascadeValueType = me.myOption.content.props.commonProp.cascadeValueType;
			cascadeValueType = (cascadeValueType == undefined || cascadeValueType == "") ? 1 : cascadeValueType;
			if(replyData && replyData.length){
				// 1 取首   2取 尾
				me.lastData  = getCascadeData(cascadeValueType,replyData);
			}else{
				reply.rows = [];
				me.lastData = Zlay.createCascadeEmpty();
			}
			if(me.option.component.chartType == "line"){
				// 特殊处理上下折线图
				var cascadeData = Zlay.handerLineFlagData(replyData);
				// 没有特殊字段 取最后一条记录
				cascadeData = cascadeData != null ?
					cascadeData :getCascadeData(cascadeValueType,replyData);
				window._echart_line_hoverData_X = cascadeData;
			}

			if(me.componentType == RC.ZCOMP_TYPE.TABLE){
				me.componentDidLoader(reply);
			}else{
				me.componentDidLoader(replyData);
			}

			if(textDs.length){
				Zlay.common.loadDataSource({datasets : textDs},function(reply){
					me._setTitleName(reply);
				});
			}else{
				me.initCompTitle();
			}
			(fn && typeof fn === "function" ) && fn();
		}
	}

	/**
	 * 设置组件标题
	 */
	initCompTitle(title){
		const me = this;
		const props = me.myOption.props ;
		if(me.myOption.titleName != "" ){

		}
	}

	resizeComponent(){

		this.$refs.comps.resize()
	}

	_setBound(){

	}

	resizeBox(){
		if(!this.isView)return ;
		if(this.componentType== RC.ZCOMP_TYPE.OTHER ){
			return ;
		}
		var ch = $(window).height(),
			cw = $(window).width();

		var screenParam = this.screenSize;
		var vectorH =  Math.floor((screenParam.h  * ch )/ screenParam.containerH);
		var vectorW = Math.floor((screenParam.w * cw ) /screenParam.containerW)  ;
		var vectorLeft = Math.floor((screenParam.left * cw )/ screenParam.containerW );
		var vectorTop =  Math.floor((screenParam.top * ch )/ screenParam.containerH );
//				console.log("旧top:"+screenParam.top);
//				console.log("旧高:"+screenParam.containerH + ",当前高:"+ch)
		vectorH = RC.ZELEMENT_MINH >= vectorH ? RC.ZELEMENT_MINH  : vectorH;
		vectorW = RC.ZELEMENT_MINW >= vectorW ? RC.ZELEMENT_MINW : vectorW;
//				vectorLeft = vectorLeft <= screenParam.left ? screenParam.left : vectorLeft ;
//				vectorTop = vectorTop <= screenParam.top ? screenParam.top : vectorTop ;
		vectorTop = vectorTop <= 0 ? 10 : vectorTop;
		vectorLeft = vectorLeft <= 0 ? 10 : vectorLeft;

		// 查询按钮最小left
		if(this.myOption.content.childType == RC.Z_SEARCH_COMPONENT.SUBMITBUTTON){
			if(vectorLeft<530){
				vectorLeft = 530;
			}
		}

		if( this.componentType == RC.ZCOMP_TYPE.SEARCH &&
			this.myOption.content.childType !==RC.Z_SEARCH_COMPONENT.TIME_PICKER){
			this.x = vectorLeft;
			this.y = vectorTop
		}else{
			// 变化前 left 与容器宽度比
			this.w = vectorW;
			this.h = vectorH;
			this.x = vectorLeft;
			this.y = vectorTop
		}

		this.resizeComponent();
	}

}


text:
<?
	if (isset($_SESSION['userID'])) {
		echo '';
		die();
	}
?>

<form id="login-form">

Login

	<input id="login-email" type="email" placeholder="Email Address" data-required="true">
	<input id="login-password" type="password" placeholder="Password" data-required="true">
	<button>Login</button>

</form>


text:
layout: post
title: "Number 2"
published: true
---

New

Enter text in [Markdown](http://daringfireball.net/projects/markdown/). Use the toolbar above, or click the **?** button for formatting help.


text:
BEGIN_HYPERDEX_NAMESPACE

class datatype_macaroon_secret : public datatype_info
{
    public:
        datatype_macaroon_secret();
        virtual ~datatype_macaroon_secret() throw ();

    public:
        virtual hyperdatatype datatype() const;
        virtual bool validate(const e::slice& value) const;
        virtual bool check_args(const funcall& func) const;
        virtual bool apply(const e::slice& old_value,
                           const funcall* funcs, size_t funcs_sz,
                           e::arena* new_memory,
                           e::slice* new_value) const;
};

END_HYPERDEX_NAMESPACE

#endif // hyperdex_common_datatype_macaroon_secret_h_