text:
#ifndef __HW_TIMER_H__
#define __HW_TIMER_H__

//*****************************************************************************
//
// The following are defines for the Timer register offsets.
//
//*****************************************************************************
#define TIMER_O_CFG             0x00000000  // GPTM Configuration
#define TIMER_O_TAMR            0x00000004  // GPTM Timer A Mode
#define TIMER_O_TBMR            0x00000008  // GPTM Timer B Mode
#define TIMER_O_CTL             0x0000000C  // GPTM Control
#define TIMER_O_SYNC            0x00000010  // GPTM Synchronize
#define TIMER_O_IMR             0x00000018  // GPTM Interrupt Mask
#define TIMER_O_RIS             0x0000001C  // GPTM Raw Interrupt Status
#define TIMER_O_MIS             0x00000020  // GPTM Masked Interrupt Status
#define TIMER_O_ICR             0x00000024  // GPTM Interrupt Clear
#define TIMER_O_TAILR           0x00000028  // GPTM Timer A Interval Load
#define TIMER_O_TBILR           0x0000002C  // GPTM Timer B Interval Load
#define TIMER_O_TAMATCHR        0x00000030  // GPTM Timer A Match
#define TIMER_O_TBMATCHR        0x00000034  // GPTM Timer B Match
#define TIMER_O_TAPR            0x00000038  // GPTM Timer A Prescale
#define TIMER_O_TBPR            0x0000003C  // GPTM Timer B Prescale
#define TIMER_O_TAPMR           0x00000040  // GPTM TimerA Prescale Match
#define TIMER_O_TBPMR           0x00000044  // GPTM TimerB Prescale Match
#define TIMER_O_TAR             0x00000048  // GPTM Timer A
#define TIMER_O_TBR             0x0000004C  // GPTM Timer B
#define TIMER_O_TAV             0x00000050  // GPTM Timer A Value
#define TIMER_O_TBV             0x00000054  // GPTM Timer B Value
#define TIMER_O_RTCPD           0x00000058  // GPTM RTC Predivide
#define TIMER_O_TAPS            0x0000005C  // GPTM Timer A Prescale Snapshot
#define TIMER_O_TBPS            0x00000060  // GPTM Timer B Prescale Snapshot
#define TIMER_O_TAPV            0x00000064  // GPTM Timer A Prescale Value
#define TIMER_O_TBPV            0x00000068  // GPTM Timer B Prescale Value
#define TIMER_O_PP              0x00000FC0  // GPTM Peripheral Properties

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_CFG register.
//
//*****************************************************************************
#define TIMER_CFG_M             0x00000007  // GPTM Configuration
#define TIMER_CFG_32_BIT_TIMER  0x00000000  // 32-bit timer configuration
#define TIMER_CFG_32_BIT_RTC    0x00000001  // 32-bit real-time clock (RTC)
                                            // counter configuration
#define TIMER_CFG_16_BIT        0x00000004  // 16-bit timer configuration. The
                                            // function is controlled by bits
                                            // 1:0 of GPTMTAMR and GPTMTBMR

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAMR register.
//
//*****************************************************************************
#define TIMER_TAMR_TAPLO        0x00000800  // GPTM Timer A PWM Legacy
                                            // Operation
#define TIMER_TAMR_TAMRSU       0x00000400  // GPTM Timer A Match Register
                                            // Update
#define TIMER_TAMR_TAPWMIE      0x00000200  // GPTM Timer A PWM Interrupt
                                            // Enable
#define TIMER_TAMR_TAILD        0x00000100  // GPTM Timer A Interval Load Write
#define TIMER_TAMR_TASNAPS      0x00000080  // GPTM Timer A Snap-Shot Mode
#define TIMER_TAMR_TAWOT        0x00000040  // GPTM Timer A Wait-on-Trigger
#define TIMER_TAMR_TAMIE        0x00000020  // GPTM Timer A Match Interrupt
                                            // Enable
#define TIMER_TAMR_TACDIR       0x00000010  // GPTM Timer A Count Direction
#define TIMER_TAMR_TAAMS        0x00000008  // GPTM Timer A Alternate Mode
                                            // Select
#define TIMER_TAMR_TACMR        0x00000004  // GPTM Timer A Capture Mode
#define TIMER_TAMR_TAMR_M       0x00000003  // GPTM Timer A Mode
#define TIMER_TAMR_TAMR_1_SHOT  0x00000001  // One-Shot Timer mode
#define TIMER_TAMR_TAMR_PERIOD  0x00000002  // Periodic Timer mode
#define TIMER_TAMR_TAMR_CAP     0x00000003  // Capture mode

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBMR register.
//
//*****************************************************************************
#define TIMER_TBMR_TBPLO        0x00000800  // GPTM Timer B PWM Legacy
                                            // Operation
#define TIMER_TBMR_TBMRSU       0x00000400  // GPTM Timer B Match Register
                                            // Update
#define TIMER_TBMR_TBPWMIE      0x00000200  // GPTM Timer B PWM Interrupt
                                            // Enable
#define TIMER_TBMR_TBILD        0x00000100  // GPTM Timer B Interval Load Write
#define TIMER_TBMR_TBSNAPS      0x00000080  // GPTM Timer B Snap-Shot Mode
#define TIMER_TBMR_TBWOT        0x00000040  // GPTM Timer B Wait-on-Trigger
#define TIMER_TBMR_TBMIE        0x00000020  // GPTM Timer B Match Interrupt
                                            // Enable
#define TIMER_TBMR_TBCDIR       0x00000010  // GPTM Timer B Count Direction
#define TIMER_TBMR_TBAMS        0x00000008  // GPTM Timer B Alternate Mode
                                            // Select
#define TIMER_TBMR_TBCMR        0x00000004  // GPTM Timer B Capture Mode
#define TIMER_TBMR_TBMR_M       0x00000003  // GPTM Timer B Mode
#define TIMER_TBMR_TBMR_1_SHOT  0x00000001  // One-Shot Timer mode
#define TIMER_TBMR_TBMR_PERIOD  0x00000002  // Periodic Timer mode
#define TIMER_TBMR_TBMR_CAP     0x00000003  // Capture mode

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_CTL register.
//
//*****************************************************************************
#define TIMER_CTL_TBPWML        0x00004000  // GPTM Timer B PWM Output Level
#define TIMER_CTL_TBOTE         0x00002000  // GPTM Timer B Output Trigger
                                            // Enable
#define TIMER_CTL_TBEVENT_M     0x00000C00  // GPTM Timer B Event Mode
#define TIMER_CTL_TBEVENT_POS   0x00000000  // Positive edge
#define TIMER_CTL_TBEVENT_NEG   0x00000400  // Negative edge
#define TIMER_CTL_TBEVENT_BOTH  0x00000C00  // Both edges
#define TIMER_CTL_TBSTALL       0x00000200  // GPTM Timer B Stall Enable
#define TIMER_CTL_TBEN          0x00000100  // GPTM Timer B Enable
#define TIMER_CTL_TAPWML        0x00000040  // GPTM Timer A PWM Output Level
#define TIMER_CTL_TAOTE         0x00000020  // GPTM Timer A Output Trigger
                                            // Enable
#define TIMER_CTL_RTCEN         0x00000010  // GPTM RTC Enable
#define TIMER_CTL_TAEVENT_M     0x0000000C  // GPTM Timer A Event Mode
#define TIMER_CTL_TAEVENT_POS   0x00000000  // Positive edge
#define TIMER_CTL_TAEVENT_NEG   0x00000004  // Negative edge
#define TIMER_CTL_TAEVENT_BOTH  0x0000000C  // Both edges
#define TIMER_CTL_TASTALL       0x00000002  // GPTM Timer A Stall Enable
#define TIMER_CTL_TAEN          0x00000001  // GPTM Timer A Enable

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_SYNC register.
//
//*****************************************************************************
#define TIMER_SYNC_SYNCWT5_M    0x00C00000  // Synchronize GPTM 32/64-Bit Timer
                                            // 5
#define TIMER_SYNC_SYNCWT5_NONE 0x00000000  // GPTM 32/64-Bit Timer 5 is not
                                            // affected
#define TIMER_SYNC_SYNCWT5_TA   0x00400000  // A timeout event for Timer A of
                                            // GPTM 32/64-Bit Timer 5 is
                                            // triggered
#define TIMER_SYNC_SYNCWT5_TB   0x00800000  // A timeout event for Timer B of
                                            // GPTM 32/64-Bit Timer 5 is
                                            // triggered
