text stringlengths 2 99k | meta dict |
|---|---|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/spdy/spdy_pinnable_buffer_piece.h"
namespace net {
SpdyPinnableBufferPiece::SpdyPinnableBufferPiece()
: buffer_(0), length_(0) {}
SpdyPinnableBufferPiece::~SpdyPinnableBufferPiece() {}
void SpdyPinnableBufferPiece::Pin() {
if (!storage_ && buffer_ != NULL && length_ != 0) {
storage_.reset(new char[length_]);
std::copy(buffer_, buffer_ + length_, storage_.get());
buffer_ = storage_.get();
}
}
void SpdyPinnableBufferPiece::Swap(SpdyPinnableBufferPiece* other) {
size_t length = length_;
length_ = other->length_;
other->length_ = length;
const char* buffer = buffer_;
buffer_ = other->buffer_;
other->buffer_ = buffer;
storage_.swap(other->storage_);
}
} // namespace net
| {
"pile_set_name": "Github"
} |
# foreach
Iterate over the key value pairs of either an array-like object or a dictionary like object.
[![browser support][1]][2]
## API
### foreach(object, function, [context])
```js
var each = require('foreach');
each([1,2,3], function (value, key, array) {
// value === 1, 2, 3
// key === 0, 1, 2
// array === [1, 2, 3]
});
each({0:1,1:2,2:3}, function (value, key, object) {
// value === 1, 2, 3
// key === 0, 1, 2
// object === {0:1,1:2,2:3}
});
```
[1]: https://ci.testling.com/manuelstofer/foreach.png
[2]: https://ci.testling.com/manuelstofer/foreach
| {
"pile_set_name": "Github"
} |
import { Group3DFacade, Object3DFacade } from 'troika-3d'
import {
BackSide,
Color,
CylinderBufferGeometry,
Mesh,
MeshBasicMaterial,
Plane,
PlaneBufferGeometry,
SphereBufferGeometry,
Vector3
} from 'three'
import { createDerivedMaterial } from 'troika-three-utils'
const tempColor = new Color()
const tempPlane = new Plane()
const hsv2rgb_glsl = `
// From https://github.com/hughsk/glsl-hsv2rgb
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
`
// From https://gist.github.com/xpansive/1241234
function hsv2rgb (a, b, c, d, e, f) {
d = a * 6 % 1
f = [c, -c * d * b + c, e = -c * b + c, e, c * d * b + e, c]
return [f[d = a * 6 | 0], f[(4 + d) % 6], f[(2 + d) % 6]]
}
// Adapted from https://github.com/Qix-/color-convert
function rgb2hsv (r, g, b) {
let rdif
let gdif
let bdif
let h
let s
const v = Math.max(r, g, b)
const diff = v - Math.min(r, g, b)
const diffc = function (c) {
return (v - c) / 6 / diff + 1 / 2
}
if (diff === 0) {
h = 0
s = 0
} else {
s = diff / v
rdif = diffc(r)
gdif = diffc(g)
bdif = diffc(b)
if (r === v) {
h = bdif - gdif
} else if (g === v) {
h = (1 / 3) + rdif - bdif
} else if (b === v) {
h = (2 / 3) + gdif - rdif
}
if (h < 0) {
h += 1
} else if (h > 1) {
h -= 1
}
}
return [h, s, v]
}
const cylinderGeometry = new CylinderBufferGeometry(0.5, 0.5, 1, 45)
.translate(0, 0.5, 0)
.rotateX(Math.PI / 2)
.rotateZ(Math.PI / 2) //orient uv
const cylinderMaterial = createDerivedMaterial(new MeshBasicMaterial({side: 2}), {
uniforms: {
maxValue: {value: 1}
},
vertexDefs: `
varying vec3 vPos;
`,
vertexMainIntro: `
vPos = position;
`,
fragmentDefs: `
uniform float maxValue;
varying vec3 vPos;
${hsv2rgb_glsl}
`,
fragmentColorTransform: `
float angle = atan(vPos.y, vPos.x) / PI2;
float radius = length(vPos.xy) * 2.0;
float value = vPos.z * maxValue;
vec3 hsv = vec3(angle, radius, value);
vec3 rgb = hsv2rgb(hsv);
gl_FragColor.xyz = rgb;
`
})
/**
* Cylinder representing `hue` + `saturation` on its top disc surface and `value`
* with its height.
*/
class HsvCylinder extends Object3DFacade {
constructor (parent) {
super(parent, new Mesh(
cylinderGeometry,
cylinderMaterial.clone()
))
this.maxValue = 1
}
afterUpdate () {
this.threeObject.material.uniforms.maxValue.value = this.maxValue
super.afterUpdate()
}
}
/**
* Backside-only full height cylinder serving to hold visual shape of full cylinder
* height when the main cylinder is shorter:
*/
class HsvCylinderBg extends Object3DFacade {
constructor (parent) {
const material = cylinderMaterial.clone()
material.transparent = true
material.opacity = 0.5
material.side = BackSide
super(parent, new Mesh(
cylinderGeometry,
material
))
}
}
class ValueStick extends Object3DFacade {
constructor (parent) {
const ballGeom = new SphereBufferGeometry(0.05, 16, 12)
.translate(0, 0, 0.5)
const stickGeom = new CylinderBufferGeometry(0.005, 0.005, 0.5, 6)
.translate(0, 0.25, 0).rotateX(Math.PI / 2)
const material = new MeshBasicMaterial()
const mesh = new Mesh(ballGeom, material)
mesh.add(new Mesh(stickGeom, new MeshBasicMaterial({color: 0xcccccc})))
super(parent, mesh)
}
afterUpdate () {
this.threeObject.material.color.set(this.color)
super.afterUpdate()
}
}
class ValuePlane extends Object3DFacade {
constructor (parent) {
const material = createDerivedMaterial(new MeshBasicMaterial({
transparent: true,
color: 0xffffff,
polygonOffset: true,
polygonOffsetFactor: 1
}), {
vertexDefs: 'varying vec2 vUV;',
vertexMainIntro: 'vUV = uv;',
fragmentDefs: 'varying vec2 vUV;',
fragmentColorTransform: `
float dist = min(min(vUV.x, 1.0 - vUV.x), min(vUV.y, 1.0 - vUV.y));
gl_FragColor.w *= 1.0 - 0.5 * smoothstep(0.0, 0.1, dist);
`
})
super(parent, new Mesh(
new PlaneBufferGeometry(),
material
))
}
afterUpdate () {
this.threeObject.material.opacity = this.opacity
super.afterUpdate()
}
}
class ColorPickerFacade extends Group3DFacade {
constructor (parent) {
super(parent)
this.cylinderHeight = 0.5
this.cylinderDiameter = 0.75
// Tilt down so user can see both relevant dimensions
// TODO can/should we automatically update this to match camera position?
this.rotateX = -Math.PI / 4
// Handle click/drag on surface of cylinder:
const onHueSaturationDrag = e => {
const obj = e.currentTarget.threeObject
const ray = e.ray
tempPlane.normal.set(0, 0, -1)
tempPlane.constant = 1 //top of cylinder
tempPlane.applyMatrix4(obj.matrixWorld)
const intersection = ray.intersectPlane(tempPlane, new Vector3())
if (intersection) {
obj.worldToLocal(intersection)
const x = intersection.x * 2
const y = (intersection.y) * 2
let angle = Math.atan2(y, x) / Math.PI / 2 //0-1
while (angle < 0) angle += 1
let radius = Math.min(1, Math.sqrt(x * x + y * y))
const hsv = this._getHSV()
hsv[0] = angle
hsv[1] = radius
this._updateHSV(hsv, e.shiftKey)
}
}
// Move hsv value up and down with scroll wheel:
this.onWheel = e => {
const hsv = this._getHSV()
hsv[2] = Math.max(0, Math.min(1, hsv[2] + e.nativeEvent.deltaY / 100))
this._updateHSV(hsv, false)
}
this.children = [
this.cylinderDef = {
key: 'disc',
facade: HsvCylinder,
onMouseDown: onHueSaturationDrag,
onDragStart: onHueSaturationDrag,
onDrag: onHueSaturationDrag
},
this.cylinderBgDef = {
facade: HsvCylinderBg,
renderOrder: 9
},
this.planeDef = {
facade: ValuePlane,
renderOrder: 10,
opacity: 0.3,
pointerStates: {
hover: {opacity: 0.4}
},
transition: {opacity: true},
onDragStart: e => {
this._dragData = {
plane: new Plane().setFromNormalAndCoplanarPoint(
new Vector3(0, 1, 0).transformDirection(this.threeObject.matrixWorld),
e.intersection.point
)
}
},
onDrag: e => {
const {plane} = this._dragData
const coplanarPoint = e.ray.intersectPlane(plane, new Vector3())
this.threeObject.worldToLocal(coplanarPoint)
const hsv = this._getHSV()
hsv[2] = Math.max(0, Math.min(1,
coplanarPoint.z / this.cylinderHeight
))
this._updateHSV(hsv, e.shiftKey)
},
onDragEnd: e => {
this._dragData = null
}
},
this.stickDef = {
facade: ValueStick
}
]
}
_getHSV () {
let hsv = [0, 0, 0]
if (this.value != null) {
tempColor.set(this.value)
hsv = rgb2hsv(tempColor.r, tempColor.g, tempColor.b)
}
return hsv
}
_updateHSV (hsv, websafe) {
const rgb = hsv2rgb(...hsv)
tempColor.setRGB(...rgb)
if (websafe) {
tempColor.r = Math.round(tempColor.r * 5) / 5
tempColor.g = Math.round(tempColor.g * 5) / 5
tempColor.b = Math.round(tempColor.b * 5) / 5
}
this.onChange(tempColor.getHex())
}
afterUpdate () {
const {stickDef, cylinderDef, cylinderBgDef, planeDef, cylinderHeight, cylinderDiameter} = this
const hsv = this._getHSV()
// find x/y on disc for hue + saturation:
const angle = hsv[0] * Math.PI * 2
const radius = hsv[1] / 2 * cylinderDiameter
const x = Math.cos(angle) * radius
const y = Math.sin(angle) * radius
stickDef.x = x
stickDef.y = y
stickDef.z = hsv[2] * cylinderHeight
stickDef.color = this.value
cylinderDef.maxValue = hsv[2]
cylinderDef.scale = cylinderDiameter
cylinderDef.scaleZ = hsv[2] * cylinderHeight + 0.00001 //never zero scale
cylinderBgDef.scale = cylinderDiameter
cylinderBgDef.scaleZ = cylinderHeight
planeDef.z = hsv[2] * cylinderHeight
super.afterUpdate()
}
}
export default ColorPickerFacade
| {
"pile_set_name": "Github"
} |
/**
* External dependencies
*/
import { expect } from 'chai';
/**
* Internal dependencies
*/
import getJetpackModules from 'state/selectors/get-jetpack-modules';
import { moduleData as MODULE_DATA_FIXTURE } from './fixtures/jetpack-modules';
describe( 'getJetpackModules()', () => {
test( 'should return data for all modules for a known site', () => {
const stateIn = {
jetpack: {
modules: {
items: {
123456: MODULE_DATA_FIXTURE,
},
},
},
},
siteId = 123456;
const output = getJetpackModules( stateIn, siteId );
expect( output ).to.eql( MODULE_DATA_FIXTURE );
} );
test( 'should return null for an unknown site', () => {
const stateIn = {
jetpack: {
modules: {
items: {
654321: MODULE_DATA_FIXTURE,
},
},
},
},
siteId = 123456;
const output = getJetpackModules( stateIn, siteId );
expect( output ).to.be.null;
} );
} );
| {
"pile_set_name": "Github"
} |
<H2 CLASS="title">Печать пробной страницы на {printer_name}</H2>
<P>Пробная страница отправлена на печать;Номер задания <A HREF="/{SECTION}/{printer_name}">
{printer_name}-{job_id}</A>.</P>
| {
"pile_set_name": "Github"
} |
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
Header header
actionlib_msgs/GoalStatus status
ReactivePlaceFeedback feedback
| {
"pile_set_name": "Github"
} |
<TeXmacs|1.99.5>
<style|<tuple|article|literate>>
<\body>
<\hide-preamble>
\;
</hide-preamble>
<\show-part|1>
\;
<\cpp-chunk|OnlyForTest.cpp|false|false>
#include\<less\>stdio.h\<gtr\>
int main() {
}
</cpp-chunk>
</show-part|>
</body>
<initial|<\collection>
</collection>>
<\references>
<\collection>
<associate|chunk-OnlyForTest.cpp-1|<tuple|OnlyForTest.cpp|?|#1>>
</collection>
</references> | {
"pile_set_name": "Github"
} |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,race linux,race freebsd,race
package unix
import (
"runtime"
"unsafe"
)
const raceenabled = true
func raceAcquire(addr unsafe.Pointer) {
runtime.RaceAcquire(addr)
}
func raceReleaseMerge(addr unsafe.Pointer) {
runtime.RaceReleaseMerge(addr)
}
func raceReadRange(addr unsafe.Pointer, len int) {
runtime.RaceReadRange(addr, len)
}
func raceWriteRange(addr unsafe.Pointer, len int) {
runtime.RaceWriteRange(addr, len)
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<!--
Copyright World Wide Web Consortium, (Massachusetts Institute of
Technology, Institut National de Recherche en Informatique et en
Automatique, Keio University).
All Rights Reserved.
Please see the full Copyright clause at
<http://www.w3.org/Consortium/Legal/copyright-software.html>
Description: tests parseType="Literal" with a simple string and
and the xml:lang attribute.
Related issue:
http://www.w3.org/2000/03/rdf-tracking/#rdfms-literal-is-xml-structure
$Id: test002.rdf,v 1.2 2005-08-04 09:53:24 jeremy_carroll Exp $
-->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<rdf:Description rdf:about="http://www.example.org">
<eg:property xml:lang="en-US" rdf:parseType="Literal">well-formed XML</eg:property>
</rdf:Description>
</rdf:RDF>
| {
"pile_set_name": "Github"
} |
#!/bin/bash
# /usr/libexec/iiab-startup.sh is AUTOEXEC.BAT for IIAB
# (put initializations here, if needed on every boot)
if [ ! -f /etc/iiab/uuid ]; then
uuidgen > /etc/iiab/uuid
echo "/etc/iiab/uuid was MISSING, so a new one was generated."
fi
# Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease"
# Sets wlan0 to promiscuous on boot if needed as gateway (i.e. AP's OFF).
# Manually run iiab-hotspot-[on|off] to toggle AP & boot flag hostapd_enabled
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
if [[ $(grep -i raspbian /etc/*release) &&
#($(grep "hostapd_enabled = False" /etc/iiab/config_vars.yml) ||
#((! $(grep "hostapd_enabled = True" /etc/iiab/config_vars.yml)) &&
! $(grep "^HOSTAPD_ENABLED=True" {{ iiab_env_file }}) ]];
# NEGATED LOGIC HELPS FORCE PROMISCUOUS MODE EARLY IN INSTALL
# (when network/tasks/main.yml hasn't yet populated iiab.env)
# RESULT: WiFi-installed IIAB should have wlan0 properly in
# promiscuous mode Even On Reboots (if 2-common completed!)
# CAUTION: roles/network/tasks/main.yml (e.g. if you run
# ./iiab-network, "./runtags network", or ./iiab-install)
# can toggle your hostapd_enabled setting if it detects a
# different "primary gateway" (eth0 vs. wlan0 vs. none) to the
# Internet -- even if you have not run iiab-hotspot-on|off !
#)
#)
#]];
then
# ip link set dev wlan0 promisc on
echo "wlan0 promiscuous mode ON, internal AP OFF: github.com/iiab/iiab/issues/638 DISABLED"
fi
exit 0
| {
"pile_set_name": "Github"
} |
#
# Makefile for the Switch device API
#
obj-$(CONFIG_NET_SWITCHDEV) += switchdev.o
| {
"pile_set_name": "Github"
} |
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Id>813c46f6-08f8-4905-a9c0-f5a2beceeb3e</Id>
<Status>OK</Status>
<ProviderName>Demo AU</ProviderName>
<DateTimeUTC>2011-05-31T01:31:06.1955046Z</DateTimeUTC>
<Invoices>
<Invoice>
<Contact>
<ContactID>0f471ca5-15c9-405e-a1b9-7cc35194b673</ContactID>
<ContactStatus>ACTIVE</ContactStatus>
<Name>Party Hire</Name>
<Addresses>
<Address>
<AddressType>STREET</AddressType>
</Address>
<Address>
<AddressType>POBOX</AddressType>
</Address>
</Addresses>
<Phones>
<Phone>
<PhoneType>DDI</PhoneType>
</Phone>
<Phone>
<PhoneType>FAX</PhoneType>
</Phone>
<Phone>
<PhoneType>DEFAULT</PhoneType>
</Phone>
<Phone>
<PhoneType>MOBILE</PhoneType>
</Phone>
</Phones>
<UpdatedDateUTC>2011-05-06T23:32:25.04</UpdatedDateUTC>
<IsSupplier>true</IsSupplier>
<IsCustomer>false</IsCustomer>
</Contact>
<Date>2011-03-20T00:00:00</Date>
<DueDate>2011-03-27T00:00:00</DueDate>
<Status>PAID</Status>
<LineAmountTypes>Exclusive</LineAmountTypes>
<LineItems>
<LineItem>
<Description>Glasses, jugs, ice buckets, patters etc for client function</Description>
<UnitAmount>250.00</UnitAmount>
<TaxType>NONE</TaxType>
<TaxAmount>0.00</TaxAmount>
<LineAmount>250.00</LineAmount>
<AccountCode>420</AccountCode>
<Quantity>1.0000</Quantity>
</LineItem>
<LineItem>
<Description>Refundable bond for return of clean</Description>
<UnitAmount>200.00</UnitAmount>
<TaxType>NONE</TaxType>
<TaxAmount>0.00</TaxAmount>
<LineAmount>200.00</LineAmount>
<AccountCode>420</AccountCode>
<Quantity>1.0000</Quantity>
</LineItem>
</LineItems>
<SubTotal>450.00</SubTotal>
<TotalTax>0.00</TotalTax>
<Total>450.00</Total>
<UpdatedDateUTC>2008-09-24T16:15:18.42</UpdatedDateUTC>
<CurrencyCode>AUD</CurrencyCode>
<FullyPaidOnDate>2011-04-04T00:00:00</FullyPaidOnDate>
<Type>ACCPAY</Type>
<InvoiceID>7dae876a-b424-436b-a4e6-17b3fdeec80c</InvoiceID>
<Payments>
<Payment>
<PaymentID>4662b9f6-7ed0-4f2a-b3a2-107c1d66b4ce</PaymentID>
<Date>2011-04-04T00:00:00</Date>
<Amount>250.00</Amount>
<Reference>DD Ref 112974</Reference>
</Payment>
</Payments>
<CreditNotes>
<CreditNote>
<Date>2011-04-21T00:00:00</Date>
<Total>200.00</Total>
<CreditNoteID>4f67130a-749a-4ee6-98b2-743adbc11245</CreditNoteID>
</CreditNote>
</CreditNotes>
<AmountDue>0.00</AmountDue>
<AmountPaid>250.00</AmountPaid>
<AmountCredited>200.00</AmountCredited>
<SentToContact>false</SentToContact>
</Invoice>
</Invoices>
</Response> | {
"pile_set_name": "Github"
} |
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<room>
<caption></caption>
<width>384</width>
<height>216</height>
<vsnap>16</vsnap>
<hsnap>16</hsnap>
<isometric>0</isometric>
<speed>60</speed>
<persistent>0</persistent>
<colour>12632256</colour>
<showcolour>0</showcolour>
<code></code>
<enableViews>-1</enableViews>
<clearViewBackground>0</clearViewBackground>
<clearDisplayBuffer>-1</clearDisplayBuffer>
<makerSettings>
<isSet>-1</isSet>
<w>1124</w>
<h>953</h>
<showGrid>-1</showGrid>
<showObjects>-1</showObjects>
<showTiles>-1</showTiles>
<showBackgrounds>-1</showBackgrounds>
<showForegrounds>-1</showForegrounds>
<showViews>0</showViews>
<deleteUnderlyingObj>-1</deleteUnderlyingObj>
<deleteUnderlyingTiles>-1</deleteUnderlyingTiles>
<page>0</page>
<xoffset>0</xoffset>
<yoffset>0</yoffset>
</makerSettings>
<backgrounds>
<background visible="-1" foreground="0" name="bg_logo" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
</backgrounds>
<views>
<view visible="-1" objName="<undefined>" xview="0" yview="0" wview="384" hview="216" xport="0" yport="0" wport="384" hport="216" hborder="184" vborder="100" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="<undefined>" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
</views>
<instances>
<instance objName="obj_persistent" x="0" y="0" name="inst_5074C778" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
</instances>
<tiles/>
<PhysicsWorld>0</PhysicsWorld>
<PhysicsWorldTop>0</PhysicsWorldTop>
<PhysicsWorldLeft>0</PhysicsWorldLeft>
<PhysicsWorldRight>640</PhysicsWorldRight>
<PhysicsWorldBottom>480</PhysicsWorldBottom>
<PhysicsWorldGravityX>0</PhysicsWorldGravityX>
<PhysicsWorldGravityY>10</PhysicsWorldGravityY>
<PhysicsWorldPixToMeters>0.100000001490116</PhysicsWorldPixToMeters>
</room>
| {
"pile_set_name": "Github"
} |
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package nl.bzk.brp.model.data.kern;
import nl.bzk.brp.model.data.kern.PlaatsDataOnDemand;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect PlaatsDataOnDemand_Roo_Configurable {
declare @type: PlaatsDataOnDemand: @Configurable;
}
| {
"pile_set_name": "Github"
} |
/*
Bootstrap - File Input
======================
This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
Converts all
<input type="file">
into Bootstrap buttons
<a class="btn">Browse</a>
*/
$(function() {
$.fn.bootstrapFileInput = function() {
this.each(function(i,elem){
var $elem = $(elem);
// Maybe some fields don't need to be standardized.
if (typeof $elem.attr('data-bfi-disabled') != 'undefined') {
return;
}
// Set the word to be displayed on the button
var buttonWord = 'Browse';
if (typeof $elem.attr('title') != 'undefined') {
buttonWord = $elem.attr('title');
}
// Start by getting the HTML of the input element.
// Thanks for the tip http://stackoverflow.com/a/1299069
var input = $('<div>').append( $elem.eq(0).clone() ).html();
var className = '';
if (!!$elem.attr('class')) {
className = ' ' + $elem.attr('class');
}
// Now we're going to replace that input field with a Bootstrap button.
// The input will actually still be there, it will just be float above and transparent (done with the CSS).
$elem.replaceWith('<a class="file-input-wrapper btn' + className + '">'+buttonWord+input+'</a>');
})
// After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
// This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh.
.promise().done( function(){
// As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor.
// This gives us the pointer cursor that FF denies us
$('.file-input-wrapper').mousemove(function(cursor) {
var input, wrapper,
wrapperX, wrapperY,
inputWidth, inputHeight,
cursorX, cursorY;
// This wrapper element (the button surround this file input)
wrapper = $(this);
// The invisible file input element
input = wrapper.find("input");
// The left-most position of the wrapper
wrapperX = wrapper.offset().left;
// The top-most position of the wrapper
wrapperY = wrapper.offset().top;
// The with of the browsers input field
inputWidth= input.width();
// The height of the browsers input field
inputHeight= input.height();
//The position of the cursor in the wrapper
cursorX = cursor.pageX;
cursorY = cursor.pageY;
//The positions we are to move the invisible file input
// The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle
moveInputX = cursorX - wrapperX - inputWidth + 20;
// Slides the invisible input Browse button to be positioned middle under the cursor
moveInputY = cursorY- wrapperY - (inputHeight/2);
// Apply the positioning styles to actually move the invisible file input
input.css({
left:moveInputX,
top:moveInputY
});
});
$('.file-input-wrapper input[type=file]').change(function(){
var fileName;
fileName = $(this).val();
// Remove any previous file names
$(this).parent().next('.file-input-name').remove();
if (!!$(this).prop('files') && $(this).prop('files').length > 1) {
fileName = $(this)[0].files.length+' files';
//$(this).parent().after('<span class="file-input-name">'+$(this)[0].files.length+' files</span>');
}
else {
// var fakepath = 'C:\\fakepath\\';
// fileName = $(this).val().replace('C:\\fakepath\\','');
fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length);
}
$(this).parent().after('<span class="file-input-name">'+fileName+'</span>');
});
});
};
// Add the styles before the first stylesheet
// This ensures they can be easily overridden with developer styles
var cssHtml = '<style>'+
'.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
'.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover { position: absolute; top: 0; left: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0); z-index: 99; outline: 0; }'+
'.file-input-name { margin-left: 8px; }'+
'</style>';
$('link[rel=stylesheet]').eq(0).before(cssHtml);
});
| {
"pile_set_name": "Github"
} |
#ifndef __ARCH_ARM_FAULT_H
#define __ARCH_ARM_FAULT_H
/*
* Fault status register encodings. We steal bit 31 for our own purposes.
*/
#define FSR_LNX_PF (1 << 31)
#define FSR_WRITE (1 << 11)
#define FSR_FS4 (1 << 10)
#define FSR_FS3_0 (15)
#define FSR_FS5_0 (0x3f)
#ifdef CONFIG_ARM_LPAE
static inline int fsr_fs(unsigned int fsr)
{
return fsr & FSR_FS5_0;
}
#else
static inline int fsr_fs(unsigned int fsr)
{
return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6;
}
#endif
void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
unsigned long search_exception_table(unsigned long addr);
#endif /* __ARCH_ARM_FAULT_H */
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2019 Xilinx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file hash_semi_join.hpp
* @brief hash join template function implementation, targeting HBM devices.
*
* The limitations are:
* (1) less than 2M entries from inner table.
* (2) max number of key with same hash is less than 256K.
*
* This file is part of Vitis Database Library.
*/
#ifndef XF_DATABASE_HASH_SEMI_JOIN_MPU_H
#define XF_DATABASE_HASH_SEMI_JOIN_MPU_H
#ifndef __cplusplus
#error "Vitis Database Library only works with C++."
#endif
#include "ap_int.h"
#include "hls_stream.h"
#include "xf_database/hash_join_v2.hpp"
// FIXME For debug
#ifndef __SYNTHESIS__
#include <iostream>
#endif
namespace xf {
namespace database {
namespace details {
namespace hash_semi_join {
// ------------------------------------------------------------
/// @brief compare key, if match, output the joined row from outer table only once.
// that is to say, if a key in outer table matches with many keys in inner table,
// the corresonding row of outer table is output once.
template <int WPayload, int WKey>
void semi_join_unit(hls::stream<ap_uint<WKey> >& inner_row_istrm,
hls::stream<ap_uint<WKey> >& outer_key_istrm,
hls::stream<ap_uint<WPayload> >& outer_playload_istrm,
hls::stream<ap_uint<18> >& nm_istrm,
hls::stream<bool>& outer_end_istrm,
hls::stream<ap_uint<WPayload> >& join_ostrm,
hls::stream<bool>& join_end_ostrm) {
ap_uint<WKey> inner_key = 0;
ap_uint<WKey> outer_key = 0;
ap_uint<WPayload> outer_payload = 0;
bool last = outer_end_istrm.read();
ap_uint<18> nm = 0;
bool matched = false;
#ifndef __SYNTHESIS__
unsigned int cnt = 0;
#endif
JOIN_LOOP:
while (!last) {
#pragma HLS PIPELINE II = 1
if (nm == 0) {
last = outer_end_istrm.read();
outer_payload = outer_playload_istrm.read();
outer_key = outer_key_istrm.read();
nm = nm_istrm.read();
matched = false;
} else {
nm--;
ap_uint<WKey> stb_row = inner_row_istrm.read();
inner_key = stb_row(WKey - 1, 0);
if (inner_key == outer_key && false == matched) {
matched = true; // if match, set the flag to true in case of output more times.
ap_uint<WPayload> j = 0;
j(WPayload - 1, 0) = outer_payload;
join_ostrm.write(j);
join_end_ostrm.write(false);
#ifndef __SYNTHESIS__
cnt++;
#endif
}
}
}
if (nm != 0) {
JOIN_CLEAR_LOOP:
for (int i = 0; i < nm; i++) {
#pragma HLS PIPELINE II = 1
ap_uint<WKey> stb_row = inner_row_istrm.read();
inner_key = stb_row(WKey - 1, 0);
if (inner_key == outer_key && false == matched) {
matched = true;
ap_uint<WPayload> j = 0;
j(WPayload - 1, 0) = outer_payload;
join_ostrm.write(j);
join_end_ostrm.write(false);
#ifndef __SYNTHESIS__
cnt++;
#endif
}
}
}
join_ostrm.write(0);
join_end_ostrm.write(true);
#ifndef __SYNTHESIS__
std::cout << " Semi Join Unit output " << cnt << " rows" << std::endl;
#endif
} // semi_join_unit
} // namespace hash_semi_join
} // namespace details
} // namespace database
} // namespace xf
namespace xf {
namespace database {
/**
* @brief Multi-PU Hash-Semi-Join primitive, using multiple DDR/HBM buffers.
*
* The max number of lines of inner table is 2M in this design.
* It is assumed that the hash-conflict is within 256K per bin.
*
* This module can accept more than 1 input row per cycle, via multiple
* input channels.
* The outer table and the inner table share the same input ports,
* so the width of the payload should be the max of both, while the data
* should be aligned to the little-end.
* The inner table should be fed TWICE, followed by the outer table ONCE.
*
* @tparam HashMode 0 for radix and 1 for Jenkin's Lookup3 hash.
* @tparam WKey width of key, in bit.
* @tparam WPayload width of payload of outer table.
* @tparam WHashHigh number of hash bits used for PU/buffer selection, 1~3.
* @tparam WhashLow number of hash bits used for hash-table in PU.
* @tparam WTmpBufferAddress width of address, log2(inner table max num of rows).
* @tparam WTmpBuffer width of buffer.
* @tparam NChannels number of input channels, 1,2,4.
* @tparam WBloomFilter bloom-filter hash width.
* @tparam EnBloomFilter bloom-filter switch, 0 for off, 1 for on.
*
* @param key_istrms input of key columns of both tables.
* @param payload_istrms input of payload columns of both tables.
* @param e0_strm_arry input of end signal of both tables.
* @param pu0_tmp_rwtpr HBM/DDR buffer of PU0
* @param pu1_tmp_rwptr HBM/DDR buffer of PU1
* @param pu2_tmp_rwptr HBM/DDR buffer of PU2
* @param pu3_tmp_rwptr HBM/DDR buffer of PU3
* @param pu4_tmp_rwptr HBM/DDR buffer of PU4
* @param pu5_tmp_rwptr HBM/DDR buffer of PU5
* @param pu6_tmp_rwptr HBM/DDR buffer of PU6
* @param pu7_tmp_rwptr HBM/DDR buffer of PU7
* @param join_ostrm output of joined rows.
* @param end_ostrm end signal of joined rows.
*/
template <int HashMode,
int WKey,
int WPayload,
int WHashHigh,
int WhashLow,
int WTmpBufferAddress,
int WTmpBuffer,
int NChannels,
int WBloomFilter,
int EnBloomFilter>
static void hashSemiJoin(hls::stream<ap_uint<WKey> > key_istrms[NChannels],
hls::stream<ap_uint<WPayload> > payload_istrms[NChannels],
hls::stream<bool> e0_strm_arry[NChannels],
ap_uint<WTmpBuffer>* pu0_tmp_rwtpr,
ap_uint<WTmpBuffer>* pu1_tmp_rwptr,
ap_uint<WTmpBuffer>* pu2_tmp_rwptr,
ap_uint<WTmpBuffer>* pu3_tmp_rwptr,
ap_uint<WTmpBuffer>* pu4_tmp_rwptr,
ap_uint<WTmpBuffer>* pu5_tmp_rwptr,
ap_uint<WTmpBuffer>* pu6_tmp_rwptr,
ap_uint<WTmpBuffer>* pu7_tmp_rwptr,
hls::stream<ap_uint<WPayload> >& join_ostrm,
hls::stream<bool>& end_ostrm) {
enum { HDP_J = (1 << (WhashLow - 2)) }; // 4 entries per slot, so -2.
enum { PU = (1 << WHashHigh) }; // high hash for distribution.
#pragma HLS dataflow
hls::stream<ap_uint<WKey> > k1_strm_arry[PU];
#pragma HLS stream variable = k1_strm_arry depth = 8
#pragma HLS array_partition variable = k1_strm_arry dim = 0
hls::stream<ap_uint<WPayload> > p1_strm_arry[PU];
#pragma HLS stream variable = p1_strm_arry depth = 8
#pragma HLS array_partition variable = p1_strm_arry dim = 0
#pragma HLS resource variable = p1_strm_arry core = FIFO_SRL
hls::stream<ap_uint<WhashLow> > hash_strm_arry[PU];
#pragma HLS stream variable = hash_strm_arry depth = 8
#pragma HLS array_partition variable = hash_strm_arry dim = 0
hls::stream<bool> e1_strm_arry[PU];
#pragma HLS stream variable = e1_strm_arry depth = 8
#pragma HLS array_partition variable = e1_strm_arry dim = 0
// NChannels >= 1
hls::stream<ap_uint<WKey> > k1_strm_arry_c0[PU];
#pragma HLS stream variable = k1_strm_arry_c0 depth = 8
#pragma HLS array_partition variable = k1_strm_arry_c0 dim = 0
hls::stream<ap_uint<WPayload> > p1_strm_arry_c0[PU];
#pragma HLS stream variable = p1_strm_arry_c0 depth = 8
#pragma HLS array_partition variable = p1_strm_arry_c0 dim = 0
#pragma HLS resource variable = p1_strm_arry_c0 core = FIFO_SRL
hls::stream<ap_uint<WhashLow> > hash_strm_arry_c0[PU];
#pragma HLS stream variable = hash_strm_arry_c0 depth = 8
#pragma HLS array_partition variable = hash_strm_arry_c0 dim = 0
hls::stream<bool> e1_strm_arry_c0[PU];
#pragma HLS stream variable = e1_strm_arry_c0 depth = 8
#pragma HLS array_partition variable = e1_strm_arry_c0 dim = 0
// NChannels >= 2
hls::stream<ap_uint<WKey> > k1_strm_arry_c1[PU];
#pragma HLS stream variable = k1_strm_arry_c1 depth = 8
#pragma HLS array_partition variable = k1_strm_arry_c1 dim = 0
hls::stream<ap_uint<WPayload> > p1_strm_arry_c1[PU];
#pragma HLS stream variable = p1_strm_arry_c1 depth = 8
#pragma HLS array_partition variable = p1_strm_arry_c1 dim = 0
#pragma HLS resource variable = p1_strm_arry_c1 core = FIFO_SRL
hls::stream<ap_uint<WhashLow> > hash_strm_arry_c1[PU];
#pragma HLS stream variable = hash_strm_arry_c1 depth = 8
#pragma HLS array_partition variable = hash_strm_arry_c1 dim = 0
hls::stream<bool> e1_strm_arry_c1[PU];
#pragma HLS stream variable = e1_strm_arry_c1 depth = 8
#pragma HLS array_partition variable = e1_strm_arry_c1 dim = 0
// NChannels >= 4
hls::stream<ap_uint<WKey> > k1_strm_arry_c2[PU];
#pragma HLS stream variable = k1_strm_arry_c2 depth = 8
#pragma HLS array_partition variable = k1_strm_arry_c2 dim = 0
hls::stream<ap_uint<WPayload> > p1_strm_arry_c2[PU];
#pragma HLS stream variable = p1_strm_arry_c2 depth = 8
#pragma HLS array_partition variable = p1_strm_arry_c2 dim = 0
#pragma HLS resource variable = p1_strm_arry_c2 core = FIFO_SRL
hls::stream<ap_uint<WhashLow> > hash_strm_arry_c2[PU];
#pragma HLS stream variable = hash_strm_arry_c2 depth = 8
#pragma HLS array_partition variable = hash_strm_arry_c2 dim = 0
hls::stream<bool> e1_strm_arry_c2[PU];
#pragma HLS stream variable = e1_strm_arry_c2 depth = 8
#pragma HLS array_partition variable = e1_strm_arry_c2 dim = 0
hls::stream<ap_uint<WKey> > k1_strm_arry_c3[PU];
#pragma HLS stream variable = k1_strm_arry_c3 depth = 8
#pragma HLS array_partition variable = k1_strm_arry_c3 dim = 0
hls::stream<ap_uint<WPayload> > p1_strm_arry_c3[PU];
#pragma HLS stream variable = p1_strm_arry_c3 depth = 8
#pragma HLS array_partition variable = p1_strm_arry_c3 dim = 0
#pragma HLS resource variable = p1_strm_arry_c3 core = FIFO_SRL
hls::stream<ap_uint<WhashLow> > hash_strm_arry_c3[PU];
#pragma HLS stream variable = hash_strm_arry_c3 depth = 8
#pragma HLS array_partition variable = hash_strm_arry_c3 dim = 0
hls::stream<bool> e1_strm_arry_c3[PU];
#pragma HLS stream variable = e1_strm_arry_c3 depth = 8
#pragma HLS array_partition variable = e1_strm_arry_c3 dim = 0
hls::stream<ap_uint<WKey> > w_row_strm[PU];
#pragma HLS stream variable = w_row_strm depth = 8
#pragma HLS array_partition variable = w_row_strm dim = 0
hls::stream<ap_uint<WKey> > r_row_strm[PU];
#pragma HLS stream variable = r_row_strm depth = 8
hls::stream<ap_uint<WKey> > k2_strm_arry[PU];
#pragma HLS stream variable = k2_strm_arry depth = 32
#pragma HLS array_partition variable = k2_strm_arry dim = 0
#pragma HLS resource variable = k2_strm_arry core = FIFO_SRL
hls::stream<ap_uint<WPayload> > p2_strm_arry[PU];
#pragma HLS stream variable = p2_strm_arry depth = 32
#pragma HLS array_partition variable = p2_strm_arry dim = 0
#pragma HLS resource variable = p2_strm_arry core = FIFO_SRL
hls::stream<bool> e2_strm_arry[PU];
#pragma HLS stream variable = e2_strm_arry depth = 8
#pragma HLS array_partition variable = e2_strm_arry dim = 0
hls::stream<bool> e3_strm_arry[PU];
#pragma HLS stream variable = e3_strm_arry depth = 32
#pragma HLS array_partition variable = e3_strm_arry dim = 0
hls::stream<bool> e4_strm_arry[PU];
#pragma HLS array_partition variable = e4_strm_arry dim = 0
#pragma HLS stream variable = e4_strm_arry depth = 8
hls::stream<ap_uint<WTmpBufferAddress> > addr_strm[PU];
#pragma HLS stream variable = raddr_strm depth = 8
#pragma HLS array_partition variable = raddr_strm dim = 0
hls::stream<ap_uint<18> > nm0_strm_arry[PU];
#pragma HLS stream variable = nm0_strm_arry depth = 32
#pragma HLS array_partition variable = nm0_strm_arry dim = 0
hls::stream<ap_uint<WPayload> > j0_strm_arry[PU];
#pragma HLS stream variable = j0_strm_arry depth = 8
#pragma HLS array_partition variable = j0_strm_arry dim = 0
#pragma HLS resource variable = j0_strm_arry core = FIFO_SRL
#ifndef __SYNTHESIS__
ap_uint<72>* bit_vector0[PU];
ap_uint<72>* bit_vector1[PU];
ap_uint<72>* bit_vector2[PU];
ap_uint<72>* bit_vector3[PU];
for (int i = 0; i < PU; i++) {
bit_vector0[i] = (ap_uint<72>*)malloc((HDP_J >> 2) * sizeof(ap_uint<72>));
bit_vector1[i] = (ap_uint<72>*)malloc((HDP_J >> 2) * sizeof(ap_uint<72>));
bit_vector2[i] = (ap_uint<72>*)malloc((HDP_J >> 2) * sizeof(ap_uint<72>));
bit_vector3[i] = (ap_uint<72>*)malloc((HDP_J >> 2) * sizeof(ap_uint<72>));
}
#else
ap_uint<72> bit_vector0[PU][(HDP_J >> 2)];
ap_uint<72> bit_vector1[PU][(HDP_J >> 2)];
ap_uint<72> bit_vector2[PU][(HDP_J >> 2)];
ap_uint<72> bit_vector3[PU][(HDP_J >> 2)];
#pragma HLS array_partition variable = bit_vector0 dim = 1
#pragma HLS resource variable = bit_vector0 core = RAM_2P_URAM
#pragma HLS array_partition variable = bit_vector1 dim = 1
#pragma HLS resource variable = bit_vector1 core = RAM_2P_URAM
#pragma HLS array_partition variable = bit_vector2 dim = 1
#pragma HLS resource variable = bit_vector2 core = RAM_2P_URAM
#pragma HLS array_partition variable = bit_vector3 dim = 1
#pragma HLS resource variable = bit_vector3 core = RAM_2P_URAM
#endif
// clang-format off
// -------------|----------|------------|------|------|------|--------
// Dispatch | |Bloom Filter|Bitmap|Build |Probe |
// -------------| |------------|------|------|------|
// Dispatch | switcher |Bloom filter|Bitmap|Build |Probe |Collect
// -------------| |------------|------|------|------|
// Dispatch | |Bloom filter|Bitmap|Build |Porbe |
// -------------|----------|------------|------|------|------|--------
// clang-format on
;
if (NChannels >= 1) {
details::join_v2::dispatch_wrapper<HashMode, WKey, WPayload, WHashHigh, WhashLow, PU, WBloomFilter,
EnBloomFilter>(key_istrms[0], payload_istrms[0], e0_strm_arry[0],
k1_strm_arry_c0, p1_strm_arry_c0, hash_strm_arry_c0,
e1_strm_arry_c0);
}
if (NChannels >= 2) {
details::join_v2::dispatch_wrapper<HashMode, WKey, WPayload, WHashHigh, WhashLow, PU, WBloomFilter,
EnBloomFilter>(key_istrms[1], payload_istrms[1], e0_strm_arry[1],
k1_strm_arry_c1, p1_strm_arry_c1, hash_strm_arry_c1,
e1_strm_arry_c1);
}
if (NChannels >= 4) {
details::join_v2::dispatch_wrapper<HashMode, WKey, WPayload, WHashHigh, WhashLow, PU, WBloomFilter,
EnBloomFilter>(key_istrms[2], payload_istrms[2], e0_strm_arry[2],
k1_strm_arry_c2, p1_strm_arry_c2, hash_strm_arry_c2,
e1_strm_arry_c2);
details::join_v2::dispatch_wrapper<HashMode, WKey, WPayload, WHashHigh, WhashLow, PU, WBloomFilter,
EnBloomFilter>(key_istrms[3], payload_istrms[3], e0_strm_arry[3],
k1_strm_arry_c3, p1_strm_arry_c3, hash_strm_arry_c3,
e1_strm_arry_c3);
}
if (NChannels == 1) {
for (int p = 0; p < PU; ++p) {
#pragma HLS unroll
details::join_v2::merge1_1_wrapper(k1_strm_arry_c0[p], p1_strm_arry_c0[p], hash_strm_arry_c0[p],
e1_strm_arry_c0[p], k1_strm_arry[p], p1_strm_arry[p], hash_strm_arry[p],
e1_strm_arry[p]);
}
}
if (NChannels == 2) {
for (int p = 0; p < PU; p++) {
#pragma HLS unroll
details::join_v2::merge2_1_wrapper(k1_strm_arry_c0[p], k1_strm_arry_c1[p], p1_strm_arry_c0[p],
p1_strm_arry_c1[p], hash_strm_arry_c0[p], hash_strm_arry_c1[p],
e1_strm_arry_c0[p], e1_strm_arry_c1[p], k1_strm_arry[p], p1_strm_arry[p],
hash_strm_arry[p], e1_strm_arry[p]);
}
}
if (NChannels == 4) {
for (int p = 0; p < PU; p++) {
#pragma HLS unroll
details::join_v2::merge4_1_wrapper(
k1_strm_arry_c0[p], k1_strm_arry_c1[p], k1_strm_arry_c2[p], k1_strm_arry_c3[p], p1_strm_arry_c0[p],
p1_strm_arry_c1[p], p1_strm_arry_c2[p], p1_strm_arry_c3[p], hash_strm_arry_c0[p], hash_strm_arry_c1[p],
hash_strm_arry_c2[p], hash_strm_arry_c3[p], e1_strm_arry_c0[p], e1_strm_arry_c1[p], e1_strm_arry_c2[p],
e1_strm_arry_c3[p], k1_strm_arry[p], p1_strm_arry[p], hash_strm_arry[p], e1_strm_arry[p]);
}
}
for (int i = 0; i < PU; i++) {
#pragma HLS unroll
details::join_v2::build_probe_wrapper<WhashLow, WKey, WPayload, 0, WTmpBufferAddress>(
hash_strm_arry[i], k1_strm_arry[i], p1_strm_arry[i], e1_strm_arry[i], w_row_strm[i], k2_strm_arry[i],
p2_strm_arry[i], addr_strm[i], nm0_strm_arry[i], e2_strm_arry[i], e3_strm_arry[i], bit_vector0[i],
bit_vector1[i], bit_vector2[i], bit_vector3[i]);
}
if (PU >= 4) {
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu0_tmp_rwtpr, addr_strm[0], w_row_strm[0],
e2_strm_arry[0], r_row_strm[0]);
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu1_tmp_rwptr, addr_strm[1], w_row_strm[1],
e2_strm_arry[1], r_row_strm[1]);
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu2_tmp_rwptr, addr_strm[2], w_row_strm[2],
e2_strm_arry[2], r_row_strm[2]);
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu3_tmp_rwptr, addr_strm[3], w_row_strm[3],
e2_strm_arry[3], r_row_strm[3]);
}
if (PU >= 8) {
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu4_tmp_rwptr, addr_strm[4], w_row_strm[4],
e2_strm_arry[4], r_row_strm[4]);
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu5_tmp_rwptr, addr_strm[5], w_row_strm[5],
e2_strm_arry[5], r_row_strm[5]);
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu6_tmp_rwptr, addr_strm[6], w_row_strm[6],
e2_strm_arry[6], r_row_strm[6]);
details::join_v2::access_srow<WTmpBuffer, WTmpBufferAddress, WKey>(pu7_tmp_rwptr, addr_strm[7], w_row_strm[7],
e2_strm_arry[7], r_row_strm[7]);
}
for (int i = 0; i < PU; i++) {
#pragma HLS unroll
details::hash_semi_join::semi_join_unit<WPayload, WKey>(r_row_strm[i], k2_strm_arry[i], p2_strm_arry[i],
nm0_strm_arry[i], e3_strm_arry[i], j0_strm_arry[i],
e4_strm_arry[i]);
}
// Collect
details::join_v2::collect_unit<PU, WPayload>(j0_strm_arry, e4_strm_arry, join_ostrm, end_ostrm);
} // hash_semi_join
} // namespace database
} // namespace xf
#endif // !defined(XF_DATABASE_HASH_SEMI_JOIN_MPU_H)
| {
"pile_set_name": "Github"
} |
/*
* linux/fs/affs/inode.c
*
* (c) 1996 Hans-Joachim Widmaier - Rewritten
*
* (C) 1993 Ray Burr - Modified for Amiga FFS filesystem.
*
* (C) 1992 Eric Youngdale Modified for ISO9660 filesystem.
*
* (C) 1991 Linus Torvalds - minix filesystem
*/
#include <linux/sched.h>
#include <linux/gfp.h>
#include "affs.h"
extern const struct inode_operations affs_symlink_inode_operations;
struct inode *affs_iget(struct super_block *sb, unsigned long ino)
{
struct affs_sb_info *sbi = AFFS_SB(sb);
struct buffer_head *bh;
struct affs_tail *tail;
struct inode *inode;
u32 block;
u32 size;
u32 prot;
u16 id;
inode = iget_locked(sb, ino);
if (!inode)
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
return inode;
pr_debug("affs_iget(%lu)\n", inode->i_ino);
block = inode->i_ino;
bh = affs_bread(sb, block);
if (!bh) {
affs_warning(sb, "read_inode", "Cannot read block %d", block);
goto bad_inode;
}
if (affs_checksum_block(sb, bh) || be32_to_cpu(AFFS_HEAD(bh)->ptype) != T_SHORT) {
affs_warning(sb,"read_inode",
"Checksum or type (ptype=%d) error on inode %d",
AFFS_HEAD(bh)->ptype, block);
goto bad_inode;
}
tail = AFFS_TAIL(sb, bh);
prot = be32_to_cpu(tail->protect);
inode->i_size = 0;
set_nlink(inode, 1);
inode->i_mode = 0;
AFFS_I(inode)->i_extcnt = 1;
AFFS_I(inode)->i_ext_last = ~1;
AFFS_I(inode)->i_protect = prot;
atomic_set(&AFFS_I(inode)->i_opencnt, 0);
AFFS_I(inode)->i_blkcnt = 0;
AFFS_I(inode)->i_lc = NULL;
AFFS_I(inode)->i_lc_size = 0;
AFFS_I(inode)->i_lc_shift = 0;
AFFS_I(inode)->i_lc_mask = 0;
AFFS_I(inode)->i_ac = NULL;
AFFS_I(inode)->i_ext_bh = NULL;
AFFS_I(inode)->mmu_private = 0;
AFFS_I(inode)->i_lastalloc = 0;
AFFS_I(inode)->i_pa_cnt = 0;
if (sbi->s_flags & SF_SETMODE)
inode->i_mode = sbi->s_mode;
else
inode->i_mode = prot_to_mode(prot);
id = be16_to_cpu(tail->uid);
if (id == 0 || sbi->s_flags & SF_SETUID)
inode->i_uid = sbi->s_uid;
else if (id == 0xFFFF && sbi->s_flags & SF_MUFS)
i_uid_write(inode, 0);
else
i_uid_write(inode, id);
id = be16_to_cpu(tail->gid);
if (id == 0 || sbi->s_flags & SF_SETGID)
inode->i_gid = sbi->s_gid;
else if (id == 0xFFFF && sbi->s_flags & SF_MUFS)
i_gid_write(inode, 0);
else
i_gid_write(inode, id);
switch (be32_to_cpu(tail->stype)) {
case ST_ROOT:
inode->i_uid = sbi->s_uid;
inode->i_gid = sbi->s_gid;
/* fall through */
case ST_USERDIR:
if (be32_to_cpu(tail->stype) == ST_USERDIR ||
sbi->s_flags & SF_SETMODE) {
if (inode->i_mode & S_IRUSR)
inode->i_mode |= S_IXUSR;
if (inode->i_mode & S_IRGRP)
inode->i_mode |= S_IXGRP;
if (inode->i_mode & S_IROTH)
inode->i_mode |= S_IXOTH;
inode->i_mode |= S_IFDIR;
} else
inode->i_mode = S_IRUGO | S_IXUGO | S_IWUSR | S_IFDIR;
/* Maybe it should be controlled by mount parameter? */
//inode->i_mode |= S_ISVTX;
inode->i_op = &affs_dir_inode_operations;
inode->i_fop = &affs_dir_operations;
break;
case ST_LINKDIR:
#if 0
affs_warning(sb, "read_inode", "inode is LINKDIR");
goto bad_inode;
#else
inode->i_mode |= S_IFDIR;
/* ... and leave ->i_op and ->i_fop pointing to empty */
break;
#endif
case ST_LINKFILE:
affs_warning(sb, "read_inode", "inode is LINKFILE");
goto bad_inode;
case ST_FILE:
size = be32_to_cpu(tail->size);
inode->i_mode |= S_IFREG;
AFFS_I(inode)->mmu_private = inode->i_size = size;
if (inode->i_size) {
AFFS_I(inode)->i_blkcnt = (size - 1) /
sbi->s_data_blksize + 1;
AFFS_I(inode)->i_extcnt = (AFFS_I(inode)->i_blkcnt - 1) /
sbi->s_hashsize + 1;
}
if (tail->link_chain)
set_nlink(inode, 2);
inode->i_mapping->a_ops = (sbi->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
inode->i_op = &affs_file_inode_operations;
inode->i_fop = &affs_file_operations;
break;
case ST_SOFTLINK:
inode->i_mode |= S_IFLNK;
inode->i_op = &affs_symlink_inode_operations;
inode->i_data.a_ops = &affs_symlink_aops;
break;
}
inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec
= (be32_to_cpu(tail->change.days) * (24 * 60 * 60) +
be32_to_cpu(tail->change.mins) * 60 +
be32_to_cpu(tail->change.ticks) / 50 +
((8 * 365 + 2) * 24 * 60 * 60)) +
sys_tz.tz_minuteswest * 60;
inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0;
affs_brelse(bh);
unlock_new_inode(inode);
return inode;
bad_inode:
affs_brelse(bh);
iget_failed(inode);
return ERR_PTR(-EIO);
}
int
affs_write_inode(struct inode *inode, struct writeback_control *wbc)
{
struct super_block *sb = inode->i_sb;
struct buffer_head *bh;
struct affs_tail *tail;
uid_t uid;
gid_t gid;
pr_debug("write_inode(%lu)\n", inode->i_ino);
if (!inode->i_nlink)
// possibly free block
return 0;
bh = affs_bread(sb, inode->i_ino);
if (!bh) {
affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino);
return -EIO;
}
tail = AFFS_TAIL(sb, bh);
if (tail->stype == cpu_to_be32(ST_ROOT)) {
secs_to_datestamp(inode->i_mtime.tv_sec,&AFFS_ROOT_TAIL(sb, bh)->root_change);
} else {
tail->protect = cpu_to_be32(AFFS_I(inode)->i_protect);
tail->size = cpu_to_be32(inode->i_size);
secs_to_datestamp(inode->i_mtime.tv_sec,&tail->change);
if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) {
uid = i_uid_read(inode);
gid = i_gid_read(inode);
if (AFFS_SB(sb)->s_flags & SF_MUFS) {
if (uid == 0 || uid == 0xFFFF)
uid = uid ^ ~0;
if (gid == 0 || gid == 0xFFFF)
gid = gid ^ ~0;
}
if (!(AFFS_SB(sb)->s_flags & SF_SETUID))
tail->uid = cpu_to_be16(uid);
if (!(AFFS_SB(sb)->s_flags & SF_SETGID))
tail->gid = cpu_to_be16(gid);
}
}
affs_fix_checksum(sb, bh);
mark_buffer_dirty_inode(bh, inode);
affs_brelse(bh);
affs_free_prealloc(inode);
return 0;
}
int
affs_notify_change(struct dentry *dentry, struct iattr *attr)
{
struct inode *inode = dentry->d_inode;
int error;
pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid);
error = inode_change_ok(inode,attr);
if (error)
goto out;
if (((attr->ia_valid & ATTR_UID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETUID)) ||
((attr->ia_valid & ATTR_GID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETGID)) ||
((attr->ia_valid & ATTR_MODE) &&
(AFFS_SB(inode->i_sb)->s_flags & (SF_SETMODE | SF_IMMUTABLE)))) {
if (!(AFFS_SB(inode->i_sb)->s_flags & SF_QUIET))
error = -EPERM;
goto out;
}
if ((attr->ia_valid & ATTR_SIZE) &&
attr->ia_size != i_size_read(inode)) {
error = inode_newsize_ok(inode, attr->ia_size);
if (error)
return error;
truncate_setsize(inode, attr->ia_size);
affs_truncate(inode);
}
setattr_copy(inode, attr);
mark_inode_dirty(inode);
if (attr->ia_valid & ATTR_MODE)
mode_to_prot(inode);
out:
return error;
}
void
affs_evict_inode(struct inode *inode)
{
unsigned long cache_page;
pr_debug("evict_inode(ino=%lu, nlink=%u)\n",
inode->i_ino, inode->i_nlink);
truncate_inode_pages_final(&inode->i_data);
if (!inode->i_nlink) {
inode->i_size = 0;
affs_truncate(inode);
}
invalidate_inode_buffers(inode);
clear_inode(inode);
affs_free_prealloc(inode);
cache_page = (unsigned long)AFFS_I(inode)->i_lc;
if (cache_page) {
pr_debug("freeing ext cache\n");
AFFS_I(inode)->i_lc = NULL;
AFFS_I(inode)->i_ac = NULL;
free_page(cache_page);
}
affs_brelse(AFFS_I(inode)->i_ext_bh);
AFFS_I(inode)->i_ext_last = ~1;
AFFS_I(inode)->i_ext_bh = NULL;
if (!inode->i_nlink)
affs_free_block(inode->i_sb, inode->i_ino);
}
struct inode *
affs_new_inode(struct inode *dir)
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
u32 block;
struct buffer_head *bh;
if (!(inode = new_inode(sb)))
goto err_inode;
if (!(block = affs_alloc_block(dir, dir->i_ino)))
goto err_block;
bh = affs_getzeroblk(sb, block);
if (!bh)
goto err_bh;
mark_buffer_dirty_inode(bh, inode);
affs_brelse(bh);
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
inode->i_ino = block;
set_nlink(inode, 1);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
atomic_set(&AFFS_I(inode)->i_opencnt, 0);
AFFS_I(inode)->i_blkcnt = 0;
AFFS_I(inode)->i_lc = NULL;
AFFS_I(inode)->i_lc_size = 0;
AFFS_I(inode)->i_lc_shift = 0;
AFFS_I(inode)->i_lc_mask = 0;
AFFS_I(inode)->i_ac = NULL;
AFFS_I(inode)->i_ext_bh = NULL;
AFFS_I(inode)->mmu_private = 0;
AFFS_I(inode)->i_protect = 0;
AFFS_I(inode)->i_lastalloc = 0;
AFFS_I(inode)->i_pa_cnt = 0;
AFFS_I(inode)->i_extcnt = 1;
AFFS_I(inode)->i_ext_last = ~1;
insert_inode_hash(inode);
return inode;
err_bh:
affs_free_block(sb, block);
err_block:
iput(inode);
err_inode:
return NULL;
}
/*
* Add an entry to a directory. Create the header block
* and insert it into the hash table.
*/
int
affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type)
{
struct super_block *sb = dir->i_sb;
struct buffer_head *inode_bh = NULL;
struct buffer_head *bh = NULL;
u32 block = 0;
int retval;
pr_debug("%s(dir=%u, inode=%u, \"%*s\", type=%d)\n",
__func__, (u32)dir->i_ino,
(u32)inode->i_ino, (int)dentry->d_name.len, dentry->d_name.name, type);
retval = -EIO;
bh = affs_bread(sb, inode->i_ino);
if (!bh)
goto done;
affs_lock_link(inode);
switch (type) {
case ST_LINKFILE:
case ST_LINKDIR:
retval = -ENOSPC;
block = affs_alloc_block(dir, dir->i_ino);
if (!block)
goto err;
retval = -EIO;
inode_bh = bh;
bh = affs_getzeroblk(sb, block);
if (!bh)
goto err;
break;
default:
break;
}
AFFS_HEAD(bh)->ptype = cpu_to_be32(T_SHORT);
AFFS_HEAD(bh)->key = cpu_to_be32(bh->b_blocknr);
affs_copy_name(AFFS_TAIL(sb, bh)->name, dentry);
AFFS_TAIL(sb, bh)->stype = cpu_to_be32(type);
AFFS_TAIL(sb, bh)->parent = cpu_to_be32(dir->i_ino);
if (inode_bh) {
__be32 chain;
chain = AFFS_TAIL(sb, inode_bh)->link_chain;
AFFS_TAIL(sb, bh)->original = cpu_to_be32(inode->i_ino);
AFFS_TAIL(sb, bh)->link_chain = chain;
AFFS_TAIL(sb, inode_bh)->link_chain = cpu_to_be32(block);
affs_adjust_checksum(inode_bh, block - be32_to_cpu(chain));
mark_buffer_dirty_inode(inode_bh, inode);
set_nlink(inode, 2);
ihold(inode);
}
affs_fix_checksum(sb, bh);
mark_buffer_dirty_inode(bh, inode);
dentry->d_fsdata = (void *)(long)bh->b_blocknr;
affs_lock_dir(dir);
retval = affs_insert_hash(dir, bh);
mark_buffer_dirty_inode(bh, inode);
affs_unlock_dir(dir);
affs_unlock_link(inode);
d_instantiate(dentry, inode);
done:
affs_brelse(inode_bh);
affs_brelse(bh);
return retval;
err:
if (block)
affs_free_block(sb, block);
affs_unlock_link(inode);
goto done;
}
| {
"pile_set_name": "Github"
} |
/**
* Library tests focused on the phantomjsOptions option.
*
* Copyright (c) 2013 - 2020, Alex Grant, LocalNerve, contributors
*/
/* global beforeEach, describe, it */
// var assert = require("assert");
var path = require("path");
var fs = require("fs");
var _ = require("lodash");
var rimraf = require("rimraf").sync;
var utils = require("./utils");
var optHelp = require("../../helpers/options");
var ss = require("../../../lib/html-snapshots");
var inputFile = require("./robots").inputFile;
// missing destructuring, will write postcard...
var timeout = utils.timeout;
var outputDir = utils.outputDir;
var cleanup = utils.cleanup;
var bogusFile = utils.bogusFile;
var cleanupError = utils.cleanupError;
var unexpectedSuccess = utils.unexpectedSuccess;
var checkActualFiles = utils.checkActualFiles;
function snapshotScriptTests (options) {
var port = options.port;
return function () {
var snapshotScriptTests = [
{
name: "removeScripts",
option: {
script: "removeScripts"
},
prove: function (completed, done) {
// console.log("@@@ removeScripts prove @@@");
var content, err;
for (var i = 0; i < completed.length; i++) {
content = fs.readFileSync(completed[i], { encoding: "utf8" });
if (/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi.test(content)) {
err = new Error("removeScripts failed. Script tag found in "+completed[i]);
break;
}
}
done(err);
}
},
{
name: "customFilter",
option: {
script: "customFilter",
module: path.join(__dirname, "myFilter.js")
},
prove: function (completed, done) {
// console.log("@@@ customFilter prove @@@");
var content, err;
for (var i = 0; i < completed.length; i++) {
// console.log("@@@ readFile "+completed[i]);
content = fs.readFileSync(completed[i], { encoding: "utf8" });
// this is dependent on myFilter.js adding someattrZZQy anywhere
if (content.indexOf("someattrZZQy") < 0) {
err = new Error("customFilter snapshotScript failed. Special sequence not found in "+completed[i]);
break;
}
}
done(err);
}
}
];
describe("should succeed for scripts", function () {
var testNumber = 0, snapshotScriptTest, scriptNames = [
snapshotScriptTests[testNumber].name,
snapshotScriptTests[testNumber + 1].name
//, testNumber + 2, etc
];
beforeEach(function () {
snapshotScriptTest = snapshotScriptTests[testNumber++];
});
function snapshotScriptTestDefinition (done) {
var options = {
source: inputFile,
hostname: "localhost",
port: port,
selector: "#dynamic-content",
outputDir: outputDir,
outputDirClean: true,
timeout: timeout,
snapshotScript: snapshotScriptTest.option
};
rimraf(outputDir);
ss.run(optHelp.decorate(options))
.then(function (completed) {
snapshotScriptTest.prove(completed, function (e) {
cleanup(done, e);
});
})
.catch(function (err) {
checkActualFiles(err.notCompleted)
.then(function () {
cleanup(done, err);
});
});
}
scriptNames.forEach(function (scriptName) {
it("snapshot script "+scriptName, function (done) {
setTimeout(snapshotScriptTestDefinition, 3000, done);
});
});
});
it("should fail if a bogus script string is supplied", function (done) {
var options = {
source: inputFile,
hostname: "localhost",
port: port,
selector: "#dynamic-content",
outputDir: outputDir,
outputDirClean: true,
snapshotScript: bogusFile,
timeout: 2000
};
var twice = _.after(2, cleanupError.bind(null, done, 0));
ss.run(optHelp.decorate(options), twice)
.then(unexpectedSuccess.bind(null, done))
.catch(twice);
});
it("should fail if a bogus script object is supplied", function(done) {
var options = {
source: inputFile,
hostname: "localhost",
port: port,
selector: "#dynamic-content",
outputDir: outputDir,
outputDirClean: true,
snapshotScript: {
script: bogusFile
},
timeout: 2000
};
var twice = _.after(2, cleanupError.bind(null, done, 0));
ss.run(optHelp.decorate(options), twice)
.then(unexpectedSuccess.bind(null, done))
.catch(twice);
});
it("should fail if a customFilter is defined but no module", function(done) {
var options = {
source: inputFile,
hostname: "localhost",
port: port,
selector: "#dynamic-content",
outputDir: outputDir,
outputDirClean: true,
snapshotScript: {
script: "customFilter"
},
timeout: 2000
};
var twice = _.after(2, cleanupError.bind(null, done, 0));
ss.run(optHelp.decorate(options), twice)
.then(unexpectedSuccess.bind(null, done))
.catch(twice);
});
it("should fail if a customFilter is defined and bogus module", function(done) {
var options = {
source: inputFile,
hostname: "localhost",
port: port,
selector: "#dynamic-content",
outputDir: outputDir,
outputDirClean: true,
snapshotScript: {
script: "customFilter",
module: bogusFile
},
timeout: 2000
};
var twice = _.after(2, cleanupError.bind(null, done, 0));
ss.run(optHelp.decorate(options), twice)
.then(unexpectedSuccess.bind(null, done))
.catch(twice);
});
};
}
module.exports = {
testSuite: snapshotScriptTests
};
| {
"pile_set_name": "Github"
} |
/*-------------------------------- Arctic Core ------------------------------
* Copyright (C) 2013, ArcCore AB, Sweden, www.arccore.com.
* Contact: <contact@arccore.com>
*
* You may ONLY use this file:
* 1)if you have a valid commercial ArcCore license and then in accordance with
* the terms contained in the written license agreement between you and ArcCore,
* or alternatively
* 2)if you follow the terms found in GNU General Public License version 2 as
* published by the Free Software Foundation and appearing in the file
* LICENSE.GPL included in the packaging of this file or here
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
*-------------------------------- Arctic Core -----------------------------*/
#ifndef SCHM_LINSM_H_
#define SCHM_LINSM_H_
#define SCHM_MAINFUNCTION_LINSM() SCHM_MAINFUNCTION(LINSM,LinSM_MainFunction())
#endif /* SCHM_LINSM_H_ */
| {
"pile_set_name": "Github"
} |
<!--
---
name: PaPiRus HAT
class: board
type: display
formfactor: HAT
manufacturer: Pi Supply
description: PaPiRus is an ePaper / eInk screen HAT module for the Raspberry Pi
url: https://www.kickstarter.com/projects/pisupply/papirus-the-epaper-screen-hat-for-your-raspberry-p
github: https://github.com/PiSupply/PaPiRus
buy: https://www.pi-supply.com/product/papirus-epaper-eink-screen-hat-for-raspberry-pi/
image: 'papirus-hat.png'
pincount: 40
eeprom: yes
power:
'1':
'2':
ground:
'6':
'9':
'14':
'20':
'25':
'30':
'34':
'39':
pin:
'3':
mode: i2c
'5':
mode: i2c
'8':
name: Border Control
'10':
name: Discharge
'11':
name: Temp Sens
'12':
name: ePaper PWM
'13':
name: RTC
'16':
name: Panel On
'18':
name: Chip On Glass Reset
'19':
mode: spi
'21':
mode: spi
'22':
name: Chip On Glass Busy
'23':
mode: spi
'24':
mode: spi
'26':
mode: spi
'36':
name: SW1
mode: input
active: low
'37':
name: SW2
mode: input
active: low
'38':
name: SW3
mode: input
active: low
'40':
name: SW4
mode: input
active: low
i2c:
'0x48':
name: Temperature Sensor
device: LM75BD
'0x6F':
name: Real Time Clock
device: MCP7940N
-->
#PaPiRus HAT
PaPiRus HAT es una pantalla ePaper versátil para Raspberry Pi, con tamaños desde 1.44" a 2.7".
A diferencia de las pantallas convencionales, refleja la luz y puede mantener imagen y textos por tiempo indefinido, hasta sin electricidad. Esta pantalla no requiere electricidad para mantener la imagen y durará varios días hasta desaparecer. Se puede leer a la luz del día y tiene un gran contraste.
* El diseño cumple el estándar HAT
* Tamaños de pantalla intercambiables (1.44", 2.0" o 2.7")
* Memoria Flash de 32MBit
* Cuenta con un reloj de tiempo real alimentado por batería (batería CR2032 incluída)
* Formato plug and play con EEPROM
* Control de temperatura digital
* Pines GPIO accesibles
* Pin de reset opcional
* Cuenta con 4 interruptores opcionales
Para configurar el HAT puedes utilizar el instalador online de una línea.
```bash
curl -sSL https://pisupp.ly/papiruscode | sudo bash
```
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "PFAssert.h"
#import "PFUserController.h"
#import "BFTask+Private.h"
#import "PFCommandResult.h"
#import "PFCommandRunning.h"
#import "PFCurrentUserController.h"
#import "PFErrorUtilities.h"
#import "PFMacros.h"
#import "PFObjectPrivate.h"
#import "PFRESTUserCommand.h"
#import "PFUserPrivate.h"
@implementation PFUserController
///--------------------------------------
#pragma mark - Init
///--------------------------------------
- (instancetype)initWithCommonDataSource:(id<PFCommandRunnerProvider>)commonDataSource
coreDataSource:(id<PFCurrentUserControllerProvider>)coreDataSource {
self = [super init];
if (!self) return nil;
_commonDataSource = commonDataSource;
_coreDataSource = coreDataSource;
return self;
}
+ (instancetype)controllerWithCommonDataSource:(id<PFCommandRunnerProvider>)commonDataSource
coreDataSource:(id<PFCurrentUserControllerProvider>)coreDataSource {
return [[self alloc] initWithCommonDataSource:commonDataSource
coreDataSource:coreDataSource];
}
///--------------------------------------
#pragma mark - Log In
///--------------------------------------
- (BFTask *)logInCurrentUserAsyncWithSessionToken:(NSString *)sessionToken {
@weakify(self);
return [[BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
@strongify(self);
NSError *error = nil;
PFRESTCommand *command = [PFRESTUserCommand getCurrentUserCommandWithSessionToken:sessionToken error:&error];
PFPreconditionReturnFailedTask(command, error);
return [self.commonDataSource.commandRunner runCommandAsync:command
withOptions:PFCommandRunningOptionRetryIfFailed];
}] continueWithSuccessBlock:^id(BFTask *task) {
@strongify(self);
PFCommandResult *result = task.result;
NSDictionary *dictionary = result.result;
// We test for a null object, if it isn't, we can use the response to create a PFUser.
if ([dictionary isKindOfClass:[NSNull class]] || !dictionary) {
return [BFTask taskWithError:[PFErrorUtilities errorWithCode:kPFErrorObjectNotFound
message:@"Invalid Session Token."]];
}
PFUser *user = [PFUser _objectFromDictionary:dictionary
defaultClassName:[PFUser parseClassName]
completeData:YES];
// Serialize the object to disk so we can later access it via currentUser
PFCurrentUserController *controller = self.coreDataSource.currentUserController;
return [[controller saveCurrentObjectAsync:user] continueWithBlock:^id(BFTask *task) {
return user;
}];
}];
}
- (BFTask *)logInCurrentUserAsyncWithUsername:(NSString *)username
password:(NSString *)password
revocableSession:(BOOL)revocableSession {
@weakify(self);
return [[BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
NSError *error = nil;
PFRESTCommand *command = [PFRESTUserCommand logInUserCommandWithUsername:username
password:password
revocableSession:revocableSession
error:&error];
PFPreconditionReturnFailedTask(command, error);
return [self.commonDataSource.commandRunner runCommandAsync:command
withOptions:PFCommandRunningOptionRetryIfFailed];
}] continueWithSuccessBlock:^id(BFTask *task) {
@strongify(self);
PFCommandResult *result = task.result;
NSDictionary *dictionary = result.result;
// We test for a null object, if it isn't, we can use the response to create a PFUser.
if ([dictionary isKindOfClass:[NSNull class]] || !dictionary) {
return [BFTask taskWithError:[PFErrorUtilities errorWithCode:kPFErrorObjectNotFound
message:@"Invalid login credentials."]];
}
PFUser *user = [PFUser _objectFromDictionary:dictionary
defaultClassName:[PFUser parseClassName]
completeData:YES];
// Serialize the object to disk so we can later access it via currentUser
PFCurrentUserController *controller = self.coreDataSource.currentUserController;
return [[controller saveCurrentObjectAsync:user] continueWithBlock:^id(BFTask *task) {
return user;
}];
}];
}
- (BFTask *)logInCurrentUserAsyncWithAuthType:(NSString *)authType
authData:(NSDictionary *)authData
revocableSession:(BOOL)revocableSession {
@weakify(self);
return [[BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
@strongify(self);
NSError *error;
PFRESTCommand *command = [PFRESTUserCommand serviceLoginUserCommandWithAuthenticationType:authType
authenticationData:authData
revocableSession:revocableSession
error:&error];
PFPreconditionReturnFailedTask(command, error);
return [self.commonDataSource.commandRunner runCommandAsync:command
withOptions:PFCommandRunningOptionRetryIfFailed];
}] continueWithSuccessBlock:^id(BFTask *task) {
PFCommandResult *result = task.result;
PFUser *user = [PFUser _objectFromDictionary:result.result
defaultClassName:[PFUser parseClassName]
completeData:YES];
@synchronized ([user lock]) {
user.authData[authType] = authData;
[user.linkedServiceNames addObject:authType];
[user startSave];
return [user _handleServiceLoginCommandResult:result];
}
}];
}
///--------------------------------------
#pragma mark - Reset Password
///--------------------------------------
- (BFTask *)requestPasswordResetAsyncForEmail:(NSString *)email {
@weakify(self);
return [[BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
@strongify(self);
NSError *error = nil;
PFRESTCommand *command = [PFRESTUserCommand resetPasswordCommandForUserWithEmail:email error:&error];
PFPreconditionReturnFailedTask(command, error);
return [self.commonDataSource.commandRunner runCommandAsync:command
withOptions:PFCommandRunningOptionRetryIfFailed];
}] continueWithSuccessResult:nil];
}
///--------------------------------------
#pragma mark - Log Out
///--------------------------------------
- (BFTask *)logOutUserAsyncWithSessionToken:(NSString *)sessionToken {
@weakify(self);
return [[BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
@strongify(self);
NSError *error = nil;
PFRESTCommand *command = [PFRESTUserCommand logOutUserCommandWithSessionToken:sessionToken error:&error];
PFPreconditionReturnFailedTask(command, error);
return [self.commonDataSource.commandRunner runCommandAsync:command
withOptions:PFCommandRunningOptionRetryIfFailed];
}] continueWithSuccessResult:nil];
}
@end
| {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_CloudKMS_Expr extends Google_Model
{
public $description;
public $expression;
public $location;
public $title;
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setExpression($expression)
{
$this->expression = $expression;
}
public function getExpression()
{
return $this->expression;
}
public function setLocation($location)
{
$this->location = $location;
}
public function getLocation()
{
return $this->location;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CODEGEN_MIPS64_CONSTANTS_MIPS64_H_
#define V8_CODEGEN_MIPS64_CONSTANTS_MIPS64_H_
#include "src/base/logging.h"
#include "src/base/macros.h"
#include "src/common/globals.h"
// UNIMPLEMENTED_ macro for MIPS.
#ifdef DEBUG
#define UNIMPLEMENTED_MIPS() \
v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \
__FILE__, __LINE__, __func__)
#else
#define UNIMPLEMENTED_MIPS()
#endif
#define UNSUPPORTED_MIPS() v8::internal::PrintF("Unsupported instruction.\n")
enum ArchVariants { kMips64r2, kMips64r6 };
#ifdef _MIPS_ARCH_MIPS64R2
static const ArchVariants kArchVariant = kMips64r2;
#elif _MIPS_ARCH_MIPS64R6
static const ArchVariants kArchVariant = kMips64r6;
#else
static const ArchVariants kArchVariant = kMips64r2;
#endif
enum Endianness { kLittle, kBig };
#if defined(V8_TARGET_LITTLE_ENDIAN)
static const Endianness kArchEndian = kLittle;
#elif defined(V8_TARGET_BIG_ENDIAN)
static const Endianness kArchEndian = kBig;
#else
#error Unknown endianness
#endif
// TODO(plind): consider renaming these ...
#if defined(__mips_hard_float) && __mips_hard_float != 0
// Use floating-point coprocessor instructions. This flag is raised when
// -mhard-float is passed to the compiler.
const bool IsMipsSoftFloatABI = false;
#elif defined(__mips_soft_float) && __mips_soft_float != 0
// This flag is raised when -msoft-float is passed to the compiler.
// Although FPU is a base requirement for v8, soft-float ABI is used
// on soft-float systems with FPU kernel emulation.
const bool IsMipsSoftFloatABI = true;
#else
const bool IsMipsSoftFloatABI = true;
#endif
#if defined(V8_TARGET_LITTLE_ENDIAN)
const uint32_t kMipsLwrOffset = 0;
const uint32_t kMipsLwlOffset = 3;
const uint32_t kMipsSwrOffset = 0;
const uint32_t kMipsSwlOffset = 3;
const uint32_t kMipsLdrOffset = 0;
const uint32_t kMipsLdlOffset = 7;
const uint32_t kMipsSdrOffset = 0;
const uint32_t kMipsSdlOffset = 7;
#elif defined(V8_TARGET_BIG_ENDIAN)
const uint32_t kMipsLwrOffset = 3;
const uint32_t kMipsLwlOffset = 0;
const uint32_t kMipsSwrOffset = 3;
const uint32_t kMipsSwlOffset = 0;
const uint32_t kMipsLdrOffset = 7;
const uint32_t kMipsLdlOffset = 0;
const uint32_t kMipsSdrOffset = 7;
const uint32_t kMipsSdlOffset = 0;
#else
#error Unknown endianness
#endif
#if defined(V8_TARGET_LITTLE_ENDIAN)
const uint32_t kLeastSignificantByteInInt32Offset = 0;
const uint32_t kLessSignificantWordInDoublewordOffset = 0;
#elif defined(V8_TARGET_BIG_ENDIAN)
const uint32_t kLeastSignificantByteInInt32Offset = 3;
const uint32_t kLessSignificantWordInDoublewordOffset = 4;
#else
#error Unknown endianness
#endif
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
// Defines constants and accessor classes to assemble, disassemble and
// simulate MIPS32 instructions.
//
// See: MIPS32 Architecture For Programmers
// Volume II: The MIPS32 Instruction Set
// Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf.
namespace v8 {
namespace internal {
// TODO(sigurds): Change this value once we use relative jumps.
constexpr size_t kMaxPCRelativeCodeRangeInMB = 0;
// -----------------------------------------------------------------------------
// Registers and FPURegisters.
// Number of general purpose registers.
const int kNumRegisters = 32;
const int kInvalidRegister = -1;
// Number of registers with HI, LO, and pc.
const int kNumSimuRegisters = 35;
// In the simulator, the PC register is simulated as the 34th register.
const int kPCRegister = 34;
// Number coprocessor registers.
const int kNumFPURegisters = 32;
const int kInvalidFPURegister = -1;
// Number of MSA registers
const int kNumMSARegisters = 32;
const int kInvalidMSARegister = -1;
const int kInvalidMSAControlRegister = -1;
const int kMSAIRRegister = 0;
const int kMSACSRRegister = 1;
const int kMSARegSize = 128;
const int kMSALanesByte = kMSARegSize / 8;
const int kMSALanesHalf = kMSARegSize / 16;
const int kMSALanesWord = kMSARegSize / 32;
const int kMSALanesDword = kMSARegSize / 64;
// FPU (coprocessor 1) control registers. Currently only FCSR is implemented.
const int kFCSRRegister = 31;
const int kInvalidFPUControlRegister = -1;
const uint32_t kFPUInvalidResult = static_cast<uint32_t>(1u << 31) - 1;
const int32_t kFPUInvalidResultNegative = static_cast<int32_t>(1u << 31);
const uint64_t kFPU64InvalidResult =
static_cast<uint64_t>(static_cast<uint64_t>(1) << 63) - 1;
const int64_t kFPU64InvalidResultNegative =
static_cast<int64_t>(static_cast<uint64_t>(1) << 63);
// FCSR constants.
const uint32_t kFCSRInexactFlagBit = 2;
const uint32_t kFCSRUnderflowFlagBit = 3;
const uint32_t kFCSROverflowFlagBit = 4;
const uint32_t kFCSRDivideByZeroFlagBit = 5;
const uint32_t kFCSRInvalidOpFlagBit = 6;
const uint32_t kFCSRNaN2008FlagBit = 18;
const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit;
const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit;
const uint32_t kFCSROverflowFlagMask = 1 << kFCSROverflowFlagBit;
const uint32_t kFCSRDivideByZeroFlagMask = 1 << kFCSRDivideByZeroFlagBit;
const uint32_t kFCSRInvalidOpFlagMask = 1 << kFCSRInvalidOpFlagBit;
const uint32_t kFCSRNaN2008FlagMask = 1 << kFCSRNaN2008FlagBit;
const uint32_t kFCSRFlagMask =
kFCSRInexactFlagMask | kFCSRUnderflowFlagMask | kFCSROverflowFlagMask |
kFCSRDivideByZeroFlagMask | kFCSRInvalidOpFlagMask;
const uint32_t kFCSRExceptionFlagMask = kFCSRFlagMask ^ kFCSRInexactFlagMask;
// 'pref' instruction hints
const int32_t kPrefHintLoad = 0;
const int32_t kPrefHintStore = 1;
const int32_t kPrefHintLoadStreamed = 4;
const int32_t kPrefHintStoreStreamed = 5;
const int32_t kPrefHintLoadRetained = 6;
const int32_t kPrefHintStoreRetained = 7;
const int32_t kPrefHintWritebackInvalidate = 25;
const int32_t kPrefHintPrepareForStore = 30;
// Actual value of root register is offset from the root array's start
// to take advantage of negative displacement values.
// TODO(sigurds): Choose best value.
constexpr int kRootRegisterBias = 256;
// Helper functions for converting between register numbers and names.
class Registers {
public:
// Return the name of the register.
static const char* Name(int reg);
// Lookup the register number for the name provided.
static int Number(const char* name);
struct RegisterAlias {
int reg;
const char* name;
};
static const int64_t kMaxValue = 0x7fffffffffffffffl;
static const int64_t kMinValue = 0x8000000000000000l;
private:
static const char* names_[kNumSimuRegisters];
static const RegisterAlias aliases_[];
};
// Helper functions for converting between register numbers and names.
class FPURegisters {
public:
// Return the name of the register.
static const char* Name(int reg);
// Lookup the register number for the name provided.
static int Number(const char* name);
struct RegisterAlias {
int creg;
const char* name;
};
private:
static const char* names_[kNumFPURegisters];
static const RegisterAlias aliases_[];
};
// Helper functions for converting between register numbers and names.
class MSARegisters {
public:
// Return the name of the register.
static const char* Name(int reg);
// Lookup the register number for the name provided.
static int Number(const char* name);
struct RegisterAlias {
int creg;
const char* name;
};
private:
static const char* names_[kNumMSARegisters];
static const RegisterAlias aliases_[];
};
// -----------------------------------------------------------------------------
// Instructions encoding constants.
// On MIPS all instructions are 32 bits.
using Instr = int32_t;
// Special Software Interrupt codes when used in the presence of the MIPS
// simulator.
enum SoftwareInterruptCodes {
// Transition to C code.
call_rt_redirected = 0xfffff
};
// On MIPS Simulator breakpoints can have different codes:
// - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints,
// the simulator will run through them and print the registers.
// - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop()
// instructions (see Assembler::stop()).
// - Breaks larger than kMaxStopCode are simple breaks, dropping you into the
// debugger.
const uint32_t kMaxWatchpointCode = 31;
const uint32_t kMaxStopCode = 127;
STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode);
// ----- Fields offset and length.
const int kOpcodeShift = 26;
const int kOpcodeBits = 6;
const int kRsShift = 21;
const int kRsBits = 5;
const int kRtShift = 16;
const int kRtBits = 5;
const int kRdShift = 11;
const int kRdBits = 5;
const int kSaShift = 6;
const int kSaBits = 5;
const int kLsaSaBits = 2;
const int kFunctionShift = 0;
const int kFunctionBits = 6;
const int kLuiShift = 16;
const int kBp2Shift = 6;
const int kBp2Bits = 2;
const int kBp3Shift = 6;
const int kBp3Bits = 3;
const int kBaseShift = 21;
const int kBaseBits = 5;
const int kBit6Shift = 6;
const int kBit6Bits = 1;
const int kImm9Shift = 7;
const int kImm9Bits = 9;
const int kImm16Shift = 0;
const int kImm16Bits = 16;
const int kImm18Shift = 0;
const int kImm18Bits = 18;
const int kImm19Shift = 0;
const int kImm19Bits = 19;
const int kImm21Shift = 0;
const int kImm21Bits = 21;
const int kImm26Shift = 0;
const int kImm26Bits = 26;
const int kImm28Shift = 0;
const int kImm28Bits = 28;
const int kImm32Shift = 0;
const int kImm32Bits = 32;
const int kMsaImm8Shift = 16;
const int kMsaImm8Bits = 8;
const int kMsaImm5Shift = 16;
const int kMsaImm5Bits = 5;
const int kMsaImm10Shift = 11;
const int kMsaImm10Bits = 10;
const int kMsaImmMI10Shift = 16;
const int kMsaImmMI10Bits = 10;
// In branches and jumps immediate fields point to words, not bytes,
// and are therefore shifted by 2.
const int kImmFieldShift = 2;
const int kFrBits = 5;
const int kFrShift = 21;
const int kFsShift = 11;
const int kFsBits = 5;
const int kFtShift = 16;
const int kFtBits = 5;
const int kFdShift = 6;
const int kFdBits = 5;
const int kFCccShift = 8;
const int kFCccBits = 3;
const int kFBccShift = 18;
const int kFBccBits = 3;
const int kFBtrueShift = 16;
const int kFBtrueBits = 1;
const int kWtBits = 5;
const int kWtShift = 16;
const int kWsBits = 5;
const int kWsShift = 11;
const int kWdBits = 5;
const int kWdShift = 6;
// ----- Miscellaneous useful masks.
// Instruction bit masks.
const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift;
const int kImm9Mask = ((1 << kImm9Bits) - 1) << kImm9Shift;
const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift;
const int kImm18Mask = ((1 << kImm18Bits) - 1) << kImm18Shift;
const int kImm19Mask = ((1 << kImm19Bits) - 1) << kImm19Shift;
const int kImm21Mask = ((1 << kImm21Bits) - 1) << kImm21Shift;
const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift;
const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift;
const int kImm5Mask = ((1 << 5) - 1);
const int kImm8Mask = ((1 << 8) - 1);
const int kImm10Mask = ((1 << 10) - 1);
const int kMsaI5I10Mask = ((7U << 23) | ((1 << 6) - 1));
const int kMsaI8Mask = ((3U << 24) | ((1 << 6) - 1));
const int kMsaI5Mask = ((7U << 23) | ((1 << 6) - 1));
const int kMsaMI10Mask = (15U << 2);
const int kMsaBITMask = ((7U << 23) | ((1 << 6) - 1));
const int kMsaELMMask = (15U << 22);
const int kMsaLongerELMMask = kMsaELMMask | (63U << 16);
const int kMsa3RMask = ((7U << 23) | ((1 << 6) - 1));
const int kMsa3RFMask = ((15U << 22) | ((1 << 6) - 1));
const int kMsaVECMask = (23U << 21);
const int kMsa2RMask = (7U << 18);
const int kMsa2RFMask = (15U << 17);
const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift;
const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift;
const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift;
const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift;
const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift;
// Misc masks.
const int kHiMaskOf32 = 0xffff << 16; // Only to be used with 32-bit values
const int kLoMaskOf32 = 0xffff;
const int kSignMaskOf32 = 0x80000000; // Only to be used with 32-bit values
const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1;
const int64_t kTop16MaskOf64 = (int64_t)0xffff << 48;
const int64_t kHigher16MaskOf64 = (int64_t)0xffff << 32;
const int64_t kUpper16MaskOf64 = (int64_t)0xffff << 16;
const int32_t kJalRawMark = 0x00000000;
const int32_t kJRawMark = 0xf0000000;
const int32_t kJumpRawMask = 0xf0000000;
// ----- MIPS Opcodes and Function Fields.
// We use this presentation to stay close to the table representation in
// MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set.
enum Opcode : uint32_t {
SPECIAL = 0U << kOpcodeShift,
REGIMM = 1U << kOpcodeShift,
J = ((0U << 3) + 2) << kOpcodeShift,
JAL = ((0U << 3) + 3) << kOpcodeShift,
BEQ = ((0U << 3) + 4) << kOpcodeShift,
BNE = ((0U << 3) + 5) << kOpcodeShift,
BLEZ = ((0U << 3) + 6) << kOpcodeShift,
BGTZ = ((0U << 3) + 7) << kOpcodeShift,
ADDI = ((1U << 3) + 0) << kOpcodeShift,
ADDIU = ((1U << 3) + 1) << kOpcodeShift,
SLTI = ((1U << 3) + 2) << kOpcodeShift,
SLTIU = ((1U << 3) + 3) << kOpcodeShift,
ANDI = ((1U << 3) + 4) << kOpcodeShift,
ORI = ((1U << 3) + 5) << kOpcodeShift,
XORI = ((1U << 3) + 6) << kOpcodeShift,
LUI = ((1U << 3) + 7) << kOpcodeShift, // LUI/AUI family.
DAUI = ((3U << 3) + 5) << kOpcodeShift,
BEQC = ((2U << 3) + 0) << kOpcodeShift,
COP1 = ((2U << 3) + 1) << kOpcodeShift, // Coprocessor 1 class.
BEQL = ((2U << 3) + 4) << kOpcodeShift,
BNEL = ((2U << 3) + 5) << kOpcodeShift,
BLEZL = ((2U << 3) + 6) << kOpcodeShift,
BGTZL = ((2U << 3) + 7) << kOpcodeShift,
DADDI = ((3U << 3) + 0) << kOpcodeShift, // This is also BNEC.
DADDIU = ((3U << 3) + 1) << kOpcodeShift,
LDL = ((3U << 3) + 2) << kOpcodeShift,
LDR = ((3U << 3) + 3) << kOpcodeShift,
SPECIAL2 = ((3U << 3) + 4) << kOpcodeShift,
MSA = ((3U << 3) + 6) << kOpcodeShift,
SPECIAL3 = ((3U << 3) + 7) << kOpcodeShift,
LB = ((4U << 3) + 0) << kOpcodeShift,
LH = ((4U << 3) + 1) << kOpcodeShift,
LWL = ((4U << 3) + 2) << kOpcodeShift,
LW = ((4U << 3) + 3) << kOpcodeShift,
LBU = ((4U << 3) + 4) << kOpcodeShift,
LHU = ((4U << 3) + 5) << kOpcodeShift,
LWR = ((4U << 3) + 6) << kOpcodeShift,
LWU = ((4U << 3) + 7) << kOpcodeShift,
SB = ((5U << 3) + 0) << kOpcodeShift,
SH = ((5U << 3) + 1) << kOpcodeShift,
SWL = ((5U << 3) + 2) << kOpcodeShift,
SW = ((5U << 3) + 3) << kOpcodeShift,
SDL = ((5U << 3) + 4) << kOpcodeShift,
SDR = ((5U << 3) + 5) << kOpcodeShift,
SWR = ((5U << 3) + 6) << kOpcodeShift,
LL = ((6U << 3) + 0) << kOpcodeShift,
LWC1 = ((6U << 3) + 1) << kOpcodeShift,
BC = ((6U << 3) + 2) << kOpcodeShift,
LLD = ((6U << 3) + 4) << kOpcodeShift,
LDC1 = ((6U << 3) + 5) << kOpcodeShift,
POP66 = ((6U << 3) + 6) << kOpcodeShift,
LD = ((6U << 3) + 7) << kOpcodeShift,
PREF = ((6U << 3) + 3) << kOpcodeShift,
SC = ((7U << 3) + 0) << kOpcodeShift,
SWC1 = ((7U << 3) + 1) << kOpcodeShift,
BALC = ((7U << 3) + 2) << kOpcodeShift,
PCREL = ((7U << 3) + 3) << kOpcodeShift,
SCD = ((7U << 3) + 4) << kOpcodeShift,
SDC1 = ((7U << 3) + 5) << kOpcodeShift,
POP76 = ((7U << 3) + 6) << kOpcodeShift,
SD = ((7U << 3) + 7) << kOpcodeShift,
COP1X = ((1U << 4) + 3) << kOpcodeShift,
// New r6 instruction.
POP06 = BLEZ, // bgeuc/bleuc, blezalc, bgezalc
POP07 = BGTZ, // bltuc/bgtuc, bgtzalc, bltzalc
POP10 = ADDI, // beqzalc, bovc, beqc
POP26 = BLEZL, // bgezc, blezc, bgec/blec
POP27 = BGTZL, // bgtzc, bltzc, bltc/bgtc
POP30 = DADDI, // bnezalc, bnvc, bnec
};
enum SecondaryField : uint32_t {
// SPECIAL Encoding of Function Field.
SLL = ((0U << 3) + 0),
MOVCI = ((0U << 3) + 1),
SRL = ((0U << 3) + 2),
SRA = ((0U << 3) + 3),
SLLV = ((0U << 3) + 4),
LSA = ((0U << 3) + 5),
SRLV = ((0U << 3) + 6),
SRAV = ((0U << 3) + 7),
JR = ((1U << 3) + 0),
JALR = ((1U << 3) + 1),
MOVZ = ((1U << 3) + 2),
MOVN = ((1U << 3) + 3),
BREAK = ((1U << 3) + 5),
SYNC = ((1U << 3) + 7),
MFHI = ((2U << 3) + 0),
CLZ_R6 = ((2U << 3) + 0),
CLO_R6 = ((2U << 3) + 1),
MFLO = ((2U << 3) + 2),
DCLZ_R6 = ((2U << 3) + 2),
DCLO_R6 = ((2U << 3) + 3),
DSLLV = ((2U << 3) + 4),
DLSA = ((2U << 3) + 5),
DSRLV = ((2U << 3) + 6),
DSRAV = ((2U << 3) + 7),
MULT = ((3U << 3) + 0),
MULTU = ((3U << 3) + 1),
DIV = ((3U << 3) + 2),
DIVU = ((3U << 3) + 3),
DMULT = ((3U << 3) + 4),
DMULTU = ((3U << 3) + 5),
DDIV = ((3U << 3) + 6),
DDIVU = ((3U << 3) + 7),
ADD = ((4U << 3) + 0),
ADDU = ((4U << 3) + 1),
SUB = ((4U << 3) + 2),
SUBU = ((4U << 3) + 3),
AND = ((4U << 3) + 4),
OR = ((4U << 3) + 5),
XOR = ((4U << 3) + 6),
NOR = ((4U << 3) + 7),
SLT = ((5U << 3) + 2),
SLTU = ((5U << 3) + 3),
DADD = ((5U << 3) + 4),
DADDU = ((5U << 3) + 5),
DSUB = ((5U << 3) + 6),
DSUBU = ((5U << 3) + 7),
TGE = ((6U << 3) + 0),
TGEU = ((6U << 3) + 1),
TLT = ((6U << 3) + 2),
TLTU = ((6U << 3) + 3),
TEQ = ((6U << 3) + 4),
SELEQZ_S = ((6U << 3) + 5),
TNE = ((6U << 3) + 6),
SELNEZ_S = ((6U << 3) + 7),
DSLL = ((7U << 3) + 0),
DSRL = ((7U << 3) + 2),
DSRA = ((7U << 3) + 3),
DSLL32 = ((7U << 3) + 4),
DSRL32 = ((7U << 3) + 6),
DSRA32 = ((7U << 3) + 7),
// Multiply integers in r6.
MUL_MUH = ((3U << 3) + 0), // MUL, MUH.
MUL_MUH_U = ((3U << 3) + 1), // MUL_U, MUH_U.
D_MUL_MUH = ((7U << 2) + 0), // DMUL, DMUH.
D_MUL_MUH_U = ((7U << 2) + 1), // DMUL_U, DMUH_U.
RINT = ((3U << 3) + 2),
MUL_OP = ((0U << 3) + 2),
MUH_OP = ((0U << 3) + 3),
DIV_OP = ((0U << 3) + 2),
MOD_OP = ((0U << 3) + 3),
DIV_MOD = ((3U << 3) + 2),
DIV_MOD_U = ((3U << 3) + 3),
D_DIV_MOD = ((3U << 3) + 6),
D_DIV_MOD_U = ((3U << 3) + 7),
// drotr in special4?
// SPECIAL2 Encoding of Function Field.
MUL = ((0U << 3) + 2),
CLZ = ((4U << 3) + 0),
CLO = ((4U << 3) + 1),
DCLZ = ((4U << 3) + 4),
DCLO = ((4U << 3) + 5),
// SPECIAL3 Encoding of Function Field.
EXT = ((0U << 3) + 0),
DEXTM = ((0U << 3) + 1),
DEXTU = ((0U << 3) + 2),
DEXT = ((0U << 3) + 3),
INS = ((0U << 3) + 4),
DINSM = ((0U << 3) + 5),
DINSU = ((0U << 3) + 6),
DINS = ((0U << 3) + 7),
BSHFL = ((4U << 3) + 0),
DBSHFL = ((4U << 3) + 4),
SC_R6 = ((4U << 3) + 6),
SCD_R6 = ((4U << 3) + 7),
LL_R6 = ((6U << 3) + 6),
LLD_R6 = ((6U << 3) + 7),
// SPECIAL3 Encoding of sa Field.
BITSWAP = ((0U << 3) + 0),
ALIGN = ((0U << 3) + 2),
WSBH = ((0U << 3) + 2),
SEB = ((2U << 3) + 0),
SEH = ((3U << 3) + 0),
DBITSWAP = ((0U << 3) + 0),
DALIGN = ((0U << 3) + 1),
DBITSWAP_SA = ((0U << 3) + 0) << kSaShift,
DSBH = ((0U << 3) + 2),
DSHD = ((0U << 3) + 5),
// REGIMM encoding of rt Field.
BLTZ = ((0U << 3) + 0) << 16,
BGEZ = ((0U << 3) + 1) << 16,
BLTZAL = ((2U << 3) + 0) << 16,
BGEZAL = ((2U << 3) + 1) << 16,
BGEZALL = ((2U << 3) + 3) << 16,
DAHI = ((0U << 3) + 6) << 16,
DATI = ((3U << 3) + 6) << 16,
// COP1 Encoding of rs Field.
MFC1 = ((0U << 3) + 0) << 21,
DMFC1 = ((0U << 3) + 1) << 21,
CFC1 = ((0U << 3) + 2) << 21,
MFHC1 = ((0U << 3) + 3) << 21,
MTC1 = ((0U << 3) + 4) << 21,
DMTC1 = ((0U << 3) + 5) << 21,
CTC1 = ((0U << 3) + 6) << 21,
MTHC1 = ((0U << 3) + 7) << 21,
BC1 = ((1U << 3) + 0) << 21,
S = ((2U << 3) + 0) << 21,
D = ((2U << 3) + 1) << 21,
W = ((2U << 3) + 4) << 21,
L = ((2U << 3) + 5) << 21,
PS = ((2U << 3) + 6) << 21,
// COP1 Encoding of Function Field When rs=S.
ADD_S = ((0U << 3) + 0),
SUB_S = ((0U << 3) + 1),
MUL_S = ((0U << 3) + 2),
DIV_S = ((0U << 3) + 3),
ABS_S = ((0U << 3) + 5),
SQRT_S = ((0U << 3) + 4),
MOV_S = ((0U << 3) + 6),
NEG_S = ((0U << 3) + 7),
ROUND_L_S = ((1U << 3) + 0),
TRUNC_L_S = ((1U << 3) + 1),
CEIL_L_S = ((1U << 3) + 2),
FLOOR_L_S = ((1U << 3) + 3),
ROUND_W_S = ((1U << 3) + 4),
TRUNC_W_S = ((1U << 3) + 5),
CEIL_W_S = ((1U << 3) + 6),
FLOOR_W_S = ((1U << 3) + 7),
RECIP_S = ((2U << 3) + 5),
RSQRT_S = ((2U << 3) + 6),
MADDF_S = ((3U << 3) + 0),
MSUBF_S = ((3U << 3) + 1),
CLASS_S = ((3U << 3) + 3),
CVT_D_S = ((4U << 3) + 1),
CVT_W_S = ((4U << 3) + 4),
CVT_L_S = ((4U << 3) + 5),
CVT_PS_S = ((4U << 3) + 6),
// COP1 Encoding of Function Field When rs=D.
ADD_D = ((0U << 3) + 0),
SUB_D = ((0U << 3) + 1),
MUL_D = ((0U << 3) + 2),
DIV_D = ((0U << 3) + 3),
SQRT_D = ((0U << 3) + 4),
ABS_D = ((0U << 3) + 5),
MOV_D = ((0U << 3) + 6),
NEG_D = ((0U << 3) + 7),
ROUND_L_D = ((1U << 3) + 0),
TRUNC_L_D = ((1U << 3) + 1),
CEIL_L_D = ((1U << 3) + 2),
FLOOR_L_D = ((1U << 3) + 3),
ROUND_W_D = ((1U << 3) + 4),
TRUNC_W_D = ((1U << 3) + 5),
CEIL_W_D = ((1U << 3) + 6),
FLOOR_W_D = ((1U << 3) + 7),
RECIP_D = ((2U << 3) + 5),
RSQRT_D = ((2U << 3) + 6),
MADDF_D = ((3U << 3) + 0),
MSUBF_D = ((3U << 3) + 1),
CLASS_D = ((3U << 3) + 3),
MIN = ((3U << 3) + 4),
MINA = ((3U << 3) + 5),
MAX = ((3U << 3) + 6),
MAXA = ((3U << 3) + 7),
CVT_S_D = ((4U << 3) + 0),
CVT_W_D = ((4U << 3) + 4),
CVT_L_D = ((4U << 3) + 5),
C_F_D = ((6U << 3) + 0),
C_UN_D = ((6U << 3) + 1),
C_EQ_D = ((6U << 3) + 2),
C_UEQ_D = ((6U << 3) + 3),
C_OLT_D = ((6U << 3) + 4),
C_ULT_D = ((6U << 3) + 5),
C_OLE_D = ((6U << 3) + 6),
C_ULE_D = ((6U << 3) + 7),
// COP1 Encoding of Function Field When rs=W or L.
CVT_S_W = ((4U << 3) + 0),
CVT_D_W = ((4U << 3) + 1),
CVT_S_L = ((4U << 3) + 0),
CVT_D_L = ((4U << 3) + 1),
BC1EQZ = ((2U << 2) + 1) << 21,
BC1NEZ = ((3U << 2) + 1) << 21,
// COP1 CMP positive predicates Bit 5..4 = 00.
CMP_AF = ((0U << 3) + 0),
CMP_UN = ((0U << 3) + 1),
CMP_EQ = ((0U << 3) + 2),
CMP_UEQ = ((0U << 3) + 3),
CMP_LT = ((0U << 3) + 4),
CMP_ULT = ((0U << 3) + 5),
CMP_LE = ((0U << 3) + 6),
CMP_ULE = ((0U << 3) + 7),
CMP_SAF = ((1U << 3) + 0),
CMP_SUN = ((1U << 3) + 1),
CMP_SEQ = ((1U << 3) + 2),
CMP_SUEQ = ((1U << 3) + 3),
CMP_SSLT = ((1U << 3) + 4),
CMP_SSULT = ((1U << 3) + 5),
CMP_SLE = ((1U << 3) + 6),
CMP_SULE = ((1U << 3) + 7),
// COP1 CMP negative predicates Bit 5..4 = 01.
CMP_AT = ((2U << 3) + 0), // Reserved, not implemented.
CMP_OR = ((2U << 3) + 1),
CMP_UNE = ((2U << 3) + 2),
CMP_NE = ((2U << 3) + 3),
CMP_UGE = ((2U << 3) + 4), // Reserved, not implemented.
CMP_OGE = ((2U << 3) + 5), // Reserved, not implemented.
CMP_UGT = ((2U << 3) + 6), // Reserved, not implemented.
CMP_OGT = ((2U << 3) + 7), // Reserved, not implemented.
CMP_SAT = ((3U << 3) + 0), // Reserved, not implemented.
CMP_SOR = ((3U << 3) + 1),
CMP_SUNE = ((3U << 3) + 2),
CMP_SNE = ((3U << 3) + 3),
CMP_SUGE = ((3U << 3) + 4), // Reserved, not implemented.
CMP_SOGE = ((3U << 3) + 5), // Reserved, not implemented.
CMP_SUGT = ((3U << 3) + 6), // Reserved, not implemented.
CMP_SOGT = ((3U << 3) + 7), // Reserved, not implemented.
SEL = ((2U << 3) + 0),
MOVF = ((2U << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt
MOVZ_C = ((2U << 3) + 2), // COP1 on FPR registers.
MOVN_C = ((2U << 3) + 3), // COP1 on FPR registers.
SELEQZ_C = ((2U << 3) + 4), // COP1 on FPR registers.
SELNEZ_C = ((2U << 3) + 7), // COP1 on FPR registers.
// COP1 Encoding of Function Field When rs=PS.
// COP1X Encoding of Function Field.
MADD_S = ((4U << 3) + 0),
MADD_D = ((4U << 3) + 1),
MSUB_S = ((5U << 3) + 0),
MSUB_D = ((5U << 3) + 1),
// PCREL Encoding of rt Field.
ADDIUPC = ((0U << 2) + 0),
LWPC = ((0U << 2) + 1),
LWUPC = ((0U << 2) + 2),
LDPC = ((0U << 3) + 6),
// reserved ((1U << 3) + 6),
AUIPC = ((3U << 3) + 6),
ALUIPC = ((3U << 3) + 7),
// POP66 Encoding of rs Field.
JIC = ((0U << 5) + 0),
// POP76 Encoding of rs Field.
JIALC = ((0U << 5) + 0),
// COP1 Encoding of rs Field for MSA Branch Instructions
BZ_V = (((1U << 3) + 3) << kRsShift),
BNZ_V = (((1U << 3) + 7) << kRsShift),
BZ_B = (((3U << 3) + 0) << kRsShift),
BZ_H = (((3U << 3) + 1) << kRsShift),
BZ_W = (((3U << 3) + 2) << kRsShift),
BZ_D = (((3U << 3) + 3) << kRsShift),
BNZ_B = (((3U << 3) + 4) << kRsShift),
BNZ_H = (((3U << 3) + 5) << kRsShift),
BNZ_W = (((3U << 3) + 6) << kRsShift),
BNZ_D = (((3U << 3) + 7) << kRsShift),
// MSA: Operation Field for MI10 Instruction Formats
MSA_LD = (8U << 2),
MSA_ST = (9U << 2),
LD_B = ((8U << 2) + 0),
LD_H = ((8U << 2) + 1),
LD_W = ((8U << 2) + 2),
LD_D = ((8U << 2) + 3),
ST_B = ((9U << 2) + 0),
ST_H = ((9U << 2) + 1),
ST_W = ((9U << 2) + 2),
ST_D = ((9U << 2) + 3),
// MSA: Operation Field for I5 Instruction Format
ADDVI = ((0U << 23) + 6),
SUBVI = ((1U << 23) + 6),
MAXI_S = ((2U << 23) + 6),
MAXI_U = ((3U << 23) + 6),
MINI_S = ((4U << 23) + 6),
MINI_U = ((5U << 23) + 6),
CEQI = ((0U << 23) + 7),
CLTI_S = ((2U << 23) + 7),
CLTI_U = ((3U << 23) + 7),
CLEI_S = ((4U << 23) + 7),
CLEI_U = ((5U << 23) + 7),
LDI = ((6U << 23) + 7), // I10 instruction format
I5_DF_b = (0U << 21),
I5_DF_h = (1U << 21),
I5_DF_w = (2U << 21),
I5_DF_d = (3U << 21),
// MSA: Operation Field for I8 Instruction Format
ANDI_B = ((0U << 24) + 0),
ORI_B = ((1U << 24) + 0),
NORI_B = ((2U << 24) + 0),
XORI_B = ((3U << 24) + 0),
BMNZI_B = ((0U << 24) + 1),
BMZI_B = ((1U << 24) + 1),
BSELI_B = ((2U << 24) + 1),
SHF_B = ((0U << 24) + 2),
SHF_H = ((1U << 24) + 2),
SHF_W = ((2U << 24) + 2),
MSA_VEC_2R_2RF_MINOR = ((3U << 3) + 6),
// MSA: Operation Field for VEC Instruction Formats
AND_V = (((0U << 2) + 0) << 21),
OR_V = (((0U << 2) + 1) << 21),
NOR_V = (((0U << 2) + 2) << 21),
XOR_V = (((0U << 2) + 3) << 21),
BMNZ_V = (((1U << 2) + 0) << 21),
BMZ_V = (((1U << 2) + 1) << 21),
BSEL_V = (((1U << 2) + 2) << 21),
// MSA: Operation Field for 2R Instruction Formats
MSA_2R_FORMAT = (((6U << 2) + 0) << 21),
FILL = (0U << 18),
PCNT = (1U << 18),
NLOC = (2U << 18),
NLZC = (3U << 18),
MSA_2R_DF_b = (0U << 16),
MSA_2R_DF_h = (1U << 16),
MSA_2R_DF_w = (2U << 16),
MSA_2R_DF_d = (3U << 16),
// MSA: Operation Field for 2RF Instruction Formats
MSA_2RF_FORMAT = (((6U << 2) + 1) << 21),
FCLASS = (0U << 17),
FTRUNC_S = (1U << 17),
FTRUNC_U = (2U << 17),
FSQRT = (3U << 17),
FRSQRT = (4U << 17),
FRCP = (5U << 17),
FRINT = (6U << 17),
FLOG2 = (7U << 17),
FEXUPL = (8U << 17),
FEXUPR = (9U << 17),
FFQL = (10U << 17),
FFQR = (11U << 17),
FTINT_S = (12U << 17),
FTINT_U = (13U << 17),
FFINT_S = (14U << 17),
FFINT_U = (15U << 17),
MSA_2RF_DF_w = (0U << 16),
MSA_2RF_DF_d = (1U << 16),
// MSA: Operation Field for 3R Instruction Format
SLL_MSA = ((0U << 23) + 13),
SRA_MSA = ((1U << 23) + 13),
SRL_MSA = ((2U << 23) + 13),
BCLR = ((3U << 23) + 13),
BSET = ((4U << 23) + 13),
BNEG = ((5U << 23) + 13),
BINSL = ((6U << 23) + 13),
BINSR = ((7U << 23) + 13),
ADDV = ((0U << 23) + 14),
SUBV = ((1U << 23) + 14),
MAX_S = ((2U << 23) + 14),
MAX_U = ((3U << 23) + 14),
MIN_S = ((4U << 23) + 14),
MIN_U = ((5U << 23) + 14),
MAX_A = ((6U << 23) + 14),
MIN_A = ((7U << 23) + 14),
CEQ = ((0U << 23) + 15),
CLT_S = ((2U << 23) + 15),
CLT_U = ((3U << 23) + 15),
CLE_S = ((4U << 23) + 15),
CLE_U = ((5U << 23) + 15),
ADD_A = ((0U << 23) + 16),
ADDS_A = ((1U << 23) + 16),
ADDS_S = ((2U << 23) + 16),
ADDS_U = ((3U << 23) + 16),
AVE_S = ((4U << 23) + 16),
AVE_U = ((5U << 23) + 16),
AVER_S = ((6U << 23) + 16),
AVER_U = ((7U << 23) + 16),
SUBS_S = ((0U << 23) + 17),
SUBS_U = ((1U << 23) + 17),
SUBSUS_U = ((2U << 23) + 17),
SUBSUU_S = ((3U << 23) + 17),
ASUB_S = ((4U << 23) + 17),
ASUB_U = ((5U << 23) + 17),
MULV = ((0U << 23) + 18),
MADDV = ((1U << 23) + 18),
MSUBV = ((2U << 23) + 18),
DIV_S_MSA = ((4U << 23) + 18),
DIV_U = ((5U << 23) + 18),
MOD_S = ((6U << 23) + 18),
MOD_U = ((7U << 23) + 18),
DOTP_S = ((0U << 23) + 19),
DOTP_U = ((1U << 23) + 19),
DPADD_S = ((2U << 23) + 19),
DPADD_U = ((3U << 23) + 19),
DPSUB_S = ((4U << 23) + 19),
DPSUB_U = ((5U << 23) + 19),
SLD = ((0U << 23) + 20),
SPLAT = ((1U << 23) + 20),
PCKEV = ((2U << 23) + 20),
PCKOD = ((3U << 23) + 20),
ILVL = ((4U << 23) + 20),
ILVR = ((5U << 23) + 20),
ILVEV = ((6U << 23) + 20),
ILVOD = ((7U << 23) + 20),
VSHF = ((0U << 23) + 21),
SRAR = ((1U << 23) + 21),
SRLR = ((2U << 23) + 21),
HADD_S = ((4U << 23) + 21),
HADD_U = ((5U << 23) + 21),
HSUB_S = ((6U << 23) + 21),
HSUB_U = ((7U << 23) + 21),
MSA_3R_DF_b = (0U << 21),
MSA_3R_DF_h = (1U << 21),
MSA_3R_DF_w = (2U << 21),
MSA_3R_DF_d = (3U << 21),
// MSA: Operation Field for 3RF Instruction Format
FCAF = ((0U << 22) + 26),
FCUN = ((1U << 22) + 26),
FCEQ = ((2U << 22) + 26),
FCUEQ = ((3U << 22) + 26),
FCLT = ((4U << 22) + 26),
FCULT = ((5U << 22) + 26),
FCLE = ((6U << 22) + 26),
FCULE = ((7U << 22) + 26),
FSAF = ((8U << 22) + 26),
FSUN = ((9U << 22) + 26),
FSEQ = ((10U << 22) + 26),
FSUEQ = ((11U << 22) + 26),
FSLT = ((12U << 22) + 26),
FSULT = ((13U << 22) + 26),
FSLE = ((14U << 22) + 26),
FSULE = ((15U << 22) + 26),
FADD = ((0U << 22) + 27),
FSUB = ((1U << 22) + 27),
FMUL = ((2U << 22) + 27),
FDIV = ((3U << 22) + 27),
FMADD = ((4U << 22) + 27),
FMSUB = ((5U << 22) + 27),
FEXP2 = ((7U << 22) + 27),
FEXDO = ((8U << 22) + 27),
FTQ = ((10U << 22) + 27),
FMIN = ((12U << 22) + 27),
FMIN_A = ((13U << 22) + 27),
FMAX = ((14U << 22) + 27),
FMAX_A = ((15U << 22) + 27),
FCOR = ((1U << 22) + 28),
FCUNE = ((2U << 22) + 28),
FCNE = ((3U << 22) + 28),
MUL_Q = ((4U << 22) + 28),
MADD_Q = ((5U << 22) + 28),
MSUB_Q = ((6U << 22) + 28),
FSOR = ((9U << 22) + 28),
FSUNE = ((10U << 22) + 28),
FSNE = ((11U << 22) + 28),
MULR_Q = ((12U << 22) + 28),
MADDR_Q = ((13U << 22) + 28),
MSUBR_Q = ((14U << 22) + 28),
// MSA: Operation Field for ELM Instruction Format
MSA_ELM_MINOR = ((3U << 3) + 1),
SLDI = (0U << 22),
CTCMSA = ((0U << 22) | (62U << 16)),
SPLATI = (1U << 22),
CFCMSA = ((1U << 22) | (62U << 16)),
COPY_S = (2U << 22),
MOVE_V = ((2U << 22) | (62U << 16)),
COPY_U = (3U << 22),
INSERT = (4U << 22),
INSVE = (5U << 22),
ELM_DF_B = ((0U << 4) << 16),
ELM_DF_H = ((4U << 3) << 16),
ELM_DF_W = ((12U << 2) << 16),
ELM_DF_D = ((28U << 1) << 16),
// MSA: Operation Field for BIT Instruction Format
SLLI = ((0U << 23) + 9),
SRAI = ((1U << 23) + 9),
SRLI = ((2U << 23) + 9),
BCLRI = ((3U << 23) + 9),
BSETI = ((4U << 23) + 9),
BNEGI = ((5U << 23) + 9),
BINSLI = ((6U << 23) + 9),
BINSRI = ((7U << 23) + 9),
SAT_S = ((0U << 23) + 10),
SAT_U = ((1U << 23) + 10),
SRARI = ((2U << 23) + 10),
SRLRI = ((3U << 23) + 10),
BIT_DF_b = ((14U << 3) << 16),
BIT_DF_h = ((6U << 4) << 16),
BIT_DF_w = ((2U << 5) << 16),
BIT_DF_d = ((0U << 6) << 16),
nullptrSF = 0U
};
enum MSAMinorOpcode : uint32_t {
kMsaMinorUndefined = 0,
kMsaMinorI8,
kMsaMinorI5,
kMsaMinorI10,
kMsaMinorBIT,
kMsaMinor3R,
kMsaMinor3RF,
kMsaMinorELM,
kMsaMinorVEC,
kMsaMinor2R,
kMsaMinor2RF,
kMsaMinorMI10
};
// ----- Emulated conditions.
// On MIPS we use this enum to abstract from conditional branch instructions.
// The 'U' prefix is used to specify unsigned comparisons.
// Opposite conditions must be paired as odd/even numbers
// because 'NegateCondition' function flips LSB to negate condition.
enum Condition {
// Any value < 0 is considered no_condition.
kNoCondition = -1,
overflow = 0,
no_overflow = 1,
Uless = 2,
Ugreater_equal = 3,
Uless_equal = 4,
Ugreater = 5,
equal = 6,
not_equal = 7, // Unordered or Not Equal.
negative = 8,
positive = 9,
parity_even = 10,
parity_odd = 11,
less = 12,
greater_equal = 13,
less_equal = 14,
greater = 15,
ueq = 16, // Unordered or Equal.
ogl = 17, // Ordered and Not Equal.
cc_always = 18,
// Aliases.
carry = Uless,
not_carry = Ugreater_equal,
zero = equal,
eq = equal,
not_zero = not_equal,
ne = not_equal,
nz = not_equal,
sign = negative,
not_sign = positive,
mi = negative,
pl = positive,
hi = Ugreater,
ls = Uless_equal,
ge = greater_equal,
lt = less,
gt = greater,
le = less_equal,
hs = Ugreater_equal,
lo = Uless,
al = cc_always,
ult = Uless,
uge = Ugreater_equal,
ule = Uless_equal,
ugt = Ugreater,
cc_default = kNoCondition
};
// Returns the equivalent of !cc.
// Negation of the default kNoCondition (-1) results in a non-default
// no_condition value (-2). As long as tests for no_condition check
// for condition < 0, this will work as expected.
inline Condition NegateCondition(Condition cc) {
DCHECK(cc != cc_always);
return static_cast<Condition>(cc ^ 1);
}
inline Condition NegateFpuCondition(Condition cc) {
DCHECK(cc != cc_always);
switch (cc) {
case ult:
return ge;
case ugt:
return le;
case uge:
return lt;
case ule:
return gt;
case lt:
return uge;
case gt:
return ule;
case ge:
return ult;
case le:
return ugt;
case eq:
return ne;
case ne:
return eq;
case ueq:
return ogl;
case ogl:
return ueq;
default:
return cc;
}
}
enum MSABranchCondition {
all_not_zero = 0, // Branch If All Elements Are Not Zero
one_elem_not_zero, // Branch If At Least One Element of Any Format Is Not
// Zero
one_elem_zero, // Branch If At Least One Element Is Zero
all_zero // Branch If All Elements of Any Format Are Zero
};
inline MSABranchCondition NegateMSABranchCondition(MSABranchCondition cond) {
switch (cond) {
case all_not_zero:
return one_elem_zero;
case one_elem_not_zero:
return all_zero;
case one_elem_zero:
return all_not_zero;
case all_zero:
return one_elem_not_zero;
default:
return cond;
}
}
enum MSABranchDF {
MSA_BRANCH_B = 0,
MSA_BRANCH_H,
MSA_BRANCH_W,
MSA_BRANCH_D,
MSA_BRANCH_V
};
// ----- Coprocessor conditions.
enum FPUCondition {
kNoFPUCondition = -1,
F = 0x00, // False.
UN = 0x01, // Unordered.
EQ = 0x02, // Equal.
UEQ = 0x03, // Unordered or Equal.
OLT = 0x04, // Ordered or Less Than, on Mips release < 6.
LT = 0x04, // Ordered or Less Than, on Mips release >= 6.
ULT = 0x05, // Unordered or Less Than.
OLE = 0x06, // Ordered or Less Than or Equal, on Mips release < 6.
LE = 0x06, // Ordered or Less Than or Equal, on Mips release >= 6.
ULE = 0x07, // Unordered or Less Than or Equal.
// Following constants are available on Mips release >= 6 only.
ORD = 0x11, // Ordered, on Mips release >= 6.
UNE = 0x12, // Not equal, on Mips release >= 6.
NE = 0x13, // Ordered Greater Than or Less Than. on Mips >= 6 only.
};
// FPU rounding modes.
enum FPURoundingMode {
RN = 0 << 0, // Round to Nearest.
RZ = 1 << 0, // Round towards zero.
RP = 2 << 0, // Round towards Plus Infinity.
RM = 3 << 0, // Round towards Minus Infinity.
// Aliases.
kRoundToNearest = RN,
kRoundToZero = RZ,
kRoundToPlusInf = RP,
kRoundToMinusInf = RM,
mode_round = RN,
mode_ceil = RP,
mode_floor = RM,
mode_trunc = RZ
};
const uint32_t kFPURoundingModeMask = 3 << 0;
enum CheckForInexactConversion {
kCheckForInexactConversion,
kDontCheckForInexactConversion
};
enum class MaxMinKind : int { kMin = 0, kMax = 1 };
// -----------------------------------------------------------------------------
// Hints.
// Branch hints are not used on the MIPS. They are defined so that they can
// appear in shared function signatures, but will be ignored in MIPS
// implementations.
enum Hint { no_hint = 0 };
inline Hint NegateHint(Hint hint) { return no_hint; }
// -----------------------------------------------------------------------------
// Specific instructions, constants, and masks.
// These constants are declared in assembler-mips.cc, as they use named
// registers and other constants.
// addiu(sp, sp, 4) aka Pop() operation or part of Pop(r)
// operations as post-increment of sp.
extern const Instr kPopInstruction;
// addiu(sp, sp, -4) part of Push(r) operation as pre-decrement of sp.
extern const Instr kPushInstruction;
// Sw(r, MemOperand(sp, 0))
extern const Instr kPushRegPattern;
// Lw(r, MemOperand(sp, 0))
extern const Instr kPopRegPattern;
extern const Instr kLwRegFpOffsetPattern;
extern const Instr kSwRegFpOffsetPattern;
extern const Instr kLwRegFpNegOffsetPattern;
extern const Instr kSwRegFpNegOffsetPattern;
// A mask for the Rt register for push, pop, lw, sw instructions.
extern const Instr kRtMask;
extern const Instr kLwSwInstrTypeMask;
extern const Instr kLwSwInstrArgumentMask;
extern const Instr kLwSwOffsetMask;
// Break 0xfffff, reserved for redirected real time call.
const Instr rtCallRedirInstr = SPECIAL | BREAK | call_rt_redirected << 6;
// A nop instruction. (Encoding of sll 0 0 0).
const Instr nopInstr = 0;
static constexpr uint64_t OpcodeToBitNumber(Opcode opcode) {
return 1ULL << (static_cast<uint32_t>(opcode) >> kOpcodeShift);
}
constexpr uint8_t kInstrSize = 4;
constexpr uint8_t kInstrSizeLog2 = 2;
class InstructionBase {
public:
enum {
// On MIPS PC cannot actually be directly accessed. We behave as if PC was
// always the value of the current instruction being executed.
kPCReadOffset = 0
};
// Instruction type.
enum Type { kRegisterType, kImmediateType, kJumpType, kUnsupported = -1 };
// Get the raw instruction bits.
inline Instr InstructionBits() const {
return *reinterpret_cast<const Instr*>(this);
}
// Set the raw instruction bits to value.
inline void SetInstructionBits(Instr value) {
*reinterpret_cast<Instr*>(this) = value;
}
// Read one particular bit out of the instruction bits.
inline int Bit(int nr) const { return (InstructionBits() >> nr) & 1; }
// Read a bit field out of the instruction bits.
inline int Bits(int hi, int lo) const {
return (InstructionBits() >> lo) & ((2U << (hi - lo)) - 1);
}
static constexpr uint64_t kOpcodeImmediateTypeMask =
OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) |
OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) |
OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) |
OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) |
OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) |
OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) |
OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) |
OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) |
OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) |
OpcodeToBitNumber(BGTZL) | OpcodeToBitNumber(POP66) |
OpcodeToBitNumber(POP76) | OpcodeToBitNumber(LB) | OpcodeToBitNumber(LH) |
OpcodeToBitNumber(LWL) | OpcodeToBitNumber(LW) | OpcodeToBitNumber(LWU) |
OpcodeToBitNumber(LD) | OpcodeToBitNumber(LBU) | OpcodeToBitNumber(LHU) |
OpcodeToBitNumber(LDL) | OpcodeToBitNumber(LDR) | OpcodeToBitNumber(LWR) |
OpcodeToBitNumber(SDL) | OpcodeToBitNumber(SB) | OpcodeToBitNumber(SH) |
OpcodeToBitNumber(SWL) | OpcodeToBitNumber(SW) | OpcodeToBitNumber(SD) |
OpcodeToBitNumber(SWR) | OpcodeToBitNumber(SDR) |
OpcodeToBitNumber(LWC1) | OpcodeToBitNumber(LDC1) |
OpcodeToBitNumber(SWC1) | OpcodeToBitNumber(SDC1) |
OpcodeToBitNumber(PCREL) | OpcodeToBitNumber(DAUI) |
OpcodeToBitNumber(BC) | OpcodeToBitNumber(BALC);
#define FunctionFieldToBitNumber(function) (1ULL << function)
// On r6, DCLZ_R6 aliases to existing MFLO.
static const uint64_t kFunctionFieldRegisterTypeMask =
FunctionFieldToBitNumber(JR) | FunctionFieldToBitNumber(JALR) |
FunctionFieldToBitNumber(BREAK) | FunctionFieldToBitNumber(SLL) |
FunctionFieldToBitNumber(DSLL) | FunctionFieldToBitNumber(DSLL32) |
FunctionFieldToBitNumber(SRL) | FunctionFieldToBitNumber(DSRL) |
FunctionFieldToBitNumber(DSRL32) | FunctionFieldToBitNumber(SRA) |
FunctionFieldToBitNumber(DSRA) | FunctionFieldToBitNumber(DSRA32) |
FunctionFieldToBitNumber(SLLV) | FunctionFieldToBitNumber(DSLLV) |
FunctionFieldToBitNumber(SRLV) | FunctionFieldToBitNumber(DSRLV) |
FunctionFieldToBitNumber(SRAV) | FunctionFieldToBitNumber(DSRAV) |
FunctionFieldToBitNumber(LSA) | FunctionFieldToBitNumber(DLSA) |
FunctionFieldToBitNumber(MFHI) | FunctionFieldToBitNumber(MFLO) |
FunctionFieldToBitNumber(MULT) | FunctionFieldToBitNumber(DMULT) |
FunctionFieldToBitNumber(MULTU) | FunctionFieldToBitNumber(DMULTU) |
FunctionFieldToBitNumber(DIV) | FunctionFieldToBitNumber(DDIV) |
FunctionFieldToBitNumber(DIVU) | FunctionFieldToBitNumber(DDIVU) |
FunctionFieldToBitNumber(ADD) | FunctionFieldToBitNumber(DADD) |
FunctionFieldToBitNumber(ADDU) | FunctionFieldToBitNumber(DADDU) |
FunctionFieldToBitNumber(SUB) | FunctionFieldToBitNumber(DSUB) |
FunctionFieldToBitNumber(SUBU) | FunctionFieldToBitNumber(DSUBU) |
FunctionFieldToBitNumber(AND) | FunctionFieldToBitNumber(OR) |
FunctionFieldToBitNumber(XOR) | FunctionFieldToBitNumber(NOR) |
FunctionFieldToBitNumber(SLT) | FunctionFieldToBitNumber(SLTU) |
FunctionFieldToBitNumber(TGE) | FunctionFieldToBitNumber(TGEU) |
FunctionFieldToBitNumber(TLT) | FunctionFieldToBitNumber(TLTU) |
FunctionFieldToBitNumber(TEQ) | FunctionFieldToBitNumber(TNE) |
FunctionFieldToBitNumber(MOVZ) | FunctionFieldToBitNumber(MOVN) |
FunctionFieldToBitNumber(MOVCI) | FunctionFieldToBitNumber(SELEQZ_S) |
FunctionFieldToBitNumber(SELNEZ_S) | FunctionFieldToBitNumber(SYNC);
// Accessors for the different named fields used in the MIPS encoding.
inline Opcode OpcodeValue() const {
return static_cast<Opcode>(
Bits(kOpcodeShift + kOpcodeBits - 1, kOpcodeShift));
}
inline int FunctionFieldRaw() const {
return InstructionBits() & kFunctionFieldMask;
}
// Return the fields at their original place in the instruction encoding.
inline Opcode OpcodeFieldRaw() const {
return static_cast<Opcode>(InstructionBits() & kOpcodeMask);
}
// Safe to call within InstructionType().
inline int RsFieldRawNoAssert() const {
return InstructionBits() & kRsFieldMask;
}
inline int SaFieldRaw() const { return InstructionBits() & kSaFieldMask; }
// Get the encoding type of the instruction.
inline Type InstructionType() const;
inline MSAMinorOpcode MSAMinorOpcodeField() const {
int op = this->FunctionFieldRaw();
switch (op) {
case 0:
case 1:
case 2:
return kMsaMinorI8;
case 6:
return kMsaMinorI5;
case 7:
return (((this->InstructionBits() & kMsaI5I10Mask) == LDI)
? kMsaMinorI10
: kMsaMinorI5);
case 9:
case 10:
return kMsaMinorBIT;
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
return kMsaMinor3R;
case 25:
return kMsaMinorELM;
case 26:
case 27:
case 28:
return kMsaMinor3RF;
case 30:
switch (this->RsFieldRawNoAssert()) {
case MSA_2R_FORMAT:
return kMsaMinor2R;
case MSA_2RF_FORMAT:
return kMsaMinor2RF;
default:
return kMsaMinorVEC;
}
break;
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
return kMsaMinorMI10;
default:
return kMsaMinorUndefined;
}
}
protected:
InstructionBase() {}
};
template <class T>
class InstructionGetters : public T {
public:
inline int RsValue() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
return this->Bits(kRsShift + kRsBits - 1, kRsShift);
}
inline int RtValue() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
return this->Bits(kRtShift + kRtBits - 1, kRtShift);
}
inline int RdValue() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kRegisterType);
return this->Bits(kRdShift + kRdBits - 1, kRdShift);
}
inline int BaseValue() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kBaseShift + kBaseBits - 1, kBaseShift);
}
inline int SaValue() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kRegisterType);
return this->Bits(kSaShift + kSaBits - 1, kSaShift);
}
inline int LsaSaValue() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kRegisterType);
return this->Bits(kSaShift + kLsaSaBits - 1, kSaShift);
}
inline int FunctionValue() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
return this->Bits(kFunctionShift + kFunctionBits - 1, kFunctionShift);
}
inline int FdValue() const {
return this->Bits(kFdShift + kFdBits - 1, kFdShift);
}
inline int FsValue() const {
return this->Bits(kFsShift + kFsBits - 1, kFsShift);
}
inline int FtValue() const {
return this->Bits(kFtShift + kFtBits - 1, kFtShift);
}
inline int FrValue() const {
return this->Bits(kFrShift + kFrBits - 1, kFrShift);
}
inline int WdValue() const {
return this->Bits(kWdShift + kWdBits - 1, kWdShift);
}
inline int WsValue() const {
return this->Bits(kWsShift + kWsBits - 1, kWsShift);
}
inline int WtValue() const {
return this->Bits(kWtShift + kWtBits - 1, kWtShift);
}
inline int Bp2Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kRegisterType);
return this->Bits(kBp2Shift + kBp2Bits - 1, kBp2Shift);
}
inline int Bp3Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kRegisterType);
return this->Bits(kBp3Shift + kBp3Bits - 1, kBp3Shift);
}
// Float Compare condition code instruction bits.
inline int FCccValue() const {
return this->Bits(kFCccShift + kFCccBits - 1, kFCccShift);
}
// Float Branch condition code instruction bits.
inline int FBccValue() const {
return this->Bits(kFBccShift + kFBccBits - 1, kFBccShift);
}
// Float Branch true/false instruction bit.
inline int FBtrueValue() const {
return this->Bits(kFBtrueShift + kFBtrueBits - 1, kFBtrueShift);
}
// Return the fields at their original place in the instruction encoding.
inline Opcode OpcodeFieldRaw() const {
return static_cast<Opcode>(this->InstructionBits() & kOpcodeMask);
}
inline int RsFieldRaw() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
return this->InstructionBits() & kRsFieldMask;
}
// Same as above function, but safe to call within InstructionType().
inline int RsFieldRawNoAssert() const {
return this->InstructionBits() & kRsFieldMask;
}
inline int RtFieldRaw() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
return this->InstructionBits() & kRtFieldMask;
}
inline int RdFieldRaw() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kRegisterType);
return this->InstructionBits() & kRdFieldMask;
}
inline int SaFieldRaw() const {
return this->InstructionBits() & kSaFieldMask;
}
inline int FunctionFieldRaw() const {
return this->InstructionBits() & kFunctionFieldMask;
}
// Get the secondary field according to the opcode.
inline int SecondaryValue() const {
Opcode op = this->OpcodeFieldRaw();
switch (op) {
case SPECIAL:
case SPECIAL2:
return FunctionValue();
case COP1:
return RsValue();
case REGIMM:
return RtValue();
default:
return nullptrSF;
}
}
inline int32_t ImmValue(int bits) const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(bits - 1, 0);
}
inline int32_t Imm9Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kImm9Shift + kImm9Bits - 1, kImm9Shift);
}
inline int32_t Imm16Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift);
}
inline int32_t Imm18Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kImm18Shift + kImm18Bits - 1, kImm18Shift);
}
inline int32_t Imm19Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kImm19Shift + kImm19Bits - 1, kImm19Shift);
}
inline int32_t Imm21Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift);
}
inline int32_t Imm26Value() const {
DCHECK((this->InstructionType() == InstructionBase::kJumpType) ||
(this->InstructionType() == InstructionBase::kImmediateType));
return this->Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift);
}
inline int32_t MsaImm8Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kMsaImm8Shift + kMsaImm8Bits - 1, kMsaImm8Shift);
}
inline int32_t MsaImm5Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kMsaImm5Shift + kMsaImm5Bits - 1, kMsaImm5Shift);
}
inline int32_t MsaImm10Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kMsaImm10Shift + kMsaImm10Bits - 1, kMsaImm10Shift);
}
inline int32_t MsaImmMI10Value() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(kMsaImmMI10Shift + kMsaImmMI10Bits - 1, kMsaImmMI10Shift);
}
inline int32_t MsaBitDf() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
int32_t df_m = this->Bits(22, 16);
if (((df_m >> 6) & 1U) == 0) {
return 3;
} else if (((df_m >> 5) & 3U) == 2) {
return 2;
} else if (((df_m >> 4) & 7U) == 6) {
return 1;
} else if (((df_m >> 3) & 15U) == 14) {
return 0;
} else {
return -1;
}
}
inline int32_t MsaBitMValue() const {
DCHECK_EQ(this->InstructionType(), InstructionBase::kImmediateType);
return this->Bits(16 + this->MsaBitDf() + 3, 16);
}
inline int32_t MsaElmDf() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
int32_t df_n = this->Bits(21, 16);
if (((df_n >> 4) & 3U) == 0) {
return 0;
} else if (((df_n >> 3) & 7U) == 4) {
return 1;
} else if (((df_n >> 2) & 15U) == 12) {
return 2;
} else if (((df_n >> 1) & 31U) == 28) {
return 3;
} else {
return -1;
}
}
inline int32_t MsaElmNValue() const {
DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
this->InstructionType() == InstructionBase::kImmediateType);
return this->Bits(16 + 4 - this->MsaElmDf(), 16);
}
static bool IsForbiddenAfterBranchInstr(Instr instr);
// Say if the instruction should not be used in a branch delay slot or
// immediately after a compact branch.
inline bool IsForbiddenAfterBranch() const {
return IsForbiddenAfterBranchInstr(this->InstructionBits());
}
inline bool IsForbiddenInBranchDelay() const {
return IsForbiddenAfterBranch();
}
// Say if the instruction 'links'. e.g. jal, bal.
bool IsLinkingInstruction() const;
// Say if the instruction is a break or a trap.
bool IsTrap() const;
inline bool IsMSABranchInstr() const {
if (this->OpcodeFieldRaw() == COP1) {
switch (this->RsFieldRaw()) {
case BZ_V:
case BZ_B:
case BZ_H:
case BZ_W:
case BZ_D:
case BNZ_V:
case BNZ_B:
case BNZ_H:
case BNZ_W:
case BNZ_D:
return true;
default:
return false;
}
}
return false;
}
inline bool IsMSAInstr() const {
if (this->IsMSABranchInstr() || (this->OpcodeFieldRaw() == MSA))
return true;
return false;
}
};
class Instruction : public InstructionGetters<InstructionBase> {
public:
// Instructions are read of out a code stream. The only way to get a
// reference to an instruction is to convert a pointer. There is no way
// to allocate or create instances of class Instruction.
// Use the At(pc) function to create references to Instruction.
static Instruction* At(byte* pc) {
return reinterpret_cast<Instruction*>(pc);
}
private:
// We need to prevent the creation of instances of class Instruction.
DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction);
};
// -----------------------------------------------------------------------------
// MIPS assembly various constants.
// C/C++ argument slots size.
const int kCArgSlotCount = 0;
// TODO(plind): below should be based on kPointerSize
// TODO(plind): find all usages and remove the needless instructions for n64.
const int kCArgsSlotsSize = kCArgSlotCount * kInstrSize * 2;
const int kInvalidStackOffset = -1;
const int kBranchReturnOffset = 2 * kInstrSize;
static const int kNegOffset = 0x00008000;
InstructionBase::Type InstructionBase::InstructionType() const {
switch (OpcodeFieldRaw()) {
case SPECIAL:
if (FunctionFieldToBitNumber(FunctionFieldRaw()) &
kFunctionFieldRegisterTypeMask) {
return kRegisterType;
}
return kUnsupported;
case SPECIAL2:
switch (FunctionFieldRaw()) {
case MUL:
case CLZ:
case DCLZ:
return kRegisterType;
default:
return kUnsupported;
}
break;
case SPECIAL3:
switch (FunctionFieldRaw()) {
case INS:
case DINS:
case DINSM:
case DINSU:
case EXT:
case DEXT:
case DEXTM:
case DEXTU:
return kRegisterType;
case BSHFL: {
int sa = SaFieldRaw() >> kSaShift;
switch (sa) {
case BITSWAP:
case WSBH:
case SEB:
case SEH:
return kRegisterType;
}
sa >>= kBp2Bits;
switch (sa) {
case ALIGN:
return kRegisterType;
default:
return kUnsupported;
}
}
case LL_R6:
case LLD_R6:
case SC_R6:
case SCD_R6: {
DCHECK_EQ(kArchVariant, kMips64r6);
return kImmediateType;
}
case DBSHFL: {
int sa = SaFieldRaw() >> kSaShift;
switch (sa) {
case DBITSWAP:
case DSBH:
case DSHD:
return kRegisterType;
}
sa = SaFieldRaw() >> kSaShift;
sa >>= kBp3Bits;
switch (sa) {
case DALIGN:
return kRegisterType;
default:
return kUnsupported;
}
}
default:
return kUnsupported;
}
break;
case COP1: // Coprocessor instructions.
switch (RsFieldRawNoAssert()) {
case BC1: // Branch on coprocessor condition.
case BC1EQZ:
case BC1NEZ:
return kImmediateType;
// MSA Branch instructions
case BZ_V:
case BNZ_V:
case BZ_B:
case BZ_H:
case BZ_W:
case BZ_D:
case BNZ_B:
case BNZ_H:
case BNZ_W:
case BNZ_D:
return kImmediateType;
default:
return kRegisterType;
}
break;
case COP1X:
return kRegisterType;
// 26 bits immediate type instructions. e.g.: j imm26.
case J:
case JAL:
return kJumpType;
case MSA:
switch (MSAMinorOpcodeField()) {
case kMsaMinor3R:
case kMsaMinor3RF:
case kMsaMinorVEC:
case kMsaMinor2R:
case kMsaMinor2RF:
return kRegisterType;
case kMsaMinorELM:
switch (InstructionBits() & kMsaLongerELMMask) {
case CFCMSA:
case CTCMSA:
case MOVE_V:
return kRegisterType;
default:
return kImmediateType;
}
default:
return kImmediateType;
}
default:
return kImmediateType;
}
return kUnsupported;
}
#undef OpcodeToBitNumber
#undef FunctionFieldToBitNumber
// -----------------------------------------------------------------------------
// Instructions.
template <class P>
bool InstructionGetters<P>::IsLinkingInstruction() const {
switch (OpcodeFieldRaw()) {
case JAL:
return true;
case POP76:
if (RsFieldRawNoAssert() == JIALC)
return true; // JIALC
else
return false; // BNEZC
case REGIMM:
switch (RtFieldRaw()) {
case BGEZAL:
case BLTZAL:
return true;
default:
return false;
}
case SPECIAL:
switch (FunctionFieldRaw()) {
case JALR:
return true;
default:
return false;
}
default:
return false;
}
}
template <class P>
bool InstructionGetters<P>::IsTrap() const {
if (OpcodeFieldRaw() != SPECIAL) {
return false;
} else {
switch (FunctionFieldRaw()) {
case BREAK:
case TGE:
case TGEU:
case TLT:
case TLTU:
case TEQ:
case TNE:
return true;
default:
return false;
}
}
}
// static
template <class T>
bool InstructionGetters<T>::IsForbiddenAfterBranchInstr(Instr instr) {
Opcode opcode = static_cast<Opcode>(instr & kOpcodeMask);
switch (opcode) {
case J:
case JAL:
case BEQ:
case BNE:
case BLEZ: // POP06 bgeuc/bleuc, blezalc, bgezalc
case BGTZ: // POP07 bltuc/bgtuc, bgtzalc, bltzalc
case BEQL:
case BNEL:
case BLEZL: // POP26 bgezc, blezc, bgec/blec
case BGTZL: // POP27 bgtzc, bltzc, bltc/bgtc
case BC:
case BALC:
case POP10: // beqzalc, bovc, beqc
case POP30: // bnezalc, bnvc, bnec
case POP66: // beqzc, jic
case POP76: // bnezc, jialc
return true;
case REGIMM:
switch (instr & kRtFieldMask) {
case BLTZ:
case BGEZ:
case BLTZAL:
case BGEZAL:
return true;
default:
return false;
}
break;
case SPECIAL:
switch (instr & kFunctionFieldMask) {
case JR:
case JALR:
return true;
default:
return false;
}
break;
case COP1:
switch (instr & kRsFieldMask) {
case BC1:
case BC1EQZ:
case BC1NEZ:
case BZ_V:
case BZ_B:
case BZ_H:
case BZ_W:
case BZ_D:
case BNZ_V:
case BNZ_B:
case BNZ_H:
case BNZ_W:
case BNZ_D:
return true;
break;
default:
return false;
}
break;
default:
return false;
}
}
} // namespace internal
} // namespace v8
#endif // V8_CODEGEN_MIPS64_CONSTANTS_MIPS64_H_
| {
"pile_set_name": "Github"
} |
<?php
/*
+---------------------------------------------------------------------------+
| Revive Adserver |
| http://www.revive-adserver.com |
| |
| Copyright: See the COPYRIGHT.txt file. |
| License: GPLv2 or later, see the LICENSE.txt file. |
+---------------------------------------------------------------------------+
*/
require_once MAX_PATH .'/lib/OA/Admin/UI/component/Form.php';
/**
* @package OX_Admin_UI
* @subpackage Install
*/
class OX_Admin_UI_Install_BaseForm
extends OA_Admin_UI_Component_Form
{
/**
* OX translation class
*
* @var OX_Translation
*/
protected $oTranslation;
/**
* Builds Database details form.
* @param OX_Translation $oTranslation instance
*/
public function __construct($formName='', $method='POST', $action='', $attributes=null, $oTranslation=null)
{
parent::__construct($formName, $method, $action, '', $attributes, true);
$this->forceClientValidation(true);
$this->oTranslation = $oTranslation;
}
protected function getRequiredFieldMessage($fieldLabel)
{
return $this->oTranslation->translate('XRequiredField', array($fieldLabel));
}
protected function addRequiredRule($fieldName, $fieldLabel)
{
$this->addRule($fieldName, $this->getRequiredFieldMessage($fieldLabel), 'required');
}
}
?> | {
"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.
*/
#ifndef APR_H
#define APR_H
/* GENERATED FILE WARNING! DO NOT EDIT apr.h
*
* You must modify apr.hwc instead.
*
* And please, make an effort to stub apr.hnw and apr.h.in in the process.
*
* This is the Win32 specific version of apr.h. It is copied from
* apr.hw by the apr.dsp and libapr.dsp projects.
*/
/**
* @file apr.h
* @brief APR Platform Definitions
* @remark This is a generated header generated from include/apr.h.in by
* ./configure, or copied from include/apr.hw or include/apr.hnw
* for Win32 or Netware by those build environments, respectively.
*/
/* Make sure we have our platform identifier macro defined we ask for later.
*/
#if defined(_WIN32) && !defined(WIN32)
#define WIN32 1
#endif
#if defined(WIN32) || defined(DOXYGEN)
/* Ignore most warnings (back down to /W3) for poorly constructed headers
*/
#if defined(_MSC_VER) && _MSC_VER >= 1200
#pragma warning(push, 3)
#endif
/* disable or reduce the frequency of...
* C4057: indirection to slightly different base types
* C4075: slight indirection changes (unsigned short* vs short[])
* C4100: unreferenced formal parameter
* C4127: conditional expression is constant
* C4163: '_rotl64' : not available as an intrinsic function
* C4201: nonstandard extension nameless struct/unions
* C4244: int to char/short - precision loss
* C4514: unreferenced inline function removed
*/
#pragma warning(disable: 4100 4127 4163 4201 4514; once: 4057 4075 4244)
/* Ignore Microsoft's interpretation of secure development
* and the POSIX string handling API
*/
#if defined(_MSC_VER) && _MSC_VER >= 1400
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#pragma warning(disable: 4996)
#endif
/* Has windows.h already been included? If so, our preferences don't matter,
* but we will still need the winsock things no matter what was included.
* If not, include a restricted set of windows headers to our tastes.
*/
#ifndef _WINDOWS_
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT @win32_winnt_str@
#endif
#ifndef NOUSER
#define NOUSER
#endif
#ifndef NOMCX
#define NOMCX
#endif
#ifndef NOIME
#define NOIME
#endif
#include <windows.h>
/*
* Add a _very_few_ declarations missing from the restricted set of headers
* (If this list becomes extensive, re-enable the required headers above!)
* winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
*/
#define SW_HIDE 0
#ifndef _WIN32_WCE
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#else
#include <winsock.h>
#endif
#endif /* !_WINDOWS_ */
/**
* @defgroup APR Apache Portability Runtime library
* @{
*/
/**
* @defgroup apr_platform Platform Definitions
* @{
* @warning
* <strong><em>The actual values of macros and typedefs on this page<br>
* are platform specific and should NOT be relied upon!</em></strong>
*/
#define APR_INLINE __inline
#define APR_HAS_INLINE 1
#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(__x)
#endif
#ifndef _WIN32_WCE
#define APR_HAVE_ARPA_INET_H 0
#define APR_HAVE_CONIO_H 1
#define APR_HAVE_CRYPT_H 0
#define APR_HAVE_CTYPE_H 1
#define APR_HAVE_DIRENT_H 0
#define APR_HAVE_ERRNO_H 1
#define APR_HAVE_FCNTL_H 1
#define APR_HAVE_IO_H 1
#define APR_HAVE_LIMITS_H 1
#define APR_HAVE_NETDB_H 0
#define APR_HAVE_NETINET_IN_H 0
#define APR_HAVE_NETINET_SCTP_H 0
#define APR_HAVE_NETINET_SCTP_UIO_H 0
#define APR_HAVE_NETINET_TCP_H 0
#define APR_HAVE_PTHREAD_H 0
#define APR_HAVE_SEMAPHORE_H 0
#define APR_HAVE_SIGNAL_H 1
#define APR_HAVE_STDARG_H 1
#define APR_HAVE_STDINT_H 0
#define APR_HAVE_STDIO_H 1
#define APR_HAVE_STDLIB_H 1
#define APR_HAVE_STRING_H 1
#define APR_HAVE_STRINGS_H 0
#define APR_HAVE_SYS_IOCTL_H 0
#define APR_HAVE_SYS_SENDFILE_H 0
#define APR_HAVE_SYS_SIGNAL_H 0
#define APR_HAVE_SYS_SOCKET_H 0
#define APR_HAVE_SYS_SOCKIO_H 0
#define APR_HAVE_SYS_SYSLIMITS_H 0
#define APR_HAVE_SYS_TIME_H 0
#define APR_HAVE_SYS_TYPES_H 1
#define APR_HAVE_SYS_UIO_H 0
#define APR_HAVE_SYS_UN_H 0
#define APR_HAVE_SYS_WAIT_H 0
#define APR_HAVE_TIME_H 1
#define APR_HAVE_UNISTD_H 0
#define APR_HAVE_STDDEF_H 1
#define APR_HAVE_PROCESS_H 1
#else
#define APR_HAVE_ARPA_INET_H 0
#define APR_HAVE_CONIO_H 0
#define APR_HAVE_CRYPT_H 0
#define APR_HAVE_CTYPE_H 0
#define APR_HAVE_DIRENT_H 0
#define APR_HAVE_ERRNO_H 0
#define APR_HAVE_FCNTL_H 0
#define APR_HAVE_IO_H 0
#define APR_HAVE_LIMITS_H 0
#define APR_HAVE_NETDB_H 0
#define APR_HAVE_NETINET_IN_H 0
#define APR_HAVE_NETINET_SCTP_H 0
#define APR_HAVE_NETINET_SCTP_UIO_H 0
#define APR_HAVE_NETINET_TCP_H 0
#define APR_HAVE_PTHREAD_H 0
#define APR_HAVE_SEMAPHORE_H 0
#define APR_HAVE_SIGNAL_H 0
#define APR_HAVE_STDARG_H 0
#define APR_HAVE_STDINT_H 0
#define APR_HAVE_STDIO_H 1
#define APR_HAVE_STDLIB_H 1
#define APR_HAVE_STRING_H 1
#define APR_HAVE_STRINGS_H 0
#define APR_HAVE_SYS_IOCTL_H 0
#define APR_HAVE_SYS_SENDFILE_H 0
#define APR_HAVE_SYS_SIGNAL_H 0
#define APR_HAVE_SYS_SOCKET_H 0
#define APR_HAVE_SYS_SOCKIO_H 0
#define APR_HAVE_SYS_SYSLIMITS_H 0
#define APR_HAVE_SYS_TIME_H 0
#define APR_HAVE_SYS_TYPES_H 0
#define APR_HAVE_SYS_UIO_H 0
#define APR_HAVE_SYS_UN_H 0
#define APR_HAVE_SYS_WAIT_H 0
#define APR_HAVE_TIME_H 0
#define APR_HAVE_UNISTD_H 0
#define APR_HAVE_STDDEF_H 0
#define APR_HAVE_PROCESS_H 0
#endif
/** @} */
/** @} */
/* We don't include our conditional headers within the doxyblocks
* or the extern "C" namespace
*/
#if APR_HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if APR_HAVE_STDIO_H
#include <stdio.h>
#endif
#if APR_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if APR_HAVE_STDDEF_H
#include <stddef.h>
#endif
#if APR_HAVE_TIME_H
#include <time.h>
#endif
#if APR_HAVE_PROCESS_H
#include <process.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup apr_platform
* @ingroup APR
* @{
*/
#define APR_HAVE_SHMEM_MMAP_TMP 0
#define APR_HAVE_SHMEM_MMAP_SHM 0
#define APR_HAVE_SHMEM_MMAP_ZERO 0
#define APR_HAVE_SHMEM_SHMGET_ANON 0
#define APR_HAVE_SHMEM_SHMGET 0
#define APR_HAVE_SHMEM_MMAP_ANON 0
#define APR_HAVE_SHMEM_BEOS 0
#define APR_USE_SHMEM_MMAP_TMP 0
#define APR_USE_SHMEM_MMAP_SHM 0
#define APR_USE_SHMEM_MMAP_ZERO 0
#define APR_USE_SHMEM_SHMGET_ANON 0
#define APR_USE_SHMEM_SHMGET 0
#define APR_USE_SHMEM_MMAP_ANON 0
#define APR_USE_SHMEM_BEOS 0
#define APR_USE_FLOCK_SERIALIZE 0
#define APR_USE_POSIXSEM_SERIALIZE 0
#define APR_USE_SYSVSEM_SERIALIZE 0
#define APR_USE_FCNTL_SERIALIZE 0
#define APR_USE_PROC_PTHREAD_SERIALIZE 0
#define APR_USE_PTHREAD_SERIALIZE 0
#define APR_HAS_FLOCK_SERIALIZE 0
#define APR_HAS_SYSVSEM_SERIALIZE 0
#define APR_HAS_POSIXSEM_SERIALIZE 0
#define APR_HAS_FCNTL_SERIALIZE 0
#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
#define APR_PROCESS_LOCK_IS_GLOBAL 0
#define APR_HAVE_CORKABLE_TCP 0
#define APR_HAVE_GETRLIMIT 0
#define APR_HAVE_ICONV 0
#define APR_HAVE_IN_ADDR 1
#define APR_HAVE_INET_ADDR 1
#define APR_HAVE_INET_NETWORK 0
#define APR_HAVE_IPV6 @apr_have_ipv6_10@
#define APR_HAVE_MEMMOVE 1
#define APR_HAVE_SETRLIMIT 0
#define APR_HAVE_SIGACTION 0
#define APR_HAVE_SIGSUSPEND 0
#define APR_HAVE_SIGWAIT 0
#define APR_HAVE_SA_STORAGE 0
#define APR_HAVE_STRCASECMP 0
#define APR_HAVE_STRDUP 1
#define APR_HAVE_STRNCASECMP 0
#define APR_HAVE_STRSTR 1
#define APR_HAVE_MEMCHR 1
#define APR_HAVE_STRUCT_RLIMIT 0
#define APR_HAVE_UNION_SEMUN 0
#define APR_HAVE_SCTP 0
#define APR_HAVE_IOVEC 0
#ifndef _WIN32_WCE
#define APR_HAVE_STRICMP 1
#define APR_HAVE_STRNICMP 1
#else
#define APR_HAVE_STRICMP 0
#define APR_HAVE_STRNICMP 0
#endif
/* APR Feature Macros */
#define APR_HAS_SHARED_MEMORY 1
#define APR_HAS_THREADS 1
#define APR_HAS_MMAP 1
#define APR_HAS_FORK 0
#define APR_HAS_RANDOM 1
#define APR_HAS_OTHER_CHILD 1
#define APR_HAS_DSO 1
#define APR_HAS_SO_ACCEPTFILTER 0
#define APR_HAS_UNICODE_FS 1
#define APR_HAS_PROC_INVOKED 1
#define APR_HAS_OS_UUID 1
#ifndef _WIN32_WCE
#define APR_HAS_SENDFILE 1
#define APR_HAS_USER 1
#define APR_HAS_LARGE_FILES 1
#define APR_HAS_XTHREAD_FILES 1
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 1
#else
#define APR_HAS_SENDFILE 0
#define APR_HAS_USER 0
#define APR_HAS_LARGE_FILES 0
#define APR_HAS_XTHREAD_FILES 0
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
#endif
/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
* to poll on files/pipes.
*/
#define APR_FILES_AS_SOCKETS 0
/* This macro indicates whether or not EBCDIC is the native character set.
*/
#define APR_CHARSET_EBCDIC 0
/* If we have a TCP implementation that can be "corked", what flag
* do we use?
*/
#define APR_TCP_NOPUSH_FLAG @apr_tcp_nopush_flag@
/* Is the TCP_NODELAY socket option inherited from listening sockets?
*/
#define APR_TCP_NODELAY_INHERITED 1
/* Is the O_NONBLOCK flag inherited from listening sockets?
*/
#define APR_O_NONBLOCK_INHERITED 1
/* Typedefs that APR needs. */
typedef unsigned char apr_byte_t;
typedef short apr_int16_t;
typedef unsigned short apr_uint16_t;
typedef int apr_int32_t;
typedef unsigned int apr_uint32_t;
typedef __int64 apr_int64_t;
typedef unsigned __int64 apr_uint64_t;
typedef size_t apr_size_t;
#if APR_HAVE_STDDEF_H
typedef ptrdiff_t apr_ssize_t;
#else
typedef int apr_ssize_t;
#endif
#if APR_HAS_LARGE_FILES
typedef __int64 apr_off_t;
#else
typedef int apr_off_t;
#endif
typedef int apr_socklen_t;
typedef apr_uint64_t apr_ino_t;
#ifdef _WIN64
#define APR_SIZEOF_VOIDP 8
#else
#define APR_SIZEOF_VOIDP 4
#endif
#if APR_SIZEOF_VOIDP == 8
typedef apr_uint64_t apr_uintptr_t;
#else
typedef apr_uint32_t apr_uintptr_t;
#endif
/* Are we big endian? */
/* XXX: Fatal assumption on Alpha platforms */
#define APR_IS_BIGENDIAN 0
/* Mechanisms to properly type numeric literals */
#ifndef __GNUC__
#define APR_INT64_C(val) (val##i64)
#define APR_UINT64_C(val) (val##Ui64)
#else
#define APR_INT64_C(val) (val##LL)
#define APR_UINT64_C(val) (val##ULL)
#endif
#ifdef INT16_MIN
#define APR_INT16_MIN INT16_MIN
#else
#define APR_INT16_MIN (-0x7fff - 1)
#endif
#ifdef INT16_MAX
#define APR_INT16_MAX INT16_MAX
#else
#define APR_INT16_MAX (0x7fff)
#endif
#ifdef UINT16_MAX
#define APR_UINT16_MAX UINT16_MAX
#else
#define APR_UINT16_MAX (0xffff)
#endif
#ifdef INT32_MIN
#define APR_INT32_MIN INT32_MIN
#else
#define APR_INT32_MIN (-0x7fffffff - 1)
#endif
#ifdef INT32_MAX
#define APR_INT32_MAX INT32_MAX
#else
#define APR_INT32_MAX 0x7fffffff
#endif
#ifdef UINT32_MAX
#define APR_UINT32_MAX UINT32_MAX
#else
#define APR_UINT32_MAX (0xffffffffU)
#endif
#ifdef INT64_MIN
#define APR_INT64_MIN INT64_MIN
#else
#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
#endif
#ifdef INT64_MAX
#define APR_INT64_MAX INT64_MAX
#else
#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
#endif
#ifdef UINT64_MAX
#define APR_UINT64_MAX UINT64_MAX
#else
#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
#endif
#define APR_SIZE_MAX (~((apr_size_t)0))
/* Definitions that APR programs need to work properly. */
/**
* APR public API wrap for C++ compilers.
*/
#ifdef __cplusplus
#define APR_BEGIN_DECLS extern "C" {
#define APR_END_DECLS }
#else
#define APR_BEGIN_DECLS
#define APR_END_DECLS
#endif
/**
* Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
* so that they follow the platform's calling convention.
* <PRE>
*
* void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
*
* </PRE>
*/
#define APR_THREAD_FUNC __stdcall
#if defined(DOXYGEN) || !defined(WIN32)
/**
* The public APR functions are declared with APR_DECLARE(), so they may
* use the most appropriate calling convention. Public APR functions with
* variable arguments must use APR_DECLARE_NONSTD().
*
* @remark Both the declaration and implementations must use the same macro.
*
* <PRE>
* APR_DECLARE(rettype) apr_func(args)
* </PRE>
* @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
* @remark Note that when APR compiles the library itself, it passes the
* symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
* to export public symbols from the dynamic library build.\n
* The user must define the APR_DECLARE_STATIC when compiling to target
* the static APR library on some platforms (e.g. Win32.) The public symbols
* are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
* By default, compiling an application and including the APR public
* headers, without defining APR_DECLARE_STATIC, will prepare the code to be
* linked to the dynamic library.
*/
#define APR_DECLARE(type) type
/**
* The public APR functions using variable arguments are declared with
* APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
* @see APR_DECLARE @see APR_DECLARE_DATA
* @remark Both the declaration and implementations must use the same macro.
* <PRE>
*
* APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
*
* </PRE>
*/
#define APR_DECLARE_NONSTD(type) type
/**
* The public APR variables are declared with AP_MODULE_DECLARE_DATA.
* This assures the appropriate indirection is invoked at compile time.
* @see APR_DECLARE @see APR_DECLARE_NONSTD
* @remark Note that the declaration and implementations use different forms,
* but both must include the macro.
*
* <PRE>
*
* extern APR_DECLARE_DATA type apr_variable;\n
* APR_DECLARE_DATA type apr_variable = value;
*
* </PRE>
*/
#define APR_DECLARE_DATA
#elif defined(APR_DECLARE_STATIC)
#define APR_DECLARE(type) type __stdcall
#define APR_DECLARE_NONSTD(type) type __cdecl
#define APR_DECLARE_DATA
#elif defined(APR_DECLARE_EXPORT)
#define APR_DECLARE(type) __declspec(dllexport) type __stdcall
#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
#define APR_DECLARE_DATA __declspec(dllexport)
#else
#define APR_DECLARE(type) __declspec(dllimport) type __stdcall
#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
#define APR_DECLARE_DATA __declspec(dllimport)
#endif
#ifdef _WIN64
#define APR_SSIZE_T_FMT "I64d"
#define APR_SIZE_T_FMT "I64u"
#else
#define APR_SSIZE_T_FMT "d"
#define APR_SIZE_T_FMT "u"
#endif
#if APR_HAS_LARGE_FILES
#define APR_OFF_T_FMT "I64d"
#else
#define APR_OFF_T_FMT "d"
#endif
#define APR_PID_T_FMT "d"
#define APR_INT64_T_FMT "I64d"
#define APR_UINT64_T_FMT "I64u"
#define APR_UINT64_T_HEX_FMT "I64x"
/* No difference between PROC and GLOBAL mutex */
#define APR_PROC_MUTEX_IS_GLOBAL 1
/* Local machine definition for console and log output. */
#define APR_EOL_STR "\r\n"
typedef int apr_wait_t;
#if APR_HAS_UNICODE_FS
/* An arbitrary size that is digestable. True max is a bit less than 32000 */
#define APR_PATH_MAX 8192
#else /* !APR_HAS_UNICODE_FS */
#define APR_PATH_MAX MAX_PATH
#endif
#define APR_DSOPATH "PATH"
/** @} */
/* Definitions that only Win32 programs need to compile properly. */
/* XXX These simply don't belong here, perhaps in apr_portable.h
* based on some APR_HAVE_PID/GID/UID?
*/
#ifndef __GNUC__
typedef int pid_t;
#endif
typedef int uid_t;
typedef int gid_t;
/* Win32 .h ommissions we really need */
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#if APR_HAVE_IPV6
/* Appears in later flavors, not the originals. */
#ifndef in_addr6
#define in6_addr in_addr6
#endif
#ifndef WS2TCPIP_INLINE
#define IN6_IS_ADDR_V4MAPPED(a) \
( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \
&& (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
#endif
#endif /* APR_HAS_IPV6 */
#ifdef __cplusplus
}
#endif
/* Done with badly written headers
*/
#if defined(_MSC_VER) && _MSC_VER >= 1200
#pragma warning(pop)
#pragma warning(disable: 4996)
#endif
#endif /* WIN32 */
#endif /* APR_H */
| {
"pile_set_name": "Github"
} |
syncline :model file
3 :#interfaces in model
plotcolors :model colors file
m :first plot descriptor (mwq) ...SEE
dummywell :well coordinates FILE
s :shooting mode (sd) NOTES...
geometry5 :receiver geometry ..........
sg :second plot descriptor (sgq) ...THIS
rt :job descriptor (rlt) DIRECTORY
demo9 :output filename(s)
-90. 90. :range of takeoff angles
.1 :increment in takeoff angle
8000.0 10000.0 12000.0
13000.0 : velocities
n :direct wave? (y or n)
:headwave interface numbers (1, 2, ...)
y :primaries? (y or n)
| {
"pile_set_name": "Github"
} |
package mruby
import "unsafe"
// #include <stdlib.h>
// #include "gomruby.h"
import "C"
// Class is a class in mruby. To obtain a Class, use DefineClass or
// one of the variants on the Mrb structure.
type Class struct {
class *C.struct_RClass
mrb *Mrb
}
// DefineClassMethod defines a class-level method on the given class.
func (c *Class) DefineClassMethod(name string, cb Func, as ArgSpec) {
insertMethod(c.mrb.state, c.class.c, name, cb)
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_class_method(
c.mrb.state,
c.class,
cs,
C._go_mrb_func_t(),
C.mrb_aspec(as))
}
// DefineConst defines a constant within this class.
func (c *Class) DefineConst(name string, value Value) {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_const(
c.mrb.state, c.class, cs, value.MrbValue(c.mrb).value)
}
// DefineMethod defines an instance method on the class.
func (c *Class) DefineMethod(name string, cb Func, as ArgSpec) {
insertMethod(c.mrb.state, c.class, name, cb)
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_method(
c.mrb.state,
c.class,
cs,
C._go_mrb_func_t(),
C.mrb_aspec(as))
}
// MrbValue returns a *Value for this Class. *Values are sometimes required
// as arguments where classes should be valid.
func (c *Class) MrbValue(m *Mrb) *MrbValue {
return newValue(c.mrb.state, C.mrb_obj_value(unsafe.Pointer(c.class)))
}
// New instantiates the class with the given args.
func (c *Class) New(args ...Value) (*MrbValue, error) {
var argv []C.mrb_value
var argvPtr *C.mrb_value
if len(args) > 0 {
// Make the raw byte slice to hold our arguments we'll pass to C
argv = make([]C.mrb_value, len(args))
for i, arg := range args {
argv[i] = arg.MrbValue(c.mrb).value
}
argvPtr = &argv[0]
}
result := C.mrb_obj_new(c.mrb.state, c.class, C.mrb_int(len(argv)), argvPtr)
if exc := checkException(c.mrb.state); exc != nil {
return nil, exc
}
return newValue(c.mrb.state, result), nil
}
func newClass(mrb *Mrb, c *C.struct_RClass) *Class {
return &Class{
class: c,
mrb: mrb,
}
}
| {
"pile_set_name": "Github"
} |
/*
Copyright 2016 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.
*/
package v1
import (
"time"
)
// Timestamp is declared in time_proto.go
// Timestamp returns the Time as a new Timestamp value.
func (m *MicroTime) ProtoMicroTime() *Timestamp {
if m == nil {
return &Timestamp{}
}
return &Timestamp{
Seconds: m.Time.Unix(),
Nanos: int32(m.Time.Nanosecond()),
}
}
// Size implements the protobuf marshalling interface.
func (m *MicroTime) Size() (n int) {
if m == nil || m.Time.IsZero() {
return 0
}
return m.ProtoMicroTime().Size()
}
// Reset implements the protobuf marshalling interface.
func (m *MicroTime) Unmarshal(data []byte) error {
if len(data) == 0 {
m.Time = time.Time{}
return nil
}
p := Timestamp{}
if err := p.Unmarshal(data); err != nil {
return err
}
m.Time = time.Unix(p.Seconds, int64(p.Nanos)).Local()
return nil
}
// Marshal implements the protobuf marshalling interface.
func (m *MicroTime) Marshal() (data []byte, err error) {
if m == nil || m.Time.IsZero() {
return nil, nil
}
return m.ProtoMicroTime().Marshal()
}
// MarshalTo implements the protobuf marshalling interface.
func (m *MicroTime) MarshalTo(data []byte) (int, error) {
if m == nil || m.Time.IsZero() {
return 0, nil
}
return m.ProtoMicroTime().MarshalTo(data)
}
| {
"pile_set_name": "Github"
} |
//
// PDPageDomainController.h
// PonyDebugger
//
// Created by Wen-Hao Lue on 8/6/12.
//
// Licensed to Square, Inc. under one or more contributor license agreements.
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. licenses this file to you.
//
#import "PonyDebugger.h"
#import "PDPageDomain.h"
@interface PDPageDomainController : PDDomainController
+ (PDPageDomainController *)defaultInstance;
@property (nonatomic, strong) PDPageDomain *domain;
@end
| {
"pile_set_name": "Github"
} |
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/mozilla-1.9.1-win32-xulrunner/build/dom/public/idl/html/nsIDOMHTMLUListElement.idl
*/
#ifndef __gen_nsIDOMHTMLUListElement_h__
#define __gen_nsIDOMHTMLUListElement_h__
#ifndef __gen_nsIDOMHTMLElement_h__
#include "nsIDOMHTMLElement.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMHTMLUListElement */
#define NS_IDOMHTMLULISTELEMENT_IID_STR "a6cf9099-15b3-11d2-932e-00805f8add32"
#define NS_IDOMHTMLULISTELEMENT_IID \
{0xa6cf9099, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
/**
* The nsIDOMHTMLUListElement interface is the interface to a [X]HTML
* ul element.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-HTML/
*
* @status FROZEN
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMHTMLUListElement : public nsIDOMHTMLElement {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMHTMLULISTELEMENT_IID)
/* attribute boolean compact; */
NS_SCRIPTABLE NS_IMETHOD GetCompact(PRBool *aCompact) = 0;
NS_SCRIPTABLE NS_IMETHOD SetCompact(PRBool aCompact) = 0;
/* attribute DOMString type; */
NS_SCRIPTABLE NS_IMETHOD GetType(nsAString & aType) = 0;
NS_SCRIPTABLE NS_IMETHOD SetType(const nsAString & aType) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMHTMLUListElement, NS_IDOMHTMLULISTELEMENT_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMHTMLULISTELEMENT \
NS_SCRIPTABLE NS_IMETHOD GetCompact(PRBool *aCompact); \
NS_SCRIPTABLE NS_IMETHOD SetCompact(PRBool aCompact); \
NS_SCRIPTABLE NS_IMETHOD GetType(nsAString & aType); \
NS_SCRIPTABLE NS_IMETHOD SetType(const nsAString & aType);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMHTMLULISTELEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD GetCompact(PRBool *aCompact) { return _to GetCompact(aCompact); } \
NS_SCRIPTABLE NS_IMETHOD SetCompact(PRBool aCompact) { return _to SetCompact(aCompact); } \
NS_SCRIPTABLE NS_IMETHOD GetType(nsAString & aType) { return _to GetType(aType); } \
NS_SCRIPTABLE NS_IMETHOD SetType(const nsAString & aType) { return _to SetType(aType); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMHTMLULISTELEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD GetCompact(PRBool *aCompact) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCompact(aCompact); } \
NS_SCRIPTABLE NS_IMETHOD SetCompact(PRBool aCompact) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCompact(aCompact); } \
NS_SCRIPTABLE NS_IMETHOD GetType(nsAString & aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
NS_SCRIPTABLE NS_IMETHOD SetType(const nsAString & aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetType(aType); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMHTMLUListElement : public nsIDOMHTMLUListElement
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMHTMLULISTELEMENT
nsDOMHTMLUListElement();
private:
~nsDOMHTMLUListElement();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMHTMLUListElement, nsIDOMHTMLUListElement)
nsDOMHTMLUListElement::nsDOMHTMLUListElement()
{
/* member initializers and constructor code */
}
nsDOMHTMLUListElement::~nsDOMHTMLUListElement()
{
/* destructor code */
}
/* attribute boolean compact; */
NS_IMETHODIMP nsDOMHTMLUListElement::GetCompact(PRBool *aCompact)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMHTMLUListElement::SetCompact(PRBool aCompact)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute DOMString type; */
NS_IMETHODIMP nsDOMHTMLUListElement::GetType(nsAString & aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMHTMLUListElement::SetType(const nsAString & aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMHTMLUListElement_h__ */
| {
"pile_set_name": "Github"
} |
package ramsql
import (
"database/sql"
"testing"
"time"
"github.com/go-gorp/gorp"
"github.com/proullon/ramsql/engine/log"
)
func TestGorp(t *testing.T) {
log.UseTestLogger(t)
// initialize the DbMap
dbmap := initDb(t)
defer dbmap.Db.Close()
// delete any existing rows
err := dbmap.TruncateTables()
checkErr(t, err, "TruncateTables failed")
// create two posts
p1 := newPost("Go 1.1 released!", "Lorem ipsum lorem ipsum")
p2 := newPost("Go 1.2 released!", "Lorem ipsum lorem ipsum")
// insert rows - auto increment PKs will be set properly after the insert
err = dbmap.Insert(&p1, &p2)
checkErr(t, err, "Insert failed")
// use convenience SelectInt
count, err := dbmap.SelectInt("select count(*) from posts where 1")
checkErr(t, err, "select count(*) failed")
if count != 2 {
t.Fatalf("Rows after inserting: %d, expected %d", count, 2)
}
// update a row
p2.Title = "Go 1.2 is better than ever"
count, err = dbmap.Update(&p2)
checkErr(t, err, "Update failed")
// fetch one row - note use of "post_id" instead of "Id" since column is aliased
//
// Postgres users should use $1 instead of ? placeholders
// See 'Known Issues' below
//
err = dbmap.SelectOne(&p2, "select * from posts where post_id=?", p2.ID)
checkErr(t, err, "SelectOne failed")
// fetch all rows
var posts []Post
_, err = dbmap.Select(&posts, "select * from posts order by post_id")
checkErr(t, err, "Select failed")
// delete row by PK
count, err = dbmap.Delete(&p1)
checkErr(t, err, "Delete failed")
// delete row manually via Exec
_, err = dbmap.Exec("delete from posts where post_id=?", p2.ID)
checkErr(t, err, "Exec failed")
// confirm count is zero
count, err = dbmap.SelectInt("select count(*) from posts")
checkErr(t, err, "select count(*) failed")
if count != 0 {
t.Fatalf("Count should be 0, got %d", count)
}
}
type Post struct {
// db tag lets you specify the column name if it differs from the struct field
ID int64 `db:"post_id"`
Created int64
Title string
Body string
}
func newPost(title, body string) Post {
return Post{
Created: time.Now().UnixNano(),
Title: title,
Body: body,
}
}
func initDb(t *testing.T) *gorp.DbMap {
// connect to db using standard Go database/sql API
// use whatever database/sql driver you wish
db, err := sql.Open("ramsql", "/tmp/post_db.bin")
if err != nil {
t.Fatalf("sql.Open failed: %s", err)
}
// construct a gorp DbMap
dbmap := &gorp.DbMap{Db: db, Dialect: gorp.PostgresDialect{}}
// add a table, setting the table name to 'posts' and
// specifying that the Id property is an auto incrementing PK
dbmap.AddTableWithName(Post{}, "posts").SetKeys(true, "ID")
// create the table. in a production system you'd generally
// use a migration tool, or create the tables via scripts
err = dbmap.CreateTablesIfNotExists()
if err != nil {
t.Fatalf("Create tables failed: %s", err)
}
return dbmap
}
func checkErr(t *testing.T, err error, msg string) {
if err != nil {
t.Fatalf("%s: %s", msg, err)
}
}
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2014 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program 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 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., or visit: http://www.gnu.org/.
##
## Author(s): Stoq Team <stoq-devel@async.com.br>
##
##
from gi.repository import Gtk
from stoqlib.api import api
from stoqlib.domain.product import Product
from stoqlib.gui.base.dialogs import run_dialog
from stoqlib.gui.base.wizards import BaseWizard, BaseWizardStep
from stoqlib.gui.editors.producteditor import ProductEditor
from stoqlib.gui.slaves.productslave import ProductAttributeSlave
from stoqlib.lib.message import yesno, warning
from stoqlib.lib.translation import stoqlib_gettext as _
class ProductTypeStep(BaseWizardStep):
gladefile = 'ProductTypeStep'
#
# WizardEditorStep
#
def next_step(self):
if self.wizard.product_type == Product.TYPE_GRID:
return ProductAttributeEditorStep(self.wizard.store, self.wizard, previous=self)
else:
return ProductEditorStep(store=self.wizard.store, wizard=self.wizard, previous=self)
#
# Callbacks
#
def on_common__toggled(self, radio):
if radio.get_active():
self.wizard.product_type = Product.TYPE_COMMON
def on_batch__toggled(self, radio):
if radio.get_active():
self.wizard.product_type = Product.TYPE_BATCH
def on_without_stock__toggled(self, radio):
if radio.get_active():
self.wizard.product_type = Product.TYPE_WITHOUT_STOCK
def on_consigned__toggled(self, radio):
if radio.get_active():
self.wizard.product_type = Product.TYPE_CONSIGNED
def on_grid__toggled(self, radio):
if radio.get_active():
self.wizard.product_type = Product.TYPE_GRID
def on_package__toggled(self, radio):
if radio.get_active():
self.wizard.product_type = Product.TYPE_PACKAGE
class ProductAttributeEditorStep(BaseWizardStep):
gladefile = 'HolderTemplate'
def __init__(self, store, wizard, previous):
BaseWizardStep.__init__(self, store, wizard, previous)
self.slave = ProductAttributeSlave(self.wizard.store, object())
self.attach_slave('product_attribute_holder', self.slave, self.place_holder)
def validate_step(self):
if len(self.slave.get_selected_attributes()) == 0:
warning(_("You should select an attribute first"))
return False
return True
def next_step(self):
self.wizard.attr_list = self.slave.get_selected_attributes()
return ProductEditorStep(self.wizard.store, self.wizard, previous=self)
class ProductEditorStep(BaseWizardStep):
gladefile = 'HolderTemplate'
#
# BaseWizardStep
#
def post_init(self):
# self.wizard.model will return something if it is coming back from
self.slave = ProductEditor(self.store, wizard=self.wizard,
product_type=self.wizard.product_type)
self.slave.get_toplevel().reparent(self.place_holder)
self.wizard.model = self.slave.model
self.slave.register_validate_function(self.wizard.refresh_next)
self.slave.force_validation()
def previous_step(self):
# Avoid creating duplicated products when going back
self.store.rollback(close=False)
return super(ProductEditorStep, self).previous_step()
def has_next_step(self):
return False
class ProductCreateWizard(BaseWizard):
size = (800, 450)
title = _('Product creation wizard')
help_section = 'product-new'
need_cancel_confirmation = True
# args and kwargs are here to get extra parameters sent by SearchEditor's
# run_dialog. We will just ignore them since they are not useful here
def __init__(self, store, *args, **kwargs):
self.product_type = Product.TYPE_COMMON
first_step = ProductTypeStep(store, self)
BaseWizard.__init__(self, store, first_step)
#
# BaseWizard
#
def finish(self):
last_step = self.get_current_step()
# Forcing the wizard to confirm all slaves
if not last_step.slave.confirm():
return
self.retval = self.model
self.close()
self.model.update_children_info()
def cancel(self):
last_step = self.get_current_step()
if isinstance(last_step, ProductEditorStep):
last_step.slave.cancel()
return super(ProductCreateWizard, self).cancel()
#
# Classmethods
#
@classmethod
def run_wizard(cls, parent):
"""Run the wizard to create a product
This will run the wizard and after finishing, ask if the user
wants to create another product alike. The product will be
cloned and `stoqlib.gui.editors.producteditor.ProductEditor`
will run as long as the user chooses to create one alike
"""
with api.new_store() as store:
rv = run_dialog(cls, parent, store)
if rv:
inner_rv = rv
while yesno(_("Would you like to register another product alike?"),
Gtk.ResponseType.NO, _("Yes"), _("No")):
with api.new_store() as store:
template = store.fetch(rv)
inner_rv = run_dialog(ProductEditor, parent, store,
product_type=template.product_type,
template=template)
if not inner_rv:
break
# We are insterested in the first rv that means that at least one
# obj was created.
return rv
| {
"pile_set_name": "Github"
} |
require 'ostruct'
require 'erb'
require 'rack/request'
module Rack
# Rack::ShowExceptions catches all exceptions raised from the app it
# wraps. It shows a useful backtrace with the sourcefile and
# clickable context, the whole Rack environment and the request
# data.
#
# Be careful when you use this on public-facing sites as it could
# reveal information helpful to attackers.
class ShowExceptions
CONTEXT = 7
def initialize(app)
@app = app
@template = ERB.new(TEMPLATE)
end
def call(env)
@app.call(env)
rescue StandardError, LoadError, SyntaxError => e
backtrace = pretty(env, e)
[500,
{"Content-Type" => "text/html",
"Content-Length" => backtrace.join.size.to_s},
backtrace]
end
def pretty(env, exception)
req = Rack::Request.new(env)
path = (req.script_name + req.path_info).squeeze("/")
frames = exception.backtrace.map { |line|
frame = OpenStruct.new
if line =~ /(.*?):(\d+)(:in `(.*)')?/
frame.filename = $1
frame.lineno = $2.to_i
frame.function = $4
begin
lineno = frame.lineno-1
lines = ::File.readlines(frame.filename)
frame.pre_context_lineno = [lineno-CONTEXT, 0].max
frame.pre_context = lines[frame.pre_context_lineno...lineno]
frame.context_line = lines[lineno].chomp
frame.post_context_lineno = [lineno+CONTEXT, lines.size].min
frame.post_context = lines[lineno+1..frame.post_context_lineno]
rescue
end
frame
else
nil
end
}.compact
env["rack.errors"].puts "#{exception.class}: #{exception.message}"
env["rack.errors"].puts exception.backtrace.map { |l| "\t" + l }
env["rack.errors"].flush
[@template.result(binding)]
end
def h(obj) # :nodoc:
case obj
when String
Utils.escape_html(obj)
else
Utils.escape_html(obj.inspect)
end
end
# :stopdoc:
# adapted from Django <djangoproject.com>
# Copyright (c) 2005, the Lawrence Journal-World
# Used under the modified BSD license:
# http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
TEMPLATE = <<'HTML'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="NONE,NOARCHIVE" />
<title><%=h exception.class %> at <%=h path %></title>
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; }
h2 { margin-bottom:.8em; }
h2 span { font-size:80%; color:#666; font-weight:normal; }
h3 { margin:1em 0 .5em 0; }
h4 { margin:0 0 .5em 0; font-weight: normal; }
table {
border:1px solid #ccc; border-collapse: collapse; background:white; }
tbody td, tbody th { vertical-align:top; padding:2px 3px; }
thead th {
padding:1px 6px 1px 3px; background:#fefefe; text-align:left;
font-weight:normal; font-size:11px; border:1px solid #ddd; }
tbody th { text-align:right; color:#666; padding-right:.5em; }
table.vars { margin:5px 0 2px 40px; }
table.vars td, table.req td { font-family:monospace; }
table td.code { width:100%;}
table td.code div { overflow:hidden; }
table.source th { color:#666; }
table.source td {
font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
ul.traceback { list-style-type:none; }
ul.traceback li.frame { margin-bottom:1em; }
div.context { margin: 10px 0; }
div.context ol {
padding-left:30px; margin:0 10px; list-style-position: inside; }
div.context ol li {
font-family:monospace; white-space:pre; color:#666; cursor:pointer; }
div.context ol.context-line li { color:black; background-color:#ccc; }
div.context ol.context-line li span { float: right; }
div.commands { margin-left: 40px; }
div.commands a { color:black; text-decoration:none; }
#summary { background: #ffc; }
#summary h2 { font-weight: normal; color: #666; }
#summary ul#quicklinks { list-style-type: none; margin-bottom: 2em; }
#summary ul#quicklinks li { float: left; padding: 0 1em; }
#summary ul#quicklinks>li+li { border-left: 1px #666 solid; }
#explanation { background:#eee; }
#template, #template-not-exist { background:#f6f6f6; }
#template-not-exist ul { margin: 0 0 0 20px; }
#traceback { background:#eee; }
#requestinfo { background:#f6f6f6; padding-left:120px; }
#summary table { border:none; background:transparent; }
#requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
#requestinfo h3 { margin-bottom:-1em; }
.error { background: #ffc; }
.specific { color:#cc3300; font-weight:bold; }
</style>
<script type="text/javascript">
//<!--
function getElementsByClassName(oElm, strTagName, strClassName){
// Written by Jonathan Snook, http://www.snook.ca/jon;
// Add-ons by Robert Nyman, http://www.robertnyman.com
var arrElements = (strTagName == "*" && document.all)? document.all :
oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$$)");
var oElement;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
if(oRegExp.test(oElement.className)){
arrReturnElements.push(oElement);
}
}
return (arrReturnElements)
}
function hideAll(elems) {
for (var e = 0; e < elems.length; e++) {
elems[e].style.display = 'none';
}
}
window.onload = function() {
hideAll(getElementsByClassName(document, 'table', 'vars'));
hideAll(getElementsByClassName(document, 'ol', 'pre-context'));
hideAll(getElementsByClassName(document, 'ol', 'post-context'));
}
function toggle() {
for (var i = 0; i < arguments.length; i++) {
var e = document.getElementById(arguments[i]);
if (e) {
e.style.display = e.style.display == 'none' ? 'block' : 'none';
}
}
return false;
}
function varToggle(link, id) {
toggle('v' + id);
var s = link.getElementsByTagName('span')[0];
var uarr = String.fromCharCode(0x25b6);
var darr = String.fromCharCode(0x25bc);
s.innerHTML = s.innerHTML == uarr ? darr : uarr;
return false;
}
//-->
</script>
</head>
<body>
<div id="summary">
<h1><%=h exception.class %> at <%=h path %></h1>
<h2><%=h exception.message %></h2>
<table><tr>
<th>Ruby</th>
<td><code><%=h frames.first.filename %></code>: in <code><%=h frames.first.function %></code>, line <%=h frames.first.lineno %></td>
</tr><tr>
<th>Web</th>
<td><code><%=h req.request_method %> <%=h(req.host + path)%></code></td>
</tr></table>
<h3>Jump to:</h3>
<ul id="quicklinks">
<li><a href="#get-info">GET</a></li>
<li><a href="#post-info">POST</a></li>
<li><a href="#cookie-info">Cookies</a></li>
<li><a href="#env-info">ENV</a></li>
</ul>
</div>
<div id="traceback">
<h2>Traceback <span>(innermost first)</span></h2>
<ul class="traceback">
<% frames.each { |frame| %>
<li class="frame">
<code><%=h frame.filename %></code>: in <code><%=h frame.function %></code>
<% if frame.context_line %>
<div class="context" id="c<%=h frame.object_id %>">
<% if frame.pre_context %>
<ol start="<%=h frame.pre_context_lineno+1 %>" class="pre-context" id="pre<%=h frame.object_id %>">
<% frame.pre_context.each { |line| %>
<li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h line %></li>
<% } %>
</ol>
<% end %>
<ol start="<%=h frame.lineno %>" class="context-line">
<li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h frame.context_line %><span>...</span></li></ol>
<% if frame.post_context %>
<ol start='<%=h frame.lineno+1 %>' class="post-context" id="post<%=h frame.object_id %>">
<% frame.post_context.each { |line| %>
<li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h line %></li>
<% } %>
</ol>
<% end %>
</div>
<% end %>
</li>
<% } %>
</ul>
</div>
<div id="requestinfo">
<h2>Request information</h2>
<h3 id="get-info">GET</h3>
<% unless req.GET.empty? %>
<table class="req">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
<tr>
<td><%=h key %></td>
<td class="code"><div><%=h val.inspect %></div></td>
</tr>
<% } %>
</tbody>
</table>
<% else %>
<p>No GET data.</p>
<% end %>
<h3 id="post-info">POST</h3>
<% unless req.POST.empty? %>
<table class="req">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
<tr>
<td><%=h key %></td>
<td class="code"><div><%=h val.inspect %></div></td>
</tr>
<% } %>
</tbody>
</table>
<% else %>
<p>No POST data.</p>
<% end %>
<h3 id="cookie-info">COOKIES</h3>
<% unless req.cookies.empty? %>
<table class="req">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<% req.cookies.each { |key, val| %>
<tr>
<td><%=h key %></td>
<td class="code"><div><%=h val.inspect %></div></td>
</tr>
<% } %>
</tbody>
</table>
<% else %>
<p>No cookie data.</p>
<% end %>
<h3 id="env-info">Rack ENV</h3>
<table class="req">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<% env.sort_by { |k, v| k.to_s }.each { |key, val| %>
<tr>
<td><%=h key %></td>
<td class="code"><div><%=h val %></div></td>
</tr>
<% } %>
</tbody>
</table>
</div>
<div id="explanation">
<p>
You're seeing this error because you use <code>Rack::ShowException</code>.
</p>
</div>
</body>
</html>
HTML
# :startdoc:
end
end
| {
"pile_set_name": "Github"
} |
#playerAvatar {
height: 75%;
max-height: 250px;
width: auto;
}
#playerName {
text-align: center;
font-size: 20px;
font-weight: bold;
}
#displayProfileContent {
text-align: center;
}
#keyboardContent {
text-align: center;
}
.overlay {
position: relative;
height: 100%;
width: 100%;
background-color: #000000;
background-color: rgba(0,0,0,0.7);
}
.ui-loader-background {
width: 100%;
height: 100%;
top: 0;
margin: 0;
background: #000000;
background: rgba(0, 0, 0, 0.3);
display: none;
position: fixed;
z-index: 100;
}
.ui-loading .ui-loader-background {
display: block;
}
#displaySongCover {
height: 75%;
max-height: 250px;
width: auto;
}
#displaySongContent {
text-align: center;
}
#displaySongContent span {
font-size: 18px;
font-weight: bold;
}
.imageLoaderImg {
height: 100%;
width: 100%;
background: url(images/ajax-loader.gif);
background-size: 45px;
border: #000000 solid 0px;
content: '';
background-repeat: no-repeat;
background-position: center;
}
.ui-body-c, .ui-overlay-c {
background: #000000;
}
.ui-input-search {
background: #6E6E6E !important;
}
.ui-listview-filter {
background: #000000 !important;
}
.ui-custom-errorIcon {
background: url(images/alert.png) !important;
background-size: 42px 42px;
-webkit-border-radius: 0px !important;
border-radius: 0px !important;
}
.cursorStyleClickable {
cursor: pointer;
}
| {
"pile_set_name": "Github"
} |
/* DB Version 2 to Version 3 */
ALTER TABLE games ADD COLUMN uniqueplayers INTEGER DEFAULT 0;
| {
"pile_set_name": "Github"
} |
[
{
"keys": ["ctrl+.", "ctrl+x"],
"command": "margo_open_extension",
},
{
"keys": ["ctrl+.", "ctrl+1"],
"command": "open_file",
"args": { "file": "${packages}/GoSublime/README.md" }
},
{
"keys": ["ctrl+.", "ctrl+2"],
"command": "open_file",
"args": { "file": "${packages}/GoSublime/USAGE.md" }
},
{
"keys": ["ctrl+.", "ctrl+3"],
"command": "gs_sanity_check"
},
{
"keys": ["ctrl+.", "ctrl+4"],
"command": "open_file",
"args": { "file": "${packages}/GoSublime/GoSublime.sublime-settings" }
},
{
"keys": ["ctrl+.", "ctrl+5"],
"command": "open_file",
"args": { "file": "${packages}/User/GoSublime.sublime-settings" }
},
{
"keys": ["ctrl+space"],
"command": "auto_complete",
"args": {"disable_auto_insert": true, "api_completions_only": true, "next_completion_if_showing": false},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+p"],
"command": "gs_palette",
"args": {"palette": "imports", "direct": true},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+d"],
"command": "gs_palette",
"args": {"palette": "declarations", "direct": true},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+e"],
"command": "margo_issues",
},
{
"keys": ["ctrl+.", "ctrl+c"],
"command": "margo_user_cmds",
},
{
"keys": ["ctrl+.", "ctrl+["],
"command": "gs_palette",
"args": {"palette": "jump_back"},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+i"],
"command": "gs_palette",
"args": {"palette": "jump_to_imports"},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+b"],
"command": "gs9o_build",
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+r"],
"command": "gs9o_open",
"args": {"run": ["replay"], "focus_view": false},
},
{
"keys": ["ctrl+.", "ctrl+g"],
"command": "gs9o_open",
"args": {"run": [".actuate"], "focus_view": false, "show_view": false},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+g"],
"command": "gs9o_open_selection",
"context": [{ "key": "selector", "operator": "equal", "operand": "text.9o" }]
},
{
"keys": ["ctrl+.", "ctrl+h"],
"command": "gs_doc",
"args": {"mode": "hint"},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+."],
"command": "show_overlay",
"args": {"overlay": "command_palette", "text": "GoSublime: "}
},
{
"keys": ["ctrl+.", "ctrl+f"],
"command": "margo_fmt",
},
{
"keys": ["ctrl+.", "ctrl+n"],
"command": "gs_new_go_file"
},
{
"keys": ["ctrl+.", "ctrl+a"],
"command": "gs_browse_declarations"
},
{
"keys": ["ctrl+.", "ctrl+l"],
"command": "gs_browse_declarations",
"args": { "dir": "." },
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+.", "ctrl+o"],
"command": "gs_browse_packages"
},
{
"keys": ["ctrl+.", "ctrl+m"],
"command": "gs_browse_files"
},
{
"keys": ["ctrl+.", "ctrl+t"],
"command": "margo_user_cmds",
"args": {"action": "QueryTestCmds"},
},
{
"keys": ["ctrl+.", "ctrl+space"],
"command": "gs_show_call_tip",
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
},
{
"keys": ["ctrl+9"],
"command": "gs9o_win_open"
},
{
"keys": ["ctrl+.","ctrl+9"],
"command": "gs9o_win_open"
},
{
"keys": ["ctrl+.","ctrl+0"],
"command": "margo_show_hud"
},
{
"keys": ["ctrl+space"],
"command": "auto_complete",
"args": {"disable_auto_insert": true, "api_completions_only": true, "next_completion_if_showing": false},
"context": [{ "key": "selector", "operator": "equal", "operand": "text.9o" }]
},
{
"keys": ["enter"],
"command": "gs9o_exec",
"args": {"save_hist": true},
"context": [{ "key": "selector", "operator": "equal", "operand": "text.9o" }]
},
{
"keys": ["enter"],
"command": "commit_completion",
"context": [
{ "key": "auto_complete_visible" },
{ "key": "setting.auto_complete_commit_on_tab", "operand": false },
{ "key": "selector", "operator": "equal", "operand": "text.9o" }
]
},
{
"keys": ["ctrl+enter"],
"command": "gs9o_insert_line",
"context": [{ "key": "selector", "operator": "equal", "operand": "text.9o" }]
},
{
"keys": ["ctrl+shift+enter"],
"command": "gs9o_insert_line",
"args": {"after": false},
"context": [{ "key": "selector", "operator": "equal", "operand": "text.9o" }]
},
{
"keys": ["up"],
"command": "gs9o_move_hist",
"args": {"up": true},
"context": [
{ "key": "selector", "operator": "equal", "operand": "prompt.9o" },
{ "key": "auto_complete_visible", "operand": false }
]
},
{
"keys": ["down"],
"command": "gs9o_move_hist",
"args": {"up": false},
"context": [
{ "key": "selector", "operator": "equal", "operand": "prompt.9o" },
{ "key": "auto_complete_visible", "operand": false }
]
}
]
| {
"pile_set_name": "Github"
} |
{
"redirected": "YOU HAVE BEEN REDIRECTED",
"site-flagged": "This site has been flagged for suspicious activity,",
"redirected-browser": "so we've redirected your browser. Stay safe out there"
}
| {
"pile_set_name": "Github"
} |
import {ArgumentException, ArgumentOutOfRangeException} from '../Exceptions/ArgumentException';
import {ArrayHelper} from '../ExtensionMethods';
import {EwsUtilities} from "../Core/EwsUtilities";
import {Strings} from "../Strings";
import {WellKnownFolderName} from "../Enumerations/WellKnownFolderName";
import {FolderId} from "./FolderId";
import {ComplexPropertyCollection} from "./ComplexPropertyCollection";
/**
* Represents a collection of folder Ids.
*
* @sealed
*/
export class FolderIdCollection extends ComplexPropertyCollection<FolderId> {
/**
* @internal Initializes a new instance of the **FolderIdCollection** class.
*/
constructor();
/**
* @internal Initializes a new instance of the **FolderIdCollection** class.
*
* @param {FolderId[]} folderIds The folder ids to include.
*/
constructor(folderIds: FolderId[]);
constructor(folderIds: FolderId[] = null) {
super();
if (folderIds != null) {
folderIds.forEach((folderId) => this.InternalAdd(folderId));
}
}
/**
* Adds a folder Id to the collection.
*
* @param {FolderId} folderId The folder Id to add.
*/
Add(folderId: FolderId): void;
/**
* Adds a well-known folder to the collection.
*
* @param {WellKnownFolderName} folderName The well known folder to add.
* @return {FolderId} A FolderId encapsulating the specified Id.
*/
Add(folderName: WellKnownFolderName): FolderId;
Add(folderIdOrName: FolderId | WellKnownFolderName): void | FolderId {
let folderId: FolderId = null;
if (typeof folderIdOrName === 'number') {
folderId = new FolderId(folderIdOrName);
if (ArrayHelper.Find(this.Items, (item) => item.FolderName === folderIdOrName)) { //if (this.Contains(folderIdOrName)) { // can not use in JavaScript
throw new ArgumentException(Strings.IdAlreadyInList, "folderName");
}
}
else {
EwsUtilities.ValidateParam(folderId, "folderId");
folderId = folderIdOrName;
if (this.Contains(folderId)) {
throw new ArgumentException(Strings.IdAlreadyInList, "folderId");
}
}
this.InternalAdd(folderId);
return folderId;
}
/**
* Clears the collection.
*/
Clear(): void {
this.InternalClear();
}
/**
* @internal Instantiate the appropriate attachment type depending on the current XML element name.
*
* @param {string} xmlElementName Name of the XML element.
* @return {FolderId} FolderId.
*/
CreateComplexProperty(xmlElementName: string): FolderId {
return new FolderId();
}
/**
* @internal Creates the default complex property.
*
* @return {FolderId} FolderId.
*/
CreateDefaultComplexProperty(): FolderId {
return new FolderId();
}
/**
* @internal Gets the name of the collection item XML element.
*
* @param {FolderId} complexProperty The complex property.
* @return {string} XML element name.
*/
GetCollectionItemXmlElementName(complexProperty: FolderId): string {
return complexProperty.GetXmlElementName();
}
/**
* Removes the specified folder Id from the collection.
*
* @param {FolderId} folderId The folder Id to remove from the collection.
* @return {boolean} True if the folder id was successfully removed from the collection, false otherwise.
*/
Remove(folderId: FolderId): boolean;
/**
* Removes the specified well-known folder from the collection.
*
* @param {WellKnownFolderName} folderName The well-knwon folder to remove from the collection.
* @return {boolean} True if the well-known folder was successfully removed from the collection, false otherwise.
*/
Remove(folderName: WellKnownFolderName): boolean;
Remove(folderIdOrName: FolderId | WellKnownFolderName): boolean {
if (typeof folderIdOrName === 'number') {
// can not simply use InternalRemove as javascript does not have c# List functionality
let index = ArrayHelper.IndexOf(this.Items, (item) => item.FolderName === folderIdOrName);
if (index >= 0) {
this.InternalRemoveAt(index);
return true;
}
}
else {
EwsUtilities.ValidateParam(folderIdOrName, "folderId");
return this.InternalRemove(folderIdOrName);
}
return false;
}
/**
* Removes the folder Id at the specified index.
*
* @param {number} index The zero-based index of the folder Id to remove.
*/
RemoveAt(index: number): void {
if (index < 0 || index >= this.Count) {
throw new ArgumentOutOfRangeException("index", Strings.IndexIsOutOfRange);
}
this.InternalRemoveAt(index);
}
} | {
"pile_set_name": "Github"
} |
Name: %{_cross_os}iputils
Version: 20190709
Release: 1%{?dist}
Summary: A set of network monitoring tools
License: GPL-2.0-or-later AND BSD-3-Clause
URL: https://github.com/iputils/iputils
Source0: https://github.com/iputils/iputils/archive/s%{version}.tar.gz#/iputils-s%{version}.tar.gz
BuildRequires: %{_cross_os}glibc-devel
BuildRequires: %{_cross_os}libcap-devel
Requires: %{_cross_os}libcap
%description
%{summary}.
%prep
%autosetup -n iputils-s%{version} -p1
cp ninfod/COPYING COPYING.ninfod
%build
CONFIGURE_OPTS=(
-DUSE_CAP=true
-DUSE_CRYPTO=none
-DUSE_GETTEXT=false
-DUSE_IDN=false
-DBUILD_ARPING=true
-DBUILD_PING=true
-DBUILD_TRACEPATH=true
-DBUILD_CLOCKDIFF=false
-DBUILD_NINFOD=false
-DBUILD_RARPD=false
-DBUILD_RDISC=false
-DBUILD_TFTPD=false
-DBUILD_TRACEROUTE6=false
-DBUILD_MANS=false
-DBUILD_HTML_MANS=false
)
%cross_meson "${CONFIGURE_OPTS[@]}"
%cross_meson_build
%install
%cross_meson_install
%files
%license LICENSE Documentation/LICENSE.GPL2 Documentation/LICENSE.BSD3 COPYING.ninfod
%{_cross_attribution_file}
%attr(0755,root,root) %caps(cap_net_raw=p) %{_cross_bindir}/arping
%attr(0755,root,root) %caps(cap_net_raw=p cap_net_admin=p) %{_cross_bindir}/ping
%{_cross_bindir}/tracepath
%changelog
| {
"pile_set_name": "Github"
} |
/*
TiMidity -- Experimental MIDI to WAVE converter
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
tables.h
*/
#ifdef USE_TIMIDITY_MIDI
#ifndef TIMIDITY_TABLES_H_INCLUDED
#define TIMIDITY_TABLES_H_INCLUDED
#include "timidity.h"
#include <cmath>
#ifdef NS_TIMIDITY
namespace NS_TIMIDITY {
#endif
#ifdef LOOKUP_SINE
extern float sine(int x);
#else
#define sine(x) (std::sin((2*PI/1024.0) * (x)))
#endif
#define SINE_CYCLE_LENGTH 1024
extern sint32 freq_table[];
extern double vol_table[];
extern double bend_fine[];
extern double bend_coarse[];
extern uint8 *_l2u; /* 13-bit PCM to 8-bit u-law */
extern uint8 _l2u_[]; /* used in LOOKUP_HACK */
#ifdef LOOKUP_HACK
extern sint16 _u2l[];
extern sint32 *mixup;
#ifdef LOOKUP_INTERPOLATION
extern sint8 *iplookup;
#endif
#endif
extern void init_tables();
#ifdef NS_TIMIDITY
}
#endif
#endif
#endif //USE_TIMIDITY_MIDI
| {
"pile_set_name": "Github"
} |
/*
*
* Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand.
* All rights reserved.
*
* This file is part of libprotoident.
*
* This code has been developed by the University of Waikato WAND
* research group. For further information please see http://www.wand.net.nz/
*
* libprotoident is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* libprotoident 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 program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#include <string.h>
#include "libprotoident.h"
#include "proto_manager.h"
#include "proto_common.h"
static inline bool match_slp_req(uint32_t payload, uint32_t len) {
/* According to RFC 2608, the 3rd and 4th bytes should be the
* length (including the SLP header). This doesn't appear to be the
* case with any of the port 427 traffic I've seen, so either I'm
* wrong or people fail at following RFCs */
if (MATCH(payload, 0x02, 0x01, 0x00, 0x00) && len == 49) {
return true;
}
return false;
}
static inline bool match_slp_resp(uint32_t payload, uint32_t len) {
/* I haven't actually observed any responses yet, so just going
* on what the spec says :/ */
if (len == 0)
return true;
if (MATCH(payload, 0x02, 0x02, ANY, ANY)) {
return true;
}
return false;
}
static inline bool match_slp(lpi_data_t *data, lpi_module_t *mod UNUSED) {
if (data->server_port != 427 && data->client_port != 427)
return false;
if (match_slp_req(data->payload[0], data->payload_len[0])) {
if (match_slp_resp(data->payload[1], data->payload_len[1]))
return true;
return false;
}
if (match_slp_req(data->payload[1], data->payload_len[1])) {
if (match_slp_resp(data->payload[0], data->payload_len[0]))
return true;
return false;
}
return false;
}
static lpi_module_t lpi_slp = {
LPI_PROTO_UDP_SLP,
LPI_CATEGORY_SERVICES,
"SLP",
5,
match_slp
};
void register_slp(LPIModuleMap *mod_map) {
register_protocol(&lpi_slp, mod_map);
}
| {
"pile_set_name": "Github"
} |
package client // import "github.com/docker/docker/client"
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"golang.org/x/net/context"
)
func TestSecretListUnsupported(t *testing.T) {
client := &Client{
version: "1.24",
client: &http.Client{},
}
_, err := client.SecretList(context.Background(), types.SecretListOptions{})
assert.Check(t, is.Error(err, `"secret list" requires API version 1.25, but the Docker daemon API version is 1.24`))
}
func TestSecretListError(t *testing.T) {
client := &Client{
version: "1.25",
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.SecretList(context.Background(), types.SecretListOptions{})
if err == nil || err.Error() != "Error response from daemon: Server error" {
t.Fatalf("expected a Server Error, got %v", err)
}
}
func TestSecretList(t *testing.T) {
expectedURL := "/v1.25/secrets"
filters := filters.NewArgs()
filters.Add("label", "label1")
filters.Add("label", "label2")
listCases := []struct {
options types.SecretListOptions
expectedQueryParams map[string]string
}{
{
options: types.SecretListOptions{},
expectedQueryParams: map[string]string{
"filters": "",
},
},
{
options: types.SecretListOptions{
Filters: filters,
},
expectedQueryParams: map[string]string{
"filters": `{"label":{"label1":true,"label2":true}}`,
},
},
}
for _, listCase := range listCases {
client := &Client{
version: "1.25",
client: newMockClient(func(req *http.Request) (*http.Response, error) {
if !strings.HasPrefix(req.URL.Path, expectedURL) {
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
}
query := req.URL.Query()
for key, expected := range listCase.expectedQueryParams {
actual := query.Get(key)
if actual != expected {
return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
}
}
content, err := json.Marshal([]swarm.Secret{
{
ID: "secret_id1",
},
{
ID: "secret_id2",
},
})
if err != nil {
return nil, err
}
return &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewReader(content)),
}, nil
}),
}
secrets, err := client.SecretList(context.Background(), listCase.options)
if err != nil {
t.Fatal(err)
}
if len(secrets) != 2 {
t.Fatalf("expected 2 secrets, got %v", secrets)
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version='1.1' ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="include/StorageFunctions.xsl"/>
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:element name="StorageObjects">
<xsl:apply-templates select="Logon"/>
<xsl:apply-templates select="ProcessList"/>
</xsl:element>
</xsl:template>
<xsl:template match="ProcessList">
<xsl:apply-templates select="Process"/>
</xsl:template>
<xsl:template match="Process">
<xsl:element name="ObjectValue">
<xsl:attribute name="name">Process</xsl:attribute>
<xsl:element name="IntValue">
<xsl:attribute name="name">id</xsl:attribute>
<xsl:value-of select="@id"/>
</xsl:element>
<xsl:element name="StringValue">
<xsl:attribute name="name">name</xsl:attribute>
<xsl:value-of select="@name"/>
</xsl:element>
<xsl:element name="StringValue">
<xsl:attribute name="name">user</xsl:attribute>
<xsl:value-of select="@user"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="Logon">
<xsl:element name="ObjectValue">
<xsl:attribute name="name">Token</xsl:attribute>
<xsl:element name="StringValue">
<xsl:attribute name="name">value</xsl:attribute>
<xsl:value-of select="@handle"/>
</xsl:element>
<xsl:element name="StringValue">
<xsl:attribute name="name">alias</xsl:attribute>
<xsl:value-of select="@alias"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:transform> | {
"pile_set_name": "Github"
} |
// eeeeeevvvvviiiiiiillllll
// more evil than monkey-patching the native builtin?
// Not sure.
var mod = require("module")
var pre = '(function (exports, require, module, __filename, __dirname) { '
var post = '});'
var src = pre + process.binding('natives').fs + post
var vm = require('vm')
var fn = vm.runInThisContext(src)
fn(exports, require, module, __filename, __dirname)
| {
"pile_set_name": "Github"
} |
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code 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.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "../idlib/precompiled.h"
#pragma hdrstop
#include "Game_local.h"
/*
game_endlevel.cpp
This entity is targeted to complete a level, and it also handles
running the stats and moving the camera.
*/
CLASS_DECLARATION( idEntity, idTarget_EndLevel )
EVENT( EV_Activate, idTarget_EndLevel::Event_Trigger )
END_CLASS
/*
================
idTarget_EndLevel::Spawn
================
*/
void idTarget_EndLevel::Spawn( void )
{
idStr guiName;
gui = NULL;
noGui = spawnArgs.GetBool( "noGui" );
if( !noGui )
{
spawnArgs.GetString( "guiName", "guis/EndLevel.gui", guiName );
if( guiName.Length() )
{
gui = idUserInterface::FindGui( guiName, true, false, true );
}
}
buttonsReleased = false;
readyToExit = false;
exitCommand = "";
}
/*
================
idTarget_EndLevel::~idTarget_EndLevel()
================
*/
idTarget_EndLevel::~idTarget_EndLevel()
{
//FIXME: need to go to smart ptrs for gui allocs or the unique method
//delete gui;
}
/*
================
idTarget_EndLevel::Event_Trigger
================
*/
void idTarget_EndLevel::Event_Trigger( idEntity* activator )
{
if( gameLocal.endLevel )
{
return;
}
// mark the endLevel, which will modify some game actions
// and pass control to us for drawing the stats and camera position
gameLocal.endLevel = this;
// grab the activating player view position
idPlayer* player = ( idPlayer* )( activator );
initialViewOrg = player->GetEyePosition();
initialViewAngles = idVec3( player->viewAngles[0], player->viewAngles[1], player->viewAngles[2] );
// kill all the sounds
gameSoundWorld->StopAllSounds();
if( noGui )
{
readyToExit = true;
}
}
/*
================
idTarget_EndLevel::Draw
================
*/
void idTarget_EndLevel::Draw()
{
if( noGui )
{
return;
}
renderView_t renderView;
memset( &renderView, 0, sizeof( renderView ) );
renderView.width = SCREEN_WIDTH;
renderView.height = SCREEN_HEIGHT;
renderView.x = 0;
renderView.y = 0;
renderView.fov_x = 90;
renderView.fov_y = gameLocal.CalcFovY( renderView.fov_x );
renderView.time = gameLocal.time;
#if 0
renderView.vieworg = initialViewOrg;
renderView.viewaxis = idAngles( initialViewAngles ).toMat3();
#else
renderView.vieworg = renderEntity.origin;
renderView.viewaxis = renderEntity.axis;
#endif
gameRenderWorld->RenderScene( &renderView );
// draw the gui on top of the 3D view
gui->Redraw( gameLocal.time );
}
/*
================
idTarget_EndLevel::PlayerCommand
================
*/
void idTarget_EndLevel::PlayerCommand( int buttons )
{
if( !( buttons & BUTTON_ATTACK ) )
{
buttonsReleased = true;
return;
}
if( !buttonsReleased )
{
return;
}
// we will exit at the end of the next game frame
readyToExit = true;
}
/*
================
idTarget_EndLevel::ExitCommand
================
*/
const char* idTarget_EndLevel::ExitCommand()
{
if( !readyToExit )
{
return NULL;
}
idStr nextMap;
if( spawnArgs.GetString( "nextMap", "", nextMap ) )
{
sprintf( exitCommand, "map %s", nextMap.c_str() );
}
else
{
exitCommand = "";
}
return exitCommand;
}
| {
"pile_set_name": "Github"
} |
logstash-indexer-config:
restart: always
image: rancher/logstash-config:v0.2.0
labels:
io.rancher.container.hostname_override: container_name
redis:
restart: always
tty: true
image: redis:3.0.3
stdin_open: true
labels:
io.rancher.container.hostname_override: container_name
logstash-indexer:
restart: always
tty: true
volumes_from:
- logstash-indexer-config
command:
- logstash
- -f
- /etc/logstash
image: logstash:1.5.3-1
links:
- redis:redis
external_links:
- ${elasticsearch_link}:elasticsearch
stdin_open: true
labels:
io.rancher.sidekicks: logstash-indexer-config
io.rancher.container.hostname_override: container_name
logstash-collector-config:
restart: always
image: rancher/logstash-config:v0.2.0
labels:
io.rancher.container.hostname_override: container_name
logstash-collector:
restart: always
tty: true
links:
- redis:redis
ports:
- "5000/udp"
volumes_from:
- logstash-collector-config
command:
- logstash
- -f
- /etc/logstash
image: logstash:1.5.3-1
stdin_open: true
labels:
io.rancher.sidekicks: logstash-collector-config
io.rancher.container.hostname_override: container_name
| {
"pile_set_name": "Github"
} |
---
-api-id: P:Windows.Storage.UserDataPaths.Videos
-api-type: winrt property
---
<!-- Property syntax.
public string Videos { get; }
-->
# Windows.Storage.UserDataPaths.Videos
## -description
Gets the path to a user's Videos folder.
## -property-value
The full path to the user's Videos folder.
## -remarks
## -see-also
## -examples
| {
"pile_set_name": "Github"
} |
/*
* /MathJax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Dingbats.js
*
* Copyright (c) 2009-2014 The MathJax Consortium
*
* 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.
*/
MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.MathJax_AMS,{10003:[706,34,833,84,749],10016:[716,22,833,48,786]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/AMS/Regular/Dingbats.js");
| {
"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.
##
log4j.rootLogger=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#
# The `%X{connector.context}` parameter in the layout includes connector-specific and task-specific information
# in the log message, where appropriate. This makes it easier to identify those log messages that apply to a
# specific connector. Simply add this parameter to the log layout configuration below to include the contextual information.
#
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %X{connector.context}%m (%c:%L)%n
#
# The following line includes no MDC context parameters:
#log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n (%t)
log4j.logger.org.reflections=OFF
log4j.logger.kafka=OFF
log4j.logger.state.change.logger=OFF
log4j.logger.org.apache.kafka.connect.mirror=INFO
| {
"pile_set_name": "Github"
} |
#pragma once
#include "config_common.h"
#define VENDOR_ID 0x1234
#define PRODUCT_ID 0x5678
#define DEVICE_VER 0x0001
#define MANUFACTURER QMK
#define PRODUCT TRACKPOINT-DEMO
#define DESCRIPTION Simple demonstration for IBM Trackpoint integration
#define MATRIX_ROWS 1
#define MATRIX_COLS 3
#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
#define PS2_USART_INIT() do { \
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
UCSR1C = ((1 << UMSEL10) | \
(3 << UPM10) | \
(0 << USBS1) | \
(3 << UCSZ10) | \
(0 << UCPOL1)); \
UCSR1A = 0; \
UBRR1H = 0; \
UBRR1L = 0; \
} while (0)
#define PS2_USART_RX_INT_ON() do { \
UCSR1B = ((1 << RXCIE1) | \
(1 << RXEN1)); \
} while (0)
#define PS2_USART_RX_POLL_ON() do { \
UCSR1B = (1 << RXEN1); \
} while (0)
#define PS2_USART_OFF() do { \
UCSR1C = 0; \
UCSR1B &= ~((1 << RXEN1) | \
(1 << TXEN1)); \
} while (0)
#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
#define PS2_USART_RX_DATA UDR1
#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
#define PS2_USART_RX_VECT USART1_RX_vect
#endif
#define MATRIX_COL_PINS { F1, F4, F5 }
#define MATRIX_ROW_PINS { F0 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
#define DEBOUNCE 5
#define LOCKING_SUPPORT_ENABLE
#define LOCKING_RESYNC_ENABLE
| {
"pile_set_name": "Github"
} |
<table>
<tr>
<td><img width="20" src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/archive.svg" alt="archived" /></td>
<td><strong>Archived Repository</strong><br />
This code is no longer maintained. Feel free to fork it, but use it at your own risks.
</td>
</tr>
</table>
# Tree.js [](https://travis-ci.org/marmelab/tree.js)
Tree.js is a JavaScript library to build and manipulate hookable trees.
## Installation
It is available with bower:
```
bower install tree.js
```
Then add the retrieved files to your HTML layout:
```html
<script type="text/javascript" src="/path/to/bower_components/tree.js/tree.min.js"></script>
<!-- If you want to build hookable tree (see below) -->
<script type="text/javascript" src="/path/to/bower_components/q/q.js"></script>
```
You can also use it with [RequireJS](http://requirejs.org/) as an AMD module.
## Usage
### Simple tree
#### Create a tree
```javascript
var myTree = Tree.tree({
children: [
{
name: 'dupuis',
children: [
{
name: 'prunelle',
children: [
{
name: 'lebrac',
job: 'designer'
},
{
name: 'lagaffe',
firstname: 'gaston',
job: 'sleeper'
},
]
}
]
}
]
});
```
#### Find a node
```javascript
var lebrac = myTree.find('/dupuis/prunelle/lebrac');
// or
var lebrac = myTree.find('/dupuis').find('/prunelle/lebrac');
// or
var lebrac = myTree.find('/dupuis').find('/prunelle').find('/lebrac');
```
#### Get the raw data of a node
```javascript
lebrac.data() // { name: 'lebrac', job: 'designer' }
```
#### Get an attribute
```javascript
lebrac.attr('job'); // designer
```
#### Set an attribute
```javascript
lebrac.attr('job', 'director');
lebrac
.attr('location', 'here')
.attr('hobby', 'design');
```
#### Get the path of a node
```javascript
lebrac.path(); // /dupuis/prunelle/lebrac
```
#### Get the parent of a node
```javascript
var dupuis = lebrac.parent();
dupuis.name(); // dupuis
dupuis.parent(); // undefined
```
#### Append a child node
```javascript
lebrac.append(Tree.tree({
name: 'paper',
children: [{ name: 'pen' }]
}));
lebrac.find('/paper/pen');
lebrac.find('/paper').parent().parent().parent().name(); // dupuis
```
#### Remove a node
```javascript
lebrac.remove();
myTree.find('/dupuis/prunelle/lebrac'); // undefined
```
#### Move a node
```javascript
var lagaffe = myTree.find('/dupuis/prunelle/lagaffe').moveTo(myTree.find('/dupuis'));
lagaffe.path(); // /dupuis/lagaffe
```
#### Get the children of a node
```javascript
var children = myTree.find('/dupuis').children();
children[0].name(); // prunelle
```
#### Get a node visitor
In order to execute a callback on each node of the tree, you can use a visitor:
```javascript
var visitor = myTree.visitor();
visitor(function(node) {
// you can now interact with each node
});
```
#### Stringify a node
On any node you can call `stringify` to serialize it. Internally it will use JSON.stringify with custom replacer to avoid circular references because of the `_parent` private property:
```javascript
myTree.stringify()
```
### Work with hooks
To work with hooks, you first need to add hook capacities to your tree:
```javascript
var hookableTree = Tree.hookable(myTree);
```
Everything explained above is still true but the hookable operations will now return promises!
Because of that you need to include into your page `Q` library. Otherwise you can specify another promises library by calling: `hookableTree.promiseFactory(YOUR_FACTORY)`. It must expose the same API than `Q`.
You can configure the timeout used for each listener by calling `hookableTree.timeout(30000)`. Set it to `0` to disable it, default to `30000`.
#### Register a hook listener
There are 12 hooks available:
| Hook | Description |
| ----------------: |:-------------------------------------------------------------------|
| HOOK_PRE_APPEND | Triggered when `append` is called and before applying it on the tree |
| HOOK_POST_APPEND | Triggered when `append` is called and after applying it on the tree |
| HOOK_ERROR_APPEND | Triggered when `append` is called and an error occured |
| HOOK_PRE_REMOVE | Triggered when `remove` is called and before applying it on the tree |
| HOOK_POST_REMOVE | Triggered when `remove` is called and after applying it on the tree |
| HOOK_ERROR_REMOVE | Triggered when `remove` is called and an error occured |
| HOOK_PRE_MOVE | Triggered when `moveTo` is called and before applying it on the tree |
| HOOK_POST_MOVE | Triggered when `moveTo` is called and after applying it on the tree |
| HOOK_ERROR_MOVE | Triggered when `moveTo` is called and an error occured |
| HOOK_PRE_CLONE | Triggered when `clone` is called and before applying it on the tree |
| HOOK_POST_CLONE | Triggered when `clone` is called and after applying it on the tree |
| HOOK_ERROR_CLONE | Triggered when `clone` is called and an error occured |
To register a hook you need to call `registerListener(string hook, function listener)`:
```javascript
hookableTree.registerListener(hookableTree.HOOK_PRE_APPEND, function(newNode) {
// I am a hook listener, I will be triggered before any append operation.
// The arguments are not always the same depending on the hook.
// Hook context is the tree.
this; // will be our tree
// If you need to perform asynchronous operation, just return a promise.
});
```
Because of hooks, `append`, `remove`, `move`, `clone` will return promise, as show in this example:
```javascript
hookableTree.append(Tree.tree({ name: 'spirou'})).then(function(childNode) {
// Everything is ok, it worked!
// When you append a node, you can either give as argument a tree or hookable tree.
// If it is a hookable tree, its hook listeners will added to the parent tree.
}, function(err) {
// An error occured or a hook listener failed
});
```
```javascript
hookableTree.find('/dupuis').remove().then(function(dupuisParent) {
// Everything is ok, it worked!
}, function(err) {
// An error occured or a hook listener failed
});
```
```javascript
hookableTree.find('/dupuis/prunelle').moveTo(hookableTree).then(function(prunelle) {
// Everything is ok, it worked!
}, function(err) {
// An error occured or a hook listener failed
});
```
```javascript
hookableTree.find('/dupuis/prunelle').clone().then(function(clonedPrunelle) {
// Everything is ok, it worked!
}, function(err) {
// An error occured or a hook listener failed
});
```
## Build
To rebuild the minified JavaScript you must run: `make build`.
## Tests
Install dependencies and run the unit tests:
```
make install
make test-spec
```
## Contributing
All contributions are welcome and must pass the tests. If you add a new feature, please write tests for it.
## License
This application is available under the MIT License, courtesy of [marmelab](http://marmelab.com).
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*/
package org.omg.spec.bpmn.non.normative.color.util;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
/**
* <!-- begin-user-doc -->
* The <b>Resource </b> associated with the package.
* <!-- end-user-doc -->
* @see org.omg.spec.bpmn.non.normative.color.util.ColorResourceFactoryImpl
* @generated
*/
public class ColorResourceImpl extends XMLResourceImpl {
/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param uri the URI of the new resource.
* @generated
*/
public ColorResourceImpl(URI uri) {
super(uri);
}
} //ColorResourceImpl
| {
"pile_set_name": "Github"
} |
#Wed Sep 11 23:45:10 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
| {
"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.yarn.server.utils;
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.DBException;
import org.iq80.leveldb.DBIterator;
import org.iq80.leveldb.ReadOptions;
/**
* A wrapper for a DBIterator to translate the raw RuntimeExceptions that
* can be thrown into DBExceptions.
*/
@Public
@Evolving
public class LeveldbIterator implements Iterator<Map.Entry<byte[], byte[]>>,
Closeable {
private DBIterator iter;
/**
* Create an iterator for the specified database
*/
public LeveldbIterator(DB db) {
iter = db.iterator();
}
/**
* Create an iterator for the specified database
*/
public LeveldbIterator(DB db, ReadOptions options) {
iter = db.iterator(options);
}
/**
* Create an iterator using the specified underlying DBIterator
*/
public LeveldbIterator(DBIterator iter) {
this.iter = iter;
}
/**
* Repositions the iterator so the key of the next BlockElement
* returned greater than or equal to the specified targetKey.
*/
public void seek(byte[] key) throws DBException {
try {
iter.seek(key);
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Repositions the iterator so is is at the beginning of the Database.
*/
public void seekToFirst() throws DBException {
try {
iter.seekToFirst();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Repositions the iterator so it is at the end of of the Database.
*/
public void seekToLast() throws DBException {
try {
iter.seekToLast();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Returns <tt>true</tt> if the iteration has more elements.
*/
public boolean hasNext() throws DBException {
try {
return iter.hasNext();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Returns the next element in the iteration.
*/
@Override
public Map.Entry<byte[], byte[]> next() throws DBException {
try {
return iter.next();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Returns the next element in the iteration, without advancing the
* iteration.
*/
public Map.Entry<byte[], byte[]> peekNext() throws DBException {
try {
return iter.peekNext();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* @return true if there is a previous entry in the iteration.
*/
public boolean hasPrev() throws DBException {
try {
return iter.hasPrev();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* @return the previous element in the iteration and rewinds the iteration.
*/
public Map.Entry<byte[], byte[]> prev() throws DBException {
try {
return iter.prev();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* @return the previous element in the iteration, without rewinding the
* iteration.
*/
public Map.Entry<byte[], byte[]> peekPrev() throws DBException {
try {
return iter.peekPrev();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Removes from the database the last element returned by the iterator.
*/
@Override
public void remove() throws DBException {
try {
iter.remove();
} catch (DBException e) {
throw e;
} catch (RuntimeException e) {
throw new DBException(e.getMessage(), e);
}
}
/**
* Closes the iterator.
*/
@Override
public void close() throws IOException {
try {
iter.close();
} catch (RuntimeException e) {
throw new IOException(e.getMessage(), e);
}
}
}
| {
"pile_set_name": "Github"
} |
//=======================================================================
// Copyright (c) 2014-2020 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//=======================================================================
#pragma once
#include "etl/expr/base_temporary_expr.hpp"
#include "etl/impl/egblas/bias_batch_sum.hpp"
namespace etl {
/*!
* \brief A transposition expression.
* \tparam A The transposed type
*/
template <typename A, typename B>
struct bias_batch_var_4d_expr : base_temporary_expr_bin<bias_batch_var_4d_expr<A, B>, A, B> {
using value_type = value_t<A>; ///< The type of value of the expression
using this_type = bias_batch_var_4d_expr<A, B>; ///< The type of this expression
using base_type = base_temporary_expr_bin<this_type, A, B>; ///< The base type
using sub_traits = decay_traits<A>; ///< The traits of the sub type
static constexpr auto storage_order = sub_traits::storage_order; ///< The sub storage order
/*!
* \brief Indicates if the temporary expression can be directly evaluated
* using only GPU.
*/
static constexpr bool gpu_computable =
(impl::egblas::has_sbias_batch_var4 && all_row_major<A> && all_single_precision<A>)
|| (impl::egblas::has_dbias_batch_var4 && all_row_major<A> && all_double_precision<A>);
/*!
* \brief Construct a new expression
* \param a The sub expression
*/
explicit bias_batch_var_4d_expr(A a, B b) : base_type(a, b) {
//Nothing else to init
}
/*!
* \brief Validate the transposition dimensions
* \param a The input matrix
* \þaram c The output matrix
*/
template <typename C>
static void check([[maybe_unused]] const A& a, [[maybe_unused]] const B& b, [[maybe_unused]] const C& c) {
static_assert(etl::dimensions<C>() == 1, "The output of bias_batch_var_4d is a vector");
static_assert(etl::dimensions<A>() == 4, "The input of bias_batch_var_4d is a 2d matrix");
static_assert(etl::dimensions<B>() == 1, "The input of bias_batch_var_4d is a vector");
if constexpr (all_fast<A, B, C>) {
static_assert(etl::dim<1, A>() == etl::dim<0, C>(), "Invalid dimensions for bias_batch_var_4d");
static_assert(etl::dim<0, B>() == etl::dim<0, C>(), "Invalid dimensions for bias_batch_var_4d");
} else {
cpp_assert(etl::dim<1>(a) == etl::dim<0>(c), "Invalid dimensions for bias_batch_var_4d");
cpp_assert(etl::dim<0>(b) == etl::dim<0>(c), "Invalid dimensions for bias_batch_var_4d");
}
}
// Assignment functions
/*!
* \brief Assign to a matrix of the same storage order
* \param lhs The expression to which assign
*/
template <typename L>
void assign_to(L&& lhs) const {
static_assert(all_etl_expr<A, L>, "bias_batch_var_4d only supported for ETL expressions");
inc_counter("temp:assign");
auto& a = this->a();
auto& b = this->b();
check(a, b, lhs);
const auto N = etl::dim<0>(a);
const auto K = etl::dim<1>(a);
if constexpr (impl::egblas::has_sbias_batch_var4 && all_row_major<A> && all_floating<A, L>) {
const auto W = etl::dim<2>(a);
const auto H = etl::dim<3>(a);
decltype(auto) t1 = smart_forward_gpu(a);
decltype(auto) t2 = smart_forward_gpu(b);
t1.ensure_gpu_up_to_date();
t2.ensure_gpu_up_to_date();
lhs.ensure_gpu_allocated();
impl::egblas::bias_batch_var4(N, K, W, H, t1.gpu_memory(), t2.gpu_memory(), lhs.gpu_memory());
lhs.validate_gpu();
lhs.invalidate_cpu();
} else {
standard_evaluator::pre_assign_rhs(a);
standard_evaluator::pre_assign_rhs(b);
a.ensure_cpu_up_to_date();
b.ensure_cpu_up_to_date();
// Note: We use etl::sum directly instead of doing the sum manually
// That way, we will access the already vectorized sum
// Now, this means that evaluator decisions will be called several
// times. This could be an issue that could be looked at in the future
auto batch_fun_k = [&](const size_t first, const size_t last) {
CPU_SECTION {
for (size_t k = first; k < last; ++k) {
lhs(k) = 0;
}
for (size_t bb = 0; bb < N; ++bb) {
for (size_t k = first; k < last; ++k) {
lhs(k) += sum((a(bb)(k) - b(k)) >> (a(bb)(k) - b(k)));
}
}
for (size_t k = first; k < last; ++k) {
lhs(k) /= (etl::size(a) / etl::size(lhs));
}
}
};
engine_dispatch_1d_serial(batch_fun_k, 0, K, 2UL);
lhs.validate_cpu();
lhs.invalidate_gpu();
}
}
/*!
* \brief Add to the given left-hand-side expression
* \param lhs The expression to which assign
*/
template <typename L>
void assign_add_to(L&& lhs) const {
static_assert(all_etl_expr<A, L>, "bias_batch_var_4d only supported for ETL expressions");
auto& a = this->a();
auto& b = this->b();
standard_evaluator::pre_assign_rhs(a);
standard_evaluator::pre_assign_rhs(b);
const auto N = etl::dim<0>(a);
const auto K = etl::dim<1>(a);
using T = value_t<A>;
check(a, b, lhs);
a.ensure_cpu_up_to_date();
b.ensure_cpu_up_to_date();
lhs.ensure_cpu_up_to_date();
auto batch_fun_k = [&](const size_t first, const size_t last) {
CPU_SECTION {
for (size_t k = first; k < last; ++k) {
T var = 0;
for (size_t bb = 0; bb < N; ++bb) {
var += sum((a(bb)(k) - b(k)) >> (a(bb)(k) - b(k)));
}
lhs(k) += var / (etl::size(a) / etl::size(lhs));
}
}
};
engine_dispatch_1d_serial(batch_fun_k, 0, K, 2UL);
lhs.validate_cpu();
lhs.invalidate_gpu();
}
/*!
* \brief Sub from the given left-hand-side expression
* \param lhs The expression to which assign
*/
template <typename L>
void assign_sub_to(L&& lhs) const {
static_assert(all_etl_expr<A, L>, "bias_batch_var_4d only supported for ETL expressions");
auto& a = this->a();
auto& b = this->b();
standard_evaluator::pre_assign_rhs(a);
standard_evaluator::pre_assign_rhs(b);
const auto N = etl::dim<0>(a);
const auto K = etl::dim<1>(a);
using T = value_t<A>;
check(a, b, lhs);
a.ensure_cpu_up_to_date();
b.ensure_cpu_up_to_date();
lhs.ensure_cpu_up_to_date();
auto batch_fun_k = [&](const size_t first, const size_t last) {
CPU_SECTION {
for (size_t k = first; k < last; ++k) {
T var = 0;
for (size_t bb = 0; bb < N; ++bb) {
var += sum((a(bb)(k) - b(k)) >> (a(bb)(k) - b(k)));
}
lhs(k) -= var / (etl::size(a) / etl::size(lhs));
}
}
};
engine_dispatch_1d_serial(batch_fun_k, 0, K, 2UL);
lhs.validate_cpu();
lhs.invalidate_gpu();
}
/*!
* \brief Multiply the given left-hand-side expression
* \param lhs The expression to which assign
*/
template <typename L>
void assign_mul_to(L&& lhs) const {
static_assert(all_etl_expr<A, L>, "bias_batch_var_4d only supported for ETL expressions");
auto& a = this->a();
auto& b = this->b();
standard_evaluator::pre_assign_rhs(a);
standard_evaluator::pre_assign_rhs(b);
const auto N = etl::dim<0>(a);
const auto K = etl::dim<1>(a);
using T = value_t<A>;
check(a, b, lhs);
a.ensure_cpu_up_to_date();
b.ensure_cpu_up_to_date();
lhs.ensure_cpu_up_to_date();
auto batch_fun_k = [&](const size_t first, const size_t last) {
CPU_SECTION {
for (size_t k = first; k < last; ++k) {
T var = 0;
for (size_t bb = 0; bb < N; ++bb) {
var += sum((a(bb)(k) - b(k)) >> (a(bb)(k) - b(k)));
}
lhs(k) *= var / (etl::size(a) / etl::size(lhs));
}
}
};
engine_dispatch_1d_serial(batch_fun_k, 0, K, 2UL);
lhs.validate_cpu();
lhs.invalidate_gpu();
}
/*!
* \brief Divide the given left-hand-side expression
* \param lhs The expression to which assign
*/
template <typename L>
void assign_div_to(L&& lhs) const {
static_assert(all_etl_expr<A, L>, "bias_batch_var_4d only supported for ETL expressions");
auto& a = this->a();
auto& b = this->b();
standard_evaluator::pre_assign_rhs(a);
standard_evaluator::pre_assign_rhs(b);
const auto N = etl::dim<0>(a);
const auto K = etl::dim<1>(a);
using T = value_t<A>;
check(a, b, lhs);
a.ensure_cpu_up_to_date();
b.ensure_cpu_up_to_date();
lhs.ensure_cpu_up_to_date();
auto batch_fun_k = [&](const size_t first, const size_t last) {
CPU_SECTION {
for (size_t k = first; k < last; ++k) {
T var = 0;
for (size_t bb = 0; bb < N; ++bb) {
var += sum((a(bb)(k) - b(k)) >> (a(bb)(k) - b(k)));
}
lhs(k) /= var / (etl::size(a) / etl::size(lhs));
}
}
};
engine_dispatch_1d_serial(batch_fun_k, 0, K, 2UL);
lhs.validate_cpu();
lhs.invalidate_gpu();
}
/*!
* \brief Modulo the given left-hand-side expression
* \param lhs The expression to which assign
*/
template <typename L>
void assign_mod_to(L&& lhs) const {
static_assert(all_etl_expr<A, L>, "bias_batch_var_4d only supported for ETL expressions");
auto& a = this->a();
auto& b = this->b();
standard_evaluator::pre_assign_rhs(a);
standard_evaluator::pre_assign_rhs(b);
const auto N = etl::dim<0>(a);
const auto K = etl::dim<1>(a);
using T = value_t<A>;
check(a, b, lhs);
a.ensure_cpu_up_to_date();
b.ensure_cpu_up_to_date();
lhs.ensure_cpu_up_to_date();
auto batch_fun_k = [&](const size_t first, const size_t last) {
CPU_SECTION {
for (size_t k = first; k < last; ++k) {
T var = 0;
for (size_t bb = 0; bb < N; ++bb) {
var += sum((a(bb)(k) - b(k)) >> (a(bb)(k) - b(k)));
}
lhs(k) %= var / (etl::size(a) / etl::size(lhs));
}
}
};
engine_dispatch_1d_serial(batch_fun_k, 0, K, 2UL);
lhs.validate_cpu();
lhs.invalidate_gpu();
}
/*!
* \brief Print a representation of the expression on the given stream
* \param os The output stream
* \param expr The expression to print
* \return the output stream
*/
friend std::ostream& operator<<(std::ostream& os, const bias_batch_var_4d_expr& expr) {
return os << "bias_batch_var_4d(" << expr._a << ")";
}
};
/*!
* \brief Traits for a transpose expression
* \tparam A The transposed sub type
*/
template <typename A, typename B>
struct etl_traits<etl::bias_batch_var_4d_expr<A, B>> {
using expr_t = etl::bias_batch_var_4d_expr<A, B>; ///< The expression type
using sub_expr_t = std::decay_t<A>; ///< The sub expression type
using sub_traits = etl_traits<sub_expr_t>; ///< The sub traits
using value_type = value_t<A>; ///< The value type of the expression
static constexpr bool is_etl = true; ///< Indicates if the type is an ETL expression
static constexpr bool is_transformer = false; ///< Indicates if the type is a transformer
static constexpr bool is_view = false; ///< Indicates if the type is a view
static constexpr bool is_magic_view = false; ///< Indicates if the type is a magic view
static constexpr bool is_fast = sub_traits::is_fast; ///< Indicates if the expression is fast
static constexpr bool is_linear = false; ///< Indicates if the expression is linear
static constexpr bool is_thread_safe = true; ///< Indicates if the expression is thread safe
static constexpr bool is_value = false; ///< Indicates if the expression is of value type
static constexpr bool is_direct = true; ///< Indicates if the expression has direct memory access
static constexpr bool is_generator = false; ///< Indicates if the expression is a generator
static constexpr bool is_padded = false; ///< Indicates if the expression is padded
static constexpr bool is_aligned = true; ///< Indicates if the expression is padded
static constexpr bool is_temporary = true; ///< Indicates if the expression needs a evaluator visitor
static constexpr order storage_order = sub_traits::storage_order; ///< The expression's storage order
static constexpr bool gpu_computable = is_gpu_t<value_type> && cuda_enabled; ///< Indicates if the expression can be computed on GPU
/*!
* \brief Indicates if the expression is vectorizable using the
* given vector mode
* \tparam V The vector mode
*/
template <vector_mode_t V>
static constexpr bool vectorizable = true;
/*!
* \brief Returns the DDth dimension of the expression
* \return the DDth dimension of the expression
*/
template <size_t DD>
static constexpr size_t dim() {
static_assert(DD == 0, "Invalid dimensions access");
return decay_traits<A>::template dim<1>();
}
/*!
* \brief Returns the dth dimension of the expression
* \param e The sub expression
* \param d The dimension to get
* \return the dth dimension of the expression
*/
static size_t dim(const expr_t& e, [[maybe_unused]] size_t d) {
cpp_assert(d == 0, "Invalid dimensions access");
return etl::dim<1>(e._a);
}
/*!
* \brief Returns the size of the expression
* \param e The sub expression
* \return the size of the expression
*/
static size_t size(const expr_t& e) {
return etl::dim<1>(e._a);
}
/*!
* \brief Returns the size of the expression
* \return the size of the expression
*/
static constexpr size_t size() {
return decay_traits<A>::template dim<1>();
}
/*!
* \brief Returns the number of dimensions of the expression
* \return the number of dimensions of the expression
*/
static constexpr size_t dimensions() {
return 1;
}
/*!
* \brief Estimate the complexity of computation
* \return An estimation of the complexity of the expression
*/
static constexpr int complexity() noexcept {
return -1;
}
};
/*!
* \brief Returns the transpose of the given expression.
* \param value The expression
* \return The transpose of the given expression.
*/
template <typename A, typename B>
bias_batch_var_4d_expr<detail::build_type<A>, detail::build_type<B>> bias_batch_var_4d(const A& a, const B& b) {
static_assert(is_etl_expr<A>, "etl::bias_batch_var_4d can only be used on ETL expressions");
static_assert(is_etl_expr<B>, "etl::bias_batch_var_4d can only be used on ETL expressions");
static_assert(is_4d<A>, "etl::bias_batch_var_4d is only defined for 4d input");
static_assert(is_1d<B>, "etl::bias_batch_var_4d is only defined for 1d mean");
return bias_batch_var_4d_expr<detail::build_type<A>, detail::build_type<B>>{a, b};
}
} //end of namespace etl
| {
"pile_set_name": "Github"
} |
/* GStreamer
* Copyright (C) <2004> Benjamin Otte <otte@gnome.org>
* <2007> Stefan Kost <ensonic@users.sf.net>
*
* 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 __GST_IIR_EQUALIZER_NBANDS__
#define __GST_IIR_EQUALIZER_NBANDS__
#include "gstiirequalizer.h"
typedef struct _GstIirEqualizerNBands GstIirEqualizerNBands;
typedef struct _GstIirEqualizerNBandsClass GstIirEqualizerNBandsClass;
#define GST_TYPE_IIR_EQUALIZER_NBANDS \
(gst_iir_equalizer_nbands_get_type())
#define GST_IIR_EQUALIZER_NBANDS(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IIR_EQUALIZER_NBANDS,GstIirEqualizerNBands))
#define GST_IIR_EQUALIZER_NBANDS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IIR_EQUALIZER_NBANDS,GstIirEqualizerNBandsClass))
#define GST_IS_IIR_EQUALIZER_NBANDS(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IIR_EQUALIZER_NBANDS))
#define GST_IS_IIR_EQUALIZER_NBANDS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IIR_EQUALIZER_NBANDS))
struct _GstIirEqualizerNBands
{
GstIirEqualizer equalizer;
};
struct _GstIirEqualizerNBandsClass
{
GstIirEqualizerClass equalizer_class;
};
extern GType gst_iir_equalizer_nbands_get_type(void);
#endif /* __GST_IIR_EQUALIZER_NBANDS__ */
| {
"pile_set_name": "Github"
} |
/**
* Copyright 2011,2012 National ICT Australia Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nicta.scoobi
package impl
package collection
import testing.mutable.UnitSpecification
import scala.collection._
import Maps._
class MapsSpec extends UnitSpecification {
"A mutable map can be updated with keys from another map and a partial function to select the new keys to be added" >> {
val updated = mutable.Map(1 -> "1", 2 -> "2").updateWith(Map(3 -> "3", 4 -> "4")) {
case (k, v) =>
(k, "got: " + v)
}
updated must_== mutable.Map(1 -> "1", 2 -> "2", 3 -> "got: 3", 4 -> "got: 4")
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RepoDialog</class>
<widget class="QDialog" name="RepoDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>737</width>
<height>591</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Repo Name</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Repo Description</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txt_repo_name"/>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="txt_repo_description">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Sections</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>Search by Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txt_search"/>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="tree_sections">
<property name="sortingEnabled">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="lay_pkg_info">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Selected Package Info</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Version</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Maintainer</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPlainTextEdit" name="txt_pkg_description">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txt_pkg_name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="txt_pkg_maintainer">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmb_pkg_version">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Package Size</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="txt_pkg_filesize">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btn_download">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Download .deb</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>RepoDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>RepoDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
| {
"pile_set_name": "Github"
} |
package com.datamountaineer.streamreactor.connect.redis.sink
import com.datamountaineer.streamreactor.connect.redis.sink.config.{RedisConfig, RedisConfigConstants, RedisSinkSettings}
import com.datamountaineer.streamreactor.connect.redis.sink.support.RedisMockSupport
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import scala.collection.JavaConverters._
class RedisSinkTaskTest extends AnyWordSpec with Matchers with RedisMockSupport {
"work with Cache" -> {
val KCQL = s"INSERT INTO cache SELECT price from yahoo-fx PK symbol;"
println("Testing mode for KCQL : " + KCQL)
val props = Map(
RedisConfigConstants.REDIS_HOST->"localhost",
RedisConfigConstants.REDIS_PORT->"0000",
RedisConfigConstants.KCQL_CONFIG->KCQL
).asJava
val config = RedisConfig(props)
val settings = RedisSinkSettings(config)
val task = new RedisSinkTask
task.filterModeCache(settings).kcqlSettings shouldBe settings.kcqlSettings
task.filterModeInsertSS(settings).kcqlSettings.isEmpty shouldBe true
task.filterModePKSS(settings).kcqlSettings.isEmpty shouldBe true
}
"work with SortedSet" -> {
val KCQL = s"INSERT INTO topic-1 SELECT * FROM topic1 STOREAS SortedSet(score=ts);"
println("Testing mode for KCQL : " + KCQL)
val props = Map(
RedisConfigConstants.REDIS_HOST->"localhost",
RedisConfigConstants.REDIS_PORT->"0000",
RedisConfigConstants.KCQL_CONFIG->KCQL
).asJava
val config = RedisConfig(props)
val settings = RedisSinkSettings(config)
val task = new RedisSinkTask
task.filterModeInsertSS(settings).kcqlSettings shouldBe settings.kcqlSettings
task.filterModeCache(settings).kcqlSettings.isEmpty shouldBe true
task.filterModePKSS(settings).kcqlSettings.isEmpty shouldBe true
}
"work with Multiple SortedSets" -> {
val KCQL = s"SELECT temperature, humidity FROM sensorsTopic PK sensorID STOREAS SortedSet(score=timestamp);"
println("Testing mode for KCQL : " + KCQL)
val props = Map(
RedisConfigConstants.REDIS_HOST->"localhost",
RedisConfigConstants.REDIS_PORT->"0000",
RedisConfigConstants.KCQL_CONFIG->KCQL
).asJava
val config = RedisConfig(props)
val settings = RedisSinkSettings(config)
val task = new RedisSinkTask
task.filterModePKSS(settings).kcqlSettings shouldBe settings.kcqlSettings
task.filterModeCache(settings).kcqlSettings.isEmpty shouldBe true
task.filterModeInsertSS(settings).kcqlSettings.isEmpty shouldBe true
}
"work with Multiple Modes" -> {
val KCQL =
s"SELECT temperature, humidity FROM sensorsTopic PK sensorID STOREAS SortedSet(score=timestamp);" +
s"SELECT temperature, humidity FROM sensorsTopic2 PK sensorID STOREAS SortedSet(score=timestamp);" +
s"INSERT INTO cache1 SELECT price from yahoo-fx PK symbol;" +
s"INSERT INTO cache2 SELECT price from googl-fx PK symbol;" +
s"INSERT INTO cache3 SELECT price from appl-fx PK symbol;" +
s"INSERT INTO topic-1 SELECT * FROM topic1 STOREAS SortedSet(score=ts);" +
s"INSERT INTO topic-2 SELECT * FROM topic2 STOREAS SortedSet(score=ts);"
println("Testing mode for KCQL : " + KCQL)
val props = Map(
RedisConfigConstants.REDIS_HOST->"localhost",
RedisConfigConstants.REDIS_PORT->"0000",
RedisConfigConstants.KCQL_CONFIG->KCQL
).asJava
val config = RedisConfig(props)
val settings = RedisSinkSettings(config)
val task = new RedisSinkTask
//Verify filtered cacheSettings
val cacheSettings = task.filterModeCache(settings).kcqlSettings
cacheSettings.size shouldBe 3
cacheSettings.exists(_.kcqlConfig.getSource == "yahoo-fx") shouldBe true
cacheSettings.exists(_.kcqlConfig.getSource == "googl-fx") shouldBe true
cacheSettings.exists(_.kcqlConfig.getSource == "appl-fx") shouldBe true
//Verify filtered Sorted Set settings
val ssSettings = task.filterModeInsertSS(settings).kcqlSettings
ssSettings.size shouldBe 2
ssSettings.exists(_.kcqlConfig.getSource == "topic1") shouldBe true
ssSettings.exists(_.kcqlConfig.getSource == "topic2") shouldBe true
//Verify filtered Multiple Sorted Set settings
val mssSettings = task.filterModePKSS(settings).kcqlSettings
mssSettings.size shouldBe 2
mssSettings.exists(_.kcqlConfig.getSource == "sensorsTopic") shouldBe true
mssSettings.exists(_.kcqlConfig.getSource == "sensorsTopic2") shouldBe true
}
"work with streams" -> {
val KCQL = s"SELECT temperature, humidity FROM sensorsTopic PK sensorID STOREAS STREAM;"
println("Testing mode for KCQL : " + KCQL)
val props = Map(
RedisConfigConstants.REDIS_HOST->"localhost",
RedisConfigConstants.REDIS_PORT->"0000",
RedisConfigConstants.KCQL_CONFIG->KCQL
).asJava
val config = RedisConfig(props)
val settings = RedisSinkSettings(config)
val task = new RedisSinkTask
task.filterStream(settings).kcqlSettings.isEmpty shouldBe false
}
}
| {
"pile_set_name": "Github"
} |
#ifndef BOOST_METAPARSE_ERROR_INDEX_OUT_OF_RANGE_HPP
#define BOOST_METAPARSE_ERROR_INDEX_OUT_OF_RANGE_HPP
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
// 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/metaparse/v1/error/index_out_of_range.hpp>
namespace boost
{
namespace metaparse
{
namespace error
{
using v1::error::index_out_of_range;
}
}
}
#endif
| {
"pile_set_name": "Github"
} |
release: all
pack-pbp EBOOT.PBP UPDATE.SFO ICON0.PNG NULL NULL NULL NULL updater.prx NULL
TARGET = updater
OBJS = main.o
INCDIR = ../include
CFLAGS = -O2 -Os -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
LIBDIR = ../lib
LIBS = -lpspsystemctrl_user
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak | {
"pile_set_name": "Github"
} |
#include <Gwork/Util/ControlFactory.h>
#include <Gwork/Controls.h>
namespace Gwk
{
// namespace ControlFactory
// {
// class ListBox_Factory : public Gwk::ControlFactory::Base
// {
// public:
//
// GWK_CONTROL_FACTORY_FOR(ListBox, Base)
// {
// }
//
// Gwk::Controls::Base* CreateInstance(Gwk::Controls::Base* parent) override
// {
// Gwk::Controls::ListBox* control = new Gwk::Controls::ListBox(parent);
// control->SetSize(100, 100);
// return control;
// }
//
// };
//
//
// GWK_CONTROL_FACTORY(ListBox_Factory);
//
// }
}
| {
"pile_set_name": "Github"
} |
use serde::{Deserialize, Serialize};
/// This object describes the position on faces where a mask should be placed by
/// default.
///
/// [The official docs](https://core.telegram.org/bots/api#maskposition).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MaskPosition {
/// The part of the face relative to which the mask should be placed. One
/// of `forehead`, `eyes`, `mouth`, or `chin`.
pub point: String,
/// Shift by X-axis measured in widths of the mask scaled to the face size,
/// from left to right. For example, choosing `-1.0` will place mask just
/// to the left of the default mask position.
pub x_shift: f64,
/// Shift by Y-axis measured in heights of the mask scaled to the face
/// size, from top to bottom. For example, `1.0` will place the mask just
/// below the default mask position.
pub y_shift: f64,
/// Mask scaling coefficient. For example, `2.0` means double size.
pub scale: f64,
}
impl MaskPosition {
pub fn new<S>(point: S, x_shift: f64, y_shift: f64, scale: f64) -> Self
where
S: Into<String>,
{
Self { point: point.into(), x_shift, y_shift, scale }
}
pub fn point<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.point = val.into();
self
}
pub fn x_shift(mut self, val: f64) -> Self {
self.x_shift = val;
self
}
pub fn y_shift(mut self, val: f64) -> Self {
self.y_shift = val;
self
}
pub fn scale(mut self, val: f64) -> Self {
self.scale = val;
self
}
}
| {
"pile_set_name": "Github"
} |
--TEST--
Statics in nested functions & evals.
--FILE--
<?php
static $a = array(7,8,9);
function f1() {
static $a = array(1,2,3);
function g1() {
static $a = array(4,5,6);
var_dump($a);
}
var_dump($a);
}
f1();
g1();
var_dump($a);
eval(' static $b = array(10,11,12); ');
function f2() {
eval(' static $b = array(1,2,3); ');
function g2a() {
eval(' static $b = array(4,5,6); ');
var_dump($b);
}
eval('function g2b() { static $b = array(7, 8, 9); var_dump($b); } ');
var_dump($b);
}
f2();
g2a();
g2b();
var_dump($b);
eval(' function f3() { static $c = array(1,2,3); var_dump($c); }');
f3();
?>
--EXPECT--
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(4)
[1]=>
int(5)
[2]=>
int(6)
}
array(3) {
[0]=>
int(7)
[1]=>
int(8)
[2]=>
int(9)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(4)
[1]=>
int(5)
[2]=>
int(6)
}
array(3) {
[0]=>
int(7)
[1]=>
int(8)
[2]=>
int(9)
}
array(3) {
[0]=>
int(10)
[1]=>
int(11)
[2]=>
int(12)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
| {
"pile_set_name": "Github"
} |
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
| {
"pile_set_name": "Github"
} |
#include <precomp.h>
#include <stdlib.h>
#include <string.h>
extern char*_acmdln;
extern wchar_t* _wcmdln;
#undef _pgmptr
extern char*_pgmptr;
#undef _wpgmptr
extern wchar_t*_wpgmptr;
#undef _environ
extern char**_environ;
#undef __argv
#undef __argc
char**__argv = NULL;
#undef __wargv
wchar_t**__wargv = NULL;
int __argc = 0;
extern wchar_t **__winitenv;
char* strndup(char const* name, size_t len)
{
char *s = malloc(len + 1);
if (s != NULL)
{
memcpy(s, name, len);
s[len] = 0;
}
return s;
}
wchar_t* wcsndup(wchar_t* name, size_t len)
{
wchar_t *s = malloc((len + 1) * sizeof(wchar_t));
if (s != NULL)
{
memcpy(s, name, len*sizeof(wchar_t));
s[len] = 0;
}
return s;
}
#define SIZE (4096 / sizeof(char*))
int wadd(wchar_t* name)
{
wchar_t** _new;
if ((__argc % SIZE) == 0)
{
if (__wargv == NULL)
_new = malloc(sizeof(wchar_t*) * (1 + SIZE));
else
_new = realloc(__wargv, sizeof(wchar_t*) * (__argc + 1 + SIZE));
if (_new == NULL)
return -1;
__wargv = _new;
}
__wargv[__argc++] = name;
__wargv[__argc] = NULL;
return 0;
}
int wexpand(wchar_t* name, int expand_wildcards)
{
wchar_t* s;
WIN32_FIND_DATAW fd;
HANDLE hFile;
BOOLEAN first = TRUE;
wchar_t buffer[256];
uintptr_t pos;
if (expand_wildcards && (s = wcspbrk(name, L"*?")))
{
hFile = FindFirstFileW(name, &fd);
if (hFile != INVALID_HANDLE_VALUE)
{
while(s != name && *s != L'/' && *s != L'\\')
s--;
pos = s - name;
if (*s == L'/' || *s == L'\\')
pos++;
wcsncpy(buffer, name, pos);
do
{
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
wcscpy(&buffer[pos], fd.cFileName);
if (wadd(_wcsdup(buffer)) < 0)
{
FindClose(hFile);
return -1;
}
first = FALSE;
}
}
while(FindNextFileW(hFile, &fd));
FindClose(hFile);
}
}
if (first)
{
if (wadd(name) < 0)
return -1;
}
else
free(name);
return 0;
}
int aadd(char* name)
{
char** _new;
if ((__argc % SIZE) == 0)
{
if (__argv == NULL)
_new = malloc(sizeof(char*) * (1 + SIZE));
else
_new = realloc(__argv, sizeof(char*) * (__argc + 1 + SIZE));
if (_new == NULL)
return -1;
__argv = _new;
}
__argv[__argc++] = name;
__argv[__argc] = NULL;
return 0;
}
int aexpand(char* name, int expand_wildcards)
{
char* s;
WIN32_FIND_DATAA fd;
HANDLE hFile;
BOOLEAN first = TRUE;
char buffer[256];
uintptr_t pos;
if (expand_wildcards && (s = strpbrk(name, "*?")))
{
hFile = FindFirstFileA(name, &fd);
if (hFile != INVALID_HANDLE_VALUE)
{
while(s != name && *s != '/' && *s != '\\')
s--;
pos = s - name;
if (*s == '/' || *s == '\\')
pos++;
strncpy(buffer, name, pos);
do
{
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
strcpy(&buffer[pos], fd.cFileName);
if (aadd(_strdup(buffer)) < 0)
{
FindClose(hFile);
return -1;
}
first = FALSE;
}
}
while(FindNextFileA(hFile, &fd));
FindClose(hFile);
}
}
if (first)
{
if (aadd(name) < 0)
return -1;
}
else
free(name);
return 0;
}
/*
* @implemented
*/
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, afterlastspace, ignorespace, doexpand;
size_t len;
char* aNewCmdln;
/* missing threading init */
i = 0;
afterlastspace = 0;
ignorespace = 0;
doexpand = expand_wildcards;
if (__argv && _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
/* Allocate a temporary buffer to be used instead of the original _acmdln parameter. */
aNewCmdln = strndup(_acmdln, len);
while (aNewCmdln[i])
{
if (aNewCmdln[i] == '"')
{
if(ignorespace)
{
ignorespace = 0;
}
else
{
ignorespace = 1;
doexpand = 0;
}
memmove(aNewCmdln + i, aNewCmdln + i + 1, len - i);
len--;
continue;
}
if (aNewCmdln[i] == ' ' && !ignorespace)
{
aexpand(strndup(aNewCmdln + afterlastspace, i - afterlastspace), doexpand);
i++;
while (aNewCmdln[i] == ' ')
i++;
afterlastspace=i;
doexpand = expand_wildcards;
}
else
{
i++;
}
}
if (aNewCmdln[afterlastspace] != 0)
{
aexpand(strndup(aNewCmdln + afterlastspace, i - afterlastspace), doexpand);
}
/* Free the temporary buffer. */
free(aNewCmdln);
HeapValidate(GetProcessHeap(), 0, NULL);
*argc = __argc;
if (__argv == NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = _strdup(__argv[0]);
// if (new_mode) _set_new_mode(*new_mode);
}
/*
* @implemented
*/
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, afterlastspace, ignorespace, doexpand;
size_t len;
wchar_t* wNewCmdln;
/* missing threading init */
i = 0;
afterlastspace = 0;
ignorespace = 0;
doexpand = expand_wildcards;
if (__wargv && __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
/* Allocate a temporary buffer to be used instead of the original _wcmdln parameter. */
wNewCmdln = wcsndup(_wcmdln, len);
while (wNewCmdln[i])
{
if (wNewCmdln[i] == L'"')
{
if(ignorespace)
{
ignorespace = 0;
}
else
{
ignorespace = 1;
doexpand = 0;
}
memmove(wNewCmdln + i, wNewCmdln + i + 1, (len - i) * sizeof(wchar_t));
len--;
continue;
}
if (wNewCmdln[i] == L' ' && !ignorespace)
{
wexpand(wcsndup(wNewCmdln + afterlastspace, i - afterlastspace), doexpand);
i++;
while (wNewCmdln[i] == L' ')
i++;
afterlastspace=i;
doexpand = expand_wildcards;
}
else
{
i++;
}
}
if (wNewCmdln[afterlastspace] != 0)
{
wexpand(wcsndup(wNewCmdln + afterlastspace, i - afterlastspace), doexpand);
}
/* Free the temporary buffer. */
free(wNewCmdln);
HeapValidate(GetProcessHeap(), 0, NULL);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = _wcsdup(__wargv[0]);
// if (new_mode) _set_new_mode(*new_mode);
}
/*
* @implemented
*/
int* __p___argc(void)
{
return &__argc;
}
/*
* @implemented
*/
char*** __p___argv(void)
{
return &__argv;
}
/*
* @implemented
*/
wchar_t*** __p___wargv(void)
{
return &__wargv;
}
| {
"pile_set_name": "Github"
} |
using System;
using System.ComponentModel;
using Newtonsoft.Json;
namespace Umbraco.Web.PublishedCache.NuCache.DataSource
{
internal class PropertyData
{
private string _culture;
private string _segment;
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, PropertyName = "c")]
public string Culture
{
get => _culture;
set => _culture = value ?? throw new ArgumentNullException(nameof(value)); // TODO: or fallback to string.Empty? CANNOT be null
}
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, PropertyName = "s")]
public string Segment
{
get => _segment;
set => _segment = value ?? throw new ArgumentNullException(nameof(value)); // TODO: or fallback to string.Empty? CANNOT be null
}
[JsonProperty("v")]
public object Value { get; set; }
//Legacy properties used to deserialize existing nucache db entries
[JsonProperty("culture")]
private string LegacyCulture
{
set => Culture = value;
}
[JsonProperty("seg")]
private string LegacySegment
{
set => Segment = value;
}
[JsonProperty("val")]
private object LegacyValue
{
set => Value = value;
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2000-2013 The Exult Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef UCSCHED_H
#define UCSCHED_H
#include <memory>
#include "databuf.h"
#include "tqueue.h"
#include "tiles.h"
class Game_object;
class Usecode_value;
class Usecode_internal;
using Game_object_weak = std::weak_ptr<Game_object>;
/*
* A class for executing usecode at a scheduled time:
*/
class Usecode_script : public Time_sensitive {
static int count; // Total # of these around.
static Usecode_script *first;// ->chain of all of them.
Usecode_script *next, *prev; // Next/prev. in global chain.
Game_object_weak obj; // From objval.
Usecode_value *code; // Array of code to execute.
int cnt; // Length of arrval.
int i; // Current index.
int frame_index; // For taking steps.
bool started; // Whether or not this script has started.
bool no_halt; // 1 to ignore halt().
bool must_finish; // 1 to finish before deleting.
bool killed_barks; // 1 to prevent barks from showing.
int delay; // Used for restoring.
// For restore:
Usecode_script(Game_object *item, Usecode_value *cd, int findex,
int nhalt, int del);
public:
Usecode_script(Game_object *o, Usecode_value *cd = nullptr);
~Usecode_script() override;
void start(long delay = 1); // Start after 'delay' msecs.
long get_delay() const {
return delay;
}
void halt(); // Stop executing.
bool is_no_halt() const { // Is the 'no_halt' flag set?
return no_halt;
}
bool is_activated() const { // Started already?
return i > 0;
}
void add(int v1); // Append new instructions:
void add(int v1, int v2);
void add(int v1, std::string str);
void add(int *vals, int cnt);
Usecode_script &operator<<(int v) {
add(v);
return *this;
}
inline void activate_egg(Usecode_internal *usecode, Game_object *e);
static int get_count() {
return count;
}
int get_length() {
return cnt;
}
// Find for given item.
static Usecode_script *find(const Game_object *srch,
Usecode_script *last_found = nullptr);
static Usecode_script *find_active(const Game_object *srch,
Usecode_script *last_found = nullptr);
static void terminate(const Game_object *obj);
static void clear(); // Delete all.
// Remove all whose objs. are too far.
static void purge(Tile_coord const &spot, int dist);
void handle_event(unsigned long curtime, uintptr udata) override;
int exec(Usecode_internal *usecode, bool finish);
// Move object in given direction.
void step(Usecode_internal *usecode, int dir, int dz);
// Save/restore.
int save(ODataSource *out) const;
static Usecode_script *restore(Game_object *item, IDataSource *in);
void print(std::ostream &out) const; // Print values.
void kill_barks() {
killed_barks = true;
}
};
#endif
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 1997-2001 Id Software, Inc.
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.
*/
// m_flash.c
#include "shared/shared.h"
// this file is included in both the game dll and quake2 },
// the game needs it to source shot locations, the client
// needs it to position muzzle flashes
const vec3_t monster_flash_offset[256] = {
// flash 0 is not used
{ 0.0, 0.0, 0.0 },
// MZ2_TANK_BLASTER_1 1
{ 20.7, -18.5, 28.7 },
// MZ2_TANK_BLASTER_2 2
{ 16.6, -21.5, 30.1 },
// MZ2_TANK_BLASTER_3 3
{ 11.8, -23.9, 32.1 },
// MZ2_TANK_MACHINEGUN_1 4
{ 22.9, -0.7, 25.3 },
// MZ2_TANK_MACHINEGUN_2 5
{ 22.2, 6.2, 22.3 },
// MZ2_TANK_MACHINEGUN_3 6
{ 19.4, 13.1, 18.6 },
// MZ2_TANK_MACHINEGUN_4 7
{ 19.4, 18.8, 18.6 },
// MZ2_TANK_MACHINEGUN_5 8
{ 17.9, 25.0, 18.6 },
// MZ2_TANK_MACHINEGUN_6 9
{ 14.1, 30.5, 20.6 },
// MZ2_TANK_MACHINEGUN_7 10
{ 9.3, 35.3, 22.1 },
// MZ2_TANK_MACHINEGUN_8 11
{ 4.7, 38.4, 22.1 },
// MZ2_TANK_MACHINEGUN_9 12
{ -1.1, 40.4, 24.1 },
// MZ2_TANK_MACHINEGUN_10 13
{ -6.5, 41.2, 24.1 },
// MZ2_TANK_MACHINEGUN_11 14
{ 3.2, 40.1, 24.7 },
// MZ2_TANK_MACHINEGUN_12 15
{ 11.7, 36.7, 26.0 },
// MZ2_TANK_MACHINEGUN_13 16
{ 18.9, 31.3, 26.0 },
// MZ2_TANK_MACHINEGUN_14 17
{ 24.4, 24.4, 26.4 },
// MZ2_TANK_MACHINEGUN_15 18
{ 27.1, 17.1, 27.2 },
// MZ2_TANK_MACHINEGUN_16 19
{ 28.5, 9.1, 28.0 },
// MZ2_TANK_MACHINEGUN_17 20
{ 27.1, 2.2, 28.0 },
// MZ2_TANK_MACHINEGUN_18 21
{ 24.9, -2.8, 28.0 },
// MZ2_TANK_MACHINEGUN_19 22
{ 21.6, -7.0, 26.4 },
// MZ2_TANK_ROCKET_1 23
{ 6.2, 29.1, 49.1 },
// MZ2_TANK_ROCKET_2 24
{ 6.9, 23.8, 49.1 },
// MZ2_TANK_ROCKET_3 25
{ 8.3, 17.8, 49.5 },
// MZ2_INFANTRY_MACHINEGUN_1 26
{ 26.6, 7.1, 13.1 },
// MZ2_INFANTRY_MACHINEGUN_2 27
{ 18.2, 7.5, 15.4 },
// MZ2_INFANTRY_MACHINEGUN_3 28
{ 17.2, 10.3, 17.9 },
// MZ2_INFANTRY_MACHINEGUN_4 29
{ 17.0, 12.8, 20.1 },
// MZ2_INFANTRY_MACHINEGUN_5 30
{ 15.1, 14.1, 21.8 },
// MZ2_INFANTRY_MACHINEGUN_6 31
{ 11.8, 17.2, 23.1 },
// MZ2_INFANTRY_MACHINEGUN_7 32
{ 11.4, 20.2, 21.0 },
// MZ2_INFANTRY_MACHINEGUN_8 33
{ 9.0, 23.0, 18.9 },
// MZ2_INFANTRY_MACHINEGUN_9 34
{ 13.9, 18.6, 17.7 },
// MZ2_INFANTRY_MACHINEGUN_10 35
{ 15.4, 15.6, 15.8 },
// MZ2_INFANTRY_MACHINEGUN_11 36
{ 10.2, 15.2, 25.1 },
// MZ2_INFANTRY_MACHINEGUN_12 37
{ -1.9, 15.1, 28.2 },
// MZ2_INFANTRY_MACHINEGUN_13 38
{ -12.4, 13.0, 20.2 },
// MZ2_SOLDIER_BLASTER_1 39
{ 10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2 },
// MZ2_SOLDIER_BLASTER_2 40
{ 21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_1 41
{ 10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_2 42
{ 21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_1 43
{ 10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_2 44
{ 21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2 },
// MZ2_GUNNER_MACHINEGUN_1 45
{ 30.1 * 1.15, 3.9 * 1.15, 19.6 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_2 46
{ 29.1 * 1.15, 2.5 * 1.15, 20.7 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_3 47
{ 28.2 * 1.15, 2.5 * 1.15, 22.2 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_4 48
{ 28.2 * 1.15, 3.6 * 1.15, 22.0 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_5 49
{ 26.9 * 1.15, 2.0 * 1.15, 23.4 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_6 50
{ 26.5 * 1.15, 0.6 * 1.15, 20.8 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_7 51
{ 26.9 * 1.15, 0.5 * 1.15, 21.5 * 1.15 },
// MZ2_GUNNER_MACHINEGUN_8 52
{ 29.0 * 1.15, 2.4 * 1.15, 19.5 * 1.15 },
// MZ2_GUNNER_GRENADE_1 53
{ 4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15 },
// MZ2_GUNNER_GRENADE_2 54
{ 4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15 },
// MZ2_GUNNER_GRENADE_3 55
{ 4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15 },
// MZ2_GUNNER_GRENADE_4 56
{ 4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15 },
// MZ2_CHICK_ROCKET_1 57
// { -24.8, -9.0, 39.0 },
{ 24.8, -9.0, 39.0 }, // PGM - this was incorrect in Q2
// MZ2_FLYER_BLASTER_1 58
{ 12.1, 13.4, -14.5 },
// MZ2_FLYER_BLASTER_2 59
{ 12.1, -7.4, -14.5 },
// MZ2_MEDIC_BLASTER_1 60
{ 12.1, 5.4, 16.5 },
// MZ2_GLADIATOR_RAILGUN_1 61
{ 30.0, 18.0, 28.0 },
// MZ2_HOVER_BLASTER_1 62
{ 32.5, -0.8, 10.0 },
// MZ2_ACTOR_MACHINEGUN_1 63
{ 18.4, 7.4, 9.6 },
// MZ2_SUPERTANK_MACHINEGUN_1 64
{ 30.0, 30.0, 88.5 },
// MZ2_SUPERTANK_MACHINEGUN_2 65
{ 30.0, 30.0, 88.5 },
// MZ2_SUPERTANK_MACHINEGUN_3 66
{ 30.0, 30.0, 88.5 },
// MZ2_SUPERTANK_MACHINEGUN_4 67
{ 30.0, 30.0, 88.5 },
// MZ2_SUPERTANK_MACHINEGUN_5 68
{ 30.0, 30.0, 88.5 },
// MZ2_SUPERTANK_MACHINEGUN_6 69
{ 30.0, 30.0, 88.5 },
// MZ2_SUPERTANK_ROCKET_1 70
{ 16.0, -22.5, 91.2 },
// MZ2_SUPERTANK_ROCKET_2 71
{ 16.0, -33.4, 86.7 },
// MZ2_SUPERTANK_ROCKET_3 72
{ 16.0, -42.8, 83.3 },
// --- Start Xian Stuff ---
// MZ2_BOSS2_MACHINEGUN_L1 73
{ 32, -40, 70 },
// MZ2_BOSS2_MACHINEGUN_L2 74
{ 32, -40, 70 },
// MZ2_BOSS2_MACHINEGUN_L3 75
{ 32, -40, 70 },
// MZ2_BOSS2_MACHINEGUN_L4 76
{ 32, -40, 70 },
// MZ2_BOSS2_MACHINEGUN_L5 77
{ 32, -40, 70 },
// --- End Xian Stuff
// MZ2_BOSS2_ROCKET_1 78
{ 22.0, 16.0, 10.0 },
// MZ2_BOSS2_ROCKET_2 79
{ 22.0, 8.0, 10.0 },
// MZ2_BOSS2_ROCKET_3 80
{ 22.0, -8.0, 10.0 },
// MZ2_BOSS2_ROCKET_4 81
{ 22.0, -16.0, 10.0 },
// MZ2_FLOAT_BLASTER_1 82
{ 32.5, -0.8, 10 },
// MZ2_SOLDIER_BLASTER_3 83
{ 20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_3 84
{ 20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_3 85
{ 20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2 },
// MZ2_SOLDIER_BLASTER_4 86
{ 7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_4 87
{ 7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_4 88
{ 7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2 },
// MZ2_SOLDIER_BLASTER_5 89
{ 30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_5 90
{ 30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_5 91
{ 30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2 },
// MZ2_SOLDIER_BLASTER_6 92
{ 27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_6 93
{ 27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_6 94
{ 27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2 },
// MZ2_SOLDIER_BLASTER_7 95
{ 28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_7 96
{ 28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_7 97
{ 28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2 },
// MZ2_SOLDIER_BLASTER_8 98
// 34.5 * 1.2, 9.6 * 1.2, 6.1 * 1.2 },
{ 31.5 * 1.2, 9.6 * 1.2, 10.1 * 1.2 },
// MZ2_SOLDIER_SHOTGUN_8 99
{ 34.5 * 1.2, 9.6 * 1.2, 6.1 * 1.2 },
// MZ2_SOLDIER_MACHINEGUN_8 100
{ 34.5 * 1.2, 9.6 * 1.2, 6.1 * 1.2 },
// --- Xian shit below ---
// MZ2_MAKRON_BFG 101
{ 17, -19.5, 62.9 },
// MZ2_MAKRON_BLASTER_1 102
{ -3.6, -24.1, 59.5 },
// MZ2_MAKRON_BLASTER_2 103
{ -1.6, -19.3, 59.5 },
// MZ2_MAKRON_BLASTER_3 104
{ -0.1, -14.4, 59.5 },
// MZ2_MAKRON_BLASTER_4 105
{ 2.0, -7.6, 59.5 },
// MZ2_MAKRON_BLASTER_5 106
{ 3.4, 1.3, 59.5 },
// MZ2_MAKRON_BLASTER_6 107
{ 3.7, 11.1, 59.5 },
// MZ2_MAKRON_BLASTER_7 108
{ -0.3, 22.3, 59.5 },
// MZ2_MAKRON_BLASTER_8 109
{ -6, 33, 59.5 },
// MZ2_MAKRON_BLASTER_9 110
{ -9.3, 36.4, 59.5 },
// MZ2_MAKRON_BLASTER_10 111
{ -7, 35, 59.5 },
// MZ2_MAKRON_BLASTER_11 112
{ -2.1, 29, 59.5 },
// MZ2_MAKRON_BLASTER_12 113
{ 3.9, 17.3, 59.5 },
// MZ2_MAKRON_BLASTER_13 114
{ 6.1, 5.8, 59.5 },
// MZ2_MAKRON_BLASTER_14 115
{ 5.9, -4.4, 59.5 },
// MZ2_MAKRON_BLASTER_15 116
{ 4.2, -14.1, 59.5 },
// MZ2_MAKRON_BLASTER_16 117
{ 2.4, -18.8, 59.5 },
// MZ2_MAKRON_BLASTER_17 118
{ -1.8, -25.5, 59.5 },
// MZ2_MAKRON_RAILGUN_1 119
{ -17.3, 7.8, 72.4 },
// MZ2_JORG_MACHINEGUN_L1 120
{ 78.5, -47.1, 96 },
// MZ2_JORG_MACHINEGUN_L2 121
{ 78.5, -47.1, 96 },
// MZ2_JORG_MACHINEGUN_L3 122
{ 78.5, -47.1, 96 },
// MZ2_JORG_MACHINEGUN_L4 123
{ 78.5, -47.1, 96 },
// MZ2_JORG_MACHINEGUN_L5 124
{ 78.5, -47.1, 96 },
// MZ2_JORG_MACHINEGUN_L6 125
{ 78.5, -47.1, 96 },
// MZ2_JORG_MACHINEGUN_R1 126
{ 78.5, 46.7, 96 },
// MZ2_JORG_MACHINEGUN_R2 127
{ 78.5, 46.7, 96 },
// MZ2_JORG_MACHINEGUN_R3 128
{ 78.5, 46.7, 96 },
// MZ2_JORG_MACHINEGUN_R4 129
{ 78.5, 46.7, 96 },
// MZ2_JORG_MACHINEGUN_R5 130
{ 78.5, 46.7, 96 },
// MZ2_JORG_MACHINEGUN_R6 131
{ 78.5, 46.7, 96 },
// MZ2_JORG_BFG_1 132
{ 6.3, -9, 111.2 },
// MZ2_BOSS2_MACHINEGUN_R1 73
{ 32, 40, 70 },
// MZ2_BOSS2_MACHINEGUN_R2 74
{ 32, 40, 70 },
// MZ2_BOSS2_MACHINEGUN_R3 75
{ 32, 40, 70 },
// MZ2_BOSS2_MACHINEGUN_R4 76
{ 32, 40, 70 },
// MZ2_BOSS2_MACHINEGUN_R5 77
{ 32, 40, 70 },
// --- End Xian Shit ---
// ROGUE
// note that the above really ends at 137
// carrier machineguns
// MZ2_CARRIER_MACHINEGUN_L1
{ 56, -32, 32 },
// MZ2_CARRIER_MACHINEGUN_R1
{ 56, 32, 32 },
// MZ2_CARRIER_GRENADE
{ 42, 24, 50 },
// MZ2_TURRET_MACHINEGUN 141
{ 16, 0, 0 },
// MZ2_TURRET_ROCKET 142
{ 16, 0, 0 },
// MZ2_TURRET_BLASTER 143
{ 16, 0, 0 },
// MZ2_STALKER_BLASTER 144
{ 24, 0, 6 },
// MZ2_DAEDALUS_BLASTER 145
{ 32.5, -0.8, 10.0 },
// MZ2_MEDIC_BLASTER_2 146
{ 12.1, 5.4, 16.5 },
// MZ2_CARRIER_RAILGUN 147
{ 32, 0, 6 },
// MZ2_WIDOW_DISRUPTOR 148
{ 57.72, 14.50, 88.81 },
// MZ2_WIDOW_BLASTER 149
{ 56, 32, 32 },
// MZ2_WIDOW_RAIL 150
{ 62, -20, 84 },
// MZ2_WIDOW_PLASMABEAM 151 // PMM - not used!
{ 32, 0, 6 },
// MZ2_CARRIER_MACHINEGUN_L2 152
{ 61, -32, 12 },
// MZ2_CARRIER_MACHINEGUN_R2 153
{ 61, 32, 12 },
// MZ2_WIDOW_RAIL_LEFT 154
{ 17, -62, 91 },
// MZ2_WIDOW_RAIL_RIGHT 155
{ 68, 12, 86 },
// MZ2_WIDOW_BLASTER_SWEEP1 156 pmm - the sweeps need to be in sequential order
{ 47.5, 56, 89 },
// MZ2_WIDOW_BLASTER_SWEEP2 157
{ 54, 52, 91 },
// MZ2_WIDOW_BLASTER_SWEEP3 158
{ 58, 40, 91 },
// MZ2_WIDOW_BLASTER_SWEEP4 159
{ 68, 30, 88 },
// MZ2_WIDOW_BLASTER_SWEEP5 160
{ 74, 20, 88 },
// MZ2_WIDOW_BLASTER_SWEEP6 161
{ 73, 11, 87 },
// MZ2_WIDOW_BLASTER_SWEEP7 162
{ 73, 3, 87 },
// MZ2_WIDOW_BLASTER_SWEEP8 163
{ 70, -12, 87 },
// MZ2_WIDOW_BLASTER_SWEEP9 164
{ 67, -20, 90 },
// MZ2_WIDOW_BLASTER_100 165
{ -20, 76, 90 },
// MZ2_WIDOW_BLASTER_90 166
{ -8, 74, 90 },
// MZ2_WIDOW_BLASTER_80 167
{ 0, 72, 90 },
// MZ2_WIDOW_BLASTER_70 168 d06
{ 10, 71, 89 },
// MZ2_WIDOW_BLASTER_60 169 d07
{ 23, 70, 87 },
// MZ2_WIDOW_BLASTER_50 170 d08
{ 32, 64, 85 },
// MZ2_WIDOW_BLASTER_40 171
{ 40, 58, 84 },
// MZ2_WIDOW_BLASTER_30 172 d10
{ 48, 50, 83 },
// MZ2_WIDOW_BLASTER_20 173
{ 54, 42, 82 },
// MZ2_WIDOW_BLASTER_10 174 d12
{ 56, 34, 82 },
// MZ2_WIDOW_BLASTER_0 175
{ 58, 26, 82 },
// MZ2_WIDOW_BLASTER_10L 176 d14
{ 60, 16, 82 },
// MZ2_WIDOW_BLASTER_20L 177
{ 59, 6, 81 },
// MZ2_WIDOW_BLASTER_30L 178 d16
{ 58, -2, 80 },
// MZ2_WIDOW_BLASTER_40L 179
{ 57, -10, 79 },
// MZ2_WIDOW_BLASTER_50L 180 d18
{ 54, -18, 78 },
// MZ2_WIDOW_BLASTER_60L 181
{ 42, -32, 80 },
// MZ2_WIDOW_BLASTER_70L 182 d20
{ 36, -40, 78 },
// MZ2_WIDOW_RUN_1 183
{ 68.4, 10.88, 82.08 },
// MZ2_WIDOW_RUN_2 184
{ 68.51, 8.64, 85.14 },
// MZ2_WIDOW_RUN_3 185
{ 68.66, 6.38, 88.78 },
// MZ2_WIDOW_RUN_4 186
{ 68.73, 5.1, 84.47 },
// MZ2_WIDOW_RUN_5 187
{ 68.82, 4.79, 80.52 },
// MZ2_WIDOW_RUN_6 188
{ 68.77, 6.11, 85.37 },
// MZ2_WIDOW_RUN_7 189
{ 68.67, 7.99, 90.24 },
// MZ2_WIDOW_RUN_8 190
{ 68.55, 9.54, 87.36 },
// MZ2_CARRIER_ROCKET_1 191
{ 0, 0, -5 },
// MZ2_CARRIER_ROCKET_2 192
{ 0, 0, -5 },
// MZ2_CARRIER_ROCKET_3 193
{ 0, 0, -5 },
// MZ2_CARRIER_ROCKET_4 194
{ 0, 0, -5 },
// MZ2_WIDOW2_BEAMER_1 195
// 72.13, -17.63, 93.77 },
{ 69.00, -17.63, 93.77 },
// MZ2_WIDOW2_BEAMER_2 196
// 71.46, -17.08, 89.82 },
{ 69.00, -17.08, 89.82 },
// MZ2_WIDOW2_BEAMER_3 197
// 71.47, -18.40, 90.70 },
{ 69.00, -18.40, 90.70 },
// MZ2_WIDOW2_BEAMER_4 198
// 71.96, -18.34, 94.32 },
{ 69.00, -18.34, 94.32 },
// MZ2_WIDOW2_BEAMER_5 199
// 72.25, -18.30, 97.98 },
{ 69.00, -18.30, 97.98 },
// MZ2_WIDOW2_BEAM_SWEEP_1 200
{ 45.04, -59.02, 92.24 },
// MZ2_WIDOW2_BEAM_SWEEP_2 201
{ 50.68, -54.70, 91.96 },
// MZ2_WIDOW2_BEAM_SWEEP_3 202
{ 56.57, -47.72, 91.65 },
// MZ2_WIDOW2_BEAM_SWEEP_4 203
{ 61.75, -38.75, 91.38 },
// MZ2_WIDOW2_BEAM_SWEEP_5 204
{ 65.55, -28.76, 91.24 },
// MZ2_WIDOW2_BEAM_SWEEP_6 205
{ 67.79, -18.90, 91.22 },
// MZ2_WIDOW2_BEAM_SWEEP_7 206
{ 68.60, -9.52, 91.23 },
// MZ2_WIDOW2_BEAM_SWEEP_8 207
{ 68.08, 0.18, 91.32 },
// MZ2_WIDOW2_BEAM_SWEEP_9 208
{ 66.14, 9.79, 91.44 },
// MZ2_WIDOW2_BEAM_SWEEP_10 209
{ 62.77, 18.91, 91.65 },
// MZ2_WIDOW2_BEAM_SWEEP_11 210
{ 58.29, 27.11, 92.00 },
// end of table
{ 0.0, 0.0, 0.0 }
};
| {
"pile_set_name": "Github"
} |
@summary {
Crosshair line weight
}
| {
"pile_set_name": "Github"
} |
package edu.stanford.bmir.protege.web.client.hierarchy;
import com.google.auto.factory.AutoFactory;
import com.google.auto.factory.Provided;
import com.google.common.collect.ImmutableSet;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.user.client.Window;
import edu.stanford.bmir.protege.web.client.Messages;
import edu.stanford.bmir.protege.web.client.action.UIAction;
import edu.stanford.bmir.protege.web.client.bulkop.EditAnnotationsUiAction;
import edu.stanford.bmir.protege.web.client.bulkop.MoveToParentUiAction;
import edu.stanford.bmir.protege.web.client.bulkop.SetAnnotationValueUiAction;
import edu.stanford.bmir.protege.web.client.entity.MergeEntitiesUiAction;
import edu.stanford.bmir.protege.web.client.library.msgbox.InputBox;
import edu.stanford.bmir.protege.web.client.library.popupmenu.PopupMenu;
import edu.stanford.bmir.protege.web.client.permissions.LoggedInUserProjectPermissionChecker;
import edu.stanford.bmir.protege.web.client.tag.EditEntityTagsUiAction;
import edu.stanford.bmir.protege.web.client.watches.WatchUiAction;
import edu.stanford.bmir.protege.web.shared.entity.EntityNode;
import edu.stanford.bmir.protege.web.shared.entity.OWLEntityData;
import edu.stanford.protege.gwt.graphtree.client.TreeWidget;
import edu.stanford.protege.gwt.graphtree.shared.tree.TreeNode;
import edu.stanford.protege.gwt.graphtree.shared.tree.impl.GraphTreeNodeModel;
import org.semanticweb.owlapi.model.OWLEntity;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;
import java.util.function.Supplier;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static edu.stanford.bmir.protege.web.shared.access.BuiltInAction.*;
import static edu.stanford.protege.gwt.graphtree.shared.tree.RevealMode.REVEAL_FIRST;
/**
* Matthew Horridge Stanford Center for Biomedical Informatics Research 3 Dec 2017
*/
@AutoFactory
public class EntityHierarchyContextMenuPresenter {
@Nonnull
private final EditAnnotationsUiAction editAnnotationsUiAction;
@Nonnull
private final Messages messages;
@Nonnull
private final TreeWidget<EntityNode, OWLEntity> treeWidget;
@Nonnull
private final EntityHierarchyModel model;
@Nonnull
private final UIAction createEntityAction;
@Nonnull
private final UIAction deleteEntityAction;
@Nonnull
private final SetAnnotationValueUiAction setAnnotationValueUiAction;
@Nonnull
private final MoveToParentUiAction moveToParentUiAction;
@Nonnull
private final MergeEntitiesUiAction mergeEntitiesAction;
@Nonnull
private final EditEntityTagsUiAction editEntityTagsAction;
@Nonnull
private final WatchUiAction watchUiAction;
@Nonnull
private final LoggedInUserProjectPermissionChecker permissionChecker;
@Nullable
private PopupMenu contextMenu;
private UIAction pruneBranchToRootAction;
private UIAction pruneAllBranchesToRootAction;
private UIAction clearPruningAction;
private UIAction showIriAction;
private UIAction showDirectLinkAction;
private final InputBox inputBox;
public EntityHierarchyContextMenuPresenter(@Nonnull EntityHierarchyModel model,
@Nonnull TreeWidget<EntityNode, OWLEntity> treeWidget,
@Nonnull UIAction createEntityAction,
@Nonnull UIAction deleteEntityAction,
@Provided @Nonnull SetAnnotationValueUiAction setAnnotationValueUiAction,
@Provided @Nonnull MoveToParentUiAction moveToParentUiAction, @Provided @Nonnull MergeEntitiesUiAction mergeEntitiesAction,
@Provided @Nonnull EditAnnotationsUiAction editAnnotationsUiAction,
@Provided @Nonnull EditEntityTagsUiAction editEntityTagsAction,
@Provided Messages messages,
@Provided @Nonnull WatchUiAction watchUiAction,
@Provided @Nonnull LoggedInUserProjectPermissionChecker permissionChecker,
@Provided @Nonnull InputBox inputBox) {
this.setAnnotationValueUiAction = checkNotNull(setAnnotationValueUiAction);
this.moveToParentUiAction = checkNotNull(moveToParentUiAction);
this.editAnnotationsUiAction = checkNotNull(editAnnotationsUiAction);
this.messages = checkNotNull(messages);
this.treeWidget = checkNotNull(treeWidget);
this.model = checkNotNull(model);
this.createEntityAction = checkNotNull(createEntityAction);
this.deleteEntityAction = checkNotNull(deleteEntityAction);
this.mergeEntitiesAction = checkNotNull(mergeEntitiesAction);
this.editEntityTagsAction = checkNotNull(editEntityTagsAction);
this.watchUiAction = checkNotNull(watchUiAction);
this.permissionChecker = checkNotNull(permissionChecker);
this.inputBox = checkNotNull(inputBox);
}
/**
* Install the context menu on its tree
*/
public void install() {
treeWidget.addContextMenuHandler(this::showContextMenu);
}
private void showContextMenu(ContextMenuEvent event) {
if (contextMenu == null) {
createContextMenu();
}
updateActionStates();
int x = event.getNativeEvent().getClientX();
int y = event.getNativeEvent().getClientY();
contextMenu.show(x, y);
}
private void createContextMenu() {
contextMenu = new PopupMenu();
contextMenu.addItem(createEntityAction);
contextMenu.addItem(deleteEntityAction);
contextMenu.addSeparator();
contextMenu.addItem(editEntityTagsAction);
contextMenu.addSeparator();
contextMenu.addItem(moveToParentUiAction);
contextMenu.addItem(mergeEntitiesAction);
contextMenu.addItem(setAnnotationValueUiAction);
contextMenu.addItem(editAnnotationsUiAction);
contextMenu.addSeparator();
contextMenu.addItem(watchUiAction);
contextMenu.addSeparator();
pruneBranchToRootAction = contextMenu.addItem(messages.tree_pruneBranchToRoot(), this::pruneSelectedNodesToRoot);
pruneAllBranchesToRootAction = contextMenu.addItem(messages.tree_pruneAllBranchesToRoot(), this::pruneToKey);
clearPruningAction = contextMenu.addItem(messages.tree_clearPruning(), this::clearPruning);
contextMenu.addSeparator();
showIriAction = contextMenu.addItem(messages.showIri(), this::showIriForSelection);
showDirectLinkAction = contextMenu.addItem(messages.showDirectLink(), this::showUrlForSelection);
contextMenu.addSeparator();
contextMenu.addItem(messages.refreshTree(), this::handleRefresh);
// This needs tidying somehow. We don't do this for other actions.
moveToParentUiAction.setHierarchyId(model.getHierarchyId());
mergeEntitiesAction.setHierarchyId(model.getHierarchyId());
Supplier<ImmutableSet<OWLEntityData>> selectionSupplier = () ->
treeWidget.getSelectedNodes().stream()
.map(TreeNode::getUserObject)
.map(EntityNode::getEntityData)
.collect(toImmutableSet());
setAnnotationValueUiAction.setSelectionSupplier(selectionSupplier);
moveToParentUiAction.setSelectionSupplier(selectionSupplier);
mergeEntitiesAction.setSelectionSupplier(selectionSupplier);
editAnnotationsUiAction.setSelectionSupplier(selectionSupplier);
updateActionStates();
}
private void updateActionStates() {
mergeEntitiesAction.setEnabled(false);
editEntityTagsAction.setEnabled(false);
setAnnotationValueUiAction.setEnabled(false);
editAnnotationsUiAction.setEnabled(false);
moveToParentUiAction.setEnabled(false);
watchUiAction.setEnabled(false);
int selSize = treeWidget.getSelectedKeys().size();
boolean selIsNonEmpty = selSize > 0;
boolean selIsSingleton = selSize == 1;
pruneBranchToRootAction.setEnabled(selIsSingleton);
pruneAllBranchesToRootAction.setEnabled(selIsSingleton);
clearPruningAction.setEnabled(selIsSingleton);
showIriAction.setEnabled(selIsSingleton);
showDirectLinkAction.setEnabled(selIsSingleton);
if (selIsNonEmpty) {
permissionChecker.hasPermission(WATCH_CHANGES, watchUiAction::setEnabled);
permissionChecker.hasPermission(MERGE_ENTITIES, mergeEntitiesAction::setEnabled);
permissionChecker.hasPermission(EDIT_ENTITY_TAGS, enabled -> editEntityTagsAction.setEnabled(selIsSingleton && enabled));
permissionChecker.hasPermission(EDIT_ONTOLOGY, setAnnotationValueUiAction::setEnabled);
permissionChecker.hasPermission(EDIT_ONTOLOGY, editAnnotationsUiAction::setEnabled);
permissionChecker.hasPermission(EDIT_ONTOLOGY, moveToParentUiAction::setEnabled);
}
}
private void pruneSelectedNodesToRoot() {
treeWidget.pruneToSelectedNodes();
}
private void pruneToKey() {
treeWidget.getFirstSelectedKey().ifPresent(sel -> treeWidget.pruneToNodesContainingKey(sel, () -> {
}));
}
private void clearPruning() {
treeWidget.clearPruning();
}
private void showIriForSelection() {
treeWidget.getFirstSelectedKey().ifPresent(sel -> {
String iri = sel.getIRI().toString();
inputBox.showOkDialog(messages.classIri(), true, iri, input -> {});
});
}
private void showUrlForSelection() {
String location = Window.Location.getHref();
inputBox.showOkDialog(messages.directLink(), true, location, input -> {});
}
private void handleRefresh() {
Optional<OWLEntity> firstSelectedKey = treeWidget.getFirstSelectedKey();
treeWidget.setModel(GraphTreeNodeModel.create(model, EntityNode::getEntity));
firstSelectedKey.ifPresent(sel -> treeWidget.revealTreeNodesForKey(sel, REVEAL_FIRST));
}
}
| {
"pile_set_name": "Github"
} |
/*
* /MathJax/jax/output/HTML-CSS/fonts/STIX/IntegralsSm/Regular/Main.js
*
* Copyright (c) 2012 Design Science, Inc.
*
* Part of the MathJax library.
* See http://www.mathjax.org for details.
*
* Licensed under the Apache License, Version 2.0;
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.STIXIntegralsSm={directory:"IntegralsSm/Regular",family:"STIXIntegralsSm",Ranges:[[32,32,"All"],[160,160,"All"],[8747,8755,"All"],[10763,10780,"All"]],8747:[690,189,496,41,552],8750:[690,189,560,41,552]};MathJax.OutputJax["HTML-CSS"].initFont("STIXIntegralsSm");MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/IntegralsSm/Regular/Main.js");
| {
"pile_set_name": "Github"
} |
bazinga_geocoder:
profiling:
enabled: false
providers:
acme:
factory: Bazinga\GeocoderBundle\ProviderFactory\PickPointFactory
options:
api_key: 'foo'
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
mvn clean package
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package leveldb provides implementation of LevelDB key/value database.
//
// Create or open a database:
//
// // The returned DB instance is safe for concurrent use. Which mean that all
// // DB's methods may be called concurrently from multiple goroutine.
// db, err := leveldb.OpenFile("path/to/db", nil)
// ...
// defer db.Close()
// ...
//
// Read or modify the database content:
//
// // Remember that the contents of the returned slice should not be modified.
// data, err := db.Get([]byte("key"), nil)
// ...
// err = db.Put([]byte("key"), []byte("value"), nil)
// ...
// err = db.Delete([]byte("key"), nil)
// ...
//
// Iterate over database content:
//
// iter := db.NewIterator(nil, nil)
// for iter.Next() {
// // Remember that the contents of the returned slice should not be modified, and
// // only valid until the next call to Next.
// key := iter.Key()
// value := iter.Value()
// ...
// }
// iter.Release()
// err = iter.Error()
// ...
//
// Iterate over subset of database content with a particular prefix:
// iter := db.NewIterator(util.BytesPrefix([]byte("foo-")), nil)
// for iter.Next() {
// // Use key/value.
// ...
// }
// iter.Release()
// err = iter.Error()
// ...
//
// Seek-then-Iterate:
//
// iter := db.NewIterator(nil, nil)
// for ok := iter.Seek(key); ok; ok = iter.Next() {
// // Use key/value.
// ...
// }
// iter.Release()
// err = iter.Error()
// ...
//
// Iterate over subset of database content:
//
// iter := db.NewIterator(&util.Range{Start: []byte("foo"), Limit: []byte("xoo")}, nil)
// for iter.Next() {
// // Use key/value.
// ...
// }
// iter.Release()
// err = iter.Error()
// ...
//
// Batch writes:
//
// batch := new(leveldb.Batch)
// batch.Put([]byte("foo"), []byte("value"))
// batch.Put([]byte("bar"), []byte("another value"))
// batch.Delete([]byte("baz"))
// err = db.Write(batch, nil)
// ...
//
// Use bloom filter:
//
// o := &opt.Options{
// Filter: filter.NewBloomFilter(10),
// }
// db, err := leveldb.OpenFile("path/to/db", o)
// ...
// defer db.Close()
// ...
package leveldb
| {
"pile_set_name": "Github"
} |
/*<-
Copyright (c) 2016 Barrett Adair
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
->*/
#ifdef BOOST_CLBL_TRTS_MSVC
// MSVC requires __cdecl for varargs, and I don't want to clutter the example
int main(){}
#else
//[ has_varargs
#include <type_traits>
#include <boost/callable_traits/has_varargs.hpp>
namespace ct = boost::callable_traits;
static_assert(ct::has_varargs<int(...)>::value, "");
static_assert(!ct::has_varargs<int()>::value, "");
int main() {}
//]
#endif
| {
"pile_set_name": "Github"
} |
// ----------------------------------------------------------------------
// <copyright file="ICallbackStore.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// ----------------------------------------------------------------------
namespace ClusterInsight.InsightCore.DataSetLayer.CallbackStore
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Describes contract for any store implementation that support callbacks.
/// </summary>
public interface ICallbackStore
{
/// <summary>
/// Gets all the scenarios for which we callbacks are supported
/// </summary>
/// <returns>Collection of scenarios.</returns>
IEnumerable<Scenario> GetCallbackSupportedScenario();
/// <summary>
/// Register callback with a specific filter
/// </summary>
/// <param name="notifyFilter"></param>
/// <param name="callbackRoutine"></param>
/// <param name="token"></param>
/// <returns></returns>
Task RegisterCallbackAsync(NotifyFilter notifyFilter, Func<ScenarioData, Task> callbackRoutine, CancellationToken token);
/// <summary>
/// Unregister a callback.
/// </summary>
/// <param name="notifyFilter"></param>
/// <param name="callbackRoutine"></param>
/// <param name="token"></param>
/// <returns></returns>
Task UnRegisterCallbackAsync(NotifyFilter notifyFilter, Func<ScenarioData, Task> callbackRoutine, CancellationToken token);
/// <summary>
/// Reset to Beginning. Basically lose all the internal progress state so that in future, can start from beginning.
/// </summary>
/// <returns></returns>
Task ResetAsync(CancellationToken token);
}
} | {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace NorthwindService
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
} | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
| {
"pile_set_name": "Github"
} |
# YAML marshaling and unmarshaling support for Go
[](https://travis-ci.org/ghodss/yaml)
## Introduction
A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs.
In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
## Compatibility
This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility).
## Caveats
**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example:
```
BAD:
exampleKey: !!binary gIGC
GOOD:
exampleKey: gIGC
... and decode the base64 data in your code.
```
**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys.
## Installation and usage
To install, run:
```
$ go get github.com/ghodss/yaml
```
And import using:
```
import "github.com/ghodss/yaml"
```
Usage is very similar to the JSON library:
```go
package main
import (
"fmt"
"github.com/ghodss/yaml"
)
type Person struct {
Name string `json:"name"` // Affects YAML field names too.
Age int `json:"age"`
}
func main() {
// Marshal a Person struct to YAML.
p := Person{"John", 30}
y, err := yaml.Marshal(p)
if err != nil {
fmt.Printf("err: %v\n", err)
return
}
fmt.Println(string(y))
/* Output:
age: 30
name: John
*/
// Unmarshal the YAML back into a Person struct.
var p2 Person
err = yaml.Unmarshal(y, &p2)
if err != nil {
fmt.Printf("err: %v\n", err)
return
}
fmt.Println(p2)
/* Output:
{John 30}
*/
}
```
`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available:
```go
package main
import (
"fmt"
"github.com/ghodss/yaml"
)
func main() {
j := []byte(`{"name": "John", "age": 30}`)
y, err := yaml.JSONToYAML(j)
if err != nil {
fmt.Printf("err: %v\n", err)
return
}
fmt.Println(string(y))
/* Output:
name: John
age: 30
*/
j2, err := yaml.YAMLToJSON(y)
if err != nil {
fmt.Printf("err: %v\n", err)
return
}
fmt.Println(string(j2))
/* Output:
{"age":30,"name":"John"}
*/
}
```
| {
"pile_set_name": "Github"
} |
#!/bin/bash
echo "Prepare Deployment"
# Script will zip the javadoc for upload to the release later, generate the changelog and increment the version in the pom.xml file to the one of the tag
echo TRAVIS_TAG=$TRAVIS_TAG
echo TAG_BRANCH=$TAG_BRANCH
rev=$(git rev-parse --short HEAD)
echo "Install Dependencies for Changelog Generation"
gem install activesupport -v 5.2.3
gem install github_changelog_generator -v 1.14.3
echo "Finished Install Dependencies for Changelog Generation"
git config user.name "Travis CI"
git config user.email "build@travis-ci.org"
echo "Prepare Git for Commits"
git remote add upstream "https://$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG.git"
git fetch upstream
git checkout $TAG_BRANCH
echo "Finished Prepare Git for Commits"
echo "Generate Changelog"
github_changelog_generator -t $GITHUB_TOKEN
git add -A CHANGELOG.md
git commit -m "update changelog at ${rev}"
echo "Finished Generate Changelog"
echo "Increment Version"
mvn versions:set -DnewVersion=$TRAVIS_TAG -DoldVersion=* -DgroupId=* -DartifactId=*
# increment version of children modules
mvn versions:update-child-modules
git commit -am "increment version to ${TRAVIS_TAG}"
echo "Finished Increment Version"
echo "Push commits"
git push upstream $TAG_BRANCH
echo "Finished Push commits"
echo "Running mvn package"
mvn package -DskipTests
echo "Making zip of javadoc"
cd ${TRAVIS_BUILD_DIR}/formsfx-core/target/apidocs
zip -r ${TRAVIS_BUILD_DIR}/javadoc.zip .
| {
"pile_set_name": "Github"
} |
/*
This file is part of Ext JS 3.4
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.
Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.
Build date: 2013-04-03 15:07:25
*/
.task {
background-image:url(../shared/icons/fam/cog.png) !important;
}
.task-folder {
background-image:url(../shared/icons/fam/folder_go.png) !important;
} | {
"pile_set_name": "Github"
} |
/*
* Jack-detection handling for HD-audio
*
* Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
*
* This driver 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.
*/
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/jack.h>
#include "hda_codec.h"
#include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_jack.h"
/**
* is_jack_detectable - Check whether the given pin is jack-detectable
* @codec: the HDA codec
* @nid: pin NID
*
* Check whether the given pin is capable to report the jack detection.
* The jack detection might not work by various reasons, e.g. the jack
* detection is prohibited in the codec level, the pin config has
* AC_DEFCFG_MISC_NO_PRESENCE bit, no unsol support, etc.
*/
bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
{
if (codec->no_jack_detect)
return false;
if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT))
return false;
if (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
AC_DEFCFG_MISC_NO_PRESENCE)
return false;
if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) &&
!codec->jackpoll_interval)
return false;
return true;
}
EXPORT_SYMBOL_GPL(is_jack_detectable);
/* execute pin sense measurement */
static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid)
{
u32 pincap;
u32 val;
if (!codec->no_trigger_sense) {
pincap = snd_hda_query_pin_caps(codec, nid);
if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
snd_hda_codec_read(codec, nid, 0,
AC_VERB_SET_PIN_SENSE, 0);
}
val = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_SENSE, 0);
if (codec->inv_jack_detect)
val ^= AC_PINSENSE_PRESENCE;
return val;
}
/**
* snd_hda_jack_tbl_get - query the jack-table entry for the given NID
* @codec: the HDA codec
* @nid: pin NID to refer to
*/
struct hda_jack_tbl *
snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid)
{
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i;
if (!nid || !jack)
return NULL;
for (i = 0; i < codec->jacktbl.used; i++, jack++)
if (jack->nid == nid)
return jack;
return NULL;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get);
/**
* snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag
* @codec: the HDA codec
* @tag: tag value to refer to
*/
struct hda_jack_tbl *
snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag)
{
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i;
if (!tag || !jack)
return NULL;
for (i = 0; i < codec->jacktbl.used; i++, jack++)
if (jack->tag == tag)
return jack;
return NULL;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_from_tag);
/**
* snd_hda_jack_tbl_new - create a jack-table entry for the given NID
* @codec: the HDA codec
* @nid: pin NID to assign
*/
static struct hda_jack_tbl *
snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid)
{
struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
if (jack)
return jack;
jack = snd_array_new(&codec->jacktbl);
if (!jack)
return NULL;
jack->nid = nid;
jack->jack_dirty = 1;
jack->tag = codec->jacktbl.used;
return jack;
}
void snd_hda_jack_tbl_clear(struct hda_codec *codec)
{
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i;
for (i = 0; i < codec->jacktbl.used; i++, jack++) {
struct hda_jack_callback *cb, *next;
/* free jack instances manually when clearing/reconfiguring */
if (!codec->bus->shutdown && jack->jack)
snd_device_free(codec->card, jack->jack);
for (cb = jack->callback; cb; cb = next) {
next = cb->next;
kfree(cb);
}
}
snd_array_free(&codec->jacktbl);
}
#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
/* update the cached value and notification flag if needed */
static void jack_detect_update(struct hda_codec *codec,
struct hda_jack_tbl *jack)
{
if (!jack->jack_dirty)
return;
if (jack->phantom_jack)
jack->pin_sense = AC_PINSENSE_PRESENCE;
else
jack->pin_sense = read_pin_sense(codec, jack->nid);
/* A gating jack indicates the jack is invalid if gating is unplugged */
if (jack->gating_jack && !snd_hda_jack_detect(codec, jack->gating_jack))
jack->pin_sense &= ~AC_PINSENSE_PRESENCE;
jack->jack_dirty = 0;
/* If a jack is gated by this one update it. */
if (jack->gated_jack) {
struct hda_jack_tbl *gated =
snd_hda_jack_tbl_get(codec, jack->gated_jack);
if (gated) {
gated->jack_dirty = 1;
jack_detect_update(codec, gated);
}
}
}
/**
* snd_hda_set_dirty_all - Mark all the cached as dirty
* @codec: the HDA codec
*
* This function sets the dirty flag to all entries of jack table.
* It's called from the resume path in hda_codec.c.
*/
void snd_hda_jack_set_dirty_all(struct hda_codec *codec)
{
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i;
for (i = 0; i < codec->jacktbl.used; i++, jack++)
if (jack->nid)
jack->jack_dirty = 1;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_set_dirty_all);
/**
* snd_hda_pin_sense - execute pin sense measurement
* @codec: the CODEC to sense
* @nid: the pin NID to sense
*
* Execute necessary pin sense measurement and return its Presence Detect,
* Impedance, ELD Valid etc. status bits.
*/
u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
{
struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
if (jack) {
jack_detect_update(codec, jack);
return jack->pin_sense;
}
return read_pin_sense(codec, nid);
}
EXPORT_SYMBOL_GPL(snd_hda_pin_sense);
/**
* snd_hda_jack_detect_state - query pin Presence Detect status
* @codec: the CODEC to sense
* @nid: the pin NID to sense
*
* Query and return the pin's Presence Detect status, as either
* HDA_JACK_NOT_PRESENT, HDA_JACK_PRESENT or HDA_JACK_PHANTOM.
*/
int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid)
{
struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
if (jack && jack->phantom_jack)
return HDA_JACK_PHANTOM;
else if (snd_hda_pin_sense(codec, nid) & AC_PINSENSE_PRESENCE)
return HDA_JACK_PRESENT;
else
return HDA_JACK_NOT_PRESENT;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state);
/**
* snd_hda_jack_detect_enable - enable the jack-detection
* @codec: the HDA codec
* @nid: pin NID to enable
* @func: callback function to register
*
* In the case of error, the return value will be a pointer embedded with
* errno. Check and handle the return value appropriately with standard
* macros such as @IS_ERR() and @PTR_ERR().
*/
struct hda_jack_callback *
snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
hda_jack_callback_fn func)
{
struct hda_jack_tbl *jack;
struct hda_jack_callback *callback = NULL;
int err;
jack = snd_hda_jack_tbl_new(codec, nid);
if (!jack)
return ERR_PTR(-ENOMEM);
if (func) {
callback = kzalloc(sizeof(*callback), GFP_KERNEL);
if (!callback)
return ERR_PTR(-ENOMEM);
callback->func = func;
callback->nid = jack->nid;
callback->next = jack->callback;
jack->callback = callback;
}
if (jack->jack_detect)
return callback; /* already registered */
jack->jack_detect = 1;
if (codec->jackpoll_interval > 0)
return callback; /* No unsol if we're polling instead */
err = snd_hda_codec_write_cache(codec, nid, 0,
AC_VERB_SET_UNSOLICITED_ENABLE,
AC_USRSP_EN | jack->tag);
if (err < 0)
return ERR_PTR(err);
return callback;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback);
/**
* snd_hda_jack_detect_enable - Enable the jack detection on the given pin
* @codec: the HDA codec
* @nid: pin NID to enable jack detection
*
* Enable the jack detection with the default callback. Returns zero if
* successful or a negative error code.
*/
int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid)
{
return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL));
}
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable);
/**
* snd_hda_jack_set_gating_jack - Set gating jack.
* @codec: the HDA codec
* @gated_nid: gated pin NID
* @gating_nid: gating pin NID
*
* Indicates the gated jack is only valid when the gating jack is plugged.
*/
int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid,
hda_nid_t gating_nid)
{
struct hda_jack_tbl *gated = snd_hda_jack_tbl_new(codec, gated_nid);
struct hda_jack_tbl *gating = snd_hda_jack_tbl_new(codec, gating_nid);
if (!gated || !gating)
return -EINVAL;
gated->gating_jack = gating_nid;
gating->gated_jack = gated_nid;
return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_set_gating_jack);
/**
* snd_hda_jack_report_sync - sync the states of all jacks and report if changed
* @codec: the HDA codec
*/
void snd_hda_jack_report_sync(struct hda_codec *codec)
{
struct hda_jack_tbl *jack;
int i, state;
/* update all jacks at first */
jack = codec->jacktbl.list;
for (i = 0; i < codec->jacktbl.used; i++, jack++)
if (jack->nid)
jack_detect_update(codec, jack);
/* report the updated jacks; it's done after updating all jacks
* to make sure that all gating jacks properly have been set
*/
jack = codec->jacktbl.list;
for (i = 0; i < codec->jacktbl.used; i++, jack++)
if (jack->nid) {
if (!jack->jack || jack->block_report)
continue;
state = get_jack_plug_state(jack->pin_sense);
snd_jack_report(jack->jack,
state ? jack->type : 0);
}
}
EXPORT_SYMBOL_GPL(snd_hda_jack_report_sync);
/* guess the jack type from the pin-config */
static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
{
unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
switch (get_defcfg_device(def_conf)) {
case AC_JACK_LINE_OUT:
case AC_JACK_SPEAKER:
return SND_JACK_LINEOUT;
case AC_JACK_HP_OUT:
return SND_JACK_HEADPHONE;
case AC_JACK_SPDIF_OUT:
case AC_JACK_DIG_OTHER_OUT:
return SND_JACK_AVOUT;
case AC_JACK_MIC_IN:
return SND_JACK_MICROPHONE;
default:
return SND_JACK_LINEIN;
}
}
static void hda_free_jack_priv(struct snd_jack *jack)
{
struct hda_jack_tbl *jacks = jack->private_data;
jacks->nid = 0;
jacks->jack = NULL;
}
/**
* snd_hda_jack_add_kctl - Add a kctl for the given pin
* @codec: the HDA codec
* @nid: pin NID to assign
* @name: string name for the jack
* @phantom_jack: flag to deal as a phantom jack
*
* This assigns a jack-detection kctl to the given pin. The kcontrol
* will have the given name and index.
*/
int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
const char *name, bool phantom_jack)
{
struct hda_jack_tbl *jack;
int err, state, type;
jack = snd_hda_jack_tbl_new(codec, nid);
if (!jack)
return 0;
if (jack->jack)
return 0; /* already created */
type = get_input_jack_type(codec, nid);
err = snd_jack_new(codec->card, name, type,
&jack->jack, true, phantom_jack);
if (err < 0)
return err;
jack->phantom_jack = !!phantom_jack;
jack->type = type;
jack->jack->private_data = jack;
jack->jack->private_free = hda_free_jack_priv;
state = snd_hda_jack_detect(codec, nid);
snd_jack_report(jack->jack, state ? jack->type : 0);
return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctl);
static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
const struct auto_pin_cfg *cfg,
const char *base_name)
{
unsigned int def_conf, conn;
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
int err;
bool phantom_jack;
if (!nid)
return 0;
def_conf = snd_hda_codec_get_pincfg(codec, nid);
conn = get_defcfg_connect(def_conf);
if (conn == AC_JACK_PORT_NONE)
return 0;
phantom_jack = (conn != AC_JACK_PORT_COMPLEX) ||
!is_jack_detectable(codec, nid);
if (base_name)
strlcpy(name, base_name, sizeof(name));
else
snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), NULL);
if (phantom_jack)
/* Example final name: "Internal Mic Phantom Jack" */
strncat(name, " Phantom", sizeof(name) - strlen(name) - 1);
err = snd_hda_jack_add_kctl(codec, nid, name, phantom_jack);
if (err < 0)
return err;
if (!phantom_jack)
return snd_hda_jack_detect_enable(codec, nid);
return 0;
}
/**
* snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg
* @codec: the HDA codec
* @cfg: pin config table to parse
*/
int snd_hda_jack_add_kctls(struct hda_codec *codec,
const struct auto_pin_cfg *cfg)
{
const hda_nid_t *p;
int i, err;
for (i = 0; i < cfg->num_inputs; i++) {
/* If we have headphone mics; make sure they get the right name
before grabbed by output pins */
if (cfg->inputs[i].is_headphone_mic) {
if (auto_cfg_hp_outs(cfg) == 1)
err = add_jack_kctl(codec, auto_cfg_hp_pins(cfg)[0],
cfg, "Headphone Mic");
else
err = add_jack_kctl(codec, cfg->inputs[i].pin,
cfg, "Headphone Mic");
} else
err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg,
NULL);
if (err < 0)
return err;
}
for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) {
err = add_jack_kctl(codec, *p, cfg, NULL);
if (err < 0)
return err;
}
for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) {
if (*p == *cfg->line_out_pins) /* might be duplicated */
break;
err = add_jack_kctl(codec, *p, cfg, NULL);
if (err < 0)
return err;
}
for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) {
if (*p == *cfg->line_out_pins) /* might be duplicated */
break;
err = add_jack_kctl(codec, *p, cfg, NULL);
if (err < 0)
return err;
}
for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) {
err = add_jack_kctl(codec, *p, cfg, NULL);
if (err < 0)
return err;
}
err = add_jack_kctl(codec, cfg->dig_in_pin, cfg, NULL);
if (err < 0)
return err;
err = add_jack_kctl(codec, cfg->mono_out_pin, cfg, NULL);
if (err < 0)
return err;
return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctls);
static void call_jack_callback(struct hda_codec *codec,
struct hda_jack_tbl *jack)
{
struct hda_jack_callback *cb;
for (cb = jack->callback; cb; cb = cb->next)
cb->func(codec, cb);
if (jack->gated_jack) {
struct hda_jack_tbl *gated =
snd_hda_jack_tbl_get(codec, jack->gated_jack);
if (gated) {
for (cb = gated->callback; cb; cb = cb->next)
cb->func(codec, cb);
}
}
}
/**
* snd_hda_jack_unsol_event - Handle an unsolicited event
* @codec: the HDA codec
* @res: the unsolicited event data
*/
void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
{
struct hda_jack_tbl *event;
int tag = (res >> AC_UNSOL_RES_TAG_SHIFT) & 0x7f;
event = snd_hda_jack_tbl_get_from_tag(codec, tag);
if (!event)
return;
event->jack_dirty = 1;
call_jack_callback(codec, event);
snd_hda_jack_report_sync(codec);
}
EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event);
/**
* snd_hda_jack_poll_all - Poll all jacks
* @codec: the HDA codec
*
* Poll all detectable jacks with dirty flag, update the status, call
* callbacks and call snd_hda_jack_report_sync() if any changes are found.
*/
void snd_hda_jack_poll_all(struct hda_codec *codec)
{
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i, changes = 0;
for (i = 0; i < codec->jacktbl.used; i++, jack++) {
unsigned int old_sense;
if (!jack->nid || !jack->jack_dirty || jack->phantom_jack)
continue;
old_sense = get_jack_plug_state(jack->pin_sense);
jack_detect_update(codec, jack);
if (old_sense == get_jack_plug_state(jack->pin_sense))
continue;
changes = 1;
call_jack_callback(codec, jack);
}
if (changes)
snd_hda_jack_report_sync(codec);
}
EXPORT_SYMBOL_GPL(snd_hda_jack_poll_all);
| {
"pile_set_name": "Github"
} |
; COMMAND-LINE: --uf-ho
; EXPECT: unsat
(set-logic ALL)
(declare-datatype Unit ((unit)))
(declare-fun f (Int) Unit)
(declare-fun g (Int) Unit)
(declare-fun P ((-> Int Unit)) Bool)
(assert (P f))
(assert (not (P g)))
(check-sat)
| {
"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 informer-gen. DO NOT EDIT.
package scheduling
import (
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
v1 "k8s.io/client-go/informers/scheduling/v1"
v1alpha1 "k8s.io/client-go/informers/scheduling/v1alpha1"
v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1 provides access to shared informers for resources in V1.
V1() v1.Interface
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
// V1beta1 provides access to shared informers for resources in V1beta1.
V1beta1() v1beta1.Interface
}
type group struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1 returns a new v1.Interface.
func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1beta1 returns a new v1beta1.Interface.
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
}
| {
"pile_set_name": "Github"
} |
/*
Copyright 2017 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.
*/
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name use in this package
const GroupName = "audit.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder runtime.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addKnownTypes)
}
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Event{},
&EventList{},
&Policy{},
&PolicyList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016 SimplifyOps, Inc. (http://simplifyops.com)
*
* 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 rundeck.services
import com.dtolabs.rundeck.core.plugins.Plugin
import com.dtolabs.rundeck.core.storage.ResourceMeta
import com.dtolabs.rundeck.core.storage.StorageUtil
import com.dtolabs.rundeck.plugins.ServiceNameConstants
import com.dtolabs.rundeck.plugins.descriptions.PluginDescription
import com.dtolabs.rundeck.plugins.storage.StoragePlugin
import com.dtolabs.rundeck.server.storage.NamespacedStorage
import grails.gorm.transactions.Transactional
import org.rundeck.storage.api.HasInputStream
import org.rundeck.storage.api.Path
import org.rundeck.storage.api.PathUtil
import org.rundeck.storage.api.Resource
import org.rundeck.storage.api.StorageException
import org.rundeck.storage.impl.ResourceBase
import rundeck.Storage
import java.util.regex.Pattern
/**
* Implements StoragePlugin and provides DB storage for rundeck resources if configured to be used.
*/
class DbStorageService implements NamespacedStorage{
static transactional = false
protected static Resource<ResourceMeta> loadDir(Path path) {
new ResourceBase(path, null, true)
}
protected static Resource<ResourceMeta> loadResource(Storage storage1) {
new ResourceBase(PathUtil.asPath(storage1.path),
StorageUtil.withStream(lazyData(storage1), storage1.storageMeta), false)
}
protected static HasInputStream lazyData(Storage storage1) {
new HasInputStream() {
@Override
InputStream getInputStream() throws IOException {
new ByteArrayInputStream(storage1.data)
}
@Override
long writeContent(OutputStream outputStream) throws IOException {
def data = storage1.data
long len = (long) data.length
outputStream.write(data)
return len
}
}
}
protected static List<String> splitPath(Path path1){
def parent = PathUtil.parentPath(path1)
[parent?parent.path:'',path1.name]
}
@Override
boolean hasPath(String ns,Path path) {
def dir,name
(dir,name)=splitPath(path)
if(PathUtil.isRoot(path)){
return true
}
def c = Storage.createCriteria()
c.get {
if (ns) {
eq('namespace', ns)
} else {
isNull('namespace')
}
or {
and{
eq('name', name)
eq('dir', dir)
}
or {
eq('dir', path.path)
like('dir', path.path + '/%')
}
}
projections {
rowCount()
}
} > 0
}
boolean hasPath(String ns,String path) {
return hasPath(ns,PathUtil.asPath(path))
}
@Override
@Transactional(readOnly = true)
boolean hasResource(String ns,Path path) {
findResource(ns,path) !=null
}
boolean hasResource(String ns,String path) {
return hasResource(ns,PathUtil.asPath(path))
}
@Override
boolean hasDirectory(String ns,Path path) {
def dir, name
(dir, name) = splitPath(path)
if (PathUtil.isRoot(path)) {
return true
}
def c = Storage.createCriteria()
c.get {
if (ns) {
eq('namespace', ns)
} else {
isNull('namespace')
}
or {
eq('dir', path.path)
like('dir', path.path + '/%')
}
projections {
rowCount()
}
} > 0
}
boolean hasDirectory(String ns,String path) {
return hasDirectory(ns,PathUtil.asPath(path))
}
@Override
@Transactional(readOnly = true)
Resource<ResourceMeta> getPath(String ns,Path path) {
Storage found = findResource(ns,path)
if(found){
return loadResource(found)
}else{
//find dir
if(hasDirectory(ns,path)){
return loadDir(path)
}
}
throw StorageException.readException(path,"Not found")
}
Resource<ResourceMeta> getPath(String ns,String path) {
return getPath(ns,PathUtil.asPath(path))
}
@Override
@Transactional(readOnly = true)
Resource<ResourceMeta> getResource(String ns,Path path) {
Storage found = findResource(ns,path)
if (!found) {
throw StorageException.readException(path,"Not found")
}
return loadResource(found)
}
protected Storage findResource(String ns, Path path) {
def dir, name
(dir, name) = splitPath(path)
def found = Storage.findByNamespaceAndDirAndName(ns?:null,dir, name)
found
}
Resource<ResourceMeta> getResource(String ns,String path) {
return getResource(ns,PathUtil.asPath(path))
}
@Override
Set<Resource<ResourceMeta>> listDirectoryResources(String ns,Path path) {
Storage.findAllByNamespaceAndDir(ns ?: null,path.path,[sort:'name',order:'desc']).collect{ loadResource(it) }
}
Set<Resource<ResourceMeta>> listDirectoryResources(String ns,String path) {
return listDirectoryResources(ns,PathUtil.asPath(path))
}
@Override
Set<Resource<ResourceMeta>> listDirectory(String ns,Path path) {
def foundset=new HashSet<String>()
def c = Storage.createCriteria()
def pathkey= path.path ? (path.path + '/') : ''
c.list {
if(ns){
eq('namespace',ns)
}else{
isNull('namespace')
}
or {
eq('dir', path.path)
like('dir', pathkey+'%')
}
order("name", "desc")
}.collect {
def m= it.dir =~ "^(${Pattern.quote(pathkey)}[^/]+)/?.*"
if (it.dir == path.path) {
return loadResource(it)
} else if (m.matches() && !foundset.contains(m[0][1])) {
foundset<<m[0][1]
return loadDir(PathUtil.asPath(m[0][1]))
}
null
}.findAll{it}
}
Set<Resource<ResourceMeta>> listDirectory(String ns,String path) {
return listDirectory(ns,PathUtil.asPath(path))
}
@Override
Set<Resource<ResourceMeta>> listDirectorySubdirs(String ns,Path path) {
def foundset = new HashSet<String>()
def c = Storage.createCriteria()
def pathkey = path.path ? (path.path + '/') : ''
c.list {
if (ns) {
eq('namespace', ns)
} else {
isNull('namespace')
}
like('dir', pathkey + '%')
order("name", "desc")
}.collect {
def m = it.dir =~ "^(${Pattern.quote(pathkey)}[^/]+)/?.*"
if (m.matches() && !foundset.contains(m[0][1])) {
foundset << m[0][1]
return loadDir(PathUtil.asPath(m[0][1]))
}
null
}.findAll { it }
}
Set<Resource<ResourceMeta>> listDirectorySubdirs(String ns,String path) {
return listDirectorySubdirs(ns,PathUtil.asPath(path))
}
@Override
boolean deleteResource(String ns,Path path) {
Storage storage1 = findResource(ns,path)
if (!storage1) {
throw StorageException.deleteException(path, "Not found")
}
storage1.delete(flush: true)
return true
}
boolean deleteResource(String ns,String path) {
return deleteResource(ns,PathUtil.asPath(path))
}
@Override
Resource<ResourceMeta> createResource(String ns,Path path, ResourceMeta content) {
if (path.path.contains('../')) {
throw StorageException.createException(path, "Invalid path: ${path.path}")
}
if(findResource(ns,path)){
throw StorageException.createException(path,"Exists")
}
def storage= saveStorage(null,content, ns,path,'create')
return loadResource(storage)
}
protected Storage saveStorage(Storage storage, ResourceMeta content,String namespace, Path path, String event) {
def id = storage?.id
def retry = true
Storage saved=null;
def data = content.getInputStream().bytes
def saveStorage={
try {
if (id) {
storage = Storage.get(id)
} else {
storage = new Storage()
}
storage.namespace = namespace ? namespace : null
storage.path = path.path
Map<String, String> newdata = storage.storageMeta?:[:]
storage.storageMeta = newdata + content.meta
storage.data = data
saved = storage.save(flush: true)
if (!saved) {
throw new StorageException("Failed to save content at path ${path}: validation error: " +
storage.errors.allErrors.collect { it.toString() }.join("; "),
StorageException.Event.valueOf(event.toUpperCase()),
path)
}
retry = false
return true;
} catch (org.springframework.dao.ConcurrencyFailureException e) {
if (!retry) {
throw new StorageException("Failed to save content at path ${path}: content was modified", e,
StorageException.Event.valueOf(event.toUpperCase()),
path)
} else {
log.warn("saveStorage optimistic locking failure for ${path}, retrying...")
Thread.sleep(1000)
}
}
return false;
}
try{
if(!saveStorage()){
while(retry){
Storage.withNewSession {session->
saveStorage()
}
}
}
} catch (Exception e) {
throw new StorageException(e.class.name+': '+e.message, e, StorageException.Event.valueOf(event.toUpperCase()), path)
}
return saved
}
Resource<ResourceMeta> createResource(String ns,String path, ResourceMeta content) {
return createResource(ns,PathUtil.asPath(path), content)
}
@Override
Resource<ResourceMeta> updateResource(String ns,Path path, ResourceMeta content) {
if (path.path.contains('../')) {
throw StorageException.updateException(path, "Invalid path: ${path.path}")
}
def storage = findResource(ns, path)
if (!storage) {
throw StorageException.updateException(path, "Not found")
}
storage = saveStorage(storage, content, ns, path, 'update')
return loadResource(storage)
}
Resource<ResourceMeta> updateResource(String ns,String path, ResourceMeta content) {
return updateResource(ns,PathUtil.asPath(path), content)
}
}
| {
"pile_set_name": "Github"
} |
package engine
import (
"bytes"
"encoding/json"
"testing"
"github.com/docker/docker/pkg/testutils"
)
func TestEnvLenZero(t *testing.T) {
env := &Env{}
if env.Len() != 0 {
t.Fatalf("%d", env.Len())
}
}
func TestEnvLenNotZero(t *testing.T) {
env := &Env{}
env.Set("foo", "bar")
env.Set("ga", "bu")
if env.Len() != 2 {
t.Fatalf("%d", env.Len())
}
}
func TestEnvLenDup(t *testing.T) {
env := &Env{
"foo=bar",
"foo=baz",
"a=b",
}
// len(env) != env.Len()
if env.Len() != 2 {
t.Fatalf("%d", env.Len())
}
}
func TestNewJob(t *testing.T) {
job := mkJob(t, "dummy", "--level=awesome")
if job.Name != "dummy" {
t.Fatalf("Wrong job name: %s", job.Name)
}
if len(job.Args) != 1 {
t.Fatalf("Wrong number of job arguments: %d", len(job.Args))
}
if job.Args[0] != "--level=awesome" {
t.Fatalf("Wrong job arguments: %s", job.Args[0])
}
}
func TestSetenv(t *testing.T) {
job := mkJob(t, "dummy")
job.Setenv("foo", "bar")
if val := job.Getenv("foo"); val != "bar" {
t.Fatalf("Getenv returns incorrect value: %s", val)
}
job.Setenv("bar", "")
if val := job.Getenv("bar"); val != "" {
t.Fatalf("Getenv returns incorrect value: %s", val)
}
if val := job.Getenv("nonexistent"); val != "" {
t.Fatalf("Getenv returns incorrect value: %s", val)
}
}
func TestSetenvBool(t *testing.T) {
job := mkJob(t, "dummy")
job.SetenvBool("foo", true)
if val := job.GetenvBool("foo"); !val {
t.Fatalf("GetenvBool returns incorrect value: %t", val)
}
job.SetenvBool("bar", false)
if val := job.GetenvBool("bar"); val {
t.Fatalf("GetenvBool returns incorrect value: %t", val)
}
if val := job.GetenvBool("nonexistent"); val {
t.Fatalf("GetenvBool returns incorrect value: %t", val)
}
}
func TestSetenvInt(t *testing.T) {
job := mkJob(t, "dummy")
job.SetenvInt("foo", -42)
if val := job.GetenvInt("foo"); val != -42 {
t.Fatalf("GetenvInt returns incorrect value: %d", val)
}
job.SetenvInt("bar", 42)
if val := job.GetenvInt("bar"); val != 42 {
t.Fatalf("GetenvInt returns incorrect value: %d", val)
}
if val := job.GetenvInt("nonexistent"); val != 0 {
t.Fatalf("GetenvInt returns incorrect value: %d", val)
}
}
func TestSetenvList(t *testing.T) {
job := mkJob(t, "dummy")
job.SetenvList("foo", []string{"bar"})
if val := job.GetenvList("foo"); len(val) != 1 || val[0] != "bar" {
t.Fatalf("GetenvList returns incorrect value: %v", val)
}
job.SetenvList("bar", nil)
if val := job.GetenvList("bar"); val != nil {
t.Fatalf("GetenvList returns incorrect value: %v", val)
}
if val := job.GetenvList("nonexistent"); val != nil {
t.Fatalf("GetenvList returns incorrect value: %v", val)
}
}
func TestEnviron(t *testing.T) {
job := mkJob(t, "dummy")
job.Setenv("foo", "bar")
val, exists := job.Environ()["foo"]
if !exists {
t.Fatalf("foo not found in the environ")
}
if val != "bar" {
t.Fatalf("bar not found in the environ")
}
}
func TestMultiMap(t *testing.T) {
e := &Env{}
e.Set("foo", "bar")
e.Set("bar", "baz")
e.Set("hello", "world")
m := e.MultiMap()
e2 := &Env{}
e2.Set("old_key", "something something something")
e2.InitMultiMap(m)
if v := e2.Get("old_key"); v != "" {
t.Fatalf("%#v", v)
}
if v := e2.Get("bar"); v != "baz" {
t.Fatalf("%#v", v)
}
if v := e2.Get("hello"); v != "world" {
t.Fatalf("%#v", v)
}
}
func testMap(l int) [][2]string {
res := make([][2]string, l)
for i := 0; i < l; i++ {
t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
res[i] = t
}
return res
}
func BenchmarkSet(b *testing.B) {
fix := testMap(100)
b.ResetTimer()
for i := 0; i < b.N; i++ {
env := &Env{}
for _, kv := range fix {
env.Set(kv[0], kv[1])
}
}
}
func BenchmarkSetJson(b *testing.B) {
fix := testMap(100)
type X struct {
f string
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
env := &Env{}
for _, kv := range fix {
if err := env.SetJson(kv[0], X{kv[1]}); err != nil {
b.Fatal(err)
}
}
}
}
func BenchmarkGet(b *testing.B) {
fix := testMap(100)
env := &Env{}
for _, kv := range fix {
env.Set(kv[0], kv[1])
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, kv := range fix {
env.Get(kv[0])
}
}
}
func BenchmarkGetJson(b *testing.B) {
fix := testMap(100)
env := &Env{}
type X struct {
f string
}
for _, kv := range fix {
env.SetJson(kv[0], X{kv[1]})
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, kv := range fix {
if err := env.GetJson(kv[0], &X{}); err != nil {
b.Fatal(err)
}
}
}
}
func BenchmarkEncode(b *testing.B) {
fix := testMap(100)
env := &Env{}
type X struct {
f string
}
// half a json
for i, kv := range fix {
if i%2 != 0 {
if err := env.SetJson(kv[0], X{kv[1]}); err != nil {
b.Fatal(err)
}
continue
}
env.Set(kv[0], kv[1])
}
var writer bytes.Buffer
b.ResetTimer()
for i := 0; i < b.N; i++ {
env.Encode(&writer)
writer.Reset()
}
}
func BenchmarkDecode(b *testing.B) {
fix := testMap(100)
env := &Env{}
type X struct {
f string
}
// half a json
for i, kv := range fix {
if i%2 != 0 {
if err := env.SetJson(kv[0], X{kv[1]}); err != nil {
b.Fatal(err)
}
continue
}
env.Set(kv[0], kv[1])
}
var writer bytes.Buffer
env.Encode(&writer)
denv := &Env{}
reader := bytes.NewReader(writer.Bytes())
b.ResetTimer()
for i := 0; i < b.N; i++ {
err := denv.Decode(reader)
if err != nil {
b.Fatal(err)
}
reader.Seek(0, 0)
}
}
func TestLongNumbers(t *testing.T) {
type T struct {
TestNum int64
}
v := T{67108864}
var buf bytes.Buffer
e := &Env{}
e.SetJson("Test", v)
if err := e.Encode(&buf); err != nil {
t.Fatal(err)
}
res := make(map[string]T)
if err := json.Unmarshal(buf.Bytes(), &res); err != nil {
t.Fatal(err)
}
if res["Test"].TestNum != v.TestNum {
t.Fatalf("TestNum %d, expected %d", res["Test"].TestNum, v.TestNum)
}
}
func TestLongNumbersArray(t *testing.T) {
type T struct {
TestNum []int64
}
v := T{[]int64{67108864}}
var buf bytes.Buffer
e := &Env{}
e.SetJson("Test", v)
if err := e.Encode(&buf); err != nil {
t.Fatal(err)
}
res := make(map[string]T)
if err := json.Unmarshal(buf.Bytes(), &res); err != nil {
t.Fatal(err)
}
if res["Test"].TestNum[0] != v.TestNum[0] {
t.Fatalf("TestNum %d, expected %d", res["Test"].TestNum, v.TestNum)
}
}
| {
"pile_set_name": "Github"
} |
//args: -Etestpackage -Egochecknoglobals
package testdata
// Test expects at least one issue in the file.
// So we have to add global variable and enable gochecknoglobals.
var global = `global` // ERROR "`global` is a global variable"
| {
"pile_set_name": "Github"
} |
'**********************************************************************************
'* クラス名 :Order_DetailsEntity
'* クラス日本語名 :自動生成Entityクラス
'*
'* 作成日時 :2014/2/9
'* 作成者 :棟梁 D層自動生成ツール(墨壺), 日立 太郎
'* 更新履歴 :
'*
'* 日時 更新者 内容
'* ---------- ---------------- -------------------------------------------------
'* 20xx/xx/xx XX XX XXXX
'**********************************************************************************
' System~
Imports System
''' <summary>自動生成Entityクラス</summary>
<Serializable> _
Public Class Order_DetailsEntity
#Region "メンバ変数"
''' <summary>設定フラグ:OrderID</summary>
Public IsSetPK_OrderID As Boolean = False
''' <summary>メンバ変数:OrderID</summary>
Private _PK_OrderID As Nullable(Of System.Int32)
''' <summary>プロパティ:OrderID</summary>
Public Property PK_OrderID() As Nullable(Of System.Int32)
Get
Return Me._PK_OrderID
End Get
Set
Me.IsSetPK_OrderID = True
Me._PK_OrderID = value
End Set
End Property
''' <summary>設定フラグ:ProductID</summary>
Public IsSetPK_ProductID As Boolean = False
''' <summary>メンバ変数:ProductID</summary>
Private _PK_ProductID As Nullable(Of System.Int32)
''' <summary>プロパティ:ProductID</summary>
Public Property PK_ProductID() As Nullable(Of System.Int32)
Get
Return Me._PK_ProductID
End Get
Set
Me.IsSetPK_ProductID = True
Me._PK_ProductID = value
End Set
End Property
''' <summary>設定フラグ:UnitPrice</summary>
Public IsSet_UnitPrice As Boolean = False
''' <summary>メンバ変数:UnitPrice</summary>
Private _UnitPrice As Nullable(Of System.Decimal)
''' <summary>プロパティ:UnitPrice</summary>
Public Property UnitPrice() As Nullable(Of System.Decimal)
Get
Return Me._UnitPrice
End Get
Set
Me.IsSet_UnitPrice = True
Me._UnitPrice = value
End Set
End Property
''' <summary>設定フラグ:Quantity</summary>
Public IsSet_Quantity As Boolean = False
''' <summary>メンバ変数:Quantity</summary>
Private _Quantity As Nullable(Of System.Int16)
''' <summary>プロパティ:Quantity</summary>
Public Property Quantity() As Nullable(Of System.Int16)
Get
Return Me._Quantity
End Get
Set
Me.IsSet_Quantity = True
Me._Quantity = value
End Set
End Property
''' <summary>設定フラグ:Discount</summary>
Public IsSet_Discount As Boolean = False
''' <summary>メンバ変数:Discount</summary>
Private _Discount As Nullable(Of System.Single)
''' <summary>プロパティ:Discount</summary>
Public Property Discount() As Nullable(Of System.Single)
Get
Return Me._Discount
End Get
Set
Me.IsSet_Discount = True
Me._Discount = value
End Set
End Property
''' <summary>設定フラグ:Set_OrderID_forUPD</summary>
Public IsSet_Set_OrderID_forUPD As Boolean = False
''' <summary>メンバ変数:Set_OrderID_forUPD</summary>
Private _Set_OrderID_forUPD As Nullable(Of System.Int32)
''' <summary>プロパティ:Set_OrderID_forUPD</summary>
Public Property Set_OrderID_forUPD() As Nullable(Of System.Int32)
Get
Return Me._Set_OrderID_forUPD
End Get
Set
Me.IsSet_Set_OrderID_forUPD = True
Me._Set_OrderID_forUPD = value
End Set
End Property
''' <summary>設定フラグ:Set_ProductID_forUPD</summary>
Public IsSet_Set_ProductID_forUPD As Boolean = False
''' <summary>メンバ変数:Set_ProductID_forUPD</summary>
Private _Set_ProductID_forUPD As Nullable(Of System.Int32)
''' <summary>プロパティ:Set_ProductID_forUPD</summary>
Public Property Set_ProductID_forUPD() As Nullable(Of System.Int32)
Get
Return Me._Set_ProductID_forUPD
End Get
Set
Me.IsSet_Set_ProductID_forUPD = True
Me._Set_ProductID_forUPD = value
End Set
End Property
''' <summary>設定フラグ:Set_UnitPrice_forUPD</summary>
Public IsSet_Set_UnitPrice_forUPD As Boolean = False
''' <summary>メンバ変数:Set_UnitPrice_forUPD</summary>
Private _Set_UnitPrice_forUPD As Nullable(Of System.Decimal)
''' <summary>プロパティ:Set_UnitPrice_forUPD</summary>
Public Property Set_UnitPrice_forUPD() As Nullable(Of System.Decimal)
Get
Return Me._Set_UnitPrice_forUPD
End Get
Set
Me.IsSet_Set_UnitPrice_forUPD = True
Me._Set_UnitPrice_forUPD = value
End Set
End Property
''' <summary>設定フラグ:Set_Quantity_forUPD</summary>
Public IsSet_Set_Quantity_forUPD As Boolean = False
''' <summary>メンバ変数:Set_Quantity_forUPD</summary>
Private _Set_Quantity_forUPD As Nullable(Of System.Int16)
''' <summary>プロパティ:Set_Quantity_forUPD</summary>
Public Property Set_Quantity_forUPD() As Nullable(Of System.Int16)
Get
Return Me._Set_Quantity_forUPD
End Get
Set
Me.IsSet_Set_Quantity_forUPD = True
Me._Set_Quantity_forUPD = value
End Set
End Property
''' <summary>設定フラグ:Set_Discount_forUPD</summary>
Public IsSet_Set_Discount_forUPD As Boolean = False
''' <summary>メンバ変数:Set_Discount_forUPD</summary>
Private _Set_Discount_forUPD As Nullable(Of System.Single)
''' <summary>プロパティ:Set_Discount_forUPD</summary>
Public Property Set_Discount_forUPD() As Nullable(Of System.Single)
Get
Return Me._Set_Discount_forUPD
End Get
Set
Me.IsSet_Set_Discount_forUPD = True
Me._Set_Discount_forUPD = value
End Set
End Property
''' <summary>設定フラグ:OrderID_Like</summary>
Public IsSet_OrderID_Like As Boolean = False
''' <summary>メンバ変数:OrderID_Like</summary>
Private _OrderID_Like As Nullable(Of System.Int32)
''' <summary>プロパティ:OrderID_Like</summary>
Public Property OrderID_Like() As Nullable(Of System.Int32)
Get
Return Me._OrderID_Like
End Get
Set
Me.IsSet_OrderID_Like = True
Me._OrderID_Like = value
End Set
End Property
''' <summary>設定フラグ:ProductID_Like</summary>
Public IsSet_ProductID_Like As Boolean = False
''' <summary>メンバ変数:ProductID_Like</summary>
Private _ProductID_Like As Nullable(Of System.Int32)
''' <summary>プロパティ:ProductID_Like</summary>
Public Property ProductID_Like() As Nullable(Of System.Int32)
Get
Return Me._ProductID_Like
End Get
Set
Me.IsSet_ProductID_Like = True
Me._ProductID_Like = value
End Set
End Property
''' <summary>設定フラグ:UnitPrice_Like</summary>
Public IsSet_UnitPrice_Like As Boolean = False
''' <summary>メンバ変数:UnitPrice_Like</summary>
Private _UnitPrice_Like As Nullable(Of System.Decimal)
''' <summary>プロパティ:UnitPrice_Like</summary>
Public Property UnitPrice_Like() As Nullable(Of System.Decimal)
Get
Return Me._UnitPrice_Like
End Get
Set
Me.IsSet_UnitPrice_Like = True
Me._UnitPrice_Like = value
End Set
End Property
''' <summary>設定フラグ:Quantity_Like</summary>
Public IsSet_Quantity_Like As Boolean = False
''' <summary>メンバ変数:Quantity_Like</summary>
Private _Quantity_Like As Nullable(Of System.Int16)
''' <summary>プロパティ:Quantity_Like</summary>
Public Property Quantity_Like() As Nullable(Of System.Int16)
Get
Return Me._Quantity_Like
End Get
Set
Me.IsSet_Quantity_Like = True
Me._Quantity_Like = value
End Set
End Property
''' <summary>設定フラグ:Discount_Like</summary>
Public IsSet_Discount_Like As Boolean = False
''' <summary>メンバ変数:Discount_Like</summary>
Private _Discount_Like As Nullable(Of System.Single)
''' <summary>プロパティ:Discount_Like</summary>
Public Property Discount_Like() As Nullable(Of System.Single)
Get
Return Me._Discount_Like
End Get
Set
Me.IsSet_Discount_Like = True
Me._Discount_Like = value
End Set
End Property
#End Region
End Class
| {
"pile_set_name": "Github"
} |
within ThermoSysPro.FlueGases.BoundaryConditions;
model SinkG "General flue gas sink"
ThermoSysPro.Units.AbsolutePressure P "Fluid pressure";
Modelica.SIunits.MassFlowRate Q "Mass flow";
ThermoSysPro.Units.AbsoluteTemperature T "Fluid temperature";
Real Xco2 "CO2 mass fraction";
Real Xh2o "H2O mass fraction";
Real Xo2 "O2 mass fraction";
Real Xso2 "SO2 mass fraction";
Real Xn2 "N2 mass fraction";
annotation(Diagram(coordinateSystem(extent={{-100,-100},{100,100}}), graphics={Rectangle(lineColor={0,0,255}, extent={{-40,40},{40,-40}}, fillColor={255,255,0}, fillPattern=FillPattern.Backward),Line(color={0,0,255}, points={{-90,0},{-40,0},{-58,10}}),Line(color={0,0,255}, points={{-40,0},{-58,-10}}),Rectangle(extent={{-20,20},{20,-20}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),Text(lineColor={0,0,255}, extent={{-40,30},{40,-32}}, textString="G"),Text(lineColor={0,0,255}, extent={{40,28},{64,6}}, fillColor={0,0,255}, textString="P"),Text(lineColor={0,0,255}, extent={{-40,60},{-6,40}}, fillColor={0,0,255}, textString="Q")}), Icon(coordinateSystem(extent={{-100,-100},{100,100}}), graphics={Rectangle(lineColor={0,0,255}, extent={{-40,40},{40,-40}}, fillColor={255,255,0}, fillPattern=FillPattern.Backward),Line(color={0,0,255}, points={{-90,0},{-40,0},{-58,10}}),Line(color={0,0,255}, points={{-40,0},{-58,-10}}),Rectangle(extent={{-20,20},{20,-20}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),Text(lineColor={0,0,255}, extent={{-40,30},{40,-32}}, textString="G"),Text(lineColor={0,0,255}, extent={{-40,60},{-6,40}}, fillColor={0,0,255}, textString="Q"),Text(lineColor={0,0,255}, extent={{40,28},{64,6}}, fillColor={0,0,255}, textString="P")}), Documentation(info="<html>
<p><b>Copyright © EDF 2002 - 2010</b></p>
</HTML>
<html>
<p><b>ThermoSysPro Version 2.0</b></p>
</HTML>
", revisions="<html>
<u><p><b>Authors</u> : </p></b>
<ul style='margin-top:0cm' type=disc>
<li>
Baligh El Hefni</li>
</ul>
</html>
"));
ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure annotation(Placement(transformation(x=50.0, y=0.0, scale=0.1, aspectRatio=1.0, flipHorizontal=true, flipVertical=false), iconTransformation(x=50.0, y=0.0, scale=0.1, aspectRatio=1.0, flipHorizontal=true, flipVertical=false)));
ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow annotation(Placement(transformation(x=0.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false, rotation=90.0), iconTransformation(x=0.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false, rotation=90.0)));
ThermoSysPro.FlueGases.Connectors.FlueGasesInlet C annotation(Placement(transformation(x=-98.0, y=0.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false), iconTransformation(x=-98.0, y=0.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
equation
C.P=P;
C.Q=Q;
C.T=T;
C.Xco2=Xco2;
C.Xh2o=Xh2o;
C.Xo2=Xo2;
C.Xso2=Xso2;
Xn2=1 - Xco2 - Xh2o - Xo2 - Xso2;
if cardinality(IMassFlow) == 1 then
C.Q=IMassFlow.signal;
end if;
if cardinality(IPressure) == 1 then
C.P=IPressure.signal;
end if;
end SinkG;
| {
"pile_set_name": "Github"
} |
<?php
class photosDialogConfirmViewAction extends waViewAction
{
protected $type = '';
public function __construct($params = null) {
parent::__construct($params);
$this->template = 'templates/actions/dialog/DialogConfirm.html';
}
public function display($clear_assign = true) {
$this->view->assign('type', $this->type);
$this->view->assign('templates_path', 'templates/actions/dialog/');
return parent::display($clear_assign);
}
} | {
"pile_set_name": "Github"
} |
package ini
// ASTKind represents different states in the parse table
// and the type of AST that is being constructed
type ASTKind int
// ASTKind* is used in the parse table to transition between
// the different states
const (
ASTKindNone = ASTKind(iota)
ASTKindStart
ASTKindExpr
ASTKindEqualExpr
ASTKindStatement
ASTKindSkipStatement
ASTKindExprStatement
ASTKindSectionStatement
ASTKindNestedSectionStatement
ASTKindCompletedNestedSectionStatement
ASTKindCommentStatement
ASTKindCompletedSectionStatement
)
func (k ASTKind) String() string {
switch k {
case ASTKindNone:
return "none"
case ASTKindStart:
return "start"
case ASTKindExpr:
return "expr"
case ASTKindStatement:
return "stmt"
case ASTKindSectionStatement:
return "section_stmt"
case ASTKindExprStatement:
return "expr_stmt"
case ASTKindCommentStatement:
return "comment"
case ASTKindNestedSectionStatement:
return "nested_section_stmt"
case ASTKindCompletedSectionStatement:
return "completed_stmt"
case ASTKindSkipStatement:
return "skip"
default:
return ""
}
}
// AST interface allows us to determine what kind of node we
// are on and casting may not need to be necessary.
//
// The root is always the first node in Children
type AST struct {
Kind ASTKind
Root Token
RootToken bool
Children []AST
}
func newAST(kind ASTKind, root AST, children ...AST) AST {
return AST{
Kind: kind,
Children: append([]AST{root}, children...),
}
}
func newASTWithRootToken(kind ASTKind, root Token, children ...AST) AST {
return AST{
Kind: kind,
Root: root,
RootToken: true,
Children: children,
}
}
// AppendChild will append to the list of children an AST has.
func (a *AST) AppendChild(child AST) {
a.Children = append(a.Children, child)
}
// GetRoot will return the root AST which can be the first entry
// in the children list or a token.
func (a *AST) GetRoot() AST {
if a.RootToken {
return *a
}
if len(a.Children) == 0 {
return AST{}
}
return a.Children[0]
}
// GetChildren will return the current AST's list of children
func (a *AST) GetChildren() []AST {
if len(a.Children) == 0 {
return []AST{}
}
if a.RootToken {
return a.Children
}
return a.Children[1:]
}
// SetChildren will set and override all children of the AST.
func (a *AST) SetChildren(children []AST) {
if a.RootToken {
a.Children = children
} else {
a.Children = append(a.Children[:1], children...)
}
}
// Start is used to indicate the starting state of the parse table.
var Start = newAST(ASTKindStart, AST{})
| {
"pile_set_name": "Github"
} |
//AdminLTE 2 Variables.less
//=========================
//PATHS
//--------------------------------------------------------
@boxed-layout-bg-image-path: "../img/boxed-bg.jpg";
//COLORS
//--------------------------------------------------------
//Primary
@light-blue: #3c8dbc;
//Danger
@red: #dd4b39;
//Success
@green: #00a65a;
//Info
@aqua: #00c0ef;
//Warning
@yellow: #f39c12;
@blue: #0073b7;
@navy: #001F3F;
@teal: #39CCCC;
@olive: #3D9970;
@lime: #01FF70;
@orange: #FF851B;
@fuchsia: #F012BE;
@purple: #605ca8;
@maroon: #D81B60;
@black: #111;
@gray-lte: #d2d6de;
//LAYOUT
//--------------------------------------------------------
//Side bar and logo width
@sidebar-width: 230px;
//Boxed layout maximum width
@boxed-layout-max-width: 1024px;
//When the logo should go to the top of the screen
@screen-header-collapse: @screen-xs-max;
//Link colors (Aka: <a> tags)
@link-color: @light-blue;
@link-hover-color: lighten(@link-color, 15%);
//Body background (Affects main content background only)
@body-bg: #ecf0f5;
//SIDEBAR SKINS
//--------------------------------------------------------
//Dark sidebar
@sidebar-dark-bg: #222d32;
@sidebar-dark-hover-bg: darken(@sidebar-dark-bg, 2%);
@sidebar-dark-color: lighten(@sidebar-dark-bg, 60%);
@sidebar-dark-hover-color: #fff;
@sidebar-dark-submenu-bg: lighten(@sidebar-dark-bg, 5%);
@sidebar-dark-submenu-color: lighten(@sidebar-dark-submenu-bg, 40%);
@sidebar-dark-submenu-hover-color: #fff;
//Light sidebar
@sidebar-light-bg: #f9fafc;
@sidebar-light-hover-bg: lighten(#f0f0f1, 1.5%);
@sidebar-light-color: #444;
@sidebar-light-hover-color: #000;
@sidebar-light-submenu-bg: @sidebar-light-hover-bg;
@sidebar-light-submenu-color: #777;
@sidebar-light-submenu-hover-color: #000;
//CONTROL SIDEBAR
//--------------------------------------------------------
@control-sidebar-width: @sidebar-width;
//BOXES
//--------------------------------------------------------
@box-border-color: #f4f4f4;
@box-border-radius: 3px;
@box-footer-bg: #fff;
@box-boxshadow: 0 1px 1px rgba(0, 0, 0, .1);
@box-padding: 10px;
//Box variants
@box-default-border-top-color: #d2d6de;
//BUTTONS
//--------------------------------------------------------
@btn-boxshadow: none;
//PROGRESS BARS
//--------------------------------------------------------
@progress-bar-border-radius: 1px;
@progress-bar-sm-border-radius: 1px;
@progress-bar-xs-border-radius: 1px;
//FORMS
//--------------------------------------------------------
@input-radius: 0;
//BUTTONS
//--------------------------------------------------------
//Border radius for non flat buttons
@btn-border-radius: 3px;
//DIRECT CHAT
//--------------------------------------------------------
@direct-chat-height: 250px;
@direct-chat-default-msg-bg: @gray-lte;
@direct-chat-default-font-color: #444;
@direct-chat-default-msg-border-color: @gray-lte;
//CHAT WIDGET
//--------------------------------------------------------
@attachment-border-radius: 3px;
//TRANSITIONS SETTINGS
//--------------------------------------------------------
//Transition global options
@transition-speed: .3s;
@transition-fn: ease-in-out;
| {
"pile_set_name": "Github"
} |
Triage Working Group
======
https://en.wikipedia.org/wiki/Triage
Triage is the process of determining the priority of patients' treatments
based on the severity of their condition or likelihood of recovery with and
without treatment.
Within the Open Enclave SDK project, we use the term "triage" to refer to one
stage in the
[process of bug management](https://en.wikipedia.org/wiki/Software_bug#Bug_management),
namely the classification of incoming issues and PRs.
How We Do It
------------
Held once a week, a regular triage meeting provides a touch-point for
development cycle alignment and ensures that no new-contributor issue goes
untouched for too long.
*Note(Aeva) we don't currently have a process to measure or track issue health
**after triage** to ensure that issues do not become stale ... but we should*
Meetings
--------
Triage meetings are open to everyone. If you have recently filed an issue or a
PR, you may want to attend the next triage meeting and help with classification.
**Regular Triage meeting**: Weekly on Mondays at 11:00 PT (Pacific Time)
Join Zoom Meeting
https://zoom.us/j/98206186947?pwd=blBEU01BMlQrb3M4bGVkcTIxSkxpdz09
Meeting ID: 982 0618 6947
Password: 488946
One tap mobile
+12532158782,,98206186947#,,1#,488946# US (Tacoma)
+16699006833,,98206186947#,,1#,488946# US (San Jose)
Dial by your location
+1 253 215 8782 US (Tacoma)
+1 669 900 6833 US (San Jose)
+1 346 248 7799 US (Houston)
+1 301 715 8592 US (Germantown)
+1 312 626 6799 US (Chicago)
+1 929 205 6099 US (New York)
888 788 0099 US Toll-free
877 853 5247 US Toll-free
Find your local number: https://zoom.us/u/aeB89f1z5V
[(convert to your local timezone)](https://www.thetimezoneconverter.com/?t=11:00&tz=PT%20%28Pacific%20Time%29)
Meeting Chair
-------------
* @radhikaj
| {
"pile_set_name": "Github"
} |
#pragma once
#ifndef GWEN_CONTROLS_DIALOGS_FILESAVE_H
#define GWEN_CONTROLS_DIALOGS_FILESAVE_H
#include "Gwen/Gwen.h"
namespace Gwen
{
namespace Dialogs
{
// Usage:
//
// Gwen::Dialogs::FileOpen( true, "Open Map", "C:\my\folder\", "My Map Format|*.bmf", this, &MyClass::OpenFilename );
//
//
// Callback function, for success
//
typedef void (Event::Handler::*FileSaveSuccessCallback)( const String& filename );
//
// The REAL function.
// If bUseSystem is used, it may use the system's modal dialog - which
// will steal focus and pause the rest of GWEN until it's continued.
//
void GWEN_EXPORT FileSaveEx( bool bUseSystem, const String& Name, const String& StartPath, const String& Extension, Gwen::Event::Handler* pHandler = NULL, Gwen::Event::Handler::FunctionStr fnCallback = NULL );
//
// Templated function simply to avoid having to manually cast the callback function.
//
template< typename A>
void FileSave( bool bUseSystem, const String& Name, const String& StartPath, const String& Extension, Gwen::Event::Handler* pHandler = NULL, A fnCallback = NULL )
{
FileSaveEx( bUseSystem, Name, StartPath, Extension, pHandler, (Gwen::Event::Handler::FunctionStr)fnCallback );
}
}
}
#endif
| {
"pile_set_name": "Github"
} |
#
# Copyright (c) 2007, Cameron Rich
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the axTLS project nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
all:
include ../config/.config
include ../config/makefile.conf
all:
ifdef CONFIG_C_SAMPLES
$(MAKE) -C c
endif
ifdef CONFIG_CSHARP_SAMPLES
$(MAKE) -C csharp
endif
ifdef CONFIG_VBNET_SAMPLES
$(MAKE) -C vbnet
endif
ifdef CONFIG_JAVA_SAMPLES
$(MAKE) -C java
endif
ifdef CONFIG_PERL_SAMPLES
$(MAKE) -C perl
endif
ifdef CONFIG_LUA_SAMPLES
$(MAKE) -C lua
endif
clean::
$(MAKE) -C c clean
$(MAKE) -C csharp clean
$(MAKE) -C vbnet clean
$(MAKE) -C java clean
$(MAKE) -C perl clean
$(MAKE) -C lua clean
| {
"pile_set_name": "Github"
} |
// This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
{}{{var d{func a<f:f.s}}}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayBossFncInvoiceQueryModel import AlipayBossFncInvoiceQueryModel
class AlipayBossFncInvoiceQueryRequest(object):
def __init__(self, biz_model=None):
self._biz_model = biz_model
self._biz_content = None
self._version = "1.0"
self._terminal_type = None
self._terminal_info = None
self._prod_code = None
self._notify_url = None
self._return_url = None
self._udf_params = None
self._need_encrypt = False
@property
def biz_model(self):
return self._biz_model
@biz_model.setter
def biz_model(self, value):
self._biz_model = value
@property
def biz_content(self):
return self._biz_content
@biz_content.setter
def biz_content(self, value):
if isinstance(value, AlipayBossFncInvoiceQueryModel):
self._biz_content = value
else:
self._biz_content = AlipayBossFncInvoiceQueryModel.from_alipay_dict(value)
@property
def version(self):
return self._version
@version.setter
def version(self, value):
self._version = value
@property
def terminal_type(self):
return self._terminal_type
@terminal_type.setter
def terminal_type(self, value):
self._terminal_type = value
@property
def terminal_info(self):
return self._terminal_info
@terminal_info.setter
def terminal_info(self, value):
self._terminal_info = value
@property
def prod_code(self):
return self._prod_code
@prod_code.setter
def prod_code(self, value):
self._prod_code = value
@property
def notify_url(self):
return self._notify_url
@notify_url.setter
def notify_url(self, value):
self._notify_url = value
@property
def return_url(self):
return self._return_url
@return_url.setter
def return_url(self, value):
self._return_url = value
@property
def udf_params(self):
return self._udf_params
@udf_params.setter
def udf_params(self, value):
if not isinstance(value, dict):
return
self._udf_params = value
@property
def need_encrypt(self):
return self._need_encrypt
@need_encrypt.setter
def need_encrypt(self, value):
self._need_encrypt = value
def add_other_text_param(self, key, value):
if not self.udf_params:
self.udf_params = dict()
self.udf_params[key] = value
def get_params(self):
params = dict()
params[P_METHOD] = 'alipay.boss.fnc.invoice.query'
params[P_VERSION] = self.version
if self.biz_model:
params[P_BIZ_CONTENT] = json.dumps(obj=self.biz_model.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
if self.biz_content:
if hasattr(self.biz_content, 'to_alipay_dict'):
params['biz_content'] = json.dumps(obj=self.biz_content.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
else:
params['biz_content'] = self.biz_content
if self.terminal_type:
params['terminal_type'] = self.terminal_type
if self.terminal_info:
params['terminal_info'] = self.terminal_info
if self.prod_code:
params['prod_code'] = self.prod_code
if self.notify_url:
params['notify_url'] = self.notify_url
if self.return_url:
params['return_url'] = self.return_url
if self.udf_params:
params.update(self.udf_params)
return params
def get_multipart_params(self):
multipart_params = dict()
return multipart_params
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.