text
stringlengths 2
100k
| meta
dict |
---|---|
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_wrHy0JTeEeSJk7nCt-yWGA" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="DataOutput_Simple" isExecutable="false">
<bpmn2:ioSpecification id="InputOutputSpecification_1">
<bpmn2:dataOutput id="DataOutput_1"/>
</bpmn2:ioSpecification>
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:task id="Task_1">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:dataOutputAssociation id="DataOutputAssociation_1">
<bpmn2:targetRef>DataOutput_1</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:task>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Task_1"/>
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="Task_1" targetRef="EndEvent_1"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_49" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="236.0" y="199.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_9" bpmnElement="Task_1">
<dc:Bounds height="80.0" width="100.0" x="322.0" y="177.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_49" targetElement="_BPMNShape_Task_9">
<di:waypoint xsi:type="dc:Point" x="272.0" y="217.0"/>
<di:waypoint xsi:type="dc:Point" x="322.0" y="217.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_47" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="472.0" y="199.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_Task_9" targetElement="_BPMNShape_EndEvent_47">
<di:waypoint xsi:type="dc:Point" x="422.0" y="217.0"/>
<di:waypoint xsi:type="dc:Point" x="472.0" y="217.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_DataOutput_3" bpmnElement="DataOutput_1">
<dc:Bounds height="50.0" width="36.0" x="472.0" y="288.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="490.0" y="343.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation_1" bpmnElement="DataOutputAssociation_1" sourceElement="_BPMNShape_Task_9" targetElement="_BPMNShape_DataOutput_3">
<di:waypoint xsi:type="dc:Point" x="372.0" y="257.0"/>
<di:waypoint xsi:type="dc:Point" x="372.0" y="312.0"/>
<di:waypoint xsi:type="dc:Point" x="472.0" y="313.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions> | {
"pile_set_name": "Github"
} |
action.copycode=Másol
action.copycontent=Másol
action.save=Ment
SaveAction.filename=qrcode-{0}.png
SaveAction.filetype=Képek
SaveAction.types=Képek
QrToolBuilder.title = Szöveg átvitele
QrToolBuilder.subtitle = Írj és szkennelj szöveget a készülékre. Kattints a kódra további lehetõségekért
QrToolBuilder.empty = Írj a szövegmezõbe a szöveg módosításához
ShareToolBuilder.title=Fájl átvitele
ShareToolBuilder.subtitle=Fájlok vizsgálata az átvitelhet. Kattints a kódra további lehetõségekért.
ShareToolBuilder.transfer=Vizsgálat az átvitelhez
ShareToolBuilder.control=Ellenõrzés
ShareToolBuilder.nofiles=Nincs kiválasztva fájl!
| {
"pile_set_name": "Github"
} |
/*
* ARM v8.3-PAuth Operations
*
* Copyright (c) 2019 Linaro, Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
#include "cpu.h"
#include "internals.h"
#include "exec/exec-all.h"
#include "exec/cpu_ldst.h"
#include "exec/helper-proto.h"
#include "tcg/tcg-gvec-desc.h"
static uint64_t pac_cell_shuffle(uint64_t i)
{
uint64_t o = 0;
o |= extract64(i, 52, 4);
o |= extract64(i, 24, 4) << 4;
o |= extract64(i, 44, 4) << 8;
o |= extract64(i, 0, 4) << 12;
o |= extract64(i, 28, 4) << 16;
o |= extract64(i, 48, 4) << 20;
o |= extract64(i, 4, 4) << 24;
o |= extract64(i, 40, 4) << 28;
o |= extract64(i, 32, 4) << 32;
o |= extract64(i, 12, 4) << 36;
o |= extract64(i, 56, 4) << 40;
o |= extract64(i, 20, 4) << 44;
o |= extract64(i, 8, 4) << 48;
o |= extract64(i, 36, 4) << 52;
o |= extract64(i, 16, 4) << 56;
o |= extract64(i, 60, 4) << 60;
return o;
}
static uint64_t pac_cell_inv_shuffle(uint64_t i)
{
uint64_t o = 0;
o |= extract64(i, 12, 4);
o |= extract64(i, 24, 4) << 4;
o |= extract64(i, 48, 4) << 8;
o |= extract64(i, 36, 4) << 12;
o |= extract64(i, 56, 4) << 16;
o |= extract64(i, 44, 4) << 20;
o |= extract64(i, 4, 4) << 24;
o |= extract64(i, 16, 4) << 28;
o |= i & MAKE_64BIT_MASK(32, 4);
o |= extract64(i, 52, 4) << 36;
o |= extract64(i, 28, 4) << 40;
o |= extract64(i, 8, 4) << 44;
o |= extract64(i, 20, 4) << 48;
o |= extract64(i, 0, 4) << 52;
o |= extract64(i, 40, 4) << 56;
o |= i & MAKE_64BIT_MASK(60, 4);
return o;
}
static uint64_t pac_sub(uint64_t i)
{
static const uint8_t sub[16] = {
0xb, 0x6, 0x8, 0xf, 0xc, 0x0, 0x9, 0xe,
0x3, 0x7, 0x4, 0x5, 0xd, 0x2, 0x1, 0xa,
};
uint64_t o = 0;
int b;
for (b = 0; b < 64; b += 16) {
o |= (uint64_t)sub[(i >> b) & 0xf] << b;
}
return o;
}
static uint64_t pac_inv_sub(uint64_t i)
{
static const uint8_t inv_sub[16] = {
0x5, 0xe, 0xd, 0x8, 0xa, 0xb, 0x1, 0x9,
0x2, 0x6, 0xf, 0x0, 0x4, 0xc, 0x7, 0x3,
};
uint64_t o = 0;
int b;
for (b = 0; b < 64; b += 16) {
o |= (uint64_t)inv_sub[(i >> b) & 0xf] << b;
}
return o;
}
static int rot_cell(int cell, int n)
{
/* 4-bit rotate left by n. */
cell |= cell << 4;
return extract32(cell, 4 - n, 4);
}
static uint64_t pac_mult(uint64_t i)
{
uint64_t o = 0;
int b;
for (b = 0; b < 4 * 4; b += 4) {
int i0, i4, i8, ic, t0, t1, t2, t3;
i0 = extract64(i, b, 4);
i4 = extract64(i, b + 4 * 4, 4);
i8 = extract64(i, b + 8 * 4, 4);
ic = extract64(i, b + 12 * 4, 4);
t0 = rot_cell(i8, 1) ^ rot_cell(i4, 2) ^ rot_cell(i0, 1);
t1 = rot_cell(ic, 1) ^ rot_cell(i4, 1) ^ rot_cell(i0, 2);
t2 = rot_cell(ic, 2) ^ rot_cell(i8, 1) ^ rot_cell(i0, 1);
t3 = rot_cell(ic, 1) ^ rot_cell(i8, 2) ^ rot_cell(i4, 1);
o |= (uint64_t)t3 << b;
o |= (uint64_t)t2 << (b + 4 * 4);
o |= (uint64_t)t1 << (b + 8 * 4);
o |= (uint64_t)t0 << (b + 12 * 4);
}
return o;
}
static uint64_t tweak_cell_rot(uint64_t cell)
{
return (cell >> 1) | (((cell ^ (cell >> 1)) & 1) << 3);
}
static uint64_t tweak_shuffle(uint64_t i)
{
uint64_t o = 0;
o |= extract64(i, 16, 4) << 0;
o |= extract64(i, 20, 4) << 4;
o |= tweak_cell_rot(extract64(i, 24, 4)) << 8;
o |= extract64(i, 28, 4) << 12;
o |= tweak_cell_rot(extract64(i, 44, 4)) << 16;
o |= extract64(i, 8, 4) << 20;
o |= extract64(i, 12, 4) << 24;
o |= tweak_cell_rot(extract64(i, 32, 4)) << 28;
o |= extract64(i, 48, 4) << 32;
o |= extract64(i, 52, 4) << 36;
o |= extract64(i, 56, 4) << 40;
o |= tweak_cell_rot(extract64(i, 60, 4)) << 44;
o |= tweak_cell_rot(extract64(i, 0, 4)) << 48;
o |= extract64(i, 4, 4) << 52;
o |= tweak_cell_rot(extract64(i, 40, 4)) << 56;
o |= tweak_cell_rot(extract64(i, 36, 4)) << 60;
return o;
}
static uint64_t tweak_cell_inv_rot(uint64_t cell)
{
return ((cell << 1) & 0xf) | ((cell & 1) ^ (cell >> 3));
}
static uint64_t tweak_inv_shuffle(uint64_t i)
{
uint64_t o = 0;
o |= tweak_cell_inv_rot(extract64(i, 48, 4));
o |= extract64(i, 52, 4) << 4;
o |= extract64(i, 20, 4) << 8;
o |= extract64(i, 24, 4) << 12;
o |= extract64(i, 0, 4) << 16;
o |= extract64(i, 4, 4) << 20;
o |= tweak_cell_inv_rot(extract64(i, 8, 4)) << 24;
o |= extract64(i, 12, 4) << 28;
o |= tweak_cell_inv_rot(extract64(i, 28, 4)) << 32;
o |= tweak_cell_inv_rot(extract64(i, 60, 4)) << 36;
o |= tweak_cell_inv_rot(extract64(i, 56, 4)) << 40;
o |= tweak_cell_inv_rot(extract64(i, 16, 4)) << 44;
o |= extract64(i, 32, 4) << 48;
o |= extract64(i, 36, 4) << 52;
o |= extract64(i, 40, 4) << 56;
o |= tweak_cell_inv_rot(extract64(i, 44, 4)) << 60;
return o;
}
static uint64_t pauth_computepac(uint64_t data, uint64_t modifier,
ARMPACKey key)
{
static const uint64_t RC[5] = {
0x0000000000000000ull,
0x13198A2E03707344ull,
0xA4093822299F31D0ull,
0x082EFA98EC4E6C89ull,
0x452821E638D01377ull,
};
const uint64_t alpha = 0xC0AC29B7C97C50DDull;
/*
* Note that in the ARM pseudocode, key0 contains bits <127:64>
* and key1 contains bits <63:0> of the 128-bit key.
*/
uint64_t key0 = key.hi, key1 = key.lo;
uint64_t workingval, runningmod, roundkey, modk0;
int i;
modk0 = (key0 << 63) | ((key0 >> 1) ^ (key0 >> 63));
runningmod = modifier;
workingval = data ^ key0;
for (i = 0; i <= 4; ++i) {
roundkey = key1 ^ runningmod;
workingval ^= roundkey;
workingval ^= RC[i];
if (i > 0) {
workingval = pac_cell_shuffle(workingval);
workingval = pac_mult(workingval);
}
workingval = pac_sub(workingval);
runningmod = tweak_shuffle(runningmod);
}
roundkey = modk0 ^ runningmod;
workingval ^= roundkey;
workingval = pac_cell_shuffle(workingval);
workingval = pac_mult(workingval);
workingval = pac_sub(workingval);
workingval = pac_cell_shuffle(workingval);
workingval = pac_mult(workingval);
workingval ^= key1;
workingval = pac_cell_inv_shuffle(workingval);
workingval = pac_inv_sub(workingval);
workingval = pac_mult(workingval);
workingval = pac_cell_inv_shuffle(workingval);
workingval ^= key0;
workingval ^= runningmod;
for (i = 0; i <= 4; ++i) {
workingval = pac_inv_sub(workingval);
if (i < 4) {
workingval = pac_mult(workingval);
workingval = pac_cell_inv_shuffle(workingval);
}
runningmod = tweak_inv_shuffle(runningmod);
roundkey = key1 ^ runningmod;
workingval ^= RC[4 - i];
workingval ^= roundkey;
workingval ^= alpha;
}
workingval ^= modk0;
return workingval;
}
static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
ARMPACKey *key, bool data)
{
ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data);
uint64_t pac, ext_ptr, ext, test;
int bot_bit, top_bit;
/* If tagged pointers are in use, use ptr<55>, otherwise ptr<63>. */
if (param.tbi) {
ext = sextract64(ptr, 55, 1);
} else {
ext = sextract64(ptr, 63, 1);
}
/* Build a pointer with known good extension bits. */
top_bit = 64 - 8 * param.tbi;
bot_bit = 64 - param.tsz;
ext_ptr = deposit64(ptr, bot_bit, top_bit - bot_bit, ext);
pac = pauth_computepac(ext_ptr, modifier, *key);
/*
* Check if the ptr has good extension bits and corrupt the
* pointer authentication code if not.
*/
test = sextract64(ptr, bot_bit, top_bit - bot_bit);
if (test != 0 && test != -1) {
pac ^= MAKE_64BIT_MASK(top_bit - 1, 1);
}
/*
* Preserve the determination between upper and lower at bit 55,
* and insert pointer authentication code.
*/
if (param.tbi) {
ptr &= ~MAKE_64BIT_MASK(bot_bit, 55 - bot_bit + 1);
pac &= MAKE_64BIT_MASK(bot_bit, 54 - bot_bit + 1);
} else {
ptr &= MAKE_64BIT_MASK(0, bot_bit);
pac &= ~(MAKE_64BIT_MASK(55, 1) | MAKE_64BIT_MASK(0, bot_bit));
}
ext &= MAKE_64BIT_MASK(55, 1);
return pac | ext | ptr;
}
static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param)
{
uint64_t extfield = -param.select;
int bot_pac_bit = 64 - param.tsz;
int top_pac_bit = 64 - 8 * param.tbi;
return deposit64(ptr, bot_pac_bit, top_pac_bit - bot_pac_bit, extfield);
}
static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier,
ARMPACKey *key, bool data, int keynumber)
{
ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data);
int bot_bit, top_bit;
uint64_t pac, orig_ptr, test;
orig_ptr = pauth_original_ptr(ptr, param);
pac = pauth_computepac(orig_ptr, modifier, *key);
bot_bit = 64 - param.tsz;
top_bit = 64 - 8 * param.tbi;
test = (pac ^ ptr) & ~MAKE_64BIT_MASK(55, 1);
if (unlikely(extract64(test, bot_bit, top_bit - bot_bit))) {
int error_code = (keynumber << 1) | (keynumber ^ 1);
if (param.tbi) {
return deposit64(ptr, 53, 2, error_code);
} else {
return deposit64(ptr, 61, 2, error_code);
}
}
return orig_ptr;
}
static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data)
{
ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data);
return pauth_original_ptr(ptr, param);
}
static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el,
uintptr_t ra)
{
raise_exception_ra(env, EXCP_UDEF, syn_pactrap(), target_el, ra);
}
static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra)
{
if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
uint64_t hcr = arm_hcr_el2_eff(env);
bool trap = !(hcr & HCR_API);
/* FIXME: ARMv8.1-VHE: trap only applies to EL1&0 regime. */
/* FIXME: ARMv8.3-NV: HCR_NV trap takes precedence for ERETA[AB]. */
if (trap) {
pauth_trap(env, 2, ra);
}
}
if (el < 3 && arm_feature(env, ARM_FEATURE_EL3)) {
if (!(env->cp15.scr_el3 & SCR_API)) {
pauth_trap(env, 3, ra);
}
}
}
static bool pauth_key_enabled(CPUARMState *env, int el, uint32_t bit)
{
uint32_t sctlr;
if (el == 0) {
/* FIXME: ARMv8.1-VHE S2 translation regime. */
sctlr = env->cp15.sctlr_el[1];
} else {
sctlr = env->cp15.sctlr_el[el];
}
return (sctlr & bit) != 0;
}
uint64_t HELPER(pacia)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnIA)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_addpac(env, x, y, &env->apia_key, false);
}
uint64_t HELPER(pacib)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnIB)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_addpac(env, x, y, &env->apib_key, false);
}
uint64_t HELPER(pacda)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnDA)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_addpac(env, x, y, &env->apda_key, true);
}
uint64_t HELPER(pacdb)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnDB)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_addpac(env, x, y, &env->apdb_key, true);
}
uint64_t HELPER(pacga)(CPUARMState *env, uint64_t x, uint64_t y)
{
uint64_t pac;
pauth_check_trap(env, arm_current_el(env), GETPC());
pac = pauth_computepac(x, y, env->apga_key);
return pac & 0xffffffff00000000ull;
}
uint64_t HELPER(autia)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnIA)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_auth(env, x, y, &env->apia_key, false, 0);
}
uint64_t HELPER(autib)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnIB)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_auth(env, x, y, &env->apib_key, false, 1);
}
uint64_t HELPER(autda)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnDA)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_auth(env, x, y, &env->apda_key, true, 0);
}
uint64_t HELPER(autdb)(CPUARMState *env, uint64_t x, uint64_t y)
{
int el = arm_current_el(env);
if (!pauth_key_enabled(env, el, SCTLR_EnDB)) {
return x;
}
pauth_check_trap(env, el, GETPC());
return pauth_auth(env, x, y, &env->apdb_key, true, 1);
}
uint64_t HELPER(xpaci)(CPUARMState *env, uint64_t a)
{
return pauth_strip(env, a, false);
}
uint64_t HELPER(xpacd)(CPUARMState *env, uint64_t a)
{
return pauth_strip(env, a, true);
}
| {
"pile_set_name": "Github"
} |
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
| {
"pile_set_name": "Github"
} |
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd.
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 5 End-User License
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
27th April 2017).
End User License Agreement: www.juce.com/juce-5-licence
Privacy Policy: www.juce.com/juce-5-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
#pragma once
/**
Components derived from this class can have files dropped onto them by an external application.
@see DragAndDropContainer
*/
class JUCE_API FileDragAndDropTarget
{
public:
/** Destructor. */
virtual ~FileDragAndDropTarget() {}
/** Callback to check whether this target is interested in the set of files being offered.
Note that this will be called repeatedly when the user is dragging the mouse around over your
component, so don't do anything time-consuming in here, like opening the files to have a look
inside them!
@param files the set of (absolute) pathnames of the files that the user is dragging
@returns true if this component wants to receive the other callbacks regarging this
type of object; if it returns false, no other callbacks will be made.
*/
virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
/** Callback to indicate that some files are being dragged over this component.
This gets called when the user moves the mouse into this component while dragging.
Use this callback as a trigger to make your component repaint itself to give the
user feedback about whether the files can be dropped here or not.
@param files the set of (absolute) pathnames of the files that the user is dragging
@param x the mouse x position, relative to this component
@param y the mouse y position, relative to this component
*/
virtual void fileDragEnter (const StringArray& files, int x, int y);
/** Callback to indicate that the user is dragging some files over this component.
This gets called when the user moves the mouse over this component while dragging.
Normally overriding itemDragEnter() and itemDragExit() are enough, but
this lets you know what happens in-between.
@param files the set of (absolute) pathnames of the files that the user is dragging
@param x the mouse x position, relative to this component
@param y the mouse y position, relative to this component
*/
virtual void fileDragMove (const StringArray& files, int x, int y);
/** Callback to indicate that the mouse has moved away from this component.
This gets called when the user moves the mouse out of this component while dragging
the files.
If you've used fileDragEnter() to repaint your component and give feedback, use this
as a signal to repaint it in its normal state.
@param files the set of (absolute) pathnames of the files that the user is dragging
*/
virtual void fileDragExit (const StringArray& files);
/** Callback to indicate that the user has dropped the files onto this component.
When the user drops the files, this get called, and you can use the files in whatever
way is appropriate.
Note that after this is called, the fileDragExit method may not be called, so you should
clean up in here if there's anything you need to do when the drag finishes.
@param files the set of (absolute) pathnames of the files that the user is dragging
@param x the mouse x position, relative to this component
@param y the mouse y position, relative to this component
*/
virtual void filesDropped (const StringArray& files, int x, int y) = 0;
};
| {
"pile_set_name": "Github"
} |
// ==UserScript==
// @name searchEngineIcon.uc.js
// @namespace http://space.geocities.yahoo.co.jp/gl/alice0775
// @description replace the magnifying glass with the search engine's icon
// @include main
// @compatibility Firefox 67
// @author Alice0775
// @version 2019/06/24 11:00 Fix 68+ Bug 1518545 - Merge engine-current/ default notifications
// @version 2019/05/24 11:00 Fix overflowed/underflowed
// @version 2019/03/30 19:00 Fix 67.0a1 Bug 1492475 The search service init() method should simply return a Promise
// @version 2019/03/20 00:00 Fix 67.0a1
// @version 2018/11/29 00:00 Fix 67.0a1 Bug 1524593 - nsISearchService (aka nsIBrowserSearchService, previously) refactor to be mostly an asynchronouse
// @version 2018/11/29 00:00 Fix 65.0a1 Bug 1453264
// @version 2018/09/29 23:00 Fix 64.0a1
// @version 2018/09/24 23:00 Fix warning from nsIBrowserSearchService
// @version 2018/07*20 23:00 Fix change option > search
// @version 2017/11/17 02:00 Fx57
// @version 2015/09/08 02:00 Bug 827546
// ==/UserScript==
var searchengineicon = {
init: function() {
Services.search.init().then(rv => {
if (Components.isSuccessCode(rv)) {
this.toggleImage();
}
});
window.addEventListener('aftercustomization', this, false);
Services.prefs.addObserver('browser.search.widget.inNavBar', this, false);
Services.obs.addObserver(this, "browser-search-engine-modified");
window.addEventListener("resize", this, false);
window.addEventListener('unload', this, false);
},
uninit: function(){
window.removeEventListener('aftercustomization', this, false);
Services.prefs.removeObserver('browser.search.widget.inNavBar', this);
Services.obs.removeObserver(this, "browser-search-engine-modified");
window.removeEventListener("resize", this, false);
window.removeEventListener('unload', this, false);
},
toggleImage: async function() {
Services.console.logStringMessage("toggleImage");
var searchbar = window.document.getElementById("searchbar");
if (!searchbar)
return;
let searchbutton = searchbar.querySelector(".searchbar-search-icon") ||
window.document.getAnonymousElementByAttribute(searchbar, "class", "searchbar-search-icon");
let defaultEngine = await Services.search.getDefault();
var uri = defaultEngine.iconURI.spec;
//var icon = PlacesUtils.getImageURLForResolution(window, uri);
searchbutton.setAttribute("style", "list-style-image: url('"+ uri +"') !important; -moz-image-region: auto !important; width: 16px !important; padding: 2px 0 !important;");
},
observe(aSubject, aTopic, aPrefstring) {
if (aTopic == "browser-search-engine-modified") {
aSubject.QueryInterface(Components.interfaces.nsISearchEngine);
switch (aPrefstring) {
case "engine-current":
case "engine-default":
this.toggleImage();
// Not relevant
break;
}
}
if (aTopic == 'nsPref:changed') {
// 設定が変更された時の処理
setTimeout(function(){searchengineicon.toggleImage();}, 0);
}
},
_timer: null,
handleEvent: function(event){
switch (event.type) {
case "resize":
if (!this._timer)
clearTimeout(this._timer);
this._timer = setTimeout(() => this.toggleImage(), 250);
break;
case "aftercustomization":
this.toggleImage();
break;
case 'unload':
this.uninit();
break;
}
}
}
searchengineicon.init();
| {
"pile_set_name": "Github"
} |
// (C) Copyright Gennadiy Rozental 2001.
// 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)
// See http://www.boost.org/libs/test for the library home page.
//
//!@file
//!@brief specific generators
// ***************************************************************************
#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
// Boost.Test
#include <boost/test/data/monomorphic/generators/xrange.hpp>
#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
| {
"pile_set_name": "Github"
} |
4 4 1
-1.80685e+003 1.17878e+003 -2.59491e+002 3.21938e+001 -3.64795e+000
-1.46613e+003 8.21003e+002 -1.28377e+002 3.66239e+000 1.63187e-001
-1.35874e+003 7.55914e+002 -1.23918e+002 6.50327e+000 -2.96036e+000
-7.71271e+001 -6.96925e+001 -4.17588e+001 1.74055e+001 -2.95205e+000
-5.64065e+002 2.64671e+002 -3.32492e+001 -3.47409e+000 2.06223e+000
1.62047e+002 -4.19701e+002 7.33851e+001 2.10685e+000 -5.02126e+000
-1.66557e+003 9.51783e+002 -2.16835e+002 1.83237e+001 -1.83535e+000
-6.40227e+002 2.31440e+002 9.18038e+000 -2.01939e+001 5.01533e+000
-1.04936e+002 1.39041e+002 -1.34606e+002 3.78554e+001 -9.55034e+000
6.36802e+002 -4.68492e+002 1.43500e+002 -2.21260e+001 1.30102e+000
1.75361e+004 -9.09763e+003 1.81205e+003 -1.93852e+002 1.55946e+001
-8.72443e+004 4.42638e+004 -8.21785e+003 7.20626e+002 -3.86280e+001
| {
"pile_set_name": "Github"
} |
Pistons are effectors, they push up to 20 blocks in front of them. The push direction can be set by placing them from different angles.
A piston pointing into an unloaded block won't extend.
A piston retracting from an unloaded block works, but gravity-sensitive nodes above the empty space may not fall.
| {
"pile_set_name": "Github"
} |
http://[fe80::1]/
| {
"pile_set_name": "Github"
} |
SCAYT plugin for CKEditor 4 Changelog
====================
### CKEditor 4.5.6
New Features:
* CKEditor [language addon](http://ckeditor.com/addon/language) support
* CKEditor [placeholder addon](http://ckeditor.com/addon/placeholder) support
* Drag and Drop support
* *Experimental* GRAYT functionality http://www.webspellchecker.net/samples/scayt-ckeditor-plugin.html#25
Fixed issues:
* [#98](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/98) SCAYT Affects Dialog Double Click. Fixed in SCAYT Core.
* [#102](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/102) SCAYT Core performance enhancements
* [#104](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/104) SCAYT's spans leak into the clipboard and after pasting
* [#105](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/105) Javascript error fired in case of multiple instances of CKEditor in one page
* [#107](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/107) SCAYT should not check non-editable parts of content
* [#108](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/108) Latest SCAYT copies id of editor element to the iframe
* SCAYT stops working when CKEditor Undo plug-in not enabled
* Issue with pasting SCAYT markup in CKEditor
* [#32](https://github.com/WebSpellChecker/ckeditor-plugin-wsc/issues/32) SCAYT stops working after pressing Cancel button in WSC dialog
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/unordered_map.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/cstdint.hpp>
#include <boost/foreach.hpp>
#include <boost/array.hpp>
#include <boost/scoped_array.hpp>
#include <boost/range/iterator_range.hpp>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
// We place the data here. Each line comprises various fields
typedef std::vector<std::string> ucd_line;
typedef std::vector<ucd_line> ucd_vector;
typedef std::vector<ucd_line>::iterator ucd_iterator;
// spirit and phoenix using declarations
using boost::spirit::qi::parse;
using boost::spirit::qi::hex;
using boost::spirit::qi::char_;
using boost::spirit::qi::eol;
using boost::spirit::qi::rule;
using boost::spirit::qi::omit;
using boost::spirit::qi::_1;
using boost::spirit::qi::_val;
using boost::phoenix::push_back;
using boost::phoenix::ref;
// basic unsigned types
using boost::uint8_t;
using boost::uint16_t;
using boost::uint32_t;
// a char range
struct ucd_range
{
ucd_range(uint32_t start, uint32_t finish)
: start(start), finish(finish) {}
// we need this so we can use ucd_range as a multimap key
friend bool operator<(ucd_range const& a, ucd_range const& b)
{
return a.start < b.start;
}
uint32_t start;
uint32_t finish;
};
class ucd_info
{
public:
ucd_info(char const* filename)
{
std::ifstream in(filename, std::ios_base::in);
if (!in)
{
std::cerr << "Error: Could not open input file: "
<< filename << std::endl;
}
else
{
std::string data; // We will read the contents here.
in.unsetf(std::ios::skipws); // No white space skipping!
std::copy(
std::istream_iterator<char>(in),
std::istream_iterator<char>(),
std::back_inserter(data));
typedef std::string::const_iterator iterator_type;
iterator_type f = data.begin();
iterator_type l = data.end();
rule<iterator_type> endl = -('#' >> *(char_-eol)) >> eol;
rule<iterator_type, std::string()> field = *(char_-(';'|endl)) >> (';'|&endl);
rule<iterator_type, ucd_line()> line = +(field-endl) >> endl;
rule<iterator_type, std::vector<ucd_line>()> file = +(endl | line[push_back(_val, _1)]);
parse(f, l, file, info);
}
}
template <typename Array>
void collect(Array& data, int field, bool collect_properties = true) const
{
BOOST_ASSERT(!info.empty());
ucd_vector::const_iterator current = info.begin();
ucd_vector::const_iterator end = info.end();
while (current != end)
{
std::string range = (*current)[0];
boost::trim(range);
std::string::const_iterator f = range.begin();
std::string::const_iterator l = range.end();
// get the code-point range
uint32_t start;
uint32_t finish;
parse(f, l, hex[ref(start) = ref(finish) = _1] >> -(".." >> hex[ref(finish) = _1]));
// special case for UnicodeData.txt ranges:
if ((*current)[1].find("First>") != std::string::npos)
{
++current;
BOOST_ASSERT(current != end);
BOOST_ASSERT((*current)[1].find("Last>") != std::string::npos);
std::string range = (*current)[0];
boost::trim(range);
f = range.begin();
l = range.end();
parse(f, l, hex[ref(finish) = _1]);
}
std::string code;
if (field < int(current->size()))
code = (*current)[field];
boost::trim(code);
// Only collect properties we are interested in
if (collect_properties) // code for properties
{
if (!ignore_property(code))
{
for (uint32_t i = start; i <= finish; ++i)
data[i] |= map_property(code);
}
}
else // code for actual numeric values
{
for (uint32_t i = start; i <= finish; ++i)
{
if (code.empty())
{
data[i] = 0; // signal that this code maps to itself
}
else
{
f = code.begin();
l = code.end();
parse(f, l, hex, data[i]);
}
}
}
++current;
}
}
private:
static bool ignore_property(std::string const& p)
{
// We don't handle all properties
std::map<std::string, int>& pm = get_property_map();
std::map<std::string, int>::iterator i = pm.find(p);
return i == pm.end();
}
static int
map_property(std::string const& p)
{
std::map<std::string, int>& pm = get_property_map();
std::map<std::string, int>::iterator i = pm.find(p);
BOOST_ASSERT(i != pm.end());
return i->second;
}
static std::map<std::string, int>&
get_property_map()
{
// The properties we are interested in:
static std::map<std::string, int> map;
if (map.empty())
{
// General_Category
map["Lu"] = 0;
map["Ll"] = 1;
map["Lt"] = 2;
map["Lm"] = 3;
map["Lo"] = 4;
map["Mn"] = 8;
map["Me"] = 9;
map["Mc"] = 10;
map["Nd"] = 16;
map["Nl"] = 17;
map["No"] = 18;
map["Zs"] = 24;
map["Zl"] = 25;
map["Zp"] = 26;
map["Cc"] = 32;
map["Cf"] = 33;
map["Co"] = 34;
map["Cs"] = 35;
map["Cn"] = 36;
map["Pd"] = 40;
map["Ps"] = 41;
map["Pe"] = 42;
map["Pc"] = 43;
map["Po"] = 44;
map["Pi"] = 45;
map["Pf"] = 46;
map["Sm"] = 48;
map["Sc"] = 49;
map["Sk"] = 50;
map["So"] = 51;
// Derived Properties.
map["Alphabetic"] = 64;
map["Uppercase"] = 128;
map["Lowercase"] = 256;
map["White_Space"] = 512;
map["Hex_Digit"] = 1024;
map["Noncharacter_Code_Point"] = 2048;
map["Default_Ignorable_Code_Point"] = 4096;
// Script
map["Arabic"] = 0;
map["Imperial_Aramaic"] = 1;
map["Armenian"] = 2;
map["Avestan"] = 3;
map["Balinese"] = 4;
map["Bamum"] = 5;
map["Bengali"] = 6;
map["Bopomofo"] = 7;
map["Braille"] = 8;
map["Buginese"] = 9;
map["Buhid"] = 10;
map["Canadian_Aboriginal"] = 11;
map["Carian"] = 12;
map["Cham"] = 13;
map["Cherokee"] = 14;
map["Coptic"] = 15;
map["Cypriot"] = 16;
map["Cyrillic"] = 17;
map["Devanagari"] = 18;
map["Deseret"] = 19;
map["Egyptian_Hieroglyphs"] = 20;
map["Ethiopic"] = 21;
map["Georgian"] = 22;
map["Glagolitic"] = 23;
map["Gothic"] = 24;
map["Greek"] = 25;
map["Gujarati"] = 26;
map["Gurmukhi"] = 27;
map["Hangul"] = 28;
map["Han"] = 29;
map["Hanunoo"] = 30;
map["Hebrew"] = 31;
map["Hiragana"] = 32;
map["Katakana_Or_Hiragana"] = 33;
map["Old_Italic"] = 34;
map["Javanese"] = 35;
map["Kayah_Li"] = 36;
map["Katakana"] = 37;
map["Kharoshthi"] = 38;
map["Khmer"] = 39;
map["Kannada"] = 40;
map["Kaithi"] = 41;
map["Tai_Tham"] = 42;
map["Lao"] = 43;
map["Latin"] = 44;
map["Lepcha"] = 45;
map["Limbu"] = 46;
map["Linear_B"] = 47;
map["Lisu"] = 48;
map["Lycian"] = 49;
map["Lydian"] = 50;
map["Malayalam"] = 51;
map["Mongolian"] = 52;
map["Meetei_Mayek"] = 53;
map["Myanmar"] = 54;
map["Nko"] = 55;
map["Ogham"] = 56;
map["Ol_Chiki"] = 57;
map["Old_Turkic"] = 58;
map["Oriya"] = 59;
map["Osmanya"] = 60;
map["Phags_Pa"] = 61;
map["Inscriptional_Pahlavi"] = 62;
map["Phoenician"] = 63;
map["Inscriptional_Parthian"] = 64;
map["Rejang"] = 65;
map["Runic"] = 66;
map["Samaritan"] = 67;
map["Old_South_Arabian"] = 68;
map["Saurashtra"] = 69;
map["Shavian"] = 70;
map["Sinhala"] = 71;
map["Sundanese"] = 72;
map["Syloti_Nagri"] = 73;
map["Syriac"] = 74;
map["Tagbanwa"] = 75;
map["Tai_Le"] = 76;
map["New_Tai_Lue"] = 77;
map["Tamil"] = 78;
map["Tai_Viet"] = 79;
map["Telugu"] = 80;
map["Tifinagh"] = 81;
map["Tagalog"] = 82;
map["Thaana"] = 83;
map["Thai"] = 84;
map["Tibetan"] = 85;
map["Ugaritic"] = 86;
map["Vai"] = 87;
map["Old_Persian"] = 88;
map["Cuneiform"] = 89;
map["Yi"] = 90;
map["Inherited"] = 91;
map["Common"] = 92;
map["Unknown"] = 93;
}
return map;
}
ucd_vector info;
};
template <typename T, uint32_t block_size_ = 256>
class ucd_table_builder
{
public:
static uint32_t const block_size = block_size_;
static uint32_t const full_span = 0x110000;
typedef T value_type;
ucd_table_builder() : p(new T[full_span])
{
for (uint32_t i = 0; i < full_span; ++i)
p[i] = 0;
}
void collect(char const* filename, int field, bool collect_properties = true)
{
std::cout << "collecting " << filename << std::endl;
ucd_info info(filename);
info.collect(p, field, collect_properties);
}
void build(std::vector<uint8_t>& stage1, std::vector<T const*>& stage2)
{
std::cout << "building tables" << std::endl;
std::map<block_ptr, std::vector<T const*> > blocks;
for (T const* i = p.get(); i < (p.get() + full_span); i += block_size)
blocks[block_ptr(i)].push_back(i);
// Not enough bits to store the block indices.
BOOST_ASSERT(blocks.size() < (1 << (sizeof(uint8_t) * 8)));
typedef std::pair<block_ptr, std::vector<T const*> > blocks_value_type;
std::map<T const*, std::vector<T const*> > sorted_blocks;
BOOST_FOREACH(blocks_value_type const& val, blocks)
{
sorted_blocks[val.first.p] = val.second;
}
stage1.clear();
stage1.reserve(full_span / block_size);
stage1.resize(full_span / block_size);
stage2.clear();
stage2.reserve(blocks.size());
typedef std::pair<T const*, std::vector<T const*> > sorted_blocks_value_type;
BOOST_FOREACH(sorted_blocks_value_type const& val, sorted_blocks)
{
stage2.push_back(val.first);
BOOST_FOREACH(T const* val2, val.second)
{
stage1[(val2 - p.get()) / block_size] = stage2.size() - 1;
}
}
}
private:
struct block_ptr
{
block_ptr(T const* p) : p(p) {}
friend bool operator<(block_ptr a, block_ptr b)
{
return std::lexicographical_compare(
a.p, a.p + block_size, b.p, b.p + block_size);
}
T const* p;
};
boost::scoped_array<T> p;
};
template <typename Out>
void print_tab(Out& out, int tab)
{
for (int i = 0; i < tab; ++i)
out << ' ';
}
template <typename Out, typename C>
void print_table(Out& out, C const& c, bool trailing_comma, int width = 4, int group = 16)
{
int const tab = 4;
typename C::size_type size = c.size();
BOOST_ASSERT(size > 1);
print_tab(out, tab);
out << std::setw(width) << int(c[0]);
for (C::size_type i = 1; i < size; ++i)
{
out << ", ";
if ((i % group) == 0)
{
out << std::endl;
print_tab(out, tab);
}
out << std::setw(width) << int(c[i]);
}
if (trailing_comma)
out << ", " << std::endl;
}
template <typename Out>
void print_head(Out& out)
{
out
<< "/*=============================================================================\n"
<< " Copyright (c) 2001-2011 Joel de Guzman\n"
<< "\n"
<< " Distributed under the Boost Software License, Version 1.0. (See accompanying\n"
<< " file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
<< "\n"
<< " AUTOGENERATED. DO NOT EDIT!!!\n"
<< "==============================================================================*/\n"
<< "#include <boost/cstdint.hpp>\n"
<< "\n"
<< "namespace boost { namespace spirit { namespace ucd { namespace detail\n"
<< "{"
;
}
template <typename Out>
void print_tail(Out& out)
{
out
<< "\n"
<< "}}}} // namespace boost::spirit::unicode::detail\n"
;
}
char const* get_int_type_name(int size)
{
switch (size)
{
case 1: return "::boost::uint8_t";
case 2: return "::boost::uint16_t";
case 4: return "::boost::uint32_t";
case 5: return "::boost::uint64_t";
default: BOOST_ASSERT(false); return 0; // invalid size
};
}
template <typename Out, typename Builder>
void print_file(Out& out, Builder& builder, int field_width, char const* name)
{
std::cout << "Generating " << name << " tables" << std::endl;
uint32_t const block_size = Builder::block_size;
typedef typename Builder::value_type value_type;
print_head(out);
std::vector<uint8_t> stage1;
std::vector<value_type const*> stage2;
builder.build(stage1, stage2);
std::cout << "Block Size: " << block_size << std::endl;
std::cout << "Total Bytes: "
<< stage1.size()+(stage2.size()*block_size*sizeof(value_type))
<< std::endl;
out
<< "\n"
<< " static const ::boost::uint8_t " << name << "_stage1[] = {\n"
<< "\n"
;
print_table(out, stage1, false, 3);
char const* int_name = get_int_type_name(sizeof(value_type));
out
<< "\n"
<< " };"
<< "\n"
<< "\n"
<< " static const " << int_name << ' ' << name << "_stage2[] = {"
;
int block_n = 0;
for (int i = 0; i < int(stage2.size()); ++i)
{
value_type const* p = stage2[i];
bool last = (i+1 == stage2.size());
out << "\n\n // block " << block_n++ << std::endl;
print_table(out,
boost::iterator_range<value_type const*>(p, p+block_size), !last, field_width);
}
out
<< "\n"
<< " };"
<< "\n"
;
out
<< "\n"
<< " inline " << int_name << ' ' << name << "_lookup(::boost::uint32_t ch)\n"
<< " {\n"
<< " ::boost::uint32_t block_offset = " << name << "_stage1[ch / " << block_size << "] * " << block_size << ";\n"
<< " return " << name << "_stage2[block_offset + ch % " << block_size << "];\n"
<< " }\n"
;
print_tail(out);
}
int main()
{
// The category tables
{
std::ofstream out("category_table.hpp");
ucd_table_builder<uint16_t, 256> builder;
builder.collect("UnicodeData.txt", 2);
builder.collect("DerivedCoreProperties.txt", 1);
builder.collect("PropList.txt", 1);
print_file(out, builder, 4, "category");
}
// The script tables
{
std::ofstream out("script_table.hpp");
ucd_table_builder<uint8_t, 256> builder;
builder.collect("Scripts.txt", 1);
print_file(out, builder, 3, "script");
}
// The lowercase tables
{
std::ofstream out("lowercase_table.hpp");
ucd_table_builder<uint32_t, 256> builder;
builder.collect("UnicodeData.txt", 13, false);
print_file(out, builder, 6, "lowercase");
}
// The uppercase tables
{
std::ofstream out("uppercase_table.hpp");
ucd_table_builder<uint32_t, 256> builder;
builder.collect("UnicodeData.txt", 12, false);
print_file(out, builder, 6, "uppercase");
}
return 0;
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta name="COPYRIGHT" content=
"Copyright (C) 2016 and later: Unicode, Inc. and others.
License & terms of use: http://www.unicode.org/copyright.html
Copyright (c) 2001-2010 IBM Corporation and others. All Rights Reserved." />
<meta name="Author" content="Eric Mader" />
<title>Readme file for the ICU LayoutEngine demo</title>
</head>
<body>
<h2>What is the layout demo?</h2>
<p>The layout demo displays a paragraph of text that is laid out using the
LayoutEngine. There are two versions of this demo, "layout.exe" which runs on
Windows 2000, and "gnomelayout" which runs on Linux. Both programs read a
file containing the Unicode text to display, and a file that says which font
to use to display each script.</p>
<h2>How do I build the layout demo?</h2>First, you need to build ICU,
including the LayoutEngine.
<p>On Windows, the layout project should be listed as a dependency of all, so
layout will build when you build all. If it doesn't for some reason, just
select the layout project in the project toolbar and build it.</p>
<p>On Linux systems, you need to add the "--enable-layout=yes" option when
you invoke the runConfigureICU script. When you've done that, layout should
build when you do "make all install"</p>
<p>To build the demo on Windows, just open the layout project in
<icu>\source\samples\layout and build it.</p>
<p>On Linux systems, connect to <top-build-dir>/samples/layout and do
"make all". To build the layout demo on Linux, you'll need the
gnome-libs-devel and freetype-devel packages, which should be part of your
Linux distribution. The demo uses the FreeType 1 library, and the make files
assume that the FreeType header files are in /usr/include/freetype1, and that
the freetype library is /usr/lib/libttf.so. This is how RedHat Linux 7.2
installs FreeType 1. If your system is different, you may need to add sym
links to where the files are stored on your system, or modify
<top-src-dir>/samples/layout/Makefile.in to reference the files
correctly for your system.</p>
<h2>How do I run the demo?</h2>
<p>Before you can run the demo, you'll need to get the fonts it uses. For
legal reasons, we can't include these fonts with ICU, but you can download
them from the web. To do this, you'll need access to a computer running
Windows. Here's how to get the fonts:</p>
<p>First, download the Thai font. Go to <a href=
"http://www.freelang.net/fonts/index.php">freelang.net</a> and
click on the link for the Courier Thai font. This will download a .ZIP file.
Extract the Courpro.ttf font. On Windows, copy this font file to your
Fonts folder (note the name of the font after it is installed), on Linux, copy this font file to the directory from which
you'll run the layout demo.</p>
<p>Next is the Hindi font. Download the font from <a href=
"http://www.ffonts.net/Raghindi.font.download">Raghindi</a>. On Linux, you can download the font into the
directory from which you'll run the layout demo. On Windows, you'll need to
install it in your Fonts folder.</p>
<p>There's still one more font to get, the Code2000 Unicode font. Go to James
Kass' <a href="http://www.code2000.net/">Unicode Support In Your
Browser</a> page and click on the link that says "Click Here to download
Code2000 shareware demo Unicode font." This will download a .ZIP file which
contains CODE2000.TTF and CODE2000.HTM. Expand this .ZIP file. If you're
going to run the layout demo on Linux, put the CODE2000.TTF file in the
directory from which you'll run the demo. On Windows, copy the font to your
fonts folder.</p>
<p><strong>Note:</strong> The Code2000 font is shareware. If you want to use
it for longer than a trial period, you should send a shareware fee to James.
Directions for how to do this are in CODE2000.HTM.</p>
<p>Be sure that your FontMap.GDI (on Windows) or FontMap.Gnome file (on Linux) contains accurate
font names for each script type. For example, the following is a valid FontMap.GDI (assuming you have the correct fonts):
<br><br>DEVANAGARI: Raghindi<br>THAI: Courier MonoThai<br>DEFAULT: Code2000<br><br>Note that only the Code2000 default font is strictly necessary,
and that the other two can simply be commented out by a '#' if you do not wish to use them.</p>
<p>Also note that the FontMap and the sample.txt files have to be in the same directory as the layout executable.</p>
<p>That's it! Now all you have to do is run letest (CTRL+F5 in Visual C++, or
"./gnomelayout" in Linux)</p>
<h2>How can I customize the layout demo?</h2>
<p>The text that the layout demo displays is read from the file "Sample.txt."
You can change the text by editing this file using a Unicode-aware text
editor. (it is in UTF8 format with a BOM as the first character; the demo can
also read UTF16 and UTF32 format files) Remember that the text will be
displayed in a single paragraph; you can include CR and LF characters in the
text, but they will be ignored.</p>
<p>If you add scripts to the text other than Arabic, Devanagari, Latin or
Thai, you'll need to find a font which contains the characters in that
script, and add an entry to the FontMap file ("FontMap.GDI" on Windows,
"FontMap.Gnome" on Linux) This file contains a single entry per line. Each
entry contains a script name followed by a colon, and then a font name.</p>
<p>Here is the list of legal script names:</p>
<blockquote>
<tt>ARABIC</tt><br />
<tt>ARMENIAN</tt><br />
<tt>BENGALI</tt><br />
<tt>BOPOMOFO</tt><br />
<span style="font-family: monospace;">BUHID</span><br />
<tt>CANADIAN_ABORIGINAL</tt><br />
<tt>CHEROKEE</tt><br />
<tt>CYRILLIC</tt><br />
<tt>DESERET</tt><br />
<tt>DEVANAGARI</tt><br />
<tt>ETHIOPIC</tt><br />
<tt>GEORGIAN</tt><br />
<tt>GOTHIC</tt><br />
<tt>GREEK</tt><br />
<tt>GUJARATI</tt><br />
<tt>GURMUKHI</tt><br />
<tt>HAN</tt><br />
<tt>HANGUL</tt><br />
<span style="font-family: monospace;">HANUNOO</span><br />
<tt>HEBREW</tt><br />
<tt>HIRAGANA</tt><br />
<tt>KANNADA</tt><br />
<tt>KATAKANA</tt><br />
<tt>KHMER</tt><br />
<tt>LATIN</tt><br />
<tt>MALAYALAM</tt><br />
<tt>MONGOLIAN</tt><br />
<tt>MYANMAR</tt><br />
<tt>OGHAM</tt><br />
<tt>OLD_ITALIC</tt><br />
<tt>ORIYA</tt><br />
<tt>RUNIC</tt><br />
<tt>SINHALA</tt><br />
<tt>SYRIAC</tt><br />
<span style="font-family: monospace;">TAGALOG<br />
TAGBANWA</span><br />
<tt>TAMIL</tt><br />
<tt>TELUGU</tt><br />
<tt>THAANA</tt><br />
<tt>THAI</tt><br />
<tt>TIBETAN</tt><br />
<tt>YI<br /></tt>
</blockquote>
<p>You can also use the script name "DEFAULT" to represent all scripts which
you don't explicitly list in the FontMap file.</p>
<p>On Windows use the full name of the font as it appears in the Windows
Fonts folder (eg. "Times New Roman") On Linux, use the file name of the font
file (e.g. "Times.TTF") If you're running on Windows, you'll need to install
the new fonts in your Fonts folder. If you're running on Linux, put them in
the directory from which you'll run the demo.</p><br />
</body>
</html>
| {
"pile_set_name": "Github"
} |
var test = require('tap').test;
var detective = require('../');
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/files/word.js');
test('word', function (t) {
t.deepEqual(
detective(src, { word : 'load' }),
[ 'a', 'b', 'c', 'events', 'doom', 'y', 'events2' ]
);
t.end();
});
| {
"pile_set_name": "Github"
} |
//
// WebViewHistoryItem.h
// WebBrowser
//
// Created by 钟武 on 2017/3/15.
// Copyright © 2017年 钟武. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WebViewHistoryItem : NSObject
@property (nonatomic, copy, readonly) NSString *URLString;
@property (nonatomic, copy, readonly) NSString *title;
- (instancetype)initWithURLString:(NSString *)URLString title:(NSString *)title;
@end
| {
"pile_set_name": "Github"
} |
/*
* Copyright 1999-2101 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.simpleimage.codec.jpeg.ext;
import java.io.IOException;
import com.alibaba.simpleimage.codec.ExtendImageHeaderReader;
import com.alibaba.simpleimage.io.ImageInputStream;
/**
* TODO Comment of AdobeHeaderReader
*
* @author wendell
*/
public class AdobeHeaderReader implements ExtendImageHeaderReader {
/*
* (non-Javadoc)
* @see
* com.alibaba.simpleimage.jpeg.ExtendImageHeaderReader#readProperties(com.alibaba.simpleimage.jpeg.ImageInputStream
* , com.alibaba.simpleimage.jpeg.ExtendImageHeader)
*/
public void readProperties(ImageInputStream in, int len, ExtendImageHeader imageHeader) throws IOException {
int transform = 0, numToRead = 0;
if (len >= 14) {
numToRead = 14;
} else if (len > 0) {
numToRead = len;
} else {
numToRead = 0;
}
byte[] datas = new byte[numToRead];
in.read(datas);
len -= numToRead;
if (numToRead >= 12 && datas[0] == 0x41 && datas[1] == 0x64 && datas[2] == 0x6F && datas[3] == 0x62
&& datas[4] == 0x65) {
// Found Adobe APP14 marker
transform = datas[11];
imageHeader.setSawAdobeMarker(true);
imageHeader.setAdobeTransform(transform);
}
// skip any remaining data
if (len > 0) {
in.skipBytes(len);
}
}
}
| {
"pile_set_name": "Github"
} |
{
"loc.friendlyName": "Descargar artefactos de un recurso compartido de archivo",
"loc.helpMarkDown": "",
"loc.description": "Descarga los artefactos de un recurso compartido de archivo, como \\\\share\\drop",
"loc.instanceNameFormat": "Descargar artefactos de un recurso compartido de archivo",
"loc.group.displayName.advanced": "Avanzado",
"loc.input.label.filesharePath": "Ruta de acceso del recurso compartido de archivos",
"loc.input.help.filesharePath": "Ruta de acceso del recurso compartido de archivos; por ejemplo, \\\\server\\folder",
"loc.input.label.artifactName": "Nombre del artefacto",
"loc.input.help.artifactName": "El nombre del artefacto para descargar; p. ej., drop",
"loc.input.label.itemPattern": "Patrón de coincidencia",
"loc.input.help.itemPattern": "Especifique los archivos que se van a descargar como patrón de minimatch multilínea. [Más información](https://aka.ms/minimatchexamples) <p> El patrón predeterminado (\\*\\*) descargará todos los archivos del artefacto.</p>",
"loc.input.label.downloadPath": "Ruta de acceso de descarga",
"loc.input.help.downloadPath": "Ruta de acceso en la máquina del agente donde se descargarán los artefactos",
"loc.input.label.parallelizationLimit": "Límite de paralelización",
"loc.input.help.parallelizationLimit": "Número de archivos para descargar simultáneamente",
"loc.messages.DownloadArtifacts": "Descargando el artefacto %s desde: %s",
"loc.messages.ArtifactsSuccessfullyDownloaded": "Los artefactos se han descargado correctamente en %s",
"loc.messages.ArtifactNameDirectoryNotFound": "El directorio \"%s\" no existe. Se usa el directorio primario: %s"
} | {
"pile_set_name": "Github"
} |
/*! This file is auto-generated */
.wrap [class*="CodeMirror-lint-marker"],
.wp-core-ui [class*="CodeMirror-lint-message"],
.wrap .CodeMirror-lint-marker-multiple {
background-image: none;
}
.wp-core-ui .CodeMirror-lint-marker-error,
.wp-core-ui .CodeMirror-lint-marker-warning {
cursor: help;
}
.wrap .CodeMirror-lint-marker-multiple {
position: absolute;
top: 0;
}
.wrap [class*="CodeMirror-lint-marker"]:before {
font: normal 18px/1 dashicons;
position: relative;
top: -2px;
}
.wp-core-ui [class*="CodeMirror-lint-message"]:before {
font: normal 16px/1 dashicons;
right: 16px;
position: absolute;
}
.wp-core-ui .CodeMirror-lint-message-error,
.wp-core-ui .CodeMirror-lint-message-warning {
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
margin: 5px 0 2px;
padding: 3px 28px 3px 12px;
}
.wp-core-ui .CodeMirror-lint-message-warning {
background-color: #fff8e5;
border-right: 4px solid #ffb900;
}
.wrap .CodeMirror-lint-marker-warning:before,
.wp-core-ui .CodeMirror-lint-message-warning:before {
content: "\f534";
color: #f6a306;
}
.wp-core-ui .CodeMirror-lint-message-error {
background-color: #fbeaea;
border-right: 4px solid #dc3232;
}
.wrap .CodeMirror-lint-marker-error:before,
.wp-core-ui .CodeMirror-lint-message-error:before {
content: "\f153";
color: #dc3232;
}
.wp-core-ui .CodeMirror-lint-tooltip {
background: none;
border: none;
border-radius: 0;
direction: rtl;
}
.wrap .CodeMirror .CodeMirror-matchingbracket {
background: rgba(255, 150, 0, 0.3);
color: inherit;
}
.CodeMirror {
text-align: right;
}
.wrap .CodeMirror .CodeMirror-linenumber {
color: #666;
}
| {
"pile_set_name": "Github"
} |
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <msgpack/preprocessor/slot/detail/shared.hpp>
#
# undef MSGPACK_PP_SLOT_1
#
# undef MSGPACK_PP_SLOT_1_DIGIT_1
# undef MSGPACK_PP_SLOT_1_DIGIT_2
# undef MSGPACK_PP_SLOT_1_DIGIT_3
# undef MSGPACK_PP_SLOT_1_DIGIT_4
# undef MSGPACK_PP_SLOT_1_DIGIT_5
# undef MSGPACK_PP_SLOT_1_DIGIT_6
# undef MSGPACK_PP_SLOT_1_DIGIT_7
# undef MSGPACK_PP_SLOT_1_DIGIT_8
# undef MSGPACK_PP_SLOT_1_DIGIT_9
# undef MSGPACK_PP_SLOT_1_DIGIT_10
#
# if MSGPACK_PP_SLOT_TEMP_10 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_10 0
# elif MSGPACK_PP_SLOT_TEMP_10 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_10 1
# elif MSGPACK_PP_SLOT_TEMP_10 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_10 2
# elif MSGPACK_PP_SLOT_TEMP_10 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_10 3
# elif MSGPACK_PP_SLOT_TEMP_10 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_10 4
# elif MSGPACK_PP_SLOT_TEMP_10 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_10 5
# elif MSGPACK_PP_SLOT_TEMP_10 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_10 6
# elif MSGPACK_PP_SLOT_TEMP_10 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_10 7
# elif MSGPACK_PP_SLOT_TEMP_10 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_10 8
# elif MSGPACK_PP_SLOT_TEMP_10 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_10 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_9 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_9 0
# elif MSGPACK_PP_SLOT_TEMP_9 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_9 1
# elif MSGPACK_PP_SLOT_TEMP_9 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_9 2
# elif MSGPACK_PP_SLOT_TEMP_9 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_9 3
# elif MSGPACK_PP_SLOT_TEMP_9 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_9 4
# elif MSGPACK_PP_SLOT_TEMP_9 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_9 5
# elif MSGPACK_PP_SLOT_TEMP_9 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_9 6
# elif MSGPACK_PP_SLOT_TEMP_9 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_9 7
# elif MSGPACK_PP_SLOT_TEMP_9 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_9 8
# elif MSGPACK_PP_SLOT_TEMP_9 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_9 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_8 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_8 0
# elif MSGPACK_PP_SLOT_TEMP_8 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_8 1
# elif MSGPACK_PP_SLOT_TEMP_8 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_8 2
# elif MSGPACK_PP_SLOT_TEMP_8 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_8 3
# elif MSGPACK_PP_SLOT_TEMP_8 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_8 4
# elif MSGPACK_PP_SLOT_TEMP_8 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_8 5
# elif MSGPACK_PP_SLOT_TEMP_8 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_8 6
# elif MSGPACK_PP_SLOT_TEMP_8 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_8 7
# elif MSGPACK_PP_SLOT_TEMP_8 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_8 8
# elif MSGPACK_PP_SLOT_TEMP_8 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_8 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_7 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_7 0
# elif MSGPACK_PP_SLOT_TEMP_7 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_7 1
# elif MSGPACK_PP_SLOT_TEMP_7 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_7 2
# elif MSGPACK_PP_SLOT_TEMP_7 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_7 3
# elif MSGPACK_PP_SLOT_TEMP_7 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_7 4
# elif MSGPACK_PP_SLOT_TEMP_7 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_7 5
# elif MSGPACK_PP_SLOT_TEMP_7 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_7 6
# elif MSGPACK_PP_SLOT_TEMP_7 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_7 7
# elif MSGPACK_PP_SLOT_TEMP_7 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_7 8
# elif MSGPACK_PP_SLOT_TEMP_7 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_7 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_6 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_6 0
# elif MSGPACK_PP_SLOT_TEMP_6 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_6 1
# elif MSGPACK_PP_SLOT_TEMP_6 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_6 2
# elif MSGPACK_PP_SLOT_TEMP_6 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_6 3
# elif MSGPACK_PP_SLOT_TEMP_6 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_6 4
# elif MSGPACK_PP_SLOT_TEMP_6 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_6 5
# elif MSGPACK_PP_SLOT_TEMP_6 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_6 6
# elif MSGPACK_PP_SLOT_TEMP_6 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_6 7
# elif MSGPACK_PP_SLOT_TEMP_6 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_6 8
# elif MSGPACK_PP_SLOT_TEMP_6 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_6 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_5 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_5 0
# elif MSGPACK_PP_SLOT_TEMP_5 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_5 1
# elif MSGPACK_PP_SLOT_TEMP_5 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_5 2
# elif MSGPACK_PP_SLOT_TEMP_5 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_5 3
# elif MSGPACK_PP_SLOT_TEMP_5 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_5 4
# elif MSGPACK_PP_SLOT_TEMP_5 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_5 5
# elif MSGPACK_PP_SLOT_TEMP_5 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_5 6
# elif MSGPACK_PP_SLOT_TEMP_5 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_5 7
# elif MSGPACK_PP_SLOT_TEMP_5 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_5 8
# elif MSGPACK_PP_SLOT_TEMP_5 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_5 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_4 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_4 0
# elif MSGPACK_PP_SLOT_TEMP_4 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_4 1
# elif MSGPACK_PP_SLOT_TEMP_4 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_4 2
# elif MSGPACK_PP_SLOT_TEMP_4 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_4 3
# elif MSGPACK_PP_SLOT_TEMP_4 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_4 4
# elif MSGPACK_PP_SLOT_TEMP_4 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_4 5
# elif MSGPACK_PP_SLOT_TEMP_4 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_4 6
# elif MSGPACK_PP_SLOT_TEMP_4 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_4 7
# elif MSGPACK_PP_SLOT_TEMP_4 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_4 8
# elif MSGPACK_PP_SLOT_TEMP_4 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_4 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_3 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_3 0
# elif MSGPACK_PP_SLOT_TEMP_3 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_3 1
# elif MSGPACK_PP_SLOT_TEMP_3 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_3 2
# elif MSGPACK_PP_SLOT_TEMP_3 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_3 3
# elif MSGPACK_PP_SLOT_TEMP_3 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_3 4
# elif MSGPACK_PP_SLOT_TEMP_3 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_3 5
# elif MSGPACK_PP_SLOT_TEMP_3 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_3 6
# elif MSGPACK_PP_SLOT_TEMP_3 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_3 7
# elif MSGPACK_PP_SLOT_TEMP_3 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_3 8
# elif MSGPACK_PP_SLOT_TEMP_3 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_3 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_2 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_2 0
# elif MSGPACK_PP_SLOT_TEMP_2 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_2 1
# elif MSGPACK_PP_SLOT_TEMP_2 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_2 2
# elif MSGPACK_PP_SLOT_TEMP_2 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_2 3
# elif MSGPACK_PP_SLOT_TEMP_2 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_2 4
# elif MSGPACK_PP_SLOT_TEMP_2 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_2 5
# elif MSGPACK_PP_SLOT_TEMP_2 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_2 6
# elif MSGPACK_PP_SLOT_TEMP_2 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_2 7
# elif MSGPACK_PP_SLOT_TEMP_2 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_2 8
# elif MSGPACK_PP_SLOT_TEMP_2 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_2 9
# endif
#
# if MSGPACK_PP_SLOT_TEMP_1 == 0
# define MSGPACK_PP_SLOT_1_DIGIT_1 0
# elif MSGPACK_PP_SLOT_TEMP_1 == 1
# define MSGPACK_PP_SLOT_1_DIGIT_1 1
# elif MSGPACK_PP_SLOT_TEMP_1 == 2
# define MSGPACK_PP_SLOT_1_DIGIT_1 2
# elif MSGPACK_PP_SLOT_TEMP_1 == 3
# define MSGPACK_PP_SLOT_1_DIGIT_1 3
# elif MSGPACK_PP_SLOT_TEMP_1 == 4
# define MSGPACK_PP_SLOT_1_DIGIT_1 4
# elif MSGPACK_PP_SLOT_TEMP_1 == 5
# define MSGPACK_PP_SLOT_1_DIGIT_1 5
# elif MSGPACK_PP_SLOT_TEMP_1 == 6
# define MSGPACK_PP_SLOT_1_DIGIT_1 6
# elif MSGPACK_PP_SLOT_TEMP_1 == 7
# define MSGPACK_PP_SLOT_1_DIGIT_1 7
# elif MSGPACK_PP_SLOT_TEMP_1 == 8
# define MSGPACK_PP_SLOT_1_DIGIT_1 8
# elif MSGPACK_PP_SLOT_TEMP_1 == 9
# define MSGPACK_PP_SLOT_1_DIGIT_1 9
# endif
#
# if MSGPACK_PP_SLOT_1_DIGIT_10
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_10(MSGPACK_PP_SLOT_1_DIGIT_10, MSGPACK_PP_SLOT_1_DIGIT_9, MSGPACK_PP_SLOT_1_DIGIT_8, MSGPACK_PP_SLOT_1_DIGIT_7, MSGPACK_PP_SLOT_1_DIGIT_6, MSGPACK_PP_SLOT_1_DIGIT_5, MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_9
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_9(MSGPACK_PP_SLOT_1_DIGIT_9, MSGPACK_PP_SLOT_1_DIGIT_8, MSGPACK_PP_SLOT_1_DIGIT_7, MSGPACK_PP_SLOT_1_DIGIT_6, MSGPACK_PP_SLOT_1_DIGIT_5, MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_8
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_8(MSGPACK_PP_SLOT_1_DIGIT_8, MSGPACK_PP_SLOT_1_DIGIT_7, MSGPACK_PP_SLOT_1_DIGIT_6, MSGPACK_PP_SLOT_1_DIGIT_5, MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_7
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_7(MSGPACK_PP_SLOT_1_DIGIT_7, MSGPACK_PP_SLOT_1_DIGIT_6, MSGPACK_PP_SLOT_1_DIGIT_5, MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_6
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_6(MSGPACK_PP_SLOT_1_DIGIT_6, MSGPACK_PP_SLOT_1_DIGIT_5, MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_5
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_5(MSGPACK_PP_SLOT_1_DIGIT_5, MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_4
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_4(MSGPACK_PP_SLOT_1_DIGIT_4, MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_3
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_3(MSGPACK_PP_SLOT_1_DIGIT_3, MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# elif MSGPACK_PP_SLOT_1_DIGIT_2
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_CC_2(MSGPACK_PP_SLOT_1_DIGIT_2, MSGPACK_PP_SLOT_1_DIGIT_1)
# else
# define MSGPACK_PP_SLOT_1() MSGPACK_PP_SLOT_1_DIGIT_1
# endif
| {
"pile_set_name": "Github"
} |
// Python Tools for Visual Studio
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Options;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Repl;
namespace Microsoft.PythonTools {
/// <summary>
/// Exposes language specific options for Python via automation. This object
/// can be fetched using Dte.GetObject("VsPython").
/// </summary>
[ComVisible(true)]
public sealed class PythonAutomation : IVsPython, IPythonOptions3, IPythonIntellisenseOptions {
private readonly IServiceProvider _serviceProvider;
private readonly PythonToolsService _pyService;
private AutomationInteractiveOptions _interactiveOptions;
internal PythonAutomation(IServiceProvider serviceProvider) {
_serviceProvider = serviceProvider;
_pyService = serviceProvider.GetPythonToolsService();
Debug.Assert(_pyService != null, "Did not find PythonToolsService");
}
#region IPythonOptions Members
IPythonIntellisenseOptions IPythonOptions.Intellisense {
get { return this; }
}
IPythonInteractiveOptions IPythonOptions.Interactive {
get {
if (_interactiveOptions == null) {
_interactiveOptions = new AutomationInteractiveOptions(_serviceProvider);
}
return _interactiveOptions;
}
}
bool IPythonOptions.PromptBeforeRunningWithBuildErrorSetting {
get {
return _pyService.DebuggerOptions.PromptBeforeRunningWithBuildError;
}
set {
_pyService.DebuggerOptions.PromptBeforeRunningWithBuildError = value;
_pyService.DebuggerOptions.Save();
}
}
Severity IPythonOptions.IndentationInconsistencySeverity {
get {
return _pyService.GeneralOptions.IndentationInconsistencySeverity;
}
set {
_pyService.GeneralOptions.IndentationInconsistencySeverity = value;
_pyService.GeneralOptions.Save();
}
}
bool IPythonOptions.AutoAnalyzeStandardLibrary {
get {
return _pyService.GeneralOptions.AutoAnalyzeStandardLibrary;
}
set {
_pyService.GeneralOptions.AutoAnalyzeStandardLibrary = value;
_pyService.GeneralOptions.Save();
}
}
bool IPythonOptions.TeeStandardOutput {
get {
return _pyService.DebuggerOptions.TeeStandardOutput;
}
set {
_pyService.DebuggerOptions.TeeStandardOutput = value;
_pyService.DebuggerOptions.Save();
}
}
bool IPythonOptions.WaitOnAbnormalExit {
get {
return _pyService.DebuggerOptions.WaitOnAbnormalExit;
}
set {
_pyService.DebuggerOptions.WaitOnAbnormalExit = value;
_pyService.DebuggerOptions.Save();
}
}
bool IPythonOptions.WaitOnNormalExit {
get {
return _pyService.DebuggerOptions.WaitOnNormalExit;
}
set {
_pyService.DebuggerOptions.WaitOnNormalExit = value;
_pyService.DebuggerOptions.Save();
}
}
public bool UseLegacyDebugger {
get {
return _pyService.DebuggerOptions.UseLegacyDebugger;
}
set {
_pyService.DebuggerOptions.UseLegacyDebugger = value;
_pyService.DebuggerOptions.Save();
}
}
bool IPythonOptions3.PromptForEnvCreate {
get {
return _pyService.GeneralOptions.PromptForEnvCreate;
}
set {
_pyService.GeneralOptions.PromptForEnvCreate = value;
_pyService.GeneralOptions.Save();
}
}
bool IPythonOptions3.PromptForPackageInstallation {
get {
return _pyService.GeneralOptions.PromptForPackageInstallation;
}
set {
_pyService.GeneralOptions.PromptForPackageInstallation = value;
_pyService.GeneralOptions.Save();
}
}
#endregion
#region IPythonIntellisenseOptions Members
bool IPythonIntellisenseOptions.AddNewLineAtEndOfFullyTypedWord {
get {
return _pyService.AdvancedOptions.AddNewLineAtEndOfFullyTypedWord;
}
set {
_pyService.AdvancedOptions.AddNewLineAtEndOfFullyTypedWord = value;
_pyService.AdvancedOptions.Save();
}
}
bool IPythonIntellisenseOptions.EnterCommitsCompletion {
get {
return _pyService.AdvancedOptions.EnterCommitsIntellisense;
}
set {
_pyService.AdvancedOptions.EnterCommitsIntellisense = value;
_pyService.AdvancedOptions.Save();
}
}
bool IPythonIntellisenseOptions.UseMemberIntersection {
get {
return _pyService.AdvancedOptions.IntersectMembers;
}
set {
_pyService.AdvancedOptions.IntersectMembers = value;
_pyService.AdvancedOptions.Save();
}
}
string IPythonIntellisenseOptions.CompletionCommittedBy {
get {
return _pyService.AdvancedOptions.CompletionCommittedBy;
}
set {
_pyService.AdvancedOptions.CompletionCommittedBy = value;
_pyService.AdvancedOptions.Save();
}
}
bool IPythonIntellisenseOptions.AutoListIdentifiers {
get {
return _pyService.AdvancedOptions.AutoListIdentifiers;
}
set {
_pyService.AdvancedOptions.AutoListIdentifiers = value;
_pyService.AdvancedOptions.Save();
}
}
#endregion
void IVsPython.OpenInteractive(string description) {
var compModel = _pyService.ComponentModel;
if (compModel == null) {
throw new InvalidOperationException("Could not activate component model");
}
var provider = compModel.GetService<InteractiveWindowProvider>();
var interpreters = compModel.GetService<IInterpreterRegistryService>();
var factory = interpreters.Configurations
.Where(PythonInterpreterFactoryExtensions.IsRunnable)
.FirstOrDefault(f => f.Description.Equals(description, StringComparison.CurrentCultureIgnoreCase));
if (factory == null) {
throw new KeyNotFoundException("Could not create interactive window with name: " + description);
}
var window = provider.OpenOrCreate(
PythonReplEvaluatorProvider.GetEvaluatorId(factory)
);
if (window == null) {
throw new InvalidOperationException("Could not create interactive window");
}
window.Show(true);
}
}
[ComVisible(true)]
public sealed class AutomationInteractiveOptions : IPythonInteractiveOptions {
private readonly IServiceProvider _serviceProvider;
public AutomationInteractiveOptions(IServiceProvider serviceProvider) {
_serviceProvider = serviceProvider;
}
internal PythonInteractiveOptions CurrentOptions {
get {
return _serviceProvider.GetPythonToolsService().InteractiveOptions;
}
}
private void SaveSettingsToStorage() {
CurrentOptions.Save();
}
bool IPythonInteractiveOptions.UseSmartHistory {
get {
return CurrentOptions.UseSmartHistory;
}
set {
CurrentOptions.UseSmartHistory = value;
SaveSettingsToStorage();
}
}
string IPythonInteractiveOptions.CompletionMode {
get {
return CurrentOptions.CompletionMode.ToString();
}
set {
ReplIntellisenseMode mode;
if (Enum.TryParse(value, out mode)) {
CurrentOptions.CompletionMode = mode;
SaveSettingsToStorage();
} else {
throw new InvalidOperationException(
String.Format(
"Bad intellisense mode, must be one of: {0}",
String.Join(", ", Enum.GetNames(typeof(ReplIntellisenseMode)))
)
);
}
}
}
string IPythonInteractiveOptions.StartupScripts {
get {
return CurrentOptions.Scripts;
}
set {
CurrentOptions.Scripts = value;
SaveSettingsToStorage();
}
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2014 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef KFD_KERNEL_QUEUE_H_
#define KFD_KERNEL_QUEUE_H_
#include <linux/list.h>
#include <linux/types.h>
#include "kfd_priv.h"
/**
* kq_acquire_packet_buffer: Returns a pointer to the location in the kernel
* queue ring buffer where the calling function can write its packet. It is
* Guaranteed that there is enough space for that packet. It also updates the
* pending write pointer to that location so subsequent calls to
* acquire_packet_buffer will get a correct write pointer
*
* kq_submit_packet: Update the write pointer and doorbell of a kernel queue.
*
* kq_rollback_packet: This routine is called if we failed to build an acquired
* packet for some reason. It just overwrites the pending wptr with the current
* one
*
*/
int kq_acquire_packet_buffer(struct kernel_queue *kq,
size_t packet_size_in_dwords,
unsigned int **buffer_ptr);
void kq_submit_packet(struct kernel_queue *kq);
void kq_rollback_packet(struct kernel_queue *kq);
struct kernel_queue {
/* data */
struct kfd_dev *dev;
struct mqd_manager *mqd_mgr;
struct queue *queue;
uint64_t pending_wptr64;
uint32_t pending_wptr;
unsigned int nop_packet;
struct kfd_mem_obj *rptr_mem;
uint32_t *rptr_kernel;
uint64_t rptr_gpu_addr;
struct kfd_mem_obj *wptr_mem;
union {
uint64_t *wptr64_kernel;
uint32_t *wptr_kernel;
};
uint64_t wptr_gpu_addr;
struct kfd_mem_obj *pq;
uint64_t pq_gpu_addr;
uint32_t *pq_kernel_addr;
struct kfd_mem_obj *eop_mem;
uint64_t eop_gpu_addr;
uint32_t *eop_kernel_addr;
struct kfd_mem_obj *fence_mem_obj;
uint64_t fence_gpu_addr;
void *fence_kernel_address;
struct list_head list;
};
#endif /* KFD_KERNEL_QUEUE_H_ */
| {
"pile_set_name": "Github"
} |
<refentry id="section.title.level1.properties">
<refmeta>
<refentrytitle>section.title.level1.properties</refentrytitle>
<refmiscinfo role="type">attribute set</refmiscinfo>
</refmeta>
<refnamediv>
<refname>section.title.level1.properties</refname>
<refpurpose>Properties for level-1 section titles</refpurpose>
</refnamediv>
<refsynopsisdiv>
<src:fragment id='section.title.level1.properties.frag'>
<xsl:attribute-set name="section.title.level1.properties">
<xsl:attribute name="font-size">
<xsl:value-of select="$body.font.master * 2.0736"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
</xsl:attribute-set>
</src:fragment>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>The properties of level-1 section titles.</para>
</refsect1>
</refentry>
| {
"pile_set_name": "Github"
} |
package org.matsim.contrib.freight.usecases.chessboard;
import java.io.FileWriter;
import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.events.Event;
import org.matsim.api.core.v01.events.LinkEnterEvent;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.population.Activity;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.contrib.freight.carrier.Carrier;
import org.matsim.contrib.freight.carrier.CarrierPlan;
import org.matsim.contrib.freight.carrier.CarrierUtils;
import org.matsim.contrib.freight.carrier.CarrierVehicle;
import org.matsim.contrib.freight.carrier.ScheduledTour;
import org.matsim.contrib.freight.carrier.TimeWindow;
import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory;
import org.matsim.contrib.freight.controler.FreightActivity;
import org.matsim.contrib.freight.jsprit.VehicleTypeDependentRoadPricingCalculator;
import org.matsim.core.gbl.Gbl;
import org.matsim.core.population.routes.NetworkRoute;
import org.matsim.core.scoring.ScoringFunction;
import org.matsim.core.scoring.SumScoringFunction;
import com.google.inject.Inject;
/**
* Defines example carrier scoring function (factory).
*
* <p>Just saw that there are some Deprecations. Needs to be adapted.
*
* @author stefan
*
*/
public final class CarrierScoringFunctionFactoryImpl implements CarrierScoringFunctionFactory{
/**
*
* Example activity scoring that penalizes missed time-windows with 1.0 per second.
*
* @author stefan
*
*/
static class DriversActivityScoring implements SumScoringFunction.BasicScoring, SumScoringFunction.ActivityScoring {
private static Logger log = Logger.getLogger(DriversActivityScoring.class);
private double score;
private double timeParameter = 0.008;
private double missedTimeWindowPenalty = 0.01;
private FileWriter fileWriter;
public DriversActivityScoring() {
super();
}
@Override
public void finish() {
}
@Override
public double getScore() {
return score;
}
@Override
public void handleFirstActivity(Activity act) {
handleActivity(act);
}
@Override
public void handleActivity(Activity act) {
if(act instanceof FreightActivity) {
double actStartTime = act.getStartTime().seconds();
// log.info(act + " start: " + Time.writeTime(actStartTime));
TimeWindow tw = ((FreightActivity) act).getTimeWindow();
if(actStartTime > tw.getEnd()){
double penalty_score = (-1)*(actStartTime - tw.getEnd())*missedTimeWindowPenalty;
if (!(penalty_score <= 0.0)) throw new AssertionError("penalty score must be negative");
// log.info("penalty " + penalty_score);
score += penalty_score;
}
double actTimeCosts = (act.getEndTime().seconds() -actStartTime)*timeParameter;
// log.info("actCosts " + actTimeCosts);
if (!(actTimeCosts >= 0.0)) throw new AssertionError("actTimeCosts must be positive");
score += actTimeCosts*(-1);
}
}
@Override
public void handleLastActivity(Activity act) {
handleActivity(act);
}
}
static class VehicleEmploymentScoring implements SumScoringFunction.BasicScoring {
private Carrier carrier;
private FileWriter fileWriter;
public VehicleEmploymentScoring(Carrier carrier) {
super();
this.carrier = carrier;
}
@Override
public void finish() {
}
@Override
public double getScore() {
double score = 0.;
CarrierPlan selectedPlan = carrier.getSelectedPlan();
if(selectedPlan == null) return 0.;
for(ScheduledTour tour : selectedPlan.getScheduledTours()){
if(!tour.getTour().getTourElements().isEmpty()){
score += (-1)*tour.getVehicle().getType().getCostInformation().getFixedCosts();
}
}
return score;
}
}
/**
* Example leg scoring.
*
* @author stefan
*
*/
static class DriversLegScoring implements SumScoringFunction.BasicScoring, SumScoringFunction.LegScoring {
private static Logger log = Logger.getLogger(DriversLegScoring.class);
private double score = 0.0;
private final Network network;
private final Carrier carrier;
private Set<CarrierVehicle> employedVehicles;
public DriversLegScoring(Carrier carrier, Network network) {
super();
this.network = network;
this.carrier = carrier;
employedVehicles = new HashSet<CarrierVehicle>();
}
@Override
public void finish() {
}
@Override
public double getScore() {
return score;
}
private double getTimeParameter(CarrierVehicle vehicle) {
return vehicle.getType().getCostInformation().getCostsPerSecond();
}
private double getDistanceParameter(CarrierVehicle vehicle) {
return vehicle.getType().getCostInformation().getCostsPerMeter();
}
// private CarrierVehicle getVehicle(Id vehicleId) {
// CarrierUtils.getCarrierVehicle(carrier, vehicleId);
// if(carrier.getCarrierCapabilities().getCarrierVehicles().containsKey(vehicleId)){
// return carrier.getCarrierCapabilities().getCarrierVehicles().get(vehicleId);
// }
// log.error("Vehicle with Id does not exists", new IllegalStateException("vehicle with id " + vehicleId + " is missing"));
// return null;
// }
@Override
public void handleLeg(Leg leg) {
if(leg.getRoute() instanceof NetworkRoute){
NetworkRoute nRoute = (NetworkRoute) leg.getRoute();
Id vehicleId = nRoute.getVehicleId();
CarrierVehicle vehicle = CarrierUtils.getCarrierVehicle(carrier, vehicleId);
Gbl.assertNotNull(vehicle);
if(!employedVehicles.contains(vehicle)){
employedVehicles.add(vehicle);
}
double distance = 0.0;
double toll = 0.;
if(leg.getRoute() instanceof NetworkRoute){
Link startLink = network.getLinks().get(leg.getRoute().getStartLinkId());
distance += startLink.getLength();
for(Id linkId : ((NetworkRoute) leg.getRoute()).getLinkIds()){
distance += network.getLinks().get(linkId).getLength();
}
distance += network.getLinks().get(leg.getRoute().getEndLinkId()).getLength();
}
double distanceCosts = distance*getDistanceParameter(vehicle);
if (!(distanceCosts >= 0.0)) throw new AssertionError("distanceCosts must be positive");
score += (-1) * distanceCosts;
double timeCosts = leg.getTravelTime().seconds() *getTimeParameter(vehicle);
if (!(timeCosts >= 0.0)) throw new AssertionError("distanceCosts must be positive");
score += (-1) * timeCosts;
}
}
}
static class TollScoring implements SumScoringFunction.BasicScoring, SumScoringFunction.ArbitraryEventScoring {
private static Logger log = Logger.getLogger(TollScoring.class);
private double score = 0.;
private Carrier carrier;
private Network network;
private VehicleTypeDependentRoadPricingCalculator roadPricing;
public TollScoring(Carrier carrier, Network network, VehicleTypeDependentRoadPricingCalculator roadPricing) {
this.carrier = carrier;
this.roadPricing = roadPricing;
this.network = network;
}
@Override
public void handleEvent(Event event) {
if(event instanceof LinkEnterEvent){
CarrierVehicle carrierVehicle = CarrierUtils.getCarrierVehicle(carrier, ((LinkEnterEvent) event).getVehicleId());
if(carrierVehicle == null) throw new IllegalStateException("carrier vehicle missing");
double toll = roadPricing.getTollAmount(carrierVehicle.getType().getId(),network.getLinks().get(((LinkEnterEvent) event).getLinkId() ),event.getTime() );
if(toll > 0.) System.out.println("bing: vehicle " + carrierVehicle.getId() + " paid toll " + toll + "" );
score += (-1) * toll;
}
}
// private CarrierVehicle getVehicle(Id<Vehicle> vehicleId) {
// if(carrier.getCarrierCapabilities().getCarrierVehicles().containsKey(vehicleId)){
// return carrier.getCarrierCapabilities().getCarrierVehicles().get(vehicleId);
// }
// log.error("Vehicle with Id does not exists", new IllegalStateException("vehicle with id " + vehicleId + " is missing"));
// return null;
// }
@Override
public void finish() {
}
@Override
public double getScore() {
return score;
}
}
private Network network;
@Inject
public CarrierScoringFunctionFactoryImpl(Network network) {
super();
this.network = network;
}
@Override
public ScoringFunction createScoringFunction(Carrier carrier) {
SumScoringFunction sf = new SumScoringFunction();
DriversLegScoring driverLegScoring = new DriversLegScoring(carrier, network);
VehicleEmploymentScoring vehicleEmployment = new VehicleEmploymentScoring(carrier);
// DriversActivityScoring actScoring = new DriversActivityScoring();
sf.addScoringFunction(driverLegScoring);
sf.addScoringFunction(vehicleEmployment);
// sf.addScoringFunction(actScoring);
return sf;
}
}
| {
"pile_set_name": "Github"
} |
/**************************************************************************//**
* @file timer_reg.h
* @version V1.00
* @brief TIMER register definition header file
*
* @copyright (C) 2017 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __TIMER_REG_H__
#define __TIMER_REG_H__
#if defined ( __CC_ARM )
#pragma anon_unions
#endif
/**
@addtogroup REGISTER Control Register
@{
*/
/**
@addtogroup TIMER Timer Controller(TIMER)
Memory Mapped Structure for TIMER Controller
@{ */
typedef struct
{
/**
* @var TIMER_T::CTL
* Offset: 0x00 Timer Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[7:0] |PSC |Prescale Counter
* | | |Timer input clock or event source is divided by (PSC+1) before it is fed to the timer up counter
* | | |If this field is 0 (PSC = 0), then there is no scaling.
* | | |Note: Update prescale counter value will reset internal 8-bit prescale counter and 24-bit up counter value.
* |[19] |INTRGEN |Inter-timer Trigger Mode Enable Control
* | | |Setting this bit will enable the inter-timer trigger capture function.
* | | |The Timer0/2 will be in event counter mode and counting with external clock source or event
* | | |Also, Timer1/3 will be in trigger-counting mode of capture function.
* | | |0 = Inter-Timer Trigger Capture mode Disabled.
* | | |1 = Inter-Timer Trigger Capture mode Enabled.
* | | |Note: For Timer1/3, this bit is ignored and the read back value is always 0.
* |[20] |PERIOSEL |Periodic Mode Behavior Selection Enable Bit
* | | |0 = The behavior selection in periodic mode is Disabled.
* | | |When user updates CMPDAT while timer is running in periodic mode,
* | | |CNT will be reset to default value.
* | | |1 = The behavior selection in periodic mode is Enabled.
* | | |When user update CMPDAT while timer is running in periodic mode, the limitations as bellows list,
* | | |If updated CMPDAT value > CNT, CMPDAT will be updated and CNT keep running continually.
* | | |If updated CMPDAT value = CNT, timer time-out interrupt will be asserted immediately.
* | | |If updated CMPDAT value < CNT, CNT will be reset to default value.
* |[21] |TGLPINSEL |Toggle-output Pin Select
* | | |0 = Toggle mode output to TMx (Timer Event Counter Pin).
* | | |1 = Toggle mode output to TMx_EXT (Timer External Capture Pin).
* |[22] |CAPSRC |Capture Pin Source Selection
* | | |0 = Capture Function source is from TMx_EXT (x= 0~3) pin.
* | | |1 = Capture Function source is from internal ACMP output signal
* | | |User can set ACMPSSEL (TIMERx_EXTCTL[8]) to decide which internal ACMP output signal as timer capture source.
* |[23] |WKEN |Wake-up Function Enable Bit
* | | |If this bit is set to 1, while timer interrupt flag TIF (TIMERx_INTSTS[0]) is 1 and INTEN (TIMERx_CTL[29]) is enabled, the timer interrupt signal will generate a wake-up trigger event to CPU.
* | | |0 = Wake-up function Disabled if timer interrupt signal generated.
* | | |1 = Wake-up function Enabled if timer interrupt signal generated.
* |[24] |EXTCNTEN |Event Counter Mode Enable Bit
* | | |This bit is for external counting pin function enabled.
* | | |0 = Event counter mode Disabled.
* | | |1 = Event counter mode Enabled.
* | | |Note: When timer is used as an event counter, this bit should be set to 1 and select PCLK as timer clock source.
* |[25] |ACTSTS |Timer Active Status Bit (Read Only)
* | | |This bit indicates the 24-bit up counter status.
* | | |0 = 24-bit up counter is not active.
* | | |1 = 24-bit up counter is active.
* | | |Note: This bit may active when CNT 0 transition to CNT 1.
* |[28:27] |OPMODE |Timer Counting Mode Select
* | | |00 = The Timer controller is operated in One-shot mode.
* | | |01 = The Timer controller is operated in Periodic mode.
* | | |10 = The Timer controller is operated in Toggle-output mode.
* | | |11 = The Timer controller is operated in Continuous Counting mode.
* |[29] |INTEN |Timer Interrupt Enable Bit
* | | |0 = Timer time-out interrupt Disabled.
* | | |1 = Timer time-out interrupt Enabled.
* | | |Note: If this bit is enabled, when the timer time-out interrupt flag TIF is set to 1, the timer interrupt signal is generated and inform to CPU.
* |[30] |CNTEN |Timer Counting Enable Bit
* | | |0 = Stops/Suspends counting.
* | | |1 = Starts counting.
* | | |Note1: In stop status, and then set CNTEN to 1 will enable the 24-bit up counter to keep counting from the last stop counting value.
* | | |Note2: This bit is auto-cleared by hardware in one-shot mode (TIMER_CTL[28:27] = 00) when the timer time-out interrupt flag TIF (TIMERx_INTSTS[0]) is generated.
* | | |Note3: Set enable/disable this bit needs 2 * TMR_CLK period to become active, user can read ACTSTS (TIMERx_CTL[25]) to check enable/disable command is completed or not.
* |[31] |ICEDEBUG |ICE Debug Mode Acknowledge Disable Control (Write Protect)
* | | |0 = ICE debug mode acknowledgement effects TIMER counting.
* | | |TIMER counter will be held while CPU is held by ICE.
* | | |1 = ICE debug mode acknowledgement Disabled.
* | | |TIMER counter will keep going no matter CPU is held by ICE or not.
* | | |Note: This bit is write protected. Refer to the SYS_REGLCTL register.
* @var TIMER_T::CMP
* Offset: 0x04 Timer Comparator Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[23:0] |CMPDAT |Timer Comparator Value
* | | |CMPDAT is a 24-bit compared value register
* | | |When the internal 24-bit up counter value is equal to CMPDAT value, the TIF (TIMERx_INTSTS[0] Timer Interrupt Flag) will set to 1.
* | | |Time-out period = (Period of timer clock input) * (8-bit PSC + 1) * (24-bit CMPDAT).
* | | |Note1: Never write 0x0 or 0x1 in CMPDAT field, or the core will run into unknown state.
* | | |Note2: When timer is operating at continuous counting mode, the 24-bit up counter will keep counting continuously even if user writes a new value into CMPDAT field
* | | |But if timer is operating at other modes, the 24-bit up counter will restart counting from 0 and using newest CMPDAT value to be the timer compared value while user writes a new value into CMPDAT field.
* @var TIMER_T::INTSTS
* Offset: 0x08 Timer Interrupt Status Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |TIF |Timer Interrupt Flag
* | | |This bit indicates the interrupt flag status of Timer while 24-bit timer up counter CNT (TIMERx_CNT[23:0]) value reaches to CMPDAT (TIMERx_CMP[23:0]) value.
* | | |0 = No effect.
* | | |1 = CNT value matches the CMPDAT value.
* | | |Note: This bit is cleared by writing 1 to it.
* |[1] |TWKF |Timer Wake-up Flag
* | | |This bit indicates the interrupt wake-up flag status of timer.
* | | |0 = Timer does not cause CPU wake-up.
* | | |1 = CPU wake-up from Idle or Power-down mode if timer time-out interrupt signal generated.
* | | |Note: This bit is cleared by writing 1 to it.
* @var TIMER_T::CNT
* Offset: 0x0C Timer Data Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[23:0] |CNT |Timer Data Register
* | | |Read operation.
* | | |Read this register to get CNT value. For example:
* | | |If EXTCNTEN (TIMERx_CTL[24] ) is 0, user can read CNT value for getting current 24-bit counter value.
* | | |If EXTCNTEN (TIMERx_CTL[24] ) is 1, user can read CNT value for getting current 24-bit event input counter value.
* | | |Write operation.
* | | |Writing any value to this register will reset current CNT value to 0 and reload internal 8-bit prescale counter.
* |[31] |RSTACT |Timer Data Register Reset Active (Read Only)
* | | |This bit indicates if the counter reset operation active.
* | | |When user writes this CNT register, timer starts to reset its internal 24-bit timer up-counter to 0 and reload 8-bit pre-scale counter
* | | |At the same time, timer set this flag to 1 to indicate the counter reset operation is in progress
* | | |Once the counter reset operation done, timer clear this bit to 0 automatically.
* | | |0 = Reset operation is done.
* | | |1 = Reset operation triggered by writing TIMERx_CNT is in progress.
* | | |Note: This bit is read only.
* @var TIMER_T::CAP
* Offset: 0x10 Timer Capture Data Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[23:0] |CAPDAT |Timer Capture Data Register
* | | |When CAPEN (TIMERx_EXTCTL[3]) bit is set, CAPFUNCS (TIMERx_EXTCTL[4]) bit is 0, and a transition on TMx_EXT pin matched the CAPEDGE (TIMERx_EXTCTL[14:12]) setting, CAPIF (TIMERx_EINTSTS[0]) will set to 1 and the current timer counter value CNT (TIMERx_CNT[23:0]) will be auto-loaded into this CAPDAT field.
* @var TIMER_T::EXTCTL
* Offset: 0x14 Timer External Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CNTPHASE |Timer External Count Phase
* | | |This bit indicates the detection phase of external counting pin TMx (x= 0~3).
* | | |0 = A falling edge of external counting pin will be counted.
* | | |1 = A rising edge of external counting pin will be counted.
* |[3] |CAPEN |Timer External Capture Pin Enable Bit
* | | |This bit enables the TMx_EXT capture pin input function.
* | | |0 =TMx_EXT (x= 0~3) pin Disabled.
* | | |1 =TMx_EXT (x= 0~3) pin Enabled.
* |[4] |CAPFUNCS |Capture Function Selection
* | | |0 = External Capture Mode Enabled.
* | | |1 = External Reset Mode Enabled.
* | | |Note1: When CAPFUNCS is 0, transition on TMx_EXT (x= 0~3) pin is using to save current 24-bit timer counter value (CNT value) to CAPDAT field.
* | | |Note2: When CAPFUNCS is 1, transition on TMx_EXT (x= 0~3) pin is using to save current 24-bit timer counter value (CNT value) to CAPDAT field then CNT value will be reset immediately.
* |[5] |CAPIEN |Timer External Capture Interrupt Enable Bit
* | | |0 = TMx_EXT (x= 0~3) pin detection Interrupt Disabled.
* | | |1 = TMx_EXT (x= 0~3) pin detection Interrupt Enabled.
* | | |Note: CAPIEN is used to enable timer external interrupt
* | | |If CAPIEN enabled, timer will rise an interrupt when CAPIF (TIMERx_EINTSTS[0]) is 1.
* | | |For example, while CAPIEN = 1, CAPEN = 1, and CAPEDGE = 00, a 1 to 0 transition on the TMx_EXT pin will cause the CAPIF to be set then the interrupt signal is generated and sent to NVIC to inform CPU.
* |[6] |CAPDBEN |Timer External Capture Pin De-bounce Enable Bit
* | | |0 = TMx_EXT (x= 0~3) pin de-bounce or ACMP output de-bounce Disabled.
* | | |1 = TMx_EXT (x= 0~3) pin de-bounce or ACMP output de-bounce Enabled.
* | | |Note: If this bit is enabled, the edge detection of TMx_EXT pin or ACMP output is detected with de-bounce circuit.
* |[7] |CNTDBEN |Timer Counter Pin De-bounce Enable Bit
* | | |0 = TMx (x= 0~3) pin de-bounce Disabled.
* | | |1 = TMx (x= 0~3) pin de-bounce Enabled.
* | | |Note: If this bit is enabled, the edge detection of TMx pin is detected with de-bounce circuit.
* |[8] |ACMPSSEL |ACMP Source Selection to Trigger Capture Function
* | | |0 = Capture Function source is from internal ACMP0 output signal.
* | | |1 = Capture Function source is from internal ACMP1 output signal.
* | | |Note: these bits only available when CAPSRC (TIMERx_CTL[22]) is 1.
* |[14:12] |CAPEDGE |Timer External Capture Pin Edge Detect
* | | |When first capture event is generated, the CNT (TIMERx_CNT[23:0]) will be reset to 0 and first CAPDAT (TIMERx_CAP[23:0]) should be to 0.
* | | |000 = Capture event occurred when detect falling edge transfer on TMx_EXT (x= 0~3) pin.
* | | |001 = Capture event occurred when detect rising edge transfer on TMx_EXT (x= 0~3) pin.
* | | |010 = Capture event occurred when detect both falling and rising edge transfer on TMx_EXT (x= 0~3) pin, and first capture event occurred at falling edge transfer.
* | | |011 = Capture event occurred when detect both rising and falling edge transfer on TMx_EXT (x= 0~3) pin, and first capture event occurred at rising edge transfer..
* | | |110 = First capture event occurred at falling edge, follows capture events are at rising edge transfer on TMx_EXT (x= 0~3) pin.
* | | |111 = First capture event occurred at rising edge, follows capture events are at falling edge transfer on TMx_EXT (x= 0~3) pin.
* | | |100, 101 = Reserved.
* |[16] |ECNTSSEL |Event Counter Source Selection to Trigger Event Counter Function
* | | |0 = Event Counter input source is from TMx (x= 0~3) pin.
* | | |1 = Event Counter input source is from USB internal SOF output signal.
* @var TIMER_T::EINTSTS
* Offset: 0x18 Timer External Interrupt Status Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CAPIF |Timer External Capture Interrupt Flag
* | | |This bit indicates the timer external capture interrupt flag status.
* | | |0 = TMx_EXT (x= 0~3) pin interrupt did not occur.
* | | |1 = TMx_EXT (x= 0~3) pin interrupt occurred.
* | | |Note1: This bit is cleared by writing 1 to it.
* | | |Note2: When CAPEN (TIMERx_EXTCTL[3]) bit is set, CAPFUNCS (TIMERx_EXTCTL[4]) bit is 0, and a transition on TMx_EXT (x= 0~3) pin matched the CAPEDGE (TIMERx_EXTCTL[2:1]) setting, this bit will set to 1 by hardware.
* | | |Note3: There is a new incoming capture event detected before CPU clearing the CAPIF status
* | | |If the above condition occurred, the Timer will keep register TIMERx_CAP unchanged and drop the new capture value.
* @var TIMER_T::TRGCTL
* Offset: 0x1C Timer Trigger Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |TRGSSEL |Trigger Source Select Bit
* | | |This bit is used to select internal trigger source is form timer time-out interrupt signal or
* | | |capture interrupt signal.
* | | |0 = Time-out interrupt signal is used to internal trigger EPWM, PDMA, DAC, and EADC.
* | | |1 = Capture interrupt signal is used to internal trigger EPWM, PDMA, DAC, and EADC.
* |[1] |TRGEPWM |Trigger EPWM Enable Bit
* | | |If this bit is set to 1, each timer time-out event or capture event can be as EPWM counter clock source.
* | | |0 = Timer interrupt trigger EPWM Disabled.
* | | |1 = Timer interrupt trigger EPWM Enabled.
* | | |Note: If TRGSSEL (TIMERx_TRGCTL[0]) = 0, time-out interrupt signal as EPWM counter clock source.
* | | |If TRGSSEL (TIMERx_TRGCTL[0]) = 1, capture interrupt signal as EPWM counter clock source.
* |[2] |TRGEADC |Trigger EADC Enable Bit
* | | |If this bit is set to 1, each timer time-out event or capture event can be triggered EADC conversion.
* | | |0 = Timer interrupt trigger EADC Disabled.
* | | |1 = Timer interrupt trigger EADC Enabled.
* | | |Note: If TRGSSEL (TIMERx_TRGCTL[0]) = 0, time-out interrupt signal will trigger EADC conversion.
* | | |If TRGSSEL (TIMERx_TRGCTL[0]) = 1, capture interrupt signal will trigger EADC conversion.
* |[3] |TRGDAC |Trigger DAC Enable Bit
* | | |If this bit is set to 1, timer time-out interrupt or capture interrupt can be triggered DAC.
* | | |0 = Timer interrupt trigger DAC Disabled.
* | | |1 = Timer interrupt trigger DAC Enabled.
* | | |Note: If TRGSSEL (TIMERx_TRGCTL[0]) = 0, time-out interrupt signal will trigger DAC.
* | | |If TRGSSEL (TIMERx_TRGCTL[0]) = 1, capture interrupt signal will trigger DAC.
* |[4] |TRGPDMA |Trigger PDMA Enable Bit
* | | |If this bit is set to 1, each timer time-out event or capture event can be triggered PDMA transfer.
* | | |0 = Timer interrupt trigger PDMA Disabled.
* | | |1 = Timer interrupt trigger PDMA Enabled.
* | | |Note: If TRGSSEL (TIMERx_TRGCTL[0]) = 0, time-out interrupt signal will trigger PDMA transfer.
* | | |If TRGSSEL (TIMERx_TRGCTL[0]) = 1, capture interrupt signal will trigger PDMA transfer.
* @var TIMER_T::ALTCTL
* Offset: 0x20 Timer Alternative Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |FUNCSEL |Function Selection
* | | |0 = Timer controller is used as timer function.
* | | |1 = Timer controller is used as PWM function.
* | | |Note: When timer is used as PWM, the clock source of time controller will be forced to PCLKx automatically.
* @var TIMER_T::PWMCTL
* Offset: 0x40 Timer PWM Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CNTEN |PWM Counter Enable Bit
* | | |0 = PWM counter and clock prescale Stop Running.
* | | |1 = PWM counter and clock prescale Start Running.
* |[2:1] |CNTTYPE |PWM Counter Behavior Type
* | | |00 = Up count type.
* | | |01 = Down count type.
* | | |10 = Up-down count type.
* | | |11 = Reserved.
* |[3] |CNTMODE |PWM Counter Mode
* | | |0 = Auto-reload mode.
* | | |1 = One-shot mode.
* |[8] |CTRLD |Center Re-load
* | | |In up-down count type, PERIOD will load to PBUF when current PWM period is completed always and CMP will load to CMPBUF at the center point of current period.
* |[9] |IMMLDEN |Immediately Load Enable Bit
* | | |0 = PERIOD will load to PBUF when current PWM period is completed no matter CTRLD is enabled/disabled
* | | |If CTRLD is disabled, CMP will load to CMPBUF when current PWM period is completed; if CTRLD is enabled in up-down count type, CMP will load to CMPBUF at the center point of current period.
* | | |1 = PERIOD/CMP will load to PBUF/CMPBUF immediately when user update PERIOD/CMP.
* | | |Note: If IMMLDEN is enabled, CTRLD will be invalid.
* |[16] |OUTMODE |PWM Output Mode
* | | |This bit controls the output mode of corresponding PWM channel.
* | | |0 = PWM independent mode.
* | | |1 = PWM complementary mode.
* |[30] |DBGHALT |ICE Debug Mode Counter Halt (Write Protect)
* | | |If debug mode counter halt is enabled, PWM counter will keep current value until exit ICE debug mode.
* | | |0 = ICE debug mode counter halt disable.
* | | |1 = ICE debug mode counter halt enable.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[31] |DBGTRIOFF |ICE Debug Mode Acknowledge Disable Bit (Write Protect)
* | | |0 = ICE debug mode acknowledgement effects PWM output.
* | | |PWM output pin will be forced as tri-state while ICE debug mode acknowledged.
* | | |1 = ICE debug mode acknowledgement disabled.
* | | |PWM output pin will keep output no matter ICE debug mode acknowledged or not.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* @var TIMER_T::PWMCLKSRC
* Offset: 0x44 Timer PWM Counter Clock Source Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[2:0] |CLKSRC |PWM Counter Clock Source Select
* | | |The PWM counter clock source can be selected from TMRx_CLK or internal timer time-out or capture event.
* | | |000 = TMRx_CLK.
* | | |001 = Internal TIMER0 time-out or capture event.
* | | |010 = Internal TIMER1 time-out or capture event.
* | | |011 = Internal TIMER2 time-out or capture event.
* | | |100 = Internal TIMER3 time-out or capture event.
* | | |Others = Reserved.
* | | |Note: If TIMER0 PWM function is enabled, the PWM counter clock source can be selected from TMR0_CLK, TIMER1 interrupt events, TIMER2 interrupt events, or TIMER3 interrupt events.
* @var TIMER_T::PWMCLKPSC
* Offset: 0x48 Timer PWM Counter Clock Pre-scale Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[11:0] |CLKPSC |PWM Counter Clock Pre-scale
* | | |The active clock of PWM counter is decided by counter clock prescale and divided by (CLKPSC + 1)
* | | |If CLKPSC is 0, then there is no scaling in PWM counter clock source.
* @var TIMER_T::PWMCNTCLR
* Offset: 0x4C Timer PWM Clear Counter Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CNTCLR |Clear PWM Counter Control Bit
* | | |It is automatically cleared by hardware.
* | | |0 = No effect.
* | | |1 = Clear 16-bit PWM counter to 0x10000 in up and up-down count type and reset counter value to PERIOD in down count type.
* @var TIMER_T::PWMPERIOD
* Offset: 0x50 Timer PWM Period Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[15:0] |PERIOD |PWM Period Register
* | | |In up count type: PWM counter counts from 0 to PERIOD, and restarts from 0.
* | | |In down count type: PWM counter counts from PERIOD to 0, and restarts from PERIOD.
* | | |In up-down count type: PWM counter counts from 0 to PERIOD, then decrements to 0 and repeats again.
* | | |In up and down count type:
* | | |PWM period time = (PERIOD + 1) * (CLKPSC + 1) * TMRx_PWMCLK.
* | | |In up-down count type:
* | | |PWM period time = 2 * PERIOD * (CLKPSC+ 1) * TMRx_PWMCLK.
* | | |Note: User should take care DIRF (TIMERx_PWMCNT[16]) bit in up/down/up-down count type to monitor current counter direction in each count type.
* @var TIMER_T::PWMCMPDAT
* Offset: 0x54 Timer PWM Comparator Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[15:0] |CMP |PWM Comparator Register
* | | |PWM CMP is used to compare with PWM CNT to generate PWM output waveform, interrupt events and trigger ADC to start convert.
* @var TIMER_T::PWMDTCTL
* Offset: 0x58 Timer PWM Dead-Time Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[11:0] |DTCNT |Dead-time Counter (Write Protect)
* | | |The dead-time can be calculated from the following two formulas:
* | | |Dead-time = (DTCNT[11:0] + 1) * TMRx_PWMCLK, if DTCKSEL is 0.
* | | |Dead-time = (DTCNT[11:0] + 1) * TMRx_PWMCLK * (CLKPSC + 1), if DTCKSEL is 1.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[16] |DTEN |Enable Dead-time Insertion for PWMx_CH0 and PWMx_CH1 (Write Protect)
* | | |Dead-time insertion function is only active when PWM complementary mode is enabled
* | | |If dead- time insertion is inactive, the outputs of PWMx_CH0 and PWMx_CH1 are complementary without any delay.
* | | |0 = Dead-time insertion Disabled on the pin pair.
* | | |1 = Dead-time insertion Enabled on the pin pair.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[24] |DTCKSEL |Dead-time Clock Select (Write Protect)
* | | |0 = Dead-time clock source from TMRx_PWMCLK without counter clock prescale.
* | | |1 = Dead-time clock source from TMRx_PWMCLK with counter clock prescale.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* @var TIMER_T::PWMCNT
* Offset: 0x5C Timer PWM Counter Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[15:0] |CNT |PWM Counter Value Register (Read Only)
* | | |User can monitor CNT to know the current counter value in 16-bit period counter.
* |[16] |DIRF |PWM Counter Direction Indicator Flag (Read Only)
* | | |0 = Counter is active in down count.
* | | |1 = Counter is active up count.
* @var TIMER_T::PWMMSKEN
* Offset: 0x60 Timer PWM Output Mask Enable Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |MSKEN0 |PWMx_CH0 Output Mask Enable Bit
* | | |The PWMx_CH0 output signal will be masked when this bit is enabled
* | | |The PWMx_CH0 will output MSKDAT0 (TIMER_PWMMSK[0]) data.
* | | |0 = PWMx_CH0 output signal is non-masked.
* | | |1 = PWMx_CH0 output signal is masked and output MSKDAT0 data.
* |[1] |MSKEN1 |PWMx_CH1 Output Mask Enable Bit
* | | |The PWMx_CH1 output signal will be masked when this bit is enabled
* | | |The PWMx_CH1 will output MSKDAT1 (TIMER_PWMMSK[1]) data.
* | | |0 = PWMx_CH1 output signal is non-masked.
* | | |1 = PWMx_CH1 output signal is masked and output MSKDAT1 data.
* @var TIMER_T::PWMMSK
* Offset: 0x64 Timer PWM Output Mask Data Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |MSKDAT0 |PWMx_CH0 Output Mask Data Control Bit
* | | |This bit is used to control the output state of PWMx_CH0 pin when PWMx_CH0 output mask function is enabled (MSKEN0 = 1).
* | | |0 = Output logic Low to PWMx_CH0.
* | | |1 = Output logic High to PWMx_CH0.
* |[1] |MSKDAT1 |PWMx_CH1 Output Mask Data Control Bit
* | | |This bit is used to control the output state of PWMx_CH1 pin when PWMx_CH1 output mask function is enabled (MSKEN1 = 1).
* | | |0 = Output logic Low to PWMx_CH1.
* | | |1 = Output logic High to PWMx_CH1.
* @var TIMER_T::PWMBNF
* Offset: 0x68 Timer PWM Brake Pin Noise Filter Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |BRKNFEN |Brake Pin Noise Filter Enable Bit
* | | |0 = Pin noise filter detect of PWMx_BRAKEy Disabled.
* | | |1 = Pin noise filter detect of PWMx_BRAKEy Enabled.
* |[3:1] |BRKNFSEL |Brake Pin Noise Filter Clock Selection
* | | |000 = Noise filter clock is PCLKx.
* | | |001 = Noise filter clock is PCLKx/2.
* | | |010 = Noise filter clock is PCLKx/4.
* | | |011 = Noise filter clock is PCLKx/8.
* | | |100 = Noise filter clock is PCLKx/16.
* | | |101 = Noise filter clock is PCLKx/32.
* | | |110 = Noise filter clock is PCLKx/64.
* | | |111 = Noise filter clock is PCLKx/128.
* |[6:4] |BRKFCNT |Brake Pin Noise Filter Count
* | | |The fields is used to control the active noise filter sample time.
* | | |Once noise filter sample time = (Period time of BRKDBCS) * BRKFCNT.
* |[7] |BRKPINV |Brake Pin Detection Control Bit
* | | |0 = Brake pin event will be detected if PWMx_BRAKEy pin status transfer from low to high in edge-detect, or pin status is high in level-detect.
* | | |1 = Brake pin event will be detected if PWMx_BRAKEy pin status transfer from high to low in edge-detect, or pin status is low in level-detect .
* |[17:16] |BKPINSRC |Brake Pin Source Select
* | | |00 = Brake pin source comes from PWM0_BRAKE0 pin.
* | | |01 = Brake pin source comes from PWM0_BRAKE1 pin.
* | | |10 = Brake pin source comes from PWM1_BRAKE0 pin.
* | | |11 = Brake pin source comes from PWM1_BRAKE1 pin.
* @var TIMER_T::PWMFAILBRK
* Offset: 0x6C Timer PWM System Fail Brake Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CSSBRKEN |Clock Security System Detection Trigger PWM Brake Function Enable Bit
* | | |0 = Brake Function triggered by clock fail detection Disabled.
* | | |1 = Brake Function triggered by clock fail detection Enabled.
* |[1] |BODBRKEN |Brown-out Detection Trigger PWM Brake Function Enable Bit
* | | |0 = Brake Function triggered by BOD event Disabled.
* | | |1 = Brake Function triggered by BOD event Enabled.
* |[2] |RAMBRKEN |SRAM Parity Error Detection Trigger PWM Brake Function Enable Bit
* | | |0 = Brake Function triggered by SRAM parity error detection Disabled.
* | | |1 = Brake Function triggered by SRAM parity error detection Enabled.
* |[3] |CORBRKEN |Core Lockup Detection Trigger PWM Brake Function Enable Bit
* | | |0 = Brake Function triggered by core lockup event Disabled.
* | | |1 = Brake Function triggered by core lockup event Enabled.
* @var TIMER_T::PWMBRKCTL
* Offset: 0x70 Timer PWM Brake Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CPO0EBEN |Enable Internal ACMP0_O Digital Output As Edge-detect Brake Source (Write Protect)
* | | |0 = Internal ACMP0_O signal as edge-detect brake source Disabled.
* | | |1 = Internal ACMP0_O signal as edge-detect brake source Enabled.
* | | |Note1: Only internal ACMP0_O signal from low to high will be detected as brake event.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[1] |CPO1EBEN |Enable Internal ACMP1_O Digital Output As Edge-detect Brake Source (Write Protect)
* | | |0 = Internal ACMP1_O signal as edge-detect brake source Disabled.
* | | |1 = Internal ACMP1_O signal as edge-detect brake source Enabled.
* | | |Note1: Only internal ACMP1_O signal from low to high will be detected as brake event.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[4] |BRKPEEN |Enable TM_BRAKEx Pin As Edge-detect Brake Source (Write Protect)
* | | |0 = PWMx_BRAKEy pin event as edge-detect brake source Disabled.
* | | |1 = PWMx_BRAKEy pin event as edge-detect brake source Enabled.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[7] |SYSEBEN |Enable System Fail As Edge-detect Brake Source (Write Protect)
* | | |0 = System fail condition as edge-detect brake source Disabled.
* | | |1 = System fail condition as edge-detect brake source Enabled.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[8] |CPO0LBEN |Enable Internal ACMP0_O Digital Output As Level-detect Brake Source (Write Protect)
* | | |0 = Internal ACMP0_O signal as level-detect brake source Disabled.
* | | |1 = Internal ACMP0_O signal as level-detect brake source Enabled.
* | | |Note1: Only internal ACMP0_O signal from low to high will be detected as brake event.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[9] |CPO1LBEN |Enable Internal ACMP1_O Digital Output As Level-detect Brake Source (Write Protect)
* | | |0 = Internal ACMP1_O signal as level-detect brake source Disabled.
* | | |1 = Internal ACMP1_O signal as level-detect brake source Enabled.
* | | |Note1: Only internal ACMP1_O signal from low to high will be detected as brake event.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[12] |BRKPLEN |Enable TM_BRAKEx Pin As Level-detect Brake Source (Write Protect)
* | | |0 = PWMx_BRAKEy pin event as level-detect brake source Disabled.
* | | |1 = PWMx_BRAKEy pin event as level-detect brake source Enabled.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[15] |SYSLBEN |Enable System Fail As Level-detect Brake Source (Write Protect)
* | | |0 = System fail condition as level-detect brake source Disabled.
* | | |1 = System fail condition as level-detect brake source Enabled.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[17:16] |BRKAEVEN |PWM Brake Action Select for PWMx_CH0 (Write Protect)
* | | |00 = PWMx_BRAKEy brake event will not affect PWMx_CH0 output.
* | | |01 = PWMx_CH0 output tri-state when PWMx_BRAKEy brake event happened.
* | | |10 = PWMx_CH0 output low level when PWMx_BRAKEy brake event happened.
* | | |11 = PWMx_CH0 output high level when PWMx_BRAKEy brake event happened.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[19:18] |BRKAODD |PWM Brake Action Select for PWMx_CH1 (Write Protect)
* | | |00 = PWMx_BRAKEy brake event will not affect PWMx_CH1 output.
* | | |01 = PWMx_CH1 output tri-state when PWMx_BRAKEy brake event happened.
* | | |10 = PWMx_CH1 output low level when PWMx_BRAKEy brake event happened.
* | | |11 = PWMx_CH1 output high level when PWMx_BRAKEy brake event happened.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* @var TIMER_T::PWMPOLCTL
* Offset: 0x74 Timer PWM Pin Output Polar Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |PINV0 |PWMx_CH0 Output Pin Polar Control Bit
* | | |The bit is used to control polarity state of PWMx_CH0 output pin.
* | | |0 = PWMx_CH0 output pin polar inverse Disabled.
* | | |1 = PWMx_CH0 output pin polar inverse Enabled.
* |[1] |PINV1 |PWMx_CH1 Output Pin Polar Control Bit
* | | |The bit is used to control polarity state of PWMx_CH1 output pin.
* | | |0 = PWMx_CH1 output pin polar inverse Disabled.
* | | |1 = PWMx_CH1 output pin polar inverse Enabled.
* @var TIMER_T::PWMPOEN
* Offset: 0x78 Timer PWM Pin Output Enable Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |POEN0 |PWMx_CH0 Output Pin Enable Bit
* | | |0 = PWMx_CH0 pin at tri-state mode.
* | | |1 = PWMx_CH0 pin in output mode.
* |[1] |POEN1 |PWMx_CH1 Output Pin Enable Bit
* | | |0 = PWMx_CH1 pin at tri-state mode.
* | | |1 = PWMx_CH1 pin in output mode.
* @var TIMER_T::PWMSWBRK
* Offset: 0x7C Timer PWM Software Trigger Brake Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |BRKETRG |Software Trigger Edge-detect Brake Source (Write Only) (Write Protect)
* | | |Write 1 to this bit will trigger PWM edge-detect brake source, then BRKEIF0 and BRKEIF1 will set to 1 automatically in TIMERx_PWMINTSTS1 register.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[8] |BRKLTRG |Software Trigger Level-detect Brake Source (Write Only) (Write Protect)
* | | |Write 1 to this bit will trigger PWM level-detect brake source, then BRKLIF0 and BRKLIF1 will set to 1 automatically in TIMERx_PWMINTSTS1 register.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* @var TIMER_T::PWMINTEN0
* Offset: 0x80 Timer PWM Interrupt Enable Register 0
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |ZIEN |PWM Zero Point Interrupt Enable Bit
* | | |0 = Zero point interrupt Disabled.
* | | |1 = Zero point interrupt Enabled.
* |[1] |PIEN |PWM Period Point Interrupt Enable Bit
* | | |0 = Period point interrupt Disabled.
* | | |1 = Period point interrupt Enabled.
* | | |Note: When in up-down count type, period point means the center point of current PWM period.
* |[2] |CMPUIEN |PWM Compare Up Count Interrupt Enable Bit
* | | |0 = Compare up count interrupt Disabled.
* | | |1 = Compare up count interrupt Enabled.
* |[3] |CMPDIEN |PWM Compare Down Count Interrupt Enable Bit
* | | |0 = Compare down count interrupt Disabled.
* | | |1 = Compare down count interrupt Enabled.
* @var TIMER_T::PWMINTEN1
* Offset: 0x84 Timer PWM Interrupt Enable Register 1
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |BRKEIEN |PWM Edge-detect Brake Interrupt Enable (Write Protect)
* | | |0 = PWM edge-detect brake interrupt Disabled.
* | | |1 = PWM edge-detect brake interrupt Enabled.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* |[8] |BRKLIEN |PWM Level-detect Brake Interrupt Enable (Write Protect)
* | | |0 = PWM level-detect brake interrupt Disabled.
* | | |1 = PWM level-detect brake interrupt Enabled.
* | | |Note: This register is write protected. Refer toSYS_REGLCTL register.
* @var TIMER_T::PWMINTSTS0
* Offset: 0x88 Timer PWM Interrupt Status Register 0
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |ZIF |PWM Zero Point Interrupt Flag
* | | |This bit is set by hardware when TIMERx_PWM counter reaches zero.
* | | |Note: This bit is cleared by writing 1 to it.
* |[1] |PIF |PWM Period Point Interrupt Flag
* | | |This bit is set by hardware when TIMERx_PWM counter reaches PERIOD.
* | | |Note1: When in up-down count type, PIF flag means the center point flag of current PWM period.
* | | |Note2: This bit is cleared by writing 1 to it.
* |[2] |CMPUIF |PWM Compare Up Count Interrupt Flag
* | | |This bit is set by hardware when TIMERx_PWM counter in up count direction and reaches CMP.
* | | |Note1: If CMP equal to PERIOD, there is no CMPUIF flag in up count type and up-down count type.
* | | |Note2: This bit is cleared by writing 1 to it.
* |[3] |CMPDIF |PWM Compare Down Count Interrupt Flag
* | | |This bit is set by hardware when TIMERx_PWM counter in down count direction and reaches CMP.
* | | |Note1: If CMP equal to PERIOD, there is no CMPDIF flag in down count type.
* | | |Note2: This bit is cleared by writing 1 to it.
* @var TIMER_T::PWMINTSTS1
* Offset: 0x8C Timer PWM Interrupt Status Register 1
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |BRKEIF0 |Edge-detect Brake Interrupt Flag on PWMx_CH0 (Write Protect)
* | | |0 = PWMx_CH0 edge-detect brake event do not happened.
* | | |1 = PWMx_CH0 edge-detect brake event happened.
* | | |Note1: This bit is cleared by writing 1 to it.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[1] |BRKEIF1 |Edge-detect Brake Interrupt Flag PWMx_CH1 (Write Protect)
* | | |0 = PWMx_CH1 edge-detect brake event do not happened.
* | | |1 = PWMx_CH1 edge-detect brake event happened.
* | | |Note1: This bit is cleared by writing 1 to it.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[8] |BRKLIF0 |Level-detect Brake Interrupt Flag on PWMx_CH0 (Write Protect)
* | | |0 = PWMx_CH0 level-detect brake event do not happened.
* | | |1 = PWMx_CH0 level-detect brake event happened.
* | | |Note1: This bit is cleared by writing 1 to it.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[9] |BRKLIF1 |Level-detect Brake Interrupt Flag on PWMx_CH1 (Write Protect)
* | | |0 = PWMx_CH1 level-detect brake event do not happened.
* | | |1 = PWMx_CH1 level-detect brake event happened.
* | | |Note1: This bit is cleared by writing 1 to it.
* | | |Note2: This register is write protected. Refer toSYS_REGLCTL register.
* |[16] |BRKESTS0 |Edge -detect Brake Status of PWMx_CH0 (Read Only)
* | | |0 = PWMx_CH0 edge-detect brake state is released.
* | | |1 = PWMx_CH0 at edge-detect brake state.
* | | |Note: User can set BRKEIF0 1 to clear BRKEIF0 flag and PWMx_CH0 will release brake state when current PWM period finished and resume PWMx_CH0 output waveform start from next full PWM period.
* |[17] |BRKESTS1 |Edge-detect Brake Status of PWMx_CH1 (Read Only)
* | | |0 = PWMx_CH1 edge-detect brake state is released.
* | | |1 = PWMx_CH1 at edge-detect brake state.
* | | |Note: User can set BRKEIF1 1 to clear BRKEIF1 flag and PWMx_CH1 will release brake state when current PWM period finished and resume PWMx_CH1 output waveform start from next full PWM period.
* |[24] |BRKLSTS0 |Level-detect Brake Status of PWMx_CH0 (Read Only)
* | | |0 = PWMx_CH0 level-detect brake state is released.
* | | |1 = PWMx_CH0 at level-detect brake state.
* | | |Note: If TIMERx_PWM level-detect brake source has released, both PWMx_CH0 and PWMx_CH1 will release brake state when current PWM period finished and resume PWMx_CH0 and PWMx_CH1 output waveform start from next full PWM period.
* |[25] |BRKLSTS1 |Level-detect Brake Status of PWMx_CH1 (Read Only)
* | | |0 = PWMx_CH1 level-detect brake state is released.
* | | |1 = PWMx_CH1 at level-detect brake state.
* | | |Note: If TIMERx_PWM level-detect brake source has released, both PWMx_CH0 and PWMx_CH1 will release brake state when current PWM period finished and resume PWMx_CH0 and PWMx_CH1 output waveform start from next full PWM period.
* @var TIMER_T::PWMEADCTS
* Offset: 0x90 Timer PWM ADC Trigger Source Select Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[2:0] |TRGSEL |PWM Counter Event Source Select to Trigger EADC Conversion
* | | |000 = Trigger EADC conversion at zero point (ZIF).
* | | |001 = Trigger EADC conversion at period point (PIF).
* | | |010 = Trigger EADC conversion at zero or period point (ZIF or PIF).
* | | |011 = Trigger EADC conversion at compare up count point (CMPUIF).
* | | |100 = Trigger EADC conversion at compare down count point (CMPDIF).
* | | |Others = Reserved.
* |[7] |TRGEN |PWM Counter Event Trigger EADC Conversion Enable Bit
* | | |0 = PWM counter event trigger EADC conversion Disabled.
* | | |1 = PWM counter event trigger EADC conversion Enabled.
* @var TIMER_T::PWMSCTL
* Offset: 0x94 Timer PWM Synchronous Control Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[1:0] |SYNCMODE |PWM Synchronous Mode Enable Select
* | | |00 = PWM synchronous function Disabled.
* | | |01 = PWM synchronous counter start function Enabled.
* | | |10 = Reserved.
* | | |11 = PWM synchronous counter clear function Enabled.
* |[8] |SYNCSRC |PWM Synchronous Counter Start/Clear Source Select
* | | |0 = Counter synchronous start/clear by trigger TIMER0_PWMSTRG STRGEN.
* | | |1 = Counter synchronous start/clear by trigger TIMER2_PWMSTRG STRGEN.
* | | |Note1: If TIMER0/1/2/3 PWM counter synchronous source are from TIMER0, TIMER0_PWMSCTL[8], TIMER1_PWMSCTL[8], TIMER2_PWMSCTL[8] and TIMER3_PWMSCTL[8] should be 0.
* | | |Note2: If TIMER0/1/ PWM counter synchronous source are from TIMER0, TIMER0_PWMSCTL[8] and TIMER1_PWMSCTL[8] should be set 0, and TIMER2/3/ PWM counter synchronous source are from TIMER2, TIME2_PWMSCTL[8] and TIMER3_PWMSCTL[8] should be set 1.
* @var TIMER_T::PWMSTRG
* Offset: 0x98 Timer PWM Synchronous Trigger Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |STRGEN |PWM Counter Synchronous Trigger Enable Bit (Write Only)
* | | |PMW counter synchronous function is used to make selected PWM channels (include TIMER0/1/2/3 PWM, TIMER0/1 PWM and TIMER2/3 PWM) start counting or clear counter at the same time according to TIMERx_PWMSCTL setting.
* | | |Note: This bit is only available in TIMER0 and TIMER2.
* @var TIMER_T::PWMSTATUS
* Offset: 0x9C Timer PWM Status Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[0] |CNTMAXF |PWM Counter Equal to 0xFFFF Flag
* | | |0 = Indicates the PWM counter value never reached its maximum value 0xFFFF.
* | | |1 = Indicates the PWM counter value has reached its maximum value.
* | | |Note: This bit is cleared by writing 1 to it.
* |[16] |EADCTRGF |Trigger EADC Start Conversion Flag
* | | |0 = PWM counter event trigger EADC start conversion is not occurred.
* | | |1 = PWM counter event trigger EADC start conversion has occurred.
* | | |Note: This bit is cleared by writing 1 to it.
* @var TIMER_T::PWMPBUF
* Offset: 0xA0 Timer PWM Period Buffer Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[15:0] |PBUF |PWM Period Buffer Register (Read Only)
* | | |Used as PERIOD active register.
* @var TIMER_T::PWMCMPBUF
* Offset: 0xA4 Timer PWM Comparator Buffer Register
* ---------------------------------------------------------------------------------------------------
* |Bits |Field |Descriptions
* | :----: | :----: | :---- |
* |[15:0] |CMPBUF |PWM Comparator Buffer Register (Read Only)
* | | |Used as CMP active register.
*/
__IO uint32_t CTL; /*!< [0x0000] Timer Control Register */
__IO uint32_t CMP; /*!< [0x0004] Timer Comparator Register */
__IO uint32_t INTSTS; /*!< [0x0008] Timer Interrupt Status Register */
__IO uint32_t CNT; /*!< [0x000c] Timer Data Register */
__I uint32_t CAP; /*!< [0x0010] Timer Capture Data Register */
__IO uint32_t EXTCTL; /*!< [0x0014] Timer External Control Register */
__IO uint32_t EINTSTS; /*!< [0x0018] Timer External Interrupt Status Register */
__IO uint32_t TRGCTL; /*!< [0x001c] Timer Trigger Control Register */
__IO uint32_t ALTCTL; /*!< [0x0020] Timer Alternative Control Register */
/** @cond HIDDEN_SYMBOLS */
__I uint32_t RESERVE0[7];
/** @endcond */
__IO uint32_t PWMCTL; /*!< [0x0040] Timer PWM Control Register */
__IO uint32_t PWMCLKSRC; /*!< [0x0044] Timer PWM Counter Clock Source Register */
__IO uint32_t PWMCLKPSC; /*!< [0x0048] Timer PWM Counter Clock Pre-scale Register */
__IO uint32_t PWMCNTCLR; /*!< [0x004c] Timer PWM Clear Counter Register */
__IO uint32_t PWMPERIOD; /*!< [0x0050] Timer PWM Period Register */
__IO uint32_t PWMCMPDAT; /*!< [0x0054] Timer PWM Comparator Register */
__IO uint32_t PWMDTCTL; /*!< [0x0058] Timer PWM Dead-Time Control Register */
__I uint32_t PWMCNT; /*!< [0x005c] Timer PWM Counter Register */
__IO uint32_t PWMMSKEN; /*!< [0x0060] Timer PWM Output Mask Enable Register */
__IO uint32_t PWMMSK; /*!< [0x0064] Timer PWM Output Mask Data Control Register */
__IO uint32_t PWMBNF; /*!< [0x0068] Timer PWM Brake Pin Noise Filter Register */
__IO uint32_t PWMFAILBRK; /*!< [0x006c] Timer PWM System Fail Brake Control Register */
__IO uint32_t PWMBRKCTL; /*!< [0x0070] Timer PWM Brake Control Register */
__IO uint32_t PWMPOLCTL; /*!< [0x0074] Timer PWM Pin Output Polar Control Register */
__IO uint32_t PWMPOEN; /*!< [0x0078] Timer PWM Pin Output Enable Register */
__O uint32_t PWMSWBRK; /*!< [0x007c] Timer PWM Software Trigger Brake Control Register */
__IO uint32_t PWMINTEN0; /*!< [0x0080] Timer PWM Interrupt Enable Register 0 */
__IO uint32_t PWMINTEN1; /*!< [0x0084] Timer PWM Interrupt Enable Register 1 */
__IO uint32_t PWMINTSTS0; /*!< [0x0088] Timer PWM Interrupt Status Register 0 */
__IO uint32_t PWMINTSTS1; /*!< [0x008c] Timer PWM Interrupt Status Register 1 */
__IO uint32_t PWMEADCTS; /*!< [0x0090] Timer PWM EADC Trigger Source Select Register */
__IO uint32_t PWMSCTL; /*!< [0x0094] Timer PWM Synchronous Control Register */
__O uint32_t PWMSTRG; /*!< [0x0098] Timer PWM Synchronous Trigger Register */
__IO uint32_t PWMSTATUS; /*!< [0x009c] Timer PWM Status Register */
__I uint32_t PWMPBUF; /*!< [0x00a0] Timer PWM Period Buffer Register */
__I uint32_t PWMCMPBUF; /*!< [0x00a4] Timer PWM Comparator Buffer Register */
} TIMER_T;
/**
@addtogroup TIMER_CONST TIMER Bit Field Definition
Constant Definitions for TIMER Controller
@{ */
#define TIMER_CTL_PSC_Pos (0) /*!< TIMER_T::CTL: PSC Position */
#define TIMER_CTL_PSC_Msk (0xfful << TIMER_CTL_PSC_Pos) /*!< TIMER_T::CTL: PSC Mask */
#define TIMER_CTL_INTRGEN_Pos (19) /*!< TIMER_T::CTL: INTRGEN Position */
#define TIMER_CTL_INTRGEN_Msk (0x1ul << TIMER_CTL_INTRGEN_Pos) /*!< TIMER_T::CTL: INTRGEN Mask */
#define TIMER_CTL_PERIOSEL_Pos (20) /*!< TIMER_T::CTL: PERIOSEL Position */
#define TIMER_CTL_PERIOSEL_Msk (0x1ul << TIMER_CTL_PERIOSEL_Pos) /*!< TIMER_T::CTL: PERIOSEL Mask */
#define TIMER_CTL_TGLPINSEL_Pos (21) /*!< TIMER_T::CTL: TGLPINSEL Position */
#define TIMER_CTL_TGLPINSEL_Msk (0x1ul << TIMER_CTL_TGLPINSEL_Pos) /*!< TIMER_T::CTL: TGLPINSEL Mask */
#define TIMER_CTL_CAPSRC_Pos (22) /*!< TIMER_T::CTL: CAPSRC Position */
#define TIMER_CTL_CAPSRC_Msk (0x1ul << TIMER_CTL_CAPSRC_Pos) /*!< TIMER_T::CTL: CAPSRC Mask */
#define TIMER_CTL_WKEN_Pos (23) /*!< TIMER_T::CTL: WKEN Position */
#define TIMER_CTL_WKEN_Msk (0x1ul << TIMER_CTL_WKEN_Pos) /*!< TIMER_T::CTL: WKEN Mask */
#define TIMER_CTL_EXTCNTEN_Pos (24) /*!< TIMER_T::CTL: EXTCNTEN Position */
#define TIMER_CTL_EXTCNTEN_Msk (0x1ul << TIMER_CTL_EXTCNTEN_Pos) /*!< TIMER_T::CTL: EXTCNTEN Mask */
#define TIMER_CTL_ACTSTS_Pos (25) /*!< TIMER_T::CTL: ACTSTS Position */
#define TIMER_CTL_ACTSTS_Msk (0x1ul << TIMER_CTL_ACTSTS_Pos) /*!< TIMER_T::CTL: ACTSTS Mask */
#define TIMER_CTL_OPMODE_Pos (27) /*!< TIMER_T::CTL: OPMODE Position */
#define TIMER_CTL_OPMODE_Msk (0x3ul << TIMER_CTL_OPMODE_Pos) /*!< TIMER_T::CTL: OPMODE Mask */
#define TIMER_CTL_INTEN_Pos (29) /*!< TIMER_T::CTL: INTEN Position */
#define TIMER_CTL_INTEN_Msk (0x1ul << TIMER_CTL_INTEN_Pos) /*!< TIMER_T::CTL: INTEN Mask */
#define TIMER_CTL_CNTEN_Pos (30) /*!< TIMER_T::CTL: CNTEN Position */
#define TIMER_CTL_CNTEN_Msk (0x1ul << TIMER_CTL_CNTEN_Pos) /*!< TIMER_T::CTL: CNTEN Mask */
#define TIMER_CTL_ICEDEBUG_Pos (31) /*!< TIMER_T::CTL: ICEDEBUG Position */
#define TIMER_CTL_ICEDEBUG_Msk (0x1ul << TIMER_CTL_ICEDEBUG_Pos) /*!< TIMER_T::CTL: ICEDEBUG Mask */
#define TIMER_CMP_CMPDAT_Pos (0) /*!< TIMER_T::CMP: CMPDAT Position */
#define TIMER_CMP_CMPDAT_Msk (0xfffffful << TIMER_CMP_CMPDAT_Pos) /*!< TIMER_T::CMP: CMPDAT Mask */
#define TIMER_INTSTS_TIF_Pos (0) /*!< TIMER_T::INTSTS: TIF Position */
#define TIMER_INTSTS_TIF_Msk (0x1ul << TIMER_INTSTS_TIF_Pos) /*!< TIMER_T::INTSTS: TIF Mask */
#define TIMER_INTSTS_TWKF_Pos (1) /*!< TIMER_T::INTSTS: TWKF Position */
#define TIMER_INTSTS_TWKF_Msk (0x1ul << TIMER_INTSTS_TWKF_Pos) /*!< TIMER_T::INTSTS: TWKF Mask */
#define TIMER_CNT_CNT_Pos (0) /*!< TIMER_T::CNT: CNT Position */
#define TIMER_CNT_CNT_Msk (0xfffffful << TIMER_CNT_CNT_Pos) /*!< TIMER_T::CNT: CNT Mask */
#define TIMER_CNT_RSTACT_Pos (31) /*!< TIMER_T::CNT: RSTACT Position */
#define TIMER_CNT_RSTACT_Msk (0x1ul << TIMER_CNT_RSTACT_Pos) /*!< TIMER_T::CNT: RSTACT Mask */
#define TIMER_CAP_CAPDAT_Pos (0) /*!< TIMER_T::CAP: CAPDAT Position */
#define TIMER_CAP_CAPDAT_Msk (0xfffffful << TIMER_CAP_CAPDAT_Pos) /*!< TIMER_T::CAP: CAPDAT Mask */
#define TIMER_EXTCTL_CNTPHASE_Pos (0) /*!< TIMER_T::EXTCTL: CNTPHASE Position */
#define TIMER_EXTCTL_CNTPHASE_Msk (0x1ul << TIMER_EXTCTL_CNTPHASE_Pos) /*!< TIMER_T::EXTCTL: CNTPHASE Mask */
#define TIMER_EXTCTL_CAPEN_Pos (3) /*!< TIMER_T::EXTCTL: CAPEN Position */
#define TIMER_EXTCTL_CAPEN_Msk (0x1ul << TIMER_EXTCTL_CAPEN_Pos) /*!< TIMER_T::EXTCTL: CAPEN Mask */
#define TIMER_EXTCTL_CAPFUNCS_Pos (4) /*!< TIMER_T::EXTCTL: CAPFUNCS Position */
#define TIMER_EXTCTL_CAPFUNCS_Msk (0x1ul << TIMER_EXTCTL_CAPFUNCS_Pos) /*!< TIMER_T::EXTCTL: CAPFUNCS Mask */
#define TIMER_EXTCTL_CAPIEN_Pos (5) /*!< TIMER_T::EXTCTL: CAPIEN Position */
#define TIMER_EXTCTL_CAPIEN_Msk (0x1ul << TIMER_EXTCTL_CAPIEN_Pos) /*!< TIMER_T::EXTCTL: CAPIEN Mask */
#define TIMER_EXTCTL_CAPDBEN_Pos (6) /*!< TIMER_T::EXTCTL: CAPDBEN Position */
#define TIMER_EXTCTL_CAPDBEN_Msk (0x1ul << TIMER_EXTCTL_CAPDBEN_Pos) /*!< TIMER_T::EXTCTL: CAPDBEN Mask */
#define TIMER_EXTCTL_CNTDBEN_Pos (7) /*!< TIMER_T::EXTCTL: CNTDBEN Position */
#define TIMER_EXTCTL_CNTDBEN_Msk (0x1ul << TIMER_EXTCTL_CNTDBEN_Pos) /*!< TIMER_T::EXTCTL: CNTDBEN Mask */
#define TIMER_EXTCTL_ACMPSSEL_Pos (8) /*!< TIMER_T::EXTCTL: ACMPSSEL Position */
#define TIMER_EXTCTL_ACMPSSEL_Msk (0x1ul << TIMER_EXTCTL_ACMPSSEL_Pos) /*!< TIMER_T::EXTCTL: ACMPSSEL Mask */
#define TIMER_EXTCTL_CAPEDGE_Pos (12) /*!< TIMER_T::EXTCTL: CAPEDGE Position */
#define TIMER_EXTCTL_CAPEDGE_Msk (0x7ul << TIMER_EXTCTL_CAPEDGE_Pos) /*!< TIMER_T::EXTCTL: CAPEDGE Mask */
#define TIMER_EXTCTL_ECNTSSEL_Pos (16) /*!< TIMER_T::EXTCTL: ECNTSSEL Position */
#define TIMER_EXTCTL_ECNTSSEL_Msk (0x1ul << TIMER_EXTCTL_ECNTSSEL_Pos) /*!< TIMER_T::EXTCTL: ECNTSSEL Mask */
#define TIMER_EINTSTS_CAPIF_Pos (0) /*!< TIMER_T::EINTSTS: CAPIF Position */
#define TIMER_EINTSTS_CAPIF_Msk (0x1ul << TIMER_EINTSTS_CAPIF_Pos) /*!< TIMER_T::EINTSTS: CAPIF Mask */
#define TIMER_TRGCTL_TRGSSEL_Pos (0) /*!< TIMER_T::TRGCTL: TRGSSEL Position */
#define TIMER_TRGCTL_TRGSSEL_Msk (0x1ul << TIMER_TRGCTL_TRGSSEL_Pos) /*!< TIMER_T::TRGCTL: TRGSSEL Mask */
#define TIMER_TRGCTL_TRGEPWM_Pos (1) /*!< TIMER_T::TRGCTL: TRGEPWM Position */
#define TIMER_TRGCTL_TRGEPWM_Msk (0x1ul << TIMER_TRGCTL_TRGEPWM_Pos) /*!< TIMER_T::TRGCTL: TRGEPWM Mask */
#define TIMER_TRGCTL_TRGEADC_Pos (2) /*!< TIMER_T::TRGCTL: TRGEADC Position */
#define TIMER_TRGCTL_TRGEADC_Msk (0x1ul << TIMER_TRGCTL_TRGEADC_Pos) /*!< TIMER_T::TRGCTL: TRGEADC Mask */
#define TIMER_TRGCTL_TRGDAC_Pos (3) /*!< TIMER_T::TRGCTL: TRGDAC Position */
#define TIMER_TRGCTL_TRGDAC_Msk (0x1ul << TIMER_TRGCTL_TRGDAC_Pos) /*!< TIMER_T::TRGCTL: TRGDAC Mask */
#define TIMER_TRGCTL_TRGPDMA_Pos (4) /*!< TIMER_T::TRGCTL: TRGPDMA Position */
#define TIMER_TRGCTL_TRGPDMA_Msk (0x1ul << TIMER_TRGCTL_TRGPDMA_Pos) /*!< TIMER_T::TRGCTL: TRGPDMA Mask */
#define TIMER_ALTCTL_FUNCSEL_Pos (0) /*!< TIMER_T::ALTCTL: FUNCSEL Position */
#define TIMER_ALTCTL_FUNCSEL_Msk (0x1ul << TIMER_ALTCTL_FUNCSEL_Pos) /*!< TIMER_T::ALTCTL: FUNCSEL Mask */
#define TIMER_PWMCTL_CNTEN_Pos (0) /*!< TIMER_T::PWMCTL: CNTEN Position */
#define TIMER_PWMCTL_CNTEN_Msk (0x1ul << TIMER_PWMCTL_CNTEN_Pos) /*!< TIMER_T::PWMCTL: CNTEN Mask */
#define TIMER_PWMCTL_CNTTYPE_Pos (1) /*!< TIMER_T::PWMCTL: CNTTYPE Position */
#define TIMER_PWMCTL_CNTTYPE_Msk (0x3ul << TIMER_PWMCTL_CNTTYPE_Pos) /*!< TIMER_T::PWMCTL: CNTTYPE Mask */
#define TIMER_PWMCTL_CNTMODE_Pos (3) /*!< TIMER_T::PWMCTL: CNTMODE Position */
#define TIMER_PWMCTL_CNTMODE_Msk (0x1ul << TIMER_PWMCTL_CNTMODE_Pos) /*!< TIMER_T::PWMCTL: CNTMODE Mask */
#define TIMER_PWMCTL_CTRLD_Pos (8) /*!< TIMER_T::PWMCTL: CTRLD Position */
#define TIMER_PWMCTL_CTRLD_Msk (0x1ul << TIMER_PWMCTL_CTRLD_Pos) /*!< TIMER_T::PWMCTL: CTRLD Mask */
#define TIMER_PWMCTL_IMMLDEN_Pos (9) /*!< TIMER_T::PWMCTL: IMMLDEN Position */
#define TIMER_PWMCTL_IMMLDEN_Msk (0x1ul << TIMER_PWMCTL_IMMLDEN_Pos) /*!< TIMER_T::PWMCTL: IMMLDEN Mask */
#define TIMER_PWMCTL_OUTMODE_Pos (16) /*!< TIMER_T::PWMCTL: OUTMODE Position */
#define TIMER_PWMCTL_OUTMODE_Msk (0x1ul << TIMER_PWMCTL_OUTMODE_Pos) /*!< TIMER_T::PWMCTL: OUTMODE Mask */
#define TIMER_PWMCTL_DBGHALT_Pos (30) /*!< TIMER_T::PWMCTL: DBGHALT Position */
#define TIMER_PWMCTL_DBGHALT_Msk (0x1ul << TIMER_PWMCTL_DBGHALT_Pos) /*!< TIMER_T::PWMCTL: DBGHALT Mask */
#define TIMER_PWMCTL_DBGTRIOFF_Pos (31) /*!< TIMER_T::PWMCTL: DBGTRIOFF Position */
#define TIMER_PWMCTL_DBGTRIOFF_Msk (0x1ul << TIMER_PWMCTL_DBGTRIOFF_Pos) /*!< TIMER_T::PWMCTL: DBGTRIOFF Mask */
#define TIMER_PWMCLKSRC_CLKSRC_Pos (0) /*!< TIMER_T::PWMCLKSRC: CLKSRC Position */
#define TIMER_PWMCLKSRC_CLKSRC_Msk (0x7ul << TIMER_PWMCLKSRC_CLKSRC_Pos) /*!< TIMER_T::PWMCLKSRC: CLKSRC Mask */
#define TIMER_PWMCLKPSC_CLKPSC_Pos (0) /*!< TIMER_T::PWMCLKPSC: CLKPSC Position */
#define TIMER_PWMCLKPSC_CLKPSC_Msk (0xffful << TIMER_PWMCLKPSC_CLKPSC_Pos) /*!< TIMER_T::PWMCLKPSC: CLKPSC Mask */
#define TIMER_PWMCNTCLR_CNTCLR_Pos (0) /*!< TIMER_T::PWMCNTCLR: CNTCLR Position */
#define TIMER_PWMCNTCLR_CNTCLR_Msk (0x1ul << TIMER_PWMCNTCLR_CNTCLR_Pos) /*!< TIMER_T::PWMCNTCLR: CNTCLR Mask */
#define TIMER_PWMPERIOD_PERIOD_Pos (0) /*!< TIMER_T::PWMPERIOD: PERIOD Position */
#define TIMER_PWMPERIOD_PERIOD_Msk (0xfffful << TIMER_PWMPERIOD_PERIOD_Pos) /*!< TIMER_T::PWMPERIOD: PERIOD Mask */
#define TIMER_PWMCMPDAT_CMP_Pos (0) /*!< TIMER_T::PWMCMPDAT: CMP Position */
#define TIMER_PWMCMPDAT_CMP_Msk (0xfffful << TIMER_PWMCMPDAT_CMP_Pos) /*!< TIMER_T::PWMCMPDAT: CMP Mask */
#define TIMER_PWMDTCTL_DTCNT_Pos (0) /*!< TIMER_T::PWMDTCTL: DTCNT Position */
#define TIMER_PWMDTCTL_DTCNT_Msk (0xffful << TIMER_PWMDTCTL_DTCNT_Pos) /*!< TIMER_T::PWMDTCTL: DTCNT Mask */
#define TIMER_PWMDTCTL_DTEN_Pos (16) /*!< TIMER_T::PWMDTCTL: DTEN Position */
#define TIMER_PWMDTCTL_DTEN_Msk (0x1ul << TIMER_PWMDTCTL_DTEN_Pos) /*!< TIMER_T::PWMDTCTL: DTEN Mask */
#define TIMER_PWMDTCTL_DTCKSEL_Pos (24) /*!< TIMER_T::PWMDTCTL: DTCKSEL Position */
#define TIMER_PWMDTCTL_DTCKSEL_Msk (0x1ul << TIMER_PWMDTCTL_DTCKSEL_Pos) /*!< TIMER_T::PWMDTCTL: DTCKSEL Mask */
#define TIMER_PWMCNT_CNT_Pos (0) /*!< TIMER_T::PWMCNT: CNT Position */
#define TIMER_PWMCNT_CNT_Msk (0xfffful << TIMER_PWMCNT_CNT_Pos) /*!< TIMER_T::PWMCNT: CNT Mask */
#define TIMER_PWMCNT_DIRF_Pos (16) /*!< TIMER_T::PWMCNT: DIRF Position */
#define TIMER_PWMCNT_DIRF_Msk (0x1ul << TIMER_PWMCNT_DIRF_Pos) /*!< TIMER_T::PWMCNT: DIRF Mask */
#define TIMER_PWMMSKEN_MSKEN0_Pos (0) /*!< TIMER_T::PWMMSKEN: MSKEN0 Position */
#define TIMER_PWMMSKEN_MSKEN0_Msk (0x1ul << TIMER_PWMMSKEN_MSKEN0_Pos) /*!< TIMER_T::PWMMSKEN: MSKEN0 Mask */
#define TIMER_PWMMSKEN_MSKEN1_Pos (1) /*!< TIMER_T::PWMMSKEN: MSKEN1 Position */
#define TIMER_PWMMSKEN_MSKEN1_Msk (0x1ul << TIMER_PWMMSKEN_MSKEN1_Pos) /*!< TIMER_T::PWMMSKEN: MSKEN1 Mask */
#define TIMER_PWMMSK_MSKDAT0_Pos (0) /*!< TIMER_T::PWMMSK: MSKDAT0 Position */
#define TIMER_PWMMSK_MSKDAT0_Msk (0x1ul << TIMER_PWMMSK_MSKDAT0_Pos) /*!< TIMER_T::PWMMSK: MSKDAT0 Mask */
#define TIMER_PWMMSK_MSKDAT1_Pos (1) /*!< TIMER_T::PWMMSK: MSKDAT1 Position */
#define TIMER_PWMMSK_MSKDAT1_Msk (0x1ul << TIMER_PWMMSK_MSKDAT1_Pos) /*!< TIMER_T::PWMMSK: MSKDAT1 Mask */
#define TIMER_PWMBNF_BRKNFEN_Pos (0) /*!< TIMER_T::PWMBNF: BRKNFEN Position */
#define TIMER_PWMBNF_BRKNFEN_Msk (0x1ul << TIMER_PWMBNF_BRKNFEN_Pos) /*!< TIMER_T::PWMBNF: BRKNFEN Mask */
#define TIMER_PWMBNF_BRKNFSEL_Pos (1) /*!< TIMER_T::PWMBNF: BRKNFSEL Position */
#define TIMER_PWMBNF_BRKNFSEL_Msk (0x7ul << TIMER_PWMBNF_BRKNFSEL_Pos) /*!< TIMER_T::PWMBNF: BRKNFSEL Mask */
#define TIMER_PWMBNF_BRKFCNT_Pos (4) /*!< TIMER_T::PWMBNF: BRKFCNT Position */
#define TIMER_PWMBNF_BRKFCNT_Msk (0x7ul << TIMER_PWMBNF_BRKFCNT_Pos) /*!< TIMER_T::PWMBNF: BRKFCNT Mask */
#define TIMER_PWMBNF_BRKPINV_Pos (7) /*!< TIMER_T::PWMBNF: BRKPINV Position */
#define TIMER_PWMBNF_BRKPINV_Msk (0x1ul << TIMER_PWMBNF_BRKPINV_Pos) /*!< TIMER_T::PWMBNF: BRKPINV Mask */
#define TIMER_PWMBNF_BKPINSRC_Pos (16) /*!< TIMER_T::PWMBNF: BKPINSRC Position */
#define TIMER_PWMBNF_BKPINSRC_Msk (0x3ul << TIMER_PWMBNF_BKPINSRC_Pos) /*!< TIMER_T::PWMBNF: BKPINSRC Mask */
#define TIMER_PWMFAILBRK_CSSBRKEN_Pos (0) /*!< TIMER_T::PWMFAILBRK: CSSBRKEN Position */
#define TIMER_PWMFAILBRK_CSSBRKEN_Msk (0x1ul << TIMER_PWMFAILBRK_CSSBRKEN_Pos) /*!< TIMER_T::PWMFAILBRK: CSSBRKEN Mask */
#define TIMER_PWMFAILBRK_BODBRKEN_Pos (1) /*!< TIMER_T::PWMFAILBRK: BODBRKEN Position */
#define TIMER_PWMFAILBRK_BODBRKEN_Msk (0x1ul << TIMER_PWMFAILBRK_BODBRKEN_Pos) /*!< TIMER_T::PWMFAILBRK: BODBRKEN Mask */
#define TIMER_PWMFAILBRK_RAMBRKEN_Pos (2) /*!< TIMER_T::PWMFAILBRK: RAMBRKEN Position */
#define TIMER_PWMFAILBRK_RAMBRKEN_Msk (0x1ul << TIMER_PWMFAILBRK_RAMBRKEN_Pos) /*!< TIMER_T::PWMFAILBRK: RAMBRKEN Mask */
#define TIMER_PWMFAILBRK_CORBRKEN_Pos (3) /*!< TIMER_T::PWMFAILBRK: CORBRKEN Position */
#define TIMER_PWMFAILBRK_CORBRKEN_Msk (0x1ul << TIMER_PWMFAILBRK_CORBRKEN_Pos) /*!< TIMER_T::PWMFAILBRK: CORBRKEN Mask */
#define TIMER_PWMBRKCTL_CPO0EBEN_Pos (0) /*!< TIMER_T::PWMBRKCTL: CPO0EBEN Position */
#define TIMER_PWMBRKCTL_CPO0EBEN_Msk (0x1ul << TIMER_PWMBRKCTL_CPO0EBEN_Pos) /*!< TIMER_T::PWMBRKCTL: CPO0EBEN Mask */
#define TIMER_PWMBRKCTL_CPO1EBEN_Pos (1) /*!< TIMER_T::PWMBRKCTL: CPO1EBEN Position */
#define TIMER_PWMBRKCTL_CPO1EBEN_Msk (0x1ul << TIMER_PWMBRKCTL_CPO1EBEN_Pos) /*!< TIMER_T::PWMBRKCTL: CPO1EBEN Mask */
#define TIMER_PWMBRKCTL_BRKPEEN_Pos (4) /*!< TIMER_T::PWMBRKCTL: BRKPEEN Position */
#define TIMER_PWMBRKCTL_BRKPEEN_Msk (0x1ul << TIMER_PWMBRKCTL_BRKPEEN_Pos) /*!< TIMER_T::PWMBRKCTL: BRKPEEN Mask */
#define TIMER_PWMBRKCTL_SYSEBEN_Pos (7) /*!< TIMER_T::PWMBRKCTL: SYSEBEN Position */
#define TIMER_PWMBRKCTL_SYSEBEN_Msk (0x1ul << TIMER_PWMBRKCTL_SYSEBEN_Pos) /*!< TIMER_T::PWMBRKCTL: SYSEBEN Mask */
#define TIMER_PWMBRKCTL_CPO0LBEN_Pos (8) /*!< TIMER_T::PWMBRKCTL: CPO0LBEN Position */
#define TIMER_PWMBRKCTL_CPO0LBEN_Msk (0x1ul << TIMER_PWMBRKCTL_CPO0LBEN_Pos) /*!< TIMER_T::PWMBRKCTL: CPO0LBEN Mask */
#define TIMER_PWMBRKCTL_CPO1LBEN_Pos (9) /*!< TIMER_T::PWMBRKCTL: CPO1LBEN Position */
#define TIMER_PWMBRKCTL_CPO1LBEN_Msk (0x1ul << TIMER_PWMBRKCTL_CPO1LBEN_Pos) /*!< TIMER_T::PWMBRKCTL: CPO1LBEN Mask */
#define TIMER_PWMBRKCTL_BRKPLEN_Pos (12) /*!< TIMER_T::PWMBRKCTL: BRKPLEN Position */
#define TIMER_PWMBRKCTL_BRKPLEN_Msk (0x1ul << TIMER_PWMBRKCTL_BRKPLEN_Pos) /*!< TIMER_T::PWMBRKCTL: BRKPLEN Mask */
#define TIMER_PWMBRKCTL_SYSLBEN_Pos (15) /*!< TIMER_T::PWMBRKCTL: SYSLBEN Position */
#define TIMER_PWMBRKCTL_SYSLBEN_Msk (0x1ul << TIMER_PWMBRKCTL_SYSLBEN_Pos) /*!< TIMER_T::PWMBRKCTL: SYSLBEN Mask */
#define TIMER_PWMBRKCTL_BRKAEVEN_Pos (16) /*!< TIMER_T::PWMBRKCTL: BRKAEVEN Position */
#define TIMER_PWMBRKCTL_BRKAEVEN_Msk (0x3ul << TIMER_PWMBRKCTL_BRKAEVEN_Pos) /*!< TIMER_T::PWMBRKCTL: BRKAEVEN Mask */
#define TIMER_PWMBRKCTL_BRKAODD_Pos (18) /*!< TIMER_T::PWMBRKCTL: BRKAODD Position */
#define TIMER_PWMBRKCTL_BRKAODD_Msk (0x3ul << TIMER_PWMBRKCTL_BRKAODD_Pos) /*!< TIMER_T::PWMBRKCTL: BRKAODD Mask */
#define TIMER_PWMPOLCTL_PINV0_Pos (0) /*!< TIMER_T::PWMPOLCTL: PINV0 Position */
#define TIMER_PWMPOLCTL_PINV0_Msk (0x1ul << TIMER_PWMPOLCTL_PINV0_Pos) /*!< TIMER_T::PWMPOLCTL: PINV0 Mask */
#define TIMER_PWMPOLCTL_PINV1_Pos (1) /*!< TIMER_T::PWMPOLCTL: PINV1 Position */
#define TIMER_PWMPOLCTL_PINV1_Msk (0x1ul << TIMER_PWMPOLCTL_PINV1_Pos) /*!< TIMER_T::PWMPOLCTL: PINV1 Mask */
#define TIMER_PWMPOEN_POEN0_Pos (0) /*!< TIMER_T::PWMPOEN: POEN0 Position */
#define TIMER_PWMPOEN_POEN0_Msk (0x1ul << TIMER_PWMPOEN_POEN0_Pos) /*!< TIMER_T::PWMPOEN: POEN0 Mask */
#define TIMER_PWMPOEN_POEN1_Pos (1) /*!< TIMER_T::PWMPOEN: POEN1 Position */
#define TIMER_PWMPOEN_POEN1_Msk (0x1ul << TIMER_PWMPOEN_POEN1_Pos) /*!< TIMER_T::PWMPOEN: POEN1 Mask */
#define TIMER_PWMSWBRK_BRKETRG_Pos (0) /*!< TIMER_T::PWMSWBRK: BRKETRG Position */
#define TIMER_PWMSWBRK_BRKETRG_Msk (0x1ul << TIMER_PWMSWBRK_BRKETRG_Pos) /*!< TIMER_T::PWMSWBRK: BRKETRG Mask */
#define TIMER_PWMSWBRK_BRKLTRG_Pos (8) /*!< TIMER_T::PWMSWBRK: BRKLTRG Position */
#define TIMER_PWMSWBRK_BRKLTRG_Msk (0x1ul << TIMER_PWMSWBRK_BRKLTRG_Pos) /*!< TIMER_T::PWMSWBRK: BRKLTRG Mask */
#define TIMER_PWMINTEN0_ZIEN_Pos (0) /*!< TIMER_T::PWMINTEN0: ZIEN Position */
#define TIMER_PWMINTEN0_ZIEN_Msk (0x1ul << TIMER_PWMINTEN0_ZIEN_Pos) /*!< TIMER_T::PWMINTEN0: ZIEN Mask */
#define TIMER_PWMINTEN0_PIEN_Pos (1) /*!< TIMER_T::PWMINTEN0: PIEN Position */
#define TIMER_PWMINTEN0_PIEN_Msk (0x1ul << TIMER_PWMINTEN0_PIEN_Pos) /*!< TIMER_T::PWMINTEN0: PIEN Mask */
#define TIMER_PWMINTEN0_CMPUIEN_Pos (2) /*!< TIMER_T::PWMINTEN0: CMPUIEN Position */
#define TIMER_PWMINTEN0_CMPUIEN_Msk (0x1ul << TIMER_PWMINTEN0_CMPUIEN_Pos) /*!< TIMER_T::PWMINTEN0: CMPUIEN Mask */
#define TIMER_PWMINTEN0_CMPDIEN_Pos (3) /*!< TIMER_T::PWMINTEN0: CMPDIEN Position */
#define TIMER_PWMINTEN0_CMPDIEN_Msk (0x1ul << TIMER_PWMINTEN0_CMPDIEN_Pos) /*!< TIMER_T::PWMINTEN0: CMPDIEN Mask */
#define TIMER_PWMINTEN1_BRKEIEN_Pos (0) /*!< TIMER_T::PWMINTEN1: BRKEIEN Position */
#define TIMER_PWMINTEN1_BRKEIEN_Msk (0x1ul << TIMER_PWMINTEN1_BRKEIEN_Pos) /*!< TIMER_T::PWMINTEN1: BRKEIEN Mask */
#define TIMER_PWMINTEN1_BRKLIEN_Pos (8) /*!< TIMER_T::PWMINTEN1: BRKLIEN Position */
#define TIMER_PWMINTEN1_BRKLIEN_Msk (0x1ul << TIMER_PWMINTEN1_BRKLIEN_Pos) /*!< TIMER_T::PWMINTEN1: BRKLIEN Mask */
#define TIMER_PWMINTSTS0_ZIF_Pos (0) /*!< TIMER_T::PWMINTSTS0: ZIF Position */
#define TIMER_PWMINTSTS0_ZIF_Msk (0x1ul << TIMER_PWMINTSTS0_ZIF_Pos) /*!< TIMER_T::PWMINTSTS0: ZIF Mask */
#define TIMER_PWMINTSTS0_PIF_Pos (1) /*!< TIMER_T::PWMINTSTS0: PIF Position */
#define TIMER_PWMINTSTS0_PIF_Msk (0x1ul << TIMER_PWMINTSTS0_PIF_Pos) /*!< TIMER_T::PWMINTSTS0: PIF Mask */
#define TIMER_PWMINTSTS0_CMPUIF_Pos (2) /*!< TIMER_T::PWMINTSTS0: CMPUIF Position */
#define TIMER_PWMINTSTS0_CMPUIF_Msk (0x1ul << TIMER_PWMINTSTS0_CMPUIF_Pos) /*!< TIMER_T::PWMINTSTS0: CMPUIF Mask */
#define TIMER_PWMINTSTS0_CMPDIF_Pos (3) /*!< TIMER_T::PWMINTSTS0: CMPDIF Position */
#define TIMER_PWMINTSTS0_CMPDIF_Msk (0x1ul << TIMER_PWMINTSTS0_CMPDIF_Pos) /*!< TIMER_T::PWMINTSTS0: CMPDIF Mask */
#define TIMER_PWMINTSTS1_BRKEIF0_Pos (0) /*!< TIMER_T::PWMINTSTS1: BRKEIF0 Position */
#define TIMER_PWMINTSTS1_BRKEIF0_Msk (0x1ul << TIMER_PWMINTSTS1_BRKEIF0_Pos) /*!< TIMER_T::PWMINTSTS1: BRKEIF0 Mask */
#define TIMER_PWMINTSTS1_BRKEIF1_Pos (1) /*!< TIMER_T::PWMINTSTS1: BRKEIF1 Position */
#define TIMER_PWMINTSTS1_BRKEIF1_Msk (0x1ul << TIMER_PWMINTSTS1_BRKEIF1_Pos) /*!< TIMER_T::PWMINTSTS1: BRKEIF1 Mask */
#define TIMER_PWMINTSTS1_BRKLIF0_Pos (8) /*!< TIMER_T::PWMINTSTS1: BRKLIF0 Position */
#define TIMER_PWMINTSTS1_BRKLIF0_Msk (0x1ul << TIMER_PWMINTSTS1_BRKLIF0_Pos) /*!< TIMER_T::PWMINTSTS1: BRKLIF0 Mask */
#define TIMER_PWMINTSTS1_BRKLIF1_Pos (9) /*!< TIMER_T::PWMINTSTS1: BRKLIF1 Position */
#define TIMER_PWMINTSTS1_BRKLIF1_Msk (0x1ul << TIMER_PWMINTSTS1_BRKLIF1_Pos) /*!< TIMER_T::PWMINTSTS1: BRKLIF1 Mask */
#define TIMER_PWMINTSTS1_BRKESTS0_Pos (16) /*!< TIMER_T::PWMINTSTS1: BRKESTS0 Position */
#define TIMER_PWMINTSTS1_BRKESTS0_Msk (0x1ul << TIMER_PWMINTSTS1_BRKESTS0_Pos) /*!< TIMER_T::PWMINTSTS1: BRKESTS0 Mask */
#define TIMER_PWMINTSTS1_BRKESTS1_Pos (17) /*!< TIMER_T::PWMINTSTS1: BRKESTS1 Position */
#define TIMER_PWMINTSTS1_BRKESTS1_Msk (0x1ul << TIMER_PWMINTSTS1_BRKESTS1_Pos) /*!< TIMER_T::PWMINTSTS1: BRKESTS1 Mask */
#define TIMER_PWMINTSTS1_BRKLSTS0_Pos (24) /*!< TIMER_T::PWMINTSTS1: BRKLSTS0 Position */
#define TIMER_PWMINTSTS1_BRKLSTS0_Msk (0x1ul << TIMER_PWMINTSTS1_BRKLSTS0_Pos) /*!< TIMER_T::PWMINTSTS1: BRKLSTS0 Mask */
#define TIMER_PWMINTSTS1_BRKLSTS1_Pos (25) /*!< TIMER_T::PWMINTSTS1: BRKLSTS1 Position */
#define TIMER_PWMINTSTS1_BRKLSTS1_Msk (0x1ul << TIMER_PWMINTSTS1_BRKLSTS1_Pos) /*!< TIMER_T::PWMINTSTS1: BRKLSTS1 Mask */
#define TIMER_PWMEADCTS_TRGSEL_Pos (0) /*!< TIMER_T::PWMEADCTS: TRGSEL Position */
#define TIMER_PWMEADCTS_TRGSEL_Msk (0x7ul << TIMER_PWMEADCTS_TRGSEL_Pos) /*!< TIMER_T::PWMEADCTS: TRGSEL Mask */
#define TIMER_PWMEADCTS_TRGEN_Pos (7) /*!< TIMER_T::PWMEADCTS: TRGEN Position */
#define TIMER_PWMEADCTS_TRGEN_Msk (0x1ul << TIMER_PWMEADCTS_TRGEN_Pos) /*!< TIMER_T::PWMEADCTS: TRGEN Mask */
#define TIMER_PWMSCTL_SYNCMODE_Pos (0) /*!< TIMER_T::PWMSCTL: SYNCMODE Position */
#define TIMER_PWMSCTL_SYNCMODE_Msk (0x3ul << TIMER_PWMSCTL_SYNCMODE_Pos) /*!< TIMER_T::PWMSCTL: SYNCMODE Mask */
#define TIMER_PWMSCTL_SYNCSRC_Pos (8) /*!< TIMER_T::PWMSCTL: SYNCSRC Position */
#define TIMER_PWMSCTL_SYNCSRC_Msk (0x1ul << TIMER_PWMSCTL_SYNCSRC_Pos) /*!< TIMER_T::PWMSCTL: SYNCSRC Mask */
#define TIMER_PWMSTRG_STRGEN_Pos (0) /*!< TIMER_T::PWMSTRG: STRGEN Position */
#define TIMER_PWMSTRG_STRGEN_Msk (0x1ul << TIMER_PWMSTRG_STRGEN_Pos) /*!< TIMER_T::PWMSTRG: STRGEN Mask */
#define TIMER_PWMSTATUS_CNTMAXF_Pos (0) /*!< TIMER_T::PWMSTATUS: CNTMAXF Position */
#define TIMER_PWMSTATUS_CNTMAXF_Msk (0x1ul << TIMER_PWMSTATUS_CNTMAXF_Pos) /*!< TIMER_T::PWMSTATUS: CNTMAXF Mask */
#define TIMER_PWMSTATUS_EADCTRGF_Pos (16) /*!< TIMER_T::PWMSTATUS: EADCTRGF Position */
#define TIMER_PWMSTATUS_EADCTRGF_Msk (0x1ul << TIMER_PWMSTATUS_EADCTRGF_Pos) /*!< TIMER_T::PWMSTATUS: EADCTRGF Mask */
#define TIMER_PWMPBUF_PBUF_Pos (0) /*!< TIMER_T::PWMPBUF: PBUF Position */
#define TIMER_PWMPBUF_PBUF_Msk (0xfffful << TIMER_PWMPBUF_PBUF_Pos) /*!< TIMER_T::PWMPBUF: PBUF Mask */
#define TIMER_PWMCMPBUF_CMPBUF_Pos (0) /*!< TIMER_T::PWMCMPBUF: CMPBUF Position */
#define TIMER_PWMCMPBUF_CMPBUF_Msk (0xfffful << TIMER_PWMCMPBUF_CMPBUF_Pos) /*!< TIMER_T::PWMCMPBUF: CMPBUF Mask */
/**@}*/ /* TIMER_CONST */
/**@}*/ /* end of TIMER register group */
/**@}*/ /* end of REGISTER group */
#if defined ( __CC_ARM )
#pragma no_anon_unions
#endif
#endif /* __TIMER_REG_H__ */
| {
"pile_set_name": "Github"
} |
NOR(Wire0,in1,in3)
NOT(Wire1,in2)
NOR(Wire2,Wire0,Wire1)
NOR(Wire3,in1,in2)
NOR(out,Wire2,Wire3)
| {
"pile_set_name": "Github"
} |
package reporters
import (
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/types"
)
type Reporter interface {
SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary)
BeforeSuiteDidRun(setupSummary *types.SetupSummary)
SpecWillRun(specSummary *types.SpecSummary)
SpecDidComplete(specSummary *types.SpecSummary)
AfterSuiteDidRun(setupSummary *types.SetupSummary)
SpecSuiteDidEnd(summary *types.SuiteSummary)
}
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.common.record;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.header.Header;
import org.apache.kafka.common.message.LeaderChangeMessage;
import org.apache.kafka.common.protocol.ByteBufferAccessor;
import org.apache.kafka.common.protocol.ObjectSerializationCache;
import org.apache.kafka.common.protocol.types.Struct;
import org.apache.kafka.common.utils.ByteBufferOutputStream;
import org.apache.kafka.common.utils.Utils;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import static org.apache.kafka.common.utils.Utils.wrapNullable;
/**
* This class is used to write new log data in memory, i.e. this is the write path for {@link MemoryRecords}.
* It transparently handles compression and exposes methods for appending new records, possibly with message
* format conversion.
*
* In cases where keeping memory retention low is important and there's a gap between the time that record appends stop
* and the builder is closed (e.g. the Producer), it's important to call `closeForRecordAppends` when the former happens.
* This will release resources like compression buffers that can be relatively large (64 KB for LZ4).
*/
public class MemoryRecordsBuilder implements AutoCloseable {
private static final float COMPRESSION_RATE_ESTIMATION_FACTOR = 1.05f;
private static final DataOutputStream CLOSED_STREAM = new DataOutputStream(new OutputStream() {
@Override
public void write(int b) {
throw new IllegalStateException("MemoryRecordsBuilder is closed for record appends");
}
});
private final TimestampType timestampType;
private final CompressionType compressionType;
// Used to hold a reference to the underlying ByteBuffer so that we can write the record batch header and access
// the written bytes. ByteBufferOutputStream allocates a new ByteBuffer if the existing one is not large enough,
// so it's not safe to hold a direct reference to the underlying ByteBuffer.
private final ByteBufferOutputStream bufferStream;
private final byte magic;
private final int initialPosition;
private final long baseOffset;
private final long logAppendTime;
private final boolean isControlBatch;
private final int partitionLeaderEpoch;
private final int writeLimit;
private final int batchHeaderSizeInBytes;
// Use a conservative estimate of the compression ratio. The producer overrides this using statistics
// from previous batches before appending any records.
private float estimatedCompressionRatio = 1.0F;
// Used to append records, may compress data on the fly
private DataOutputStream appendStream;
private boolean isTransactional;
private long producerId;
private short producerEpoch;
private int baseSequence;
private int uncompressedRecordsSizeInBytes = 0; // Number of bytes (excluding the header) written before compression
private int numRecords = 0;
private float actualCompressionRatio = 1;
private long maxTimestamp = RecordBatch.NO_TIMESTAMP;
private long offsetOfMaxTimestamp = -1;
private Long lastOffset = null;
private Long firstTimestamp = null;
private MemoryRecords builtRecords;
private boolean aborted = false;
public MemoryRecordsBuilder(ByteBufferOutputStream bufferStream,
byte magic,
CompressionType compressionType,
TimestampType timestampType,
long baseOffset,
long logAppendTime,
long producerId,
short producerEpoch,
int baseSequence,
boolean isTransactional,
boolean isControlBatch,
int partitionLeaderEpoch,
int writeLimit) {
if (magic > RecordBatch.MAGIC_VALUE_V0 && timestampType == TimestampType.NO_TIMESTAMP_TYPE)
throw new IllegalArgumentException("TimestampType must be set for magic >= 0");
if (magic < RecordBatch.MAGIC_VALUE_V2) {
if (isTransactional)
throw new IllegalArgumentException("Transactional records are not supported for magic " + magic);
if (isControlBatch)
throw new IllegalArgumentException("Control records are not supported for magic " + magic);
if (compressionType == CompressionType.ZSTD)
throw new IllegalArgumentException("ZStandard compression is not supported for magic " + magic);
}
this.magic = magic;
this.timestampType = timestampType;
this.compressionType = compressionType;
this.baseOffset = baseOffset;
this.logAppendTime = logAppendTime;
this.numRecords = 0;
this.uncompressedRecordsSizeInBytes = 0;
this.actualCompressionRatio = 1;
this.maxTimestamp = RecordBatch.NO_TIMESTAMP;
this.producerId = producerId;
this.producerEpoch = producerEpoch;
this.baseSequence = baseSequence;
this.isTransactional = isTransactional;
this.isControlBatch = isControlBatch;
this.partitionLeaderEpoch = partitionLeaderEpoch;
this.writeLimit = writeLimit;
this.initialPosition = bufferStream.position();
this.batchHeaderSizeInBytes = AbstractRecords.recordBatchHeaderSizeInBytes(magic, compressionType);
bufferStream.position(initialPosition + batchHeaderSizeInBytes);
this.bufferStream = bufferStream;
this.appendStream = new DataOutputStream(compressionType.wrapForOutput(this.bufferStream, magic));
}
/**
* Construct a new builder.
*
* @param buffer The underlying buffer to use (note that this class will allocate a new buffer if necessary
* to fit the records appended)
* @param magic The magic value to use
* @param compressionType The compression codec to use
* @param timestampType The desired timestamp type. For magic > 0, this cannot be {@link TimestampType#NO_TIMESTAMP_TYPE}.
* @param baseOffset The initial offset to use for
* @param logAppendTime The log append time of this record set. Can be set to NO_TIMESTAMP if CREATE_TIME is used.
* @param producerId The producer ID associated with the producer writing this record set
* @param producerEpoch The epoch of the producer
* @param baseSequence The sequence number of the first record in this set
* @param isTransactional Whether or not the records are part of a transaction
* @param isControlBatch Whether or not this is a control batch (e.g. for transaction markers)
* @param partitionLeaderEpoch The epoch of the partition leader appending the record set to the log
* @param writeLimit The desired limit on the total bytes for this record set (note that this can be exceeded
* when compression is used since size estimates are rough, and in the case that the first
* record added exceeds the size).
*/
public MemoryRecordsBuilder(ByteBuffer buffer,
byte magic,
CompressionType compressionType,
TimestampType timestampType,
long baseOffset,
long logAppendTime,
long producerId,
short producerEpoch,
int baseSequence,
boolean isTransactional,
boolean isControlBatch,
int partitionLeaderEpoch,
int writeLimit) {
this(new ByteBufferOutputStream(buffer), magic, compressionType, timestampType, baseOffset, logAppendTime,
producerId, producerEpoch, baseSequence, isTransactional, isControlBatch, partitionLeaderEpoch,
writeLimit);
}
public ByteBuffer buffer() {
return bufferStream.buffer();
}
public int initialCapacity() {
return bufferStream.initialCapacity();
}
public double compressionRatio() {
return actualCompressionRatio;
}
public CompressionType compressionType() {
return compressionType;
}
public boolean isControlBatch() {
return isControlBatch;
}
public boolean isTransactional() {
return isTransactional;
}
/**
* Close this builder and return the resulting buffer.
* @return The built log buffer
*/
public MemoryRecords build() {
if (aborted) {
throw new IllegalStateException("Attempting to build an aborted record batch");
}
close();
return builtRecords;
}
/**
* Get the max timestamp and its offset. The details of the offset returned are a bit subtle.
*
* If the log append time is used, the offset will be the last offset unless no compression is used and
* the message format version is 0 or 1, in which case, it will be the first offset.
*
* If create time is used, the offset will be the last offset unless no compression is used and the message
* format version is 0 or 1, in which case, it will be the offset of the record with the max timestamp.
*
* @return The max timestamp and its offset
*/
public RecordsInfo info() {
if (timestampType == TimestampType.LOG_APPEND_TIME) {
long shallowOffsetOfMaxTimestamp;
// Use the last offset when dealing with record batches
if (compressionType != CompressionType.NONE || magic >= RecordBatch.MAGIC_VALUE_V2)
shallowOffsetOfMaxTimestamp = lastOffset;
else
shallowOffsetOfMaxTimestamp = baseOffset;
return new RecordsInfo(logAppendTime, shallowOffsetOfMaxTimestamp);
} else if (maxTimestamp == RecordBatch.NO_TIMESTAMP) {
return new RecordsInfo(RecordBatch.NO_TIMESTAMP, lastOffset);
} else {
long shallowOffsetOfMaxTimestamp;
// Use the last offset when dealing with record batches
if (compressionType != CompressionType.NONE || magic >= RecordBatch.MAGIC_VALUE_V2)
shallowOffsetOfMaxTimestamp = lastOffset;
else
shallowOffsetOfMaxTimestamp = offsetOfMaxTimestamp;
return new RecordsInfo(maxTimestamp, shallowOffsetOfMaxTimestamp);
}
}
public int numRecords() {
return numRecords;
}
/**
* Return the sum of the size of the batch header (always uncompressed) and the records (before compression).
*/
public int uncompressedBytesWritten() {
return uncompressedRecordsSizeInBytes + batchHeaderSizeInBytes;
}
public void setProducerState(long producerId, short producerEpoch, int baseSequence, boolean isTransactional) {
if (isClosed()) {
// Sequence numbers are assigned when the batch is closed while the accumulator is being drained.
// If the resulting ProduceRequest to the partition leader failed for a retriable error, the batch will
// be re queued. In this case, we should not attempt to set the state again, since changing the producerId and sequence
// once a batch has been sent to the broker risks introducing duplicates.
throw new IllegalStateException("Trying to set producer state of an already closed batch. This indicates a bug on the client.");
}
this.producerId = producerId;
this.producerEpoch = producerEpoch;
this.baseSequence = baseSequence;
this.isTransactional = isTransactional;
}
public void overrideLastOffset(long lastOffset) {
if (builtRecords != null)
throw new IllegalStateException("Cannot override the last offset after the records have been built");
this.lastOffset = lastOffset;
}
/**
* Release resources required for record appends (e.g. compression buffers). Once this method is called, it's only
* possible to update the RecordBatch header.
*/
public void closeForRecordAppends() {
if (appendStream != CLOSED_STREAM) {
try {
appendStream.close();
} catch (IOException e) {
throw new KafkaException(e);
} finally {
appendStream = CLOSED_STREAM;
}
}
}
public void abort() {
closeForRecordAppends();
buffer().position(initialPosition);
aborted = true;
}
public void reopenAndRewriteProducerState(long producerId, short producerEpoch, int baseSequence, boolean isTransactional) {
if (aborted)
throw new IllegalStateException("Should not reopen a batch which is already aborted.");
builtRecords = null;
this.producerId = producerId;
this.producerEpoch = producerEpoch;
this.baseSequence = baseSequence;
this.isTransactional = isTransactional;
}
public void close() {
if (aborted)
throw new IllegalStateException("Cannot close MemoryRecordsBuilder as it has already been aborted");
if (builtRecords != null)
return;
validateProducerState();
closeForRecordAppends();
if (numRecords == 0L) {
buffer().position(initialPosition);
builtRecords = MemoryRecords.EMPTY;
} else {
if (magic > RecordBatch.MAGIC_VALUE_V1)
this.actualCompressionRatio = (float) writeDefaultBatchHeader() / this.uncompressedRecordsSizeInBytes;
else if (compressionType != CompressionType.NONE)
this.actualCompressionRatio = (float) writeLegacyCompressedWrapperHeader() / this.uncompressedRecordsSizeInBytes;
ByteBuffer buffer = buffer().duplicate();
buffer.flip();
buffer.position(initialPosition);
builtRecords = MemoryRecords.readableRecords(buffer.slice());
}
}
private void validateProducerState() {
if (isTransactional && producerId == RecordBatch.NO_PRODUCER_ID)
throw new IllegalArgumentException("Cannot write transactional messages without a valid producer ID");
if (producerId != RecordBatch.NO_PRODUCER_ID) {
if (producerEpoch == RecordBatch.NO_PRODUCER_EPOCH)
throw new IllegalArgumentException("Invalid negative producer epoch");
if (baseSequence < 0 && !isControlBatch)
throw new IllegalArgumentException("Invalid negative sequence number used");
if (magic < RecordBatch.MAGIC_VALUE_V2)
throw new IllegalArgumentException("Idempotent messages are not supported for magic " + magic);
}
}
/**
* Write the header to the default batch.
* @return the written compressed bytes.
*/
private int writeDefaultBatchHeader() {
ensureOpenForRecordBatchWrite();
ByteBuffer buffer = bufferStream.buffer();
int pos = buffer.position();
buffer.position(initialPosition);
int size = pos - initialPosition;
int writtenCompressed = size - DefaultRecordBatch.RECORD_BATCH_OVERHEAD;
int offsetDelta = (int) (lastOffset - baseOffset);
final long maxTimestamp;
if (timestampType == TimestampType.LOG_APPEND_TIME)
maxTimestamp = logAppendTime;
else
maxTimestamp = this.maxTimestamp;
DefaultRecordBatch.writeHeader(buffer, baseOffset, offsetDelta, size, magic, compressionType, timestampType,
firstTimestamp, maxTimestamp, producerId, producerEpoch, baseSequence, isTransactional, isControlBatch,
partitionLeaderEpoch, numRecords);
buffer.position(pos);
return writtenCompressed;
}
/**
* Write the header to the legacy batch.
* @return the written compressed bytes.
*/
private int writeLegacyCompressedWrapperHeader() {
ensureOpenForRecordBatchWrite();
ByteBuffer buffer = bufferStream.buffer();
int pos = buffer.position();
buffer.position(initialPosition);
int wrapperSize = pos - initialPosition - Records.LOG_OVERHEAD;
int writtenCompressed = wrapperSize - LegacyRecord.recordOverhead(magic);
AbstractLegacyRecordBatch.writeHeader(buffer, lastOffset, wrapperSize);
long timestamp = timestampType == TimestampType.LOG_APPEND_TIME ? logAppendTime : maxTimestamp;
LegacyRecord.writeCompressedRecordHeader(buffer, magic, wrapperSize, timestamp, compressionType, timestampType);
buffer.position(pos);
return writtenCompressed;
}
/**
* Append a record and return its checksum for message format v0 and v1, or null for v2 and above.
*/
private Long appendWithOffset(long offset, boolean isControlRecord, long timestamp, ByteBuffer key,
ByteBuffer value, Header[] headers) {
try {
if (isControlRecord != isControlBatch)
throw new IllegalArgumentException("Control records can only be appended to control batches");
if (lastOffset != null && offset <= lastOffset)
throw new IllegalArgumentException(String.format("Illegal offset %s following previous offset %s " +
"(Offsets must increase monotonically).", offset, lastOffset));
if (timestamp < 0 && timestamp != RecordBatch.NO_TIMESTAMP)
throw new IllegalArgumentException("Invalid negative timestamp " + timestamp);
if (magic < RecordBatch.MAGIC_VALUE_V2 && headers != null && headers.length > 0)
throw new IllegalArgumentException("Magic v" + magic + " does not support record headers");
if (firstTimestamp == null)
firstTimestamp = timestamp;
if (magic > RecordBatch.MAGIC_VALUE_V1) {
appendDefaultRecord(offset, timestamp, key, value, headers);
return null;
} else {
return appendLegacyRecord(offset, timestamp, key, value, magic);
}
} catch (IOException e) {
throw new KafkaException("I/O exception when writing to the append stream, closing", e);
}
}
/**
* Append a new record at the given offset.
* @param offset The absolute offset of the record in the log buffer
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @param headers The record headers if there are any
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendWithOffset(long offset, long timestamp, byte[] key, byte[] value, Header[] headers) {
return appendWithOffset(offset, false, timestamp, wrapNullable(key), wrapNullable(value), headers);
}
/**
* Append a new record at the given offset.
* @param offset The absolute offset of the record in the log buffer
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @param headers The record headers if there are any
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendWithOffset(long offset, long timestamp, ByteBuffer key, ByteBuffer value, Header[] headers) {
return appendWithOffset(offset, false, timestamp, key, value, headers);
}
/**
* Append a new record at the given offset.
* @param offset The absolute offset of the record in the log buffer
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendWithOffset(long offset, long timestamp, byte[] key, byte[] value) {
return appendWithOffset(offset, timestamp, wrapNullable(key), wrapNullable(value), Record.EMPTY_HEADERS);
}
/**
* Append a new record at the given offset.
* @param offset The absolute offset of the record in the log buffer
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendWithOffset(long offset, long timestamp, ByteBuffer key, ByteBuffer value) {
return appendWithOffset(offset, timestamp, key, value, Record.EMPTY_HEADERS);
}
/**
* Append a new record at the given offset.
* @param offset The absolute offset of the record in the log buffer
* @param record The record to append
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendWithOffset(long offset, SimpleRecord record) {
return appendWithOffset(offset, record.timestamp(), record.key(), record.value(), record.headers());
}
/**
* Append a control record at the given offset. The control record type must be known or
* this method will raise an error.
*
* @param offset The absolute offset of the record in the log buffer
* @param record The record to append
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendControlRecordWithOffset(long offset, SimpleRecord record) {
short typeId = ControlRecordType.parseTypeId(record.key());
ControlRecordType type = ControlRecordType.fromTypeId(typeId);
if (type == ControlRecordType.UNKNOWN)
throw new IllegalArgumentException("Cannot append record with unknown control record type " + typeId);
return appendWithOffset(offset, true, record.timestamp(),
record.key(), record.value(), record.headers());
}
/**
* Append a new record at the next sequential offset.
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long append(long timestamp, ByteBuffer key, ByteBuffer value) {
return append(timestamp, key, value, Record.EMPTY_HEADERS);
}
/**
* Append a new record at the next sequential offset.
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @param headers The record headers if there are any
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long append(long timestamp, ByteBuffer key, ByteBuffer value, Header[] headers) {
return appendWithOffset(nextSequentialOffset(), timestamp, key, value, headers);
}
/**
* Append a new record at the next sequential offset.
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long append(long timestamp, byte[] key, byte[] value) {
return append(timestamp, wrapNullable(key), wrapNullable(value), Record.EMPTY_HEADERS);
}
/**
* Append a new record at the next sequential offset.
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @param headers The record headers if there are any
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long append(long timestamp, byte[] key, byte[] value, Header[] headers) {
return append(timestamp, wrapNullable(key), wrapNullable(value), headers);
}
/**
* Append a new record at the next sequential offset.
* @param record The record to append
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long append(SimpleRecord record) {
return appendWithOffset(nextSequentialOffset(), record);
}
/**
* Append a control record at the next sequential offset.
* @param timestamp The record timestamp
* @param type The control record type (cannot be UNKNOWN)
* @param value The control record value
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/
private Long appendControlRecord(long timestamp, ControlRecordType type, ByteBuffer value) {
Struct keyStruct = type.recordKey();
ByteBuffer key = ByteBuffer.allocate(keyStruct.sizeOf());
keyStruct.writeTo(key);
key.flip();
return appendWithOffset(nextSequentialOffset(), true, timestamp, key, value, Record.EMPTY_HEADERS);
}
/**
* Return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendEndTxnMarker(long timestamp, EndTransactionMarker marker) {
if (producerId == RecordBatch.NO_PRODUCER_ID)
throw new IllegalArgumentException("End transaction marker requires a valid producerId");
if (!isTransactional)
throw new IllegalArgumentException("End transaction marker depends on batch transactional flag being enabled");
ByteBuffer value = marker.serializeValue();
return appendControlRecord(timestamp, marker.controlType(), value);
}
/**
* Return CRC of the record or null if record-level CRC is not supported for the message format
*/
public Long appendLeaderChangeMessage(long timestamp, LeaderChangeMessage leaderChangeMessage) {
if (partitionLeaderEpoch == RecordBatch.NO_PARTITION_LEADER_EPOCH) {
throw new IllegalArgumentException("Partition leader epoch must be valid, but get " + partitionLeaderEpoch);
}
ObjectSerializationCache cache = new ObjectSerializationCache();
int size = leaderChangeMessage.size(cache, ControlRecordUtils.LEADER_CHANGE_SCHEMA_VERSION);
ByteBuffer buffer = ByteBuffer.allocate(size);
ByteBufferAccessor accessor = new ByteBufferAccessor(buffer);
leaderChangeMessage.write(accessor, cache, ControlRecordUtils.LEADER_CHANGE_SCHEMA_VERSION);
buffer.flip();
return appendControlRecord(timestamp, ControlRecordType.LEADER_CHANGE, buffer);
}
/**
* Add a legacy record without doing offset/magic validation (this should only be used in testing).
* @param offset The offset of the record
* @param record The record to add
*/
public void appendUncheckedWithOffset(long offset, LegacyRecord record) {
ensureOpenForRecordAppend();
try {
int size = record.sizeInBytes();
AbstractLegacyRecordBatch.writeHeader(appendStream, toInnerOffset(offset), size);
ByteBuffer buffer = record.buffer().duplicate();
appendStream.write(buffer.array(), buffer.arrayOffset(), buffer.limit());
recordWritten(offset, record.timestamp(), size + Records.LOG_OVERHEAD);
} catch (IOException e) {
throw new KafkaException("I/O exception when writing to the append stream, closing", e);
}
}
/**
* Append a record without doing offset/magic validation (this should only be used in testing).
*
* @param offset The offset of the record
* @param record The record to add
*/
public void appendUncheckedWithOffset(long offset, SimpleRecord record) throws IOException {
if (magic >= RecordBatch.MAGIC_VALUE_V2) {
int offsetDelta = (int) (offset - baseOffset);
long timestamp = record.timestamp();
if (firstTimestamp == null)
firstTimestamp = timestamp;
int sizeInBytes = DefaultRecord.writeTo(appendStream,
offsetDelta,
timestamp - firstTimestamp,
record.key(),
record.value(),
record.headers());
recordWritten(offset, timestamp, sizeInBytes);
} else {
LegacyRecord legacyRecord = LegacyRecord.create(magic,
record.timestamp(),
Utils.toNullableArray(record.key()),
Utils.toNullableArray(record.value()));
appendUncheckedWithOffset(offset, legacyRecord);
}
}
/**
* Append a record at the next sequential offset.
* @param record the record to add
*/
public void append(Record record) {
appendWithOffset(record.offset(), isControlBatch, record.timestamp(), record.key(), record.value(), record.headers());
}
/**
* Append a log record using a different offset
* @param offset The offset of the record
* @param record The record to add
*/
public void appendWithOffset(long offset, Record record) {
appendWithOffset(offset, record.timestamp(), record.key(), record.value(), record.headers());
}
/**
* Add a record with a given offset. The record must have a magic which matches the magic use to
* construct this builder and the offset must be greater than the last appended record.
* @param offset The offset of the record
* @param record The record to add
*/
public void appendWithOffset(long offset, LegacyRecord record) {
appendWithOffset(offset, record.timestamp(), record.key(), record.value());
}
/**
* Append the record at the next consecutive offset. If no records have been appended yet, use the base
* offset of this builder.
* @param record The record to add
*/
public void append(LegacyRecord record) {
appendWithOffset(nextSequentialOffset(), record);
}
private void appendDefaultRecord(long offset, long timestamp, ByteBuffer key, ByteBuffer value,
Header[] headers) throws IOException {
ensureOpenForRecordAppend();
int offsetDelta = (int) (offset - baseOffset);
long timestampDelta = timestamp - firstTimestamp;
int sizeInBytes = DefaultRecord.writeTo(appendStream, offsetDelta, timestampDelta, key, value, headers);
recordWritten(offset, timestamp, sizeInBytes);
}
private long appendLegacyRecord(long offset, long timestamp, ByteBuffer key, ByteBuffer value, byte magic) throws IOException {
ensureOpenForRecordAppend();
if (compressionType == CompressionType.NONE && timestampType == TimestampType.LOG_APPEND_TIME)
timestamp = logAppendTime;
int size = LegacyRecord.recordSize(magic, key, value);
AbstractLegacyRecordBatch.writeHeader(appendStream, toInnerOffset(offset), size);
if (timestampType == TimestampType.LOG_APPEND_TIME)
timestamp = logAppendTime;
long crc = LegacyRecord.write(appendStream, magic, timestamp, key, value, CompressionType.NONE, timestampType);
recordWritten(offset, timestamp, size + Records.LOG_OVERHEAD);
return crc;
}
private long toInnerOffset(long offset) {
// use relative offsets for compressed messages with magic v1
if (magic > 0 && compressionType != CompressionType.NONE)
return offset - baseOffset;
return offset;
}
private void recordWritten(long offset, long timestamp, int size) {
if (numRecords == Integer.MAX_VALUE)
throw new IllegalArgumentException("Maximum number of records per batch exceeded, max records: " + Integer.MAX_VALUE);
if (offset - baseOffset > Integer.MAX_VALUE)
throw new IllegalArgumentException("Maximum offset delta exceeded, base offset: " + baseOffset +
", last offset: " + offset);
numRecords += 1;
uncompressedRecordsSizeInBytes += size;
lastOffset = offset;
if (magic > RecordBatch.MAGIC_VALUE_V0 && timestamp > maxTimestamp) {
maxTimestamp = timestamp;
offsetOfMaxTimestamp = offset;
}
}
private void ensureOpenForRecordAppend() {
if (appendStream == CLOSED_STREAM)
throw new IllegalStateException("Tried to append a record, but MemoryRecordsBuilder is closed for record appends");
}
private void ensureOpenForRecordBatchWrite() {
if (isClosed())
throw new IllegalStateException("Tried to write record batch header, but MemoryRecordsBuilder is closed");
if (aborted)
throw new IllegalStateException("Tried to write record batch header, but MemoryRecordsBuilder is aborted");
}
/**
* Get an estimate of the number of bytes written (based on the estimation factor hard-coded in {@link CompressionType}.
* @return The estimated number of bytes written
*/
private int estimatedBytesWritten() {
if (compressionType == CompressionType.NONE) {
return batchHeaderSizeInBytes + uncompressedRecordsSizeInBytes;
} else {
// estimate the written bytes to the underlying byte buffer based on uncompressed written bytes
return batchHeaderSizeInBytes + (int) (uncompressedRecordsSizeInBytes * estimatedCompressionRatio * COMPRESSION_RATE_ESTIMATION_FACTOR);
}
}
/**
* Set the estimated compression ratio for the memory records builder.
*/
public void setEstimatedCompressionRatio(float estimatedCompressionRatio) {
this.estimatedCompressionRatio = estimatedCompressionRatio;
}
/**
* Check if we have room for a new record containing the given key/value pair. If no records have been
* appended, then this returns true.
*/
public boolean hasRoomFor(long timestamp, byte[] key, byte[] value, Header[] headers) {
return hasRoomFor(timestamp, wrapNullable(key), wrapNullable(value), headers);
}
/**
* Check if we have room for a new record containing the given key/value pair. If no records have been
* appended, then this returns true.
*
* Note that the return value is based on the estimate of the bytes written to the compressor, which may not be
* accurate if compression is used. When this happens, the following append may cause dynamic buffer
* re-allocation in the underlying byte buffer stream.
*/
public boolean hasRoomFor(long timestamp, ByteBuffer key, ByteBuffer value, Header[] headers) {
if (isFull())
return false;
// We always allow at least one record to be appended (the ByteBufferOutputStream will grow as needed)
if (numRecords == 0)
return true;
final int recordSize;
if (magic < RecordBatch.MAGIC_VALUE_V2) {
recordSize = Records.LOG_OVERHEAD + LegacyRecord.recordSize(magic, key, value);
} else {
int nextOffsetDelta = lastOffset == null ? 0 : (int) (lastOffset - baseOffset + 1);
long timestampDelta = firstTimestamp == null ? 0 : timestamp - firstTimestamp;
recordSize = DefaultRecord.sizeInBytes(nextOffsetDelta, timestampDelta, key, value, headers);
}
// Be conservative and not take compression of the new record into consideration.
return this.writeLimit >= estimatedBytesWritten() + recordSize;
}
public boolean isClosed() {
return builtRecords != null;
}
public boolean isFull() {
// note that the write limit is respected only after the first record is added which ensures we can always
// create non-empty batches (this is used to disable batching when the producer's batch size is set to 0).
return appendStream == CLOSED_STREAM || (this.numRecords > 0 && this.writeLimit <= estimatedBytesWritten());
}
/**
* Get an estimate of the number of bytes written to the underlying buffer. The returned value
* is exactly correct if the record set is not compressed or if the builder has been closed.
*/
public int estimatedSizeInBytes() {
return builtRecords != null ? builtRecords.sizeInBytes() : estimatedBytesWritten();
}
public byte magic() {
return magic;
}
private long nextSequentialOffset() {
return lastOffset == null ? baseOffset : lastOffset + 1;
}
public static class RecordsInfo {
public final long maxTimestamp;
public final long shallowOffsetOfMaxTimestamp;
public RecordsInfo(long maxTimestamp,
long shallowOffsetOfMaxTimestamp) {
this.maxTimestamp = maxTimestamp;
this.shallowOffsetOfMaxTimestamp = shallowOffsetOfMaxTimestamp;
}
}
/**
* Return the producer id of the RecordBatches created by this builder.
*/
public long producerId() {
return this.producerId;
}
public short producerEpoch() {
return this.producerEpoch;
}
public int baseSequence() {
return this.baseSequence;
}
}
| {
"pile_set_name": "Github"
} |
<html xmlns="http://www.w3.org/1999/xhtml">
<head><script type="text/javascript" src="../resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery.js"></script>
<script type="text/javascript" id="wicket-ajax-debug-enable">
/*<![CDATA[*/
Wicket.Log.enabled=true;
/*]]>*/
</script>
<script type="text/javascript" id="wicket-ajax-base-url">
/*<![CDATA[*/
Wicket.Ajax.baseUrl="wicket/bookmarkable/org.apache.wicket.extensions.yui.calendar.DatesPage1?0";
/*]]>*/
</script>
<script type="text/javascript" src="../resource/org.apache.wicket.extensions.yui.YuiLib/yuiloader/yuiloader.js"></script>
<title>Wicket Examples - dates</title>
<link rel="stylesheet" type="text/css" href="../../style.css"/>
<style type="text/css">
/*<![CDATA[*/
th {
color: grey;
}
/*]]>*/
</style>
<script type="text/javascript">
/*<![CDATA[*/
Wicket.Event.add(window, "domready", function(event) {
Wicket.Ajax.ajax({"u":"./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.0-localeForm-localeSelect","m":"POST","c":"localeSelect1","e":"change"});;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
if (typeof(Wicket) === 'undefined') {
window.Wicket = {};
}
if (typeof(Wicket.DateTimeInit) === 'undefined') {
Wicket.DateTimeInit = {};
}
Wicket.DateTimeInit.CalendarInits = [];
Wicket.DateTimeInit.CalendarInitFinished = false;
Wicket.DateTimeInit.CalendarI18n = {};
Wicket.DateTimeInit.CalendarAdd = function(initFn) {
if (Wicket.DateTimeInit.CalendarInitFinished) {
// when a DatePicker is added via ajax, the loader is already finished, so
// we call the init function directly.
initFn();
} else {
// when page is rendered, all calendar components will be initialized after
// the required js libraries have been loaded.
Wicket.DateTimeInit.CalendarInits.push(initFn);
}
};
Wicket.DateTimeInit.YuiLoader = new YAHOO.util.YUILoader({
base: "../resource/org.apache.wicket.extensions.yui.YuiLib/",
filter: "RAW",
allowRollup: false,
require: ["wicket-date"],
onSuccess: function() {
Wicket.DateTimeInit.CalendarInitFinished = true;
while (Wicket.DateTimeInit.CalendarInits.length > 0) {
Wicket.DateTimeInit.CalendarInits.pop()();
}
}
});
Wicket.DateTimeInit.YuiLoader.addModule({
name: "wicket-date",
type: "js",
requires: ["calendar"],
fullpath: "../resource/org.apache.wicket.extensions.yui.calendar.DatePicker/wicket-date.js"
});
Wicket.DateTimeInit.YuiLoader.insert();
;
Wicket.DateTimeInit.CalendarI18n["it"]={MONTHS_SHORT:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],MONTHS_LONG:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],WEEKDAYS_MEDIUM:["dom","lun","mar","mer","gio","ven","sab"],WEEKDAYS_LONG:["domenica","luned\u00EC","marted\u00EC","mercoled\u00EC","gioved\u00EC","venerd\u00EC","sabato"],START_WEEKDAY:1,WEEKDAYS_1CHAR:["d","l","m","m","g","v","s"],WEEKDAYS_SHORT:["do","lu","ma","me","gi","ve","sa"]};;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Wicket.DateTimeInit.CalendarAdd(function() {
Wicket.DateTime.init2("dateTextField2", "dateTextField2", {close:true,selected:"xx/xx/xxxx",pagedate:"xx/xxxx"}, "dd/MM/yy",
true, true, true, false, Wicket.DateTimeInit.CalendarI18n["it"], false);
});
;
Wicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);
;});
/*]]>*/
</script>
</head>
<body>
<form wicket:id="localeForm" id="localeForm3" method="post" action="./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.-localeForm"><div id="localeForm3_hf_0" hidden="" class="hidden-fields"></div>
<p><select wicket:id="localeSelect" name="localeSelect" id="localeSelect1">
<option value="0">cinese (Cina) (Chinese (China))</option>
<option value="1">cinese (Cina) (Chinese (China))</option>
<option value="2">cinese (Cina) (Chinese (China))</option>
<option value="3">cinese (Taiwan) (Chinese (Taiwan))</option>
<option value="4">cinese (Taiwan) (Chinese (Taiwan))</option>
<option value="5">coreano (Korean)</option>
<option value="6">coreano (Corea del Sud) (Korean (South Korea))</option>
<option value="7">francese (French)</option>
<option value="8">francese (Canada) (French (Canada))</option>
<option value="9">francese (Francia) (French (France))</option>
<option value="10">giapponese (Japanese)</option>
<option value="11">giapponese (Giappone) (Japanese (Japan))</option>
<option value="12">inglese (English)</option>
<option value="13">inglese (Canada) (English (Canada))</option>
<option value="14">inglese (Regno Unito) (English (United Kingdom))</option>
<option value="15">inglese (Stati Uniti) (English (United States))</option>
<option selected="selected" value="16">italiano (Italian)</option>
<option value="17">italiano (Italia) (Italian (Italy))</option>
<option value="18">tedesco (German)</option>
<option value="19">tedesco (Germania) (German (Germany))</option>
</select> [<a href="./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.-localeForm-localeUSLink" wicket:id="localeUSLink">set to english</a>]</p>
</form>
<p>
<form wicket:id="form" id="form4" method="post" action="./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.-form"><div id="form4_hf_0" hidden="" class="hidden-fields"></div><input type="text" wicket:id="dateTextField" value="xx/xx/xx" name="dateTextField" id="dateTextField2"/>
<span class="yui-skin-sam"> <span style="display:none;position:absolute;z-index: 99999;" id="dateTextField2Dp"></span><img style="cursor: pointer; border: none;" id="dateTextField2Icon" src="../resource/org.apache.wicket.extensions.yui.calendar.DatePicker/icon1.gif" alt="" title=""/></span> <input type="submit" value="submit" /></form>
</p>
<p>
<div wicket:id="feedback"><wicket:panel>
</wicket:panel></div>
</p>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?php
array_change_key_case($part, CASE_UPPER);
array_multisort($order, SORT_NUMERIC, SORT_DESC, $c->results);
error_reporting(E_ALL ^ E_DEPRECATED);
error_reporting(E_ALL | E_STRICT);
htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
?> | {
"pile_set_name": "Github"
} |
--source include/have_innodb.inc
--source include/have_debug_sync.inc
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connection default;
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
INSERT INTO t VALUES(1,2),(2,3);
SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL do WAIT_FOR m';
SET DEBUG_SYNC='innodb_after_inplace_alter_table SIGNAL scanned WAIT_FOR done';
--send
CREATE INDEX tb ON t(b);
connection con1;
SET DEBUG_SYNC='now WAIT_FOR do';
SET DEBUG_SYNC='row_update_for_mysql_error SIGNAL m WAIT_FOR scanned';
--error ER_DUP_ENTRY
UPDATE t SET a=2 WHERE a=1;
call mtr.add_suppression('InnoDB: record in index .*tb was not found on rollback, trying to insert');
SET DEBUG_SYNC='now SIGNAL done';
disconnect con1;
connection default;
reap;
SET DEBUG_SYNC='RESET';
DROP TABLE t;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
| {
"pile_set_name": "Github"
} |
#ifndef A_H
#define A_H
int function_from_a(int a);
#endif /* A_H */ | {
"pile_set_name": "Github"
} |
---
title: ShapeNode.Application Property (Word)
keywords: vbawd10.chm164430824
f1_keywords:
- vbawd10.chm164430824
ms.prod: word
api_name:
- Word.ShapeNode.Application
ms.assetid: 6d9efca5-c8d6-ea2b-89cb-0e91f5924cd5
ms.date: 06/08/2017
---
# ShapeNode.Application Property (Word)
Returns an **[Application](application-object-word.md)** object that represents the Microsoft Word application.
## Syntax
_expression_ . **Application**
_expression_ Required. A variable that represents a **[ShapeNode](shapenode-object-word.md)** object.
## Remarks
Visual Basic's **CreateObject** and **GetObject** functions give you access to an OLE Automation object from a Visual Basic for Applications project.
## See also
#### Concepts
[ShapeNode Object](shapenode-object-word.md)
| {
"pile_set_name": "Github"
} |
require 'json'
package = JSON.parse(File.read('../package.json'))
Pod::Spec.new do |s|
s.name = "Permission-Motion"
s.dependency "RNPermissions"
s.version = package["version"]
s.license = package["license"]
s.summary = package["description"]
s.authors = package["author"]
s.homepage = package["homepage"]
s.platform = :ios, "9.0"
s.ios.deployment_target = "9.0"
s.tvos.deployment_target = "11.0"
s.requires_arc = true
s.source = { :git => package["repository"]["url"], :tag => s.version }
s.source_files = "Motion/*.{h,m}"
end
| {
"pile_set_name": "Github"
} |
@import "mixins/mixins";
@import "common/var";
@import "input";
@include b(input-number) {
position: relative;
display: inline-block;
width: 180px;
line-height: #{$--input-height - 2};
.el-input {
display: block;
&__inner {
-webkit-appearance: none;
padding-left: #{$--input-height + 10};
padding-right: #{$--input-height + 10};
text-align: center;
}
}
@include e((increase, decrease)) {
position: absolute;
z-index: 1;
top: 1px;
width: $--input-height;
height: auto;
text-align: center;
background: $--background-color-base;
color: $--color-text-regular;
cursor: pointer;
font-size: 13px;
&:hover {
color: $--color-primary;
&:not(.is-disabled) ~ .el-input .el-input__inner:not(.is-disabled) {
border-color: $--input-focus-border;
}
}
&.is-disabled {
color: $--disabled-color-base;
cursor: not-allowed;
}
}
@include e(increase) {
right: 1px;
border-radius: 0 $--border-radius-base $--border-radius-base 0;
border-left: $--border-base;
}
@include e(decrease) {
left: 1px;
border-radius: $--border-radius-base 0 0 $--border-radius-base;
border-right: $--border-base;
}
@include when(disabled) {
@include e((increase, decrease)) {
border-color: $--disabled-border-base;
color: $--disabled-border-base;
&:hover {
color: $--disabled-border-base;
cursor: not-allowed;
}
}
}
@include m(medium) {
width: 200px;
line-height: #{$--input-medium-height - 2};
@include e((increase, decrease)) {
width: $--input-medium-height;
font-size: $--input-medium-font-size;
}
.el-input__inner {
padding-left: #{$--input-medium-height + 7};
padding-right: #{$--input-medium-height + 7};
}
}
@include m(small) {
width: 130px;
line-height: #{$--input-small-height - 2};
@include e((increase, decrease)) {
width: $--input-small-height;
font-size: $--input-small-font-size;
[class*=el-icon] {
transform: scale(.9);
}
}
.el-input__inner {
padding-left: #{$--input-small-height + 7};
padding-right: #{$--input-small-height + 7};
}
}
@include m(mini) {
width: 130px;
line-height: #{$--input-mini-height - 2};
@include e((increase, decrease)) {
width: $--input-mini-height;
font-size: $--input-mini-font-size;
[class*=el-icon] {
transform: scale(.8);
}
}
.el-input__inner {
padding-left: #{$--input-mini-height + 7};
padding-right: #{$--input-mini-height + 7};
}
}
@include when(without-controls) {
.el-input__inner {
padding-left: 15px;
padding-right: 15px;
}
}
@include when(controls-right) {
.el-input__inner {
padding-left: 15px;
padding-right: #{$--input-height + 10};
}
@include e((increase, decrease)) {
height: auto;
line-height: #{($--input-height - 2) / 2};
[class*=el-icon] {
transform: scale(.8);
}
}
@include e(increase) {
border-radius: 0 $--border-radius-base 0 0;
border-bottom: $--border-base;
}
@include e(decrease) {
right: 1px;
bottom: 1px;
top: auto;
left: auto;
border-right: none;
border-left: $--border-base;
border-radius: 0 0 $--border-radius-base 0;
}
&[class*=medium] {
[class*=increase], [class*=decrease] {
line-height: #{($--input-medium-height - 2) / 2};
}
}
&[class*=small] {
[class*=increase], [class*=decrease] {
line-height: #{($--input-small-height - 2) / 2};
}
}
&[class*=mini] {
[class*=increase], [class*=decrease] {
line-height: #{($--input-mini-height - 2) / 2};
}
}
}
}
| {
"pile_set_name": "Github"
} |
import { Injectable } from '@angular/core';
import { assert } from './utils';
declare const require;
@Injectable({
providedIn: 'root'
})
export class ScriptLoaderService {
private readonly scripts = {
SystemJS: require('!!raw-loader!systemjs/dist/system'),
mocha: require('!!raw-loader!../../../assets/runner/js/mocha'),
chai: require('!!raw-loader!chai/chai'),
'test-bootstrap': require('!!raw-loader!../../../assets/runner/js/test-bootstrap'),
shim: require('!!raw-loader!core-js/client/shim.min.js'),
zone: require('!!raw-loader!zone.js/dist/zone.js'),
'system-config': require('!!raw-loader!../../../assets/runner/js/system-config'),
'ng-bundle': require('!!raw-loader!../../../assets/runner/ng2/ng-bundle')
// TODO(kirjs): not sure we still need vue and react libs
// vue: require('!!raw-loader!vue/dist/vue.js'),
// react: require('!!raw-loader!react/umd/react.development.js'),
// 'react-dom': require('!!raw-loader!react-dom/umd/react-dom.development.js')
};
getScript(url) {
assert(this.scripts[url]);
return this.scripts[url];
}
}
| {
"pile_set_name": "Github"
} |
If you are interested in understanding the internals of Google Test,
building from source, or contributing ideas or modifications to the
project, then this document is for you.
# Introduction #
First, let's give you some background of the project.
## Licensing ##
All Google Test source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php).
## The Google Test Community ##
The Google Test community exists primarily through the [discussion group](http://groups.google.com/group/googletestframework) and the GitHub repository.
You are definitely encouraged to contribute to the
discussion and you can also help us to keep the effectiveness of the
group high by following and promoting the guidelines listed here.
### Please Be Friendly ###
Showing courtesy and respect to others is a vital part of the Google
culture, and we strongly encourage everyone participating in Google
Test development to join us in accepting nothing less. Of course,
being courteous is not the same as failing to constructively disagree
with each other, but it does mean that we should be respectful of each
other when enumerating the 42 technical reasons that a particular
proposal may not be the best choice. There's never a reason to be
antagonistic or dismissive toward anyone who is sincerely trying to
contribute to a discussion.
Sure, C++ testing is serious business and all that, but it's also
a lot of fun. Let's keep it that way. Let's strive to be one of the
friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group.
You don't have to actually submit code in order to sign up. Your participation
itself is a valuable contribution.
# Working with the Code #
If you want to get your hands dirty with the code inside Google Test,
this is the section for you.
## Compiling from Source ##
Once you check out the code, you can find instructions on how to
compile it in the [README](../README.md) file.
## Testing ##
A testing framework is of no good if itself is not thoroughly tested.
Tests should be written for any new code, and changes should be
verified to not break existing tests before they are submitted for
review. To perform the tests, follow the instructions in
[README](../README.md) and verify that there are no failures.
# Contributing Code #
We are excited that Google Test is now open source, and hope to get
great patches from the community. Before you fire up your favorite IDE
and begin hammering away at that new feature, though, please take the
time to read this section and understand the process. While it seems
rigorous, we want to keep a high standard of quality in the code
base.
## Contributor License Agreements ##
You must sign a Contributor License Agreement (CLA) before we can
accept any code. The CLA protects you and us.
* If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).
* If you work for a company that wants to allow you to contribute your work to Google Test, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html).
Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it.
## Coding Style ##
To keep the source consistent, readable, diffable and easy to merge,
we use a fairly rigid coding style, as defined by the [google-styleguide](http://code.google.com/p/google-styleguide/) project. All patches will be expected
to conform to the style outlined [here](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml).
## Updating Generated Code ##
Some of Google Test's source files are generated by the Pump tool (a
Python script). If you need to update such files, please modify the
source (`foo.h.pump`) and re-generate the C++ file using Pump. You
can read the PumpManual for details.
## Submitting Patches ##
Please do submit code. Here's what you need to do:
1. A submission should be a set of changes that addresses one issue in the [issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one.
1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches.
1. Ensure that your code adheres to the [Google Test source code style](#Coding_Style.md).
1. Ensure that there are unit tests for your code.
1. Sign a Contributor License Agreement.
1. Create a Pull Request in the usual way.
## Google Test Committers ##
The current members of the Google Test engineering team are the only
committers at present. In the great tradition of eating one's own
dogfood, we will be requiring each new Google Test engineering team
member to earn the right to become a committer by following the
procedures in this document, writing consistently great code, and
demonstrating repeatedly that he or she truly gets the zen of Google
Test.
# Release Process #
We follow a typical release process:
1. A release branch named `release-X.Y` is created.
1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable.
1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch.
1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time).
1. Go back to step 1 to create another release branch and so on.
---
This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/).
| {
"pile_set_name": "Github"
} |
# Contributing
We would love to have people submit pull requests and help make `grpc-ecosystem/go-grpc-middleware` even better 👍.
Fork, then clone the repo:
```bash
git clone [email protected]:your-username/go-grpc-middleware.git
```
Before checking in please run the following:
```bash
make all
```
This will `vet`, `fmt`, regenerate documentation and run all tests.
Push to your fork and open a pull request. | {
"pile_set_name": "Github"
} |
<RCC>
<qresource prefix="/">
<file>urlHints.txt</file>
</qresource>
</RCC>
| {
"pile_set_name": "Github"
} |
/* Generated by RuntimeBrowser.
*/
@protocol GEOVenueLabel
@required
- (NSString *)detail;
- (NSString *)name;
- (NSString *)shortName;
@end
| {
"pile_set_name": "Github"
} |
How to Create a Conscrypt Release
====================================
One-Time Setup
--------------
These steps need to be performed once by each person doing releases.
### Platforms
Conscrypt is built on Linux, Mac, and Windows, so ensure you have access to machines
running all three. The 1.0.0 release was made with the following configuration:
* Ubuntu 14.04
* MacOS Sierra (10.12)
* Windows Server 2016
### Software
The following software is necessary and may not be installed by default:
<!-- TODO(flooey): Expand and link these, there's probably more -->
* Linux: [Docker](https://www.docker.com/), [Android SDK](https://developer.android.com/studio/index.html)
* MacOS: Java SDK
* Windows: MSVC, git, NASM, Java
### Setup OSSRH and GPG
If you haven't deployed artifacts to Maven Central before, you need to setup
your OSSRH (OSS Repository Hosting) account and signing keys.
- Follow the instructions on [this
page](http://central.sonatype.org/pages/ossrh-guide.html) to set up an
account with OSSRH.
- You only need to create the account, not set up a new project
- Contact a Conscrypt maintainer to add your account after you have created it.
- Install GnuPG and [generate your key
pair](https://www.gnupg.org/documentation/howtos.html).
- [Publish your public key](https://www.gnupg.org/gph/en/manual.html#AEN464)
to make it visible to the Sonatype servers
(e.g. `gpg --keyserver pgp.mit.edu --send-key <key ID>`).
### Get the signing certificates
Contact an existing Conscrypt maintainer to get the keystore containing the
code signing certificate.
### Set up gradle.properties
Add your OSSRH credentials, GPG key information, and the code signing keystore details
to `$HOME/.gradle/gradle.properties`.
```
signing.keyId=<8-character-public-key-id>
signing.password=<key-password>
signing.secretKeyRingFile=<your-home-directory>/.gnupg/secring.gpg
signingKeystore=<path-to-keystore>
signingPassword=<keystore-password>
ossrhUsername=<ossrh-username>
ossrhPassword=<ossrh-password>
checkstyle.ignoreFailures=false
```
Once Per Release Series Setup
-----------------------------
These steps need to be performed once per `X.Y` release series.
### Create the release branch
We use a branch named `<major>.<minor>.x` for all releases in a series.
Create the branch and push it to GitHub:
```bash
$ git checkout -b 1.0.x master
$ git push upstream 1.0.x
```
### Set the branch protection settings
In the GitHub UI, go to Settings -> Branches and mark the new branch as
protected, with administrators included and restrict pushes to administrators.
### Update the master version
Update the master branch's version to the next minor snapshot.
```bash
$ git checkout -b bump-version master
# Change version in build.gradle to X.Y+1-SNAPSHOT
$ git commit -a -m 'Start X.Y+1 development cycle'
# Push to GitHub and get reviewed like normal
```
Making a New Release
--------------------
### Cherry-pick changes from the master branch (optional)
Cherry-pick any desired master changes since the branch was created.
```bash
$ git checkout 1.0.x
$ git cherry-pick <revision>
```
### Tag the release
```bash
# Change version in build.gradle to this version's number
$ git commit -a -m 'Preparing version 1.0.0'
$ git tag -a 1.0.0 -m 'Version 1.0.0'
```
### Push to GitHub
Push both the branch and the new tag to GitHub.
```bash
$ git push upstream 1.0.x
$ git push upstream 1.0.0
```
### Build the Linux OpenJDK Release
The deployment for Linux uses [Docker](https://www.docker.com/) running
CentOS 6.6 in order to ensure that we have a consistent deployment environment
on Linux.
1. From the conscrypt source directory:
```bash
$ docker build -t conscrypt-deploy release
```
1. Start a Docker container that has the deploy environment set up for you. The
Conscrypt source is cloned into `/conscrypt`.
```bash
$ docker run -it --rm=true conscrypt-deploy
```
Note that the container will be deleted after you exit. Any changes you have
made (e.g., copied configuration files) will be lost. If you want to keep the
container, remove `--rm=true` from the command line.
1. Copy your OSSRH credentials and GnuPG keys to your docker container. In Docker:
```
# mkdir /root/.gradle
```
Find the container ID in your bash prompt, which is shown as `[root@<container-ID> ...]`.
In host:
```
$ docker cp ~/.gnupg <container-ID>:/root/
$ docker cp ~/.gradle/gradle.properties <container-ID>:/root/.gradle/
$ docker cp <path to cert keystore> <container-ID>:/root/certkeystore
```
You'll also need to update `signing.secretKeyRingFile` and `signingKeystore` in
`/root/.gradle/gradle.properties` to point to `/root/.gnupg/secring.gpg` and
`/root/certkeystore`, respectively.
1. Create the initial build
```bash
$ git checkout 1.0.x
$ ./gradlew conscrypt-openjdk:build
$ ./gradlew -Dorg.gradle.parallel=false publish
```
1. Note the BoringSSL commit used for this build.
```bash
$ cd /usr/src/boringssl
$ git log -n 1
```
1. Go to the OSSRH UI and note the ID of the new staging repository. It should be in the
form of `orgconscrypt-NNNN`.
### Build the Mac and Windows OpenJDK Releases
See [BUILDING](../BUILDING.md) for instructions for setting up the build environment.
1. Ensure BoringSSL is synced to the same revision as for the Linux build.
```bash
$ git checkout <revision>
$ cd build64
$ ninja
# For Windows only
$ cd ..\build32
$ ninja
```
1. Build the code and upload it to the staging repository noted previously.
```bash
$ ./gradlew conscrypt-openjdk:build
$ ./gradlew conscrypt-openjdk:publish -Dorg.gradle.parallel=false -PrepositoryId=<repository-id>
```
(Omit the `./` for the Windows build.)
### Close and Release the Staging Repository
1. Navigate to the staging repository, open the contents, and ensure there are jars for
each supported build environment: linux-x86_64, osx-x86_64, windows-x86, and windows-x86_64.
1. Click the `close` button at the top of the staging repo list.
1. After the automated checks are done, click the `release` button at the top of the staging repo list.
You can see the complete process for releasing to Maven Central on the [OSSRH site]
(http://central.sonatype.org/pages/releasing-the-deployment.html).
It will take several hours for the jars to show up on [Maven Central](http://search.maven.org).
### Build the Android Release
The Android build is not yet integrated into the Docker container, so on any machine with
the Android SDK installed, do the following:
1. Build the code.
```bash
$ ./gradlew conscrypt-android:build
$ ./gradlew conscrypt-android:publish -Dorg.gradle.parallel=false
```
1. Visit the OSSRH site and close and release the repository.
### Build the Uber Jar
Once the platform-specific jars have shown up on Maven Central, return to the Docker container
and build the Uber jar.
1. Build the code.
```bash
# If you left the container, reattach to it
$ docker container attach {CONTAINER_ID}
$ ./gradlew conscrypt-openjdk-uber:build -Dorg.conscrypt.openjdk.buildUberJar=true
$ ./gradlew conscrypt-openjdk-uber:publish -Dorg.gradle.parallel=false -Dorg.conscrypt.openjdk.buildUberJar=true
```
1. Visit the OSSRH site and close and release the repository.
### Notify the Community
Finally, document and publicize the release.
1. Add [Release Notes](https://github.com/google/conscrypt/releases) for the new tag.
The description should include any major fixes or features since the last release.
You may choose to add links to bugs, PRs, or commits if appropriate.
2. Post a release announcement to [conscrypt](https://groups.google.com/forum/#!forum/conscrypt)
(`[email protected]`). The title should be something that clearly identifies
the release (e.g.`Conscrypt <tag> Released`).
| {
"pile_set_name": "Github"
} |
package bundlec
import (
"sort"
"github.com/atlassian/ctrl"
smith_v1 "github.com/atlassian/smith/pkg/apis/smith/v1"
"github.com/pkg/errors"
"go.uber.org/zap"
api_errors "k8s.io/apimachinery/pkg/api/errors"
)
func (c *Controller) Process(pctx *ctrl.ProcessContext) (bool /*external*/, bool /*retriable*/, error) {
return c.ProcessBundle(pctx.Logger, pctx.Object.(*smith_v1.Bundle))
}
// ProcessBundle is only visible for testing purposes. Should not be called directly.
func (c *Controller) ProcessBundle(logger *zap.Logger, bundle *smith_v1.Bundle) (bool /*external*/, bool /*retriable*/, error) {
st := bundleSyncTask{
logger: logger,
bundleClient: c.BundleClient,
smartClient: c.SmartClient,
checker: c.Rc,
store: c.Store,
specChecker: c.SpecChecker,
bundle: bundle,
pluginContainers: c.PluginContainers,
scheme: c.Scheme,
catalog: c.Catalog,
bundleTransitionCounter: c.BundleTransitionCounter,
bundleResourceTransitionCounter: c.BundleResourceTransitionCounter,
recorder: c.Recorder,
}
var external bool
var retriable bool
var err error
if st.bundle.DeletionTimestamp != nil {
external, retriable, err = st.processDeleted()
} else {
external, retriable, err = st.processNormal()
}
if err != nil {
cause := errors.Cause(err)
// short circuit on conflicts
if api_errors.IsConflict(cause) {
return external, retriable, err
}
// proceed to handleProcessResult() for all other errors
}
// Updates bundle status
handleProcessRetriable, handleProcessErr := st.handleProcessResult(retriable, err)
// Inspect the resources for failures. They can fail for many different reasons.
// The priority of errors to bubble up to the ctrl layer are:
// 1. processDeleted/processNormal errors
// 2. Internal resource processing errors are raised first
// 3. External resource processing errors are raised last
// 4. handleProcessResult errors of any sort.
// Handle the errors from processDeleted/processNormal, taking precedence
// over the handleProcessErr if any.
if err != nil {
if handleProcessErr != nil {
st.logger.Error("Error processing Bundle", zap.Error(handleProcessErr))
}
return external, retriable || handleProcessRetriable, err
}
// Inspect resources, returning an error if necessary
allExternalErrors := true
hasRetriableResourceErr := false
var failedResources []string
for resName, resInfo := range st.processedResources {
resErr := resInfo.fetchError()
if resErr != nil {
allExternalErrors = allExternalErrors && resErr.isExternalError
hasRetriableResourceErr = hasRetriableResourceErr || resErr.isRetriableError
failedResources = append(failedResources, string(resName))
}
}
if len(failedResources) > 0 {
if handleProcessErr != nil {
st.logger.Error("Error processing Bundle", zap.Error(handleProcessErr))
}
// stable output
sort.Strings(failedResources)
err := errors.Errorf("error processing resource(s): %q", failedResources)
return allExternalErrors, hasRetriableResourceErr || handleProcessRetriable, err
}
// Otherwise, return the result from handleProcessResult
return false, handleProcessRetriable, handleProcessErr
}
| {
"pile_set_name": "Github"
} |
// This is a generated file. Not intended for manual editing.
package org.elixir_lang.psi;
import com.ericsson.otp.erlang.OtpErlangObject;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface ElixirUnmatchedAtNumericBracketOperation extends ElixirUnmatchedExpression, AtNumericBracketOperation {
@NotNull
ElixirAtPrefixOperator getAtPrefixOperator();
@Nullable
ElixirBinaryWholeNumber getBinaryWholeNumber();
@NotNull
ElixirBracketArguments getBracketArguments();
@Nullable
ElixirCharToken getCharToken();
@Nullable
ElixirDecimalFloat getDecimalFloat();
@Nullable
ElixirDecimalWholeNumber getDecimalWholeNumber();
@Nullable
ElixirHexadecimalWholeNumber getHexadecimalWholeNumber();
@Nullable
ElixirOctalWholeNumber getOctalWholeNumber();
@Nullable
ElixirUnknownBaseWholeNumber getUnknownBaseWholeNumber();
@NotNull
OtpErlangObject quote();
}
| {
"pile_set_name": "Github"
} |
/*
* Spreed WebRTC.
* Copyright (C) 2013-2015 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
.mainYoutubevideo #youtubevideo { // scss-lint:disable IdSelector
display: block;
}
.youtubevideo {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
.click-container {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: 5;
}
.welcome {
max-width: 700px;
h1 {
margin-top: 10px;
}
.welcome-container {
max-width: 700px;
}
.welcome-logo {
background: transparent;
font-size: 10em;
}
}
.overlaybar {
bottom: 0;
left: 0;
right: 0;
}
.overlaybar-content {
max-width: 100%;
width: 100%;
form .overlaybar-buttons {
position: absolute;
right: 23px;
top: 6px;
}
}
.overlaybar-input {
padding-right: 15px;
position: relative;
width: 100%;
}
}
.youtubevideopane {
bottom: 0;
left: 0;
overflow: auto;
position: absolute;
right: 0;
top: 0;
}
.youtubecontainer {
position: relative;
&.fullscreen {
width: 100%;
}
}
.youtubeplayerinfo {
bottom: 10%;
left: 0;
opacity: 0;
pointer-events: auto;
position: absolute;
right: 0;
text-align: center;
transition-duration: .2s;
transition-property: opacity;
z-index: 10;
&:hover {
opacity: .8;
}
div {
background-color: #f9f2f4;
border-radius: 10px;
display: inline-block;
font-size: 2em;
padding: 20px 40px;
}
}
.volumecontrol {
background: rgba(0, 0, 0, .6);
bottom: 0;
left: 0;
opacity: 0;
padding: 4px;
pointer-events: auto;
position: absolute;
right: 0;
z-index: 10;
&:hover {
opacity: 1;
}
}
.volume-button {
display: inline;
min-width: 38px;
}
.volumebar {
display: inline-block;
padding: 6px 8px;
vertical-align: middle;
.bar {
-webkit-appearance: none;
background-color: #aaa;
border: 1px solid #aaa;
height: 3px;
outline: 0;
width: 100px;
&::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: #fff;
height: 20px;
width: 6px;
}
&::-moz-range-track {
background: #aaa;
border: 0;
}
&::-moz-range-thumb {
background-color: #fff;
border-radius: 0;
height: 20px;
width: 6px;
}
&::-moz-focusring {
outline: 1px solid #aaa;
outline-offset: -1px;
}
}
}
| {
"pile_set_name": "Github"
} |
'use strict';
const yaml =
require(`${__dirname}/../node_modules/eslint/node_modules/js-yaml`);
function isYAMLBlock(text) {
return /^<!-- YAML/.test(text);
}
function arrify(value) {
return Array.isArray(value) ? value : [value];
}
function extractAndParseYAML(text) {
text = text.trim()
.replace(/^<!-- YAML/, '')
.replace(/-->$/, '');
// js-yaml.safeLoad() throws on error.
const meta = yaml.safeLoad(text);
if (meta.added) {
// Since semver-minors can trickle down to previous major versions,
// features may have been added in multiple versions.
meta.added = arrify(meta.added);
}
if (meta.napiVersion) {
meta.napiVersion = arrify(meta.napiVersion);
}
if (meta.deprecated) {
// Treat deprecated like added for consistency.
meta.deprecated = arrify(meta.deprecated);
}
if (meta.removed) {
meta.removed = arrify(meta.removed);
}
meta.changes = meta.changes || [];
return meta;
}
module.exports = { arrify, isYAMLBlock, extractAndParseYAML };
| {
"pile_set_name": "Github"
} |
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
namespace CSharpEssentials.UseNameOf
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = "Use NameOf")]
internal class UseNameOfCodeFix : CodeFixProvider
{
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var root = await context.Document.GetSyntaxRootAsync(CancellationToken.None);
var literalExpression = root.FindNode(context.Span, getInnermostNodeForTie: true) as LiteralExpressionSyntax;
if (literalExpression != null)
{
context.RegisterCodeFix(
CodeAction.Create("Use NameOf", c => ReplaceWithNameOf(context.Document, literalExpression, c)),
context.Diagnostics);
}
}
private async Task<Document> ReplaceWithNameOf(Document document, LiteralExpressionSyntax literalExpression, CancellationToken cancellationToken)
{
var stringText = literalExpression.Token.ValueText;
var nameOfExpression = InvocationExpression(
expression: IdentifierName("nameof"),
argumentList: ArgumentList(
arguments: SingletonSeparatedList(Argument(IdentifierName(stringText)))));
var root = await document.GetSyntaxRootAsync(cancellationToken);
var newRoot = root.ReplaceNode(literalExpression, nameOfExpression);
return document.WithSyntaxRoot(newRoot);
}
public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DiagnosticIds.UseNameOf);
public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
}
}
| {
"pile_set_name": "Github"
} |
#if !defined(PCI_H) && defined(CONFIG_PCI)
#define PCI_H
/*
** Support for NE2000 PCI clones added David Monro June 1997
** Generalised for other PCI NICs by Ken Yap July 1997
**
** Most of this is taken from:
**
** /usr/src/linux/drivers/pci/pci.c
** /usr/src/linux/include/linux/pci.h
** /usr/src/linux/arch/i386/bios32.c
** /usr/src/linux/include/linux/bios32.h
** /usr/src/linux/drivers/net/ne.c
*/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*/
#include "pci_ids.h"
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
#define PCI_COMMAND_MEM 0x2 /* Enable response in mem space */
#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
#define PCIBIOS_PCI_FUNCTION_ID 0xb1XX
#define PCIBIOS_PCI_BIOS_PRESENT 0xb101
#define PCIBIOS_FIND_PCI_DEVICE 0xb102
#define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103
#define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106
#define PCIBIOS_READ_CONFIG_BYTE 0xb108
#define PCIBIOS_READ_CONFIG_WORD 0xb109
#define PCIBIOS_READ_CONFIG_DWORD 0xb10a
#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b
#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c
#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d
#define PCI_VENDOR_ID 0x00 /* 16 bits */
#define PCI_DEVICE_ID 0x02 /* 16 bits */
#define PCI_COMMAND 0x04 /* 16 bits */
#define PCI_STATUS 0x06 /* 16 bits */
#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
#define PCI_STATUS_DEVSEL_FAST 0x000
#define PCI_STATUS_DEVSEL_MEDIUM 0x200
#define PCI_STATUS_DEVSEL_SLOW 0x400
#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
#define PCI_REVISION 0x08 /* 8 bits */
#define PCI_REVISION_ID 0x08 /* 8 bits */
#define PCI_CLASS_REVISION 0x08 /* 32 bits */
#define PCI_CLASS_CODE 0x0b /* 8 bits */
#define PCI_SUBCLASS_CODE 0x0a /* 8 bits */
#define PCI_HEADER_TYPE 0x0e /* 8 bits */
#define PCI_HEADER_TYPE_NORMAL 0
#define PCI_HEADER_TYPE_BRIDGE 1
#define PCI_HEADER_TYPE_CARDBUS 2
/* Header type 0 (normal devices) */
#define PCI_CARDBUS_CIS 0x28
#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
#define PCI_SUBSYSTEM_ID 0x2e
#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits */
#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits */
#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */
#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
#ifndef PCI_BASE_ADDRESS_IO_MASK
#define PCI_BASE_ADDRESS_IO_MASK (~0x03)
#endif
#ifndef PCI_BASE_ADDRESS_MEM_MASK
#define PCI_BASE_ADDRESS_MEM_MASK (~0x0f)
#endif
#define PCI_BASE_ADDRESS_SPACE_IO 0x01
#define PCI_ROM_ADDRESS 0x30 /* 32 bits */
#define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM,
bits 31..11 are address,
10..2 are reserved */
#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
#define PCI_INTERRUPT_LINE 0x3c /* IRQ number (0-15) */
#define PCI_INTERRUPT_PIN 0x3d /* IRQ pin on PCI bus (A-D) */
/* Header type 1 (PCI-to-PCI bridges) */
#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */
#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */
#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */
#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */
#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */
#define PCI_IO_LIMIT 0x1d
#define PCI_IO_RANGE_TYPE_MASK 0x0f /* I/O bridging type */
#define PCI_IO_RANGE_TYPE_16 0x00
#define PCI_IO_RANGE_TYPE_32 0x01
#define PCI_IO_RANGE_MASK ~0x0f
#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */
#define PCI_MEMORY_BASE 0x20 /* Memory range behind */
#define PCI_MEMORY_LIMIT 0x22
#define PCI_MEMORY_RANGE_TYPE_MASK 0x0f
#define PCI_MEMORY_RANGE_MASK ~0x0f
#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */
#define PCI_PREF_MEMORY_LIMIT 0x26
#define PCI_PREF_RANGE_TYPE_MASK 0x0f
#define PCI_PREF_RANGE_TYPE_32 0x00
#define PCI_PREF_RANGE_TYPE_64 0x01
#define PCI_PREF_RANGE_MASK ~0x0f
#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */
#define PCI_PREF_LIMIT_UPPER32 0x2c
#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
#define PCI_IO_LIMIT_UPPER16 0x32
/* 0x34 same as for htype 0 */
/* 0x35-0x3b is reserved */
#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
/* 0x3c-0x3d are same as for htype 0 */
#define PCI_BRIDGE_CONTROL 0x3e
#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */
#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */
#define PCI_CB_CAPABILITY_LIST 0x14
/* Capability lists */
#define PCI_CAP_LIST_ID 0 /* Capability ID */
#define PCI_CAP_ID_PM 0x01 /* Power Management */
#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
#define PCI_CAP_SIZEOF 4
/* Power Management Registers */
#define PCI_PM_PMC 2 /* PM Capabilities Register */
#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */
#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */
#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */
#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */
#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */
#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
#define PCI_PM_CTRL 4 /* PM control and status register */
#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */
#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
#define PCI_PM_DATA_REGISTER 7 /* (??) */
#define PCI_PM_SIZEOF 8
/* AGP registers */
#define PCI_AGP_VERSION 2 /* BCD version number */
#define PCI_AGP_RFU 3 /* Rest of capability flags */
#define PCI_AGP_STATUS 4 /* Status register */
#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
#define PCI_AGP_COMMAND 8 /* Control register */
#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
#define PCI_AGP_SIZEOF 12
/* Slot Identification */
#define PCI_SID_ESR 2 /* Expansion Slot Register */
#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
/* Message Signalled Interrupts registers */
#define PCI_MSI_FLAGS 2 /* Various flags */
#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */
#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */
#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */
#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */
#define PCI_MSI_RFU 3 /* Rest of capability flags */
#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
#define PCI_SLOT(devfn) ((devfn) >> 3)
#define PCI_FUNC(devfn) ((devfn) & 0x07)
#define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
/* PCI signature: "PCI " */
#define PCI_SIGNATURE (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24))
/* PCI service signature: "$PCI" */
#define PCI_SERVICE (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24))
union bios32 {
struct {
unsigned long signature; /* _32_ */
unsigned long entry; /* 32 bit physical address */
unsigned char revision; /* Revision level, 0 */
unsigned char length; /* Length in paragraphs should be 01 */
unsigned char checksum; /* All bytes must add up to zero */
unsigned char reserved[5]; /* Must be zero */
} fields;
char chars[16];
};
struct pci_device;
struct dev;
typedef int (*pci_probe_t)(struct dev *, struct pci_device *);
struct pci_device {
uint32_t class;
uint16_t vendor, dev_id;
const char *name;
/* membase and ioaddr are silly and depricated */
unsigned int membase;
unsigned int ioaddr;
unsigned int romaddr;
unsigned char irq;
unsigned char devfn;
unsigned char bus;
unsigned char use_specified;
const struct pci_driver *driver;
};
extern void scan_pci_bus(int type, struct pci_device *dev);
extern void find_pci(int type, struct pci_device *dev);
extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t *value);
extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t value);
extern int pcibios_read_config_word(unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t *value);
extern int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t value);
extern int pcibios_read_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t *value);
extern int pcibios_write_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value);
extern unsigned long pcibios_bus_base(unsigned int bus);
extern void adjust_pci_device(struct pci_device *p);
static inline int
pci_read_config_byte(struct pci_device *dev, unsigned int where, uint8_t *value)
{
return pcibios_read_config_byte(dev->bus, dev->devfn, where, value);
}
static inline int
pci_write_config_byte(struct pci_device *dev, unsigned int where, uint8_t value)
{
return pcibios_write_config_byte(dev->bus, dev->devfn, where, value);
}
static inline int
pci_read_config_word(struct pci_device *dev, unsigned int where, uint16_t *value)
{
return pcibios_read_config_word(dev->bus, dev->devfn, where, value);
}
static inline int
pci_write_config_word(struct pci_device *dev, unsigned int where, uint16_t value)
{
return pcibios_write_config_word(dev->bus, dev->devfn, where, value);
}
static inline int
pci_read_config_dword(struct pci_device *dev, unsigned int where, uint32_t *value)
{
return pcibios_read_config_dword(dev->bus, dev->devfn, where, value);
}
static inline int
pci_write_config_dword(struct pci_device *dev, unsigned int where, uint32_t value)
{
return pcibios_write_config_dword(dev->bus, dev->devfn, where, value);
}
/* Helper functions to find the size of a pci bar */
extern unsigned long pci_bar_start(struct pci_device *dev, unsigned int bar);
extern unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar);
/* Helper function to find pci capabilities */
extern int pci_find_capability(struct pci_device *dev, int cap);
struct pci_id {
unsigned short vendor, dev_id;
const char *name;
};
struct dev;
/* Most pci drivers will use this */
struct pci_driver {
int type;
const char *name;
pci_probe_t probe;
struct pci_id *ids;
int id_count;
/* On a few occasions the hardware is standardized enough that
* we only need to know the class of the device and not the exact
* type to drive the device correctly. If this is the case
* set a class value other than 0.
*/
unsigned short class;
};
#define PCI_ROM(VENDOR_ID, DEVICE_ID, IMAGE, DESCRIPTION) \
{ VENDOR_ID, DEVICE_ID, IMAGE, }
#endif /* PCI_H */
| {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Red
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
- first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 10
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 3
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 0
m_Colors:
- first:
name: _Color
second: {r: 1, g: 0, b: 0, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
| {
"pile_set_name": "Github"
} |
/*
[auto_generated]
boost/numeric/odeint/stepper/runge_kutta_fehlberg87.hpp
[begin_description]
Implementation of the Runge-Kutta-Fehlberg stepper with the generic stepper.
[end_description]
Copyright 2011-2013 Mario Mulansky
Copyright 2012-2013 Karsten Ahnert
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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
#include <boost/numeric/odeint/algebra/default_operations.hpp>
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint/util/state_wrapper.hpp>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/resizer.hpp>
namespace boost {
namespace numeric {
namespace odeint {
#ifndef DOXYGEN_SKIP
template< class Value = double >
struct rk78_coefficients_a1 : boost::array< Value , 1 >
{
rk78_coefficients_a1( void )
{
(*this)[0] = static_cast< Value >( 2 )/static_cast< Value >( 27 );
}
};
template< class Value = double >
struct rk78_coefficients_a2 : boost::array< Value , 2 >
{
rk78_coefficients_a2( void )
{
(*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 36 );
(*this)[1] = static_cast< Value >( 1 )/static_cast< Value >( 12 );
}
};
template< class Value = double >
struct rk78_coefficients_a3 : boost::array< Value , 3 >
{
rk78_coefficients_a3( void )
{
(*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 24 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 1 )/static_cast< Value >( 8 );
}
};
template< class Value = double >
struct rk78_coefficients_a4 : boost::array< Value , 4 >
{
rk78_coefficients_a4( void )
{
(*this)[0] = static_cast< Value >( 5 )/static_cast< Value >( 12 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( -25 )/static_cast< Value >( 16 );
(*this)[3] = static_cast< Value >( 25 )/static_cast< Value >( 16 );
}
};
template< class Value = double >
struct rk78_coefficients_a5 : boost::array< Value , 5 >
{
rk78_coefficients_a5( void )
{
(*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 20 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 1 )/static_cast< Value >( 4 );
(*this)[4] = static_cast< Value >( 1 )/static_cast< Value >( 5 );
}
};
template< class Value = double >
struct rk78_coefficients_a6 : boost::array< Value , 6 >
{
rk78_coefficients_a6( void )
{
(*this)[0] = static_cast< Value >( -25 )/static_cast< Value >( 108 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 125 )/static_cast< Value >( 108 );
(*this)[4] = static_cast< Value >( -65 )/static_cast< Value >( 27 );
(*this)[5] = static_cast< Value >( 125 )/static_cast< Value >( 54 );
}
};
template< class Value = double >
struct rk78_coefficients_a7 : boost::array< Value , 7 >
{
rk78_coefficients_a7( void )
{
(*this)[0] = static_cast< Value >( 31 )/static_cast< Value >( 300 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 0 );
(*this)[4] = static_cast< Value >( 61 )/static_cast< Value >( 225 );
(*this)[5] = static_cast< Value >( -2 )/static_cast< Value >( 9 );
(*this)[6] = static_cast< Value >( 13 )/static_cast< Value >( 900 );
}
};
template< class Value = double >
struct rk78_coefficients_a8 : boost::array< Value , 8 >
{
rk78_coefficients_a8( void )
{
(*this)[0] = static_cast< Value >( 2 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( -53 )/static_cast< Value >( 6 );
(*this)[4] = static_cast< Value >( 704 )/static_cast< Value >( 45 );
(*this)[5] = static_cast< Value >( -107 )/static_cast< Value >( 9 );
(*this)[6] = static_cast< Value >( 67 )/static_cast< Value >( 90 );
(*this)[7] = static_cast< Value >( 3 );
}
};
template< class Value = double >
struct rk78_coefficients_a9 : boost::array< Value , 9 >
{
rk78_coefficients_a9( void )
{
(*this)[0] = static_cast< Value >( -91 )/static_cast< Value >( 108 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 23 )/static_cast< Value >( 108 );
(*this)[4] = static_cast< Value >( -976 )/static_cast< Value >( 135 );
(*this)[5] = static_cast< Value >( 311 )/static_cast< Value >( 54 );
(*this)[6] = static_cast< Value >( -19 )/static_cast< Value >( 60 );
(*this)[7] = static_cast< Value >( 17 )/static_cast< Value >( 6 );
(*this)[8] = static_cast< Value >( -1 )/static_cast< Value >( 12 );
}
};
template< class Value = double >
struct rk78_coefficients_a10 : boost::array< Value , 10 >
{
rk78_coefficients_a10( void )
{
(*this)[0] = static_cast< Value >( 2383 )/static_cast< Value >( 4100 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( -341 )/static_cast< Value >( 164 );
(*this)[4] = static_cast< Value >( 4496 )/static_cast< Value >( 1025 );
(*this)[5] = static_cast< Value >( -301 )/static_cast< Value >( 82 );
(*this)[6] = static_cast< Value >( 2133 )/static_cast< Value >( 4100 );
(*this)[7] = static_cast< Value >( 45 )/static_cast< Value >( 82 );
(*this)[8] = static_cast< Value >( 45 )/static_cast< Value >( 164 );
(*this)[9] = static_cast< Value >( 18 )/static_cast< Value >( 41 );
}
};
template< class Value = double >
struct rk78_coefficients_a11 : boost::array< Value , 11 >
{
rk78_coefficients_a11( void )
{
(*this)[0] = static_cast< Value >( 3 )/static_cast< Value >( 205 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 0 );
(*this)[4] = static_cast< Value >( 0 );
(*this)[5] = static_cast< Value >( -6 )/static_cast< Value >( 41 );
(*this)[6] = static_cast< Value >( -3 )/static_cast< Value >( 205 );
(*this)[7] = static_cast< Value >( -3 )/static_cast< Value >( 41 );
(*this)[8] = static_cast< Value >( 3 )/static_cast< Value >( 41 );
(*this)[9] = static_cast< Value >( 6 )/static_cast< Value >( 41 );
(*this)[10] = static_cast< Value >( 0 );
}
};
template< class Value = double >
struct rk78_coefficients_a12 : boost::array< Value , 12 >
{
rk78_coefficients_a12( void )
{
(*this)[0] = static_cast< Value >( -1777 )/static_cast< Value >( 4100 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( -341 )/static_cast< Value >( 164 );
(*this)[4] = static_cast< Value >( 4496 )/static_cast< Value >( 1025 );
(*this)[5] = static_cast< Value >( -289 )/static_cast< Value >( 82 );
(*this)[6] = static_cast< Value >( 2193 )/static_cast< Value >( 4100 );
(*this)[7] = static_cast< Value >( 51 )/static_cast< Value >( 82 );
(*this)[8] = static_cast< Value >( 33 )/static_cast< Value >( 164 );
(*this)[9] = static_cast< Value >( 12 )/static_cast< Value >( 41 );
(*this)[10] = static_cast< Value >( 0 );
(*this)[11] = static_cast< Value >( 1 );
}
};
template< class Value = double >
struct rk78_coefficients_b : boost::array< Value , 13 >
{
rk78_coefficients_b( void )
{
(*this)[0] = static_cast< Value >( 0 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 0 );
(*this)[4] = static_cast< Value >( 0 );
(*this)[5] = static_cast< Value >( 34 )/static_cast<Value>( 105 );
(*this)[6] = static_cast< Value >( 9 )/static_cast<Value>( 35 );
(*this)[7] = static_cast< Value >( 9 )/static_cast<Value>( 35 );
(*this)[8] = static_cast< Value >( 9 )/static_cast<Value>( 280 );
(*this)[9] = static_cast< Value >( 9 )/static_cast<Value>( 280 );
(*this)[10] = static_cast< Value >( 0 );
(*this)[11] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
(*this)[12] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
}
};
template< class Value = double >
struct rk78_coefficients_db : boost::array< Value , 13 >
{
rk78_coefficients_db( void )
{
(*this)[0] = static_cast< Value >( 0 ) - static_cast< Value >( 41 )/static_cast<Value>( 840 );
(*this)[1] = static_cast< Value >( 0 );
(*this)[2] = static_cast< Value >( 0 );
(*this)[3] = static_cast< Value >( 0 );
(*this)[4] = static_cast< Value >( 0 );
(*this)[5] = static_cast< Value >( 0 );
(*this)[6] = static_cast< Value >( 0 );
(*this)[7] = static_cast< Value >( 0 );
(*this)[8] = static_cast< Value >( 0 );
(*this)[9] = static_cast< Value >( 0 );
(*this)[10] = static_cast< Value >( 0 ) - static_cast< Value >( 41 )/static_cast<Value>( 840 );
(*this)[11] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
(*this)[12] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
}
};
template< class Value = double >
struct rk78_coefficients_c : boost::array< Value , 13 >
{
rk78_coefficients_c( void )
{
(*this)[0] = static_cast< Value >( 0 );
(*this)[1] = static_cast< Value >( 2 )/static_cast< Value >( 27 );
(*this)[2] = static_cast< Value >( 1 )/static_cast< Value >( 9 );
(*this)[3] = static_cast< Value >( 1 )/static_cast<Value>( 6 );
(*this)[4] = static_cast< Value >( 5 )/static_cast<Value>( 12 );
(*this)[5] = static_cast< Value >( 1 )/static_cast<Value>( 2 );
(*this)[6] = static_cast< Value >( 5 )/static_cast<Value>( 6 );
(*this)[7] = static_cast< Value >( 1 )/static_cast<Value>( 6 );
(*this)[8] = static_cast< Value >( 2 )/static_cast<Value>( 3 );
(*this)[9] = static_cast< Value >( 1 )/static_cast<Value>( 3 );
(*this)[10] = static_cast< Value >( 1 );
(*this)[11] = static_cast< Value >( 0 );
(*this)[12] = static_cast< Value >( 1 );
}
};
#endif // DOXYGEN_SKIP
template<
class State ,
class Value = double ,
class Deriv = State ,
class Time = Value ,
class Algebra = typename algebra_dispatcher< State >::algebra_type ,
class Operations = typename operations_dispatcher< State >::operations_type ,
class Resizer = initially_resizer
>
#ifndef DOXYGEN_SKIP
class runge_kutta_fehlberg78 : public explicit_error_generic_rk< 13 , 8 , 8 , 7 , State , Value , Deriv , Time ,
Algebra , Operations , Resizer >
#else
class runge_kutta_fehlberg78 : public explicit_error_generic_rk
#endif
{
public:
#ifndef DOXYGEN_SKIP
typedef explicit_error_generic_rk< 13 , 8 , 8 , 7 , State , Value , Deriv , Time ,
Algebra , Operations , Resizer > stepper_base_type;
#endif
typedef typename stepper_base_type::state_type state_type;
typedef typename stepper_base_type::value_type value_type;
typedef typename stepper_base_type::deriv_type deriv_type;
typedef typename stepper_base_type::time_type time_type;
typedef typename stepper_base_type::algebra_type algebra_type;
typedef typename stepper_base_type::operations_type operations_type;
typedef typename stepper_base_type::resizer_type resizer_type;
#ifndef DOXYGEN_SKIP
typedef typename stepper_base_type::stepper_type stepper_type;
typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
#endif // DOXYGEN_SKIP
runge_kutta_fehlberg78( const algebra_type &algebra = algebra_type() ) : stepper_base_type(
boost::fusion::make_vector( rk78_coefficients_a1<Value>() , rk78_coefficients_a2<Value>() , rk78_coefficients_a3<Value>() ,
rk78_coefficients_a4<Value>() , rk78_coefficients_a5<Value>() , rk78_coefficients_a6<Value>() ,
rk78_coefficients_a7<Value>() , rk78_coefficients_a8<Value>() , rk78_coefficients_a9<Value>() ,
rk78_coefficients_a10<Value>() , rk78_coefficients_a11<Value>() , rk78_coefficients_a12<Value>() ) ,
rk78_coefficients_b<Value>() , rk78_coefficients_db<Value>() , rk78_coefficients_c<Value>() , algebra )
{ }
};
/************* DOXYGEN *************/
/**
* \class runge_kutta_fehlberg78
* \brief The Runge-Kutta Fehlberg 78 method.
*
* The Runge-Kutta Fehlberg 78 method is a standard method for high-precision applications.
* The method is explicit and fulfills the Error Stepper concept. Step size control
* is provided but continuous output is not available for this method.
*
* This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern).
* Furthermore, it derivs from explicit_error_generic_rk which is a generic Runge-Kutta algorithm with error estimation.
* For more details see explicit_error_stepper_base and explicit_error_generic_rk.
*
* \tparam State The state type.
* \tparam Value The value type.
* \tparam Deriv The type representing the time derivative of the state.
* \tparam Time The time representing the independent variable - the time.
* \tparam Algebra The algebra type.
* \tparam Operations The operations type.
* \tparam Resizer The resizer policy type.
*/
/**
* \fn runge_kutta_fehlberg78::runge_kutta_fehlberg78( const algebra_type &algebra )
* \brief Constructs the runge_kutta_cash_fehlberg78 class. This constructor can be used as a default
* constructor if the algebra has a default constructor.
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
*/
}
}
}
#endif //BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED
| {
"pile_set_name": "Github"
} |
package storage
import (
"encoding/json"
"errors"
"time"
"github.com/nghialv/promviz/model"
)
const ChunkLength = 5 * time.Minute
var ErrAddToCompletedChunk = errors.New("Unabled to add a new snapshot into a completed chunk")
type Chunk interface {
ID() int64
SetCompleted(bool)
IsCompleted() bool
Len() int
Clone() Chunk
Add(*model.Snapshot) error
Iterator() ChunkIterator
Marshal() ([]byte, error)
Unmarshal([]byte) error
}
type ChunkIterator interface {
FindBestSnapshot(time.Time) *model.Snapshot
}
type chunk struct {
TimestampID int64 `json:"id"`
SortedSnapshots []*model.Snapshot `json:"snapshots"`
Completed bool `json:"completed"`
}
func NewChunk(id int64) Chunk {
return &chunk{
TimestampID: id,
SortedSnapshots: make([]*model.Snapshot, 0),
}
}
func ChunkID(ts time.Time) int64 {
length := int64(ChunkLength / time.Second)
return (ts.Unix() / length) * length
}
func (c *chunk) ID() int64 {
return c.TimestampID
}
func (c *chunk) SetCompleted(completed bool) {
c.Completed = completed
}
func (c *chunk) IsCompleted() bool {
return c.Completed
}
func (c *chunk) Len() int {
return len(c.SortedSnapshots)
}
func (c *chunk) Clone() Chunk {
nc := NewChunk(c.TimestampID).(*chunk)
for _, ss := range c.SortedSnapshots {
snapshot := &model.Snapshot{}
*snapshot = *ss
nc.SortedSnapshots = append(nc.SortedSnapshots, snapshot)
}
return nc
}
func (c *chunk) Add(snapshot *model.Snapshot) error {
if c.Completed {
return ErrAddToCompletedChunk
}
c.SortedSnapshots = append(c.SortedSnapshots, snapshot)
for i := len(c.SortedSnapshots) - 1; i > 0; i-- {
if c.SortedSnapshots[i].Timestamp.Before(c.SortedSnapshots[i-1].Timestamp) {
tmp := c.SortedSnapshots[i-1]
c.SortedSnapshots[i-1] = c.SortedSnapshots[i]
c.SortedSnapshots[i] = tmp
}
}
return nil
}
func (c *chunk) Iterator() ChunkIterator {
return c
}
func (c *chunk) FindBestSnapshot(ts time.Time) *model.Snapshot {
if len(c.SortedSnapshots) == 0 {
return nil
}
for i := len(c.SortedSnapshots) - 1; i >= 0; i-- {
if ts.After(c.SortedSnapshots[i].Timestamp) {
return c.SortedSnapshots[i]
}
}
// TODO: should returns nil and load pre chunk to get more better one
return c.SortedSnapshots[0]
}
func (c *chunk) Marshal() ([]byte, error) {
return json.Marshal(c)
}
func (c *chunk) Unmarshal(data []byte) error {
return json.Unmarshal(data, c)
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.calendar;
import android.text.format.DateUtils;
import java.util.Calendar;
public final class CalendarData {
static final String[] s24Hours = {format24Hours(0), format24Hours(1), format24Hours(2), format24Hours(3), format24Hours(4), format24Hours(5),
format24Hours(6), format24Hours(7), format24Hours(8), format24Hours(9), format24Hours(10), format24Hours(11), format24Hours(12), format24Hours(13), format24Hours(14), format24Hours(15), format24Hours(16),
format24Hours(17), format24Hours(18), format24Hours(19), format24Hours(20), format24Hours(21), format24Hours(22), format24Hours(23), format24Hours(0) };
private static final String am = DateUtils.getAMPMString(Calendar.AM).toUpperCase();
private static final String pm = DateUtils.getAMPMString(Calendar.PM).toUpperCase();
static final String[] s12Hours = {format12Hours(12, am), format12Hours(1, am), format12Hours(2, am), format12Hours(3, am), format12Hours(4, am),
format12Hours(5, am), format12Hours(6, am), format12Hours(7, am), format12Hours(8, am), format12Hours(9, am), format12Hours(10, am), format12Hours(11, am), format12Hours(12, pm),
format12Hours(1, pm), format12Hours(2, pm), format12Hours(3, pm), format12Hours(4, pm), format12Hours(5, pm), format12Hours(6, pm), format12Hours(7, pm), format12Hours(8, pm),
format12Hours(9, pm), format12Hours(10, pm), format12Hours(11, pm), format12Hours(12, pm) };
public CalendarData() {
}
private static String format12Hours(int hour, String amPm) {
return String.format("%d %s", hour, amPm);
}
private static String format24Hours(int hour) {
return String.format("%02d:%02d", hour, 0);
}
}
| {
"pile_set_name": "Github"
} |
import { keyBy, mapValues, sortBy } from "lodash"
import parseArgs from "minimist"
import fetch from "node-fetch"
import opener from "opener"
import * as timeago from "timeago.js"
import { exec } from "utils/server/serverUtil"
/**
* Retrieves information about the deployed commit on a live or staging server.
* Usage examples:
* - `yarn live-commit` will retrieve information about the deployed commits for _all_ servers, and show a table
* - `yarn live-commit live` will retrieve the commit that's live on https://ourworldindata.org and opens it in GitHub
* That's equivalent to `yarn live-commit live --open`
* - `yarn live-commit staging --show` will `git show` information about the commit deployed on https://staging-owid.netlify.app
* - `yarn live-commit --show --tree` will both show a git tree and a `git show` of the deployed commits on https://ourworldindata.org
*
* Note:
* For the local git commands to work you need to have that commit on your machine. Run a `git fetch` if you're getting a git error message.
* If it still doesn't work, the live commit is not pushed to GitHub yet. That should only happen on a staging server, never on live.
*/
const servers = [
"live",
"staging",
"explorer",
"exemplars",
"hans",
"playfair",
"jefferson",
"nightingale",
"tufte",
"roser",
]
const args = parseArgs(process.argv.slice(2))
const showTree = args["tree"]
const showCommit = args["show"]
const openInBrowser = args["open"] || !(showCommit || showTree)
function getServerUrl(server: string): string {
if (server === "live") return "https://ourworldindata.org"
else return `https://${server}-owid.netlify.com`
}
async function fetchCommitSha(server: string): Promise<string> {
return fetch(`${getServerUrl(server)}/head.txt`)
.then((res) => {
if (res.ok) return res
else throw Error(`Request rejected with status ${res.status}`)
})
.then((resp) => resp.text())
}
interface ServerCommitInformation {
serverName: string
commitSha: string | undefined
commitDate: string | undefined
commitAuthor: string | undefined
commitMessage: string | undefined
}
async function fetchAll(): Promise<Array<ServerCommitInformation>> {
const commits = await Promise.all(
servers.map(async (serverName) => {
let commitSha = undefined
try {
commitSha = await fetchCommitSha(serverName)
} catch {
commitSha = undefined
}
return {
serverName,
commitSha,
commitDate: undefined,
commitAuthor: undefined,
commitMessage: undefined,
}
})
)
const commitsWithInformation = await Promise.all(
commits.map(async (commit) => {
if (!commit.commitSha) return commit
const apiResponse = (await fetch(
`https://api.github.com/repos/owid/owid-grapher/git/commits/${commit.commitSha}`,
{
headers: {
Accept: "application/vnd.github.v3",
},
}
)) as any
const response = await apiResponse.json()
return {
...commit,
commitSha: commit.commitSha.substr(0, 7),
commitDate:
response?.author?.date && new Date(response?.author?.date),
commitAuthor: response?.author?.name,
commitMessage: response?.message?.split("\n")?.[0],
}
})
)
return sortBy(commitsWithInformation, (c) => c.commitDate ?? 0)
.reverse()
.map((commitInformation) => ({
...commitInformation,
commitDate:
commitInformation.commitDate &&
timeago.format(commitInformation.commitDate),
}))
}
if (args._[0]) {
// fetch information for one specific server
const server = args._[0]
fetchCommitSha(server)
.then(async (headSha) => {
if (showTree)
await exec(
`git log -10 --graph --oneline --decorate --color=always ${headSha}`
)
if (showTree && showCommit) console.log()
if (showCommit)
await exec(`git show --stat --color=always ${headSha}`)
if (openInBrowser)
opener(`https://github.com/owid/owid-grapher/commit/${headSha}`)
})
.catch((err) =>
console.error(
`Could not retrieve commit information from ${getServerUrl(
server
)}. ${err}`
)
)
} else {
// fetch information for _all_ servers
fetchAll().then((commitInformation) => {
const data = mapValues(
keyBy(
commitInformation,
(commitInformation) => commitInformation.serverName
),
(commitInformation) => {
const {
commitSha,
commitDate,
commitAuthor,
commitMessage,
} = commitInformation
return {
commitSha,
commitDate,
commitAuthor,
commitMessage:
// truncate to 50 characters
commitMessage && commitMessage.length > 50
? commitMessage?.substr(0, 50) + "…"
: commitMessage,
}
}
)
console.table(data)
})
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2012 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
*/
/**
* Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into
* multiple blocks, each of which is a unit of data and error-correction codewords. Each
* is represented by an instance of this class.
*/
@class ZXDataMatrixVersion;
@interface ZXDataMatrixDataBlock : NSObject
@property (nonatomic, assign, readonly) int numDataCodewords;
@property (nonatomic, strong, readonly) NSMutableArray *codewords;
+ (NSArray *)dataBlocks:(NSArray *)rawCodewords version:(ZXDataMatrixVersion *)version;
@end
| {
"pile_set_name": "Github"
} |
# galican stopwords
a
aínda
alí
aquel
aquela
aquelas
aqueles
aquilo
aquí
ao
aos
as
así
á
ben
cando
che
co
coa
comigo
con
connosco
contigo
convosco
coas
cos
cun
cuns
cunha
cunhas
da
dalgunha
dalgunhas
dalgún
dalgúns
das
de
del
dela
delas
deles
desde
deste
do
dos
dun
duns
dunha
dunhas
e
el
ela
elas
eles
en
era
eran
esa
esas
ese
eses
esta
estar
estaba
está
están
este
estes
estiven
estou
eu
é
facer
foi
foron
fun
había
hai
iso
isto
la
las
lle
lles
lo
los
mais
me
meu
meus
min
miña
miñas
moi
na
nas
neste
nin
no
non
nos
nosa
nosas
noso
nosos
nós
nun
nunha
nuns
nunhas
o
os
ou
ó
ós
para
pero
pode
pois
pola
polas
polo
polos
por
que
se
senón
ser
seu
seus
sexa
sido
sobre
súa
súas
tamén
tan
te
ten
teñen
teño
ter
teu
teus
ti
tido
tiña
tiven
túa
túas
un
unha
unhas
uns
vos
vosa
vosas
voso
vosos
vós
| {
"pile_set_name": "Github"
} |
---
title: "harfbuzz"
layout: formula
---
{{ content }}
| {
"pile_set_name": "Github"
} |
// parallel-for-structure.cpp
// compile with: /EHsc
#include <ppl.h>
#include <array>
#include <sstream>
#include <iostream>
using namespace concurrency;
using namespace std;
int wmain()
{
// Print each value from 1 to 5 in parallel.
parallel_for(1, 6, [](int value) {
wstringstream ss;
ss << value << L' ';
wcout << ss.str();
});
} | {
"pile_set_name": "Github"
} |
%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% Try goal without I/O, cannot fail.
:- module try_syntax_2.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is cc_multi.
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
:- implementation.
:- import_module exception.
:- import_module string.
%---------------------------------------------------------------------------%
:- type action
---> act_succeed
; act_throw.
main(!IO) :-
io.write_string("Should succeed: ", !IO),
run_test(act_succeed, !IO),
io.write_string("Should throw: ", !IO),
run_test(act_throw, !IO).
:- pred run_test(action::in, io::di, io::uo) is cc_multi.
run_test(Action, !IO) :-
Input = input,
( try [] (
Output = Input ++ "-coated",
(
Action = act_succeed
;
Action = act_throw,
throw("up")
)
)
then
X = Output
catch E ->
X = "caught string: " ++ E
catch_any Other ->
X = "caught other type: " ++ string(Other)
),
io.write_string(X, !IO),
io.nl(!IO).
:- func input = string.
:- pragma no_inline(input/0).
input = "sugar".
| {
"pile_set_name": "Github"
} |
@set virtual-grid
{
:root
{
prototype: VGrid;
//background-color:window;
//border:1px solid threedshadow;
flow: horizontal;
}
:root > table
{
width:*;
height:*;
background-color:window;
flow:table-fixed; /* enforce fixed layout on the table
to avoid column width changes
when new rows are pumping up */
overflow-x:auto; /* but x is scrollable */
overflow-y:hidden; /* but x is scrollable */
border-spacing:0;
}
:root > table > tbody
{
width:*;
height:*;
overflow:hidden;
border-spacing:0px;
}
:root > table > thead
{
border-spacing:0;
behavior:column-resizer;
}
:root > table > thead > tr > th
{
width:10%;
min-width:1em;
font:system;
line-height: 1.6em;
white-space:nowrap; overflow-x:hidden; text-overflow:ellipsis; /* ellipsis */
background: url(theme:column-header-normal) stretch;
}
:root > table > thead > tr > th[sortType='ascending']
{
foreground-image:url("stock:arrow-down");
foreground-position-top: 50%;
foreground-position-right: 5px;
foreground-repeat: no-repeat;
}
:root > table > thead > tr > th[sortType='descending']
{
foreground-image:url("stock:arrow-up");
foreground-position-top: 50%;
foreground-position-right: 5px;
foreground-repeat: no-repeat;
}
:root > table > thead > tr > th:hover
{
background-image: url(theme:column-header-hover);
}
:root > table > thead > tr > th:active
{
background-image: url(theme:column-header-pressed);
}
:root > table > tbody > tr > td
{
height: 1.4em;
white-space:nowrap; overflow-x:hidden; text-overflow:ellipsis; /* ellipsis */
border-right: 1px solid threedlight;
padding-left:3px;
font-size: 10pt;
}
:root > table > tbody > tr
{
border-bottom:1px solid threedface;
background-repeat: stretch;
}
:root > table > tbody > tr[hidden]
{
visibility:hidden;
/*border-bottom:transparent;*/
}
:root > table > tbody > tr[beforecurrent]
{
border-bottom:transparent;
}
:root > table > tbody > tr:hover
{
background-image: url(theme:list-view-item-hover);
}
:root > table > tbody > tr:current
{
//border-style:none;
//border-radius:4px;
//background-color: highlight;
//color:highlighttext;
background-image: url(theme:list-view-item-selected);
/*border-bottom:transparent;*/
}
:root > table > tbody > tr:current > td
{
border-right: 1px solid transparent;
}
:root > [type="vscrollbar"]
{
visibility:collapse; /* initially invisible */
}
:root > [type="vscrollbar"][visible]
{
visibility:visible;
}
:root > table > tbody > tr:moving { background-image: url(theme:list-view-item-selected); }
:root > table > tbody > tr:drag-source { background:#eee; }
:root > table > tbody > tr:drag-source > td { visibility:hidden; }
}
| {
"pile_set_name": "Github"
} |
module SportDb
module Service
VERSION = '0.4.2'
end
end
| {
"pile_set_name": "Github"
} |
#!/bin/bash
if [[ $1 ]]; then
cd collector/plugins
if [ ! -d $1 ]; then
mkdir $1
sed "s/example/$1/g;s/Example/${1^}/g" example/example.go > $1/$1.go
sed "s/example/$1/g;s/Example/${1^}/g" example/example_test.go > $1/$1_test.go
else
echo "The plugin exists. Do nothing.";
exit 1;
fi
else
echo "Usage: ./generate_plugin.sh plugin_name";
exit 1;
fi
| {
"pile_set_name": "Github"
} |
; This test ensures that IVUsers works correctly in the legacy pass manager
; without LCSSA and in the specific ways that some of its users (LSR) require.
;
; FIXME: We need some way to match the precision here in the new PM where loop
; passes *always* work on LCSSA. This should stop using a different set of
; checks at that point.
; RUN: opt < %s -analyze -iv-users | FileCheck %s --check-prefixes=CHECK,CHECK-NO-LCSSA
; RUN: opt < %s -disable-output -passes='print<ivusers>' 2>&1 | FileCheck %s
; Provide legal integer types.
target datalayout = "n8:16:32:64"
; The value of %r is dependent on a polynomial iteration expression.
;
; CHECK-LABEL: IV Users for loop %foo.loop
; CHECK-NO-LCSSA: {1,+,3,+,2}<%foo.loop>
define i64 @foo(i64 %n) {
entry:
br label %foo.loop
foo.loop:
%indvar = phi i64 [ 0, %entry ], [ %indvar.next, %foo.loop ]
%indvar.next = add i64 %indvar, 1
%c = icmp eq i64 %indvar.next, %n
br i1 %c, label %exit, label %foo.loop
exit:
%r = mul i64 %indvar.next, %indvar.next
ret i64 %r
}
; PR15470: LSR miscompile. The test1 function should return '1'.
; It is valid to fold SCEVUnknown into the recurrence because it
; was defined before the loop.
;
; SCEV does not know how to denormalize chained recurrences, so make
; sure they aren't marked as post-inc users.
;
; CHECK-LABEL: IV Users for loop %test1.loop
; CHECK-NO-LCSSA: %sext.us = {0,+,(16777216 + (-16777216 * %sub.us))<nuw><nsw>,+,33554432}<%test1.loop> (post-inc with loop %test1.loop) in %f = ashr i32 %sext.us, 24
define i32 @test1(i1 %cond) {
entry:
%sub.us = select i1 %cond, i32 0, i32 0
br label %test1.loop
test1.loop:
%inc1115.us = phi i32 [ 0, %entry ], [ %inc11.us, %test1.loop ]
%inc11.us = add nsw i32 %inc1115.us, 1
%cmp.us = icmp slt i32 %inc11.us, 2
br i1 %cmp.us, label %test1.loop, label %for.end
for.end:
%tobool.us = icmp eq i32 %inc1115.us, 0
%mul.us = shl i32 %inc1115.us, 24
%sub.cond.us = sub nsw i32 %inc1115.us, %sub.us
%sext.us = mul i32 %mul.us, %sub.cond.us
%f = ashr i32 %sext.us, 24
br label %exit
exit:
ret i32 %f
}
; PR15470: LSR miscompile. The test2 function should return '1'.
; It is illegal to fold SCEVUnknown (sext.us) into the recurrence
; because it is defined after the loop where this recurrence belongs.
;
; SCEV does not know how to denormalize chained recurrences, so make
; sure they aren't marked as post-inc users.
;
; CHECK-LABEL: IV Users for loop %test2.loop
; CHECK-NO-LCSSA: %sub.cond.us = ((-1 * %sub.us)<nuw><nsw> + {0,+,1}<nuw><nsw><%test2.loop>) (post-inc with loop %test2.loop) in %sext.us = mul i32 %mul.us, %sub.cond.us
define i32 @test2() {
entry:
br label %test2.loop
test2.loop:
%inc1115.us = phi i32 [ 0, %entry ], [ %inc11.us, %test2.loop ]
%inc11.us = add nsw i32 %inc1115.us, 1
%cmp.us = icmp slt i32 %inc11.us, 2
br i1 %cmp.us, label %test2.loop, label %for.end
for.end:
%tobool.us = icmp eq i32 %inc1115.us, 0
%sub.us = select i1 %tobool.us, i32 0, i32 0
%mul.us = shl i32 %inc1115.us, 24
%sub.cond.us = sub nsw i32 %inc1115.us, %sub.us
%sext.us = mul i32 %mul.us, %sub.cond.us
%f = ashr i32 %sext.us, 24
br label %exit
exit:
ret i32 %f
}
| {
"pile_set_name": "Github"
} |
var parent = require('../../es/object/define-properties');
module.exports = parent;
| {
"pile_set_name": "Github"
} |
{
"citation": "@ONLINE {wikidump,\n author = \"Wikimedia Foundation\",\n title = \"Wikimedia Downloads\",\n url = \"https://dumps.wikimedia.org\"\n}",
"description": "Wikipedia dataset containing cleaned articles of all languages.\nThe datasets are built from the Wikipedia dump\n(https://dumps.wikimedia.org/) with one split per language. Each example\ncontains the content of one full Wikipedia article with cleaning to strip\nmarkdown and unwanted sections (references, etc.).",
"downloadSize": "52842522",
"location": {
"urls": [
"https://dumps.wikimedia.org"
]
},
"name": "wikipedia",
"redistributionInfo": {
"license": "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA."
},
"splits": [
{
"name": "train",
"numBytes": "75580750",
"numShards": "1",
"shardLengths": [
"77940"
]
}
],
"version": "1.0.0"
} | {
"pile_set_name": "Github"
} |
export interface IRectangle {
x?: number;
y?: number;
width?: number;
height?: number;
}
export interface IMonitorInfo {
id: number;
bounds?: IRectangle;
isPrimary?: boolean;
workArea?: IRectangle;
}
| {
"pile_set_name": "Github"
} |
#pragma once
#ifndef STYLEINDEXLINEEDIT_H
#define STYLEINDEXLINEEDIT_H
#include "tcommon.h"
#include "toonzqt/lineedit.h"
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
// forward declaration
class TPaletteHandle;
//=============================================================================
namespace DVGui {
class DVAPI StyleIndexLineEdit : public LineEdit {
Q_OBJECT
TPaletteHandle *m_pltHandle;
public:
StyleIndexLineEdit();
~StyleIndexLineEdit();
void setPaletteHandle(TPaletteHandle *pltHandle) { m_pltHandle = pltHandle; }
TPaletteHandle *getPaletteHandle() { return m_pltHandle; }
protected:
void paintEvent(QPaintEvent *pe) override;
};
} // namspace
#endif
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
GL_ARB_arrays_of_arrays
http://www.opengl.org/registry/specs/ARB/arrays_of_arrays.txt
GL_ARB_arrays_of_arrays
| {
"pile_set_name": "Github"
} |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_customer
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Odoo 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-21 14:08+0000\n"
"PO-Revision-Date: 2015-07-17 08:16+0000\n"
"Last-Translator: Martin Trigaux\n"
"Language-Team: Spanish (Venezuela) (http://www.transifex.com/odoo/odoo-8/language/es_VE/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_VE\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: website_customer
#: code:addons/website_customer/controllers/main.py:55
#, python-format
msgid "All Countries"
msgstr ""
#. module: website_customer
#: view:website:website_customer.implemented_by_block
msgid "Implemented By"
msgstr ""
#. module: website_customer
#: view:website:website_customer.index
msgid "No result found"
msgstr ""
#. module: website_customer
#: view:website:website.layout view:website:website_customer.details
#: view:website:website_customer.index
msgid "Our References"
msgstr ""
#. module: website_customer
#: view:website:website_customer.references_block
msgid "References"
msgstr "Referencias"
#. module: website_customer
#: view:website:website_customer.index
msgid "References by Country"
msgstr ""
#. module: website_customer
#: view:website:website_customer.index
msgid "Search"
msgstr "Buscar"
#. module: website_customer
#: view:website:website_customer.index
msgid "Trusted by millions worldwide"
msgstr ""
#. module: website_customer
#: view:website:website_customer.index
msgid "World Map"
msgstr ""
#. module: website_customer
#: view:website:website_customer.implemented_by_block
msgid "reference(s))"
msgstr ""
| {
"pile_set_name": "Github"
} |
package git
import (
"bytes"
"fmt"
"path/filepath"
)
// Status represents the current status of a Worktree.
// The key of the map is the path of the file.
type Status map[string]*FileStatus
// File returns the FileStatus for a given path, if the FileStatus doesn't
// exists a new FileStatus is added to the map using the path as key.
func (s Status) File(path string) *FileStatus {
if _, ok := (s)[path]; !ok {
s[path] = &FileStatus{Worktree: Untracked, Staging: Untracked}
}
return s[path]
}
// IsUntracked checks if file for given path is 'Untracked'
func (s Status) IsUntracked(path string) bool {
stat, ok := (s)[filepath.ToSlash(path)]
return ok && stat.Worktree == Untracked
}
// IsClean returns true if all the files are in Unmodified status.
func (s Status) IsClean() bool {
for _, status := range s {
if status.Worktree != Unmodified || status.Staging != Unmodified {
return false
}
}
return true
}
func (s Status) String() string {
buf := bytes.NewBuffer(nil)
for path, status := range s {
if status.Staging == Unmodified && status.Worktree == Unmodified {
continue
}
if status.Staging == Renamed {
path = fmt.Sprintf("%s -> %s", path, status.Extra)
}
fmt.Fprintf(buf, "%c%c %s\n", status.Staging, status.Worktree, path)
}
return buf.String()
}
// FileStatus contains the status of a file in the worktree
type FileStatus struct {
// Staging is the status of a file in the staging area
Staging StatusCode
// Worktree is the status of a file in the worktree
Worktree StatusCode
// Extra contains extra information, such as the previous name in a rename
Extra string
}
// StatusCode status code of a file in the Worktree
type StatusCode byte
const (
Unmodified StatusCode = ' '
Untracked StatusCode = '?'
Modified StatusCode = 'M'
Added StatusCode = 'A'
Deleted StatusCode = 'D'
Renamed StatusCode = 'R'
Copied StatusCode = 'C'
UpdatedButUnmerged StatusCode = 'U'
)
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016 Red Hat, Inc.
* <p>
* Red Hat licenses this file to you under the Apache License, version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
*/
package io.fabric8.funktion.agent;
import io.fabric8.funktion.model.DtoSupport;
/**
*/
public class SubscribeResponse extends DtoSupport {
private final String namespace;
private final String name;
public SubscribeResponse(String namespace, String name) {
this.namespace = namespace;
this.name = name;
}
@Override
public String toString() {
return "CreateFlowResponse{" +
"namespace='" + namespace + '\'' +
", name='" + name + '\'' +
'}';
}
public String getNamespace() {
return namespace;
}
public String getName() {
return name;
}
}
| {
"pile_set_name": "Github"
} |
package com.bugvm.bouncycastle.crypto.params;
import java.security.SecureRandom;
public class DSAParameterGenerationParameters
{
public static final int DIGITAL_SIGNATURE_USAGE = 1;
public static final int KEY_ESTABLISHMENT_USAGE = 2;
private final int l;
private final int n;
private final int usageIndex;
private final int certainty;
private final SecureRandom random;
/**
* Construct without a usage index, this will do a random construction of G.
*
* @param L desired length of prime P in bits (the effective key size).
* @param N desired length of prime Q in bits.
* @param certainty certainty level for prime number generation.
* @param random the source of randomness to use.
*/
public DSAParameterGenerationParameters(
int L,
int N,
int certainty,
SecureRandom random)
{
this(L, N, certainty, random, -1);
}
/**
* Construct for a specific usage index - this has the effect of using verifiable canonical generation of G.
*
* @param L desired length of prime P in bits (the effective key size).
* @param N desired length of prime Q in bits.
* @param certainty certainty level for prime number generation.
* @param random the source of randomness to use.
* @param usageIndex a valid usage index.
*/
public DSAParameterGenerationParameters(
int L,
int N,
int certainty,
SecureRandom random,
int usageIndex)
{
this.l = L;
this.n = N;
this.certainty = certainty;
this.usageIndex = usageIndex;
this.random = random;
}
public int getL()
{
return l;
}
public int getN()
{
return n;
}
public int getCertainty()
{
return certainty;
}
public SecureRandom getRandom()
{
return random;
}
public int getUsageIndex()
{
return usageIndex;
}
}
| {
"pile_set_name": "Github"
} |
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2014-2015 Marc Coll
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_EDIT_GP_SCREEN_HPP
#define HEADER_EDIT_GP_SCREEN_HPP
#include "guiengine/screen.hpp"
#include "guiengine/widgets/list_widget.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
#include <vector>
namespace GUIEngine { class Widget; }
namespace irr { namespace gui { class STKModifiedSpriteBank; } }
class GrandPrixData;
/**
* \brief screen where the user can edit a grand prix
* \ingroup states_screens
*/
class EditGPScreen :
public GUIEngine::Screen,
public GUIEngine::ScreenSingleton<EditGPScreen>,
public MessageDialog::IConfirmDialogListener
{
friend class GUIEngine::ScreenSingleton<EditGPScreen>;
EditGPScreen();
void onConfirm() OVERRIDE;
void onCancel() OVERRIDE;
void loadList(const int selected);
void setModified(const bool modified);
void setSelected(const int selected);
void edit();
bool save();
void back();
bool canMoveUp() const;
bool canMoveDown() const;
void enableButtons();
GrandPrixData* m_gp;
GUIEngine::ListWidget* m_list;
irr::gui::STKModifiedSpriteBank* m_icon_bank;
std::vector<int> m_icons;
int m_selected;
bool m_modified;
std::string m_action;
public:
~EditGPScreen();
void setSelectedGP(GrandPrixData* gp);
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID) OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void beforeAddingWidget() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void init() OVERRIDE;
};
#endif
| {
"pile_set_name": "Github"
} |
/* switchbin
* Copyright (C) 2016 Carlos Rafael Giani
*
* gstswitchbin.h: Header for GstSwitchBin object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef GSTSWITCHBIN_H___
#define GSTSWITCHBIN_H___
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct _GstSwitchBin GstSwitchBin;
typedef struct _GstSwitchBinClass GstSwitchBinClass;
typedef struct _GstSwitchBinPath GstSwitchBinPath;
#define GST_TYPE_SWITCH_BIN (gst_switch_bin_get_type())
#define GST_SWITCH_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_SWITCH_BIN, GstSwitchBin))
#define GST_SWITCH_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SWITCH_BIN, GstSwitchBinClass))
#define GST_SWITCH_BIN_CAST(obj) ((GstSwitchBin *)(obj))
#define GST_IS_SWITCH_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SWITCH_BIN))
#define GST_IS_SWITCH_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SWITCH_BIN))
struct _GstSwitchBin
{
GstBin parent;
GMutex path_mutex;
GstSwitchBinPath **paths;
GstSwitchBinPath *current_path;
gboolean path_changed;
guint num_paths;
GstElement *input_identity;
GstEvent *last_stream_start;
GstPad *sinkpad, *srcpad;
gulong blocking_probe_id, drop_probe_id;
GstCaps *last_caps;
};
struct _GstSwitchBinClass
{
GstBinClass parent_class;
};
struct _GstSwitchBinPath
{
GstObject parent;
GstElement *element;
GstCaps *caps;
GstSwitchBin *bin;
};
GType gst_switch_bin_get_type(void);
GType gst_switch_bin_path_get_type(void);
G_END_DECLS
#endif
| {
"pile_set_name": "Github"
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.opensplice.dds.examples.Durability.java5</groupId>
<artifactId>examples.Durability.java5</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>org.opensplice.dds.examples.Durability.java5</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.opensplice.dds.examples.Durability</groupId>
<artifactId>examples.Durability</artifactId>
<version>1.0</version>
</parent>
<modules>
<module>pub</module>
<module>sub</module>
</modules>
</project>
| {
"pile_set_name": "Github"
} |
void bar() {}
| {
"pile_set_name": "Github"
} |
build/SDL_x11events.lo: src/video/x11/SDL_x11events.c \
include/SDL_config.h include/SDL_platform.h include/begin_code.h \
include/close_code.h src/video/x11/SDL_x11video.h include/SDL_keycode.h \
include/SDL_stdinc.h include/SDL_config.h include/SDL_scancode.h \
src/video/x11/../SDL_sysvideo.h include/SDL_messagebox.h \
include/SDL_video.h include/SDL_pixels.h include/SDL_rect.h \
include/SDL_error.h include/SDL_rwops.h include/SDL_surface.h \
include/SDL_blendmode.h include/SDL_shape.h \
/usr/include/dbus-1.0/dbus/dbus.h \
/usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus/dbus-arch-deps.h \
/usr/include/dbus-1.0/dbus/dbus-macros.h \
/usr/include/dbus-1.0/dbus/dbus-address.h \
/usr/include/dbus-1.0/dbus/dbus-types.h \
/usr/include/dbus-1.0/dbus/dbus-errors.h \
/usr/include/dbus-1.0/dbus/dbus-protocol.h \
/usr/include/dbus-1.0/dbus/dbus-bus.h \
/usr/include/dbus-1.0/dbus/dbus-connection.h \
/usr/include/dbus-1.0/dbus/dbus-memory.h \
/usr/include/dbus-1.0/dbus/dbus-message.h \
/usr/include/dbus-1.0/dbus/dbus-shared.h \
/usr/include/dbus-1.0/dbus/dbus-misc.h \
/usr/include/dbus-1.0/dbus/dbus-pending-call.h \
/usr/include/dbus-1.0/dbus/dbus-server.h \
/usr/include/dbus-1.0/dbus/dbus-signature.h \
/usr/include/dbus-1.0/dbus/dbus-threads.h src/video/x11/SDL_x11dyn.h \
src/video/x11/SDL_x11sym.h src/video/x11/SDL_x11clipboard.h \
src/video/x11/SDL_x11events.h src/video/x11/SDL_x11keyboard.h \
src/video/x11/SDL_x11modes.h src/video/x11/SDL_x11mouse.h \
src/video/x11/SDL_x11opengl.h include/SDL_opengl.h \
src/video/x11/SDL_x11window.h src/video/x11/SDL_x11touch.h \
src/video/x11/SDL_x11xinput2.h src/video/x11/../../events/SDL_events_c.h \
include/SDL_events.h include/SDL_keyboard.h include/SDL_keycode.h \
include/SDL_mouse.h include/SDL_joystick.h include/SDL_gamecontroller.h \
include/SDL_quit.h include/SDL_gesture.h include/SDL_touch.h \
include/SDL_thread.h include/SDL_mutex.h \
src/video/x11/../../events/SDL_clipboardevents_c.h \
src/video/x11/../../events/SDL_dropevents_c.h \
src/video/x11/../../events/SDL_gesture_c.h \
src/video/x11/../../events/SDL_keyboard_c.h \
src/video/x11/../../events/SDL_mouse_c.h include/SDL_mouse.h \
src/video/x11/../../events/SDL_touch_c.h \
src/video/x11/../../events/../../include/SDL_touch.h \
src/video/x11/../../events/SDL_windowevents_c.h \
src/video/x11/../../events/SDL_mouse_c.h \
src/video/x11/../../events/SDL_touch_c.h include/SDL_timer.h \
include/SDL_syswm.h include/SDL_version.h
| {
"pile_set_name": "Github"
} |
// Package gc provides the Torus interface for how garbage collection is implemented.
// Volumes implement a garbage collector and the controller in this package runs
// them.
package gc
import (
"github.com/alternative-storage/torus"
"github.com/alternative-storage/torus/models"
"github.com/coreos/pkg/capnslog"
"golang.org/x/net/context"
)
var clog = capnslog.NewPackageLogger("github.com/alternative-storage/torus", "gc")
type controller struct {
gcs []GC
}
type GC interface {
PrepVolume(*models.Volume) error
IsDead(torus.BlockRef) bool
Clear()
}
type INodeFetcher interface {
GetINode(context.Context, torus.INodeRef) (*models.INode, error)
}
func NewGCController(srv *torus.Server, inodes INodeFetcher) GC {
var gcs []GC
for k, v := range gcFuncs {
clog.Debugf("creating %s gc", k)
gc, err := v(srv, inodes)
if err != nil {
clog.Errorf("cannot create gc %s: %v", k, err)
continue
}
gcs = append(gcs, gc)
}
return &controller{
gcs: gcs,
}
}
func (c *controller) PrepVolume(vol *models.Volume) error {
n := 0
for _, x := range c.gcs {
n++
err := x.PrepVolume(vol)
if err != nil {
return err
}
}
return nil
}
func (c *controller) IsDead(ref torus.BlockRef) bool {
for _, x := range c.gcs {
if x.IsDead(ref) {
return true
}
}
return false
}
func (c *controller) Clear() {
for _, x := range c.gcs {
x.Clear()
}
}
type CreateGCFunc func(srv *torus.Server, inodes INodeFetcher) (GC, error)
var gcFuncs map[string]CreateGCFunc
func RegisterGC(name string, newFunc CreateGCFunc) {
if gcFuncs == nil {
gcFuncs = make(map[string]CreateGCFunc)
}
if _, ok := gcFuncs[name]; ok {
panic("gc: attempted to register GC " + name + " twice")
}
gcFuncs[name] = newFunc
}
| {
"pile_set_name": "Github"
} |
{
"name": "dom-serializer",
"version": "0.1.0",
"description": "render dom nodes to string",
"author": "Felix Boehm <[email protected]>",
"keywords": [
"html",
"xml",
"render"
],
"repository": {
"type": "git",
"url": "git://github.com/cheeriojs/dom-renderer.git"
},
"main": "./index.js",
"files": [
"index.js"
],
"dependencies": {
"domelementtype": "~1.1.1",
"entities": "~1.1.1"
},
"devDependencies": {
"cheerio": "*",
"expect.js": "~0.3.1",
"jshint": "~2.3.0",
"lodash": "~2.4.1",
"mocha": "*",
"xyz": "0.4.x"
},
"scripts": {
"test": "mocha test.js"
},
"license": "MIT"
}
| {
"pile_set_name": "Github"
} |
Joining a web development community can be a challenge within itself, especially when all the resources you visit assume you're familiar with other technologies that you're not familiar with.
Our goal is to help you avoid that mess and come up to speed as fast as possible; you can consider us your internet friend.
## CDN
Content Delivery Network
This is typically a paid service you can use to get great performance for your app. Many CDNs act as caching proxies to your origin server; some require you to upload your assets to them. They give you a URL for each resource in your app. This URL will resolve differently for folks depending on where they're browsing.
Behind the scenes, the CDN will distribute your content geographically with the goal of end-users being able to fetch your content with the lowest latency possible. For example, if a user is in India, they'd likely get content served from India faster than from the United States.
## CoffeeScript, TypeScript
These are both languages that compile to JavaScript. You're able to write your code using the syntax they offer and when ready you compile your TypeScript or CoffeeScript into JavaScript.
[CoffeeScript vs TypeScript](http://www.stoutsystems.com/articles/coffeescript-versus-typescript/)
## Evergreen browsers
Browsers that update themselves (without user intervention).
[Evergreen Browsers](http://tomdale.net/2013/05/evergreen-browsers/)
## ES3, ES5, ES5.1, ES6 (aka ES2015), etc
ES stands for ECMAScript, which is the specification that JavaScript is based on. The number that follows is the version of the specification.
Most browsers support at least ES5, and some even have ES6 (also known as ES2015) support. You can check each browser's support (including yours) here:
* [ES5 support](http://kangax.github.io/compat-table/es5/)
* [ES6 support](http://kangax.github.io/compat-table/es6/)
[ECMAScript](https://en.wikipedia.org/wiki/ECMAScript)
## LESS, Sass
Both LESS and Sass are types of CSS preprocessor markup intended to give you much more control over your CSS. During the build process, the LESS or Sass resources compile down to vanilla CSS (which can be executed in a browser).
[Sass/Less Comparison](https://gist.github.com/chriseppstein/674726)
## Linter, linting, jslint, jshint
A validation tool which checks for common issues in your JavaScript. You'd usually use this in your build process to enforce quality in your codebase. A great example of something to check for: *making sure you've always got your semicolons*.
[An example of some of the options you can configure](http://jshint.com/docs/options/)
## Polyfill
This is a concept that typically means providing JavaScript which tests for features that are missing (prototypes not defined, etc) and "fills" them by providing an implementation.
## Promise
Asynchronous calls typically return a promise (or deferred). This is an object which has a state: it can be given handlers for when it's fulfilled or rejected.
Ember makes use of these in places like the model hook for a route. Until the promise resolves, Ember is able to put the route into a "loading" state.
* [An open standard for sound, interoperable JavaScript promises](https://promisesaplus.com/)
* [emberjs.com - A word on promises](http://emberjs.com/guides/routing/asynchronous-routing/#toc_a-word-on-promises)
## SSR
Server Side Rendering
[Inside FastBoot: The Road to Server-Side Rendering](http://emberjs.com/blog/2014/12/22/inside-fastboot-the-road-to-server-side-rendering.html)
## Transpile
When related to JavaScript, this can be part of your build process which "transpiles" (converts) your ES6 syntax JavaScript to JavaScript that is supported by current browsers.
Besides ES6, you'll see a lot of content about compiling/transpiling CoffeeScript, a short-hand language which can "compile" to JavaScript.
* Ember CLI specifically uses [Babel](https://babeljs.io/) via the [ember-cli-babel](https://github.com/babel/ember-cli-babel) plugin.
## Shadow DOM
Not to be confused with Virtual DOM. Shadow DOM is still a work in progress, but basically a proposed way to have an "isolated" DOM encapsulated within your app's DOM.
Creating a re-usable "widget" or control might be a good use-case for this. Browsers implement some of their controls using their own version of a shadow DOM.
* [W3C Working Draft](http://www.w3.org/TR/shadow-dom/)
* [What the Heck is Shadow DOM?](http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/)
## Virtual DOM
Not to be confused with Shadow DOM. The concept of a virtual DOM means abstracting your code (or in our case, Ember) away from using the browser's DOM in favor of a "virtual" DOM that can easily be accessed for read/writes or even serialized.
| {
"pile_set_name": "Github"
} |
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef CHECKDOCUMENT_H
#define CHECKDOCUMENT_H
#include <QMap>
#include <QPair>
#include <QPointer>
#include <QString>
class QEvent;
class QHBoxLayout;
class QLabel;
class QPushButton;
class QTreeWidget;
class QTreeWidgetItem;
class QVBoxLayout;
#include "scribusapi.h"
#include "pageitem.h"
#include "scribusstructs.h"
#include "ui/scrpalettebase.h"
class QComboBox;
class ScribusDoc;
class ScPage;
/*! \brief Preflight Verifier GUI (P.V.)
A tool to check document for errors (in P.V. profiles)
which can be set up in Preferences dialog.
*/
class SCRIBUS_API CheckDocument : public ScrPaletteBase
{
Q_OBJECT
public:
CheckDocument( QWidget* parent, bool modal );
~CheckDocument() {};
virtual void changeEvent(QEvent *e);
void setDoc(ScribusDoc *doc);
/*! \brief State of the P.V. */
enum CheckMode { checkNULL, checkPDF, checkEPS, checkPrint, checkPrintPreview, checkOutputPreviewPDF, checkOutputPreviewPS };
/*! \brief Clean the list view tree and reset the P.V. attributes. */
void clearErrorList();
/*! \brief Get all possible errors for given document.
It walks through all errors filled in DocumentChecker::checkDocument()
to create a tree structure of error items:
- some item e.g. page
- - page item - its error if there is only one error
- - another item
- - - error 1
- - - warning X etc.
- another item...
\param doc a reference to the ScribusDoc */
void buildErrorList(ScribusDoc *doc);
/*! \brief Enable/disable "ignore" button and noButton property
\param state true to enable the button */
void setIgnoreEnabled(bool state);
/*! \brief Get the state of the "ignore" button
\retval true on button is visible */
bool isIgnoreEnabled();
//! \brief Current state of P.V.
CheckMode checkMode;
/*! \brief Best checker profile best suited for current check mode
(PDF, EPS, PS, ...)
*/
QString bestCheckerProfileForCheckMode(const QString& defaultProfile);
/*! \brief Best checker profile best suited for specific check mode
*/
QString bestCheckerProfileForCheckMode(CheckMode mode, const QString& defaultProfile);
public slots:
/*! \brief Called when is selected a new item in error list.
\param ite and item */
void slotSelect(QTreeWidgetItem* ite);
/*!\brief Do a manual rechecking. */
void doReScan();
/*! \brief Process error checking itself.
\param name a QString with P.V. profile name */
void newScan(const QString& name);
signals:
//void rescan();
//! \brief Signal emitted when user selects any page item in error list.
void selectElement(PageItem *, bool, int);
void selectElementByItem(PageItem *, bool);
//! \brief Signal emitted when user selects any page in error list.
void selectPage(int);
//! \brief Signal emitted when user selects any master page in error list.
void selectMasterPage(QString);
//! \brief Signal emitted when user selects any master page item in error list.
void selectMasterPageElement(QString, int);
//void selectNormal();
//! \brief Signal emitted when user press the "ignore errors" button.
void ignoreAllErrors();
protected slots:
void iconSetChange();
void languageChange();
protected:
QVBoxLayout* checkDocumentLayout;
QHBoxLayout* layout1;
QHBoxLayout* layout2;
//! \brief Mappping Page Item - item nr.
QMap<QTreeWidgetItem*, QPointer<PageItem> > itemMap;
//! \brief Mappping Page - page nr.
QMap<QTreeWidgetItem*, ScPage*> pageMap;
//! \brief Mappping Master Page - MP nr.
QMap<QTreeWidgetItem*, ScPage*> masterPageMap;
//! \brief Mappping MP Item - MP item nr.
QMap<QTreeWidgetItem*, QPointer<PageItem> > masterPageItemMap;
//! \brief Mappping Page Item - cursor position in item
QMap<QTreeWidgetItem*, int> posMap;
//! \brief a reference to the current document
ScribusDoc* m_Doc {nullptr};
//! \brief Icon for fatal error
QPixmap graveError;
//! \brief Icon for warning
QPixmap onlyWarning;
//! \brief Icon for OK
QPixmap noErrors;
//! \brief enum for warning strings for common texts in GUI dialog tree
enum {
PV_ANNOTATION,
PV_APPLIED_MASTER_DIFF_SIDE,
PV_EMPTY_IMAGE_FRAME,
PV_EMPTY_TEXT_FRAME,
PV_FONT_NOT_EMBEDDED,
PV_HIGH_DPI,
PV_IMAGE_FRAME_PART_FILLED,
PV_IS_GIF,
PV_LOW_DPI,
PV_MISSING_GLYPH,
PV_MISSING_IMAGE,
PV_NON_ON_PAGE,
PV_NOT_CMYK_SPOT,
PV_RASTER_PDF,
PV_TEXT_OVERFLOW,
PV_TRANSPARENCY,
PV_WRONG_FONT,
PV_LAYER_TRANSPARENCY,
PV_LAYER_BLENDMODE,
PV_LAYER_PRINTVIS_MISMATCH
};
//! \brief Strings for common texts in GUI dialog tree
QMap<int, QPair<QString, QString> > warnMap;
//! \brief Flag if is ignore button shown. true = hidden, false = shown.
bool noButton;
QComboBox* curCheckProfile;
QLabel* textLabel1;
QTreeWidget* reportDisplay;
QPushButton* ignoreErrors;
QPushButton* reScan;
// bool globalGraveError;
bool pageGraveError {false};
bool itemError {false};
bool showPagesWithoutErrors;
bool showNonPrintingLayerErrors;
int minResDPI {0};
int maxResDPI {0};
/*! \brief Create content of QTreeWidgetItem based on error type
and pageItem state.
\param item a reference to current QTreeWidgetItem to fill the data
\param errorType type of PreflightError value. There is one big switch/case.
\param pageItem data for item are taken here.
Available columns of item:
1) items' group or item name
2) detailed problem text
3) membersip in layer
4) beginning of the text (textframes) or image path (imageframe) (removed)
*/
void buildItem(QTreeWidgetItem * item,
PreflightError errorType,
PageItem * pageItem);
};
#endif // CHECKDOCUMENT_H
| {
"pile_set_name": "Github"
} |
/* this file is generated by RelaxNGCC */
package com.sun.xml.xsom.impl.parser.state;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.Attributes;
import com.sun.xml.xsom.impl.parser.NGCCRuntimeEx;
import com.sun.xml.xsom.*;
import com.sun.xml.xsom.parser.*;
import com.sun.xml.xsom.impl.*;
import com.sun.xml.xsom.impl.parser.*;
import org.xml.sax.Locator;
import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.*;
import java.util.*;
class xpath extends NGCCHandler {
private String xpath;
private ForeignAttributesImpl fa;
private AnnotationImpl ann;
protected final NGCCRuntimeEx $runtime;
private int $_ngcc_current_state;
protected String $uri;
protected String $localName;
protected String $qname;
public final NGCCRuntime getRuntime() {
return($runtime);
}
public xpath(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
super(source, parent, cookie);
$runtime = runtime;
$_ngcc_current_state = 6;
}
public xpath(NGCCRuntimeEx runtime) {
this(null, runtime, runtime, -1);
}
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 1:
{
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
NGCCHandler h = new annotation(this, super._source, $runtime, 164, null,AnnotationContext.XPATH);
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
}
else {
$_ngcc_current_state = 0;
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
}
}
break;
case 5:
{
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
$runtime.consumeAttribute($ai);
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
}
else {
unexpectedEnterElement($__qname);
}
}
break;
case 0:
{
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
}
break;
case 6:
{
if((($ai = $runtime.getAttributeIndex("","xpath"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) {
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 169, null);
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
}
else {
unexpectedEnterElement($__qname);
}
}
break;
default:
{
unexpectedEnterElement($__qname);
}
break;
}
}
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 1:
{
$_ngcc_current_state = 0;
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
}
break;
case 5:
{
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
$runtime.consumeAttribute($ai);
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
}
else {
unexpectedLeaveElement($__qname);
}
}
break;
case 0:
{
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
}
break;
case 6:
{
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 169, null);
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
}
else {
unexpectedLeaveElement($__qname);
}
}
break;
default:
{
unexpectedLeaveElement($__qname);
}
break;
}
}
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 1:
{
$_ngcc_current_state = 0;
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
case 5:
{
if(($__uri.equals("") && $__local.equals("xpath"))) {
$_ngcc_current_state = 4;
}
else {
unexpectedEnterAttribute($__qname);
}
}
break;
case 0:
{
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
}
break;
case 6:
{
if(($__uri.equals("") && $__local.equals("xpath"))) {
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 169, null);
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
}
else {
unexpectedEnterAttribute($__qname);
}
}
break;
default:
{
unexpectedEnterAttribute($__qname);
}
break;
}
}
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 1:
{
$_ngcc_current_state = 0;
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
case 0:
{
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
}
break;
case 3:
{
if(($__uri.equals("") && $__local.equals("xpath"))) {
$_ngcc_current_state = 1;
}
else {
unexpectedLeaveAttribute($__qname);
}
}
break;
default:
{
unexpectedLeaveAttribute($__qname);
}
break;
}
}
public void text(String $value) throws SAXException {
int $ai;
switch($_ngcc_current_state) {
case 1:
{
$_ngcc_current_state = 0;
$runtime.sendText(super._cookie, $value);
}
break;
case 4:
{
xpath = $value;
$_ngcc_current_state = 3;
}
break;
case 5:
{
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
$runtime.consumeAttribute($ai);
$runtime.sendText(super._cookie, $value);
}
}
break;
case 0:
{
revertToParentFromText(makeResult(), super._cookie, $value);
}
break;
case 6:
{
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 169, null);
spawnChildFromText(h, $value);
}
}
break;
}
}
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
switch($__cookie__) {
case 164:
{
ann = ((AnnotationImpl)$__result__);
$_ngcc_current_state = 0;
}
break;
case 169:
{
fa = ((ForeignAttributesImpl)$__result__);
$_ngcc_current_state = 5;
}
break;
}
}
public boolean accepted() {
return((($_ngcc_current_state == 0) || ($_ngcc_current_state == 1)));
}
private XPathImpl makeResult() {
return new XPathImpl($runtime.document,ann,$runtime.copyLocator(),fa,
$runtime.createXmlString(xpath));
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="groups_6.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
createResults();
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/**
* External dependencies
*/
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import page from 'page';
import { connect } from 'react-redux';
import classNames from 'classnames';
import { localize } from 'i18n-calypso';
import { get, isUndefined } from 'lodash';
import Gridicon from 'components/gridicon';
/**
* Internal dependencies
*/
import Count from 'components/count';
import { Dialog } from '@automattic/components';
import EllipsisMenu from 'components/ellipsis-menu';
import PopoverMenuItem from 'components/popover/menu-item';
import PopoverMenuSeparator from 'components/popover/menu-separator';
import Tooltip from 'components/tooltip';
import { getSelectedSiteId } from 'state/ui/selectors';
import { getSiteSettings } from 'state/site-settings/selectors';
import { getSite } from 'state/sites/selectors';
import { decodeEntities } from 'lib/formatting';
import { deleteTerm } from 'state/terms/actions';
import { saveSiteSettings } from 'state/site-settings/actions';
import { recordGoogleEvent, bumpStat } from 'state/analytics/actions';
import PodcastIndicator from 'components/podcast-indicator';
import getPodcastingCategoryId from 'state/selectors/get-podcasting-category-id';
class TaxonomyManagerListItem extends Component {
static propTypes = {
canSetAsDefault: PropTypes.bool,
deleteTerm: PropTypes.func,
isDefault: PropTypes.bool,
onClick: PropTypes.func,
saveSiteSettings: PropTypes.func,
siteId: PropTypes.number,
term: PropTypes.object,
translate: PropTypes.func,
siteUrl: PropTypes.string,
slug: PropTypes.string,
isPreviewable: PropTypes.bool,
recordGoogleEvent: PropTypes.func,
bumpStat: PropTypes.func,
};
static defaultProps = {
onClick: () => {},
};
state = {
showDeleteDialog: false,
showTooltip: false,
};
deleteItem = () => {
this.setState( {
showDeleteDialog: true,
} );
};
viewPosts = () => {
const { siteSlug, taxonomy: rawTaxonomy, term } = this.props;
const taxonomy = rawTaxonomy === 'post_tag' ? 'tag' : rawTaxonomy;
this.props.recordGoogleEvent( 'Taxonomy Manager', `View ${ rawTaxonomy }` );
page( `/posts/${ siteSlug }?${ taxonomy }=${ term.slug }` );
};
closeDeleteDialog = ( action ) => {
if ( action === 'delete' ) {
const { siteId, taxonomy, term } = this.props;
this.props.recordGoogleEvent( 'Taxonomy Manager', `Deleted ${ taxonomy }` );
this.props.bumpStat( 'taxonomy_manager', `delete_${ taxonomy }` );
this.props.deleteTerm( siteId, taxonomy, term.ID, term.slug );
}
this.setState( {
showDeleteDialog: false,
} );
};
setAsDefault = () => {
const { canSetAsDefault, siteId, term } = this.props;
if ( canSetAsDefault ) {
this.props.recordGoogleEvent( 'Taxonomy Manager', 'Set Default Category' );
this.props.bumpStat( 'taxonomy_manager', 'set_default_category' );
this.props.saveSiteSettings( siteId, { default_category: term.ID } );
}
};
getTaxonomyLink() {
const { taxonomy, siteUrl, term } = this.props;
let taxonomyBase = taxonomy;
if ( taxonomy === 'post_tag' ) {
taxonomyBase = 'tag';
}
return `${ siteUrl }/${ taxonomyBase }/${ term.slug }/`;
}
tooltipText = () => {
const { term, translate } = this.props;
const name = this.getName();
const postCount = get( term, 'post_count', 0 );
return translate( "%(postCount)d '%(name)s' post", "%(postCount)d '%(name)s' posts", {
count: postCount,
args: {
postCount,
name,
},
} );
};
showTooltip = () => {
this.setState( { showTooltip: true } );
};
hideTooltip = () => {
this.setState( { showTooltip: false } );
};
getName = () => {
const { term, translate } = this.props;
return decodeEntities( term.name ) || translate( 'Untitled' );
};
render() {
const {
canSetAsDefault,
isDefault,
onClick,
term,
isPodcastingCategory,
translate,
} = this.props;
const name = this.getName();
const hasPosts = get( term, 'post_count', 0 ) > 0;
const className = classNames( 'taxonomy-manager__item', {
'is-default': isDefault,
} );
const deleteDialogButtons = [
{ action: 'cancel', label: translate( 'Cancel' ) },
{ action: 'delete', label: translate( 'OK' ), isPrimary: true },
];
return (
<div className={ className }>
<span className="taxonomy-manager__icon" onClick={ onClick }>
<Gridicon icon={ isDefault ? 'checkmark-circle' : 'folder' } />
</span>
{ /* FIXME: jsx-a11y issues */ }
{ /* eslint-disable-next-line */ }
<span className="taxonomy-manager__label" onClick={ onClick }>
<span>{ name }</span>
{ isDefault && (
<span className="taxonomy-manager__default-label">
{ translate( 'default', { context: 'label for terms marked as default' } ) }
</span>
) }
{ isPodcastingCategory && (
<PodcastIndicator className="taxonomy-manager__podcast-indicator" />
) }
</span>
{ ! isUndefined( term.post_count ) && (
<Count
ref="count"
count={ term.post_count }
onMouseEnter={ this.showTooltip }
onMouseLeave={ this.hideTooltip }
/>
) }
<Tooltip
context={ this.refs && this.refs.count }
isVisible={ this.state.showTooltip }
position="left"
>
{ this.tooltipText() }
</Tooltip>
<EllipsisMenu position="bottom left">
<PopoverMenuItem onClick={ onClick }>
<Gridicon icon="pencil" size={ 18 } />
{ translate( 'Edit' ) }
</PopoverMenuItem>
{ ( ! canSetAsDefault || ! isDefault ) && (
<PopoverMenuItem onClick={ this.deleteItem } icon="trash">
{ translate( 'Delete' ) }
</PopoverMenuItem>
) }
{ hasPosts && (
<PopoverMenuItem onClick={ this.viewPosts } icon="visible">
{ translate( 'View Posts' ) }
</PopoverMenuItem>
) }
{ canSetAsDefault && ! isDefault && <PopoverMenuSeparator /> }
{ canSetAsDefault && ! isDefault && (
<PopoverMenuItem onClick={ this.setAsDefault } icon="checkmark-circle">
{ translate( 'Set as default' ) }
</PopoverMenuItem>
) }
</EllipsisMenu>
<Dialog
isVisible={ this.state.showDeleteDialog }
buttons={ deleteDialogButtons }
onClose={ this.closeDeleteDialog }
>
<p>
{ translate( "Are you sure you want to permanently delete '%(name)s'?", {
args: { name },
} ) }
</p>
</Dialog>
</div>
);
}
}
export default connect(
( state, { taxonomy, term } ) => {
const siteId = getSelectedSiteId( state );
const site = getSite( state, siteId );
const siteSettings = getSiteSettings( state, siteId );
const canSetAsDefault = taxonomy === 'category';
const isDefault = canSetAsDefault && get( siteSettings, [ 'default_category' ] ) === term.ID;
const isPreviewable = get( site, 'is_previewable' );
const siteSlug = get( site, 'slug' );
const siteUrl = get( site, 'URL' );
const isPodcastingCategory =
taxonomy === 'category' && getPodcastingCategoryId( state, siteId ) === term.ID;
return {
canSetAsDefault,
isDefault,
isPreviewable,
siteId,
siteSlug,
siteUrl,
isPodcastingCategory,
};
},
{
deleteTerm,
saveSiteSettings,
recordGoogleEvent,
bumpStat,
}
)( localize( TaxonomyManagerListItem ) );
| {
"pile_set_name": "Github"
} |
/** @file mathop.h
** @brief Math operations (@ref mathop)
** @author Andrea Vedaldi, David Novotny
**/
/*
Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
All rights reserved.
This file is part of the VLFeat library and is made available under
the terms of the BSD license (see the COPYING file).
*/
#ifndef VL_MATHOP_H
#define VL_MATHOP_H
#include "generic.h"
#include <math.h>
#include <float.h>
/** @brief Euler constant*/
#define VL_E 2.718281828459045
/** @brief Logarithm of 2 (math constant)*/
#define VL_LOG_OF_2 0.693147180559945
/** @brief Pi (math constant) */
#define VL_PI 3.141592653589793
/** @brief IEEE single precision epsilon (math constant)
**
** <code>1.0F + VL_EPSILON_F</code> is the smallest representable
** single precision number greater than @c 1.0F. Numerically,
** ::VL_EPSILON_F is equal to @f$ 2^{-23} @f$.
**
**/
#define VL_EPSILON_F 1.19209290E-07F
/** @brief IEEE double precision epsilon (math constant)
**
** <code>1.0 + VL_EPSILON_D</code> is the smallest representable
** double precision number greater than @c 1.0. Numerically,
** ::VL_EPSILON_D is equal to @f$ 2^{-52} @f$.
**/
#define VL_EPSILON_D 2.220446049250313e-16
/*
For the code below: An ANSI C compiler takes the two expressions,
LONG_VAR and CHAR_VAR, and implicitly casts them to the type of the
first member of the union. Refer to K&R Second Edition Page 148,
last paragraph.
*/
/** @internal @brief IEEE single precision quiet NaN constant */
static union { vl_uint32 raw ; float value ; }
const vl_nan_f =
{ 0x7FC00000UL } ;
/** @internal @brief IEEE single precision infinity constant */
static union { vl_uint32 raw ; float value ; }
const vl_infinity_f =
{ 0x7F800000UL } ;
/** @internal @brief IEEE double precision quiet NaN constant */
static union { vl_uint64 raw ; double value ; }
const vl_nan_d =
#ifdef VL_COMPILER_MSC
{ 0x7FF8000000000000ui64 } ;
#else
{ 0x7FF8000000000000ULL } ;
#endif
/** @internal @brief IEEE double precision infinity constant */
static union { vl_uint64 raw ; double value ; }
const vl_infinity_d =
#ifdef VL_COMPILER_MSC
{ 0x7FF0000000000000ui64 } ;
#else
{ 0x7FF0000000000000ULL } ;
#endif
/** @brief IEEE single precision NaN (not signaling) */
#define VL_NAN_F (vl_nan_f.value)
/** @brief IEEE single precision positive infinity (not signaling) */
#define VL_INFINITY_F (vl_infinity_f.value)
/** @brief IEEE double precision NaN (not signaling) */
#define VL_NAN_D (vl_nan_d.value)
/** @brief IEEE double precision positive infinity (not signaling) */
#define VL_INFINITY_D (vl_infinity_d.value)
/* ---------------------------------------------------------------- */
/** @brief Fast <code>mod(x, 2 * VL_PI)</code>
**
** @param x input value.
** @return <code>mod(x, 2 * VL_PI)</code>
**
** The function is optimized for small absolute values of @a x.
**
** The result is guaranteed to be not smaller than 0. However, due to
** finite numerical precision and rounding errors, the result can be
** equal to 2 * VL_PI (for instance, if @c x is a very small negative
** number).
**/
VL_INLINE float
vl_mod_2pi_f (float x)
{
while (x > (float)(2 * VL_PI)) x -= (float) (2 * VL_PI) ;
while (x < 0.0F) x += (float) (2 * VL_PI);
return x ;
}
/** @brief Fast <code>mod(x, 2 * VL_PI)</code>
** @see vl_mod_2pi_f
**/
VL_INLINE double
vl_mod_2pi_d (double x)
{
while (x > 2.0 * VL_PI) x -= 2 * VL_PI ;
while (x < 0.0) x += 2 * VL_PI ;
return x ;
}
/** @brief Floor and convert to integer
** @param x argument.
** @return Similar to @c (int) floor(x)
**/
VL_INLINE long int
vl_floor_f (float x)
{
long int xi = (long int) x ;
if (x >= 0 || (float) xi == x) return xi ;
else return xi - 1 ;
}
/** @brief Floor and convert to integer
** @see vl_floor_f
**/
VL_INLINE long int
vl_floor_d (double x)
{
long int xi = (long int) x ;
if (x >= 0 || (double) xi == x) return xi ;
else return xi - 1 ;
}
/** @brief Ceil and convert to integer
** @param x argument.
** @return @c lceilf(x)
**/
VL_INLINE long int
vl_ceil_f (float x)
{
#ifdef VL_COMPILER_GNUC
return (long int) __builtin_ceilf(x) ;
#else
return (long int) ceilf(x) ;
#endif
}
/** @brief Ceil and convert to integer
** @see vl_ceil_f
**/
VL_INLINE long int
vl_ceil_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_ceil(x) ;
#else
return (long int) ceil(x) ;
#endif
}
/** @brief Round
** @param x argument.
** @return @c lroundf(x)
** This function is either the same or similar to C99 @c lroundf().
**/
VL_INLINE long int
vl_round_f (float x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_lroundf(x) ;
#elif VL_COMPILER_MSC
if (x >= 0.0F) {
return vl_floor_f(x + 0.5F) ;
} else {
return vl_ceil_f(x - 0.5F) ;
}
#else
return lroundf(x) ;
#endif
}
/** @brief Round
** @param x argument.
** @return @c lround(x)
** This function is either the same or similar to C99 @c lround().
**/
VL_INLINE long int
vl_round_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_lround(x) ;
#elif VL_COMPILER_MSC
if (x >= 0.0) {
return vl_floor_d(x + 0.5) ;
} else {
return vl_ceil_d(x - 0.5) ;
}
#else
return lround(x) ;
#endif
}
/** @brief Fast @c abs(x)
** @param x argument.
** @return @c abs(x)
**/
VL_INLINE float
vl_abs_f (float x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_fabsf (x) ;
#else
return fabsf(x) ;
#endif
}
/** @brief Fast @c abs(x)
** @sa vl_abs_f
**/
VL_INLINE double
vl_abs_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_fabs (x) ;
#else
return fabs(x) ;
#endif
}
/** @brief Base-2 logaritghm
** @param x argument.
** @return @c log(x).
**/
VL_INLINE double
vl_log2_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_log2(x) ;
#elif VL_COMPILER_MSC
return log(x) / 0.693147180559945 ;
#else
return log2(x) ;
#endif
}
/** @copydoc vl_log2_d */
VL_INLINE float
vl_log2_f (float x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_log2f (x) ;
#elif VL_COMPILER_MSC
return logf(x) / 0.6931472F ;
#else
return log2(x) ;
#endif
}
/** @brief Square root.
** @param x argument.
** @return @c sqrt(x).
**/
VL_INLINE double
vl_sqrt_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_sqrt(x) ;
#else
return sqrt(x) ;
#endif
}
/** @copydoc vl_sqrt_d */
VL_INLINE float
vl_sqrt_f (float x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_sqrtf(x) ;
#else
return sqrtf(x) ;
#endif
}
/** @brief Check whether a floating point value is NaN
** @param x argument.
** @return true if @a x is NaN.
**/
VL_INLINE vl_bool
vl_is_nan_f (float x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_isnan (x) ;
#elif VL_COMPILER_MSC
return _isnan(x) ;
#else
return isnan(x) ;
#endif
}
/** @copydoc vl_is_nan_f */
VL_INLINE vl_bool
vl_is_nan_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_isnan (x) ;
#elif VL_COMPILER_MSC
return _isnan(x) ;
#else
return isnan(x) ;
#endif
}
/** @brief Check whether a floating point value is infinity
** @param x argument.
** @return true if @a x is infinity.
**/
VL_INLINE vl_bool
vl_is_inf_f (float x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_isinf (x) ;
#elif VL_COMPILER_MSC
return ! _finite(x) ;
#else
return isinf(x) ;
#endif
}
/** @copydoc vl_is_inf_f */
VL_INLINE vl_bool
vl_is_inf_d (double x)
{
#ifdef VL_COMPILER_GNUC
return __builtin_isinf (x) ;
#elif VL_COMPILER_MSC
return ! _finite(x) ;
#else
return isinf(x) ;
#endif
}
/** ------------------------------------------------------------------
** @brief Fast @c atan2 approximation
** @param y argument.
** @param x argument.
**
** The function computes a relatively rough but fast approximation of
** @c atan2(y,x).
**
** @par Algorithm
**
** The algorithm approximates the function @f$ f(r)=atan((1-r)/(1+r))
** @f$, @f$ r \in [-1,1] @f$ with a third order polynomial @f$
** f(r)=c_0 + c_1 r + c_2 r^2 + c_3 r^3 @f$. To fit the polynomial
** we impose the constraints
**
** @f{eqnarray*}
** f(+1) &=& c_0 + c_1 + c_2 + c_3 = atan(0) = 0,\\
** f(-1) &=& c_0 - c_1 + c_2 - c_3 = atan(\infty) = \pi/2,\\
** f(0) &=& c_0 = atan(1) = \pi/4.
** @f}
**
** The last degree of freedom is fixed by minimizing the @f$
** l^{\infty} @f$ error, which yields
**
** @f[
** c_0=\pi/4, \quad
** c_1=-0.9675, \quad
** c_2=0, \quad
** c_3=0.1821,
** @f]
**
** with maximum error of 0.0061 radians at 0.35 degrees.
**
** @return Approximation of @c atan2(y,x).
**/
VL_INLINE float
vl_fast_atan2_f (float y, float x)
{
float angle, r ;
float const c3 = 0.1821F ;
float const c1 = 0.9675F ;
float abs_y = vl_abs_f (y) + VL_EPSILON_F ;
if (x >= 0) {
r = (x - abs_y) / (x + abs_y) ;
angle = (float) (VL_PI / 4) ;
} else {
r = (x + abs_y) / (abs_y - x) ;
angle = (float) (3 * VL_PI / 4) ;
}
angle += (c3*r*r - c1) * r ;
return (y < 0) ? - angle : angle ;
}
/** @brief Fast @c atan2 approximation
** @sa vl_fast_atan2_f
**/
VL_INLINE double
vl_fast_atan2_d (double y, double x)
{
double angle, r ;
double const c3 = 0.1821 ;
double const c1 = 0.9675 ;
double abs_y = vl_abs_d (y) + VL_EPSILON_D ;
if (x >= 0) {
r = (x - abs_y) / (x + abs_y) ;
angle = VL_PI / 4 ;
} else {
r = (x + abs_y) / (abs_y - x) ;
angle = 3 * VL_PI / 4 ;
}
angle += (c3*r*r - c1) * r ;
return (y < 0) ? - angle : angle ;
}
/** ------------------------------------------------------------------
** @brief Fast @c resqrt approximation
** @param x argument.
** @return approximation of @c resqrt(x).
**
** The function quickly computes an approximation of @f$ x^{-1/2}
** @f$.
**
** @par Algorithm
**
** The goal is to compute @f$ y = x^{-1/2} @f$, which we do by
** finding the solution of @f$ 0 = f(y) = y^{-2} - x @f$ by two Newton
** steps. Each Newton iteration is given by
**
** @f[
** y \leftarrow
** y - \frac{f(y)}{\frac{df(y)}{dy}} =
** y + \frac{1}{2} (y-xy^3) =
** \frac{y}{2} \left( 3 - xy^2 \right)
** @f]
**
** which yields a simple polynomial update rule.
**
** The clever bit (attributed to either J. Carmack or G. Tarolli) is
** the way an initial guess @f$ y \approx x^{-1/2} @f$ is chosen.
**
** @see <a href="http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf">Inverse Sqare Root</a>.
**
**/
VL_INLINE float
vl_fast_resqrt_f (float x)
{
/* 32-bit version */
union {
float x ;
vl_int32 i ;
} u ;
float xhalf = (float) 0.5 * x ;
/* convert floating point value in RAW integer */
u.x = x ;
/* gives initial guess y0 */
u.i = 0x5f3759df - (u.i >> 1);
/*u.i = 0xdf59375f - (u.i>>1);*/
/* two Newton steps */
u.x = u.x * ( (float) 1.5 - xhalf*u.x*u.x) ;
u.x = u.x * ( (float) 1.5 - xhalf*u.x*u.x) ;
return u.x ;
}
/** @brief Fast @c resqrt approximation
** @sa vl_fast_resqrt_d
**/
VL_INLINE double
vl_fast_resqrt_d (double x)
{
/* 64-bit version */
union {
double x ;
vl_int64 i ;
} u ;
double xhalf = (double) 0.5 * x ;
/* convert floating point value in RAW integer */
u.x = x ;
/* gives initial guess y0 */
#ifdef VL_COMPILER_MSC
u.i = 0x5fe6ec85e7de30dai64 - (u.i >> 1) ;
#else
u.i = 0x5fe6ec85e7de30daLL - (u.i >> 1) ;
#endif
/* two Newton steps */
u.x = u.x * ( (double) 1.5 - xhalf*u.x*u.x) ;
u.x = u.x * ( (double) 1.5 - xhalf*u.x*u.x) ;
return u.x ;
}
/** ------------------------------------------------------------------
** @brief Fast @c sqrt approximation
** @param x argument.
** @return approximation of @c sqrt(x).
**
** The function uses ::vl_fast_resqrt_f
** (or ::vl_fast_resqrt_d) to compute <code>x *
** vl_fast_resqrt_f(x)</code>.
**/
VL_INLINE float
vl_fast_sqrt_f (float x)
{
return (x < 1e-8) ? 0 : x * vl_fast_resqrt_f (x) ;
}
/** @brief Fast @c sqrt approximation
** @copydoc vl_fast_sqrt_f
**/
VL_INLINE double
vl_fast_sqrt_d (float x)
{
return (x < 1e-8) ? 0 : x * vl_fast_resqrt_d (x) ;
}
/** @brief Fast integer @c sqrt approximation
** @param x non-negative integer.
** @return largest integer $y$ such that $y^2 \leq x$.
** @sa @ref mathop-sqrti "Algorithm"
**/
VL_INLINE vl_uint64 vl_fast_sqrt_ui64 (vl_uint64 x) ;
/** @brief Fast @c sqrt approximation
** @copydoc vl_fast_sqrt_ui64 */
VL_INLINE vl_uint32 vl_fast_sqrt_ui32 (vl_uint32 x) ;
/** @brief Fast @c sqrt approximation
** @copydoc vl_fast_sqrt_ui64 */
VL_INLINE vl_uint16 vl_fast_sqrt_ui16 (vl_uint16 x) ;
/** @brief Fast @c sqrt approximation
** @copydoc vl_fast_sqrt_ui64 */
VL_INLINE vl_uint8 vl_fast_sqrt_ui8 (vl_uint8 x) ;
#define VL_FAST_SQRT_UI(T,SFX) \
VL_INLINE T \
vl_fast_sqrt_ ## SFX (T x) \
{ \
T y = 0 ; \
T tmp = 0 ; \
int twice_k ; \
for (twice_k = 8 * sizeof(T) - 2 ; \
twice_k >= 0 ; twice_k -= 2) { \
y <<= 1 ; /* y = 2 * y */ \
tmp = (2*y + 1) << twice_k ; \
if (x >= tmp) { \
x -= tmp ; \
y += 1 ; \
} \
} \
return y ; \
}
VL_FAST_SQRT_UI(vl_uint64,ui64)
VL_FAST_SQRT_UI(vl_uint32,ui32)
VL_FAST_SQRT_UI(vl_uint16,ui16)
VL_FAST_SQRT_UI(vl_uint8,ui8)
/* ---------------------------------------------------------------- */
/* Vector distances and similarities */
/* ---------------------------------------------------------------- */
/** @typedef VlFloatVectorComparisonFunction
** @brief Pointer to a function to compare vectors of floats
**/
typedef float (*VlFloatVectorComparisonFunction)(vl_size dimension, float const * X, float const * Y) ;
/** @typedef VlDoubleVectorComparisonFunction
** @brief Pointer to a function to compare vectors of doubles
**/
typedef double (*VlDoubleVectorComparisonFunction)(vl_size dimension, double const * X, double const * Y) ;
/** @typedef VlFloatVector3ComparisonFunction
** @brief Pointer to a function to compare 3 vectors of doubles
**/
typedef float (*VlFloatVector3ComparisonFunction)(vl_size dimension, float const * X, float const * Y, float const * Z) ;
/** @typedef VlDoubleVector3ComparisonFunction
** @brief Pointer to a function to compare 3 vectors of doubles
**/
typedef double (*VlDoubleVector3ComparisonFunction)(vl_size dimension, double const * X, double const * Y, double const * Z) ;
/** @brief Vector comparison types */
enum _VlVectorComparisonType {
VlDistanceL1, /**< l1 distance (squared intersection metric) */
VlDistanceL2, /**< squared l2 distance */
VlDistanceChi2, /**< squared Chi2 distance */
VlDistanceHellinger, /**< squared Hellinger's distance */
VlDistanceJS, /**< squared Jensen-Shannon distance */
VlDistanceMahalanobis, /**< squared mahalanobis distance */
VlKernelL1, /**< intersection kernel */
VlKernelL2, /**< l2 kernel */
VlKernelChi2, /**< Chi2 kernel */
VlKernelHellinger, /**< Hellinger's kernel */
VlKernelJS /**< Jensen-Shannon kernel */
} ;
/** @brief Vector comparison types */
typedef enum _VlVectorComparisonType VlVectorComparisonType ;
/** @brief Get the symbolic name of a vector comparison type
** @param type vector comparison type.
** @return data symbolic name.
**/
VL_INLINE char const *
vl_get_vector_comparison_type_name (int type)
{
switch (type) {
case VlDistanceL1 : return "l1" ;
case VlDistanceL2 : return "l2" ;
case VlDistanceChi2 : return "chi2" ;
case VlDistanceMahalanobis : return "mahalanobis" ;
case VlKernelL1 : return "kl1" ;
case VlKernelL2 : return "kl2" ;
case VlKernelChi2 : return "kchi2" ;
default: return NULL ;
}
}
VL_EXPORT VlFloatVectorComparisonFunction
vl_get_vector_comparison_function_f (VlVectorComparisonType type) ;
VL_EXPORT VlDoubleVectorComparisonFunction
vl_get_vector_comparison_function_d (VlVectorComparisonType type) ;
VL_EXPORT VlFloatVector3ComparisonFunction
vl_get_vector_3_comparison_function_f (VlVectorComparisonType type) ;
VL_EXPORT VlDoubleVector3ComparisonFunction
vl_get_vector_3_comparison_function_d (VlVectorComparisonType type) ;
VL_EXPORT void
vl_eval_vector_comparison_on_all_pairs_f (float * result, vl_size dimension,
float const * X, vl_size numDataX,
float const * Y, vl_size numDataY,
VlFloatVectorComparisonFunction function) ;
VL_EXPORT void
vl_eval_vector_comparison_on_all_pairs_d (double * result, vl_size dimension,
double const * X, vl_size numDataX,
double const * Y, vl_size numDataY,
VlDoubleVectorComparisonFunction function) ;
/* ---------------------------------------------------------------- */
/* Numerical analysis */
/* ---------------------------------------------------------------- */
VL_EXPORT void
vl_svd2 (double* S, double *U, double *V, double const *M) ;
VL_EXPORT void
vl_lapack_dlasv2 (double *smin,
double *smax,
double *sv,
double *cv,
double *su,
double *cu,
double f,
double g,
double h) ;
VL_EXPORT int
vl_solve_linear_system_3 (double * x, double const * A, double const *b) ;
VL_EXPORT int
vl_solve_linear_system_2 (double * x, double const * A, double const *b) ;
VL_EXPORT int
vl_gaussian_elimination (double * A, vl_size numRows, vl_size numColumns) ;
/* VL_MATHOP_H */
#endif
| {
"pile_set_name": "Github"
} |
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
| {
"pile_set_name": "Github"
} |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.types;
import org.apache.hadoop.hbase.util.Order;
import org.apache.hadoop.hbase.util.OrderedBytes;
import org.apache.hadoop.hbase.util.PositionedByteRange;
import org.apache.yetus.audience.InterfaceAudience;
/**
* Base class for data types backed by the {@link OrderedBytes} encoding
* implementations.
*/
@InterfaceAudience.Public
public abstract class OrderedBytesBase<T> implements DataType<T> {
protected final Order order;
public OrderedBytesBase(Order order) {
this.order = order;
}
@Override
public boolean isOrderPreserving() {
return true;
}
@Override
public Order getOrder() {
return order;
}
// almost all OrderedBytes implementations are nullable.
@Override
public boolean isNullable() {
return true;
}
// almost all OrderedBytes implementations are skippable.
@Override
public boolean isSkippable() {
return true;
}
@Override
public int skip(PositionedByteRange src) {
return OrderedBytes.skip(src);
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>AppleACPIPS2Nub</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.driver.AppleACPIPS2Nub</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AppleACPIPS2Nub</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0d1</string>
<key>IOKitPersonalities</key>
<dict>
<key>ACPI PS/2 Nub</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.driver.AppleACPIPS2Nub</string>
<key>IOClass</key>
<string>AppleACPIPS2Nub</string>
<key>IONameMatch</key>
<array>
<string>PNP0303</string>
<string>PNP030B</string>
</array>
<key>IOProviderClass</key>
<string>IOACPIPlatformDevice</string>
<key>MouseNameMatch</key>
<array>
<string>PNP0F03</string>
<string>PNP0F0B</string>
<string>PNP0F0E</string>
<string>PNP0F13</string>
</array>
</dict>
</dict>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOACPIFamily</key>
<string>1.0.0d1</string>
<key>com.apple.kpi.bsd</key>
<string>8.0.0</string>
<key>com.apple.kpi.iokit</key>
<string>8.0.0</string>
<key>com.apple.kpi.libkern</key>
<string>8.0.0</string>
<key>com.apple.kpi.mach</key>
<string>8.0.0</string>
<key>com.apple.kpi.unsupported</key>
<string>8.0.0</string>
</dict>
<key>OSBundleRequired</key>
<string>Root</string>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
"context"
"time"
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// ReplicationControllersGetter has a method to return a ReplicationControllerInterface.
// A group's client should implement this interface.
type ReplicationControllersGetter interface {
ReplicationControllers(namespace string) ReplicationControllerInterface
}
// ReplicationControllerInterface has methods to work with ReplicationController resources.
type ReplicationControllerInterface interface {
Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (*v1.ReplicationController, error)
Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error)
UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ReplicationController, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ReplicationControllerList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error)
GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error)
ReplicationControllerExpansion
}
// replicationControllers implements ReplicationControllerInterface
type replicationControllers struct {
client rest.Interface
ns string
}
// newReplicationControllers returns a ReplicationControllers
func newReplicationControllers(c *CoreV1Client, namespace string) *replicationControllers {
return &replicationControllers{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any.
func (c *replicationControllers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicationController, err error) {
result = &v1.ReplicationController{}
err = c.client.Get().
Namespace(c.ns).
Resource("replicationcontrollers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors.
func (c *replicationControllers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicationControllerList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.ReplicationControllerList{}
err = c.client.Get().
Namespace(c.ns).
Resource("replicationcontrollers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested replicationControllers.
func (c *replicationControllers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("replicationcontrollers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any.
func (c *replicationControllers) Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (result *v1.ReplicationController, err error) {
result = &v1.ReplicationController{}
err = c.client.Post().
Namespace(c.ns).
Resource("replicationcontrollers").
VersionedParams(&opts, scheme.ParameterCodec).
Body(replicationController).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any.
func (c *replicationControllers) Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) {
result = &v1.ReplicationController{}
err = c.client.Put().
Namespace(c.ns).
Resource("replicationcontrollers").
Name(replicationController.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(replicationController).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *replicationControllers) UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) {
result = &v1.ReplicationController{}
err = c.client.Put().
Namespace(c.ns).
Resource("replicationcontrollers").
Name(replicationController.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(replicationController).
Do(ctx).
Into(result)
return
}
// Delete takes name of the replicationController and deletes it. Returns an error if one occurs.
func (c *replicationControllers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("replicationcontrollers").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *replicationControllers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("replicationcontrollers").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched replicationController.
func (c *replicationControllers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error) {
result = &v1.ReplicationController{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("replicationcontrollers").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
// GetScale takes name of the replicationController, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
func (c *replicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
result = &autoscalingv1.Scale{}
err = c.client.Get().
Namespace(c.ns).
Resource("replicationcontrollers").
Name(replicationControllerName).
SubResource("scale").
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *replicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
result = &autoscalingv1.Scale{}
err = c.client.Put().
Namespace(c.ns).
Resource("replicationcontrollers").
Name(replicationControllerName).
SubResource("scale").
VersionedParams(&opts, scheme.ParameterCodec).
Body(scale).
Do(ctx).
Into(result)
return
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2014, Michael Ellerman, IBM Corp.
* Licensed under GPLv2.
*/
#include <stdio.h>
#include <stdlib.h>
#include "ebb.h"
/*
* Test various attributes of the EBB event are enforced.
*/
int event_attributes(void)
{
struct event event, leader;
SKIP_IF(!ebb_is_supported());
event_init(&event, 0x1001e);
event_leader_ebb_init(&event);
/* Expected to succeed */
FAIL_IF(event_open(&event));
event_close(&event);
event_init(&event, 0x001e); /* CYCLES - no PMC specified */
event_leader_ebb_init(&event);
/* Expected to fail, no PMC specified */
FAIL_IF(event_open(&event) == 0);
event_init(&event, 0x2001e);
event_leader_ebb_init(&event);
event.attr.exclusive = 0;
/* Expected to fail, not exclusive */
FAIL_IF(event_open(&event) == 0);
event_init(&event, 0x3001e);
event_leader_ebb_init(&event);
event.attr.freq = 1;
/* Expected to fail, sets freq */
FAIL_IF(event_open(&event) == 0);
event_init(&event, 0x4001e);
event_leader_ebb_init(&event);
event.attr.sample_period = 1;
/* Expected to fail, sets sample_period */
FAIL_IF(event_open(&event) == 0);
event_init(&event, 0x1001e);
event_leader_ebb_init(&event);
event.attr.enable_on_exec = 1;
/* Expected to fail, sets enable_on_exec */
FAIL_IF(event_open(&event) == 0);
event_init(&event, 0x1001e);
event_leader_ebb_init(&event);
event.attr.inherit = 1;
/* Expected to fail, sets inherit */
FAIL_IF(event_open(&event) == 0);
event_init(&leader, 0x1001e);
event_leader_ebb_init(&leader);
FAIL_IF(event_open(&leader));
event_init(&event, 0x20002);
event_ebb_init(&event);
/* Expected to succeed */
FAIL_IF(event_open_with_group(&event, leader.fd));
event_close(&leader);
event_close(&event);
event_init(&leader, 0x1001e);
event_leader_ebb_init(&leader);
FAIL_IF(event_open(&leader));
event_init(&event, 0x20002);
/* Expected to fail, event doesn't request EBB, leader does */
FAIL_IF(event_open_with_group(&event, leader.fd) == 0);
event_close(&leader);
event_init(&leader, 0x1001e);
event_leader_ebb_init(&leader);
/* Clear the EBB flag */
leader.attr.config &= ~(1ull << 63);
FAIL_IF(event_open(&leader));
event_init(&event, 0x20002);
event_ebb_init(&event);
/* Expected to fail, leader doesn't request EBB */
FAIL_IF(event_open_with_group(&event, leader.fd) == 0);
event_close(&leader);
event_init(&leader, 0x1001e);
event_leader_ebb_init(&leader);
leader.attr.exclusive = 0;
/* Expected to fail, leader isn't exclusive */
FAIL_IF(event_open(&leader) == 0);
event_init(&leader, 0x1001e);
event_leader_ebb_init(&leader);
leader.attr.pinned = 0;
/* Expected to fail, leader isn't pinned */
FAIL_IF(event_open(&leader) == 0);
event_init(&event, 0x1001e);
event_leader_ebb_init(&event);
/* Expected to fail, not a task event */
SKIP_IF(require_paranoia_below(1));
FAIL_IF(event_open_with_cpu(&event, 0) == 0);
return 0;
}
int main(void)
{
return test_harness(event_attributes, "event_attributes");
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
# @author : [email protected]
from headers.BeaEnginePython import *
from nose.tools import *
class TestSuite:
def test(self):
# 66 0F 3A 44 /r ib
# PCLMULQDQ xmm1, xmm2/m128, imm8
Buffer = '660f3a442001'.decode('hex')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0xf3a44)
assert_equal(myDisasm.infos.Instruction.Mnemonic, 'pclmulhqlqdq ')
assert_equal(myDisasm.infos.repr, 'pclmulhqlqdq xmm4, xmmword ptr [rax], 01h')
# VEX.128.66.0F3A.WIG 44 /r ib
# VPCLMULQDQ xmm1, xmm2, xmm3/m128, imm8
myVEX = VEX('VEX.128.66.0F3A.WIG')
Buffer = '{}441033'.format(myVEX.c4()).decode('hex')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x44)
assert_equal(myDisasm.infos.Instruction.Mnemonic, 'vpclmulqdq ')
assert_equal(myDisasm.infos.repr, 'vpclmulqdq xmm10, xmm0, xmmword ptr [r8], 33h')
# VEX.256.66.0F3A.WIG 44 /r /ib
# VPCLMULQDQ ymm1, ymm2, ymm3/m256, imm8
myVEX = VEX('VEX.256.66.0F3A.WIG')
Buffer = '{}441033'.format(myVEX.c4()).decode('hex')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x44)
assert_equal(myDisasm.infos.Instruction.Mnemonic, 'vpclmulqdq ')
assert_equal(myDisasm.infos.repr, 'vpclmulqdq ymm10, ymm0, ymmword ptr [r8], 33h')
# EVEX.128.66.0F3A.WIG 44 /r /ib
# VPCLMULQDQ xmm1, xmm2, xmm3/m128, imm8
myEVEX = EVEX('EVEX.128.66.0F3A.WIG')
Buffer = '{}442011'.format(myEVEX.prefix()).decode('hex')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x44)
assert_equal(myDisasm.infos.Instruction.Mnemonic, 'vpclmulqdq ')
assert_equal(myDisasm.infos.repr, 'vpclmulqdq xmm28, xmm16, xmmword ptr [r8], 11h')
# EVEX.256.66.0F3A.WIG 44 /r /ib
# VPCLMULQDQ ymm1, ymm2, ymm3/m256, imm8
myEVEX = EVEX('EVEX.256.66.0F3A.WIG')
Buffer = '{}442011'.format(myEVEX.prefix()).decode('hex')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x44)
assert_equal(myDisasm.infos.Instruction.Mnemonic, 'vpclmulqdq ')
assert_equal(myDisasm.infos.repr, 'vpclmulqdq ymm28, ymm16, ymmword ptr [r8], 11h')
# EVEX.512.66.0F3A.WIG 44 /r /ib
# VPCLMULQDQ zmm1, zmm2, zmm3/m512, imm8
myEVEX = EVEX('EVEX.512.66.0F3A.WIG')
Buffer = '{}442011'.format(myEVEX.prefix()).decode('hex')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x44)
assert_equal(myDisasm.infos.Instruction.Mnemonic, 'vpclmulqdq ')
assert_equal(myDisasm.infos.repr, 'vpclmulqdq zmm28, zmm16, zmmword ptr [r8], 11h')
| {
"pile_set_name": "Github"
} |
Bitcoin Core version 0.10.3 is now available from:
<https://bitcoin.org/bin/bitcoin-core-0.10.3/>
This is a new minor version release, bringing security fixes and translation
updates. It is recommended to upgrade to this version as soon as possible.
Please report bugs using the issue tracker at github:
<https://github.com/bitcoin/bitcoin/issues>
Upgrading and downgrading
=========================
How to Upgrade
--------------
If you are running an older version, shut it down. Wait until it has completely
shut down (which might take a few minutes for older versions), then run the
installer (on Windows) or just copy over /Applications/Bitcoin-Qt (on Mac) or
bitcoind/bitcoin-qt (on Linux).
Downgrade warning
------------------
Because release 0.10.0 and later makes use of headers-first synchronization and
parallel block download (see further), the block files and databases are not
backwards-compatible with pre-0.10 versions of Bitcoin Core or other software:
* Blocks will be stored on disk out of order (in the order they are
received, really), which makes it incompatible with some tools or
other programs. Reindexing using earlier versions will also not work
anymore as a result of this.
* The block index database will now hold headers for which no block is
stored on disk, which earlier versions won't support.
If you want to be able to downgrade smoothly, make a backup of your entire data
directory. Without this your node will need start syncing (or importing from
bootstrap.dat) anew afterwards. It is possible that the data from a completely
synchronised 0.10 node may be usable in older versions as-is, but this is not
supported and may break as soon as the older version attempts to reindex.
This does not affect wallet forward or backward compatibility.
Notable changes
===============
Fix buffer overflow in bundled upnp
------------------------------------
Bundled miniupnpc was updated to 1.9.20151008. This fixes a buffer overflow in
the XML parser during initial network discovery.
Details can be found here: http://talosintel.com/reports/TALOS-2015-0035/
This applies to the distributed executables only, not when building from source or
using distribution provided packages.
Additionally, upnp has been disabled by default. This may result in a lower
number of reachable nodes on IPv4, however this prevents future libupnpc
vulnerabilities from being a structural risk to the network
(see https://github.com/bitcoin/bitcoin/pull/6795).
Test for LowS signatures before relaying
-----------------------------------------
Make the node require the canonical 'low-s' encoding for ECDSA signatures when
relaying or mining. This removes a nuisance malleability vector.
Consensus behavior is unchanged.
If widely deployed this change would eliminate the last remaining known vector
for nuisance malleability on SIGHASH_ALL P2PKH transactions. On the down-side
it will block most transactions made by sufficiently out of date software.
Unlike the other avenues to change txids on transactions this
one was randomly violated by all deployed bitcoin software prior to
its discovery. So, while other malleability vectors where made
non-standard as soon as they were discovered, this one has remained
permitted. Even BIP62 did not propose applying this rule to
old version transactions, but conforming implementations have become
much more common since BIP62 was initially written.
Bitcoin Core has produced compatible signatures since a28fb70e in
September 2013, but this didn't make it into a release until 0.9
in March 2014; Bitcoinj has done so for a similar span of time.
Bitcoinjs and electrum have been more recently updated.
This does not replace the need for BIP62 or similar, as miners can
still cooperate to break transactions. Nor does it replace the
need for wallet software to handle malleability sanely[1]. This
only eliminates the cheap and irritating DOS attack.
[1] On the Malleability of Bitcoin Transactions
Marcin Andrychowicz, Stefan Dziembowski, Daniel Malinowski, Łukasz Mazurek
http://fc15.ifca.ai/preproceedings/bitcoin/paper_9.pdf
Minimum relay fee default increase
-----------------------------------
The default for the `-minrelaytxfee` setting has been increased from `0.00001`
to `0.00005`.
This is necessitated by the current transaction flooding, causing
outrageous memory usage on nodes due to the mempool ballooning. This is a
temporary measure, bridging the time until a dynamic method for determining
this fee is merged (which will be in 0.12).
(see https://github.com/bitcoin/bitcoin/pull/6793, as well as the 0.11.0
release notes, in which this value was suggested)
0.10.3 Change log
=================
Detailed release notes follow. This overview includes changes that affect external
behavior, not code moves, refactors or string updates.
- #6186 `e4a7d51` Fix two problems in CSubnet parsing
- #6153 `ebd7d8d` Parameter interaction: disable upnp if -proxy set
- #6203 `ecc96f5` Remove P2SH coinbase flag, no longer interesting
- #6226 `181771b` json: fail read_string if string contains trailing garbage
- #6244 `09334e0` configure: Detect (and reject) LibreSSL
- #6276 `0fd8464` Fix getbalance * 0
- #6274 `be64204` Add option `-alerts` to opt out of alert system
- #6319 `3f55638` doc: update mailing list address
- #6438 `7e66e9c` openssl: avoid config file load/race
- #6439 `255eced` Updated URL location of netinstall for Debian
- #6412 `0739e6e` Test whether created sockets are select()able
- #6694 `f696ea1` [QT] fix thin space word wrap line brake issue
- #6704 `743cc9e` Backport bugfixes to 0.10
- #6769 `1cea6b0` Test LowS in standardness, removes nuisance malleability vector.
- #6789 `093d7b5` Update miniupnpc to 1.9.20151008
- #6795 `f2778e0` net: Disable upnp by default
- #6797 `91ef4d9` Do not store more than 200 timedata samples
- #6793 `842c48d` Bump minrelaytxfee default
Credits
=======
Thanks to everyone who directly contributed to this release:
- Adam Weiss
- Alex Morcos
- Casey Rodarmor
- Cory Fields
- fanquake
- Gregory Maxwell
- Jonas Schnelli
- J Ross Nicoll
- Luke Dashjr
- Pavel Vasin
- Pieter Wuille
- randy-waterhouse
- ฿tcDrak
- Tom Harding
- Veres Lajos
- Wladimir J. van der Laan
And all those who contributed additional code review and/or security research:
- timothy on IRC for reporting the issue
- Vulnerability in miniupnp discovered by Aleksandar Nikolic of Cisco Talos
As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/).
| {
"pile_set_name": "Github"
} |
package org.dddjava.jig.domain.model.identifier.type;
import org.assertj.core.api.Assertions;
import org.dddjava.jig.domain.model.jigmodel.lowmodel.declaration.package_.PackageIdentifier;
import org.dddjava.jig.domain.model.jigmodel.lowmodel.declaration.type.TypeIdentifier;
import org.dddjava.jig.domain.model.jigmodel.lowmodel.declaration.type.TypeIdentifiers;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
import static org.assertj.core.api.Assertions.assertThat;
class TypeIdentifiersTest {
@ParameterizedTest
@MethodSource
void test(List<String> identifiers, String simpleText) {
TypeIdentifiers sut = identifiers.stream().map(TypeIdentifier::new).collect(TypeIdentifiers.collector());
assertThat(sut.asSimpleText()).isEqualTo(simpleText);
}
static Stream<Arguments> test() {
return Stream.of(
Arguments.of(Collections.emptyList(), "[]"),
Arguments.of(Collections.singletonList("a.Hoge"), "[Hoge]"),
Arguments.of(Arrays.asList("a.Hoge", "a.Fuga"), "[Fuga, Hoge]"),
Arguments.of(Arrays.asList("a.Hoge", "a.Fuga", "a.Fuga"), "[Fuga, Hoge]"),
Arguments.of(Arrays.asList("a.Hoge", "a.Fuga", "b.Fuga"), "[Fuga, Fuga, Hoge]")
);
}
@ParameterizedTest
@MethodSource
void typeIdentifier_asSimpleText(String fullName, String simpleText) {
TypeIdentifier hoge = new TypeIdentifier(fullName);
assertThat(hoge.asSimpleText()).isEqualTo(simpleText);
}
static Stream<Arguments> typeIdentifier_asSimpleText() {
return Stream.of(
Arguments.of("hoge", "hoge"),
Arguments.of("hoge.fuga", "fuga"),
Arguments.of("hoge.fuga.Piyo", "Piyo"),
Arguments.of("hoge.fuga$foo", "fuga$foo")
);
}
@ParameterizedTest
@MethodSource
void typeIdentifier_packageIdentifier(String fullName, String packageName) {
TypeIdentifier hoge = new TypeIdentifier(fullName);
Assertions.assertThat(hoge.packageIdentifier()).isEqualTo(new PackageIdentifier(packageName));
}
static Stream<Arguments> typeIdentifier_packageIdentifier() {
return Stream.of(
Arguments.of("hoge", "(default)"),
Arguments.of("hoge.fuga", "hoge"),
Arguments.of("hoge.fuga.Piyo", "hoge.fuga"),
Arguments.of("hoge.fuga$foo", "hoge")
);
}
} | {
"pile_set_name": "Github"
} |
# 什么是突发性能实例 {#concept_n52_3v2_5db .concept}
突发性能实例可以利用CPU积分应对突发性能需求。本文介绍突发性能实例的特点,以及基准性能、CPU积分和性能模式。
## 突发性能实例应用场景 {#section_dom_pr6_2a9 .section}
在购买企业级等类型的实例后,您拥有实例vCPU的完全使用权,同时意味着无论CPU使用率是0%还是100%,您都需要为整个vCPU付费。如果您的业务场景规律,仅在特定的时段有较高的CPU性能需求,相当于在其它时段也在为未能使用的计算资源付费。这种情况下,您可以选择突发性能实例打造高性价比、经济实用的服务器。
突发性能实例适用于在某些时段对计算性能有突发性要求的场景,例如开发测试压测服务应用、轻负载应用、微服务、Web应用服务器等。购买前请评估业务在平峰期和高峰期的实例性能需求,至少选择基准性能满足平峰期需求的实例规格,选择得当可以在满足整体性能需求的同时节省成本。在售的突发性能实例规格请参见[突发性能实例规格族t5](#section_mq2_x7y_0jl)。
**说明:** 如果您在使用过程中发现所选突发性能实例规格无法满足需求,也可以进行[变配操作](#section_vg2_yxn_ore)。
## 突发性能实例特点 {#section_ih8_fr4_7vd .section}
突发性能实例可以持续获得CPU积分,在性能无法满足负载要求时,可以通过消耗更多CPU积分无缝提高计算性能,不会影响部署在实例上的环境和应用。基准性能和CPU积分是突发性能实例的基本概念,详情请参见[基准性能](#section_dpw_65z_7kv)、[获得CPU积分](#section_h4n_jgr_6b4)和[消耗CPU积分](#section_1wo_8vj_2yd)。
通过CPU积分,您可以从整体业务角度分配计算资源,将业务平峰期的计算能力转移到高峰期使用。如果偶尔会出现计划外的高性能需求,您还可以选择为突发性能实例打开无性能约束模式。
在性能约束模式下,如果没有可用的CPU积分,CPU使用率将无法超过基准性能。在无性能约束模式下,突发性能实例可以透支或付费使用CPU积分,在任意时间段保持高于基准性能的CPU使用率,但是可能会产生相应费用。更多性能模式说明,请参见[性能约束模式](#section_svb_w9d_dju)和[无性能约束模式](#section_i6c_2kn_y5s)。
## 突发性能实例规格族t5 {#section_mq2_x7y_0jl .section}
t5的特点如下:
- 支持IPv6
- 处理器:2.5 GHz主频的Intel ® Xeon ® 处理器
- 搭配DDR4内存
- 多种处理器和内存配比
- 可突然提速的vCPU,持续基本性能,受到vCPU积分的限制
- 计算、内存和网络资源的平衡
- 仅支持专有网络VPC
- 适用场景:
- Web应用服务器
- 轻负载应用、微服务
- 开发测试压测服务应用
t5包括的实例规格及指标数据如下:
|实例规格|vCPU|内存(GiB\)|平均基准CPU计算性能|CPU积分/小时|最大CPU积分余额|本地存储(GiB)|网络带宽能力(出/入)(Gbit/s)|网络收发包能力(出/入)(万PPS)|支持IPv6|多队列|弹性网卡(包括一块主网卡)|单块弹性网卡的私有IP|
|:---|:---|--------|:----------|:-------|:--------|---------|-------------------|------------------|:-----|---|:------------|-----------|
|ecs.t5-lc2m1.nano|1|0.5|10%|6|144|无|0.1|4|是|1|1|2|
|ecs.t5-lc1m1.small|1|1.0|10%|6|144|无|0.2|6|是|1|1|2|
|ecs.t5-lc1m2.small|1|2.0|10%|6|144|无|0.2|6|是|1|1|2|
|ecs.t5-lc1m2.large|2|4.0|10%|12|288|无|0.4|10|是|1|1|2|
|ecs.t5-lc1m4.large|2|8.0|10%|12|288|无|0.4|10|是|1|1|2|
|ecs.t5-c1m1.large|2|2.0|15%|18|432|无|0.5|10|是|1|1|2|
|ecs.t5-c1m2.large|2|4.0|15%|18|432|无|0.5|10|是|1|1|2|
|ecs.t5-c1m4.large|2|8.0|15%|18|432|无|0.5|10|是|1|1|2|
|ecs.t5-c1m1.xlarge|4|4.0|15%|36|864|无|0.8|20|是|1|2|6|
|ecs.t5-c1m2.xlarge|4|8.0|15%|36|864|无|0.8|20|是|1|2|6|
|ecs.t5-c1m4.xlarge|4|16.0|15%|36|864|无|0.8|20|是|1|2|6|
|ecs.t5-c1m1.2xlarge|8|8.0|15%|72|1728|无|1.2|40|是|1|2|6|
|ecs.t5-c1m2.2xlarge|8|16.0|15%|72|1728|无|1.2|40|是|1|2|6|
|ecs.t5-c1m4.2xlarge|8|32.0|15%|72|1728|无|1.2|40|是|1|2|6|
|ecs.t5-c1m1.4xlarge|16|16.0|15%|144|3456|无|1.2|60|是|1|2|6|
|ecs.t5-c1m2.4xlarge|16|32.0|15%|144|3456|无|1.2|60|是|1|2|6|
**说明:**
- t5实例热销中,详细信息请参见[产品页面](https://promotion.aliyun.com/ntms/act/creditinstancet5.html)。
- 您可以前往[ECS实例可购买地域](https://ecs-buy.aliyun.com/instanceTypes/#/instanceTypeByRegion),查看本实例的可购情况。
- 指标的含义请参见[实例规格指标说明](cn.zh-CN/实例/实例规格族.md#section_e9r_xkf_z15)。
## 基准性能 {#section_dpw_65z_7kv .section}
突发性能实例的基准性能由实例规格决定,基准性能是实例可以持续稳定地提供的CPU性能。CPU使用率等于基准性能时,突发性能实例获得的CPU积分和消耗的CPU积分相等。请参见[t5实例规格表](#section_mq2_x7y_0jl)的平均基准CPU计算性能列,该指标为单个vCPU的基准性能。
## 获得CPU积分 {#section_h4n_jgr_6b4 .section}
CPU积分可以视为您持有的计算能力,决定突发性能实例实际可以达到的计算性能。
为保证您开机后拥有CPU积分完成部署,创建一台突发性能实例后,每个vCPU会获得30个CPU积分,即初始CPU积分。例如,ecs.t5-lc1m2.large配有2个vCPU,新建实例拥有60个初始CPU积分。ecs.t5-c1m1.xlarge配有4个vCPU,新建实例拥有120个初始CPU积分。
突发性能实例开机后即消耗CPU积分维持计算性能,同时按固定速度获得CPU积分,CPU积分的获得速度由实例规格决定,单个vCPU每小时获得的CPU积分与基准性能对应,请参见[t5实例规格表](#section_mq2_x7y_0jl)的CPU积分/小时列,该指标为单台实例所有vCPU每小时可以获得的CPU积分。例如,ecs.t5-c1m1.large实例的基准性能为15%,表示每小时单vCPU持续获得CPU积分,可以供该vCPU以使用率15%运行1小时,以使用率100%运行9分钟(60\*15%)。与基准性能对应,每个vCPU每小时获得9个CPU积分,ecs.t5-c1m1.large实例有两个vCPU,因此每小时获得18个CPU积分。
如果获得的CPU积分大于消耗的CPU积分,多出的部分会保留,即CPU积分余额,CPU积分余额最多保存24小时,保持动态平衡。对指定实例规格来说,CPU积分获得速度是固定的,因此CPU积分余额有上限。CPU积分余额上限为指定实例规格24小时可以获得的CPU积分数,请参见[t5实例规格表](#section_mq2_x7y_0jl)的CPU最大积分余额列。例如,ecs.t5-c1m1.large实例每小时可以获得18个CPU积分,则CPU最大积分余额为432(18\*24)。
停机可能对获得CPU积分有影响:
- 实例停机但未开启实例停机不收费,当前CPU积分余额保留,并继续获得CPU积分。
- 实例停机且开启了实例停机不收费,当前CPU积分余额失效,不会继续获得CPU积分。重启实例后获得初始CPU积分,并开始获得CPU积分。
- 包年包月实例到期,当前CPU积分余额保留,但不会继续获得CPU积分。重开机后继续获得CPU积分 。
- 按量付费实例欠费,当前CPU积分余额保留,但不会继续获得CPU积分。结清按量付费账单后继续获得CPU积分 。
## 消耗CPU积分 {#section_1wo_8vj_2yd .section}
CPU积分的消耗速度和突发性能实例的vCPU数、CPU使用率和工作时间有关。例如,以下三种情况都会消耗掉1个CPU积分:
- 1个vCPU以100%使用率运行1分钟
- 1个vCPU以50%使用率运行2分钟
- 2个vCPU以25%使用率运行2分钟
突发性能实例开机后即消耗CPU积分维持计算性能,优先消耗初始CPU积分,初始CPU积分消耗完毕后不会恢复,之后只可消耗获得的CPU积分。
- 当CPU使用率低于基准性能时,消耗的CPU积分少于获得的CPU积分,CPU积分余额逐渐增加。
- 当CPU使用率等于基准性能时,消耗的CPU积分等于获得的CPU积分,CPU积分余额保持不变。
- 当CPU使用率高于基准性能时,消耗的CPU积分大于获得的CPU积分,CPU积分余额逐渐减少。
## 性能约束模式 {#section_svb_w9d_dju .section}
在性能约束模式下,突发性能实例的性能受CPU积分的约束。初始CPU积分和CPU积分余额消耗完毕后,实例性能将无法超过基准性能。但在CPU积分余额较少时,实例性能将在15分钟内逐渐下降到基准性能水平,保证CPU积分余额消耗完毕后,实例性能不会急剧下降。
**说明:** 性能约束模式下的实例性能和CPU积分的关系,请参见[CPU积分变化示例](cn.zh-CN/实例/选择实例规格/突发型/CPU积分变化示例.md#)。
性能约束模式适用于负载稳定,CPU使用率不会长时间超过基准性能,偶尔需要提高计算性能完成工作的场景,例如轻量级的Web服务器、开发测试环境、中低性能数据库等。
## 无性能约束模式 {#section_i6c_2kn_y5s .section}
在无性能约束模式下,突发性能实例可以突破可用CPU积分的约束,通过透支或付费使用CPU积分在任意时间段保持高于基准性能的CPU使用率。初始CPU积分和CPU积分余额消耗完毕后,如果实例的CPU使用率仍然高于基准性能,CPU积分变化如下图所示。其中:
- 预支CPU积分:未来24小时可以获得的CPU积分,可能会产生费用,请参见[性能模式对计费的影响](cn.zh-CN/实例/选择实例规格/突发型/突发性能实例计费.md#section_lqi_vqf_dsc)。
- 超额CPU积分:预支CPU积分消耗完毕后,继续维持高于基准性能的CPU使用率会使用的CPU积分,会产生费用,请参见[性能模式对计费的影响](cn.zh-CN/实例/选择实例规格/突发型/突发性能实例计费.md#section_lqi_vqf_dsc)。

**说明:** 无性能约束模式下的实例性能和CPU积分的关系,请参见[CPU积分变化示例](cn.zh-CN/实例/选择实例规格/突发型/CPU积分变化示例.md#)。
无性能约束模式适用于对CPU性能有突发使用,并且CPU积分余额无法满足需求,可能需要消耗预支CPU积分甚至超额CPU积分的场景。例如:
- 产品新功能发布、电商平台大促、网站承载推广活动等可预见会承接大量访问,并且必须在特定时间段内保持高性能的场景。您可以临时打开无性能约束模式,待高峰期结束后再关闭无性能约束模式降低成本。
- 某些网站应用负载高峰集中在固定时间段,但平均到24小时CPU使用率仍然低于基准性能的场景。您可以保持开启无性能约束模式,保证在高峰期的访问体验。如果在低访问量时段获得的CPU积分可以补齐消耗的预支CPU积分,就可以在保证网站整体访问体验的同时无需支付额外费用。
**说明:** 创建突发性能实例时,默认使用性能约束模式,相关操作请参见[打开无性能约束模式](cn.zh-CN/实例/选择实例规格/突发型/管理性能模式.md#section_cds_zh0_eh7)。
## 创建说明 {#section_zkq_nji_eef .section}
您可以通过[产品页](https://promotion.aliyun.com/ntms/act/creditinstancet5.html)或者[ECS管理控制台](https://ecs.console.aliyun.com/#/home)购买突发性能实例。
创建实例相关操作请参见[创建方式导航](cn.zh-CN/实例/创建实例/创建方式导航.md#)。在创建突发性能实例时,请注意以下设置:
- 实例规格:选择**x86计算** \> **入门级(共享)**,并选择合适的[突发性能实例规格](#section_mq2_x7y_0jl)。
- 实例规格:您可以在创建突发性能实例时勾选**打开t5实例无性能约束模式**,也可以在创建后[打开无性能约束模式](cn.zh-CN/实例/选择实例规格/突发型/管理性能模式.md#section_cds_zh0_eh7)。

- 镜像类型:最小t5实例规格的内存为0.5 GiB,仅支持安装Linux操作系统或Windows Server Version 1809操作系统,不支持Windows Server 2016等所需内存大于0.5 GiB的操作系统。更多信息,请参见[选择镜像](../../../../cn.zh-CN/镜像/选择镜像.md#)。
- 网络类型:仅支持**专有网络**。
## 变配说明 {#section_vg2_yxn_ore .section}
如果您在[监控突发性能实例](cn.zh-CN/实例/选择实例规格/突发型/监控突发性能实例.md#)时发现CPU使用率长期高于或者低于基准性能,说明该规格无法满足或者一直超过业务需求。建议您重新评估当前实例规格是否合适,并在需要时更换为其它突发性能实例或者企业级实例,更多信息请参见[可变配的实例规格](cn.zh-CN/实例/升降配实例/支持变配的实例规格.md#table_mpj_twq_wgb)。
变配操作和计费方式有关:
- 包年包月实例变配操作请参见[升降配](cn.zh-CN/实例/升降配实例/升降配方式汇总.md#)。
- 按量付费实例变配操作请参见[按量付费实例变更实例规格](cn.zh-CN/实例/升降配实例/升降配按量付费实例/按量付费实例变更实例规格.md#)。
## 突发性能实例基本概念 {#section_q81_jyk_xvl .section}
|基本概念|说明|示例|
|----|--|--|
|初始CPU积分|创建突发性能实例时一次性获得的CPU积分,固定为每vCPU 30个积分。|请参见[获得CPU积分](#section_h4n_jgr_6b4)。|
|CPU积分余额|突发性能实例持续获得的CPU积分超过消耗的CPU积分,即转化为CPU积分余额,用于将CPU使用率提升到基准性能以上。|请参见[获得CPU积分](#section_h4n_jgr_6b4)。|
|最大CPU积分余额|一台突发性能实例24小时可以获得的CPU积分,CPU积分余额最多保存24小时,保持动态平衡。对指定实例规格来说,CPU积分获得速度是固定的,因此CPU积分余额有上限。|请参见[获得CPU积分](#section_h4n_jgr_6b4)。|
|预支CPU积分|未来24小时可以获得的CPU积分,可能产生费用。仅在打开无性能约束模式时可以透支使用。|请参见[无性能约束模式](#section_i6c_2kn_y5s)。|
|超额CPU积分|预支CPU积分消耗完毕后,继续维持高于基准性能的CPU使用率会使用的CPU积分,产生费用。仅在打开无性能约束模式时可以使用。|请参见[无性能约束模式](#section_i6c_2kn_y5s)。|
| {
"pile_set_name": "Github"
} |
;
; ID_SD_A.ASM
; Id Sound Manager assembly stuff
.286C
IDEAL
MODEL MEDIUM,C
JUMPS
INCLUDE 'ID_SD.EQU'
DEBUG = 0
EXTRN SDL_DigitizedDone:FAR
EXTRN alOut:FAR
;============================================================================
DATASEG
EXTRN sqActive:WORD
EXTRN ssSample:DWORD
EXTRN ssLengthLeft:WORD
EXTRN ssControl:WORD
EXTRN ssStatus:WORD
EXTRN ssData:WORD
EXTRN ssOn:BYTE
EXTRN ssOff:BYTE
EXTRN pcSound:DWORD
EXTRN pcLengthLeft:WORD
EXTRN pcLastSample:BYTE
EXTRN pcSoundLookup:WORD
EXTRN alSound:DWORD
EXTRN alBlock:WORD
EXTRN alLengthLeft:WORD
EXTRN alTimeCount:DWORD
EXTRN sqHack:DWORD
EXTRN sqHackPtr:DWORD
EXTRN sqHackLen:WORD
EXTRN sqHackSeqLen:WORD
EXTRN sqHackTime:DWORD
EXTRN HackCount:WORD
EXTRN TimeCount:WORD
EXTRN LocalTime:WORD
EXTRN TimerCount:WORD
EXTRN TimerDivisor:WORD
EXTRN t0OldService:DWORD
EXTRN SoundMode:WORD
EXTRN DigiMode:WORD
EXTRN SoundNumber:WORD
EXTRN SoundPriority:WORD
count_time dw ?
count_fx dw ?
pcdtab db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
;============================================================================
CODESEG
MyDS dw ?
pcindicate dw ?
extreme dw ?
PROC SDL_SetDS
PUBLIC SDL_SetDS
mov ax,ds
mov [cs:MyDS],ds
ret
ENDP
;
; COMMONSTART
; Macro used for common prefix code
;
MACRO COMMONSTART
IF DEBUG
push dx
push ax
mov dx,STATUS_REGISTER_1
in al,dx
mov dx,ATR_INDEX
mov al,ATR_OVERSCAN
out dx,al
mov al,4 ; red
out dx,al
ENDIF
push ds
push ax
mov ds,[cs:MyDS]
inc [HackCount]
ENDM
;
; DOFX
; Macro used to do the sound effects code
;
MACRO DOFX
les di,[pcSound] ; PC sound effects
mov ax,es
or ax,di
jz @@nopc ; nil pointer - no PC sound effect going
mov bl,[es:di] ; Get the byte
inc [WORD PTR pcSound] ; Increment pointer
cmp [pcLastSample],bl ; Is this sample the same as last?
jz @@pcsame ; Yep - don't do anything
mov [pcLastSample],bl ; No, save it for next time
or bl,bl
jz @@pcoff ; If 0, turn sounds off
xor bh,bh
shl bx,1
mov bx,[pcSoundLookup+bx] ; Use byte as index into frequency table
mov al,0b6h ; Write to channel 2 (speaker) timer
out pcTAccess,al
mov al,bl
out pcTimer,al ; Low byte
mov al,bh
out pcTimer,al ; High byte
in al,pcSpeaker ; Turn the speaker & gate on
or al,3
out pcSpeaker,al
jmp @@pcsame
@@pcoff:
in al,pcSpeaker ; Turn the speaker & gate off
and al,0fch ; ~3
out pcSpeaker,al
@@pcsame:
dec [pcLengthLeft] ; Decrement length
jnz @@nopc ; If not 0, we're not done with the sound
mov ax,0
mov [WORD PTR pcSound],ax ; Zero the pointer
mov [WORD PTR pcSound + 2],ax
mov [SoundNumber],ax ; Indicate no sound
mov [SoundPriority],ax ; with no priority
in al,pcSpeaker ; Turn the speaker off
and al,0fdh ; ~2
out pcSpeaker,al
@@nopc:
les di,[alSound] ; AdLib sound effects
mov ax,es
or ax,di
jz @@noal ; nil pointer - no AdLib effect going
xor ah,ah
mov al,[es:di]
or al,al
jz @@aldone
CALL alOut C,alFreqL,ax
mov ax,[alBlock]
@@aldone:
CALL alOut C,alFreqH,ax
inc [WORD PTR alSound]
dec [alLengthLeft]
jnz @@noal
mov ax,0
mov [WORD PTR alSound],ax ; Zero the pointer
mov [WORD PTR alSound + 2],ax
mov [SoundNumber],ax ; Indicate no sound
mov [SoundPriority],ax ; with no priority
CALL alOut C,alFreqH,ax ; Turn off the sound
@@noal:
ENDM
;
;
;
MACRO TIME
cmp [count_time],2
jb @@notime
add [LocalTime],1
adc [LocalTime+2],0
add [TimeCount],1
adc [TimeCount+2],0
mov [count_time],0
@@notime:
ENDM
;
; COMMONEND
; Macro used for common suffix code
;
MACRO COMMONEND
@@fullexit:
pop es
popa
@@nosave:
mov ax,[TimerDivisor]
add [TimerCount],ax
jnc @@myack
pushf
call [t0OldService]
jmp @@out
@@myack:
mov al,20h
out 20h,al
@@out:
pop ax
pop ds
IF DEBUG
mov dx,STATUS_REGISTER_1
in al,dx
mov dx,ATR_INDEX
mov al,ATR_OVERSCAN
out dx,al
mov al,3 ; blue
out dx,al
mov al,20h ; normal
out dx,al
pop ax
pop dx
ENDIF
iret
ENDM
;
; SDL_IndicatePC
;
PROC SDL_IndicatePC on:WORD
PUBLIC SDL_IndicatePC
mov ax,[on]
mov [cs:pcindicate],ax
ret
ENDP
;
; SDL_t0ExtremeAsmService
; Timer 0 ISR 7000Hz interrupts
;
PROC SDL_t0ExtremeAsmService
PUBLIC SDL_t0ExtremeAsmService
push ax
mov al,[BYTE PTR cs:pcindicate]
or al,al
jz @@done
push ds
push es
pusha
mov ds,[cs:MyDS]
les di,[pcSound]
mov ax,es
or ax,di
jz @@donereg ; nil pointer
mov bl,[es:di] ; Get the byte
inc [WORD PTR pcSound] ; Increment pointer
and bl,11100000b ; Nuke some of the precision (DEBUG - do this in the table)
xor bh,bh
mov ah,[pcdtab+bx] ; Translate the byte
in al,pcSpeaker
and al,11111100b
or al,ah
out pcSpeaker,al
dec [pcLengthLeft]
jnz @@donereg
mov [WORD PTR pcSound],0 ; We're done with this sample
mov [WORD PTR pcSound+2],0
in al,pcSpeaker
and al,11111100b
out pcSpeaker,al
call SDL_DigitizedDone
@@donereg:
popa
pop es
pop ds
@@done:
inc [cs:extreme]
cmp [cs:extreme],10
jae @@tofast
mov al,20h
out 20h,al
pop ax
iret
@@tofast:
mov [cs:extreme],0
pop ax
; jmp SDL_t0FastAsmService ; Drops through to SDL_t0FastAsmService
ENDP
;
; SDL_t0FastAsmService
; Timer 0 ISR for 700Hz interrupts
;
PROC SDL_t0FastAsmService
PUBLIC SDL_t0FastAsmService
COMMONSTART
inc [count_fx] ; Time to do PC/AdLib effects & time?
cmp [count_fx],5
jae @@dofull
mov ax,[sqActive] ; Is the sequencer active?
or ax,ax
jnz @@dofull
mov ax,[WORD PTR ssSample] ; Is there a sample for the Sound Src?
or ax,[WORD PTR ssSample+2]
jz @@nosave
@@dofull:
pusha
push es
cmp [count_fx],5
jb @@nofx
mov [count_fx],0
DOFX
inc [count_time]
TIME
@@nofx:
mov ax,[sqActive]
or ax,ax
jz @@nosq
mov ax,[sqHackLen]
or ax,ax
jz @@sqdone
les di,[sqHackPtr]
@@sqloop:
mov ax,[WORD PTR sqHackTime+2]
cmp ax,[WORD PTR alTimeCount+2]
ja @@sqdone
mov ax,[WORD PTR sqHackTime]
cmp ax,[WORD PTR alTimeCount]
ja @@sqdone
mov ax,[es:di+2] ; Get time to next event
add ax,[WORD PTR alTimeCount]
mov [WORD PTR sqHackTime],ax
mov ax,[WORD PTR alTimeCount+2]
adc ax,0
mov [WORD PTR sqHackTime+2],ax
mov ax,[es:di] ; Get register/value pair
xor bh,bh
mov bl,ah
xor ah,ah
CALL alOut C,ax,bx
add di,4
mov [WORD PTR sqHackPtr],di
sub [sqHackLen],4
jnz @@sqloop
@@sqdone:
add [WORD PTR alTimeCount],1
adc [WORD PTR alTimeCount+2],0
mov ax,[sqHackLen]
or ax,ax
jnz @@nosq
mov ax,[WORD PTR sqHack] ; Copy pointer
mov [WORD PTR sqHackPtr],ax
mov ax,[WORD PTR sqHack+2]
mov [WORD PTR sqHackPtr+2],ax
mov ax,[sqHackSeqLen] ; Copy length
mov [sqHackLen],ax
mov ax,0
mov [WORD PTR alTimeCount],ax ; Reset time counts
mov [WORD PTR alTimeCount+2],ax
mov [WORD PTR sqHackTime],ax
mov [WORD PTR sqHackTime+2],ax
@@nosq:
les di,[ssSample] ; Get pointer to Sound Source sample
mov ax,es
or ax,di
jz @@ssdone ; If nil, skip this
@@ssloop:
mov dx,[ssStatus] ; Check to see if FIFO has any empty slots
in al,dx
test al,40h
jnz @@ssdone ; Nope - don't push any more data out
mov dx,[ssData]
mov al,[es:di] ; al = *ssSample
out dx,al ; Pump the value out
mov dx,[ssControl] ; Pulse printer select
mov al,[ssOff]
out dx,al
push ax
pop ax
mov al,[ssOn]
out dx,al
push ax ; Delay a short while
pop ax
inc di
mov [WORD PTR ssSample],di ; ssSample++
dec [ssLengthLeft]
jnz @@ssloop
mov [WORD PTR ssSample],0 ; We're done with this sample
mov [WORD PTR ssSample+2],0
call SDL_DigitizedDone
@@ssdone:
COMMONEND
ENDP
;
; SDL_t0SlowAsmService
; Timer 0 ISR for 140Hz interrupts
;
PROC SDL_t0SlowAsmService
PUBLIC SDL_t0SlowAsmService
IF DEBUG
push dx
push ax
mov dx,STATUS_REGISTER_1
in al,dx
mov dx,ATR_INDEX
mov al,ATR_OVERSCAN
out dx,al
mov al,4 ; red
out dx,al
ENDIF
push ds
push ax
mov ds,[cs:MyDS]
inc [count_time]
TIME
mov ax,[WORD PTR pcSound] ; Is there a PC sound effect going?
or ax,[WORD PTR pcSound+2]
jnz @@dofull
mov ax,[WORD PTR alSound] ; Is there an AdLib sound effect going?
or ax,[WORD PTR alSound+2]
jz @@nosave
@@dofull:
pusha
push es
DOFX
COMMONEND
ENDP
END
| {
"pile_set_name": "Github"
} |
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
*/
/** \file
* \ingroup balembic
*/
#ifndef __ABC_POINTS_H__
#define __ABC_POINTS_H__
#include "abc_object.h"
#include "abc_customdata.h"
struct ParticleSystem;
/* ************************************************************************** */
class AbcPointsWriter : public AbcObjectWriter {
Alembic::AbcGeom::OPointsSchema m_schema;
Alembic::AbcGeom::OPointsSchema::Sample m_sample;
ParticleSystem *m_psys;
public:
AbcPointsWriter(Object *ob,
AbcTransformWriter *parent,
uint32_t time_sampling,
ExportSettings &settings,
ParticleSystem *psys);
void do_write();
};
/* ************************************************************************** */
class AbcPointsReader : public AbcObjectReader {
Alembic::AbcGeom::IPointsSchema m_schema;
Alembic::AbcGeom::IPointsSchema::Sample m_sample;
public:
AbcPointsReader(const Alembic::Abc::IObject &object, ImportSettings &settings);
bool valid() const;
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
const Object *const ob,
const char **err_str) const;
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel);
struct Mesh *read_mesh(struct Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel,
int read_flag,
const char **err_str);
};
void read_points_sample(const Alembic::AbcGeom::IPointsSchema &schema,
const Alembic::AbcGeom::ISampleSelector &selector,
CDStreamConfig &config);
#endif /* __ABC_POINTS_H__ */
| {
"pile_set_name": "Github"
} |
3004 6 0 0 0 0 12 267516 + AK094917 3011 1 3011 chr5 180857866 75414994 75685520 13 99,681,181,152,134,90,111,89,165,134,204,160,810, 1,100,781,962,1114,1248,1338,1449,1538,1703,1837,2041,2201, 75414994,75463230,75526499,75541316,75616742,75617361,75622801,75623348,75627358,75630374,75632309,75632966,75684710,
1913 0 0 0 0 0 1 2323 - CR611640 1913 0 1913 chr5 180857866 75501665 75505901 2 684,1229, 0,684, 75501665,75504672,
1916 0 0 0 0 0 1 2323 - CR617598 1916 0 1916 chr5 180857866 75501665 75505904 2 684,1232, 0,684, 75501665,75504672,
1929 0 0 0 0 0 1 2323 - CR590134 1929 0 1929 chr5 180857866 75501665 75505917 2 684,1245, 0,684, 75501665,75504672,
1938 0 0 0 0 0 1 2323 - CR593875 1938 0 1938 chr5 180857866 75501666 75505927 2 683,1255, 0,683, 75501666,75504672,
1546 0 0 0 0 0 1 2323 - CR605282 1546 0 1546 chr5 180857866 75501670 75505539 2 679,867, 0,679, 75501670,75504672,
1894 0 0 0 0 0 1 2323 - CR594687 1894 0 1894 chr5 180857866 75501686 75505903 2 663,1231, 0,663, 75501686,75504672,
| {
"pile_set_name": "Github"
} |
import os
import re
from tqdm import tqdm
import subprocess
import shutil
from .base import BaseTrainer
from ..helper import thirdparty_binary, make_path_safe
from ..multiprocessing import (align, mono_align_equal, compile_train_graphs,
acc_stats, tree_stats, convert_alignments,
convert_ali_to_textgrids, calc_fmllr,
compile_information)
class TriphoneTrainer(BaseTrainer):
'''
Configuration class for triphone training
Attributes
----------
num_iterations : int
Number of training iterations to perform, defaults to 40
transition_scale : float
Scaling of transition costs in alignment, defaults to 1.0
acoustic_scale : float
Scaling of acoustic costs in alignment, defaults to 0.1
self_loop_scale : float
Scaling of self loop costs in alignment, defaults to 0.1
beam : int
Default beam width for alignment, defaults = 10
retry_beam : int
Beam width to fall back on if no alignment is produced, defaults to 40
max_gaussians : int
Total number of gaussians, defaults to 1000
boost_silence : float
Factor by which to boost silence likelihoods in alignment, defaults to 1.0
realignment_iterations : list
List of iterations to perform alignment
power : float
Exponent for number of gaussians according to occurrence counts, defaults to 0.25
num_leaves : int
Number of states in the decision tree, defaults to 1000
max_gaussians : int
Number of gaussians in the decision tree, defaults to 10000
cluster_threshold : int
For build-tree control final bottom-up clustering of leaves, defaults to 100
'''
def __init__(self, default_feature_config):
super(TriphoneTrainer, self).__init__(default_feature_config)
self.num_iterations = 35
self.num_leaves = 1000
self.max_gaussians = 10000
self.cluster_threshold = -1
self.compute_calculated_properties()
def compute_calculated_properties(self):
for i in range(0, self.num_iterations, 10):
if i == 0:
continue
self.realignment_iterations.append(i)
self.initial_gaussians = self.num_leaves
@property
def train_type(self):
return 'tri'
@property
def phone_type(self):
return 'triphone'
def init_training(self, identifier, temporary_directory, corpus, dictionary, previous_trainer):
self._setup_for_init(identifier, temporary_directory, corpus, dictionary)
if os.path.exists(os.path.join(self.train_directory, 'final.mdl')):
return
align_directory = previous_trainer.align_directory
context_opts = []
ci_phones = self.dictionary.silence_csl
tree_stats(self.train_directory, align_directory,
self.data_directory, ci_phones, self.corpus.num_jobs, self)
log_path = os.path.join(self.log_directory, 'questions.log')
tree_path = os.path.join(self.train_directory, 'tree')
treeacc_path = os.path.join(self.train_directory, 'treeacc')
sets_int_path = os.path.join(self.dictionary.phones_dir, 'sets.int')
roots_int_path = os.path.join(self.dictionary.phones_dir, 'roots.int')
extra_question_int_path = os.path.join(self.dictionary.phones_dir, 'extra_questions.int')
topo_path = os.path.join(self.dictionary.output_directory, 'topo')
questions_path = os.path.join(self.train_directory, 'questions.int')
questions_qst_path = os.path.join(self.train_directory, 'questions.qst')
with open(log_path, 'w') as logf:
subprocess.call([thirdparty_binary('cluster-phones')] + context_opts +
[treeacc_path, sets_int_path, questions_path], stderr=logf)
with open(extra_question_int_path, 'r') as inf, \
open(questions_path, 'a') as outf:
for line in inf:
outf.write(line)
log_path = os.path.join(self.log_directory, 'compile_questions.log')
with open(log_path, 'w') as logf:
subprocess.call([thirdparty_binary('compile-questions')] + context_opts +
[topo_path, questions_path, questions_qst_path],
stderr=logf)
log_path = os.path.join(self.log_directory, 'build_tree.log')
with open(log_path, 'w') as logf:
subprocess.call([thirdparty_binary('build-tree')] + context_opts +
['--verbose=1', '--max-leaves={}'.format(self.initial_gaussians),
'--cluster-thresh={}'.format(self.cluster_threshold),
treeacc_path, roots_int_path, questions_qst_path,
topo_path, tree_path], stderr=logf)
log_path = os.path.join(self.log_directory, 'init_model.log')
occs_path = os.path.join(self.train_directory, '0.occs')
mdl_path = os.path.join(self.train_directory, '0.mdl')
with open(log_path, 'w') as logf:
subprocess.call([thirdparty_binary('gmm-init-model'),
'--write-occs=' + occs_path, tree_path, treeacc_path,
topo_path, mdl_path], stderr=logf)
log_path = os.path.join(self.log_directory, 'mixup.log')
with open(log_path, 'w') as logf:
subprocess.call([thirdparty_binary('gmm-mixup'),
'--mix-up={}'.format(self.initial_gaussians),
mdl_path, occs_path, mdl_path], stderr=logf)
os.remove(treeacc_path)
compile_train_graphs(self.train_directory, self.dictionary.output_directory,
self.data_directory, self.corpus.num_jobs)
os.rename(occs_path, os.path.join(self.train_directory, '1.occs'))
os.rename(mdl_path, os.path.join(self.train_directory, '1.mdl'))
convert_alignments(self.train_directory, align_directory, self.corpus.num_jobs)
print('Initialization complete!') | {
"pile_set_name": "Github"
} |
// Generated by CoffeeScript 1.9.1
(function() {
var XMLProcessingInstruction, create;
create = require('lodash/object/create');
module.exports = XMLProcessingInstruction = (function() {
function XMLProcessingInstruction(parent, target, value) {
this.stringify = parent.stringify;
if (target == null) {
throw new Error("Missing instruction target");
}
this.target = this.stringify.insTarget(target);
if (value) {
this.value = this.stringify.insValue(value);
}
}
XMLProcessingInstruction.prototype.clone = function() {
return create(XMLProcessingInstruction.prototype, this);
};
XMLProcessingInstruction.prototype.toString = function(options, level) {
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
pretty = (options != null ? options.pretty : void 0) || false;
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
level || (level = 0);
space = new Array(level + offset + 1).join(indent);
r = '';
if (pretty) {
r += space;
}
r += '<?';
r += this.target;
if (this.value) {
r += ' ' + this.value;
}
r += '?>';
if (pretty) {
r += newline;
}
return r;
};
return XMLProcessingInstruction;
})();
}).call(this);
| {
"pile_set_name": "Github"
} |
{
"name": "autoMessageService",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"date-utils": "^1.2.21",
"wx-server-sdk": "^1.8.2"
}
}
| {
"pile_set_name": "Github"
} |
/* Copyright (c) 2006-2015 Jonas Fonseca <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef TIG_HELP_H
#define TIG_HELP_H
#include "tig/view.h"
extern struct view help_view;
static inline void
open_help_view(struct view *prev, enum open_flags flags)
{
open_view(prev, &help_view, flags);
}
#endif
/* vim: set ts=8 sw=8 noexpandtab: */
| {
"pile_set_name": "Github"
} |
<?php
namespace AlibabaCloud\Client\Signature;
/**
* Class BearerTokenSignature
*
* @package AlibabaCloud\Signature
*/
class BearerTokenSignature extends Signature implements SignatureInterface
{
/**
* @return string
*/
public function getMethod()
{
return '';
}
/**
* @return string
*/
public function getType()
{
return 'BEARERTOKEN';
}
/**
* @return string
*/
public function getVersion()
{
return '1.0';
}
/**
* @param string $string
* @param string $accessKeySecret
*
* @return string
*/
public function sign($string, $accessKeySecret)
{
return '';
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.