#define TIMER_SYNC_SYNCWT5_TATB 0x00C00000  // A timeout event for both Timer A
                                            // and Timer B of GPTM 32/64-Bit
                                            // Timer 5 is triggered
#define TIMER_SYNC_SYNCWT4_M    0x00300000  // Synchronize GPTM 32/64-Bit Timer
                                            // 4
#define TIMER_SYNC_SYNCWT4_NONE 0x00000000  // GPTM 32/64-Bit Timer 4 is not
                                            // affected
#define TIMER_SYNC_SYNCWT4_TA   0x00100000  // A timeout event for Timer A of
                                            // GPTM 32/64-Bit Timer 4 is
                                            // triggered
#define TIMER_SYNC_SYNCWT4_TB   0x00200000  // A timeout event for Timer B of
                                            // GPTM 32/64-Bit Timer 4 is
                                            // triggered
#define TIMER_SYNC_SYNCWT4_TATB 0x00300000  // A timeout event for both Timer A
                                            // and Timer B of GPTM 32/64-Bit
                                            // Timer 4 is triggered
#define TIMER_SYNC_SYNCWT3_M    0x000C0000  // Synchronize GPTM 32/64-Bit Timer
                                            // 3
#define TIMER_SYNC_SYNCWT3_NONE 0x00000000  // GPTM 32/64-Bit Timer 3 is not
                                            // affected
#define TIMER_SYNC_SYNCWT3_TA   0x00040000  // A timeout event for Timer A of
                                            // GPTM 32/64-Bit Timer 3 is
                                            // triggered
#define TIMER_SYNC_SYNCWT3_TB   0x00080000  // A timeout event for Timer B of
                                            // GPTM 32/64-Bit Timer 3 is
                                            // triggered
#define TIMER_SYNC_SYNCWT3_TATB 0x000C0000  // A timeout event for both Timer A
                                            // and Timer B of GPTM 32/64-Bit
                                            // Timer 3 is triggered
#define TIMER_SYNC_SYNCWT2_M    0x00030000  // Synchronize GPTM 32/64-Bit Timer
                                            // 2
#define TIMER_SYNC_SYNCWT2_NONE 0x00000000  // GPTM 32/64-Bit Timer 2 is not
                                            // affected
#define TIMER_SYNC_SYNCWT2_TA   0x00010000  // A timeout event for Timer A of
                                            // GPTM 32/64-Bit Timer 2 is
                                            // triggered
#define TIMER_SYNC_SYNCWT2_TB   0x00020000  // A timeout event for Timer B of
                                            // GPTM 32/64-Bit Timer 2 is
                                            // triggered
#define TIMER_SYNC_SYNCWT2_TATB 0x00030000  // A timeout event for both Timer A
                                            // and Timer B of GPTM 32/64-Bit
                                            // Timer 2 is triggered
#define TIMER_SYNC_SYNCWT1_M    0x0000C000  // Synchronize GPTM 32/64-Bit Timer
                                            // 1
#define TIMER_SYNC_SYNCWT1_NONE 0x00000000  // GPTM 32/64-Bit Timer 1 is not
                                            // affected
#define TIMER_SYNC_SYNCWT1_TA   0x00004000  // A timeout event for Timer A of
                                            // GPTM 32/64-Bit Timer 1 is
                                            // triggered
#define TIMER_SYNC_SYNCWT1_TB   0x00008000  // A timeout event for Timer B of
                                            // GPTM 32/64-Bit Timer 1 is
                                            // triggered
#define TIMER_SYNC_SYNCWT1_TATB 0x0000C000  // A timeout event for both Timer A
                                            // and Timer B of GPTM 32/64-Bit
                                            // Timer 1 is triggered
#define TIMER_SYNC_SYNCWT0_M    0x00003000  // Synchronize GPTM 32/64-Bit Timer
                                            // 0
#define TIMER_SYNC_SYNCWT0_NONE 0x00000000  // GPTM 32/64-Bit Timer 0 is not
                                            // affected
#define TIMER_SYNC_SYNCWT0_TA   0x00001000  // A timeout event for Timer A of
                                            // GPTM 32/64-Bit Timer 0 is
                                            // triggered
#define TIMER_SYNC_SYNCWT0_TB   0x00002000  // A timeout event for Timer B of
                                            // GPTM 32/64-Bit Timer 0 is
                                            // triggered
#define TIMER_SYNC_SYNCWT0_TATB 0x00003000  // A timeout event for both Timer A
                                            // and Timer B of GPTM 32/64-Bit
                                            // Timer 0 is triggered
#define TIMER_SYNC_SYNCT5_M     0x00000C00  // Synchronize GPTM 16/32-Bit Timer
                                            // 5
#define TIMER_SYNC_SYNCT5_NONE  0x00000000  // GPTM 16/32-Bit Timer 5 is not
                                            // affected
#define TIMER_SYNC_SYNCT5_TA    0x00000400  // A timeout event for Timer A of
                                            // GPTM 16/32-Bit Timer 5 is
                                            // triggered
#define TIMER_SYNC_SYNCT5_TB    0x00000800  // A timeout event for Timer B of
                                            // GPTM 16/32-Bit Timer 5 is
                                            // triggered
#define TIMER_SYNC_SYNCT5_TATB  0x00000C00  // A timeout event for both Timer A
                                            // and Timer B of GPTM 16/32-Bit
                                            // Timer 5 is triggered
#define TIMER_SYNC_SYNCT4_M     0x00000300  // Synchronize GPTM 16/32-Bit Timer
                                            // 4
#define TIMER_SYNC_SYNCT4_NONE  0x00000000  // GPTM 16/32-Bit Timer 4 is not
                                            // affected
#define TIMER_SYNC_SYNCT4_TA    0x00000100  // A timeout event for Timer A of
                                            // GPTM 16/32-Bit Timer 4 is
                                            // triggered
#define TIMER_SYNC_SYNCT4_TB    0x00000200  // A timeout event for Timer B of
                                            // GPTM 16/32-Bit Timer 4 is
                                            // triggered
#define TIMER_SYNC_SYNCT4_TATB  0x00000300  // A timeout event for both Timer A
                                            // and Timer B of GPTM 16/32-Bit
                                            // Timer 4 is triggered
#define TIMER_SYNC_SYNCT3_M     0x000000C0  // Synchronize GPTM 16/32-Bit Timer
                                            // 3
#define TIMER_SYNC_SYNCT3_NONE  0x00000000  // GPTM 16/32-Bit Timer 3 is not
                                            // affected
#define TIMER_SYNC_SYNCT3_TA    0x00000040  // A timeout event for Timer A of
                                            // GPTM 16/32-Bit Timer 3 is
                                            // triggered
#define TIMER_SYNC_SYNCT3_TB    0x00000080  // A timeout event for Timer B of
                                            // GPTM 16/32-Bit Timer 3 is
                                            // triggered
#define TIMER_SYNC_SYNCT3_TATB  0x000000C0  // A timeout event for both Timer A
                                            // and Timer B of GPTM 16/32-Bit
                                            // Timer 3 is triggered
#define TIMER_SYNC_SYNCT2_M     0x00000030  // Synchronize GPTM 16/32-Bit Timer
                                            // 2
#define TIMER_SYNC_SYNCT2_NONE  0x00000000  // GPTM 16/32-Bit Timer 2 is not
                                            // affected
#define TIMER_SYNC_SYNCT2_TA    0x00000010  // A timeout event for Timer A of
                                            // GPTM 16/32-Bit Timer 2 is
                                            // triggered
#define TIMER_SYNC_SYNCT2_TB    0x00000020  // A timeout event for Timer B of
                                            // GPTM 16/32-Bit Timer 2 is
                                            // triggered
#define TIMER_SYNC_SYNCT2_TATB  0x00000030  // A timeout event for both Timer A
                                            // and Timer B of GPTM 16/32-Bit
                                            // Timer 2 is triggered
#define TIMER_SYNC_SYNCT1_M     0x0000000C  // Synchronize GPTM 16/32-Bit Timer
                                            // 1
#define TIMER_SYNC_SYNCT1_NONE  0x00000000  // GPTM 16/32-Bit Timer 1 is not
                                            // affected
#define TIMER_SYNC_SYNCT1_TA    0x00000004  // A timeout event for Timer A of
                                            // GPTM 16/32-Bit Timer 1 is
                                            // triggered
#define TIMER_SYNC_SYNCT1_TB    0x00000008  // A timeout event for Timer B of
                                            // GPTM 16/32-Bit Timer 1 is
                                            // triggered
#define TIMER_SYNC_SYNCT1_TATB  0x0000000C  // A timeout event for both Timer A
                                            // and Timer B of GPTM 16/32-Bit
                                            // Timer 1 is triggered
#define TIMER_SYNC_SYNCT0_M     0x00000003  // Synchronize GPTM 16/32-Bit Timer
                                            // 0
#define TIMER_SYNC_SYNCT0_NONE  0x00000000  // GPTM 16/32-Bit Timer 0 is not
                                            // affected
#define TIMER_SYNC_SYNCT0_TA    0x00000001  // A timeout event for Timer A of
                                            // GPTM 16/32-Bit Timer 0 is
                                            // triggered
#define TIMER_SYNC_SYNCT0_TB    0x00000002  // A timeout event for Timer B of
                                            // GPTM 16/32-Bit Timer 0 is
                                            // triggered
#define TIMER_SYNC_SYNCT0_TATB  0x00000003  // A timeout event for both Timer A
                                            // and Timer B of GPTM 16/32-Bit
                                            // Timer 0 is triggered

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_IMR register.
//
//*****************************************************************************
#define TIMER_IMR_WUEIM         0x00010000  // 32/64-Bit GPTM Write Update
                                            // Error Interrupt Mask
#define TIMER_IMR_TBMIM         0x00000800  // GPTM Timer B Mode Match
                                            // Interrupt Mask
#define TIMER_IMR_CBEIM         0x00000400  // GPTM Capture B Event Interrupt
                                            // Mask
#define TIMER_IMR_CBMIM         0x00000200  // GPTM Capture B Match Interrupt
                                            // Mask
#define TIMER_IMR_TBTOIM        0x00000100  // GPTM Timer B Time-Out Interrupt
                                            // Mask
#define TIMER_IMR_TAMIM         0x00000010  // GPTM Timer A Mode Match
                                            // Interrupt Mask
#define TIMER_IMR_RTCIM         0x00000008  // GPTM RTC Interrupt Mask
#define TIMER_IMR_CAEIM         0x00000004  // GPTM Capture A Event Interrupt
                                            // Mask
#define TIMER_IMR_CAMIM         0x00000002  // GPTM Capture A Match Interrupt
                                            // Mask
#define TIMER_IMR_TATOIM        0x00000001  // GPTM Timer A Time-Out Interrupt
                                            // Mask

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_RIS register.
//
//*****************************************************************************
#define TIMER_RIS_WUERIS        0x00010000  // 32/64-Bit GPTM Write Update
                                            // Error Raw Interrupt Status
#define TIMER_RIS_TBMRIS        0x00000800  // GPTM Timer B Mode Match Raw
                                            // Interrupt
#define TIMER_RIS_CBERIS        0x00000400  // GPTM Capture B Event Raw
                                            // Interrupt
#define TIMER_RIS_CBMRIS        0x00000200  // GPTM Capture B Match Raw
                                            // Interrupt
#define TIMER_RIS_TBTORIS       0x00000100  // GPTM Timer B Time-Out Raw
                                            // Interrupt
#define TIMER_RIS_TAMRIS        0x00000010  // GPTM Timer A Mode Match Raw
                                            // Interrupt
#define TIMER_RIS_RTCRIS        0x00000008  // GPTM RTC Raw Interrupt
#define TIMER_RIS_CAERIS        0x00000004  // GPTM Capture A Event Raw
                                            // Interrupt
#define TIMER_RIS_CAMRIS        0x00000002  // GPTM Capture A Match Raw
                                            // Interrupt
#define TIMER_RIS_TATORIS       0x00000001  // GPTM Timer A Time-Out Raw
                                            // Interrupt

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_MIS register.
//
//*****************************************************************************
#define TIMER_MIS_WUEMIS        0x00010000  // 32/64-Bit GPTM Write Update
                                            // Error Masked Interrupt Status
#define TIMER_MIS_TBMMIS        0x00000800  // GPTM Timer B Mode Match Masked
                                            // Interrupt
#define TIMER_MIS_CBEMIS        0x00000400  // GPTM Capture B Event Masked
                                            // Interrupt
#define TIMER_MIS_CBMMIS        0x00000200  // GPTM Capture B Match Masked
                                            // Interrupt
#define TIMER_MIS_TBTOMIS       0x00000100  // GPTM Timer B Time-Out Masked
                                            // Interrupt
#define TIMER_MIS_TAMMIS        0x00000010  // GPTM Timer A Mode Match Masked
                                            // Interrupt
#define TIMER_MIS_RTCMIS        0x00000008  // GPTM RTC Masked Interrupt
#define TIMER_MIS_CAEMIS        0x00000004  // GPTM Capture A Event Masked
                                            // Interrupt
#define TIMER_MIS_CAMMIS        0x00000002  // GPTM Capture A Match Masked
                                            // Interrupt
#define TIMER_MIS_TATOMIS       0x00000001  // GPTM Timer A Time-Out Masked
                                            // Interrupt

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_ICR register.
//
//*****************************************************************************
#define TIMER_ICR_WUECINT       0x00010000  // 32/64-Bit GPTM Write Update
                                            // Error Interrupt Clear
#define TIMER_ICR_TBMCINT       0x00000800  // GPTM Timer B Mode Match
                                            // Interrupt Clear
#define TIMER_ICR_CBECINT       0x00000400  // GPTM Capture B Event Interrupt
                                            // Clear
#define TIMER_ICR_CBMCINT       0x00000200  // GPTM Capture B Match Interrupt
                                            // Clear
#define TIMER_ICR_TBTOCINT      0x00000100  // GPTM Timer B Time-Out Interrupt
                                            // Clear
#define TIMER_ICR_TAMCINT       0x00000010  // GPTM Timer A Mode Match
                                            // Interrupt Clear
#define TIMER_ICR_RTCCINT       0x00000008  // GPTM RTC Interrupt Clear
#define TIMER_ICR_CAECINT       0x00000004  // GPTM Capture A Event Interrupt
                                            // Clear
#define TIMER_ICR_CAMCINT       0x00000002  // GPTM Capture A Match Interrupt
                                            // Clear
#define TIMER_ICR_TATOCINT      0x00000001  // GPTM Timer A Time-Out Raw
                                            // Interrupt

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAILR register.
//
//*****************************************************************************
#define TIMER_TAILR_M           0xFFFFFFFF  // GPTM Timer A Interval Load
                                            // Register
#define TIMER_TAILR_TAILRH_M    0xFFFF0000  // GPTM Timer A Interval Load
                                            // Register High
#define TIMER_TAILR_TAILRL_M    0x0000FFFF  // GPTM Timer A Interval Load
                                            // Register Low
#define TIMER_TAILR_TAILRH_S    16
#define TIMER_TAILR_TAILRL_S    0
#define TIMER_TAILR_S           0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBILR register.
//
//*****************************************************************************
#define TIMER_TBILR_M           0xFFFFFFFF  // GPTM Timer B Interval Load
                                            // Register
#define TIMER_TBILR_TBILRL_M    0x0000FFFF  // GPTM Timer B Interval Load
                                            // Register
#define TIMER_TBILR_TBILRL_S    0
#define TIMER_TBILR_S           0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAMATCHR
// register.
//
//*****************************************************************************
#define TIMER_TAMATCHR_TAMR_M   0xFFFFFFFF  // GPTM Timer A Match Register
#define TIMER_TAMATCHR_TAMRH_M  0xFFFF0000  // GPTM Timer A Match Register High
#define TIMER_TAMATCHR_TAMRL_M  0x0000FFFF  // GPTM Timer A Match Register Low
#define TIMER_TAMATCHR_TAMRH_S  16
#define TIMER_TAMATCHR_TAMRL_S  0
#define TIMER_TAMATCHR_TAMR_S   0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBMATCHR
// register.
//
//*****************************************************************************
#define TIMER_TBMATCHR_TBMR_M   0xFFFFFFFF  // GPTM Timer B Match Register
#define TIMER_TBMATCHR_TBMRL_M  0x0000FFFF  // GPTM Timer B Match Register Low
#define TIMER_TBMATCHR_TBMR_S   0
#define TIMER_TBMATCHR_TBMRL_S  0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAPR register.
//
//*****************************************************************************
#define TIMER_TAPR_TAPSRH_M     0x0000FF00  // GPTM Timer A Prescale High Byte
#define TIMER_TAPR_TAPSR_M      0x000000FF  // GPTM Timer A Prescale
#define TIMER_TAPR_TAPSRH_S     8
#define TIMER_TAPR_TAPSR_S      0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBPR register.
//
//*****************************************************************************
#define TIMER_TBPR_TBPSRH_M     0x0000FF00  // GPTM Timer B Prescale High Byte
#define TIMER_TBPR_TBPSR_M      0x000000FF  // GPTM Timer B Prescale
#define TIMER_TBPR_TBPSRH_S     8
#define TIMER_TBPR_TBPSR_S      0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAPMR register.
//
//*****************************************************************************
#define TIMER_TAPMR_TAPSMRH_M   0x0000FF00  // GPTM Timer A Prescale Match High
                                            // Byte
#define TIMER_TAPMR_TAPSMR_M    0x000000FF  // GPTM TimerA Prescale Match
#define TIMER_TAPMR_TAPSMRH_S   8
#define TIMER_TAPMR_TAPSMR_S    0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBPMR register.
//
//*****************************************************************************
#define TIMER_TBPMR_TBPSMRH_M   0x0000FF00  // GPTM Timer B Prescale Match High
                                            // Byte
#define TIMER_TBPMR_TBPSMR_M    0x000000FF  // GPTM TimerB Prescale Match
#define TIMER_TBPMR_TBPSMRH_S   8
#define TIMER_TBPMR_TBPSMR_S    0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAR register.
//
//*****************************************************************************
#define TIMER_TAR_M             0xFFFFFFFF  // GPTM Timer A Register
#define TIMER_TAR_TARH_M        0xFFFF0000  // GPTM Timer A Register High
#define TIMER_TAR_TARL_M        0x0000FFFF  // GPTM Timer A Register Low
#define TIMER_TAR_TARH_S        16
#define TIMER_TAR_TARL_S        0
#define TIMER_TAR_S             0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBR register.
//
//*****************************************************************************
#define TIMER_TBR_M             0xFFFFFFFF  // GPTM Timer B Register
#define TIMER_TBR_TBRL_M        0x00FFFFFF  // GPTM Timer B
#define TIMER_TBR_TBRL_S        0
#define TIMER_TBR_S             0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAV register.
//
//*****************************************************************************
#define TIMER_TAV_M             0xFFFFFFFF  // GPTM Timer A Value
#define TIMER_TAV_TAVH_M        0xFFFF0000  // GPTM Timer A Value High
#define TIMER_TAV_TAVL_M        0x0000FFFF  // GPTM Timer A Register Low
#define TIMER_TAV_TAVH_S        16
#define TIMER_TAV_TAVL_S        0
#define TIMER_TAV_S             0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBV register.
//
//*****************************************************************************
#define TIMER_TBV_M             0xFFFFFFFF  // GPTM Timer B Value
#define TIMER_TBV_TBVL_M        0x0000FFFF  // GPTM Timer B Register
#define TIMER_TBV_TBVL_S        0
#define TIMER_TBV_S             0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_RTCPD register.
//
//*****************************************************************************
#define TIMER_RTCPD_RTCPD_M     0x0000FFFF  // RTC Predivide Counter Value
#define TIMER_RTCPD_RTCPD_S     0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAPS register.
//
//*****************************************************************************
#define TIMER_TAPS_PSS_M        0x0000FFFF  // GPTM Timer A Prescaler Snapshot
#define TIMER_TAPS_PSS_S        0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBPS register.
//
//*****************************************************************************
#define TIMER_TBPS_PSS_M        0x0000FFFF  // GPTM Timer A Prescaler Value
#define TIMER_TBPS_PSS_S        0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TAPV register.
//
//*****************************************************************************
#define TIMER_TAPV_PSV_M        0x0000FFFF  // GPTM Timer A Prescaler Value
#define TIMER_TAPV_PSV_S        0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_TBPV register.
//
//*****************************************************************************
#define TIMER_TBPV_PSV_M        0x0000FFFF  // GPTM Timer B Prescaler Value
#define TIMER_TBPV_PSV_S        0

//*****************************************************************************
//
// The following are defines for the bit fields in the TIMER_O_PP register.
//
//*****************************************************************************
#define TIMER_PP_SIZE_M         0x0000000F  // Count Size
#define TIMER_PP_SIZE_16        0x00000000  // Timer A and Timer B counters are
                                            // 16 bits each with an 8-bit
                                            // prescale counter
#define TIMER_PP_SIZE_32        0x00000001  // Timer A and Timer B counters are
                                            // 32 bits each with a 16-bit
                                            // prescale counter

//*****************************************************************************
//
// The following definitions are deprecated.
//
//*****************************************************************************
#ifndef DEPRECATED

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_CFG
// register.
//
//*****************************************************************************
#define TIMER_CFG_CFG_MSK       0x00000007  // Configuration options mask

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_CTL
// register.
//
//*****************************************************************************
#define TIMER_CTL_TBEVENT_MSK   0x00000C00  // TimerB event mode mask
#define TIMER_CTL_TAEVENT_MSK   0x0000000C  // TimerA event mode mask

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_RIS
// register.
//
//*****************************************************************************
#define TIMER_RIS_CBEMIS        0x00000400  // CaptureB event masked int status
#define TIMER_RIS_CBMMIS        0x00000200  // CaptureB match masked int status
#define TIMER_RIS_TBTOMIS       0x00000100  // TimerB time out masked int stat
#define TIMER_RIS_RTCMIS        0x00000008  // RTC masked int status
#define TIMER_RIS_CAEMIS        0x00000004  // CaptureA event masked int status
#define TIMER_RIS_CAMMIS        0x00000002  // CaptureA match masked int status
#define TIMER_RIS_TATOMIS       0x00000001  // TimerA time out masked int stat

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_TAILR
// register.
//
//*****************************************************************************
#define TIMER_TAILR_TAILRH      0xFFFF0000  // TimerB load val in 32 bit mode
#define TIMER_TAILR_TAILRL      0x0000FFFF  // TimerA interval load value

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_TBILR
// register.
//
//*****************************************************************************
#define TIMER_TBILR_TBILRL      0x0000FFFF  // TimerB interval load value

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the
// TIMER_O_TAMATCHR register.
//
//*****************************************************************************
#define TIMER_TAMATCHR_TAMRH    0xFFFF0000  // TimerB match val in 32 bit mode
#define TIMER_TAMATCHR_TAMRL    0x0000FFFF  // TimerA match value

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the
// TIMER_O_TBMATCHR register.
//
//*****************************************************************************
#define TIMER_TBMATCHR_TBMRL    0x0000FFFF  // TimerB match load value

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_TAR
// register.
//
//*****************************************************************************
#define TIMER_TAR_TARH          0xFFFF0000  // TimerB val in 32 bit mode
#define TIMER_TAR_TARL          0x0000FFFF  // TimerA value

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_O_TBR
// register.
//
//*****************************************************************************
#define TIMER_TBR_TBRL          0x0000FFFF  // TimerB value

//*****************************************************************************
//
// The following are deprecated defines for the reset values of the timer
// registers.
//
//*****************************************************************************
#define TIMER_RV_TAILR          0xFFFFFFFF  // TimerA interval load reg RV
#define TIMER_RV_TAR            0xFFFFFFFF  // TimerA register RV
#define TIMER_RV_TAMATCHR       0xFFFFFFFF  // TimerA match register RV
#define TIMER_RV_TBILR          0x0000FFFF  // TimerB interval load reg RV
#define TIMER_RV_TBMATCHR       0x0000FFFF  // TimerB match register RV
#define TIMER_RV_TBR            0x0000FFFF  // TimerB register RV
#define TIMER_RV_TAPR           0x00000000  // TimerA prescale register RV
#define TIMER_RV_CFG            0x00000000  // Configuration register RV
#define TIMER_RV_TBPMR          0x00000000  // TimerB prescale match regi RV
#define TIMER_RV_TAPMR          0x00000000  // TimerA prescale match reg RV
#define TIMER_RV_CTL            0x00000000  // Control register RV
#define TIMER_RV_ICR            0x00000000  // Interrupt clear register RV
#define TIMER_RV_TBMR           0x00000000  // TimerB mode register RV
#define TIMER_RV_MIS            0x00000000  // Masked interrupt status reg RV
#define TIMER_RV_RIS            0x00000000  // Interrupt status register RV
#define TIMER_RV_TBPR           0x00000000  // TimerB prescale register RV
#define TIMER_RV_IMR            0x00000000  // Interrupt mask register RV
#define TIMER_RV_TAMR           0x00000000  // TimerA mode register RV

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_TnMR
// register.
//
//*****************************************************************************
#define TIMER_TNMR_TNAMS        0x00000008  // Alternate mode select
#define TIMER_TNMR_TNCMR        0x00000004  // Capture mode - count or time
#define TIMER_TNMR_TNTMR_MSK    0x00000003  // Timer mode mask
#define TIMER_TNMR_TNTMR_1_SHOT 0x00000001  // Mode - one shot
#define TIMER_TNMR_TNTMR_PERIOD 0x00000002  // Mode - periodic
#define TIMER_TNMR_TNTMR_CAP    0x00000003  // Mode - capture

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_TnPR
// register.
//
//*****************************************************************************
#define TIMER_TNPR_TNPSR        0x000000FF  // TimerN prescale value

//*****************************************************************************
//
// The following are deprecated defines for the bit fields in the TIMER_TnPMR
// register.
//
//*****************************************************************************
#define TIMER_TNPMR_TNPSMR      0x000000FF  // TimerN prescale match value

#endif

#endif // __HW_TIMER_H__


text:
---
components: CssBaseline, ScopedCssBaseline
githubLabel: 'component: CssBaseline'
---

# CSS Baseline

Material-UI oferece um componente CSS Base a fim de inciar uma elegante, consistente e simples base para construção de aplicativos.

[A paleta](/system/palette/) com funções de estilo.

## Reset global

Você já deve estar familiarizado com [normalize.css](https://github.com/necolas/normalize.css), uma coleção de elementos HTML e normas de atributos de estilo.

```jsx
import * as React from 'react';
import CssBaseline from '@material-ui/core/CssBaseline';

export default function MyApp() {
  return (
    <React. Fragment>
      <CssBaseline />
      {/* O resto da sua aplicação */}
    </React. Fragment>
  );
}
```

## Escopando componentes filhos

No entanto, você pode estar migrando progressivamente um site para Material-UI, usar um reset global pode não ser uma opção. É possível aplicar a baseline apenas aos filhos usando o componente `ScopedCssBaseline`.

```jsx
import * as React from 'react';
import ScopedCssBaseline from '@material-ui/core/ScopedCssBaseline';
import MyApp from './MyApp';

export default function MyApp() {
  return (
    <ScopedCssBaseline>
      {/* O resto da sua aplicação */}
      <MyApp />
    </ScopedCssBaseline>
  );
}
```

⚠ Certifique-se de importar `ScopedCssBaseline` primeiro para evitar conflitos de box-sizing, como no exemplo acima.

## Abordagem

### Página

Os elementos `<html>` e `<body>` são atualizados para fornecer melhores padrões para toda a página. Mais especificamente:

- A margem é removida em todos navegadores.
- A cor de fundo padrão do material design é aplicada. Isto usando [`theme.palette.background.default`](/customization/default-theme/?expand-path=$.palette.background) para dispositivos padrão e um fundo branco para dispositivos de impressão.

### Leiaute

- `box-sizing` é definido globalmente no elemento `<html>` para `border-box`. Todos elementos—incluindo `*::before` e `*::after` são declarados para herdar essa propriedade, que garante que a largura declarada do elemento nunca seja excedida devido ao preenchimento da borda.

### Barras de rolagem

No modo escuro, as cores das barras de rolagem são personalizadas para fornecer uma contraste melhor.

### Tipografia

- Nenhum tamanho de fonte base é declarado no `<html>`, mas 16px é assumido (o padrão do navegador). Você pode aprender mais sobre as implicações da mudança do padrão de tamanho da fonte do `<html>` na página de [documentação do tema](/customization/typography/#typography-html-font-size).
- Define o estilo `theme.typography.body2` no elemento `<body>`.
- Define o font-weight para `theme.typography.fontWeightBold` em elementos `<b>` e `<strong>`.
- Uma customização da suavização da fonte (font-smoothing) é ativada para melhor exibição da fonte Roboto.

## Customização

Vá até a seção de [customização global](/customization/how-to-customize/#5-global-css-override) da documentação para alterar o comportamento desses componentes.

redpajama_set_name: RedPajamaGithub


text:
package me.ykrank.s1next.view.adapter;

import android.app.Activity;

import me.ykrank.s1next.view.adapter.delegate.DarkRoomAdapterDelegate;

public final class DarkRoomRecyclerViewAdapter extends BaseRecyclerViewAdapter {

    public DarkRoomRecyclerViewAdapter(Activity activity) {
        super(activity);

        addAdapterDelegate(new DarkRoomAdapterDelegate(activity));
    }
}


text:
'use strict';

RMModule.factory('RMExtendedApi', ['$q', function($q) {

  /**
   * @class ExtendedApi
   *
   * @description
   *
   * Provides a common framework **on top** of the {@link RecordApi} and {@link CollectionApi}.
   *
   * @property {boolean} $resolved The collection resolve status, is undefined on intialization
   */
  return {

    // override decode to detect resolution of resource
    $decode: function(_raw, _mask) {
      if(this.$resolved === false && this.$clear) this.$clear(); // clear if not resolved.
      this.$super(_raw, _mask);
      this.$resolved = true;
      return this;
    },

    /**
     * @memberof ExtendedApi#
     *
     * @description Resets the resource's $resolved status.
     *
     * After being reset, calls to `$resolve` will execute a new $fetch.
     *
     * Also, if reset, resource will be cleared on new data.
     *
     * @return {ExtendedApi} self
     */
    $reset: function() {
      this.$cancel(); // TODO: find another way of ignoring pending requests that will lead to resolution
      this.$resolved = false;
      return this;
    },

    /**
     * @memberof ExtendedApi#
     *
     * @description Resolves the resource's contents.
     *
     * If already resolved then this method will return a resolved promise, if not then
     * it will initiate a `$fetch` operation and return the operation promise.
     *
     * This method will trigger a `before-resolve` event before checking the resolve status.
     *
     * @param  {object} _params `$fetch` params
     * @return {promise} Promise that resolves to the resource.
     */
    $resolve: function(_params) {
      return this.$then(function() { // chain resolution in request promise chain
        this.$dispatch('before-resolve', []);
        if(!this.$resolved) this.$fetch(_params);
      });
    },

    /**
     * @memberof ExtendedApi#
     *
     * @description Resets and fetches the resource contents.
     *
     * @param  {object} _params `$fetch` params
     * @return {ExtendedApi} self
     */
    $refresh: function(_params) {
      return this.$reset().$fetch(_params);
    }
  };

}]);


text:
Article 1397-6
----
Le changement de régime matrimonial prend effet entre les parties à dater de la
décision ou de l'acte qui le prévoit et, à l'égard des tiers, trois mois après
que les formalités de publicité prévues à l'article 1397-5 auront été
accomplies.

Toutefois, en l'absence d'accomplissement de ces formalités, le changement de
régime matrimonial est opposable aux tiers si, dans les actes passés avec eux,
les époux ont déclaré avoir modifié leur régime matrimonial.


text:
import { AnimationKeyFrames } from './animation-interface';

let animationPrefix: string | undefined;

/**
 * Web Animations requires hyphenated CSS properties
 * to be written in camelCase when animating
 */
export const processKeyframes = (keyframes: AnimationKeyFrames) => {
  keyframes.forEach(keyframe => {
    for (const key in keyframe) {
      if (keyframe.hasOwnProperty(key)) {
        const value = keyframe[key];

        if (key === 'easing') {
          const newKey = 'animation-timing-function';
          keyframe[newKey] = value;
          delete keyframe[key];
        } else {
          const newKey = convertCamelCaseToHypen(key);

          if (newKey !== key) {
            keyframe[newKey] = value;
            delete keyframe[key];
          }
        }
      }
    }
  });

  return keyframes;
};

const convertCamelCaseToHypen = (str: string) => {
  return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
};

export const getAnimationPrefix = (el: HTMLElement): string => {
  if (animationPrefix === undefined) {
    const supportsUnprefixed = (el.style as any).animationName !== undefined;
    const supportsWebkitPrefix = (el.style as any).webkitAnimationName !== undefined;
    animationPrefix = (!supportsUnprefixed && supportsWebkitPrefix) ? '-webkit-' : '';
  }
  return animationPrefix;
};

export const setStyleProperty = (element: HTMLElement, propertyName: string, value: string | null) => {
  const prefix = propertyName.startsWith('animation') ? getAnimationPrefix(element) : '';
  element.style.setProperty(prefix + propertyName, value);
};

export const removeStyleProperty = (element: HTMLElement, propertyName: string) => {
  const prefix = propertyName.startsWith('animation') ? getAnimationPrefix(element) : '';
  element.style.removeProperty(prefix + propertyName);
};

export const animationEnd = (el: HTMLElement | null, callback: (ev?: TransitionEvent) => void) => {
  let unRegTrans: (() => void) | undefined;
  const opts: any = { passive: true };

  const unregister = () => {
    if (unRegTrans) {
      unRegTrans();
    }
  };

  const onTransitionEnd = (ev: Event) => {
    if (el === ev.target) {
      unregister();
      callback(ev as TransitionEvent);
    }
  };

  if (el) {
    el.addEventListener('webkitAnimationEnd', onTransitionEnd, opts);
    el.addEventListener('animationend', onTransitionEnd, opts);

    unRegTrans = () => {
      el.removeEventListener('webkitAnimationEnd', onTransitionEnd, opts);
      el.removeEventListener('animationend', onTransitionEnd, opts);
    };
  }

  return unregister;
};

export const generateKeyframeRules = (keyframes: any[] = []) => {
  return keyframes.map(keyframe => {
    const offset = keyframe.offset;

    const frameString = [];
    for (const property in keyframe) {
      if (keyframe.hasOwnProperty(property) && property !== 'offset') {
        frameString.push(`${property}: ${keyframe[property]};`);
      }
    }

    return `${offset * 100}% { ${frameString.join(' ')} }`;
  }).join(' ');
};

const keyframeIds: string[] = [];

export const generateKeyframeName = (keyframeRules: string) => {
  let index = keyframeIds.indexOf(keyframeRules);
  if (index < 0) {
    index = (keyframeIds.push(keyframeRules) - 1);
  }
  return `ion-animation-${index}`;
};

export const getStyleContainer = (element: HTMLElement) => {
  const rootNode = (element.getRootNode() as any);
  return (rootNode.head || rootNode);
};

export const createKeyframeStylesheet = (keyframeName: string, keyframeRules: string, element: HTMLElement): HTMLElement => {
  const styleContainer = getStyleContainer(element);
  const keyframePrefix = getAnimationPrefix(element);

  const existingStylesheet = styleContainer.querySelector('#' + keyframeName);
  if (existingStylesheet) {
    return existingStylesheet;
  }

  const stylesheet = (element.ownerDocument || document).createElement('style');
  stylesheet.id = keyframeName;
  stylesheet.textContent = `@${keyframePrefix}keyframes ${keyframeName} { ${keyframeRules} } @${keyframePrefix}keyframes ${keyframeName}-alt { ${keyframeRules} }`;

  styleContainer.appendChild(stylesheet);

  return stylesheet;
};

export const addClassToArray = (classes: string[] = [], className: string | string[] | undefined): string[] => {
  if (className !== undefined) {
    const classNameToAppend = (Array.isArray(className)) ? className : [className];

    return [...classes, ...classNameToAppend];
  }

  return classes;
};


text:
class ChromeBrowserState;

namespace send_tab_to_self {
class SendTabToSelfSyncService;
}  // namespace send_tab_to_self

// Singleton that owns all SendTabToSelfSyncService and associates them with
// ChromeBrowserState.
class SendTabToSelfSyncServiceFactory : public BrowserStateKeyedServiceFactory {
 public:
  static send_tab_to_self::SendTabToSelfSyncService* GetForBrowserState(
      ChromeBrowserState* browser_state);

  static SendTabToSelfSyncServiceFactory* GetInstance();

  // Returns the default factory used to build SendTabToSelfSyncService. Can be
  // registered with SetTestingFactory to use real instances during testing.
  static TestingFactory GetDefaultFactory();

  SendTabToSelfSyncServiceFactory(const SendTabToSelfSyncServiceFactory&) =
      delete;
  SendTabToSelfSyncServiceFactory& operator=(
      const SendTabToSelfSyncServiceFactory&) = delete;

 private:
  friend class base::NoDestructor<SendTabToSelfSyncServiceFactory>;

  SendTabToSelfSyncServiceFactory();
  ~SendTabToSelfSyncServiceFactory() override;

  // BrowserStateKeyedServiceFactory implementation.
  std::unique_ptr<KeyedService> BuildServiceInstanceFor(
      web::BrowserState* context) const override;
};

#endif  // IOS_CHROME_BROWSER_SYNC_SEND_TAB_TO_SELF_SYNC_SERVICE_FACTORY_H_


text:
this_environment
================
*retrieving the environment of the calling function*

Sometimes in C++ it's useful to know where a Lua call is coming from and what :doc:`environment<environment>` it is from. The former is covered by Lua's Debug API, which is extensive and is not fully wrapped up by sol2. But, sol2 covers the latter in letting you get the environment of the calling script / function, if it has one. ``sol::this_environment`` is a *transparent argument* and does not need to be passed in Lua scripts or provided when using :doc:`sol::function<function>`, similar to :doc:`sol::this_state<this_state>`:

.. code-block:: cpp
	:linenos:

	#define SOL_ALL_SAFETIES_ON
	#include <sol/sol.hpp>

	#include <iostream>

	void env_check(sol::this_state ts, int x, sol::this_environment te) {
		std::cout << "In C++, 'int x' is in the second position, and its value is: " << x << std::endl;
		if (!te) {
			std::cout << "function does not have an environment: exiting function early" << std::endl;
			return;
		}
		sol::environment& env = te;
		sol::state_view lua = ts;
		sol::environment freshenv = lua["freshenv"];
		bool is_same_env = freshenv == env;
		std::cout << "env == freshenv : " << is_same_env << std::endl;
	}

	int main() {
		sol::state lua;
		sol::environment freshenv(lua, sol::create, lua.globals());
		lua["freshenv"] = freshenv;

		lua.set_function("f", env_check);

		// note that "f" only takes 1 argument and is okay here
		lua.script("f(25)", freshenv);

		return 0;
	}

Also see `this example`_ for more details.

.. _this example: https://github.com/ThePhD/sol2/blob/develop/examples/source/environment_snooping.cpp


text:
using System.Linq;
using System.ServiceModel;

namespace Chiro.Cdf.Authentication.Backend
{
    /// <summary>
    /// Authenticatie voor de WCF-backend.
    ///
    /// Het AD-nummer wordt opgehaald uit de informatie in Chiro.Cdf.AdnrWcfExtension.
    /// </summary>
    public class BackendAuthenticator: IAuthenticator
    {
        public UserInfo WieBenIk()
        {
            var userInfo = OperationContext.Current.IncomingMessageProperties.FirstOrDefault(f => f.Key == "UserInfo").Value as UserInfo;

            if (userInfo != null)
            {
                return userInfo;
            }

            // Onder windows kom je hier normaal gesproken nooit.

            // Maar met Linux en Mono krijg ik de servicebehaviour met de IDispatchMessageInspector (nog?) niet aan de
            // praat. Dus voorlopig probeer ik de UserInfo nog eens rechtstreeks uit de http-request te halen,
            // maar op termijn moet dit zeker weg.

            var headers = OperationContext.Current.IncomingMessageHeaders;

            try
            {
                userInfo = headers.GetHeader<UserInfo>("adnr-header", "s");
            }
            catch (MessageHeaderException)
            {
                return null;
            }

            return userInfo;
        }
    }
}


text:
using System;
using Floobits.Common;
using Floobits.Common.Protocol;

namespace Floobits.Common.Protocol.Json.Send
{
    [Serializable]
    public abstract class InitialBase : Base
    {
        public string platform = Environment.OSVersion.ToString();
        public string version = Constants.version;
        public string client = "C# client"; //TODO ApplicationImpl.getClientName();
    }
}


text:
package org.cloudfoundry.client.v3.roles;

import org.cloudfoundry.client.v3.Relationship;
import org.cloudfoundry.client.v3.ToOneRelationship;
import org.junit.Test;

public class CreateRoleRequestTest {

    @Test(expected = IllegalStateException.class)
    public void invalidWithMissingOrgRelationship() {
        CreateRoleRequest.builder()
            .type(RoleType.ORGANIZATION_AUDITOR)
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .build())
            .build();
    }

    @Test(expected = IllegalStateException.class)
    public void invalidWithMissingSpaceRelationship() {
        CreateRoleRequest.builder()
            .type(RoleType.SPACE_AUDITOR)
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .build())
            .build();
    }

    @Test(expected = IllegalStateException.class)
    public void invalidWithNoRelationships() {
        CreateRoleRequest.builder()
            .type(RoleType.ORGANIZATION_AUDITOR)
            .build();
    }

    @Test(expected = IllegalStateException.class)
    public void invalidWithOrgRelationship() {
        CreateRoleRequest.builder()
            .type(RoleType.SPACE_AUDITOR)
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .organization(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-org-id")
                        .build())
                    .build())
                .build())
            .build();
    }

    @Test(expected = IllegalStateException.class)
    public void invalidWithSpaceRelationship() {
        CreateRoleRequest.builder()
            .type(RoleType.ORGANIZATION_AUDITOR)
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .space(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-space-id")
                        .build())
                    .build())
                .build())
            .build();
    }

    @Test(expected = IllegalStateException.class)
    public void invalidWithoutType() {
        CreateRoleRequest.builder()
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .build())
            .build();
    }

    @Test
    public void validOrgRole() {
        CreateRoleRequest.builder()
            .type(RoleType.ORGANIZATION_AUDITOR)
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .organization(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-org-id")
                        .build())
                    .build())
                .build())
            .build();
    }

    @Test
    public void validSpaceRole() {
        CreateRoleRequest.builder()
            .type(RoleType.SPACE_AUDITOR)
            .relationships(RoleRelationships.builder()
                .user(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-user-id")
                        .build())
                    .build())
                .space(ToOneRelationship.builder()
                    .data(Relationship.builder()
                        .id("test-space-id")
                        .build())
                    .build())
                .build())
            .build();
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TangramSkApp
{
    class ViewRegion
    {
        int x_offset;
        int y_offset;
        int width;
        int height;
        int device_width;
        int device_height;
        float[,] matrix;

        public ViewRegion(int x_offset, int y_offset, int width, int height,int device_width, int device_height)
        {
            this.x_offset = x_offset;
            this.y_offset = y_offset;
            this.width = width;
            this.height = height;
            this.device_width = device_width;
            this.device_height = device_height;
        }

        public float[,] getMatrix()
        {
            return matrix;
        }

        public bool setMatrix(float[,] matrix)
        {
            if (matrix.GetLength(0) == this.width && matrix.GetLength(1) == this.height)
            {
                this.matrix = matrix;
                return true;
            }
            else return false;
        }

        public int getXOffset()
        {
            return x_offset;
        }

        public int getYOffset()
        {
            return y_offset;
        }

        public void setXOffset(int value)
        {
            if (value < device_width)
                x_offset = value;
            if (x_offset + width > device_width)
                width = device_width - x_offset;
        }

        public void setYOffset(int value)
        {
            if (value < device_height)
                y_offset = value;
            if (y_offset + height > device_height)
                width = device_height - y_offset;
        }

        public int getWidth()
        {
            return width;
        }

        public void setWidth(int value)
        {
            if (x_offset + value < device_width)
                width = value;
            else
                width = device_width - x_offset;
        }

        public int getHeight()
        {
            return height;
        }

        public void setHeight(int value)
        {
            if (y_offset + value < device_height)
                height = value;
            else
                height = device_width - y_offset;
        }

    }
}


text:
const DEFAULT_SORRY = "¯\\_(ツ)_/¯ Sorry, I don't know what to do!";

export default (
    sendTextMessage: (text: string) => Promise<any>,
): Promise<string> =>
    sendTextMessage(DEFAULT_SORRY)
        .then(() => "response by sorry message");


text:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Xml;
using krsclient.net.Exception;
using System.Data.Common;

namespace krsclient.net.Persist
{
    /// <summary>
    /// Klasse der håndtere gemning af Records
    /// </summary>
    class RecordDao
    {
        private readonly DbConnection _connection;

        public RecordDao(DbConnection connection)
        {
            _connection = connection;
        }

        /// <summary>
        /// Opretter forbindelse til database og persistere alle records.
        /// </summary>
        /// <param name="records">Rækker der ønskes persisteret</param>
        /// <param name="tableSpecification">Specifikation der beskriver hvordan de ønskede rækker skal indsættes</param>
        /// <returns>Antallet af rækker der var opdateret i databasen</returns>
        public uint PersistRecords(Record[] records, TableSpecification tableSpecification)
        {
            uint updated = 0;
            _connection.Open();
            DbTransaction transaction = _connection.BeginTransaction();
            try
            {
                DbCommand command = _connection.CreateCommand();
                command.Connection = _connection;
                command.Transaction = transaction;

                foreach (var record in records)
                {
                    if (InsertOrUpdateRecord(record, tableSpecification, command))
                        updated++;
                }
                transaction.Commit();
            }
            catch (System.Exception)
            {
                transaction.Rollback();
                throw;
            }
            finally
            {
                _connection.Close();
            }
            return updated;
        }

        /// <summary>
        /// Konverter en modtagen streng værdi til en type efter regel angivet i felt specifikationen.
        /// </summary>
        /// <param name="fieldSpecification">Felt specifikation</param>
        /// <param name="fieldValue">Felt værdi</param>
        /// <returns>Object af korrekt type</returns>
        private static Object ConvertToProperType(TableSpecification.FieldSpecification fieldSpecification,
            String fieldValue)
        {
            if (fieldValue == null) return DBNull.Value;
            switch (fieldSpecification.Type)
            {
                case TableSpecification.FieldSpecification.FieldDataType.String:
                    return fieldValue;
                case TableSpecification.FieldSpecification.FieldDataType.Int:
                    return Int32.Parse(fieldValue);
                case TableSpecification.FieldSpecification.FieldDataType.Float:
                    return Double.Parse(fieldValue);
                case TableSpecification.FieldSpecification.FieldDataType.BigInt:
                    return Int64.Parse(fieldValue);
                case TableSpecification.FieldSpecification.FieldDataType.Boolean:
                    return "1".Equals(fieldValue) ? true : false;
                case TableSpecification.FieldSpecification.FieldDataType.Decimal:
                    return Decimal.Parse(fieldValue);
                case TableSpecification.FieldSpecification.FieldDataType.Date:
                case TableSpecification.FieldSpecification.FieldDataType.Datetime:
                    return XmlConvert.ToDateTime(fieldValue, XmlDateTimeSerializationMode.RoundtripKind);
            }
            throw new InvalidSpecificationException("Field specification: "+ fieldSpecification.SourceName +" maps to unknown type");
        }

        /// <summary>
        /// Indsæt eller opdater en enkelt række
        /// </summary>
        /// <param name="record">Række der skal indsættes eller opdateres</param>
        /// <param name="tableSpecification">Specifikation der beskriver hvordan de ønskede rækker skal indsættes</param>
        /// <param name="command">Et command object der er klar til at køre statements med</param>
        /// <returns></returns>
        private static bool InsertOrUpdateRecord(Record record, TableSpecification tableSpecification,
            DbCommand command)
        {
            // Opbyg en streng afhængig af om det drejer sig om en insert eller en update.
            command.CommandText =
                RecordExists(tableSpecification, record, command) ?
                    BuildUpdateStatement(tableSpecification, record) :
                    BuildInsertStatement(tableSpecification, record);

            // Det statement der er opbygget har alle parametre sat som @<SourceNavn>
            // Sæt alle værdier på statement
            foreach (KeyValuePair<string, string> keyValuePair in record.FieldValues)
            {
                TableSpecification.FieldSpecification fieldSpec =
                    tableSpecification.GetFieldSpecificationForSourceName(keyValuePair.Key);
                // Der behøver ikke findes en fieldspec hvis man ikke ønsker at gemme feltet.
                if (fieldSpec != null)
                {
                    Object properValue = ConvertToProperType(fieldSpec, keyValuePair.Value);
                    AddParamWithValue(command, "@" + keyValuePair.Key, properValue);
                }
            }
            int modifiedRows = command.ExecuteNonQuery();
            command.Parameters.Clear();
            if (modifiedRows > 0)
                return true;
            return false;
        }

        /// <summary>
        /// Byg et update statement
        /// </summary>
        /// <param name="tableSpecification"></param>
        /// <param name="record"></param>
        /// <returns>Det byggede update statement</returns>
        private static string BuildUpdateStatement(TableSpecification tableSpecification, Record record)
        {
            string targetTableName = tableSpecification.TargetTableName;

            var sqlBuilder = new StringBuilder();
            sqlBuilder.Append("UPDATE ").Append(targetTableName).Append(" SET ");
            foreach (var currentField in record.FieldValues)
            {
                TableSpecification.FieldSpecification fieldSpec =
                    tableSpecification.GetFieldSpecificationForSourceName(currentField.Key);
                if (fieldSpec != null)
                {
                    String targetColumnName = fieldSpec.TargetName;
                    sqlBuilder.Append(targetColumnName).Append("=@").Append(currentField.Key);
                    sqlBuilder.Append(",");
                }
            }
            // Fjern det ekstra komma
            sqlBuilder.Remove(sqlBuilder.Length - 1, 1);

            var validFromFieldSpec = tableSpecification.GetValidFromField();
            var idFieldSpec = tableSpecification.GetIdentifierField();

            // "Semi" lækker where clause opbygning...

            // TargetName er navn på kolonnen i vores database, SourceName er nøglen i input record
            sqlBuilder.Append(" WHERE ").Append(validFromFieldSpec.TargetName).Append("=@").Append(validFromFieldSpec.SourceName);
            sqlBuilder.Append(" AND ").Append(idFieldSpec.TargetName).Append("=@").Append(idFieldSpec.SourceName);

            return sqlBuilder.ToString();
        }

        /// <summary>
        /// Byg et insert statement
        /// </summary>
        /// <param name="tableSpecification"></param>
        /// <param name="record"></param>
        /// <returns>Strent med det byggede insert statement</returns>
        private static String BuildInsertStatement(TableSpecification tableSpecification, Record record)
        {
            string targetTableName = tableSpecification.TargetTableName;

            var sqlBuilder = new StringBuilder();
            var valuesBuilder = new StringBuilder();

            sqlBuilder.Append("INSERT INTO ").Append(targetTableName).Append("(");
            for (int i = 0; i < record.FieldValues.Count; i++)
            {
                String currentKey = record.FieldValues.Keys[i];
                TableSpecification.FieldSpecification fieldSpecificationForSourceName =
                    tableSpecification.GetFieldSpecificationForSourceName(currentKey);
                if (fieldSpecificationForSourceName != null)
                {
                    sqlBuilder.Append(fieldSpecificationForSourceName.TargetName).Append(",");
                    valuesBuilder.Append("@").Append(currentKey).Append(",");
                }
            }
            sqlBuilder.Remove(sqlBuilder.Length - 1, 1);
            valuesBuilder.Remove(valuesBuilder.Length - 1, 1);
            sqlBuilder.Append(") VALUES(").Append(valuesBuilder).Append(")");
            return sqlBuilder.ToString();
        }

        /// <summary>
        /// Undersøg om en række allerede eksistere i databasen.
        /// </summary>
        /// <param name="tableSpecification">Register specifikation</param>
        /// <param name="record">Række der skal tjekkes om findes i forvejen</param>
        /// <param name="command">Et command object der er klar til at køre statements med</param>
        /// <returns>true hvis rækken allerede findes i databasen</returns>
        private static bool RecordExists(TableSpecification tableSpecification,
            Record record, DbCommand command)
        {

            var identifierField = tableSpecification.GetIdentifierField();
            var validFromField = tableSpecification.GetValidFromField();
            if (identifierField == null || validFromField == null)
                throw new InvalidSpecificationException(tableSpecification, "ValidFrom or Identifier field is not set");

            object validFromValue = ConvertToProperType(validFromField, record.ValueOfFieldNamed(validFromField.SourceName));
            object identifier = ConvertToProperType(identifierField, record.ValueOfFieldNamed(identifierField.SourceName));

            command.CommandText = "SELECT COUNT(1) FROM "+tableSpecification.TargetTableName +
                                  " WHERE " + validFromField.TargetName + "=@ValidFrom AND " +
                                  identifierField.TargetName + "=@Identifier";
            AddParamWithValue(command, "@ValidFrom", validFromValue);
            AddParamWithValue(command, "@Identifier", identifier);

            var count = (Int32) command.ExecuteScalar();
            command.Parameters.Clear();
            return count > 0;
        }

        private static void AddParamWithValue(DbCommand command, string name, object value)
        {
            var param = command.CreateParameter();
            param.ParameterName = name;
            param.Value = value;
            command.Parameters.Add(param);
        }

    }

}


text:
namespace WDK.API.CouchDb
{
	public class DocumentInfo
	{
		public string Id;
		public string Revision;
	}
}


text:
var gulp = require('gulp'),
    browserSync = require('browser-sync'),
    runSequence = require('run-sequence'),
    del = require('del'),
    //使用gulp-lad-plugins,自动加载pageage.json中devDependencies节点内容
    plugins = require('gulp-load-plugins')(),
    //定义刷新插件
    reload = require('browser-sync').reload;

var tsProject = plugins.typescript.createProject("tsconfig.json");

var paths = {
    src: "./src",
    dist: "./dist",
    srcJs: "./src/js",
    distJs: "./dist/js"
};

//注册browserSync
gulp.task('browserSync', function() {
    browserSync.init({
        server: [paths.dist]
    });

    //修改js,刷新页面
    var watchScript = gulp.watch([paths.srcJs + '/**/*.ts'], ['myts', reload]);

});

gulp.task('myts',['clean'],function() {
    return gulp.src(["./src/js/**/*.ts"])
        .pipe(tsProject())
        //压缩代码,发布时需要放开注释
        //.pipe(plugins.uglify())
        .pipe(plugins.revEasy({ revType: 'hash', hashLength: 7 })) //添加版本号.
        .pipe(gulp.dest(paths.distJs));
});

//并发
gulp.task('runSequence', function() {
    return runSequence(['clean'], ['myts'], ['browserSync']);
});

//清空生成目录
gulp.task('clean', function() {
    return del(
        [paths.dist]
    );
});

gulp.task('ts', ['myts']);

gulp.task('default', ['runSequence']);


text:
package com.google.api.ads.adwords.jaxws.v201509.cm;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;

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

 *

 * <simpleType name="BatchJobStatus">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="UNKNOWN"/>
 *     <enumeration value="AWAITING_FILE"/>
 *     <enumeration value="ACTIVE"/>
 *     <enumeration value="CANCELING"/>
 *     <enumeration value="CANCELED"/>
 *     <enumeration value="DONE"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "BatchJobStatus")
@XmlEnum
public enum BatchJobStatus {

    /**
     *
     *                 Used for return value only. An enumeration could not be processed, typically due to incompatibility with your WSDL version.
     *
     *
     */
    UNKNOWN,

    /**
     *
     *                 Initial state of a BatchJob. While a job has this status, it is awaiting a file
     *                 upload to Google Cloud Storage.
     *
     *
     */
    AWAITING_FILE,

    /**
     *
     *                 Indicates that a job has an associated file and is being executed.
     *
     *
     */
    ACTIVE,

    /**
     *
     *                 Indicates that a job is being canceled. It will remain in this status until any
     *                 partial results are written, and then will be marked CANCELED. This status is
     *                 not supported in SET operations.
     *
     *
     */
    CANCELING,

    /**
     *
     *                 Indicates that a job has been canceled. It will be garbage-collected 30 days
     *                 after cancellation. This status is not currently supported in SET operations.
     *
     *
     */
    CANCELED,

    /**
     *
     *                 Indicates that a job has completed. It will be garbage-collected 30 days after
     *                 completion.
     *
     *
     */
    DONE;

    public String value() {
        return name();
    }

    public static BatchJobStatus fromValue(String v) {
        return valueOf(v);
    }

}


text:
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <boost/exception/exception.hpp>
#include <stdexcept>
#include <string>

namespace
boost
    {
    namespace
    exception_test
        {
        void
        throw_length_error()
            {
            throw enable_error_info( std::length_error("exception test length error") );
            }
        }
    }


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!DOCTYPE Test SYSTEM "test.dtd">
<!--
Author:  Alexander V. Esin
Version: $Revision: 1.2 $
-->
<Test
  ID="field05"
  date-of-creation="2006-07-11"
  timeout="1"
  >
  <Author value="Alexander V. Esin"/>
  <Description>
    Checks that VM loads and instantiates class with a field of array type
    of 255 dimension and no errors or exceptions are thrown.
    Covered assertions assert_class130_01
  </Description>

  <Keyword name="JVMS3ed_specific"/>
  <Keyword name="spec_clarification"/>

  <Source name="field05p.j"/>

  <Runner ID="Runtime">
    <Param name="toRun" value="org.apache.harmony.vts.test.vm.jvms.share.vmVerifierRun">
          <Option name="instantiate"/>
          <Option name="org.apache.harmony.vts.test.vm.jvms.classFile.descriptors.field.field05.field05p"/>
    </Param>
  </Runner>
</Test>