text stringlengths 2 99k | meta dict |
|---|---|
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: Templates\CSharp\Model\ComplexType.cs.tt
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using Newtonsoft.Json;
/// <summary>
/// The type Report.
/// </summary>
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[JsonConverter(typeof(DerivedTypeConverter))]
public partial class Report
{
/// <summary>
/// Initializes a new instance of the <see cref="Report"/> class.
/// </summary>
public Report()
{
this.ODataType = "microsoft.graph.report";
}
/// <summary>
/// Gets or sets content.
/// Not yet documented
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "content", Required = Newtonsoft.Json.Required.Default)]
public Stream Content { get; set; }
/// <summary>
/// Gets or sets additional data.
/// </summary>
[JsonExtensionData(ReadData = true)]
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>
/// Gets or sets @odata.type.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "@odata.type", Required = Newtonsoft.Json.Required.Default)]
public string ODataType { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
function ts = shrink(t,f)
% im_shr = shrink(im0, f)
%
% It shrinks (spatially) an image into a factor f
% in each dimension. It does it by cropping the
% Fourier transform of the image.
% JPM, 5/1/95.
% Revised so it can work also with exponents of 3 factors: JPM 5/2003
[my,mx] = size(t);
T = fftshift(fft2(t))/f^2;
Ts = zeros(my/f,mx/f);
cy = ceil(my/2);
cx = ceil(mx/2);
evenmy = (my/2==floor(my/2));
evenmx = (mx/2==floor(mx/2));
y1 = cy + 2*evenmy - floor(my/(2*f));
y2 = cy + floor(my/(2*f));
x1 = cx + 2*evenmx - floor(mx/(2*f));
x2 = cx + floor(mx/(2*f));
Ts(1+evenmy:my/f,1+evenmx:mx/f)=T(y1:y2,x1:x2);
if evenmy,
Ts(1+evenmy:my/f,1)=(T(y1:y2,x1-1)+T(y1:y2,x2+1))/2;
end
if evenmx,
Ts(1,1+evenmx:mx/f)=(T(y1-1,x1:x2)+T(y2+1,x1:x2))/2;
end
if evenmy & evenmx,
Ts(1,1)=(T(y1-1,x1-1)+T(y1-1,x2+1)+T(y2+1,x1-1)+T(y2+1,x2+1))/4;
end
Ts = fftshift(Ts);
Ts = shift(Ts, [1 1] - [evenmy evenmx]);
ts = ifft2(Ts);
| {
"pile_set_name": "Github"
} |
DROP PROCEDURE IF EXISTS add_migration;
delimiter ??
CREATE PROCEDURE `add_migration`()
BEGIN
DECLARE v INT DEFAULT 1;
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20171212192732');
IF v=0 THEN
INSERT INTO `migrations` VALUES ('20171212192732');
-- Add your query below.
-- "Anengineer" (wrong quest text)
-- https://github.com/LightsHope/server/issues/964
-- Tainted Memorandum id 3115
-- Progress text Anengineer --> $N
UPDATE `quest_template` SET `RequestItemsText`='Wonderful! You got my memorandum obviously.$b$bIgnore the fools around you, $N. The Holy Light?! The sword and shield?! These aren\'t paths for ones as open minded as us. Look at what "normal" magic did to our home. Coupled with those damned tinkerers, our race almost became extinct. And now we have to rely on the dwarves-- they\'d rather spend time allying with humans than help us rebuild our own home. We\'re like second-class citizens. Have you seen the way they look at us?' WHERE `entry`=3115 AND `patch`=0;
-- Completion text Anengineer --> $N
UPDATE `quest_template` SET `OfferRewardText`='But none of that matters. What matters is that you\'ve seen your own Holy Light! You know where power truly comes from. You realize that having our own allies is much more... prudent. Special allies. Allies that, no matter the task, will obey till their last breath.$b$bAnd that\'s where I come in, $N. I can train you in the beginnings of those special powers. Seek me out often and I will do what I can to teach you more spells.' WHERE `entry`=3115 AND `patch`=0;
-- Beginnings id 1599
-- Completion text Anengineer --> $N
UPDATE `quest_template` SET `OfferRewardText`='Very good, very good! You\'ve done well, $N. Perhaps the interest that is being shown in you is deserved, after all.$b$bThat\'ll be for the others to decide--assuming your imp doesn\'t overpower you and nip your career in the bud. For now, I\'m satisfied that you\'ll probably survive your first few months as a $C.$b$bA word about the imp, $N. As a $R knows, don\'t let its size fool you, its magic can be very dangerous.' WHERE `entry`=1599 AND `patch`=0;
-- Quest 9321 has TBC name
-- https://github.com/LightsHope/server/issues/839
-- Quest: Major Healing Potion
UPDATE `quest_template` SET `Title`='Major Healing Potion' WHERE `entry`=9321 AND `patch`=9;
-- Lorgalis Manuscript is zone drop instead of only object drop.
-- https://github.com/LightsHope/server/issues/907
-- Delete from incorrect mobs
DELETE FROM `creature_loot_template` WHERE `entry`=4805 AND `item`=5359 AND `groupid`=0;
DELETE FROM `creature_loot_template` WHERE `entry`=4807 AND `item`=5359 AND `groupid`=0;
DELETE FROM `creature_loot_template` WHERE `entry`=4822 AND `item`=5359 AND `groupid`=0;
DELETE FROM `creature_loot_template` WHERE `entry`=4824 AND `item`=5359 AND `groupid`=0;
-- Delete from incorrect container
-- `gameobject_loot_template` `entry`=2774 contains quest items involved in 2 quests
-- Move one (secret note) to new entry
UPDATE `gameobject_loot_template` SET `entry`='2775' WHERE `entry`=2774 AND `item`=12765;
-- Move secret note container to the new loot template
UPDATE `gameobject_template` SET `data1`='2775' WHERE `entry`=176344;
-- Box for the quest "Ammo For Rumbleshot"
-- https://github.com/LightsHope/server/issues/140
-- Don't give player item at quest accept
UPDATE `quest_template` SET `SrcItemId`='0', `SrcItemCount`='0' WHERE `entry`=5541 AND `patch`=0;
-- Remove "this item starts quest tag" on ammo item
UPDATE `item_template` SET `startquest`='0' WHERE `entry`=13850 AND `patch`=0;
-- End of migration.
END IF;
END??
delimiter ;
CALL add_migration();
DROP PROCEDURE IF EXISTS add_migration;
| {
"pile_set_name": "Github"
} |
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#define BOOST_SHARED_PTR_HPP_INCLUDED
//
// shared_ptr.hpp
//
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
// Copyright (c) 2001-2008 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
//
#include <boost/smart_ptr/shared_ptr.hpp>
#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
| {
"pile_set_name": "Github"
} |
#!/bin/bash
#
# This test is for basic NAT functionality: snat, dnat, redirect, masquerade.
#
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
ret=0
test_inet_nat=true
sfx=$(mktemp -u "XXXXXXXX")
ns0="ns0-$sfx"
ns1="ns1-$sfx"
ns2="ns2-$sfx"
cleanup()
{
for i in 0 1 2; do ip netns del ns$i-"$sfx";done
}
nft --version > /dev/null 2>&1
if [ $? -ne 0 ];then
echo "SKIP: Could not run test without nft tool"
exit $ksft_skip
fi
ip -Version > /dev/null 2>&1
if [ $? -ne 0 ];then
echo "SKIP: Could not run test without ip tool"
exit $ksft_skip
fi
ip netns add "$ns0"
if [ $? -ne 0 ];then
echo "SKIP: Could not create net namespace $ns0"
exit $ksft_skip
fi
trap cleanup EXIT
ip netns add "$ns1"
if [ $? -ne 0 ];then
echo "SKIP: Could not create net namespace $ns1"
exit $ksft_skip
fi
ip netns add "$ns2"
if [ $? -ne 0 ];then
echo "SKIP: Could not create net namespace $ns2"
exit $ksft_skip
fi
ip link add veth0 netns "$ns0" type veth peer name eth0 netns "$ns1" > /dev/null 2>&1
if [ $? -ne 0 ];then
echo "SKIP: No virtual ethernet pair device support in kernel"
exit $ksft_skip
fi
ip link add veth1 netns "$ns0" type veth peer name eth0 netns "$ns2"
ip -net "$ns0" link set lo up
ip -net "$ns0" link set veth0 up
ip -net "$ns0" addr add 10.0.1.1/24 dev veth0
ip -net "$ns0" addr add dead:1::1/64 dev veth0
ip -net "$ns0" link set veth1 up
ip -net "$ns0" addr add 10.0.2.1/24 dev veth1
ip -net "$ns0" addr add dead:2::1/64 dev veth1
for i in 1 2; do
ip -net ns$i-$sfx link set lo up
ip -net ns$i-$sfx link set eth0 up
ip -net ns$i-$sfx addr add 10.0.$i.99/24 dev eth0
ip -net ns$i-$sfx route add default via 10.0.$i.1
ip -net ns$i-$sfx addr add dead:$i::99/64 dev eth0
ip -net ns$i-$sfx route add default via dead:$i::1
done
bad_counter()
{
local ns=$1
local counter=$2
local expect=$3
local tag=$4
echo "ERROR: $counter counter in $ns has unexpected value (expected $expect) at $tag" 1>&2
ip netns exec $ns nft list counter inet filter $counter 1>&2
}
check_counters()
{
ns=$1
local lret=0
cnt=$(ip netns exec $ns nft list counter inet filter ns0in | grep -q "packets 1 bytes 84")
if [ $? -ne 0 ]; then
bad_counter $ns ns0in "packets 1 bytes 84" "check_counters 1"
lret=1
fi
cnt=$(ip netns exec $ns nft list counter inet filter ns0out | grep -q "packets 1 bytes 84")
if [ $? -ne 0 ]; then
bad_counter $ns ns0out "packets 1 bytes 84" "check_counters 2"
lret=1
fi
expect="packets 1 bytes 104"
cnt=$(ip netns exec $ns nft list counter inet filter ns0in6 | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter $ns ns0in6 "$expect" "check_counters 3"
lret=1
fi
cnt=$(ip netns exec $ns nft list counter inet filter ns0out6 | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter $ns ns0out6 "$expect" "check_counters 4"
lret=1
fi
return $lret
}
check_ns0_counters()
{
local ns=$1
local lret=0
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0in | grep -q "packets 0 bytes 0")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns0in "packets 0 bytes 0" "check_ns0_counters 1"
lret=1
fi
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns0in6 "packets 0 bytes 0"
lret=1
fi
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0out | grep -q "packets 0 bytes 0")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns0out "packets 0 bytes 0" "check_ns0_counters 2"
lret=1
fi
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns0out6 "packets 0 bytes 0" "check_ns0_counters3 "
lret=1
fi
for dir in "in" "out" ; do
expect="packets 1 bytes 84"
cnt=$(ip netns exec "$ns0" nft list counter inet filter ${ns}${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" $ns$dir "$expect" "check_ns0_counters 4"
lret=1
fi
expect="packets 1 bytes 104"
cnt=$(ip netns exec "$ns0" nft list counter inet filter ${ns}${dir}6 | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" $ns$dir6 "$expect" "check_ns0_counters 5"
lret=1
fi
done
return $lret
}
reset_counters()
{
for i in 0 1 2;do
ip netns exec ns$i-$sfx nft reset counters inet > /dev/null
done
}
test_local_dnat6()
{
local family=$1
local lret=0
local IPF=""
if [ $family = "inet" ];then
IPF="ip6"
fi
ip netns exec "$ns0" nft -f /dev/stdin <<EOF
table $family nat {
chain output {
type nat hook output priority 0; policy accept;
ip6 daddr dead:1::99 dnat $IPF to dead:2::99
}
}
EOF
if [ $? -ne 0 ]; then
echo "SKIP: Could not add add $family dnat hook"
return $ksft_skip
fi
# ping netns1, expect rewrite to netns2
ip netns exec "$ns0" ping -q -c 1 dead:1::99 > /dev/null
if [ $? -ne 0 ]; then
lret=1
echo "ERROR: ping6 failed"
return $lret
fi
expect="packets 0 bytes 0"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns1$dir "$expect" "test_local_dnat6 1"
lret=1
fi
done
expect="packets 1 bytes 104"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat6 2"
lret=1
fi
done
# expect 0 count in ns1
expect="packets 0 bytes 0"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_local_dnat6 3"
lret=1
fi
done
# expect 1 packet in ns2
expect="packets 1 bytes 104"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat6 4"
lret=1
fi
done
test $lret -eq 0 && echo "PASS: ipv6 ping to $ns1 was $family NATted to $ns2"
ip netns exec "$ns0" nft flush chain ip6 nat output
return $lret
}
test_local_dnat()
{
local family=$1
local lret=0
local IPF=""
if [ $family = "inet" ];then
IPF="ip"
fi
ip netns exec "$ns0" nft -f /dev/stdin <<EOF 2>/dev/null
table $family nat {
chain output {
type nat hook output priority 0; policy accept;
ip daddr 10.0.1.99 dnat $IPF to 10.0.2.99
}
}
EOF
if [ $? -ne 0 ]; then
if [ $family = "inet" ];then
echo "SKIP: inet nat tests"
test_inet_nat=false
return $ksft_skip
fi
echo "SKIP: Could not add add $family dnat hook"
return $ksft_skip
fi
# ping netns1, expect rewrite to netns2
ip netns exec "$ns0" ping -q -c 1 10.0.1.99 > /dev/null
if [ $? -ne 0 ]; then
lret=1
echo "ERROR: ping failed"
return $lret
fi
expect="packets 0 bytes 0"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns1$dir "$expect" "test_local_dnat 1"
lret=1
fi
done
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat 2"
lret=1
fi
done
# expect 0 count in ns1
expect="packets 0 bytes 0"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_local_dnat 3"
lret=1
fi
done
# expect 1 packet in ns2
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat 4"
lret=1
fi
done
test $lret -eq 0 && echo "PASS: ping to $ns1 was $family NATted to $ns2"
ip netns exec "$ns0" nft flush chain $family nat output
reset_counters
ip netns exec "$ns0" ping -q -c 1 10.0.1.99 > /dev/null
if [ $? -ne 0 ]; then
lret=1
echo "ERROR: ping failed"
return $lret
fi
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns1$dir "$expect" "test_local_dnat 5"
lret=1
fi
done
expect="packets 0 bytes 0"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat 6"
lret=1
fi
done
# expect 1 count in ns1
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns0$dir "$expect" "test_local_dnat 7"
lret=1
fi
done
# expect 0 packet in ns2
expect="packets 0 bytes 0"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat 8"
lret=1
fi
done
test $lret -eq 0 && echo "PASS: ping to $ns1 OK after $family nat output chain flush"
return $lret
}
test_masquerade6()
{
local family=$1
local natflags=$2
local lret=0
ip netns exec "$ns0" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 via ipv6"
return 1
lret=1
fi
expect="packets 1 bytes 104"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns2$dir "$expect" "test_masquerade6 1"
lret=1
fi
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns1$dir "$expect" "test_masquerade6 2"
lret=1
fi
done
reset_counters
# add masquerading rule
ip netns exec "$ns0" nft -f /dev/stdin <<EOF
table $family nat {
chain postrouting {
type nat hook postrouting priority 0; policy accept;
meta oif veth0 masquerade $natflags
}
}
EOF
if [ $? -ne 0 ]; then
echo "SKIP: Could not add add $family masquerade hook"
return $ksft_skip
fi
ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 with active $family masquerade $natflags"
lret=1
fi
# ns1 should have seen packets from ns0, due to masquerade
expect="packets 1 bytes 104"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_masquerade6 3"
lret=1
fi
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns1$dir "$expect" "test_masquerade6 4"
lret=1
fi
done
# ns1 should not have seen packets from ns2, due to masquerade
expect="packets 0 bytes 0"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_masquerade6 5"
lret=1
fi
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns1$dir "$expect" "test_masquerade6 6"
lret=1
fi
done
ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 with active ipv6 masquerade $natflags (attempt 2)"
lret=1
fi
ip netns exec "$ns0" nft flush chain $family nat postrouting
if [ $? -ne 0 ]; then
echo "ERROR: Could not flush $family nat postrouting" 1>&2
lret=1
fi
test $lret -eq 0 && echo "PASS: $family IPv6 masquerade $natflags for $ns2"
return $lret
}
test_masquerade()
{
local family=$1
local natflags=$2
local lret=0
ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from "$ns2" $natflags"
lret=1
fi
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns2$dir "$expect" "test_masquerade 1"
lret=1
fi
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns1$dir "$expect" "test_masquerade 2"
lret=1
fi
done
reset_counters
# add masquerading rule
ip netns exec "$ns0" nft -f /dev/stdin <<EOF
table $family nat {
chain postrouting {
type nat hook postrouting priority 0; policy accept;
meta oif veth0 masquerade $natflags
}
}
EOF
if [ $? -ne 0 ]; then
echo "SKIP: Could not add add $family masquerade hook"
return $ksft_skip
fi
ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 with active $family masquerade $natflags"
lret=1
fi
# ns1 should have seen packets from ns0, due to masquerade
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 3"
lret=1
fi
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns1$dir "$expect" "test_masquerade 4"
lret=1
fi
done
# ns1 should not have seen packets from ns2, due to masquerade
expect="packets 0 bytes 0"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 5"
lret=1
fi
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns1$dir "$expect" "test_masquerade 6"
lret=1
fi
done
ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 with active ip masquerade $natflags (attempt 2)"
lret=1
fi
ip netns exec "$ns0" nft flush chain $family nat postrouting
if [ $? -ne 0 ]; then
echo "ERROR: Could not flush $family nat postrouting" 1>&2
lret=1
fi
test $lret -eq 0 && echo "PASS: $family IP masquerade $natflags for $ns2"
return $lret
}
test_redirect6()
{
local family=$1
local lret=0
ip netns exec "$ns0" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannnot ping $ns1 from $ns2 via ipv6"
lret=1
fi
expect="packets 1 bytes 104"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns2$dir "$expect" "test_redirect6 1"
lret=1
fi
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns1$dir "$expect" "test_redirect6 2"
lret=1
fi
done
reset_counters
# add redirect rule
ip netns exec "$ns0" nft -f /dev/stdin <<EOF
table $family nat {
chain prerouting {
type nat hook prerouting priority 0; policy accept;
meta iif veth1 meta l4proto icmpv6 ip6 saddr dead:2::99 ip6 daddr dead:1::99 redirect
}
}
EOF
if [ $? -ne 0 ]; then
echo "SKIP: Could not add add $family redirect hook"
return $ksft_skip
fi
ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 via ipv6 with active $family redirect"
lret=1
fi
# ns1 should have seen no packets from ns2, due to redirection
expect="packets 0 bytes 0"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_redirect6 3"
lret=1
fi
done
# ns0 should have seen packets from ns2, due to masquerade
expect="packets 1 bytes 104"
for dir in "in6" "out6" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_redirect6 4"
lret=1
fi
done
ip netns exec "$ns0" nft delete table $family nat
if [ $? -ne 0 ]; then
echo "ERROR: Could not delete $family nat table" 1>&2
lret=1
fi
test $lret -eq 0 && echo "PASS: $family IPv6 redirection for $ns2"
return $lret
}
test_redirect()
{
local family=$1
local lret=0
ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2"
lret=1
fi
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" $ns2$dir "$expect" "test_redirect 1"
lret=1
fi
cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns2" ns1$dir "$expect" "test_redirect 2"
lret=1
fi
done
reset_counters
# add redirect rule
ip netns exec "$ns0" nft -f /dev/stdin <<EOF
table $family nat {
chain prerouting {
type nat hook prerouting priority 0; policy accept;
meta iif veth1 ip protocol icmp ip saddr 10.0.2.99 ip daddr 10.0.1.99 redirect
}
}
EOF
if [ $? -ne 0 ]; then
echo "SKIP: Could not add add $family redirect hook"
return $ksft_skip
fi
ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
if [ $? -ne 0 ] ; then
echo "ERROR: cannot ping $ns1 from $ns2 with active $family ip redirect"
lret=1
fi
# ns1 should have seen no packets from ns2, due to redirection
expect="packets 0 bytes 0"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns1" ns0$dir "$expect" "test_redirect 3"
lret=1
fi
done
# ns0 should have seen packets from ns2, due to masquerade
expect="packets 1 bytes 84"
for dir in "in" "out" ; do
cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect")
if [ $? -ne 0 ]; then
bad_counter "$ns0" ns0$dir "$expect" "test_redirect 4"
lret=1
fi
done
ip netns exec "$ns0" nft delete table $family nat
if [ $? -ne 0 ]; then
echo "ERROR: Could not delete $family nat table" 1>&2
lret=1
fi
test $lret -eq 0 && echo "PASS: $family IP redirection for $ns2"
return $lret
}
# ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99
for i in 0 1 2; do
ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF
table inet filter {
counter ns0in {}
counter ns1in {}
counter ns2in {}
counter ns0out {}
counter ns1out {}
counter ns2out {}
counter ns0in6 {}
counter ns1in6 {}
counter ns2in6 {}
counter ns0out6 {}
counter ns1out6 {}
counter ns2out6 {}
map nsincounter {
type ipv4_addr : counter
elements = { 10.0.1.1 : "ns0in",
10.0.2.1 : "ns0in",
10.0.1.99 : "ns1in",
10.0.2.99 : "ns2in" }
}
map nsincounter6 {
type ipv6_addr : counter
elements = { dead:1::1 : "ns0in6",
dead:2::1 : "ns0in6",
dead:1::99 : "ns1in6",
dead:2::99 : "ns2in6" }
}
map nsoutcounter {
type ipv4_addr : counter
elements = { 10.0.1.1 : "ns0out",
10.0.2.1 : "ns0out",
10.0.1.99: "ns1out",
10.0.2.99: "ns2out" }
}
map nsoutcounter6 {
type ipv6_addr : counter
elements = { dead:1::1 : "ns0out6",
dead:2::1 : "ns0out6",
dead:1::99 : "ns1out6",
dead:2::99 : "ns2out6" }
}
chain input {
type filter hook input priority 0; policy accept;
counter name ip saddr map @nsincounter
icmpv6 type { "echo-request", "echo-reply" } counter name ip6 saddr map @nsincounter6
}
chain output {
type filter hook output priority 0; policy accept;
counter name ip daddr map @nsoutcounter
icmpv6 type { "echo-request", "echo-reply" } counter name ip6 daddr map @nsoutcounter6
}
}
EOF
done
sleep 3
# test basic connectivity
for i in 1 2; do
ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 > /dev/null
if [ $? -ne 0 ];then
echo "ERROR: Could not reach other namespace(s)" 1>&2
ret=1
fi
ip netns exec "$ns0" ping -c 1 -q dead:$i::99 > /dev/null
if [ $? -ne 0 ];then
echo "ERROR: Could not reach other namespace(s) via ipv6" 1>&2
ret=1
fi
check_counters ns$i-$sfx
if [ $? -ne 0 ]; then
ret=1
fi
check_ns0_counters ns$i
if [ $? -ne 0 ]; then
ret=1
fi
reset_counters
done
if [ $ret -eq 0 ];then
echo "PASS: netns routing/connectivity: $ns0 can reach $ns1 and $ns2"
fi
reset_counters
test_local_dnat ip
test_local_dnat6 ip6
reset_counters
$test_inet_nat && test_local_dnat inet
$test_inet_nat && test_local_dnat6 inet
for flags in "" "fully-random"; do
reset_counters
test_masquerade ip $flags
test_masquerade6 ip6 $flags
reset_counters
$test_inet_nat && test_masquerade inet $flags
$test_inet_nat && test_masquerade6 inet $flags
done
reset_counters
test_redirect ip
test_redirect6 ip6
reset_counters
$test_inet_nat && test_redirect inet
$test_inet_nat && test_redirect6 inet
if [ $ret -ne 0 ];then
echo -n "FAIL: "
nft --version
fi
exit $ret
| {
"pile_set_name": "Github"
} |
#ifndef CLASS_NCINE_TEXTURELOADERKTX
#define CLASS_NCINE_TEXTURELOADERKTX
#include <cstdint> // for header
#include "ITextureLoader.h"
namespace ncine {
/// KTX texture loader
class TextureLoaderKtx : public ITextureLoader
{
public:
explicit TextureLoaderKtx(const char *filename);
explicit TextureLoaderKtx(nctl::UniquePtr<IFile> fileHandle);
private:
static const int KtxIdentifierLength = 12;
static uint8_t fileIdentifier_[KtxIdentifierLength];
/// Header for the KTX format
struct KtxHeader
{
uint8_t identifier[KtxIdentifierLength];
uint32_t endianess;
uint32_t glType;
uint32_t glTypeSize;
uint32_t glFormat;
uint32_t glInternalFormat;
uint32_t glBaseInternalFormat;
uint32_t pixelWidth;
uint32_t pixelHeight;
uint32_t pixelDepth;
uint32_t numberOfArrayElements;
uint32_t numberOfFaces;
uint32_t numberOfMipmapLevels;
uint32_t bytesOfKeyValueData;
};
/// Reads the KTX header and fills the corresponding structure
void readHeader(KtxHeader &header);
/// Parses the KTX header to determine its format
void parseFormat(const KtxHeader &header);
};
}
#endif
| {
"pile_set_name": "Github"
} |
# git clean
> Remove untracked files from the working tree.
> More information: <https://git-scm.com/docs/git-clean>.
- Delete files that are not tracked by git:
`git clean`
- Interactively delete files that are not tracked by git:
`git clean -i`
- Show what files would be deleted without actually deleting them:
`git clean --dry-run`
- Forcefully delete files that are not tracked by git:
`git clean -f`
- Forcefully delete directories that are not tracked by git:
`git clean -fd`
- Delete untracked files, including ignored files in `.gitignore` and `.git/info/exclude`:
`git clean -x`
| {
"pile_set_name": "Github"
} |
//
// ViewController+Streamer.swift
// TimePitchStreamer
//
// Created by Syed Haris Ali on 6/5/18.
// Copyright © 2018 Ausome Apps LLC. All rights reserved.
//
import Foundation
import AudioStreamer
import os.log
import UIKit
extension ViewController: StreamingDelegate {
func streamer(_ streamer: Streaming, failedDownloadWithError error: Error, forURL url: URL) {
os_log("%@ - %d [%@]", log: ViewController.logger, type: .debug, #function, #line, error.localizedDescription)
let alert = UIAlertController(title: "Download Failed", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { _ in
alert.dismiss(animated: true, completion: nil)
}))
show(alert, sender: self)
}
func streamer(_ streamer: Streaming, updatedDownloadProgress progress: Float, forURL url: URL) {
os_log("%@ - %d [%.2f]", log: ViewController.logger, type: .debug, #function, #line, progress)
progressSlider.progress = progress
}
func streamer(_ streamer: Streaming, changedState state: StreamingState) {
os_log("%@ - %d [%@]", log: ViewController.logger, type: .debug, #function, #line, String(describing: state))
switch state {
case .playing:
playButton.setImage(#imageLiteral(resourceName: "pause"), for: .normal)
case .paused, .stopped:
playButton.setImage(#imageLiteral(resourceName: "play"), for: .normal)
}
}
func streamer(_ streamer: Streaming, updatedCurrentTime currentTime: TimeInterval) {
os_log("%@ - %d [%@]", log: ViewController.logger, type: .debug, #function, #line, currentTime.toMMSS())
if !isSeeking {
progressSlider.value = Float(currentTime)
currentTimeLabel.text = currentTime.toMMSS()
}
}
func streamer(_ streamer: Streaming, updatedDuration duration: TimeInterval) {
let formattedDuration = duration.toMMSS()
os_log("%@ - %d [%@]", log: ViewController.logger, type: .debug, #function, #line, formattedDuration)
durationTimeLabel.text = formattedDuration
durationTimeLabel.isEnabled = true
playButton.isEnabled = true
progressSlider.isEnabled = true
progressSlider.minimumValue = 0.0
progressSlider.maximumValue = Float(duration)
}
}
| {
"pile_set_name": "Github"
} |
package stacktrace
import (
"path/filepath"
"runtime"
"strings"
)
// NewFrame returns a new stack frame for the provided information
func NewFrame(pc uintptr, file string, line int) Frame {
fn := runtime.FuncForPC(pc)
if fn == nil {
return Frame{}
}
pack, name := parseFunctionName(fn.Name())
return Frame{
Line: line,
File: filepath.Base(file),
Package: pack,
Function: name,
}
}
func parseFunctionName(name string) (string, string) {
i := strings.LastIndex(name, ".")
if i == -1 {
return "", name
}
return name[:i], name[i+1:]
}
// Frame contains all the information for a stack frame within a go program
type Frame struct {
File string
Function string
Package string
Line int
}
| {
"pile_set_name": "Github"
} |
========================================================================
控制台应用程序:DllToShellCode 项目概述
========================================================================
应用程序向导已为您创建了此 DllToShellCode 应用程序。
本文件概要介绍组成 DllToShellCode 应用程序的每个文件的内容。
DllToShellCode.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
DllToShellCode.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
DllToShellCode.cpp
这是主应用程序源文件。
/////////////////////////////////////////////////////////////////////////////
其他标准文件:
StdAfx.h, StdAfx.cpp
这些文件用于生成名为 DllToShellCode.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
/////////////////////////////////////////////////////////////////////////////
其他注释:
应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
/////////////////////////////////////////////////////////////////////////////
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Source: extern/util.js | Blend4Web API Reference</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: extern/util.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import register from "../util/register.js";
import m_assert_fact from "../util/assert.js";
import m_compat_fact from "../intern/compat.js";
import m_generator_fact from "../util/generator.js";
import m_print_fact from "../intern/print.js";
import * as m_quat from "../libs/gl_matrix/quat.js";
import * as m_tbn from "../intern/tbn.js";
import * as m_util from "../intern/util.js";
import * as m_vec3 from "../libs/gl_matrix/vec3.js";
/**
* Contains various utility methods for math, searching etc.
* @module util
*/
function Util(ns, exports) {
var m_assert = m_assert_fact(ns);
var m_compat = m_compat_fact(ns);
var m_generator = m_generator_fact(ns);
var m_print = m_print_fact(ns);
/**
* X-axis vector.
* @const {Vec3} module:util.AXIS_X
*/
exports.AXIS_X = new Float32Array([1, 0, 0]);
/**
* Y-axis vector.
* @const {Vec3} module:util.AXIS_Y
*/
exports.AXIS_Y = new Float32Array([0, 1, 0]);
/**
* Z-axis vector.
* @const {Vec3} module:util.AXIS_Z
*/
exports.AXIS_Z = new Float32Array([0, 0, 1]);
/**
* Negative x-axis vector.
* @const {Vec3} module:util.AXIS_MX
*/
exports.AXIS_MX = new Float32Array([-1, 0, 0]);
/**
* Negative y-axis vector.
* @const {Vec3} module:util.AXIS_MY
*/
exports.AXIS_MY = new Float32Array([ 0,-1, 0]);
/**
* Negative z-axis vector.
* @const {Vec3} module:util.AXIS_MZ
*/
exports.AXIS_MZ = new Float32Array([ 0, 0,-1]);
/**
* Rotation sequence enum.
* @typedef {number} RotationSequence
*/
/**
* Rotation sequence: XYX.
* @const {RotationSequence} module:util.XYX
*/
exports.XYX = m_util.XYX;
/**
* Rotation sequence: YZY.
* @const {RotationSequence} module:util.YZY
*/
exports.YZY = m_util.YZY;
/**
* Rotation sequence: ZXZ.
* @const {RotationSequence} module:util.ZXZ
*/
exports.ZXZ = m_util.ZXZ;
/**
* Rotation sequence: XZX.
* @const {RotationSequence} module:util.XZX
*/
exports.XZX = m_util.XZX;
/**
* Rotation sequence: YXY.
* @const {RotationSequence} module:util.YXY
*/
exports.YXY = m_util.YXY;
/**
* Rotation sequence: ZYZ.
* @const {RotationSequence} module:util.ZYZ
*/
exports.ZYZ = m_util.ZYZ;
/**
* Rotation sequence: XYZ.
* @const {RotationSequence} module:util.XYZ
*/
exports.XYZ = m_util.XYZ;
/**
* Rotation sequence: YZX.
* @const {RotationSequence} module:util.YZX
*/
exports.YZX = m_util.YZX;
/**
* Rotation sequence: ZXY.
* @const {RotationSequence} module:util.ZXY
*/
exports.ZXY = m_util.ZXY;
/**
* Rotation sequence: XZY.
* @const {RotationSequence} module:util.XZY
*/
exports.XZY = m_util.XZY;
/**
* Rotation sequence: YXZ.
* @const {RotationSequence} module:util.YXZ
*/
exports.YXZ = m_util.YXZ;
/**
* Rotation sequence: ZYX.
* @const {RotationSequence} module:util.ZYX
*/
exports.ZYX = m_util.ZYX;
/**
* Create a new Float32Array.
* @param {number|Array|TypedArray} param Constructor param
* @returns {Float32Array} New Float32Array.
*/
exports.f32 = function(param) {
param = param || 0;
return m_util.f32(param);
}
/**
* Abort the program if assertion is false.
* @method module:util.assert
* @param {boolean} Boolean expression result
* @deprecated Do not use it anymore
*/
exports.assert = m_assert.assert;
/**
* Search for object in array.
* @method module:util.keyfind
* @param {string} key Key
* @param {*} value Value
* @param {Object[]} array Array of objects.
* @returns {Object[]} Array of found objects.
*/
exports.keyfind = m_util.keyfind;
/**
* Search for object in array.
* @method module:util.keysearch
* @param {string} key Key.
* @param {*} value Value.
* @param {Array} array Array of objects.
* @returns {?Object} First found object or null.
*/
exports.keysearch = m_util.keysearch;
/**
* Extract rotation from the 4x4 matrix to quaternion vector.
* @method module:util.matrix_to_quat
* @param {Mat4} matrix 4x4 matrix
* @returns {Quat} Quaternion
*/
exports.matrix_to_quat = function(matrix) {
return m_util.matrix_to_quat(matrix);
}
/**
* Convert euler angles in the ZYX intrinsic system to quaternion.
* @method module:util.euler_to_quat
* @param {Euler} euler Euler angles. The angles order: an angle of the rotation around the x axis,
* an angle of the rotation around the y axis, an angle of the rotation around the z axis.
* @param {Quat} [quat] Destination quaternion vector.
* @returns {Quat} Quaternion vector.
*/
exports.euler_to_quat = function(euler, quat) {
if (!quat)
quat = new Float32Array(4);
return m_util.euler_to_quat(euler, quat);
}
/**
* Convert Euler angles in the ordered intrinsic system to quaternion.
* @method module:util.ordered_angles_to_quat
* @param {Euler} angles Ordered Euler angles. Euler angles have the same order as
* the intrinsic rotation sequence.
* @param {RotationSequence} order Intrinsic rotation sequence.
* @param {Quat} [quat] Destination quaternion vector.
* @returns {Quat} Quaternion vector.
*/
exports.ordered_angles_to_quat = function(angles, order, quat) {
if (!quat)
quat = m_quat.create();
return m_util.ordered_angles_to_quat(angles, order, quat);
}
/**
* Convert quaternion to Euler angles in the ordered intrinsic system.
* @method module:util.quat_to_ordered_angles
* @param {Quat} quat Quaternion vector.
* @param {RotationSequence} order Intrinsic rotation sequence.
* @param {Euler} [angles] Destination Euler angles vector. Euler angles have
* the same order as the intrinsic rotation sequence.
* @returns {Euler} Euler angles vector.
*/
exports.quat_to_ordered_angles = function(quat, order, angles) {
if (!angles)
angles = m_vec3.create();
return m_util.quat_to_ordered_angles(quat, order, angles);
}
/**
* Convert quaternion rotation to euler rotation.
* @method module:util.quat_to_euler
* @param {Quat} quat Quaternion vector
* @param {Euler} [euler] Destination euler vector
* @returns {Euler} Euler vector
*/
exports.quat_to_euler = function(quat, euler) {
if (!euler)
euler = new Float32Array(3);
return m_util.quat_to_euler(quat, euler);
}
/**
* Get sign of the number.
* @method module:util.sign
* @param {number} value Input value
* @returns {number} -1,0,1 for negative, zero or positive number accordingly
*/
exports.sign = m_util.sign;
/**
* Clamp the number.
* @method module:util.clamp
* @param {number} value Input value
* @param {number} min Lower bound
* @param {number} max Upper bound
* @returns {number} Clamped value
*/
exports.clamp = m_util.clamp;
/**
* Convert quaternion rotation to a directional vector.
* @method module:util.quat_to_dir
* @param {Quat} quat Rotation quaternion
* @param {Vec3} ident Identity vector
* @param {Vec3} [dest] Destination vector
* @returns {Vec3} Destination vector.
*/
exports.quat_to_dir = m_util.quat_to_dir;
/**
* Project camera quaternion rotation on a horizontal plane.
* @method module:util.ground_project_cam_quat
* @param {Quat} quat Source quaternion.
* @param {Quat} [dest] Destination quaternion.
* @returns {Quat} Destination quaternion.
*/
exports.ground_project_cam_quat = function(quat, dest) {
return m_util.quat_project(quat, m_util.AXIS_MZ, m_util.AXIS_Z, m_util.AXIS_Y, dest);
}
/**
* Transform a camera quaternion to a mesh quaternion.
* @method module:util.cam_quat_to_mesh_quat
* @param {Quat} cam_quat Camera quaternion.
* @param {Quat} [dest] Destination quaternion.
* @returns {Quat} Destination quaternion.
*/
exports.cam_quat_to_mesh_quat = function(cam_quat, dest) {
return m_util.cam_quat_to_mesh_quat(cam_quat, dest);
}
/**
* Perform quaternion projection.
* @method module:util.quat_project
* @param {Quat} quat Quaternion to project.
* @param {Vec3} quat_ident_dir Direction corresponding to the identity quaternion.
* @param {Vec3} plane Plane direction (normal).
* @param {Vec3} plane_ident_dir Direction corresponding to the
* identity quaternion in a plane.
* @param {Quat} [dest=quat.create()] Destination quaternion.
* @returns {Quat} Destination quaternion.
*/
exports.quat_project = function(quat, quat_ident_dir,
plane, plane_ident_dir, dest) {
if (m_vec3.dot(plane, plane_ident_dir) != 0) {
m_print.error("Wrong in-plane direction");
return null;
}
return m_util.quat_project(quat, quat_ident_dir,
plane, plane_ident_dir, dest);
}
exports.hash_code = function() {
return m_generator.hash_code.apply(m_generator, arguments);
}
/**
* Perform exponential smoothing.
* @method module:util.smooth
* @param {number} curr Current value.
* @param {number} last Last smoothed value.
* @param {number} delta Time delta.
* @param {number} period Mean lifetime for averaging.
* @returns {number} Smoothed value
*/
exports.smooth = m_util.smooth;
/**
* Perform exponential smoothing (vector form).
* @method module:util.smooth_v
* @param {Float32Array} curr Current value.
* @param {Float32Array} last Last smoothed value.
* @param {Float32Array} delta Time delta.
* @param {Float32Array} period Mean lifetime for averaging.
* @param {Float32Array} [dest] Smoothed value
* @returns {Float32Array} Smoothed value
*/
exports.smooth_v = m_util.smooth_v;
/**
* Check if object is a vector.
* @method module:util.is_vector
* @param {Object} o Object
* @param {number} [dimension=0] Dimension, allow any if not specified
* @returns {boolean} Check result
*/
exports.is_vector = m_util.is_vector;
/**
* Correct the camera quaternion rotation.
* @method module:util.correct_cam_quat_up
* @param {Quat} quat Quaternion to correct
* @param {boolean} up_only Disable upside-down camera view
*/
exports.correct_cam_quat_up = m_util.correct_cam_quat_up;
exports.quat_to_angle_axis = m_util.quat_to_angle_axis;
exports.random_from_array = m_util.random_from_array;
exports.horizontal_direction = m_util.horizontal_direction;
/**
* Convert radian angle into range [0, 2PI)
* @method module:util.angle_wrap_0_2pi
* @param {number} angle Angle in radians
* @returns {number} Converted angle
*/
exports.angle_wrap_0_2pi = m_util.angle_wrap_0_2pi;
/**
* Convert radian angle into custom range [from, to)
* @method module:util.angle_wrap_periodic
* @param {number} angle Angle in radians
* @param {number} from Value from in radians
* @param {number} to Value to in radians
* @returns {number} Converted angle
*/
exports.angle_wrap_periodic = m_util.angle_wrap_periodic;
/**
* Smooth step function.
* @method module:util.smooth_step
* @param {number} t Input value.
* @param {number} min Min clamping value.
* @param {number} max Max clamping value.
* @returns {number} Result value.
*/
exports.smooth_step = m_util.smooth_step;
/**
* Linear interpolation function.
* @method module:util.lerp
* @param {number} t Input value.
* @param {number} from Start interpolation value.
* @param {number} to End interpolation value.
* @returns {number} Result value.
*/
exports.lerp = m_util.lerp;
/**
* Convert degrees to radians.
* @method module:util.deg_to_rad
* @param {number} degrees Angle in degrees.
* @returns {number} Angle in radians.
*/
exports.deg_to_rad = m_util.deg_to_rad;
/**
* Convert radians to degrees.
* @method module:util.rad_to_deg
* @param {number} radians Angle in radians.
* @returns {number} Angle in degrees.
*/
exports.rad_to_deg = m_util.rad_to_deg;
/**
* Convert directional vector to quaternion.
* @method module:util.dir_to_quat
* @param {Vec3} dir Directional vector.
* @param {Vec3} ident Identity vector
* @param {Quat} [dest] Destination quaternion
* @returns {Quat} Destination quaternion
*/
exports.dir_to_quat = m_util.dir_to_quat;
/**
* Check if Internet Explorer 11 is using.
* @method module:util.is_ie11
* @returns {boolean} Check result.
*/
exports.is_ie11 = m_compat.is_ie11;
/**
* Generate flat array of TBN quaternions
* @method module:util.gen_tbn_quats
* @param {Float32Array} normals Flat array of normals.
* @param {Float32Array} [tangents] Flat array of tangents.
* @returns {Float32Array} Flat array of quaternions.
* @deprecated Do not use it anymore
*/
exports.gen_tbn_quats = function(normals, tangents) {
m_print.error_once("util.gen_tbn_quats() deprecated. " +
"Do not use it anymore.");
return m_tbn.from_norm_tan(normals, tangents);
}
/**
* Returns the integer part of the given number.
* @method module:util.trunc
* @param {number} value Original value.
* @returns {number} Truncated value.
*/
exports.trunc = m_util.trunc;
}
var util_factory = register("util", Util);
export default util_factory;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-anchors.html">anchors</a></li><li><a href="module-animation.html">animation</a></li><li><a href="module-app.html">app</a></li><li><a href="module-armature.html">armature</a></li><li><a href="module-assets.html">assets</a></li><li><a href="module-camera.html">camera</a></li><li><a href="module-camera_anim.html">camera_anim</a></li><li><a href="module-config.html">config</a></li><li><a href="module-constraints.html">constraints</a></li><li><a href="module-container.html">container</a></li><li><a href="module-controls.html">controls</a></li><li><a href="module-data.html">data</a></li><li><a href="module-debug.html">debug</a></li><li><a href="module-fps.html">fps</a></li><li><a href="module-geometry.html">geometry</a></li><li><a href="module-gp_conf.html">gp_conf</a></li><li><a href="module-gyroscope.html">gyroscope</a></li><li><a href="module-hmd.html">hmd</a></li><li><a href="module-hmd_conf.html">hmd_conf</a></li><li><a href="module-hud.html">hud</a></li><li><a href="module-input.html">input</a></li><li><a href="module-lights.html">lights</a></li><li><a href="module-logic_nodes.html">logic_nodes</a></li><li><a href="module-main.html">main</a></li><li><a href="module-mat3.html">mat3</a></li><li><a href="module-mat4.html">mat4</a></li><li><a href="module-material.html">material</a></li><li><a href="module-math.html">math</a></li><li><a href="module-mixer.html">mixer</a></li><li><a href="module-mouse.html">mouse</a></li><li><a href="module-nla.html">nla</a></li><li><a href="module-npc_ai.html">npc_ai</a></li><li><a href="module-objects.html">objects</a></li><li><a href="module-particles.html">particles</a></li><li><a href="module-physics.html">physics</a></li><li><a href="module-preloader.html">preloader</a></li><li><a href="module-quat.html">quat</a></li><li><a href="module-rgb.html">rgb</a></li><li><a href="module-rgba.html">rgba</a></li><li><a href="module-scenes.html">scenes</a></li><li><a href="module-screen.html">screen</a></li><li><a href="module-screenshooter.html">screenshooter</a></li><li><a href="module-sfx.html">sfx</a></li><li><a href="module-storage.html">storage</a></li><li><a href="module-textures.html">textures</a></li><li><a href="module-time.html">time</a></li><li><a href="module-transform.html">transform</a></li><li><a href="module-tsr.html">tsr</a></li><li><a href="module-util.html">util</a></li><li><a href="module-vec3.html">vec3</a></li><li><a href="module-vec4.html">vec4</a></li><li><a href="module-version.html">version</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Blend4Web API Reference (generated by JSDoc 3.5.5 on Wed Jun 06 2018 11:49:10 GMT+0300 (MSK))
<a href="https://www.blend4web.com">www.blend4web.com</a>
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function() {
if (window.document.domain != "www.blend4web.com")
return;
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter24512171 = new Ya.Metrika({
id:24512171,
clickmap:false,
trackLinks:true,
accurateTrackBounce:true
});
} catch(e) { }
});
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/watch.js";
if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else { f(); }
})(document, window, "yandex_metrika_callbacks");
})();
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/24512171" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2001-2011 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(BOOST_SPIRIT_LEXER_MAR_22_2007_1008PM)
#define BOOST_SPIRIT_LEXER_MAR_22_2007_1008PM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/lex/lexer/terminals.hpp>
#include <boost/spirit/home/lex/lexer/token_def.hpp>
#include <boost/spirit/home/lex/lexer/char_token_def.hpp>
#include <boost/spirit/home/lex/lexer/string_token_def.hpp>
#include <boost/spirit/home/lex/lexer/sequence.hpp>
#include <boost/spirit/home/lex/lexer/action.hpp>
#include <boost/spirit/home/lex/lexer/lexer.hpp>
#endif
| {
"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.
#ifndef CONTENT_BROWSER_CONVERSIONS_CONVERSION_REPORTER_IMPL_H_
#define CONTENT_BROWSER_CONVERSIONS_CONVERSION_REPORTER_IMPL_H_
#include <stdint.h>
#include <memory>
#include <queue>
#include <vector>
#include "base/callback.h"
#include "base/containers/flat_map.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "content/browser/conversions/conversion_manager_impl.h"
#include "content/browser/conversions/conversion_report.h"
#include "content/common/content_export.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace base {
class Clock;
} // namespace base
namespace content {
class StoragePartition;
class StoragePartitionImpl;
// This class is responsible for managing the dispatch of conversion reports to
// a ConversionReporterImpl::NetworkSender. It maintains a queue of reports and
// a timer to ensure all reports are sent at the correct time, since the time in
// which a conversion report is sent is potentially sensitive information.
// Created and owned by ConversionManager.
class CONTENT_EXPORT ConversionReporterImpl
: public ConversionManagerImpl::ConversionReporter {
public:
// This class is responsible for sending conversion reports to their
// configured endpoints over the network.
class NetworkSender {
public:
virtual ~NetworkSender() = default;
// Callback used to notify caller that the requested report has been sent.
using ReportSentCallback = base::OnceCallback<void()>;
// Generates and sends a conversion report matching |report|. This should
// generate a secure POST quest with no-credentials. Does not persist the
// raw pointer.
virtual void SendReport(ConversionReport* report,
ReportSentCallback sent_callback) = 0;
};
ConversionReporterImpl(StoragePartition* storage_partition,
const base::Clock* clock);
ConversionReporterImpl(const ConversionReporterImpl&) = delete;
ConversionReporterImpl& operator=(const ConversionReporterImpl&) = delete;
~ConversionReporterImpl() override;
// ConversionManagerImpl::ConversionReporter:
void AddReportsToQueue(
std::vector<ConversionReport> reports,
base::RepeatingCallback<void(int64_t)> report_sent_callback) override;
void SetNetworkSenderForTesting(
std::unique_ptr<NetworkSender> network_sender);
private:
void MaybeScheduleNextReport();
void SendNextReport();
// Called when a conversion report sent via NetworkSender::SendReport() has
// completed loading.
void OnReportSent(int64_t conversion_id);
// Comparator used to order ConversionReports by their report time, with the
// smallest time at the top of |report_queue_|.
struct ReportComparator {
bool operator()(const std::unique_ptr<ConversionReport>& a,
const std::unique_ptr<ConversionReport>& b) const;
};
// Priority queue which holds reports that are yet to be sent. Reports are
// removed from the queue when they are delivered to the NetworkSender.
std::priority_queue<std::unique_ptr<ConversionReport>,
std::vector<std::unique_ptr<ConversionReport>>,
ReportComparator>
report_queue_;
// Map of all conversion ids that are currently in |report_queue| or are being
// sent by |network_sender_|, and their associated report sent callbacks. The
// number of concurrent conversion reports being sent at any time is expected
// to be small, so a flat_map is used.
base::flat_map<int64_t, base::OnceCallback<void(int64_t)>>
conversion_report_callbacks_;
const base::Clock* clock_;
// Should never be nullptr, since StoragePartition owns the ConversionManager
// which owns |this|.
StoragePartitionImpl* partition_;
// Timer which signals the next report in |report_queue_| should be sent.
base::OneShotTimer send_report_timer_;
// Responsible for issuing requests to network for report that need to be
// sent. Calls OnReportSent() when a report has finished sending.
//
// Should never be nullptr.
std::unique_ptr<NetworkSender> network_sender_;
};
} // namespace content
#endif // CONTENT_BROWSER_CONVERSIONS_CONVERSION_REPORTER_IMPL_H_
| {
"pile_set_name": "Github"
} |
/* Copyright 2014 Mozilla Foundation
*
* 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.
*/
.textLayer {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
opacity: 0.2;
line-height: 1.0;
}
.textLayer > span {
color: transparent;
position: absolute;
white-space: pre;
cursor: text;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
}
.textLayer .highlight {
margin: -1px;
padding: 1px;
background-color: rgba(180, 0, 170, 1);
border-radius: 4px;
}
.textLayer .highlight.begin {
border-radius: 4px 0px 0px 4px;
}
.textLayer .highlight.end {
border-radius: 0px 4px 4px 0px;
}
.textLayer .highlight.middle {
border-radius: 0px;
}
.textLayer .highlight.selected {
background-color: rgba(0, 100, 0, 1);
}
.textLayer ::-moz-selection {
background: rgba(0, 0, 255, 1);
}
.textLayer ::selection {
background: rgba(0, 0, 255, 1);
}
.textLayer .endOfContent {
display: block;
position: absolute;
left: 0px;
top: 100%;
right: 0px;
bottom: 0px;
z-index: -1;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.textLayer .endOfContent.active {
top: 0px;
}
.annotationLayer section {
position: absolute;
}
.annotationLayer .linkAnnotation > a,
.annotationLayer .buttonWidgetAnnotation.pushButton > a {
position: absolute;
font-size: 1em;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.annotationLayer .linkAnnotation > a:hover,
.annotationLayer .buttonWidgetAnnotation.pushButton > a:hover {
opacity: 0.2;
background: rgba(255, 255, 0, 1);
box-shadow: 0px 2px 10px rgba(255, 255, 0, 1);
}
.annotationLayer .textAnnotation img {
position: absolute;
cursor: pointer;
}
.annotationLayer .textWidgetAnnotation input,
.annotationLayer .textWidgetAnnotation textarea,
.annotationLayer .choiceWidgetAnnotation select,
.annotationLayer .buttonWidgetAnnotation.checkBox input,
.annotationLayer .buttonWidgetAnnotation.radioButton input {
background-color: rgba(0, 54, 255, 0.13);
border: 1px solid transparent;
box-sizing: border-box;
font-size: 9px;
height: 100%;
margin: 0;
padding: 0 3px;
vertical-align: top;
width: 100%;
}
.annotationLayer .choiceWidgetAnnotation select option {
padding: 0;
}
.annotationLayer .buttonWidgetAnnotation.radioButton input {
border-radius: 50%;
}
.annotationLayer .textWidgetAnnotation textarea {
font: message-box;
font-size: 9px;
resize: none;
}
.annotationLayer .textWidgetAnnotation input[disabled],
.annotationLayer .textWidgetAnnotation textarea[disabled],
.annotationLayer .choiceWidgetAnnotation select[disabled],
.annotationLayer .buttonWidgetAnnotation.checkBox input[disabled],
.annotationLayer .buttonWidgetAnnotation.radioButton input[disabled] {
background: none;
border: 1px solid transparent;
cursor: not-allowed;
}
.annotationLayer .textWidgetAnnotation input:hover,
.annotationLayer .textWidgetAnnotation textarea:hover,
.annotationLayer .choiceWidgetAnnotation select:hover,
.annotationLayer .buttonWidgetAnnotation.checkBox input:hover,
.annotationLayer .buttonWidgetAnnotation.radioButton input:hover {
border: 1px solid rgba(0, 0, 0, 1);
}
.annotationLayer .textWidgetAnnotation input:focus,
.annotationLayer .textWidgetAnnotation textarea:focus,
.annotationLayer .choiceWidgetAnnotation select:focus {
background: none;
border: 1px solid transparent;
}
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before {
background-color: rgba(0, 0, 0, 1);
content: '';
display: block;
position: absolute;
}
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after {
height: 80%;
left: 45%;
width: 1px;
}
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after {
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before {
border-radius: 50%;
height: 50%;
left: 30%;
top: 20%;
width: 50%;
}
.annotationLayer .textWidgetAnnotation input.comb {
font-family: monospace;
padding-left: 2px;
padding-right: 0;
}
.annotationLayer .textWidgetAnnotation input.comb:focus {
/*
* Letter spacing is placed on the right side of each character. Hence, the
* letter spacing of the last character may be placed outside the visible
* area, causing horizontal scrolling. We avoid this by extending the width
* when the element has focus and revert this when it loses focus.
*/
width: 115%;
}
.annotationLayer .buttonWidgetAnnotation.checkBox input,
.annotationLayer .buttonWidgetAnnotation.radioButton input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding: 0;
}
.annotationLayer .popupWrapper {
position: absolute;
width: 20em;
}
.annotationLayer .popup {
position: absolute;
z-index: 200;
max-width: 20em;
background-color: rgba(255, 255, 153, 1);
box-shadow: 0px 2px 5px rgba(136, 136, 136, 1);
border-radius: 2px;
padding: 6px;
margin-left: 5px;
cursor: pointer;
font: message-box;
font-size: 9px;
word-wrap: break-word;
}
.annotationLayer .popup > * {
font-size: 9px;
}
.annotationLayer .popup h1 {
display: inline-block;
}
.annotationLayer .popup span {
display: inline-block;
margin-left: 5px;
}
.annotationLayer .popup p {
border-top: 1px solid rgba(51, 51, 51, 1);
margin-top: 2px;
padding-top: 2px;
}
.annotationLayer .highlightAnnotation,
.annotationLayer .underlineAnnotation,
.annotationLayer .squigglyAnnotation,
.annotationLayer .strikeoutAnnotation,
.annotationLayer .freeTextAnnotation,
.annotationLayer .lineAnnotation svg line,
.annotationLayer .squareAnnotation svg rect,
.annotationLayer .circleAnnotation svg ellipse,
.annotationLayer .polylineAnnotation svg polyline,
.annotationLayer .polygonAnnotation svg polygon,
.annotationLayer .caretAnnotation,
.annotationLayer .inkAnnotation svg polyline,
.annotationLayer .stampAnnotation,
.annotationLayer .fileAttachmentAnnotation {
cursor: pointer;
}
.pdfViewer .canvasWrapper {
overflow: hidden;
}
.pdfViewer .page {
direction: ltr;
width: 816px;
height: 1056px;
margin: 1px auto -8px auto;
position: relative;
overflow: visible;
border: 9px solid transparent;
background-clip: content-box;
-webkit-border-image: url(images/shadow.png) 9 9 repeat;
-o-border-image: url(images/shadow.png) 9 9 repeat;
border-image: url(images/shadow.png) 9 9 repeat;
background-color: rgba(255, 255, 255, 1);
}
.pdfViewer.removePageBorders .page {
margin: 0px auto 10px auto;
border: none;
}
.pdfViewer.singlePageView {
display: inline-block;
}
.pdfViewer.singlePageView .page {
margin: 0;
border: none;
}
.pdfViewer.scrollHorizontal, .pdfViewer.scrollWrapped, .spread {
margin-left: 3.5px;
margin-right: 3.5px;
text-align: center;
}
.pdfViewer.scrollHorizontal, .spread {
white-space: nowrap;
}
.pdfViewer.removePageBorders,
.pdfViewer.scrollHorizontal .spread,
.pdfViewer.scrollWrapped .spread {
margin-left: 0;
margin-right: 0;
}
.spread .page,
.pdfViewer.scrollHorizontal .page,
.pdfViewer.scrollWrapped .page,
.pdfViewer.scrollHorizontal .spread,
.pdfViewer.scrollWrapped .spread {
display: inline-block;
vertical-align: middle;
}
.spread .page,
.pdfViewer.scrollHorizontal .page,
.pdfViewer.scrollWrapped .page {
margin-left: -3.5px;
margin-right: -3.5px;
}
.pdfViewer.removePageBorders .spread .page,
.pdfViewer.removePageBorders.scrollHorizontal .page,
.pdfViewer.removePageBorders.scrollWrapped .page {
margin-left: 5px;
margin-right: 5px;
}
.pdfViewer .page canvas {
margin: 0;
display: block;
}
.pdfViewer .page canvas[hidden] {
display: none;
}
.pdfViewer .page .loadingIcon {
position: absolute;
display: block;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: url('images/loading-icon.gif') center no-repeat;
}
.pdfPresentationMode .pdfViewer {
margin-left: 0;
margin-right: 0;
}
.pdfPresentationMode .pdfViewer .page,
.pdfPresentationMode .pdfViewer .spread {
display: block;
}
.pdfPresentationMode .pdfViewer .page,
.pdfPresentationMode .pdfViewer.removePageBorders .page {
margin-left: auto;
margin-right: auto;
}
.pdfPresentationMode:-ms-fullscreen .pdfViewer .page {
margin-bottom: 100% !important;
}
.pdfPresentationMode:-webkit-full-screen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}
.pdfPresentationMode:-moz-full-screen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}
.pdfPresentationMode:fullscreen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}
:root {
--sidebar-width: 200px;
--sidebar-transition-duration: 200ms;
--sidebar-transition-timing-function: ease;
}
* {
padding: 0;
margin: 0;
}
html {
height: 100%;
width: 100%;
/* Font size is needed to make the activity bar the correct size. */
font-size: 10px;
}
body {
height: 100%;
width: 100%;
background-color: rgba(64, 64, 64, 1);
background-image: url(images/texture.png);
}
body,
input,
button,
select {
font: message-box;
outline: none;
}
.hidden {
display: none !important;
}
[hidden] {
display: none !important;
}
#viewerContainer.pdfPresentationMode:-ms-fullscreen {
top: 0px !important;
overflow: hidden !important;
}
#viewerContainer.pdfPresentationMode:-ms-fullscreen::-ms-backdrop {
background-color: rgba(0, 0, 0, 1);
}
#viewerContainer.pdfPresentationMode:-webkit-full-screen {
top: 0px;
border-top: 2px solid rgba(0, 0, 0, 0);
background-color: rgba(0, 0, 0, 1);
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-webkit-user-select: none;
user-select: none;
}
#viewerContainer.pdfPresentationMode:-moz-full-screen {
top: 0px;
border-top: 2px solid rgba(0, 0, 0, 0);
background-color: rgba(0, 0, 0, 1);
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-moz-user-select: none;
user-select: none;
}
#viewerContainer.pdfPresentationMode:-ms-fullscreen {
top: 0px;
border-top: 2px solid rgba(0, 0, 0, 0);
background-color: rgba(0, 0, 0, 1);
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-ms-user-select: none;
user-select: none;
}
#viewerContainer.pdfPresentationMode:fullscreen {
top: 0px;
border-top: 2px solid rgba(0, 0, 0, 0);
background-color: rgba(0, 0, 0, 1);
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.pdfPresentationMode:-webkit-full-screen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:-moz-full-screen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:-ms-fullscreen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:fullscreen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:-webkit-full-screen .textLayer > span {
cursor: none;
}
.pdfPresentationMode:-moz-full-screen .textLayer > span {
cursor: none;
}
.pdfPresentationMode:-ms-fullscreen .textLayer > span {
cursor: none;
}
.pdfPresentationMode:fullscreen .textLayer > span {
cursor: none;
}
.pdfPresentationMode.pdfPresentationModeControls > *,
.pdfPresentationMode.pdfPresentationModeControls .textLayer > span {
cursor: default;
}
#outerContainer {
width: 100%;
height: 100%;
position: relative;
}
#sidebarContainer {
position: absolute;
top: 32px;
bottom: 0;
width: 200px;
width: var(--sidebar-width);
visibility: hidden;
z-index: 100;
border-top: 1px solid rgba(51, 51, 51, 1);
-webkit-transition-duration: 200ms;
transition-duration: 200ms;
-webkit-transition-duration: var(--sidebar-transition-duration);
transition-duration: var(--sidebar-transition-duration);
-webkit-transition-timing-function: ease;
transition-timing-function: ease;
-webkit-transition-timing-function: var(--sidebar-transition-timing-function);
transition-timing-function: var(--sidebar-transition-timing-function);
}
html[dir='ltr'] #sidebarContainer {
-webkit-transition-property: left;
transition-property: left;
left: -200px;
left: calc(0px - var(--sidebar-width));
}
html[dir='rtl'] #sidebarContainer {
-webkit-transition-property: right;
transition-property: right;
right: -200px;
right: calc(0px - var(--sidebar-width));
}
.loadingInProgress #sidebarContainer {
top: 36px;
}
#outerContainer.sidebarResizing #sidebarContainer {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
-webkit-transition-duration: 0s;
transition-duration: 0s;
/* Prevent e.g. the thumbnails being selected when the sidebar is resized. */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#outerContainer.sidebarMoving #sidebarContainer,
#outerContainer.sidebarOpen #sidebarContainer {
visibility: visible;
}
html[dir='ltr'] #outerContainer.sidebarOpen #sidebarContainer {
left: 0px;
}
html[dir='rtl'] #outerContainer.sidebarOpen #sidebarContainer {
right: 0px;
}
#mainContainer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
min-width: 320px;
}
#sidebarContent {
top: 32px;
bottom: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}
html[dir='ltr'] #sidebarContent {
left: 0;
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25);
}
html[dir='rtl'] #sidebarContent {
right: 0;
box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25);
}
#viewerContainer {
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
top: 32px;
right: 0;
bottom: 0;
left: 0;
outline: none;
}
#viewerContainer:not(.pdfPresentationMode) {
-webkit-transition-duration: 200ms;
transition-duration: 200ms;
-webkit-transition-duration: var(--sidebar-transition-duration);
transition-duration: var(--sidebar-transition-duration);
-webkit-transition-timing-function: ease;
transition-timing-function: ease;
-webkit-transition-timing-function: var(--sidebar-transition-timing-function);
transition-timing-function: var(--sidebar-transition-timing-function);
}
html[dir='ltr'] #viewerContainer {
box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.05);
}
html[dir='rtl'] #viewerContainer {
box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}
#outerContainer.sidebarResizing #viewerContainer {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
-webkit-transition-duration: 0s;
transition-duration: 0s;
}
html[dir='ltr'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) {
-webkit-transition-property: left;
transition-property: left;
left: 200px;
left: var(--sidebar-width);
}
html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) {
-webkit-transition-property: right;
transition-property: right;
right: 200px;
right: var(--sidebar-width);
}
.toolbar {
position: relative;
left: 0;
right: 0;
z-index: 9999;
cursor: default;
}
#toolbarContainer {
width: 100%;
}
#toolbarSidebar {
width: 100%;
height: 32px;
background-color: rgba(66, 66, 66, 1); /* fallback */
background-image: url(images/texture.png),
-webkit-gradient(linear, left top, left bottom, from(rgba(77, 77, 77, 0.99)), to(rgba(64, 64, 64, 0.95)));
background-image: url(images/texture.png),
linear-gradient(rgba(77, 77, 77, 0.99), rgba(64, 64, 64, 0.95));
}
html[dir='ltr'] #toolbarSidebar {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25),
inset 0 -1px 0 rgba(255, 255, 255, 0.05),
0 1px 0 rgba(0, 0, 0, 0.15),
0 0 1px rgba(0, 0, 0, 0.1);
}
html[dir='rtl'] #toolbarSidebar {
box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25),
inset 0 1px 0 rgba(255, 255, 255, 0.05),
0 1px 0 rgba(0, 0, 0, 0.15),
0 0 1px rgba(0, 0, 0, 0.1);
}
#sidebarResizer {
position: absolute;
top: 0;
bottom: 0;
width: 6px;
z-index: 200;
cursor: ew-resize;
}
html[dir='ltr'] #sidebarResizer {
right: -6px;
}
html[dir='rtl'] #sidebarResizer {
left: -6px;
}
#toolbarContainer, .findbar, .secondaryToolbar {
position: relative;
height: 32px;
background-color: rgba(71, 71, 71, 1); /* fallback */
background-image: url(images/texture.png),
-webkit-gradient(linear, left top, left bottom, from(rgba(82, 82, 82, 0.99)), to(rgba(69, 69, 69, 0.95)));
background-image: url(images/texture.png),
linear-gradient(rgba(82, 82, 82, 0.99), rgba(69, 69, 69, 0.95));
}
html[dir='ltr'] #toolbarContainer, .findbar, .secondaryToolbar {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.15),
inset 0 -1px 0 rgba(255, 255, 255, 0.05),
0 1px 0 rgba(0, 0, 0, 0.15),
0 1px 1px rgba(0, 0, 0, 0.1);
}
html[dir='rtl'] #toolbarContainer, .findbar, .secondaryToolbar {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.15),
inset 0 -1px 0 rgba(255, 255, 255, 0.05),
0 1px 0 rgba(0, 0, 0, 0.15),
0 1px 1px rgba(0, 0, 0, 0.1);
}
#toolbarViewer {
height: 32px;
}
#loadingBar {
position: relative;
width: 100%;
height: 4px;
background-color: rgba(51, 51, 51, 1);
border-bottom: 1px solid rgba(51, 51, 51, 1);
}
#loadingBar .progress {
position: absolute;
top: 0;
left: 0;
width: 0%;
height: 100%;
background-color: rgba(221, 221, 221, 1);
overflow: hidden;
-webkit-transition: width 200ms;
transition: width 200ms;
}
@-webkit-keyframes progressIndeterminate {
0% { left: -142px; }
100% { left: 0; }
}
@keyframes progressIndeterminate {
0% { left: -142px; }
100% { left: 0; }
}
#loadingBar .progress.indeterminate {
background-color: rgba(153, 153, 153, 1);
-webkit-transition: none;
transition: none;
}
#loadingBar .progress.indeterminate .glimmer {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: calc(100% + 150px);
background: repeating-linear-gradient(135deg,
rgba(187, 187, 187, 1) 0, rgba(153, 153, 153, 1) 5px,
rgba(153, 153, 153, 1) 45px, rgba(221, 221, 221, 1) 55px,
rgba(221, 221, 221, 1) 95px, rgba(187, 187, 187, 1) 100px);
-webkit-animation: progressIndeterminate 950ms linear infinite;
animation: progressIndeterminate 950ms linear infinite;
}
.findbar, .secondaryToolbar {
top: 32px;
position: absolute;
z-index: 10000;
height: auto;
min-width: 16px;
padding: 0px 6px 0px 6px;
margin: 4px 2px 4px 2px;
color: rgba(217, 217, 217, 1);
font-size: 12px;
line-height: 14px;
text-align: left;
cursor: default;
}
.findbar {
min-width: 300px;
}
.findbar > div {
height: 32px;
}
.findbar.wrapContainers > div {
clear: both;
}
.findbar.wrapContainers > div#findbarMessageContainer {
height: auto;
}
html[dir='ltr'] .findbar {
left: 68px;
}
html[dir='rtl'] .findbar {
right: 68px;
}
.findbar label {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#findInput {
width: 200px;
}
#findInput::-webkit-input-placeholder {
color: rgba(191, 191, 191, 1);
}
#findInput::-moz-placeholder {
font-style: italic;
}
#findInput:-ms-input-placeholder {
font-style: italic;
}
#findInput::-ms-input-placeholder {
font-style: italic;
}
#findInput::placeholder {
font-style: italic;
}
#findInput[data-status="pending"] {
background-image: url(images/loading-small.png);
background-repeat: no-repeat;
background-position: right;
}
html[dir='rtl'] #findInput[data-status="pending"] {
background-position: left;
}
.secondaryToolbar {
padding: 6px;
height: auto;
z-index: 30000;
}
html[dir='ltr'] .secondaryToolbar {
right: 4px;
}
html[dir='rtl'] .secondaryToolbar {
left: 4px;
}
#secondaryToolbarButtonContainer {
max-width: 200px;
max-height: 400px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
margin-bottom: -4px;
}
#secondaryToolbarButtonContainer.hiddenScrollModeButtons > .scrollModeButtons,
#secondaryToolbarButtonContainer.hiddenSpreadModeButtons > .spreadModeButtons {
display: none !important;
}
.doorHanger,
.doorHangerRight {
border: 1px solid rgba(0, 0, 0, 0.5);
border-radius: 2px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.doorHanger:after, .doorHanger:before,
.doorHangerRight:after, .doorHangerRight:before {
bottom: 100%;
border: solid rgba(0, 0, 0, 0);
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.doorHanger:after,
.doorHangerRight:after {
border-bottom-color: rgba(82, 82, 82, 0.99);
border-width: 8px;
}
.doorHanger:before,
.doorHangerRight:before {
border-bottom-color: rgba(0, 0, 0, 0.5);
border-width: 9px;
}
html[dir='ltr'] .doorHanger:after,
html[dir='rtl'] .doorHangerRight:after {
left: 13px;
margin-left: -8px;
}
html[dir='ltr'] .doorHanger:before,
html[dir='rtl'] .doorHangerRight:before {
left: 13px;
margin-left: -9px;
}
html[dir='rtl'] .doorHanger:after,
html[dir='ltr'] .doorHangerRight:after {
right: 13px;
margin-right: -8px;
}
html[dir='rtl'] .doorHanger:before,
html[dir='ltr'] .doorHangerRight:before {
right: 13px;
margin-right: -9px;
}
#findResultsCount {
background-color: rgba(217, 217, 217, 1);
color: rgba(82, 82, 82, 1);
text-align: center;
padding: 3px 4px;
}
#findMsg {
font-style: italic;
color: rgba(166, 183, 208, 1);
}
#findMsg:empty {
display: none;
}
#findInput.notFound {
background-color: rgba(255, 102, 102, 1);
}
#toolbarViewerMiddle {
position: absolute;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}
html[dir='ltr'] #toolbarViewerLeft,
html[dir='rtl'] #toolbarViewerRight {
float: left;
}
html[dir='ltr'] #toolbarViewerRight,
html[dir='rtl'] #toolbarViewerLeft {
float: right;
}
html[dir='ltr'] #toolbarViewerLeft > *,
html[dir='ltr'] #toolbarViewerMiddle > *,
html[dir='ltr'] #toolbarViewerRight > *,
html[dir='ltr'] .findbar * {
position: relative;
float: left;
}
html[dir='rtl'] #toolbarViewerLeft > *,
html[dir='rtl'] #toolbarViewerMiddle > *,
html[dir='rtl'] #toolbarViewerRight > *,
html[dir='rtl'] .findbar * {
position: relative;
float: right;
}
html[dir='ltr'] .splitToolbarButton {
margin: 3px 2px 4px 0;
display: inline-block;
}
html[dir='rtl'] .splitToolbarButton {
margin: 3px 0 4px 2px;
display: inline-block;
}
html[dir='ltr'] .splitToolbarButton > .toolbarButton {
border-radius: 0;
float: left;
}
html[dir='rtl'] .splitToolbarButton > .toolbarButton {
border-radius: 0;
float: right;
}
.toolbarButton,
.secondaryToolbarButton,
.overlayButton {
border: 0 none;
background: none;
width: 32px;
height: 25px;
}
.toolbarButton > span {
display: inline-block;
width: 0;
height: 0;
overflow: hidden;
}
.toolbarButton[disabled],
.secondaryToolbarButton[disabled],
.overlayButton[disabled] {
opacity: .5;
}
.splitToolbarButton.toggled .toolbarButton {
margin: 0;
}
.splitToolbarButton:hover > .toolbarButton,
.splitToolbarButton:focus > .toolbarButton,
.splitToolbarButton.toggled > .toolbarButton,
.toolbarButton.textButton {
background-color: rgba(0, 0, 0, 0.12);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, 0.35);
border-color: rgba(0, 0, 0, 0.32) rgba(0, 0, 0, 0.38) rgba(0, 0, 0, 0.42);
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.15) inset,
0 1px 0 rgba(255, 255, 255, 0.05);
}
.splitToolbarButton > .toolbarButton:hover,
.splitToolbarButton > .toolbarButton:focus,
.dropdownToolbarButton:hover,
.overlayButton:hover,
.overlayButton:focus,
.toolbarButton.textButton:hover,
.toolbarButton.textButton:focus {
background-color: rgba(0,0,0,0.2);
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.15) inset,
0 0 1px rgba(0, 0, 0, 0.05);
z-index: 199;
}
.dropdownToolbarButton:hover {
background-color: rgba(0, 0, 0, 0.26);
}
.splitToolbarButton > .toolbarButton {
position: relative;
}
html[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child,
html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child {
position: relative;
margin: 0;
margin-right: -1px;
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
border-right-color: rgba(0, 0, 0, 0);
}
html[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child,
html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child {
position: relative;
margin: 0;
margin-left: -1px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
border-left-color: rgba(0, 0, 0, 0);
}
.splitToolbarButtonSeparator {
padding: 8px 0;
width: 1px;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
display: inline-block;
margin: 5px 0;
}
html[dir='ltr'] .splitToolbarButtonSeparator {
float: left;
}
html[dir='rtl'] .splitToolbarButtonSeparator {
float: right;
}
.splitToolbarButton:hover > .splitToolbarButtonSeparator,
.splitToolbarButton.toggled > .splitToolbarButtonSeparator {
padding: 12px 0;
margin: 1px 0;
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.toolbarButton,
.dropdownToolbarButton,
.secondaryToolbarButton,
.overlayButton {
min-width: 16px;
padding: 2px 6px 0;
border: 1px solid rgba(0, 0, 0, 0);
border-radius: 2px;
color: rgba(255, 255, 255, 0.8);
font-size: 12px;
line-height: 14px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* Opera does not support user-select, use <... unselectable="on"> instead */
cursor: default;
}
html[dir='ltr'] .toolbarButton,
html[dir='ltr'] .overlayButton,
html[dir='ltr'] .dropdownToolbarButton {
margin: 3px 2px 4px 0;
}
html[dir='rtl'] .toolbarButton,
html[dir='rtl'] .overlayButton,
html[dir='rtl'] .dropdownToolbarButton {
margin: 3px 0 4px 2px;
}
.toolbarButton:hover,
.toolbarButton:focus,
.dropdownToolbarButton,
.overlayButton,
.secondaryToolbarButton:hover,
.secondaryToolbarButton:focus {
background-color: rgba(0, 0, 0, 0.12);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, 0.35);
border-color: rgba(0, 0, 0, 0.32) rgba(0, 0, 0, 0.38) rgba(0, 0, 0, 0.42);
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.15) inset,
0 1px 0 rgba(255, 255, 255, 0.05);
}
.toolbarButton:hover:active,
.overlayButton:hover:active,
.dropdownToolbarButton:hover:active,
.secondaryToolbarButton:hover:active {
background-color: rgba(0, 0, 0, 0.2);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
border-color: rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.45);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) inset,
0 0 1px rgba(0, 0, 0, 0.2) inset,
0 1px 0 rgba(255, 255, 255, 0.05);
}
.toolbarButton.toggled,
.splitToolbarButton.toggled > .toolbarButton.toggled,
.secondaryToolbarButton.toggled {
background-color: rgba(0, 0, 0, 0.3);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.45) rgba(0, 0, 0, 0.5);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) inset,
0 0 1px rgba(0, 0, 0, 0.2) inset,
0 1px 0 rgba(255, 255, 255, 0.05);
}
.toolbarButton.toggled:hover:active,
.splitToolbarButton.toggled > .toolbarButton.toggled:hover:active,
.secondaryToolbarButton.toggled:hover:active {
background-color: rgba(0, 0, 0, 0.4);
border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.55);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2) inset,
0 0 1px rgba(0, 0, 0, 0.3) inset,
0 1px 0 rgba(255, 255, 255, 0.05);
}
.dropdownToolbarButton {
width: 140px;
padding: 0;
overflow: hidden;
}
.dropdownToolbarButton::after {
position: absolute;
display: inline-block;
top: 4px;
content: url(images/toolbarButton-menuArrows.png);
}
html[dir='ltr'] .dropdownToolbarButton::after {
right: 8px;
}
html[dir='rtl'] .dropdownToolbarButton::after {
left: 8px;
}
.dropdownToolbarButton > select {
width: 162px;
height: 23px;
font-size: 12px;
color: rgba(242, 242, 242, 1);
margin: 0;
padding: 3px 2px 2px;
border: none;
background: rgba(0,0,0,0); /* Opera does not support 'transparent' <select> background */
}
.dropdownToolbarButton > select > option {
background: rgba(61, 61, 61, 1);
}
#customScaleOption {
display: none;
}
#pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, 0.5) solid;
}
html[dir='ltr'] .splitToolbarButton:first-child,
html[dir='ltr'] .toolbarButton:first-child,
html[dir='rtl'] .splitToolbarButton:last-child,
html[dir='rtl'] .toolbarButton:last-child {
margin-left: 4px;
}
html[dir='ltr'] .splitToolbarButton:last-child,
html[dir='ltr'] .toolbarButton:last-child,
html[dir='rtl'] .splitToolbarButton:first-child,
html[dir='rtl'] .toolbarButton:first-child {
margin-right: 4px;
}
.toolbarButtonSpacer {
width: 30px;
display: inline-block;
height: 1px;
}
html[dir='ltr'] #findPrevious {
margin-left: 3px;
}
html[dir='ltr'] #findNext {
margin-right: 3px;
}
html[dir='rtl'] #findPrevious {
margin-right: 3px;
}
html[dir='rtl'] #findNext {
margin-left: 3px;
}
.toolbarButton::before,
.secondaryToolbarButton::before {
/* All matching images have a size of 16x16
* All relevant containers have a size of 32x25 */
position: absolute;
display: inline-block;
top: 4px;
left: 7px;
}
html[dir="ltr"] .secondaryToolbarButton::before {
left: 4px;
}
html[dir="rtl"] .secondaryToolbarButton::before {
right: 4px;
}
html[dir='ltr'] .toolbarButton#sidebarToggle::before {
content: url(images/toolbarButton-sidebarToggle.png);
}
html[dir='rtl'] .toolbarButton#sidebarToggle::before {
content: url(images/toolbarButton-sidebarToggle-rtl.png);
}
html[dir='ltr'] .toolbarButton#secondaryToolbarToggle::before {
content: url(images/toolbarButton-secondaryToolbarToggle.png);
}
html[dir='rtl'] .toolbarButton#secondaryToolbarToggle::before {
content: url(images/toolbarButton-secondaryToolbarToggle-rtl.png);
}
html[dir='ltr'] .toolbarButton.findPrevious::before {
content: url(images/findbarButton-previous.png);
}
html[dir='rtl'] .toolbarButton.findPrevious::before {
content: url(images/findbarButton-previous-rtl.png);
}
html[dir='ltr'] .toolbarButton.findNext::before {
content: url(images/findbarButton-next.png);
}
html[dir='rtl'] .toolbarButton.findNext::before {
content: url(images/findbarButton-next-rtl.png);
}
html[dir='ltr'] .toolbarButton.pageUp::before {
content: url(images/toolbarButton-pageUp.png);
}
html[dir='rtl'] .toolbarButton.pageUp::before {
content: url(images/toolbarButton-pageUp-rtl.png);
}
html[dir='ltr'] .toolbarButton.pageDown::before {
content: url(images/toolbarButton-pageDown.png);
}
html[dir='rtl'] .toolbarButton.pageDown::before {
content: url(images/toolbarButton-pageDown-rtl.png);
}
.toolbarButton.zoomOut::before {
content: url(images/toolbarButton-zoomOut.png);
}
.toolbarButton.zoomIn::before {
content: url(images/toolbarButton-zoomIn.png);
}
.toolbarButton.presentationMode::before,
.secondaryToolbarButton.presentationMode::before {
content: url(images/toolbarButton-presentationMode.png);
}
.toolbarButton.print::before,
.secondaryToolbarButton.print::before {
content: url(images/toolbarButton-print.png);
}
.toolbarButton.openFile::before,
.secondaryToolbarButton.openFile::before {
content: url(images/toolbarButton-openFile.png);
}
.toolbarButton.download::before,
.secondaryToolbarButton.download::before {
content: url(images/toolbarButton-download.png);
}
.toolbarButton.bookmark,
.secondaryToolbarButton.bookmark {
box-sizing: border-box;
outline: none;
padding-top: 4px;
text-decoration: none;
}
.secondaryToolbarButton.bookmark {
padding-top: 5px;
}
.bookmark[href='#'] {
opacity: .5;
pointer-events: none;
}
.toolbarButton.bookmark::before,
.secondaryToolbarButton.bookmark::before {
content: url(images/toolbarButton-bookmark.png);
}
#viewThumbnail.toolbarButton::before {
content: url(images/toolbarButton-viewThumbnail.png);
}
html[dir="ltr"] #viewOutline.toolbarButton::before {
content: url(images/toolbarButton-viewOutline.png);
}
html[dir="rtl"] #viewOutline.toolbarButton::before {
content: url(images/toolbarButton-viewOutline-rtl.png);
}
#viewAttachments.toolbarButton::before {
content: url(images/toolbarButton-viewAttachments.png);
}
#viewFind.toolbarButton::before {
content: url(images/toolbarButton-search.png);
}
.toolbarButton.pdfSidebarNotification::after {
position: absolute;
display: inline-block;
top: 1px;
/* Create a filled circle, with a diameter of 9 pixels, using only CSS: */
content: '';
background-color: rgba(112, 219, 85, 1);
height: 9px;
width: 9px;
border-radius: 50%;
}
html[dir='ltr'] .toolbarButton.pdfSidebarNotification::after {
left: 17px;
}
html[dir='rtl'] .toolbarButton.pdfSidebarNotification::after {
right: 17px;
}
.secondaryToolbarButton {
position: relative;
margin: 0 0 4px 0;
padding: 3px 0 1px 0;
height: auto;
min-height: 25px;
width: auto;
min-width: 100%;
white-space: normal;
}
html[dir="ltr"] .secondaryToolbarButton {
padding-left: 24px;
text-align: left;
}
html[dir="rtl"] .secondaryToolbarButton {
padding-right: 24px;
text-align: right;
}
html[dir="ltr"] .secondaryToolbarButton.bookmark {
padding-left: 27px;
}
html[dir="rtl"] .secondaryToolbarButton.bookmark {
padding-right: 27px;
}
html[dir="ltr"] .secondaryToolbarButton > span {
padding-right: 4px;
}
html[dir="rtl"] .secondaryToolbarButton > span {
padding-left: 4px;
}
.secondaryToolbarButton.firstPage::before {
content: url(images/secondaryToolbarButton-firstPage.png);
}
.secondaryToolbarButton.lastPage::before {
content: url(images/secondaryToolbarButton-lastPage.png);
}
.secondaryToolbarButton.rotateCcw::before {
content: url(images/secondaryToolbarButton-rotateCcw.png);
}
.secondaryToolbarButton.rotateCw::before {
content: url(images/secondaryToolbarButton-rotateCw.png);
}
.secondaryToolbarButton.selectTool::before {
content: url(images/secondaryToolbarButton-selectTool.png);
}
.secondaryToolbarButton.handTool::before {
content: url(images/secondaryToolbarButton-handTool.png);
}
.secondaryToolbarButton.scrollVertical::before {
content: url(images/secondaryToolbarButton-scrollVertical.png);
}
.secondaryToolbarButton.scrollHorizontal::before {
content: url(images/secondaryToolbarButton-scrollHorizontal.png);
}
.secondaryToolbarButton.scrollWrapped::before {
content: url(images/secondaryToolbarButton-scrollWrapped.png);
}
.secondaryToolbarButton.spreadNone::before {
content: url(images/secondaryToolbarButton-spreadNone.png);
}
.secondaryToolbarButton.spreadOdd::before {
content: url(images/secondaryToolbarButton-spreadOdd.png);
}
.secondaryToolbarButton.spreadEven::before {
content: url(images/secondaryToolbarButton-spreadEven.png);
}
.secondaryToolbarButton.documentProperties::before {
content: url(images/secondaryToolbarButton-documentProperties.png);
}
.verticalToolbarSeparator {
display: block;
padding: 8px 0;
margin: 8px 4px;
width: 1px;
background-color: rgba(0, 0, 0, 0.5);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
html[dir='ltr'] .verticalToolbarSeparator {
margin-left: 2px;
}
html[dir='rtl'] .verticalToolbarSeparator {
margin-right: 2px;
}
.horizontalToolbarSeparator {
display: block;
margin: 0 0 4px 0;
height: 1px;
width: 100%;
background-color: rgba(0, 0, 0, 0.5);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.toolbarField {
padding: 3px 6px;
margin: 4px 0 4px 0;
border-radius: 2px;
background-color: rgba(255, 255, 255, 0.09);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
border-width: 1px;
border-style: solid;
border-color: rgba(0, 0, 0, 0.32) rgba(0, 0, 0, 0.38) rgba(0, 0, 0, 0.42);
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05) inset,
0 1px 0 rgba(255, 255, 255, 0.05);
color: rgba(242, 242, 242, 1);
font-size: 12px;
line-height: 14px;
outline-style: none;
}
.toolbarField[type=checkbox] {
display: inline-block;
margin: 8px 0px;
}
.toolbarField.pageNumber {
-moz-appearance: textfield; /* hides the spinner in moz */
min-width: 16px;
text-align: right;
width: 40px;
}
.toolbarField.pageNumber.visiblePageIsLoading {
background-image: url(images/loading-small.png);
background-repeat: no-repeat;
background-position: 1px;
}
.toolbarField.pageNumber::-webkit-inner-spin-button,
.toolbarField.pageNumber::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.toolbarField:hover {
background-color: rgba(255, 255, 255, 0.11);
border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.43) rgba(0, 0, 0, 0.45);
}
.toolbarField:focus {
background-color: rgba(255, 255, 255, 0.15);
border-color: rgba(77, 184, 255, 0.8) rgba(77, 184, 255, 0.85) rgba(77, 184, 255, 0.9);
}
.toolbarLabel {
min-width: 16px;
padding: 3px 6px 3px 2px;
margin: 4px 2px 4px 0;
border: 1px solid rgba(0, 0, 0, 0);
border-radius: 2px;
color: rgba(217, 217, 217, 1);
font-size: 12px;
line-height: 14px;
text-align: left;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: default;
}
#thumbnailView {
position: absolute;
width: calc(100% - 60px);
top: 0;
bottom: 0;
padding: 10px 30px 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
#thumbnailView > a:active,
#thumbnailView > a:focus {
outline: 0;
}
.thumbnail {
margin: 0 10px 5px 10px;
}
html[dir='ltr'] .thumbnail {
float: left;
}
html[dir='rtl'] .thumbnail {
float: right;
}
#thumbnailView > a:last-of-type > .thumbnail {
margin-bottom: 10px;
}
#thumbnailView > a:last-of-type > .thumbnail:not([data-loaded]) {
margin-bottom: 9px;
}
.thumbnail:not([data-loaded]) {
border: 1px dashed rgba(255, 255, 255, 0.5);
margin: -1px 9px 4px 9px;
}
.thumbnailImage {
border: 1px solid rgba(0, 0, 0, 0);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
opacity: 0.8;
z-index: 99;
background-color: rgba(255, 255, 255, 1);
background-clip: content-box;
}
.thumbnailSelectionRing {
border-radius: 2px;
padding: 7px;
}
a:focus > .thumbnail > .thumbnailSelectionRing > .thumbnailImage,
.thumbnail:hover > .thumbnailSelectionRing > .thumbnailImage {
opacity: .9;
}
a:focus > .thumbnail > .thumbnailSelectionRing,
.thumbnail:hover > .thumbnailSelectionRing {
background-color: rgba(255, 255, 255, 0.15);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.2) inset,
0 0 1px rgba(0, 0, 0, 0.2);
color: rgba(255, 255, 255, 0.9);
}
.thumbnail.selected > .thumbnailSelectionRing > .thumbnailImage {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
opacity: 1;
}
.thumbnail.selected > .thumbnailSelectionRing {
background-color: rgba(255, 255, 255, 0.3);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.1) inset,
0 0 1px rgba(0, 0, 0, 0.2);
color: rgba(255, 255, 255,1);
}
#outlineView,
#attachmentsView {
position: absolute;
width: calc(100% - 8px);
top: 0;
bottom: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#outlineView {
padding: 4px 4px 0;
}
#attachmentsView {
padding: 3px 4px 0;
}
html[dir='ltr'] .outlineWithDeepNesting > .outlineItem,
html[dir='ltr'] .outlineItem > .outlineItems {
margin-left: 20px;
}
html[dir='rtl'] .outlineWithDeepNesting > .outlineItem,
html[dir='rtl'] .outlineItem > .outlineItems {
margin-right: 20px;
}
.outlineItem > a,
.attachmentsItem > button {
text-decoration: none;
display: inline-block;
min-width: 95%;
min-width: calc(100% - 4px); /* Subtract the right padding (left, in RTL mode)
of the container. */
height: auto;
margin-bottom: 1px;
border-radius: 2px;
color: rgba(255, 255, 255, 0.8);
font-size: 13px;
line-height: 15px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: normal;
}
.attachmentsItem > button {
border: 0 none;
background: none;
cursor: pointer;
width: 100%;
}
html[dir='ltr'] .outlineItem > a {
padding: 2px 0 5px 4px;
}
html[dir='ltr'] .attachmentsItem > button {
padding: 2px 0 3px 7px;
text-align: left;
}
html[dir='rtl'] .outlineItem > a {
padding: 2px 4px 5px 0;
}
html[dir='rtl'] .attachmentsItem > button {
padding: 2px 7px 3px 0;
text-align: right;
}
.outlineItemToggler {
position: relative;
height: 0;
width: 0;
color: rgba(255, 255, 255, 0.5);
}
.outlineItemToggler::before {
content: url(images/treeitem-expanded.png);
display: inline-block;
position: absolute;
}
html[dir='ltr'] .outlineItemToggler.outlineItemsHidden::before {
content: url(images/treeitem-collapsed.png);
}
html[dir='rtl'] .outlineItemToggler.outlineItemsHidden::before {
content: url(images/treeitem-collapsed-rtl.png);
}
.outlineItemToggler.outlineItemsHidden ~ .outlineItems {
display: none;
}
html[dir='ltr'] .outlineItemToggler {
float: left;
}
html[dir='rtl'] .outlineItemToggler {
float: right;
}
html[dir='ltr'] .outlineItemToggler::before {
right: 4px;
}
html[dir='rtl'] .outlineItemToggler::before {
left: 4px;
}
.outlineItemToggler:hover,
.outlineItemToggler:hover + a,
.outlineItemToggler:hover ~ .outlineItems,
.outlineItem > a:hover,
.attachmentsItem > button:hover {
background-color: rgba(255, 255, 255, 0.02);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.2) inset,
0 0 1px rgba(0, 0, 0, 0.2);
border-radius: 2px;
color: rgba(255, 255, 255, 0.9);
}
.outlineItem.selected {
background-color: rgba(255, 255, 255, 0.08);
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
background-clip: padding-box;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
0 0 1px rgba(255, 255, 255, 0.1) inset,
0 0 1px rgba(0, 0, 0, 0.2);
color: rgba(255, 255, 255, 1);
}
.noResults {
font-size: 12px;
color: rgba(255, 255, 255, 0.8);
font-style: italic;
cursor: default;
}
/* TODO: file FF bug to support ::-moz-selection:window-inactive
so we can override the opaque grey background when the window is inactive;
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
::-moz-selection {
background: rgba(0, 0, 255, 0.3);
}
::selection {
background: rgba(0, 0, 255, 0.3);
}
#errorWrapper {
background: none repeat scroll 0 0 rgba(255, 85, 85, 1);
color: rgba(255, 255, 255, 1);
left: 0;
position: absolute;
right: 0;
z-index: 1000;
padding: 3px;
font-size: 0.8em;
}
.loadingInProgress #errorWrapper {
top: 37px;
}
#errorMessageLeft {
float: left;
}
#errorMessageRight {
float: right;
}
#errorMoreInfo {
background-color: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
padding: 3px;
margin: 3px;
width: 98%;
}
.overlayButton {
width: auto;
margin: 3px 4px 2px 4px !important;
padding: 2px 6px 3px 6px;
}
#overlayContainer {
display: table;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
z-index: 40000;
}
#overlayContainer > * {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
#overlayContainer > .container {
display: table-cell;
vertical-align: middle;
text-align: center;
}
#overlayContainer > .container > .dialog {
display: inline-block;
padding: 15px;
border-spacing: 4px;
color: rgba(217, 217, 217, 1);
font-size: 12px;
line-height: 14px;
background-color: rgba(71, 71, 71, 1); /* fallback */
background-image: url(images/texture.png),
-webkit-gradient(linear, left top, left bottom, from(rgba(82, 82, 82,0.99)), to(rgba(69, 69, 69, 0.95)));
background-image: url(images/texture.png),
linear-gradient(rgba(82, 82, 82,0.99), rgba(69, 69, 69, 0.95));
border: 1px solid rgba(0, 0, 0, 0.5);
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.dialog > .row {
display: table-row;
}
.dialog > .row > * {
display: table-cell;
}
.dialog .toolbarField {
margin: 5px 0;
}
.dialog .separator {
display: block;
margin: 4px 0 4px 0;
height: 1px;
width: 100%;
background-color: rgba(0, 0, 0, 0.5);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.dialog .buttonRow {
text-align: center;
vertical-align: middle;
}
.dialog :link {
color: rgba(255, 255, 255, 1);
}
#passwordOverlay > .dialog {
text-align: center;
}
#passwordOverlay .toolbarField {
width: 200px;
}
#documentPropertiesOverlay > .dialog {
text-align: left;
}
#documentPropertiesOverlay .row > * {
min-width: 100px;
}
html[dir='ltr'] #documentPropertiesOverlay .row > * {
text-align: left;
}
html[dir='rtl'] #documentPropertiesOverlay .row > * {
text-align: right;
}
#documentPropertiesOverlay .row > span {
width: 125px;
word-wrap: break-word;
}
#documentPropertiesOverlay .row > p {
max-width: 225px;
word-wrap: break-word;
}
#documentPropertiesOverlay .buttonRow {
margin-top: 10px;
}
.clearBoth {
clear: both;
}
.fileInput {
background: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
margin-top: 5px;
visibility: hidden;
position: fixed;
right: 0;
top: 0;
}
#PDFBug {
background: none repeat scroll 0 0 rgba(255, 255, 255, 1);
border: 1px solid rgba(102, 102, 102, 1);
position: fixed;
top: 32px;
right: 0;
bottom: 0;
font-size: 10px;
padding: 0;
width: 300px;
}
#PDFBug .controls {
background: rgba(238, 238, 238, 1);
border-bottom: 1px solid rgba(102, 102, 102, 1);
padding: 3px;
}
#PDFBug .panels {
bottom: 0;
left: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
right: 0;
top: 27px;
}
#PDFBug .panels > div {
padding: 5px;
}
#PDFBug button.active {
font-weight: bold;
}
.debuggerShowText {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
color: rgba(0, 0, 255, 1);
}
.debuggerHideText:hover {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
}
#PDFBug .stats {
font-family: courier;
font-size: 10px;
white-space: pre;
}
#PDFBug .stats .title {
font-weight: bold;
}
#PDFBug table {
font-size: 10px;
}
#viewer.textLayer-visible .textLayer {
opacity: 1.0;
}
#viewer.textLayer-visible .canvasWrapper {
background-color: rgba(128, 255, 128, 1);
}
#viewer.textLayer-visible .canvasWrapper canvas {
mix-blend-mode: screen;
}
#viewer.textLayer-visible .textLayer > span {
background-color: rgba(255, 255, 0, 0.1);
color: rgba(0, 0, 0, 1);
border: solid 1px rgba(255, 0, 0, 0.5);
box-sizing: border-box;
}
#viewer.textLayer-hover .textLayer > span:hover {
background-color: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
}
#viewer.textLayer-shadow .textLayer > span {
background-color: rgba(255, 255, 255, 0.6);
color: rgba(0, 0, 0, 1);
}
.grab-to-pan-grab {
cursor: url("images/grab.cur"), move !important;
cursor: -webkit-grab !important;
cursor: grab !important;
}
.grab-to-pan-grab *:not(input):not(textarea):not(button):not(select):not(:link) {
cursor: inherit !important;
}
.grab-to-pan-grab:active,
.grab-to-pan-grabbing {
cursor: url("images/grabbing.cur"), move !important;
cursor: -webkit-grabbing !important;
cursor: grabbing !important;
position: fixed;
background: rgba(0, 0, 0, 0);
display: block;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 50000; /* should be higher than anything else in PDF.js! */
}
@page {
margin: 0;
}
#printContainer {
display: none;
}
@media screen and (-webkit-min-device-pixel-ratio: 1.1), screen and (min-resolution: 1.1dppx) {
/* Rules for Retina screens */
.toolbarButton::before {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -5px;
}
.secondaryToolbarButton::before {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -4px;
}
html[dir='ltr'] .toolbarButton::before,
html[dir='rtl'] .toolbarButton::before {
left: -1px;
}
html[dir='ltr'] .secondaryToolbarButton::before {
left: -2px;
}
html[dir='rtl'] .secondaryToolbarButton::before {
left: 186px;
}
.toolbarField.pageNumber.visiblePageIsLoading,
#findInput[data-status="pending"] {
background-image: url(images/loading-small@2x.png);
background-size: 16px 17px;
}
.dropdownToolbarButton::after {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -5px;
content: url(images/toolbarButton-menuArrows@2x.png);
}
html[dir='ltr'] .dropdownToolbarButton::after {
right: 4px;
}
html[dir='rtl'] .dropdownToolbarButton::after {
left: 4px;
}
html[dir='ltr'] .toolbarButton#sidebarToggle::before {
content: url(images/toolbarButton-sidebarToggle@2x.png);
}
html[dir='rtl'] .toolbarButton#sidebarToggle::before {
content: url(images/toolbarButton-sidebarToggle-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton#secondaryToolbarToggle::before {
content: url(images/toolbarButton-secondaryToolbarToggle@2x.png);
}
html[dir='rtl'] .toolbarButton#secondaryToolbarToggle::before {
content: url(images/toolbarButton-secondaryToolbarToggle-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.findPrevious::before {
content: url(images/findbarButton-previous@2x.png);
}
html[dir='rtl'] .toolbarButton.findPrevious::before {
content: url(images/findbarButton-previous-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.findNext::before {
content: url(images/findbarButton-next@2x.png);
}
html[dir='rtl'] .toolbarButton.findNext::before {
content: url(images/findbarButton-next-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.pageUp::before {
content: url(images/toolbarButton-pageUp@2x.png);
}
html[dir='rtl'] .toolbarButton.pageUp::before {
content: url(images/toolbarButton-pageUp-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.pageDown::before {
content: url(images/toolbarButton-pageDown@2x.png);
}
html[dir='rtl'] .toolbarButton.pageDown::before {
content: url(images/toolbarButton-pageDown-rtl@2x.png);
}
.toolbarButton.zoomIn::before {
content: url(images/toolbarButton-zoomIn@2x.png);
}
.toolbarButton.zoomOut::before {
content: url(images/toolbarButton-zoomOut@2x.png);
}
.toolbarButton.presentationMode::before,
.secondaryToolbarButton.presentationMode::before {
content: url(images/toolbarButton-presentationMode@2x.png);
}
.toolbarButton.print::before,
.secondaryToolbarButton.print::before {
content: url(images/toolbarButton-print@2x.png);
}
.toolbarButton.openFile::before,
.secondaryToolbarButton.openFile::before {
content: url(images/toolbarButton-openFile@2x.png);
}
.toolbarButton.download::before,
.secondaryToolbarButton.download::before {
content: url(images/toolbarButton-download@2x.png);
}
.toolbarButton.bookmark::before,
.secondaryToolbarButton.bookmark::before {
content: url(images/toolbarButton-bookmark@2x.png);
}
#viewThumbnail.toolbarButton::before {
content: url(images/toolbarButton-viewThumbnail@2x.png);
}
html[dir="ltr"] #viewOutline.toolbarButton::before {
content: url(images/toolbarButton-viewOutline@2x.png);
}
html[dir="rtl"] #viewOutline.toolbarButton::before {
content: url(images/toolbarButton-viewOutline-rtl@2x.png);
}
#viewAttachments.toolbarButton::before {
content: url(images/toolbarButton-viewAttachments@2x.png);
}
#viewFind.toolbarButton::before {
content: url(images/toolbarButton-search@2x.png);
}
.secondaryToolbarButton.firstPage::before {
content: url(images/secondaryToolbarButton-firstPage@2x.png);
}
.secondaryToolbarButton.lastPage::before {
content: url(images/secondaryToolbarButton-lastPage@2x.png);
}
.secondaryToolbarButton.rotateCcw::before {
content: url(images/secondaryToolbarButton-rotateCcw@2x.png);
}
.secondaryToolbarButton.rotateCw::before {
content: url(images/secondaryToolbarButton-rotateCw@2x.png);
}
.secondaryToolbarButton.selectTool::before {
content: url(images/secondaryToolbarButton-selectTool@2x.png);
}
.secondaryToolbarButton.handTool::before {
content: url(images/secondaryToolbarButton-handTool@2x.png);
}
.secondaryToolbarButton.scrollVertical::before {
content: url(images/secondaryToolbarButton-scrollVertical@2x.png);
}
.secondaryToolbarButton.scrollHorizontal::before {
content: url(images/secondaryToolbarButton-scrollHorizontal@2x.png);
}
.secondaryToolbarButton.scrollWrapped::before {
content: url(images/secondaryToolbarButton-scrollWrapped@2x.png);
}
.secondaryToolbarButton.spreadNone::before {
content: url(images/secondaryToolbarButton-spreadNone@2x.png);
}
.secondaryToolbarButton.spreadOdd::before {
content: url(images/secondaryToolbarButton-spreadOdd@2x.png);
}
.secondaryToolbarButton.spreadEven::before {
content: url(images/secondaryToolbarButton-spreadEven@2x.png);
}
.secondaryToolbarButton.documentProperties::before {
content: url(images/secondaryToolbarButton-documentProperties@2x.png);
}
.outlineItemToggler::before {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -1px;
content: url(images/treeitem-expanded@2x.png);
}
html[dir='ltr'] .outlineItemToggler.outlineItemsHidden::before {
content: url(images/treeitem-collapsed@2x.png);
}
html[dir='rtl'] .outlineItemToggler.outlineItemsHidden::before {
content: url(images/treeitem-collapsed-rtl@2x.png);
}
html[dir='ltr'] .outlineItemToggler::before {
right: 0;
}
html[dir='rtl'] .outlineItemToggler::before {
left: 0;
}
}
@media print {
/* General rules for printing. */
body {
background: rgba(0, 0, 0, 0) none;
}
/* Rules for browsers that don't support mozPrintCallback. */
#sidebarContainer, #secondaryToolbar, .toolbar, #loadingBox, #errorWrapper, .textLayer {
display: none;
}
#viewerContainer {
overflow: visible;
}
#mainContainer, #viewerContainer, .page, .page canvas {
position: static;
padding: 0;
margin: 0;
}
.page {
float: left;
display: none;
border: none;
box-shadow: none;
background-clip: content-box;
background-color: rgba(255, 255, 255, 1);
}
.page[data-loaded] {
display: block;
}
.fileInput {
display: none;
}
/* Rules for browsers that support PDF.js printing */
body[data-pdfjsprinting] #outerContainer {
display: none;
}
body[data-pdfjsprinting] #printContainer {
display: block;
}
#printContainer {
height: 100%;
}
/* wrapper around (scaled) print canvas elements */
#printContainer > div {
position: relative;
top: 0;
left: 0;
width: 1px;
height: 1px;
overflow: visible;
page-break-after: always;
page-break-inside: avoid;
}
#printContainer canvas,
#printContainer img {
display: block;
}
}
.visibleLargeView,
.visibleMediumView,
.visibleSmallView {
display: none;
}
@media all and (max-width: 900px) {
#toolbarViewerMiddle {
display: table;
margin: auto;
left: auto;
position: inherit;
-webkit-transform: none;
transform: none;
}
}
@media all and (max-width: 840px) {
#sidebarContent {
background-color: rgba(0, 0, 0, 0.7);
}
html[dir='ltr'] #outerContainer.sidebarOpen #viewerContainer {
left: 0px !important;
}
html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer {
right: 0px !important;
}
#outerContainer .hiddenLargeView,
#outerContainer .hiddenMediumView {
display: inherit;
}
#outerContainer .visibleLargeView,
#outerContainer .visibleMediumView {
display: none;
}
}
@media all and (max-width: 770px) {
#outerContainer .hiddenLargeView {
display: none;
}
#outerContainer .visibleLargeView {
display: inherit;
}
}
@media all and (max-width: 700px) {
#outerContainer .hiddenMediumView {
display: none;
}
#outerContainer .visibleMediumView {
display: inherit;
}
}
@media all and (max-width: 640px) {
.hiddenSmallView, .hiddenSmallView * {
display: none;
}
.visibleSmallView {
display: inherit;
}
.toolbarButtonSpacer {
width: 0;
}
html[dir='ltr'] .findbar {
left: 38px;
}
html[dir='rtl'] .findbar {
right: 38px;
}
}
@media all and (max-width: 535px) {
#scaleSelectContainer {
display: none;
}
}
| {
"pile_set_name": "Github"
} |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addDefault = addDefault;
exports.addNamed = addNamed;
exports.addNamespace = addNamespace;
exports.addSideEffect = addSideEffect;
Object.defineProperty(exports, "ImportInjector", {
enumerable: true,
get: function () {
return _importInjector.default;
}
});
Object.defineProperty(exports, "isModule", {
enumerable: true,
get: function () {
return _isModule.default;
}
});
var _importInjector = _interopRequireDefault(require("./import-injector"));
var _isModule = _interopRequireDefault(require("./is-module"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function addDefault(path, importedSource, opts) {
return new _importInjector.default(path).addDefault(importedSource, opts);
}
function addNamed(path, name, importedSource, opts) {
return new _importInjector.default(path).addNamed(name, importedSource, opts);
}
function addNamespace(path, importedSource, opts) {
return new _importInjector.default(path).addNamespace(importedSource, opts);
}
function addSideEffect(path, importedSource, opts) {
return new _importInjector.default(path).addSideEffect(importedSource, opts);
} | {
"pile_set_name": "Github"
} |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
#include "cmLinkLineComputer.h"
class cmGlobalNinjaGenerator;
class cmOutputConverter;
class cmStateDirectory;
class cmNinjaLinkLineComputer : public cmLinkLineComputer
{
public:
cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir,
cmGlobalNinjaGenerator const* gg);
cmNinjaLinkLineComputer(cmNinjaLinkLineComputer const&) = delete;
cmNinjaLinkLineComputer& operator=(cmNinjaLinkLineComputer const&) = delete;
std::string ConvertToLinkReference(std::string const& input) const override;
private:
cmGlobalNinjaGenerator const* GG;
};
| {
"pile_set_name": "Github"
} |
using System;
using Urho;
namespace Urho.Actions
{
public class EaseInOut : EaseRateAction
{
#region Constructors
public EaseInOut (FiniteTimeAction action, float rate) : base (action, rate)
{
}
#endregion Constructors
protected internal override ActionState StartAction(Node target)
{
return new EaseInOutState (this, target);
}
public override FiniteTimeAction Reverse ()
{
return new EaseInOut ((FiniteTimeAction)InnerAction.Reverse (), Rate);
}
}
#region Action state
public class EaseInOutState : EaseRateActionState
{
public EaseInOutState (EaseInOut action, Node target) : base (action, target)
{
}
public override void Update (float time)
{
float actionRate = Rate;
time *= 2;
if (time < 1)
{
InnerActionState.Update (0.5f * (float)Math.Pow (time, actionRate));
}
else
{
InnerActionState.Update (1.0f - 0.5f * (float)Math.Pow (2 - time, actionRate));
}
}
}
#endregion Action state
} | {
"pile_set_name": "Github"
} |
undefined
1
1
13
[object Object]
undefined
1
1
13
[object Object]
| {
"pile_set_name": "Github"
} |
David Robillard <d@drobilla.net>
| {
"pile_set_name": "Github"
} |
require "./sys/types"
lib LibC
VEOF = 4
VEOL = 11
VERASE = 2
VINTR = 0
VKILL = 3
VMIN = 6
VQUIT = 1
VSTART = 8
VSTOP = 9
VSUSP = 10
BRKINT = 0o000002
ICRNL = 0o000400
IGNBRK = 0o000001
IGNCR = 0o000200
IGNPAR = 0o000004
INLCR = 0o000100
INPCK = 0o000020
ISTRIP = 0o000040
IXANY = 0o004000
IXOFF = 0o010000
IXON = 0o002000
PARMRK = 0o000010
OPOST = 0o000001
ONLCR = 0o000004
OCRNL = 0o000010
ONOCR = 0o000020
ONLRET = 0o000040
OFDEL = 0o000200
OFILL = 0o000100
CRDLY = 0o003000
CR0 = 0o000000
CR1 = 0o001000
CR2 = 0o002000
CR3 = 0o003000
TABDLY = 0o014000
TAB0 = 0o000000
TAB1 = 0o004000
TAB2 = 0o010000
TAB3 = 0o014000
BSDLY = 0o020000
BS0 = 0o000000
BS1 = 0o020000
VTDLY = 0o040000
VT0 = 0o000000
VT1 = 0o040000
FFDLY = 0o100000
FF0 = 0o000000
FF1 = 0o100000
NLDLY = 0o000400
NL0 = 0o000000
NL1 = 0o000400
B0 = 0o000000
B50 = 0o000001
B75 = 0o000002
B110 = 0o000003
B134 = 0o000004
B150 = 0o000005
B200 = 0o000006
B300 = 0o000007
B600 = 0o000010
B1200 = 0o000011
B1800 = 0o000012
B2400 = 0o000013
B4800 = 0o000014
B9600 = 0o000015
B19200 = 0o000016
B38400 = 0o000017
CSIZE = 0o000060
CS5 = 0o000000
CS6 = 0o000020
CS7 = 0o000040
CS8 = 0o000060
CSTOPB = 0o000100
CREAD = 0o000200
PARENB = 0o000400
PARODD = 0o001000
HUPCL = 0o002000
CLOCAL = 0o004000
ECHO = 0o000010
ECHOE = 0o000020
ECHOK = 0o000040
ECHONL = 0o000100
ICANON = 0o000002
IEXTEN = 0o100000
ISIG = 0o000001
NOFLSH = 0o000200
TOSTOP = 0o000400
TCSANOW = 0
TCSADRAIN = 1
TCSAFLUSH = 2
TCIFLUSH = 0
TCIOFLUSH = 2
TCOFLUSH = 1
TCIOFF = 2
TCION = 3
TCOOFF = 0
TCOON = 1
alias CcT = Char
alias SpeedT = UInt
alias TcflagT = UInt
struct Termios
c_iflag : TcflagT
c_oflag : TcflagT
c_cflag : TcflagT
c_lflag : TcflagT
c_line : CcT
c_cc : StaticArray(CcT, 32)
__c_ispeed : SpeedT
__c_ospeed : SpeedT
end
fun tcgetattr(x0 : Int, x1 : Termios*) : Int
fun tcsetattr(x0 : Int, x1 : Int, x2 : Termios*) : Int
fun cfmakeraw(x0 : Termios*) : Void
end
| {
"pile_set_name": "Github"
} |
include(FeatureSummary)
if(BUILD_TESTING)
# for the actual gtest:
# at least in debian, they are the package only installs their source code,
# so if one wants to use them, he needs to compile them in-tree
include(GoogleTest)
add_dependencies(dependencies gtest gmock_main)
endif()
if(BUILD_BENCHMARKING)
include(GoogleBenchmark)
add_dependencies(dependencies benchmark)
endif()
unset(HAVE_OPENMP)
if(WITH_OPENMP)
message(STATUS "Looking for OpenMP")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# Clang has an option to specify the OpenMP standard to use. Specify it.
set(OPENMP_VERSION_SPECIFIER "-fopenmp-version=40")
endif()
set(CMAKE_C_FLAGS_SAVE "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_SAVE "${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPENMP_VERSION_SPECIFIER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENMP_VERSION_SPECIFIER}")
find_package(OpenMP 4.0)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_SAVE}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
if(NOT OPENMP_FOUND)
message(SEND_ERROR "Did not find OpenMP! Either make it find OpenMP, "
"or pass -DWITH_OPENMP=OFF to disable OpenMP support.")
else()
message(STATUS "Looking for OpenMP - found (system)")
endif()
# The wrapper library that *actually* should be linked to.
add_library(RawSpeed::OpenMP_CXX INTERFACE IMPORTED)
set_property(TARGET RawSpeed::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS $<TARGET_PROPERTY:OpenMP::OpenMP_CXX,INTERFACE_COMPILE_OPTIONS>)
set_property(TARGET RawSpeed::OpenMP_CXX APPEND PROPERTY INTERFACE_COMPILE_OPTIONS ${OPENMP_VERSION_SPECIFIER})
set_property(TARGET RawSpeed::OpenMP_CXX PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:OpenMP::OpenMP_CXX,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT USE_BUNDLED_LLVMOPENMP)
set_property(TARGET RawSpeed::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES $<TARGET_PROPERTY:OpenMP::OpenMP_CXX,INTERFACE_LINK_LIBRARIES>)
else()
include(LLVMOpenMP)
message(STATUS "Looking for OpenMP - found 'in-tree' runtime library")
add_dependencies(RawSpeed::OpenMP_CXX omp)
add_dependencies(dependencies omp)
set_property(TARGET RawSpeed::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES omp)
endif()
target_link_libraries(rawspeed PRIVATE RawSpeed::OpenMP_CXX)
set(HAVE_OPENMP 1)
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.3
# XCode 10 is broken. Maybe XCode 11 will be ok?
))
# See https://bugs.llvm.org/show_bug.cgi?id=35873
# https://redmine.darktable.org/issues/12568
set(OPENMP_FIRSTPRIVATE_CLAUSE_IS_BROKEN_FOR_CONST_VARIABLES TRUE)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
# See https://godbolt.org/z/AiyuX9
set(OPENMP_SHARED_CLAUSE_IS_BROKEN_FOR_CONST_VARIABLES TRUE)
endif()
set_package_properties(OpenMP PROPERTIES
TYPE RECOMMENDED
URL https://www.openmp.org/
DESCRIPTION "Open Multi-Processing"
PURPOSE "Used for parallelization of the library")
else()
message(STATUS "OpenMP is disabled")
endif()
add_feature_info("OpenMP-based threading" HAVE_OPENMP "used for parallelization of the library")
unset(HAVE_PUGIXML)
if(WITH_PUGIXML)
message(STATUS "Looking for pugixml")
if(NOT USE_BUNDLED_PUGIXML)
find_package(Pugixml 1.8)
if(NOT Pugixml_FOUND)
message(SEND_ERROR "Did not find Pugixml! Either make it find Pugixml, or pass -DUSE_BUNDLED_PUGIXML=ON to enable in-tree pugixml.")
else()
message(STATUS "Looking for pugixml - found (system)")
endif()
else()
include(Pugixml)
if(NOT Pugixml_FOUND)
message(SEND_ERROR "Managed to fail to use 'bundled' Pugixml!")
else()
message(STATUS "Looking for pugixml - found ('in-tree')")
add_dependencies(dependencies ${Pugixml_LIBRARIES})
endif()
endif()
if(Pugixml_FOUND)
set(HAVE_PUGIXML 1)
if(NOT TARGET Pugixml::Pugixml)
add_library(Pugixml::Pugixml INTERFACE IMPORTED)
set_property(TARGET Pugixml::Pugixml PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Pugixml_INCLUDE_DIRS}")
set_property(TARGET Pugixml::Pugixml PROPERTY INTERFACE_LINK_LIBRARIES "${Pugixml_LIBRARIES}")
endif()
target_link_libraries(rawspeed PRIVATE Pugixml::Pugixml)
set_package_properties(Pugixml PROPERTIES
TYPE REQUIRED
URL http://pugixml.org/
DESCRIPTION "Light-weight, simple and fast XML parser"
PURPOSE "Used for loading of data/cameras.xml")
endif()
else()
message(STATUS "Pugixml library support is disabled. I hope you know what you are doing.")
endif()
add_feature_info("XML reading" HAVE_PUGIXML "used for loading of data/cameras.xml")
unset(HAVE_JPEG)
if(WITH_JPEG)
message(STATUS "Looking for JPEG")
find_package(JPEG)
if(NOT JPEG_FOUND)
message(SEND_ERROR "Did not find JPEG! Either make it find JPEG, or pass -DWITH_JPEG=OFF to disable JPEG.")
else()
message(STATUS "Looking for JPEG - found")
set(HAVE_JPEG 1)
if(NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG INTERFACE IMPORTED)
set_property(TARGET JPEG::JPEG PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${JPEG_INCLUDE_DIRS}")
set_property(TARGET JPEG::JPEG PROPERTY INTERFACE_LINK_LIBRARIES "${JPEG_LIBRARIES}")
endif()
target_link_libraries(rawspeed PRIVATE JPEG::JPEG)
set_package_properties(JPEG PROPERTIES
TYPE RECOMMENDED
DESCRIPTION "free library for handling the JPEG image data format, implements a JPEG codec"
PURPOSE "Used for decoding DNG Lossy JPEG compression")
include(CheckJPEGSymbols)
endif()
else()
message(STATUS "JPEG is disabled, DNG Lossy JPEG support won't be available.")
endif()
add_feature_info("Lossy JPEG decoding" HAVE_JPEG "used for DNG Lossy JPEG compression decoding")
unset(HAVE_ZLIB)
if (WITH_ZLIB)
message(STATUS "Looking for ZLIB")
if(NOT USE_BUNDLED_ZLIB)
find_package(ZLIB 1.2.11)
if(NOT ZLIB_FOUND)
message(SEND_ERROR "Did not find ZLIB! Either make it find ZLIB, or pass -DWITH_ZLIB=OFF to disable ZLIB, or pass -DUSE_BUNDLED_ZLIB=ON to enable in-tree ZLIB.")
else()
include(CheckZLIB)
message(STATUS "Looking for ZLIB - found (system)")
endif()
else()
include(Zlib)
if(NOT ZLIB_FOUND)
message(SEND_ERROR "Managed to fail to use 'bundled' ZLIB!")
else()
message(STATUS "Looking for ZLIB - found ('in-tree')")
add_dependencies(dependencies ${ZLIB_LIBRARIES})
endif()
endif()
if(ZLIB_FOUND)
set(HAVE_ZLIB 1)
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB INTERFACE IMPORTED)
set_property(TARGET ZLIB::ZLIB PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
set_property(TARGET ZLIB::ZLIB PROPERTY INTERFACE_LINK_LIBRARIES "${ZLIB_LIBRARIES}")
endif()
target_link_libraries(rawspeed PRIVATE ZLIB::ZLIB)
set_package_properties(ZLIB PROPERTIES
TYPE RECOMMENDED
DESCRIPTION "software library used for data compression"
PURPOSE "Used for decoding DNG Deflate compression")
endif()
else()
message(STATUS "ZLIB is disabled, DNG deflate support won't be available.")
endif()
add_feature_info("ZLIB decoding" HAVE_ZLIB "used for DNG Deflate compression decoding")
| {
"pile_set_name": "Github"
} |
<?php
/**
* PHPUnit
*
* Copyright (c) 2001-2013, Sebastian Bergmann <sebastian@phpunit.de>.
* 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 Sebastian Bergmann nor the names of his
* 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.
*
* @package PHPUnit
* @subpackage Util_Log
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 2001-2013 Sebastian Bergmann <sebastian@phpunit.de>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @link http://www.phpunit.de/
* @since File available since Release 2.3.0
*/
/**
* A TestListener that generates a logfile of the test execution in XML markup.
*
* The XML markup used is the same as the one that is used by the JUnit Ant task.
*
* @package PHPUnit
* @subpackage Util_Log
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 2001-2013 Sebastian Bergmann <sebastian@phpunit.de>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @link http://www.phpunit.de/
* @since Class available since Release 2.1.0
*/
class PHPUnit_Util_Log_JUnit extends PHPUnit_Util_Printer implements PHPUnit_Framework_TestListener
{
/**
* @var DOMDocument
*/
protected $document;
/**
* @var DOMElement
*/
protected $root;
/**
* @var boolean
*/
protected $logIncompleteSkipped = FALSE;
/**
* @var boolean
*/
protected $writeDocument = TRUE;
/**
* @var DOMElement[]
*/
protected $testSuites = array();
/**
* @var integer[]
*/
protected $testSuiteTests = array(0);
/**
* @var integer[]
*/
protected $testSuiteAssertions = array(0);
/**
* @var integer[]
*/
protected $testSuiteErrors = array(0);
/**
* @var integer[]
*/
protected $testSuiteFailures = array(0);
/**
* @var integer[]
*/
protected $testSuiteTimes = array(0);
/**
* @var integer
*/
protected $testSuiteLevel = 0;
/**
* @var DOMElement
*/
protected $currentTestCase = NULL;
/**
* @var boolean
*/
protected $attachCurrentTestCase = TRUE;
/**
* Constructor.
*
* @param mixed $out
* @param boolean $logIncompleteSkipped
*/
public function __construct($out = NULL, $logIncompleteSkipped = FALSE)
{
$this->document = new DOMDocument('1.0', 'UTF-8');
$this->document->formatOutput = TRUE;
$this->root = $this->document->createElement('testsuites');
$this->document->appendChild($this->root);
parent::__construct($out);
$this->logIncompleteSkipped = $logIncompleteSkipped;
}
/**
* Flush buffer and close output.
*
*/
public function flush()
{
if ($this->writeDocument === TRUE) {
$this->write($this->getXML());
}
parent::flush();
}
/**
* An error occurred.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
{
if ($this->currentTestCase !== NULL) {
if ($test instanceof PHPUnit_Framework_SelfDescribing) {
$buffer = $test->toString() . "\n";
} else {
$buffer = '';
}
$buffer .= PHPUnit_Framework_TestFailure::exceptionToString($e) .
"\n" .
PHPUnit_Util_Filter::getFilteredStacktrace($e);
$error = $this->document->createElement(
'error', PHPUnit_Util_XML::prepareString($buffer)
);
$error->setAttribute('type', get_class($e));
$this->currentTestCase->appendChild($error);
$this->testSuiteErrors[$this->testSuiteLevel]++;
}
}
/**
* A failure occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
*/
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
if ($this->currentTestCase !== NULL) {
if (!$test instanceof PHPUnit_Framework_Warning) {
if ($test instanceof PHPUnit_Framework_SelfDescribing) {
$buffer = $test->toString() . "\n";
} else {
$buffer = '';
}
$buffer .= PHPUnit_Framework_TestFailure::exceptionToString($e) .
"\n" .
PHPUnit_Util_Filter::getFilteredStacktrace($e);
$failure = $this->document->createElement(
'failure', PHPUnit_Util_XML::prepareString($buffer)
);
$failure->setAttribute('type', get_class($e));
$this->currentTestCase->appendChild($failure);
$this->testSuiteFailures[$this->testSuiteLevel]++;
}
}
}
/**
* Incomplete test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
if ($this->logIncompleteSkipped && $this->currentTestCase !== NULL) {
$error = $this->document->createElement(
'error',
PHPUnit_Util_XML::prepareString(
"Incomplete Test\n" .
PHPUnit_Util_Filter::getFilteredStacktrace($e)
)
);
$error->setAttribute('type', get_class($e));
$this->currentTestCase->appendChild($error);
$this->testSuiteErrors[$this->testSuiteLevel]++;
} else {
$this->attachCurrentTestCase = FALSE;
}
}
/**
* Skipped test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
* @since Method available since Release 3.0.0
*/
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
if ($this->logIncompleteSkipped && $this->currentTestCase !== NULL) {
$error = $this->document->createElement(
'error',
PHPUnit_Util_XML::prepareString(
"Skipped Test\n" .
PHPUnit_Util_Filter::getFilteredStacktrace($e)
)
);
$error->setAttribute('type', get_class($e));
$this->currentTestCase->appendChild($error);
$this->testSuiteErrors[$this->testSuiteLevel]++;
} else {
$this->attachCurrentTestCase = FALSE;
}
}
/**
* A testsuite started.
*
* @param PHPUnit_Framework_TestSuite $suite
* @since Method available since Release 2.2.0
*/
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
$testSuite = $this->document->createElement('testsuite');
$testSuite->setAttribute('name', $suite->getName());
if (class_exists($suite->getName(), FALSE)) {
try {
$class = new ReflectionClass($suite->getName());
$testSuite->setAttribute('file', $class->getFileName());
$packageInformation = PHPUnit_Util_Class::getPackageInformation(
$suite->getName(), $class->getDocComment()
);
if (!empty($packageInformation['namespace'])) {
$testSuite->setAttribute(
'namespace', $packageInformation['namespace']
);
}
if (!empty($packageInformation['fullPackage'])) {
$testSuite->setAttribute(
'fullPackage', $packageInformation['fullPackage']
);
}
if (!empty($packageInformation['category'])) {
$testSuite->setAttribute(
'category', $packageInformation['category']
);
}
if (!empty($packageInformation['package'])) {
$testSuite->setAttribute(
'package', $packageInformation['package']
);
}
if (!empty($packageInformation['subpackage'])) {
$testSuite->setAttribute(
'subpackage', $packageInformation['subpackage']
);
}
}
catch (ReflectionException $e) {
}
}
if ($this->testSuiteLevel > 0) {
$this->testSuites[$this->testSuiteLevel]->appendChild($testSuite);
} else {
$this->root->appendChild($testSuite);
}
$this->testSuiteLevel++;
$this->testSuites[$this->testSuiteLevel] = $testSuite;
$this->testSuiteTests[$this->testSuiteLevel] = 0;
$this->testSuiteAssertions[$this->testSuiteLevel] = 0;
$this->testSuiteErrors[$this->testSuiteLevel] = 0;
$this->testSuiteFailures[$this->testSuiteLevel] = 0;
$this->testSuiteTimes[$this->testSuiteLevel] = 0;
}
/**
* A testsuite ended.
*
* @param PHPUnit_Framework_TestSuite $suite
* @since Method available since Release 2.2.0
*/
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
$this->testSuites[$this->testSuiteLevel]->setAttribute(
'tests', $this->testSuiteTests[$this->testSuiteLevel]
);
$this->testSuites[$this->testSuiteLevel]->setAttribute(
'assertions', $this->testSuiteAssertions[$this->testSuiteLevel]
);
$this->testSuites[$this->testSuiteLevel]->setAttribute(
'failures', $this->testSuiteFailures[$this->testSuiteLevel]
);
$this->testSuites[$this->testSuiteLevel]->setAttribute(
'errors', $this->testSuiteErrors[$this->testSuiteLevel]
);
$this->testSuites[$this->testSuiteLevel]->setAttribute(
'time', sprintf('%F', $this->testSuiteTimes[$this->testSuiteLevel])
);
if ($this->testSuiteLevel > 1) {
$this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel];
$this->testSuiteAssertions[$this->testSuiteLevel - 1] += $this->testSuiteAssertions[$this->testSuiteLevel];
$this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel];
$this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel];
$this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel];
}
$this->testSuiteLevel--;
}
/**
* A test started.
*
* @param PHPUnit_Framework_Test $test
*/
public function startTest(PHPUnit_Framework_Test $test)
{
if (!$test instanceof PHPUnit_Framework_Warning) {
$testCase = $this->document->createElement('testcase');
$testCase->setAttribute('name', $test->getName());
if ($test instanceof PHPUnit_Framework_TestCase) {
$class = new ReflectionClass($test);
$methodName = $test->getName();
if ($class->hasMethod($methodName)) {
$method = $class->getMethod($test->getName());
$testCase->setAttribute('class', $class->getName());
$testCase->setAttribute('file', $class->getFileName());
$testCase->setAttribute('line', $method->getStartLine());
}
}
$this->currentTestCase = $testCase;
}
}
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$test instanceof PHPUnit_Framework_Warning) {
if ($this->attachCurrentTestCase) {
if ($test instanceof PHPUnit_Framework_TestCase) {
$numAssertions = $test->getNumAssertions();
$this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions;
$this->currentTestCase->setAttribute(
'assertions', $numAssertions
);
}
$this->currentTestCase->setAttribute(
'time', sprintf('%F', $time)
);
$this->testSuites[$this->testSuiteLevel]->appendChild(
$this->currentTestCase
);
$this->testSuiteTests[$this->testSuiteLevel]++;
$this->testSuiteTimes[$this->testSuiteLevel] += $time;
}
}
$this->attachCurrentTestCase = TRUE;
$this->currentTestCase = NULL;
}
/**
* Returns the XML as a string.
*
* @return string
* @since Method available since Release 2.2.0
*/
public function getXML()
{
return $this->document->saveXML();
}
/**
* Enables or disables the writing of the document
* in flush().
*
* This is a "hack" needed for the integration of
* PHPUnit with Phing.
*
* @return string
* @since Method available since Release 2.2.0
*/
public function setWriteDocument($flag)
{
if (is_bool($flag)) {
$this->writeDocument = $flag;
}
}
}
| {
"pile_set_name": "Github"
} |
#import "CSStreamHandle.h"
#include <bzlib.h>
#define CSBzip2Handle XADBzip2Handle
extern NSString *CSBzip2Exception;
@interface CSBzip2Handle:CSStreamHandle
{
CSHandle *parent;
off_t startoffs;
bz_stream bzs;
BOOL inited,checksumcorrect;
uint8_t inbuffer[16*1024];
}
+(CSBzip2Handle *)bzip2HandleWithHandle:(CSHandle *)handle;
+(CSBzip2Handle *)bzip2HandleWithHandle:(CSHandle *)handle length:(off_t)length;
// Initializers.
-(id)initWithHandle:(CSHandle *)handle length:(off_t)length name:(NSString *)descname;
-(void)dealloc;
// Implemented by this class.
-(void)resetStream;
-(int)streamAtMost:(int)num toBuffer:(void *)buffer;
// Checksum functions for XADMaster.
-(BOOL)hasChecksum;
-(BOOL)isChecksumCorrect;
// Internal methods.
-(void)_raiseBzip2:(int)error;
@end
| {
"pile_set_name": "Github"
} |
#include "JavascriptInvocation.h"
#include "WebPage.h"
#include "InvocationResult.h"
#include <QApplication>
#include <QEvent>
#include <QContextMenuEvent>
QMap<QString, Qt::KeyboardModifiers> JavascriptInvocation::m_modifiersMap(JavascriptInvocation::makeModifiersMap());
JavascriptInvocation::JavascriptInvocation(const QString &functionName, bool allowUnattached, const QStringList &arguments, WebPage *page, QObject *parent) : QObject(parent) {
m_functionName = functionName;
m_allowUnattached = allowUnattached;
m_arguments = arguments;
m_page = page;
}
QString &JavascriptInvocation::functionName() {
return m_functionName;
}
bool JavascriptInvocation::allowUnattached() {
return m_allowUnattached;
}
QStringList &JavascriptInvocation::arguments() {
return m_arguments;
}
QVariant JavascriptInvocation::getError() {
return m_error;
}
void JavascriptInvocation::setError(QVariant error) {
m_error = error;
}
InvocationResult JavascriptInvocation::invoke(QWebFrame *frame) {
frame->addToJavaScriptWindowObject("CapybaraInvocation", this);
QVariant result = frame->evaluateJavaScript("Capybara.invoke()");
if (getError().isValid())
return InvocationResult(getError(), true);
else {
if (functionName() == "leftClick") {
// Don't trigger the left click from JS incase the frame closes
QVariantMap qm = result.toMap();
leftClick(qm["absoluteX"].toInt(), qm["absoluteY"].toInt(), qm["keys"].value<QVariantList>());
}
return InvocationResult(result);
}
}
Qt::KeyboardModifiers JavascriptInvocation::modifiers(const QVariantList& keys){
Qt::KeyboardModifiers modifiers = Qt::NoModifier;
for (int i = 0; i < keys.length(); i++) {
modifiers |= m_modifiersMap.value(keys[i].toString(), Qt::NoModifier);
}
return modifiers;
}
void JavascriptInvocation::leftClick(int x, int y, QVariantList keys) {
QPoint mousePos(x, y);
m_page->mouseEvent(QEvent::MouseButtonPress, mousePos, Qt::LeftButton, modifiers(keys));
m_page->mouseEvent(QEvent::MouseButtonRelease, mousePos, Qt::LeftButton, modifiers(keys));
}
void JavascriptInvocation::rightClick(int x, int y, QVariantList keys) {
QPoint mousePos(x, y);
m_page->mouseEvent(QEvent::MouseButtonPress, mousePos, Qt::RightButton, modifiers(keys));
// swallowContextMenuEvent tries to fire contextmenu event in html page
QContextMenuEvent *event = new QContextMenuEvent(QContextMenuEvent::Mouse, mousePos, QCursor::pos(), modifiers(keys));
m_page->swallowContextMenuEvent(event);
m_page->mouseEvent(QEvent::MouseButtonRelease, mousePos, Qt::RightButton, modifiers(keys));
}
void JavascriptInvocation::doubleClick(int x, int y, QVariantList keys) {
QPoint mousePos(x, y);
m_page->mouseEvent(QEvent::MouseButtonDblClick, mousePos, Qt::LeftButton, modifiers(keys));
m_page->mouseEvent(QEvent::MouseButtonRelease, mousePos, Qt::LeftButton, modifiers(keys));
}
bool JavascriptInvocation::clickTest(QWebElement element, int absoluteX, int absoluteY) {
return m_page->clickTest(element, absoluteX, absoluteY);
}
QVariantMap JavascriptInvocation::clickPosition(QWebElement element, int left, int top, int width, int height) {
QRect elementBox(left, top, width, height);
QRect viewport(QPoint(0, 0), m_page->viewportSize());
QRect boundedBox = elementBox.intersected(viewport);
QPoint mousePos = boundedBox.center();
QVariantMap m;
m["relativeX"] = mousePos.x();
m["relativeY"] = mousePos.y();
m["relativeTop"] = boundedBox.top();
m["relativeLeft"] = boundedBox.left();
QWebFrame *parent = element.webFrame();
while (parent) {
elementBox.translate(parent->geometry().topLeft());
parent = parent->parentFrame();
}
boundedBox = elementBox.intersected(viewport);
mousePos = boundedBox.center();
m["absoluteTop"] = boundedBox.top();
m["absoluteLeft"] = boundedBox.left();
m["absoluteX"] = mousePos.x();
m["absoluteY"] = mousePos.y();
return m;
}
void JavascriptInvocation::hover(int absoluteX, int absoluteY) {
QPoint mousePos(absoluteX, absoluteY);
hover(mousePos);
}
void JavascriptInvocation::hover(const QPoint &mousePos) {
m_page->mouseEvent(QEvent::MouseMove, mousePos, Qt::NoButton);
}
int JavascriptInvocation::keyCodeFor(const QChar &key) {
switch(key.unicode()) {
case 0x18:
return Qt::Key_Cancel;
case 0x08:
return Qt::Key_Backspace;
case 0x09:
return Qt::Key_Tab;
case 0x0A:
return Qt::Key_Return;
case 0x1B:
return Qt::Key_Escape;
case 0x7F:
return Qt::Key_Delete;
default:
int keyCode = key.toUpper().toLatin1();
if (keyCode >= Qt::Key_Space || keyCode <= Qt::Key_AsciiTilde)
return keyCode;
else
return Qt::Key_unknown;
}
}
int JavascriptInvocation::keyCodeForName(const QString &keyName) {
const QMetaObject &mo = JavascriptInvocation::staticMetaObject;
int prop_index = mo.indexOfProperty("key_enum");
QMetaProperty metaProperty = mo.property(prop_index);
QMetaEnum metaEnum = metaProperty.enumerator();
QByteArray array ((QString("Key_") + keyName).toStdString().c_str());
return metaEnum.keyToValue(array);
// return Qt::Key_unknown;
}
void JavascriptInvocation::keypress(QChar key) {
int keyCode = keyCodeFor(key);
QKeyEvent event(QKeyEvent::KeyPress, keyCode, m_currentModifiers, (m_currentModifiers ? QString() : key));
QApplication::sendEvent(m_page, &event);
event = QKeyEvent(QKeyEvent::KeyRelease, keyCode, m_currentModifiers);
QApplication::sendEvent(m_page, &event);
}
void JavascriptInvocation::namedKeypress(QString keyName, QString modifiers){
Qt::KeyboardModifiers key_modifiers(m_currentModifiers);
if (modifiers == "Keypad") {
key_modifiers |= Qt::KeypadModifier;
};
int keyCode = keyCodeForName(keyName);
QKeyEvent event(QKeyEvent::KeyPress, keyCode, key_modifiers);
QApplication::sendEvent(m_page, &event);
event = QKeyEvent(QKeyEvent::KeyRelease, keyCode, key_modifiers);
QApplication::sendEvent(m_page, &event);
}
void JavascriptInvocation::namedKeydown(QString keyName){
int keyCode = keyCodeForName(keyName);
QKeyEvent event(QKeyEvent::KeyPress, keyCode, m_currentModifiers);
QApplication::sendEvent(m_page, &event);
switch(keyCode){
case Qt::Key_Shift:
m_currentModifiers |= Qt::ShiftModifier;
break;
case Qt::Key_Control:
m_currentModifiers |= Qt::ControlModifier;
break;
case Qt::Key_Alt:
m_currentModifiers |= Qt::AltModifier;
break;
case Qt::Key_Meta:
m_currentModifiers |= Qt::MetaModifier;
break;
};
}
void JavascriptInvocation::namedKeyup(QString keyName){
int keyCode = keyCodeForName(keyName);
QKeyEvent event(QKeyEvent::KeyRelease, keyCode, m_currentModifiers, 0);
QApplication::sendEvent(m_page, &event);
switch(keyCode){
case Qt::Key_Shift:
m_currentModifiers &= ~Qt::ShiftModifier;
break;
case Qt::Key_Control:
m_currentModifiers &= ~Qt::ControlModifier;
break;
case Qt::Key_Alt:
m_currentModifiers &= ~Qt::AltModifier;
break;
case Qt::Key_Meta:
m_currentModifiers &= ~Qt::MetaModifier;
break;
};
}
const QString JavascriptInvocation::render(void) {
QString pathTemplate =
QDir::temp().absoluteFilePath("./click_failed_XXXXXX.png");
QTemporaryFile file(pathTemplate);
file.open();
file.setAutoRemove(false);
QString path = file.fileName();
m_page->render(path, QSize(1024, 768));
return path;
}
QMap<QString, Qt::KeyboardModifiers> JavascriptInvocation::makeModifiersMap(){
QMap<QString, Qt::KeyboardModifiers> map;
map["alt"] = Qt::AltModifier;
map["control"] = Qt::ControlModifier;
map["meta"] = Qt::MetaModifier;
map["shift"] = Qt::ShiftModifier;
return map;
}
| {
"pile_set_name": "Github"
} |
#pragma once
#include <agz/editor/resource/pool/name_resource_pool_ui.h>
#include <agz/editor/resource/resource.h>
AGZ_EDITOR_BEGIN
class Editor;
template<typename TracerObject>
class NameResourcePool : public QObject, public ResourcePool<TracerObject>
{
public:
NameResourcePool(
ObjectContext &obj_ctx, Editor *editor, const QString &default_type);
Box<ResourceReference<TracerObject>> select_resource() override;
ResourceInPool<TracerObject> *add_resource(
const QString &name, Box<ResourcePanel<TracerObject>> panel) override;
void save_asset(AssetSaver &saver) const override;
void load_asset(AssetLoader &loader) override;
void to_config(
tracer::ConfigGroup &scene_grp, JSONExportContext &ctx) const override;
ResourceInPool<TracerObject> *name_to_rsc(const QString &name) override;
bool is_valid_name(const QString &name) const override;
QString to_valid_name(const QString &name) const override;
void show_edit_panel(
ResourcePanel<TracerObject> *rsc, bool display_rsc_panel) override;
QWidget *get_widget() override;
private:
struct Record
{
QString name;
Box<ResourceInPool<TracerObject>> rsc;
};
QString default_type_;
ObjectContext &obj_ctx_;
Editor *editor_ = nullptr;
std::map<QString, Box<Record>> name2record_;
NameResourcePoolWidget *widget_ = nullptr;
};
AGZ_EDITOR_END
| {
"pile_set_name": "Github"
} |
/*
* Realtek RTL28xxU DVB USB driver
*
* Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
* Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef RTL28XXU_H
#define RTL28XXU_H
#define DVB_USB_LOG_PREFIX "rtl28xxu"
#include "dvb-usb.h"
#define deb_info(args...) dprintk(dvb_usb_rtl28xxu_debug, 0x01, args)
#define deb_rc(args...) dprintk(dvb_usb_rtl28xxu_debug, 0x02, args)
#define deb_xfer(args...) dprintk(dvb_usb_rtl28xxu_debug, 0x04, args)
#define deb_reg(args...) dprintk(dvb_usb_rtl28xxu_debug, 0x08, args)
#define deb_i2c(args...) dprintk(dvb_usb_rtl28xxu_debug, 0x10, args)
#define deb_fw(args...) dprintk(dvb_usb_rtl28xxu_debug, 0x20, args)
#define deb_dump(r, t, v, i, b, l, func) { \
int loop_; \
func("%02x %02x %02x %02x %02x %02x %02x %02x", \
t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
func(" >>> "); \
else \
func(" <<< "); \
for (loop_ = 0; loop_ < l; loop_++) \
func("%02x ", b[loop_]); \
func("\n");\
}
/*
* USB commands
* (usb_control_msg() index parameter)
*/
#define DEMOD 0x0000
#define USB 0x0100
#define SYS 0x0200
#define I2C 0x0300
#define I2C_DA 0x0600
#define CMD_WR_FLAG 0x0010
#define CMD_DEMOD_RD 0x0000
#define CMD_DEMOD_WR 0x0010
#define CMD_USB_RD 0x0100
#define CMD_USB_WR 0x0110
#define CMD_SYS_RD 0x0200
#define CMD_IR_RD 0x0201
#define CMD_IR_WR 0x0211
#define CMD_SYS_WR 0x0210
#define CMD_I2C_RD 0x0300
#define CMD_I2C_WR 0x0310
#define CMD_I2C_DA_RD 0x0600
#define CMD_I2C_DA_WR 0x0610
struct rtl28xxu_priv {
u8 chip_id;
u8 tuner;
u8 page; /* integrated demod active register page */
bool rc_active;
};
enum rtl28xxu_chip_id {
CHIP_ID_NONE,
CHIP_ID_RTL2831U,
CHIP_ID_RTL2832U,
};
enum rtl28xxu_tuner {
TUNER_NONE,
TUNER_RTL2830_QT1010,
TUNER_RTL2830_MT2060,
TUNER_RTL2830_MXL5005S,
TUNER_RTL2832_MT2266,
TUNER_RTL2832_FC2580,
TUNER_RTL2832_MT2063,
TUNER_RTL2832_MAX3543,
TUNER_RTL2832_TUA9001,
TUNER_RTL2832_MXL5007T,
TUNER_RTL2832_FC0012,
TUNER_RTL2832_E4000,
TUNER_RTL2832_TDA18272,
TUNER_RTL2832_FC0013,
};
struct rtl28xxu_req {
u16 value;
u16 index;
u16 size;
u8 *data;
};
struct rtl28xxu_reg_val {
u16 reg;
u8 val;
};
/*
* memory map
*
* 0x0000 DEMOD : demodulator
* 0x2000 USB : SIE, USB endpoint, debug, DMA
* 0x3000 SYS : system
* 0xfc00 RC : remote controller (not RTL2831U)
*/
/*
* USB registers
*/
/* SIE Control Registers */
#define USB_SYSCTL 0x2000 /* USB system control */
#define USB_SYSCTL_0 0x2000 /* USB system control */
#define USB_SYSCTL_1 0x2001 /* USB system control */
#define USB_SYSCTL_2 0x2002 /* USB system control */
#define USB_SYSCTL_3 0x2003 /* USB system control */
#define USB_IRQSTAT 0x2008 /* SIE interrupt status */
#define USB_IRQEN 0x200C /* SIE interrupt enable */
#define USB_CTRL 0x2010 /* USB control */
#define USB_STAT 0x2014 /* USB status */
#define USB_DEVADDR 0x2018 /* USB device address */
#define USB_TEST 0x201C /* USB test mode */
#define USB_FRAME_NUMBER 0x2020 /* frame number */
#define USB_FIFO_ADDR 0x2028 /* address of SIE FIFO RAM */
#define USB_FIFO_CMD 0x202A /* SIE FIFO RAM access command */
#define USB_FIFO_DATA 0x2030 /* SIE FIFO RAM data */
/* Endpoint Registers */
#define EP0_SETUPA 0x20F8 /* EP 0 setup packet lower byte */
#define EP0_SETUPB 0x20FC /* EP 0 setup packet higher byte */
#define USB_EP0_CFG 0x2104 /* EP 0 configure */
#define USB_EP0_CTL 0x2108 /* EP 0 control */
#define USB_EP0_STAT 0x210C /* EP 0 status */
#define USB_EP0_IRQSTAT 0x2110 /* EP 0 interrupt status */
#define USB_EP0_IRQEN 0x2114 /* EP 0 interrupt enable */
#define USB_EP0_MAXPKT 0x2118 /* EP 0 max packet size */
#define USB_EP0_BC 0x2120 /* EP 0 FIFO byte counter */
#define USB_EPA_CFG 0x2144 /* EP A configure */
#define USB_EPA_CFG_0 0x2144 /* EP A configure */
#define USB_EPA_CFG_1 0x2145 /* EP A configure */
#define USB_EPA_CFG_2 0x2146 /* EP A configure */
#define USB_EPA_CFG_3 0x2147 /* EP A configure */
#define USB_EPA_CTL 0x2148 /* EP A control */
#define USB_EPA_CTL_0 0x2148 /* EP A control */
#define USB_EPA_CTL_1 0x2149 /* EP A control */
#define USB_EPA_CTL_2 0x214A /* EP A control */
#define USB_EPA_CTL_3 0x214B /* EP A control */
#define USB_EPA_STAT 0x214C /* EP A status */
#define USB_EPA_IRQSTAT 0x2150 /* EP A interrupt status */
#define USB_EPA_IRQEN 0x2154 /* EP A interrupt enable */
#define USB_EPA_MAXPKT 0x2158 /* EP A max packet size */
#define USB_EPA_MAXPKT_0 0x2158 /* EP A max packet size */
#define USB_EPA_MAXPKT_1 0x2159 /* EP A max packet size */
#define USB_EPA_MAXPKT_2 0x215A /* EP A max packet size */
#define USB_EPA_MAXPKT_3 0x215B /* EP A max packet size */
#define USB_EPA_FIFO_CFG 0x2160 /* EP A FIFO configure */
#define USB_EPA_FIFO_CFG_0 0x2160 /* EP A FIFO configure */
#define USB_EPA_FIFO_CFG_1 0x2161 /* EP A FIFO configure */
#define USB_EPA_FIFO_CFG_2 0x2162 /* EP A FIFO configure */
#define USB_EPA_FIFO_CFG_3 0x2163 /* EP A FIFO configure */
/* Debug Registers */
#define USB_PHYTSTDIS 0x2F04 /* PHY test disable */
#define USB_TOUT_VAL 0x2F08 /* USB time-out time */
#define USB_VDRCTRL 0x2F10 /* UTMI vendor signal control */
#define USB_VSTAIN 0x2F14 /* UTMI vendor signal status in */
#define USB_VLOADM 0x2F18 /* UTMI load vendor signal status in */
#define USB_VSTAOUT 0x2F1C /* UTMI vendor signal status out */
#define USB_UTMI_TST 0x2F80 /* UTMI test */
#define USB_UTMI_STATUS 0x2F84 /* UTMI status */
#define USB_TSTCTL 0x2F88 /* test control */
#define USB_TSTCTL2 0x2F8C /* test control 2 */
#define USB_PID_FORCE 0x2F90 /* force PID */
#define USB_PKTERR_CNT 0x2F94 /* packet error counter */
#define USB_RXERR_CNT 0x2F98 /* RX error counter */
#define USB_MEM_BIST 0x2F9C /* MEM BIST test */
#define USB_SLBBIST 0x2FA0 /* self-loop-back BIST */
#define USB_CNTTEST 0x2FA4 /* counter test */
#define USB_PHYTST 0x2FC0 /* USB PHY test */
#define USB_DBGIDX 0x2FF0 /* select individual block debug signal */
#define USB_DBGMUX 0x2FF4 /* debug signal module mux */
/*
* SYS registers
*/
/* demod control registers */
#define SYS_SYS0 0x3000 /* include DEMOD_CTL, GPO, GPI, GPOE */
#define SYS_DEMOD_CTL 0x3000 /* control register for DVB-T demodulator */
/* GPIO registers */
#define SYS_GPIO_OUT_VAL 0x3001 /* output value of GPIO */
#define SYS_GPIO_IN_VAL 0x3002 /* input value of GPIO */
#define SYS_GPIO_OUT_EN 0x3003 /* output enable of GPIO */
#define SYS_SYS1 0x3004 /* include GPD, SYSINTE, SYSINTS, GP_CFG0 */
#define SYS_GPIO_DIR 0x3004 /* direction control for GPIO */
#define SYS_SYSINTE 0x3005 /* system interrupt enable */
#define SYS_SYSINTS 0x3006 /* system interrupt status */
#define SYS_GPIO_CFG0 0x3007 /* PAD configuration for GPIO0-GPIO3 */
#define SYS_SYS2 0x3008 /* include GP_CFG1 and 3 reserved bytes */
#define SYS_GPIO_CFG1 0x3008 /* PAD configuration for GPIO4 */
#define SYS_DEMOD_CTL1 0x300B
/* IrDA registers */
#define SYS_IRRC_PSR 0x3020 /* IR protocol selection */
#define SYS_IRRC_PER 0x3024 /* IR protocol extension */
#define SYS_IRRC_SF 0x3028 /* IR sampling frequency */
#define SYS_IRRC_DPIR 0x302C /* IR data package interval */
#define SYS_IRRC_CR 0x3030 /* IR control */
#define SYS_IRRC_RP 0x3034 /* IR read port */
#define SYS_IRRC_SR 0x3038 /* IR status */
/* I2C master registers */
#define SYS_I2CCR 0x3040 /* I2C clock */
#define SYS_I2CMCR 0x3044 /* I2C master control */
#define SYS_I2CMSTR 0x3048 /* I2C master SCL timing */
#define SYS_I2CMSR 0x304C /* I2C master status */
#define SYS_I2CMFR 0x3050 /* I2C master FIFO */
/*
* IR registers
*/
#define IR_RX_BUF 0xFC00
#define IR_RX_IE 0xFD00
#define IR_RX_IF 0xFD01
#define IR_RX_CTRL 0xFD02
#define IR_RX_CFG 0xFD03
#define IR_MAX_DURATION0 0xFD04
#define IR_MAX_DURATION1 0xFD05
#define IR_IDLE_LEN0 0xFD06
#define IR_IDLE_LEN1 0xFD07
#define IR_GLITCH_LEN 0xFD08
#define IR_RX_BUF_CTRL 0xFD09
#define IR_RX_BUF_DATA 0xFD0A
#define IR_RX_BC 0xFD0B
#define IR_RX_CLK 0xFD0C
#define IR_RX_C_COUNT_L 0xFD0D
#define IR_RX_C_COUNT_H 0xFD0E
#define IR_SUSPEND_CTRL 0xFD10
#define IR_ERR_TOL_CTRL 0xFD11
#define IR_UNIT_LEN 0xFD12
#define IR_ERR_TOL_LEN 0xFD13
#define IR_MAX_H_TOL_LEN 0xFD14
#define IR_MAX_L_TOL_LEN 0xFD15
#define IR_MASK_CTRL 0xFD16
#define IR_MASK_DATA 0xFD17
#define IR_RES_MASK_ADDR 0xFD18
#define IR_RES_MASK_T_LEN 0xFD19
#endif
| {
"pile_set_name": "Github"
} |
FactoryBot.define do
factory :user_host_access_group do
user { nil }
host_access_group { nil }
end
end
| {
"pile_set_name": "Github"
} |
import java.util.*;
class MinStack {
Stack<Integer> data = new Stack<Integer>();
Stack<Integer> minData = new Stack<Integer>();
public MinStack() {}
public void push(int x) {
data.push(x);
if (minData.isEmpty() || x <= getMin()) {
minData.push(x);
}
}
public int pop() {
if (!data.isEmpty()) {
int v = data.pop();
if (v == getMin()) {
minData.pop();
}
return v;
} else {
throw new RuntimeException();
}
}
public int top() {
if (data.isEmpty()) throw new RuntimeException();
return data.peek();
}
public int getMin() {
if (minData.isEmpty()) throw new RuntimeException();
return minData.peek();
}
public static void main(String[] args) {
MinStack ms = new MinStack();
ms.push(-1);
ms.push(-2);
ms.push(0);
System.out.format("%d\n", ms.getMin());
ms.pop();
System.out.format("%d\n", ms.getMin());
ms.pop();
System.out.format("%d\n", ms.getMin());
}
}
| {
"pile_set_name": "Github"
} |
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Collections.Generic;
using UnityEditor.ShortcutManagement;
using UnityEngine;
namespace UnityEditor
{
[PriorityContext, ReserveModifiers(ShortcutModifiers.Shift)]
class CameraFlyModeContext : IShortcutToolContext
{
public struct InputSamplingScope : IDisposable
{
bool active => m_ArrowKeysActive || m_Context.active;
public bool currentlyMoving => active && !Mathf.Approximately(currentInputVector.sqrMagnitude, 0f);
public Vector3 currentInputVector => active ? s_CurrentInputVector : Vector3.zero;
public bool inputVectorChanged => active && !Mathf.Approximately((s_CurrentInputVector - m_Context.m_PreviousVector).sqrMagnitude, 0f);
readonly bool m_ArrowKeysActive;
bool m_Disposed;
readonly CameraFlyModeContext m_Context;
// controlID will get hotControl if using arrow keys while shortcut context is not active
// passing a value of zero disables the arrow keys
public InputSamplingScope(CameraFlyModeContext context, ViewTool currentViewTool, int controlID, EditorWindow window, bool orthographic = false)
{
m_ArrowKeysActive = false;
m_Disposed = false;
m_Context = context;
m_Context.active = currentViewTool == ViewTool.FPS;
m_Context.m_Window = window;
if (m_Context.active)
{
ShortcutIntegration.instance.contextManager.RegisterToolContext(context);
ForceArrowKeysUp(orthographic);
}
else
{
ShortcutIntegration.instance.contextManager.DeregisterToolContext(context);
m_ArrowKeysActive = DoArrowKeys(controlID, orthographic);
}
if (currentlyMoving && Mathf.Approximately(m_Context.m_PreviousVector.sqrMagnitude, 0f))
s_Timer.Begin();
}
public void Dispose()
{
if (m_Disposed)
return;
m_Disposed = true;
m_Context.m_PreviousVector = currentInputVector;
}
static readonly Dictionary<KeyCode, Action<bool, ShortcutArguments>> s_ArrowKeyBindings =
new Dictionary<KeyCode, Action<bool, ShortcutArguments>>
{
{ KeyCode.UpArrow, (orthographic, args) => { if (orthographic) WalkUp(args); else WalkForward(args); } },
{ KeyCode.DownArrow, (orthographic, args) => { if (orthographic) WalkDown(args); else WalkBackward(args); } },
{ KeyCode.LeftArrow, (orthographic, args) => WalkLeft(args) },
{ KeyCode.RightArrow, (orthographic, args) => WalkRight(args) },
};
static readonly HashSet<KeyCode> s_ArrowKeysDown = new HashSet<KeyCode>();
void ForceArrowKeysUp(bool orthographic)
{
foreach (KeyCode key in s_ArrowKeysDown)
{
var action = s_ArrowKeyBindings[key];
action(orthographic, new ShortcutArguments { stage = ShortcutStage.End, context = m_Context });
}
s_ArrowKeysDown.Clear();
}
bool DoArrowKeys(int id, bool orthographic)
{
if (id == 0 || GUIUtility.hotControl != 0 && GUIUtility.hotControl != id)
return false;
if (EditorGUI.actionKey)
return false;
Action<bool, ShortcutArguments> action;
var evt = Event.current;
switch (evt.GetTypeForControl(id))
{
case EventType.KeyDown:
if (!s_ArrowKeyBindings.TryGetValue(evt.keyCode, out action))
return false;
action(orthographic, new ShortcutArguments { stage = ShortcutStage.Begin, context = m_Context });
GUIUtility.hotControl = id;
s_ArrowKeysDown.Add(evt.keyCode);
evt.Use();
return true;
case EventType.KeyUp:
if (!s_ArrowKeyBindings.TryGetValue(evt.keyCode, out action))
return false;
action(orthographic, new ShortcutArguments { stage = ShortcutStage.End, context = m_Context });
s_ArrowKeysDown.Remove(evt.keyCode);
if (s_ArrowKeysDown.Count == 0)
{
GUIUtility.hotControl = 0;
s_CurrentInputVector = Vector3.zero;
}
evt.Use();
return true;
default:
return GUIUtility.hotControl == id;
}
}
}
public bool active { get; set; }
EditorWindow m_Window;
Vector3 m_PreviousVector;
public static float deltaTime => s_Timer.Update();
static TimeHelper s_Timer = new TimeHelper();
static Vector3 s_CurrentInputVector;
[ClutchShortcut("3D Viewport/Fly Mode Forward", typeof(CameraFlyModeContext), KeyCode.W)]
[FormerlyPrefKeyAs("View/FPS Forward", "w")]
static void WalkForward(ShortcutArguments args)
{
s_CurrentInputVector.z = args.stage == ShortcutStage.Begin ? 1f : s_CurrentInputVector.z > 0f ? 0f : s_CurrentInputVector.z;
var context = (CameraFlyModeContext)args.context;
context.m_Window.Repaint();
}
[ClutchShortcut("3D Viewport/Fly Mode Backward", typeof(CameraFlyModeContext), KeyCode.S)]
[FormerlyPrefKeyAs("View/FPS Back", "s")]
static void WalkBackward(ShortcutArguments args)
{
s_CurrentInputVector.z = args.stage == ShortcutStage.Begin ? -1f : s_CurrentInputVector.z < 0f ? 0f : s_CurrentInputVector.z;
var context = (CameraFlyModeContext)args.context;
context.m_Window.Repaint();
}
[ClutchShortcut("3D Viewport/Fly Mode Left", typeof(CameraFlyModeContext), KeyCode.A)]
[FormerlyPrefKeyAs("View/FPS Strafe Left", "a")]
static void WalkLeft(ShortcutArguments args)
{
s_CurrentInputVector.x = args.stage == ShortcutStage.Begin ? -1f : s_CurrentInputVector.x < 0f ? 0f : s_CurrentInputVector.x;
var context = (CameraFlyModeContext)args.context;
context.m_Window.Repaint();
}
[ClutchShortcut("3D Viewport/Fly Mode Right", typeof(CameraFlyModeContext), KeyCode.D)]
[FormerlyPrefKeyAs("View/FPS Strafe Right", "d")]
static void WalkRight(ShortcutArguments args)
{
s_CurrentInputVector.x = args.stage == ShortcutStage.Begin ? 1f : s_CurrentInputVector.x > 0f ? 0f : s_CurrentInputVector.x;
var context = (CameraFlyModeContext)args.context;
context.m_Window.Repaint();
}
[ClutchShortcut("3D Viewport/Fly Mode Up", typeof(CameraFlyModeContext), KeyCode.E)]
[FormerlyPrefKeyAs("View/FPS Strafe Up", "e")]
static void WalkUp(ShortcutArguments args)
{
s_CurrentInputVector.y = args.stage == ShortcutStage.Begin ? 1f : s_CurrentInputVector.y > 0f ? 0f : s_CurrentInputVector.y;
var context = (CameraFlyModeContext)args.context;
context.m_Window.Repaint();
}
[ClutchShortcut("3D Viewport/Fly Mode Down", typeof(CameraFlyModeContext), KeyCode.Q)]
[FormerlyPrefKeyAs("View/FPS Strafe Down", "q")]
static void WalkDown(ShortcutArguments args)
{
s_CurrentInputVector.y = args.stage == ShortcutStage.Begin ? -1f : s_CurrentInputVector.y < 0f ? 0f : s_CurrentInputVector.y;
var context = (CameraFlyModeContext)args.context;
context.m_Window.Repaint();
}
}
}
| {
"pile_set_name": "Github"
} |
function ternary(cond,then_,else_) if cond then return then_() else return else_() end end
function ternary_value(cond,then_,else_) if cond then return then_ else return else_ end end
function eps() return 1e-18; end
function pi() return 3.1415926535897932384; end
function random() return math.random(); end
function irandom() return math.floor(math.random() * 4294967296); end
function clip(x,low,high) if x < low then return low else if x > high then return high else return x end end end
function real(x) return x; end
function int(x) local int_part,_ = math.modf(x) return int_part; end
function sin(x) return math.sin(x); end
function cos(x) return math.cos(x); end
function abs(x) return math.abs(x); end
function exp(x) return math.exp(x); end
function floor(x) return math.floor(x); end
function tan(x) return math.tan(x); end
function tanh(x) return math.tanh(x); end
function pow(a,b) return math.pow(a,b); end
function log10(x) return math.log10(x); end
function log(x) return math.log(x); end
function sqrt(x) return x; end
function set(a, i, v) a[i+1]=v; end
function get(a, i) return a[i+1]; end
function makeArray(size, v) local a = {}; for i=1,size do a[i]=v end return a; end
function makeComplexArray(size, f) local a = {}; for i=1,size do a[i]=f() end return a; end
function wrap_array(a) return a; end
function Util__ctx_type_0_init()
local _ctx = {};
_ctx.pre = false;
return _ctx;
end
function Util_edge_init()
return Util__ctx_type_0_init();
end
function Util_edge(_ctx,x)
local ret = (x and (_ctx.pre == false));
_ctx.pre = x;
return ret;
end
function Util__ctx_type_1_init()
local _ctx = {};
_ctx.pre_x = 0.;
return _ctx;
end
function Util_change_init()
return Util__ctx_type_1_init();
end
function Util_change(_ctx,x)
local v = (_ctx.pre_x ~= x);
_ctx.pre_x = x;
return v;
end
function Util_map(x,x0,x1,y0,y1)
return (y0 + (((x + (- x0)) * (y1 + (- y0))) / (x1 + (- x0))));
end
function Util__ctx_type_3_init()
local _ctx = {};
_ctx.y1 = 0.;
_ctx.x1 = 0.;
return _ctx;
end
function Util_dcblock_init()
return Util__ctx_type_3_init();
end
function Util_dcblock(_ctx,x0)
local y0 = (x0 + (- _ctx.x1) + (0.995 * _ctx.y1));
_ctx.x1 = x0;
_ctx.y1 = y0;
return y0;
end
function Util__ctx_type_4_init()
local _ctx = {};
_ctx.x = 0.;
return _ctx;
end
function Util_smooth_init()
return Util__ctx_type_4_init();
end
function Util_smooth(_ctx,input)
_ctx.x = (_ctx.x + (0.005 * (input + (- _ctx.x))));
return _ctx.x;
end
function Util__ctx_type_5_init()
local _ctx = {};
_ctx.x0 = 0.;
return _ctx;
end
function Util_average2_init()
return Util__ctx_type_5_init();
end
function Util_average2(_ctx,x1)
local result = (0.5 * (_ctx.x0 + x1));
_ctx.x0 = x1;
return result;
end
function Util_cubic_clipper(x)
if (x <= (-0.6666666)) then
return (-0.6666666);
else
if (x >= 0.6666667) then
return 0.6666667;
else
return (x + ((-0.3333333) * x * x * x));
end
end
end
local Util_pitchToRate_1024_c0 = {0.1898417,0.1913259,0.1986886,0.2194246,0.2656772,0.3564378,0.5206507,0.8015597,1.2627581,1.9965621,3.135544,4.8683456,7.4612795,11.2877251,16.8680071,24.9233293,36.4485185,52.8098903,75.8766039,108.1965793,153.2316185,215.6710565,301.8494285,420.3017178,582.500346,803.8319419,1104.890093,1513.1840318,2065.3942521,2810.3465753,3812.9290693,5159.2451728};
local Util_pitchToRate_1024_c1 = {0.0109134,0.0101758,0.0083338,0.004867,(-0.0009394),(-0.0100609),(-0.0238203),(-0.0440021),(-0.0730021),(-0.1140249),(-0.1713405),(-0.2506214),(-0.3593814),(-0.5075483),(-0.7082084),(-0.9785757),(-1.3412496),(-1.8258479),(-2.4711225),(-3.3277005),(-4.4616308),(-5.9589702),(-7.9317091),(-10.5254219),(-13.9291388),(-18.3880749),(-24.2200334),(-31.8365325),(-41.7699993),(-54.7087564),(-71.5420103),(-93.4176738)};
local Util_pitchToRate_1024_c2 = {0.0003556,0.0004472,0.0005624,0.0007073,0.0008895,0.0011187,0.0014069,0.0017694,0.0022253,0.0027986,0.0035197,0.0044265,0.005567,0.0070013,0.0088052,0.0110738,0.013927,0.0175152,0.022028,0.0277035,0.0348413,0.043818,0.0551077,0.0693061,0.0871628,0.1096201,0.1378636,0.173384,0.2180562,0.2742381,0.3448952,0.4337571};
function Util_pitchToRate_1024_raw_c0(index)
return Util_pitchToRate_1024_c0[index+1];
end
function Util_pitchToRate_1024_raw_c1(index)
return Util_pitchToRate_1024_c1[index+1];
end
function Util_pitchToRate_1024_raw_c2(index)
return Util_pitchToRate_1024_c2[index+1];
end
function Util_pitchToRate_1024(pitch)
local index = clip(int((0.2440945 * pitch)),0,31);
return (Util_pitchToRate_1024_c0[index+1] + (pitch * (Util_pitchToRate_1024_c1[index+1] + (pitch * Util_pitchToRate_1024_c2[index+1]))));
end
local Util_pitchToRate_c0 = {0.0001854,0.0001869,0.0001941,0.0002143,0.0002595,0.0003481,0.0005085,0.0007828,0.0012332,0.0019498,0.0030621,0.0047543,0.0072865,0.0110232,0.0164727,0.0243392,0.0355943,0.0515722,0.0740983,0.1056608,0.1496403,0.2106163,0.2947749,0.4104509,0.568848,0.7849922,1.0789943,1.4777188,2.0169866,2.7444791,3.7235636,5.0383254};
local Util_pitchToRate_c1 = {1.07e-05,1e-05,8.2e-06,4.8e-06,(-9e-07),(-9.8e-06),(-2.32e-05),(-4.29e-05),(-7.12e-05),(-0.0001113),(-0.0001673),(-0.0002447),(-0.0003509),(-0.0004956),(-0.0006916),(-0.0009556),(-0.0013098),(-0.001783),(-0.0024132),(-0.0032497),(-0.004357),(-0.0058193),(-0.0077458),(-0.0102787),(-0.0136026),(-0.0179571),(-0.0236523),(-0.0310903),(-0.040791),(-0.0534265),(-0.0698652),(-0.0912281)};
local Util_pitchToRate_c2 = {4e-07,5e-07,6e-07,7e-07,9e-07,1.1e-06,1.4e-06,1.8e-06,2.2e-06,2.8e-06,3.5e-06,4.4e-06,5.5e-06,6.9e-06,8.6e-06,1.09e-05,1.37e-05,1.72e-05,2.16e-05,2.71e-05,3.41e-05,4.28e-05,5.39e-05,6.77e-05,8.52e-05,0.0001071,0.0001347,0.0001694,0.000213,0.0002679,0.0003369,0.0004236};
function Util_pitchToRate_raw_c0(index)
return Util_pitchToRate_c0[index+1];
end
function Util_pitchToRate_raw_c1(index)
return Util_pitchToRate_c1[index+1];
end
function Util_pitchToRate_raw_c2(index)
return Util_pitchToRate_c2[index+1];
end
function Util_pitchToRate(pitch)
local index = clip(int((0.2440945 * pitch)),0,31);
return (Util_pitchToRate_c0[index+1] + (pitch * (Util_pitchToRate_c1[index+1] + (pitch * Util_pitchToRate_c2[index+1]))));
end
function Util_cvToPitch(cv)
return (24. + (120. * cv));
end
local Util_cvToRate_1024_c0 = {0.7593668,0.7628769,0.7797366,0.8256516,0.9246484,1.1123985,1.4406875,1.9833925,2.8444342,4.1683106,6.1539936,9.073195,13.2942978,19.3136143,27.7961018,39.6282634,55.9867165,78.4268778,108.9974326,150.3878036,206.1177981,280.7810906,380.3573327,512.6116485,687.6052678,918.3473603,1221.6260803,1619.0668426,2138.4784521,2815.5635571,3696.0898222,4838.643251};
local Util_cvToRate_1024_c1 = {5.2455831,4.9989426,4.4030893,3.3191161,1.5644968,(-1.0992562),(-4.9822262),(-10.4858642),(-18.1279556),(-28.574102),(-42.6773652),(-61.5281299),(-86.516746),(-119.4121434),(-162.4603915),(-218.5081483),(-291.1571467),(-384.9573613),(-505.6483473),(-660.4605419),(-858.49116),(-1111.1728348),(-1432.8575168),(-1841.543534),(-2359.7803917),(-3015.7941424),(-3844.8863585),(-4891.1723528),(-6209.7398756),(-7869.328765),(-9955.6558052),(-12575.5383972)};
local Util_cvToRate_1024_c2 = {20.1255919,24.4575724,29.7220002,36.1195823,43.8942271,53.3423435,64.8241421,78.7773676,95.733988,116.3404762,141.3824565,171.814657,208.7973083,253.7403777,308.3573241,374.730424,455.3901585,553.4116878,672.5320926,817.29285,993.2129783,1206.9994498,1466.8028948,1782.5283455,2166.212866,2632.4844665,3199.1197981,3887.7218889,4724.5437618,5741.4893336,6977.329755,8479.1815645};
function Util_cvToRate_1024_raw_c0(index)
return Util_cvToRate_1024_c0[index+1];
end
function Util_cvToRate_1024_raw_c1(index)
return Util_cvToRate_1024_c1[index+1];
end
function Util_cvToRate_1024_raw_c2(index)
return Util_cvToRate_1024_c2[index+1];
end
function Util_cvToRate_1024(cv)
local index = clip(int((34.4444445 * cv)),0,31);
return (Util_cvToRate_1024_c0[index+1] + (cv * (Util_cvToRate_1024_c1[index+1] + (cv * Util_cvToRate_1024_c2[index+1]))));
end
local Util_cvToRate_c0 = {0.0007416,0.0007417,0.0007419,0.0007423,0.0007431,0.0007445,0.0007466,0.0007495,0.0007536,0.000759,0.000766,0.0007749,0.000786,0.0007997,0.0008163,0.0008364,0.0008604,0.0008888,0.0009222,0.0009614,0.0010069,0.0010596,0.0011203,0.00119,0.0012697,0.0013604,0.0014635,0.0015802,0.001712,0.0018604,0.0020271,0.0022141,0.0024232,0.0026568,0.0029171,0.0032067,0.0035283,0.0038851,0.0042802,0.0047172,0.0051998,0.0057321,0.0063187,0.0069642,0.0076738,0.0084532,0.0093082,0.0102454,0.0112717,0.0123946,0.0136222,0.0149632,0.0164269,0.0180234,0.0197635,0.0216588,0.0237217,0.0259657,0.0284052,0.0310556,0.0339336,0.0370567,0.0404443,0.0441167,0.0480959,0.0524055,0.0570705,0.0621181,0.0675771,0.0734786,0.0798558,0.0867441,0.0941815,0.1022089,0.1108697,0.1202104,0.1302809,0.1411344,0.1528279,0.1654223,0.1789825,0.1935781,0.2092834,0.2261777,0.2443458,0.2638781,0.2848713,0.3074285,0.3316599,0.357683,0.3856233,0.4156144,0.4477993,0.4823303,0.5193697,0.5590908,0.6016783,0.6473293,0.6962535,0.7486748,0.8048318,0.8649786,0.929386,0.9983426,1.0721558,1.1511531,1.2356831,1.3261173,1.4228512,1.5263058,1.6369296,1.7551997,1.8816241,2.0167435,2.1611333,2.3154058,2.4802125,2.6562464,2.8442451,3.0449928,3.2593239,3.4881257,3.7323419,3.9929758,4.2710944,4.5678321,4.8843948,5.2220646};
local Util_cvToRate_c1 = {0.0051392,0.0051263,0.0050994,0.0050569,0.0049975,0.0049196,0.0048214,0.0047011,0.0045567,0.0043863,0.0041874,0.0039577,0.0036947,0.0033955,0.0030572,0.0026766,0.0022504,0.001775,0.0012464,0.0006606,1.32e-05,(-0.0007005),(-0.0014856),(-0.0023473),(-0.0032914),(-0.0043239),(-0.0054514),(-0.0066807),(-0.0080191),(-0.0094747),(-0.0110556),(-0.0127708),(-0.0146297),(-0.0166425),(-0.0188198),(-0.0211731),(-0.0237146),(-0.0264571),(-0.0294143),(-0.032601),(-0.0360326),(-0.0397257),(-0.0436977),(-0.0479675),(-0.0525547),(-0.0574805),(-0.0627673),(-0.0684387),(-0.0745201),(-0.0810382),(-0.0880216),(-0.0955003),(-0.1035065),(-0.1120742),(-0.1212396),(-0.1310409),(-0.1415188),(-0.1527165),(-0.1646796),(-0.1774569),(-0.1910996),(-0.2056624),(-0.2212032),(-0.2377833),(-0.2554678),(-0.2743257),(-0.29443),(-0.3158582),(-0.3386924),(-0.3630195),(-0.3889319),(-0.416527),(-0.4459084),(-0.4771857),(-0.510475),(-0.5458991),(-0.5835884),(-0.6236806),(-0.6663219),(-0.7116669),(-0.7598792),(-0.8111321),(-0.8656092),(-0.9235045),(-0.9850238),(-1.0503845),(-1.1198169),(-1.1935646),(-1.2718857),(-1.3550528),(-1.4433547),(-1.5370969),(-1.6366025),(-1.7422134),(-1.8542912),(-1.9732184),(-2.0993997),(-2.233263),(-2.3752609),(-2.5258721),(-2.6856026),(-2.8549877),(-3.0345935),(-3.2250182),(-3.4268945),(-3.6408914),(-3.867716),(-4.1081157),(-4.3628809),(-4.6328468),(-4.9188962),(-5.2219624),(-5.5430316),(-5.883146),(-6.2434073),(-6.6249794),(-7.0290924),(-7.4570461),(-7.9102138),(-8.3900467),(-8.898078),(-9.4359272),(-10.0053059),(-10.6080216),(-11.2459841),(-11.9212107),(-12.6358324),(-13.3921)};
local Util_cvToRate_c2 = {0.0182549,0.0191666,0.0201238,0.0211289,0.0221841,0.0232921,0.0244554,0.0256768,0.0269592,0.0283057,0.0297194,0.0312037,0.0327621,0.0343984,0.0361164,0.0379202,0.0398141,0.0418025,0.0438903,0.0460824,0.0483839,0.0508004,0.0533376,0.0560015,0.0587984,0.061735,0.0648183,0.0680556,0.0714546,0.0750233,0.0787703,0.0827044,0.086835,0.0911719,0.0957254,0.1005063,0.105526,0.1107964,0.11633,0.12214,0.1282402,0.134645,0.1413697,0.1484303,0.1558435,0.163627,0.1717992,0.1803795,0.1893884,0.1988473,0.2087785,0.2192058,0.2301538,0.2416486,0.2537175,0.2663892,0.2796938,0.2936628,0.3083295,0.3237288,0.3398971,0.356873,0.3746966,0.3934105,0.413059,0.4336889,0.4553491,0.4780911,0.5019689,0.5270393,0.5533618,0.5809989,0.6100164,0.6404831,0.6724714,0.7060574,0.7413208,0.7783454,0.8172191,0.8580344,0.9008881,0.9458821,0.9931234,1.042724,1.0948019,1.1494808,1.2068905,1.2671676,1.3304551,1.3969035,1.4666705,1.539922,1.616832,1.6975832,1.7823675,1.8713862,1.9648508,2.0629835,2.1660173,2.2741971,2.3877798,2.5070353,2.6322469,2.763712,2.9017431,3.046668,3.198831,3.3585937,3.5263356,3.7024552,3.8873709,4.0815221,4.28537,4.4993989,4.7241173,4.960059,5.2077846,5.4678826,5.740971,6.0276986,6.3287465,6.6448299,6.9766999,7.3251448,7.6909924,8.075112,8.4784161,8.9018628};
function Util_cvToRate_raw_c0(index)
return Util_cvToRate_c0[index+1];
end
function Util_cvToRate_raw_c1(index)
return Util_cvToRate_c1[index+1];
end
function Util_cvToRate_raw_c2(index)
return Util_cvToRate_c2[index+1];
end
function Util_cvToRate(cv)
local index = clip(int((141.1111112 * cv)),0,127);
return (Util_cvToRate_c0[index+1] + (cv * (Util_cvToRate_c1[index+1] + (cv * Util_cvToRate_c2[index+1]))));
end
function Util_pitchToCv(pitch)
return (0.0083334 * ((-24.) + pitch));
end
local Util_cvToperiod_c0 = {674.2460348,671.5538378,662.7617819,646.759522,623.7994278,594.871802,561.2982769,524.4769422,485.7313693,446.2293824,406.9474404,368.6637744,331.9686831,297.2841558,264.8876665,234.9368568,207.4931244,182.5430159,160.0169068,139.8048318,121.7695566,105.757117,91.6051156,79.1490884,68.227249,58.6838946,50.3717336,43.153355,36.902033,31.5020248,26.8484943,22.8471657};
local Util_cvToperiod_c1 = {(-4656.6563108),(-4481.960579),(-4198.6861325),(-3855.7515427),(-3487.1394548),(-3115.8588213),(-2756.9303187),(-2419.6251411),(-2109.1347532),(-1827.8083337),(-1576.062963),(-1353.0470918),(-1157.1188644),(-986.1862501),(-837.9446649),(-710.0391128),(-600.1712335),(-506.1665656),(-426.0134627),(-357.8821512),(-300.1301898),(-251.2989043),(-210.1041049),(-175.4234501),(-146.2821135),(-121.837895),(-101.3665365),(-84.2477263),(-69.9520817),(-58.0292593),(-48.0972479),(-39.8328333)};
local Util_cvToperiod_c2 = {14548.8231621,11715.3695219,9433.7446751,7596.4772967,6117.0266216,4925.7061172,3966.4010399,3193.9252637,2571.8928791,2071.0043083,1667.666208,1342.8801524,1081.3477513,870.7500494,701.1672681,564.6115532,454.6507239,366.1052976,294.8045211,237.3899156,191.157082,153.9283162,123.9500325,99.8101645,80.3716525,64.7188847,52.114569,41.9650048,33.7921173,27.2109391,21.9114772,17.6441111};
function Util_cvToperiod_raw_c0(index)
return Util_cvToperiod_c0[index+1];
end
function Util_cvToperiod_raw_c1(index)
return Util_cvToperiod_c1[index+1];
end
function Util_cvToperiod_raw_c2(index)
return Util_cvToperiod_c2[index+1];
end
function Util_cvToperiod(cv)
local index = clip(int((31. * cv)),0,31);
return (Util_cvToperiod_c0[index+1] + (cv * (Util_cvToperiod_c1[index+1] + (cv * Util_cvToperiod_c2[index+1]))));
end
local Util_cvTokHz_c0 = {0.0327032,0.0329158,0.0339579,0.0368567,0.0432422,0.055616,0.0777238,0.115069,0.1756143,0.2707394,0.4165374,0.6355669,0.9592072,1.4308178,2.1099596,3.078021,4.4456974,6.3629088,9.0319219,12.7246767,17.805619,24.7617347,34.2419904,47.1090422,64.5069279,87.9495574,119.436234,161.6022735,217.9151479,292.9296186,392.6192398,524.8066449};
local Util_cvTokHz_c1 = {0.2257192,0.2122933,0.1791694,0.117605,0.0157802,(-0.142178),(-0.3774662),(-0.7182503),(-1.2017969),(-1.8772284),(-2.8090773),(-4.0818673),(-5.8060081),(-8.1253731),(-11.2270275),(-15.3537053),(-20.8197945),(-28.0317982),(-37.5145028),(-49.9444141),(-66.1924493),(-87.3784044),(-114.9403964),(-150.7233371),(-197.0915838),(-257.0722838),(-334.5376738),(-434.4367882),(-563.0898166),(-728.5618575),(-941.1372579),(-1213.9213282)};
local Util_cvTokHz_c2 = {0.8763378,1.088287,1.3514976,1.6783679,2.0842943,2.5883971,3.2144212,3.991854,4.9573151,6.1562805,7.645225,9.4942823,11.7905487,14.642185,18.1835118,22.5813362,28.0428087,34.8251811,43.2479231,53.7077712,66.6974152,82.8287061,102.8614758,127.7393272,158.6340814,197.0009732,244.6471976,303.8170335,377.2975565,468.549918,581.872376,722.6027558};
function Util_cvTokHz_raw_c0(index)
return Util_cvTokHz_c0[index+1];
end
function Util_cvTokHz_raw_c1(index)
return Util_cvTokHz_c1[index+1];
end
function Util_cvTokHz_raw_c2(index)
return Util_cvTokHz_c2[index+1];
end
function Util_cvTokHz(cv)
local index = clip(int((31. * cv)),0,31);
return (Util_cvTokHz_c0[index+1] + (cv * (Util_cvTokHz_c1[index+1] + (cv * Util_cvTokHz_c2[index+1]))));
end
function Ad__ctx_type_0_init()
local _ctx = {};
_ctx.target = 0.;
_ctx.state = 0;
_ctx.scale = 0.;
_ctx.rate = 0.;
_ctx.out = 0.;
_ctx._inst251 = Util__ctx_type_0_init();
return _ctx;
end
function Ad_do_init()
return Ad__ctx_type_0_init();
end
function Ad_do(_ctx,gate,a,d)
local a_rate = (1. / (0.01 + (100. * a)));
local d_rate = (1. / (0.01 + (100. * d)));
local bgate = (gate > 0.);
_ctx.out = (_ctx.out + (0.004 * _ctx.rate * (_ctx.target + (- _ctx.out))));
if (_ctx.state == 0) then
if Util_edge(_ctx._inst251,bgate) then
_ctx.state = 1;
_ctx.scale = (0.2 * gate);
end
_ctx.rate = d_rate;
_ctx.target = 0.;
end
if (_ctx.state == 1) then
if ((bgate == false) or (_ctx.out > 1024.)) then
_ctx.state = 0;
end
_ctx.rate = a_rate;
_ctx.target = 1228.8;
end
return (_ctx.scale * clip((0.0009766 * _ctx.out),0.,1.));
end
function Ad__ctx_type_1_init()
local _ctx = {};
_ctx.knob2 = 0.;
_ctx.knob1 = 0.;
_ctx._inst1f = Ad__ctx_type_0_init();
return _ctx;
end
function Ad_process_init()
return Ad__ctx_type_1_init();
end
function Ad_process(_ctx,gate)
return Ad_do(_ctx._inst1f,gate,_ctx.knob1,_ctx.knob2);
end
function Ad_noteOn_init()
return Ad__ctx_type_1_init();
end
function Ad_noteOn(_ctx,note,velocity,channel)
end
function Ad_noteOff_init()
return Ad__ctx_type_1_init();
end
function Ad_noteOff(_ctx,note,channel)
end
function Ad_controlChange_init()
return Ad__ctx_type_1_init();
end
function Ad_controlChange(_ctx,control,value,channel)
if (control == 1) then
_ctx.knob1 = (0.0078741 * real(value));
end
if (control == 2) then
_ctx.knob2 = (0.0078741 * real(value));
end
end
function Ad_default_init()
return Ad__ctx_type_1_init();
end
function Ad_default(_ctx)
_ctx.knob1 = 0.;
_ctx.knob2 = 0.5;
end
local this = {}
function this.process(ctx,gate) return Ad_process(ctx,gate) end
function this.noteOn(ctx,note,velocity,channel) return Ad_noteOn(ctx,note,velocity,channel) end
function this.noteOff(ctx,note,channel) return Ad_noteOff(ctx,note,channel) end
function this.controlChange(ctx,control,value,channel) return Ad_controlChange(ctx,control,value,channel) end
function this.init() return Ad_process_init() end
function this.default(ctx) return Ad_default(ctx) end
this.config = { inputs = 2, outputs = 1, noteon_inputs = 4, noteoff_inputs = 3, controlchange_inputs = 4, is_active = true }
return this
| {
"pile_set_name": "Github"
} |
--TEST--
Closures can be generators
--FILE--
<?php
$genFactory = function() {
yield 1;
yield 2;
yield 3;
};
foreach ($genFactory() as $value) {
var_dump($value);
}
?>
--EXPECT--
int(1)
int(2)
int(3)
| {
"pile_set_name": "Github"
} |
import operator_benchmark as op_bench
import torch
"""Microbenchmarks for element-wise Add operator. Supports both Caffe2/PyTorch."""
add_short_configs = op_bench.config_list(
attr_names=['M', 'N', 'K'],
attrs=[
[8, 16, 32],
[16, 16, 64],
[64, 64, 128],
],
cross_product_configs={
'device': ['cpu', 'cuda'],
'dtype': [torch.float, torch.float64],
},
tags=['short'],
)
class AddBenchmark(op_bench.TorchBenchmarkBase):
def init(self, M, N, K, device, dtype):
self.input_one = torch.rand(M, N, K, device=device, dtype=dtype, requires_grad=True)
self.input_two = torch.rand(M, N, K, device=device, dtype=dtype)
self.set_module_name('add')
def forward(self):
return torch.add(self.input_one, self.input_two)
op_bench.generate_pt_test(add_short_configs, AddBenchmark)
if __name__ == "__main__":
op_bench.benchmark_runner.main()
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package testcode.sqli.android;
import android.content.UriMatcher;
import android.content.*;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.util.Log;
/** Simple test provider that runs in the local process. */
public class LocalProvider extends ContentProvider {
private static final String TAG = "LocalProvider";
private SQLiteOpenHelper mOpenHelper;
private static final int DATA = 1;
private static final int DATA_ID = 2;
private static final UriMatcher sURLMatcher = new UriMatcher(
UriMatcher.NO_MATCH);
static {
sURLMatcher.addURI("*", "data", DATA);
sURLMatcher.addURI("*", "data/#", DATA_ID);
}
private static class DatabaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "local.db";
private static final int DATABASE_VERSION = 1;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE data (" +
"_id INTEGER PRIMARY KEY," +
"text TEXT, " +
"integer INTEGER);");
// insert alarms
db.execSQL("INSERT INTO data (text, integer) VALUES ('first data', 100);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) {
Log.w(TAG, "Upgrading test database from version " +
oldVersion + " to " + currentVersion +
", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS data");
onCreate(db);
}
}
public LocalProvider() {
}
@Override
public boolean onCreate() {
mOpenHelper = new DatabaseHelper(getContext());
return true;
}
@Override
public Cursor query(Uri url, String[] projectionIn, String selection,
String[] selectionArgs, String sort) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
// Generate the body of the query
int match = sURLMatcher.match(url);
switch (match) {
case DATA:
qb.setTables("data");
break;
case DATA_ID:
qb.setTables("data");
qb.appendWhere("_id=");
qb.appendWhere(url.getPathSegments().get(1));
break;
default:
throw new IllegalArgumentException("Unknown URL " + url);
}
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
Cursor ret = qb.query(db, projectionIn, selection, selectionArgs,
null, null, sort);
if (ret == null) {
if (false) Log.d(TAG, "Alarms.query: failed");
} else {
// ret.setNotificationUri(getContext().getContentResolver(), url);
}
return ret;
}
@Override
public String getType(Uri url) {
int match = sURLMatcher.match(url);
switch (match) {
case DATA:
return "vnd.android.cursor.dir/vnd.google.unit_tests.local";
case DATA_ID:
return "vnd.android.cursor.item/vnd.google.unit_tests.local";
default:
throw new IllegalArgumentException("Unknown URL");
}
}
@Override
public int update(Uri url, ContentValues values, String where, String[] whereArgs) {
int count;
long rowId = 0;
int match = sURLMatcher.match(url);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
switch (match) {
case DATA_ID: {
String segment = url.getPathSegments().get(1);
rowId = Long.parseLong(segment);
count = db.update("data", values, "_id=" + rowId, null);
break;
}
default: {
throw new UnsupportedOperationException(
"Cannot update URL: " + url);
}
}
if (false) Log.d(TAG, "*** notifyChange() rowId: " + rowId);
// getContext().getContentResolver().notifyChange(url, null);
return count;
}
@Override
public Uri insert(Uri url, ContentValues initialValues) {
return null;
}
@Override
public int delete(Uri url, String where, String[] whereArgs) {
throw new UnsupportedOperationException("delete not supported");
}
} | {
"pile_set_name": "Github"
} |
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww25140\viewh18960\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs26 \cf0 Scala is licensed under the {\field{\*\fldinst{HYPERLINK "http://opensource.org/licenses/BSD-3-Clause"}}{\fldrslt BSD 3-Clause License}}.\
\
\fs48 Scala License
\fs40 \
\fs26 Copyright (c) 2002-2013 EPFL\
Copyright (c) 2011-2013 Typesafe, Inc.\
All rights reserved.\
\
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\
\'95 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\
\'95 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.\
\'95 Neither the name of the EPFL 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 \'93AS IS\'94 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.\
\fs52 \
\fs48 Other Licenses
\fs52 \
\fs26 This software includes projects with the following licenses, which are also included in the
\fs24 licenses/
\fs26 directory:\
\fs30 \
{\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0.html"}}{\fldrslt Apache License}}\
\fs26 This license is used by the following third-party libraries:\
\'95 jansi\
\fs30 \
{\field{\*\fldinst{HYPERLINK "http://www.opensource.org/licenses/bsd-license.php"}}{\fldrslt BSD License}}\
\fs26 This license is used by the following third-party libraries:\
\'95 jline\
\fs30 \
{\field{\*\fldinst{HYPERLINK "http://opensource.org/licenses/BSD-3-Clause"}}{\fldrslt BSD 3-Clause License}}\
\fs26 This license is used by the following third-party libraries:\
\'95 asm\
\fs30 \
{\field{\*\fldinst{HYPERLINK "http://www.opensource.org/licenses/MIT"}}{\fldrslt MIT License}}\
\fs26 This license is used by the following third-party libraries:\
\'95 jquery\
\'95 jquery-ui\
\'95 jquery-layout\
\'95 sizzle\
\'95 tools tooltip\
\fs30 \
Public Domain\
\fs26 The following libraries are freely available in the public domain:\
\'95 forkjoin} | {
"pile_set_name": "Github"
} |
package com.tinyspeck.engine.spritesheet {
public class AnimationSequenceCommand {
public var A:Array;
public var loop:Boolean;
public var loops_from:uint;
public var name:String = '';
public function AnimationSequenceCommand(A:Array=null, loop:Boolean=false, loops_from:uint=0) {
this.A = A;
this.loop = loop;
this.loops_from = loops_from;
}
}
} | {
"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.controller.state;
import org.apache.nifi.web.api.dto.StateEntryDTO;
import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
public class SortedStateUtils {
/**
* The maximum number of state entries to return to a client
*/
public static final int MAX_COMPONENT_STATE_ENTRIES = 500;
/**
* Gets a comparator for comparing state entry keys.
*
* @return comparator for comparing state entry keys
*/
public static Comparator<String> getKeyComparator() {
final Collator collator = Collator.getInstance(Locale.US);
return new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return collator.compare(s1, s2);
}
};
}
/**
* Gets a comparator for comparing state entry keys.
*
* @return comparator for comparing state entry keys
*/
public static Comparator<StateEntryDTO> getEntryDtoComparator() {
final Collator collator = Collator.getInstance(Locale.US);
return new Comparator<StateEntryDTO>() {
@Override
public int compare(StateEntryDTO o1, StateEntryDTO o2) {
return collator.compare(o1.getKey(), o2.getKey());
}
};
}
}
| {
"pile_set_name": "Github"
} |
# Class cis::el7::9_2_15
#
# CIS Security Benchmark for RHEL7
#
class cis::el7::9_2_15 {
include cis::linuxcontrols::c0099
}
| {
"pile_set_name": "Github"
} |
dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE )
dnl Copyright 2001-2002 by Dan Fandrich <dan@coneharvesters.com>
dnl This file may be copied and used freely without restrictions. No warranty
dnl is expressed or implied.
dnl
dnl Create a header file that guarantees that byte swapping macros of the
dnl ntohl variety as well as the extended types included in OpenBSD and
dnl NetBSD such as le32toh are defined. If possible, the standard ntohl
dnl are overloaded as they are optimized for the given platform, but when
dnl this is not possible (e.g. on a big-endian machine) they are defined
dnl in this file.
dnl Look for a symbol in a header file
dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND )
AC_DEFUN([AC_HAVE_SYMBOL],
[
AC_MSG_CHECKING(for $1 in $2)
AC_EGREP_CPP([symbol is present|\<$1\>],[
#include <$2>
#ifdef $1
symbol is present
#endif
],
[AC_MSG_RESULT(yes)
$3
],
[AC_MSG_RESULT(no)
$4
])])
dnl Create a header file that defines extended byte swapping macros
AC_DEFUN([AC_NEED_BYTEORDER_H],
[
changequote(, )dnl
ac_dir=`echo $1|sed 's%/[^/][^/]*$%%'`
changequote([, ])dnl
if test "$ac_dir" != "$1" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
# We're only interested in the target CPU, but it's not always set
effective_target="$target"
if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then
effective_target="$host"
fi
AC_SUBST(effective_target)
cat > "$1" << EOF
/* This file is generated automatically by configure */
/* It is valid only for the system type ${effective_target} */
#ifndef __BYTEORDER_H
#define __BYTEORDER_H
EOF
dnl First, do an endian check
AC_C_BIGENDIAN
dnl Look for NetBSD-style extended byte swapping macros
AC_HAVE_SYMBOL(le32toh,machine/endian.h,
[HAVE_LE32TOH=1
cat >> "$1" << EOF
/* extended byte swapping macros are already available */
#include <machine/endian.h>
EOF],
[
dnl Look for standard byte swapping macros
AC_HAVE_SYMBOL(ntohl,arpa/inet.h,
[cat >> "$1" << EOF
/* ntohl and relatives live here */
#include <arpa/inet.h>
EOF],
[AC_HAVE_SYMBOL(ntohl,netinet/in.h,
[cat >> "$1" << EOF
/* ntohl and relatives live here */
#include <netinet/in.h>
EOF],true)])
])
dnl Look for generic byte swapping macros
dnl OpenBSD
AC_HAVE_SYMBOL(swap32,machine/endian.h,
[cat >> "$1" << EOF
/* swap32 and swap16 are defined in machine/endian.h */
EOF],
[
dnl Linux GLIBC
AC_HAVE_SYMBOL(bswap_32,byteswap.h,
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <byteswap.h>
#define swap16(x) bswap_16(x)
#define swap32(x) bswap_32(x)
#define swap64(x) bswap_64(x)
EOF],
[
dnl NetBSD
AC_HAVE_SYMBOL(bswap32,machine/endian.h,
dnl We're already including machine/endian.h if this test succeeds
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
EOF
if test "$HAVE_LE32TOH" != "1"; then
echo '#include <machine/endian.h>'>> "$1"
fi
cat >> "$1" << EOF
#define swap16(x) bswap16(x)
#define swap32(x) bswap32(x)
#define swap64(x) bswap64(x)
EOF],
[
dnl FreeBSD
AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h,
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <sys/types.h>
#define swap16(x) __byte_swap_word(x)
#define swap32(x) __byte_swap_long(x)
/* No optimized 64 bit byte swapping macro is available */
#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
((x) >> 8) & 0x00000000ff000000ULL | \\
((x) >> 24) & 0x0000000000ff0000ULL | \\
((x) >> 40) & 0x000000000000ff00ULL | \\
((x) >> 56) & 0x00000000000000ffULL))
EOF],
[
dnl OS X
AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h,
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <machine/byte_order.h>
#define swap16(x) NXSwapShort(x)
#define swap32(x) NXSwapLong(x)
#define swap64(x) NXSwapLongLong(x)
EOF],
[
if test $ac_cv_c_bigendian = yes; then
cat >> "$1" << EOF
/* No other byte swapping functions are available on this big-endian system */
#define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
#define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\
((uint32_t)(x) << 8) & 0x00ff0000UL | \\
((x) >> 8) & 0x0000ff00UL | \\
((x) >> 24) & 0x000000ffUL))
#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
((x) >> 8) & 0x00000000ff000000ULL | \\
((x) >> 24) & 0x0000000000ff0000ULL | \\
((x) >> 40) & 0x000000000000ff00ULL | \\
((x) >> 56) & 0x00000000000000ffULL))
EOF
else
cat >> "$1" << EOF
/* Use these as generic byteswapping macros on this little endian system */
#define swap16(x) ntohs(x)
#define swap32(x) ntohl(x)
/* No optimized 64 bit byte swapping macro is available */
#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
((x) >> 8) & 0x00000000ff000000ULL | \\
((x) >> 24) & 0x0000000000ff0000ULL | \\
((x) >> 40) & 0x000000000000ff00ULL | \\
((x) >> 56) & 0x00000000000000ffULL))
EOF
fi
])
])
])
])
])
[
if test "$HAVE_LE32TOH" != "1"; then
cat >> "$1" << EOF
/* The byte swapping macros have the form: */
/* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */
/* le (little-endian), NN is 16 or 32 (number of bits) and a, */
/* if present, indicates that the endian side is a pointer to an */
/* array of uint8_t bytes instead of an integer of the specified length. */
/* h refers to the host's ordering method. */
/* So, to convert a 32-bit integer stored in a buffer in little-endian */
/* format into a uint32_t usable on this machine, you could use: */
/* uint32_t value = le32atoh(&buf[3]); */
/* To put that value back into the buffer, you could use: */
/* htole32a(&buf[3], value); */
/* Define aliases for the standard byte swapping macros */
/* Arguments to these macros must be properly aligned on natural word */
/* boundaries in order to work properly on all architectures */
#define htobe16(x) htons(x)
#define htobe32(x) htonl(x)
#define be16toh(x) ntohs(x)
#define be32toh(x) ntohl(x)
#define HTOBE16(x) (x) = htobe16(x)
#define HTOBE32(x) (x) = htobe32(x)
#define BE32TOH(x) (x) = be32toh(x)
#define BE16TOH(x) (x) = be16toh(x)
EOF
if test $ac_cv_c_bigendian = yes; then
cat >> "$1" << EOF
/* Define our own extended byte swapping macros for big-endian machines */
#define htole16(x) swap16(x)
#define htole32(x) swap32(x)
#define le16toh(x) swap16(x)
#define le32toh(x) swap32(x)
#define htobe64(x) (x)
#define be64toh(x) (x)
#define HTOLE16(x) (x) = htole16(x)
#define HTOLE32(x) (x) = htole32(x)
#define LE16TOH(x) (x) = le16toh(x)
#define LE32TOH(x) (x) = le32toh(x)
#define HTOBE64(x) (void) (x)
#define BE64TOH(x) (void) (x)
EOF
else
cat >> "$1" << EOF
/* On little endian machines, these macros are null */
#define htole16(x) (x)
#define htole32(x) (x)
#define htole64(x) (x)
#define le16toh(x) (x)
#define le32toh(x) (x)
#define le64toh(x) (x)
#define HTOLE16(x) (void) (x)
#define HTOLE32(x) (void) (x)
#define HTOLE64(x) (void) (x)
#define LE16TOH(x) (void) (x)
#define LE32TOH(x) (void) (x)
#define LE64TOH(x) (void) (x)
/* These don't have standard aliases */
#define htobe64(x) swap64(x)
#define be64toh(x) swap64(x)
#define HTOBE64(x) (x) = htobe64(x)
#define BE64TOH(x) (x) = be64toh(x)
EOF
fi
fi
cat >> "$1" << EOF
/* Define the C99 standard length-specific integer types */
#include <_stdint.h>
EOF
case "${effective_target}" in
i[3456]86-*)
cat >> "$1" << EOF
/* Here are some macros to create integers from a byte array */
/* These are used to get and put integers from/into a uint8_t array */
/* with a specific endianness. This is the most portable way to generate */
/* and read messages to a network or serial device. Each member of a */
/* packet structure must be handled separately. */
/* The i386 and compatibles can handle unaligned memory access, */
/* so use the optimized macros above to do this job */
#define be16atoh(x) be16toh(*(uint16_t*)(x))
#define be32atoh(x) be32toh(*(uint32_t*)(x))
#define be64atoh(x) be64toh(*(uint64_t*)(x))
#define le16atoh(x) le16toh(*(uint16_t*)(x))
#define le32atoh(x) le32toh(*(uint32_t*)(x))
#define le64atoh(x) le64toh(*(uint64_t*)(x))
#define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x)
#define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x)
#define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x)
#define htole16a(a,x) *(uint16_t*)(a) = htole16(x)
#define htole32a(a,x) *(uint32_t*)(a) = htole32(x)
#define htole64a(a,x) *(uint64_t*)(a) = htole64(x)
EOF
;;
*)
cat >> "$1" << EOF
/* Here are some macros to create integers from a byte array */
/* These are used to get and put integers from/into a uint8_t array */
/* with a specific endianness. This is the most portable way to generate */
/* and read messages to a network or serial device. Each member of a */
/* packet structure must be handled separately. */
/* Non-optimized but portable macros */
#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1]))
#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))
#define be64atoh(x) ((uint64_t)(((x)[0]<<56)|((x)[1]<<48)|((x)[2]<<40)| \\
((x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7]))
#define le16atoh(x) ((uint16_t)(((x)[1]<<8)|(x)[0]))
#define le32atoh(x) ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
#define le64atoh(x) ((uint64_t)(((x)[7]<<56)|((x)[6]<<48)|((x)[5]<<40)| \\
((x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
#define htobe16a(a,x) (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)
#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\
(a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x)
#define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\
(a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\
(a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\
(a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x)
#define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
#define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\
(a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
#define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\
(a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\
(a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\
(a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
EOF
;;
esac
]
cat >> "$1" << EOF
#endif /*__BYTEORDER_H*/
EOF])
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include <atomic>
#include <string>
#include "core/session/onnxruntime_c_api.h"
#include "core/common/logging/isink.h"
#include "core/platform/ort_mutex.h"
#include "core/common/status.h"
#include "core/framework/allocator.h"
namespace onnxruntime {
class Environment;
}
class LoggingWrapper : public onnxruntime::logging::ISink {
public:
LoggingWrapper(OrtLoggingFunction logging_function, void* logger_param);
void SendImpl(const onnxruntime::logging::Timestamp& /*timestamp*/ /*timestamp*/, const std::string& logger_id,
const onnxruntime::logging::Capture& message) override;
private:
OrtLoggingFunction logging_function_;
void* logger_param_;
};
struct OrtEnv {
public:
struct LoggingManagerConstructionInfo {
LoggingManagerConstructionInfo(OrtLoggingFunction logging_function1,
void* logger_param1,
OrtLoggingLevel default_warning_level1,
const char* logid1)
: logging_function(logging_function1),
logger_param(logger_param1),
default_warning_level(default_warning_level1),
logid(logid1) {}
OrtLoggingFunction logging_function{};
void* logger_param{};
OrtLoggingLevel default_warning_level;
const char* logid{};
};
static OrtEnv* GetInstance(const LoggingManagerConstructionInfo& lm_info,
onnxruntime::common::Status& status,
const OrtThreadingOptions* tp_options = nullptr);
static void Release(OrtEnv* env_ptr);
const onnxruntime::Environment& GetEnvironment() const {
return *(value_.get());
}
onnxruntime::logging::LoggingManager* GetLoggingManager() const;
void SetLoggingManager(std::unique_ptr<onnxruntime::logging::LoggingManager> logging_manager);
/**
* Registers an allocator for sharing between multiple sessions.
* Returns an error if an allocator with the same OrtMemoryInfo is already registered.
*/
onnxruntime::Status RegisterAllocator(onnxruntime::AllocatorPtr allocator);
private:
static OrtEnv* p_instance_;
static onnxruntime::OrtMutex m_;
static int ref_count_;
std::unique_ptr<onnxruntime::Environment> value_;
OrtEnv(std::unique_ptr<onnxruntime::Environment> value1);
~OrtEnv() = default;
ORT_DISALLOW_COPY_AND_ASSIGNMENT(OrtEnv);
}; | {
"pile_set_name": "Github"
} |
// ***************************************************************************
// *
// * Copyright (C) 2013 International Business Machines
// * Corporation and others. All Rights Reserved.
// * Tool: org.unicode.cldr.icu.NewLdml2IcuConverter
// * Source File: <path>/common/main/zh_Hans.xml
// *
// ***************************************************************************
/**
* ICU <specials> source: <path>/common/main/zh_Hans.xml
*/
zh_Hans{
Version{"2.0.90.61"}
}
| {
"pile_set_name": "Github"
} |
/**
* @file CosaServo.ino
* @version 1.0
*
* @section License
* Copyright (C) 2013-2015, Mikael Patel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* @section Description
* Demonstration of the Servo control class.
*
* @section Circuit
* @code
* Servo#0/servo
* +------------+
* (D9)----------------1-|PULSE I |
* (VCC)---------------2-|VCC ==o== |
* (GND)---------------3-|GND I |
* +------------+
* Servo#1/door
* +------------+
* (D8)----------------1-|PULSE I |
* (VCC)---------------2-|VCC ==o== |
* (GND)---------------3-|GND I |
* +------------+
* @endcode
*
* This file is part of the Arduino Che Cosa project.
*/
#include <Servo.h>
#include "Cosa/Watchdog.hh"
Servo servo(0, Board::D9);
Servo door(1, Board::D8);
void setup()
{
// Start watchdog for delay timing
Watchdog::begin();
// Start servo handling and set initial angle
Servo::begin();
door.angle(10);
servo.angle(10);
}
void loop()
{
static int degree = 10;
static int inc = 45;
// Step servo from 10 to 170 degrees by 45 degrees
for (; degree < 170; degree += inc) {
door.angle(degree);
servo.angle(degree);
delay(512);
}
if (degree > 170) degree -= inc;
// Step servo from 170 to 10 degrees by -45 degrees
for (; degree > 10; degree -= inc) {
door.angle(degree);
servo.angle(degree);
delay(512);
}
if (degree < 10) degree += inc;
}
| {
"pile_set_name": "Github"
} |
/*
* This file is part of Bisq.
*
* bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* bisq 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 bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.trade.statistics;
import bisq.network.p2p.storage.P2PDataStorage;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
import bisq.network.p2p.storage.persistence.MapStoreService;
import bisq.common.config.Config;
import bisq.common.storage.Storage;
import javax.inject.Named;
import javax.inject.Inject;
import java.io.File;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class TradeStatistics2StorageService extends MapStoreService<TradeStatistics2Store, PersistableNetworkPayload> {
private static final String FILE_NAME = "TradeStatistics2Store";
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public TradeStatistics2StorageService(@Named(Config.STORAGE_DIR) File storageDir,
Storage<TradeStatistics2Store> persistableNetworkPayloadMapStorage) {
super(storageDir, persistableNetworkPayloadMapStorage);
}
///////////////////////////////////////////////////////////////////////////////////////////
// API
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public String getFileName() {
return FILE_NAME;
}
@Override
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap() {
return store.getMap();
}
@Override
public boolean canHandle(PersistableNetworkPayload payload) {
return payload instanceof TradeStatistics2;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////
@Override
protected TradeStatistics2Store createStore() {
return new TradeStatistics2Store();
}
@Override
protected void readStore() {
super.readStore();
}
}
| {
"pile_set_name": "Github"
} |
/*
* Reader.cpp
* zxing
*
* Created by Christian Brunschen on 13/05/2008.
* Copyright 2008 ZXing authors 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.
*/
#include <zxing/Reader.h>
namespace zxing {
Reader::~Reader() { }
Ref<Result> Reader::decode(Ref<BinaryBitmap> image) {
return decode(image, DecodeHints::DEFAULT_HINT);
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2013 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.
// Make sure that go test runs Example_Y before Example_B, preserving source order.
package p
import "fmt"
func Example_Y() {
n++
fmt.Println(n)
// Output: 3
}
func Example_B() {
n++
fmt.Println(n)
// Output: 4
}
| {
"pile_set_name": "Github"
} |
import io
import os
import select
import socket
import time
import utils
utils.new_ns()
port = 1
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
s.bind(('127.0.0.1', port))
s.listen(16)
tcpdump = utils.tcpdump_start(port)
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
c.connect(('127.0.0.1', port))
# user timeout on one socket for 3s
c.setsockopt(socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, 3*1000)
# drop packets
utils.drop_start(dport=port)
utils.drop_start(sport=port)
utils.ss(port)
time.sleep(6)
utils.ss(port)
# the point: user-timeout doesn't kick in
c.send(b'hello world')
time.sleep(1)
utils.ss(port)
# utils.drop_stop(dport=port)
# utils.drop_stop(sport=port)
# time.sleep(1)
# utils.ss(port)
poll = select.poll()
poll.register(c, select.POLLIN)
poll.poll()
utils.ss(port)
e = c.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
print("[ ] SO_ERROR = %s" % (e,))
t1 = time.time()
print("[ ] took: %f seconds" % (t1-t0,))
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "MMSearchBarDisplayController.h"
#import "FavFilterViewControllerDelegate.h"
#import "FavForwardLogicDelegate.h"
#import "FavSearchControllerDelegate.h"
#import "FavTypeItemsViewDelegate.h"
#import "IFavoritesExt.h"
#import "UITableViewDataSource.h"
#import "UITableViewDelegate.h"
@class FavForwardLogicController, FavTypeItemsView, FavoritesItem, MMFavoritesSearchController, MMTableView, NSMutableArray, NSMutableDictionary, NSString, UIActivityIndicatorView, UIView;
@interface MyFavoritesListViewController : MMSearchBarDisplayController <UITableViewDataSource, UITableViewDelegate, IFavoritesExt, FavSearchControllerDelegate, FavForwardLogicDelegate, FavFilterViewControllerDelegate, FavTypeItemsViewDelegate>
{
MMFavoritesSearchController *m_searchController;
NSMutableArray *_arrFavData;
NSMutableDictionary *_cellViewCache;
_Bool _isReadyToLoad;
unsigned int _curMinItemUpdateTime;
UIView *m_headView;
UIView *_emptyView;
MMTableView *_tableView;
UIView *_footerView;
UIActivityIndicatorView *_activityView;
FavoritesItem *m_selectFavItem;
id <MyFavoritesListViewControllerDelegate> _delegate;
long long m_preInterfaceOrientation;
FavTypeItemsView *m_favTypeItemsView;
FavForwardLogicController *m_favForwardLogic;
}
@property(nonatomic) __weak id <MyFavoritesListViewControllerDelegate> delegate; // @synthesize delegate=_delegate;
- (void).cxx_destruct;
- (void)onSelectFavItemsByType:(int)arg1;
- (void)scrollViewDidScroll:(id)arg1;
- (void)onSelectFilterViewFavItem:(id)arg1 tableView:(id)arg2 atIndexPath:(id)arg3;
- (_Bool)shouldShowSearchResult:(id)arg1;
- (void)onSelectFavItem:(id)arg1 tableView:(id)arg2 atIndexPath:(id)arg3;
- (id)getCurrentViewController;
- (void)OnGetNextPageFavoritesItemList:(id)arg1 ErrCode:(int)arg2 HasMoreItems:(_Bool)arg3;
- (void)OnGetFirstPageFavoritesItemList:(id)arg1 ErrCode:(int)arg2 HasMoreItems:(_Bool)arg3;
- (void)stopActivityLoading;
- (_Bool)safeAddItemList:(id)arg1;
- (void)onLoadMore;
- (void)initData;
- (id)getFavForawrdViewController;
- (void)OnForwardDone;
- (void)didSelectFavItem:(id)arg1;
- (void)tableView:(id)arg1 didSelectRowAtIndexPath:(id)arg2;
- (void)tableView:(id)arg1 willDisplayCell:(id)arg2 forRowAtIndexPath:(id)arg3;
- (_Bool)tableView:(id)arg1 canEditRowAtIndexPath:(id)arg2;
- (id)tableView:(id)arg1 cellForRowAtIndexPath:(id)arg2;
- (void)genNormalCell:(id)arg1 indexPath:(id)arg2;
- (double)getHeightForItem:(id)arg1;
- (double)tableView:(id)arg1 heightForRowAtIndexPath:(id)arg2;
- (id)tableView:(id)arg1 viewForHeaderInSection:(long long)arg2;
- (double)tableView:(id)arg1 heightForHeaderInSection:(long long)arg2;
- (long long)tableView:(id)arg1 numberOfRowsInSection:(long long)arg2;
- (long long)numberOfSectionsInTableView:(id)arg1;
- (void)resetTableViewOffset:(id)arg1;
- (void)viewDidLayoutSubviews;
- (void)viewDidLoad;
- (void)initEmptyView;
- (void)initTableFooterView;
- (void)updateTableFooterHasMore:(_Bool)arg1;
- (void)resetHeaderView:(id)arg1;
- (void)initHeaderView;
- (void)initTableView;
- (void)OnCancelModalView:(id)arg1;
- (void)initNavigationBar;
- (void)dealloc;
- (id)init;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
| {
"pile_set_name": "Github"
} |
# Changlog
## Version 2.1.7 - May 8, 2015
* Check type of G_vmlCanvasManager. #138
## Version 2.1.6 - Dec 15, 2014
* Added option for track width
## Version 2.1.5 - Feb 28, 2014
* Fixed build error for minified vanilla version
## Version 2.1.4 - Feb 1, 2014
* Various updates and pull requests
## Version 2.1.3 - Dec 1, 2013
* Allow negative percent values with a reversed pie chart
## Version 2.1.2 - Dec 1, 2013
* Allow override of default options with data attributes in JQuery plugin
## Version 2.1.1 - Nov 19, 2013
* Fixed AMD support for jQuery version
## Version 2.1.0 - Oct 28, 2013
* Added UMD (Universal Module Definition) wrapper for AMD and requireJS support
* Angular module: Move options into single attribute and provide it as JSON
* Allow decimal numbers for percent values
## Version 2.0.5 – Oct 12, 2013
* (Angular) Fixed timer bug
## Version 2.0.4 - Oct 10, 2013
* Use the internal timing function of angular
* Added the ability to create two instances of the chart on one main scope
* Removed unnecessary stuff from the angular example to provide the minimal setup
* Added more conventional way to create controller in angular
## Version 2.0.3 - Sep 29, 2013
* Fixed render bug on retina displays
* Auto detect and load renderer (in preparation of a svg renderer)
## Version 2.0.2 - Sep 26, 2013
* Improved render performance by approx. 300%
## Version 2.0.1 - Sep 22, 2013
* Support for Internet Explorer 7 and 8 with excanvas
## Version 2.0.0 - Sep 22, 2013
* Added vanilla JS version
* Added angular directive
* Dropped coffeescript version
* Dropped support for delayed animations
* Moved canvas render methods in own module
## Version 1.2.5 - Aug 05, 2013
* Added default option value for delay
## Version 1.2.4 - Aug 05, 2013
* bug fix for incomplete animations
* support for delayed animations
## Version 1.2.3 - Jul 17, 2013
* Date.now fix for IE < IE9
## Version 1.2.2 - Jul 15, 2013
* Add `currentValue` and `to` to the onStop callback
## Version 1.2.1 - Jun 19, 2013
* Allow overriding of options with HTML data attributes where provided
## Version 1.2.0 - Jun 19, 2013
* Added `rotate` option to rotate the complete chart
## Version 1.1.0 - Jun 10, 2013
* Added missing `onStop` method
* cast `percent` to float to avoid breaking chart if a string is passed to the update method
## Version 1.0.2 - Jun 07, 2013
* Use requestAnimationFrame for smooth animations
* Added `onStep` option to get the current value during animations
## Version 1.0.1 - Feb 07, 2013
* Added retina support
## Version 1.0.0 - Aug 02, 2012
* Initial version
| {
"pile_set_name": "Github"
} |
.class public final Lcom/google/android/gms/internal/av;
.super Ljava/lang/Object;
# interfaces
.implements Landroid/os/Parcelable$Creator;
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/Object;",
"Landroid/os/Parcelable$Creator",
"<",
"Lcom/google/android/gms/internal/zzbpd;",
">;"
}
.end annotation
# direct methods
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public final synthetic createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
.locals 5
invoke-static {p1}, Lcom/google/android/gms/internal/i;->a(Landroid/os/Parcel;)I
move-result v2
const/4 v1, 0x0
const/4 v0, 0x0
:goto_0
invoke-virtual {p1}, Landroid/os/Parcel;->dataPosition()I
move-result v3
if-ge v3, v2, :cond_0
invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I
move-result v3
const v4, 0xffff
and-int/2addr v4, v3
packed-switch v4, :pswitch_data_0
invoke-static {p1, v3}, Lcom/google/android/gms/internal/i;->b(Landroid/os/Parcel;I)V
goto :goto_0
:pswitch_0
sget-object v1, Lcom/google/android/gms/drive/zzv;->CREATOR:Landroid/os/Parcelable$Creator;
invoke-static {p1, v3, v1}, Lcom/google/android/gms/internal/i;->c(Landroid/os/Parcel;ILandroid/os/Parcelable$Creator;)Ljava/util/ArrayList;
move-result-object v1
goto :goto_0
:pswitch_1
invoke-static {p1, v3}, Lcom/google/android/gms/internal/i;->d(Landroid/os/Parcel;I)I
move-result v0
goto :goto_0
:cond_0
invoke-static {p1, v2}, Lcom/google/android/gms/internal/i;->x(Landroid/os/Parcel;I)V
new-instance v2, Lcom/google/android/gms/internal/zzbpd;
invoke-direct {v2, v1, v0}, Lcom/google/android/gms/internal/zzbpd;-><init>(Ljava/util/List;I)V
return-object v2
:pswitch_data_0
.packed-switch 0x2
:pswitch_0
:pswitch_1
.end packed-switch
.end method
.method public final synthetic newArray(I)[Ljava/lang/Object;
.locals 1
new-array v0, p1, [Lcom/google/android/gms/internal/zzbpd;
return-object v0
.end method
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
v1 "github.com/F5Networks/k8s-bigip-ctlr/config/apis/cis/v1"
"github.com/F5Networks/k8s-bigip-ctlr/config/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type K8sV1Interface interface {
RESTClient() rest.Interface
NginxCisConnectorsGetter
TLSProfilesGetter
VirtualServersGetter
}
// K8sV1Client is used to interact with features provided by the k8s.nginx.org group.
type K8sV1Client struct {
restClient rest.Interface
}
func (c *K8sV1Client) NginxCisConnectors(namespace string) NginxCisConnectorInterface {
return newNginxCisConnectors(c, namespace)
}
func (c *K8sV1Client) TLSProfiles(namespace string) TLSProfileInterface {
return newTLSProfiles(c, namespace)
}
func (c *K8sV1Client) VirtualServers(namespace string) VirtualServerInterface {
return newVirtualServers(c, namespace)
}
// NewForConfig creates a new K8sV1Client for the given config.
func NewForConfig(c *rest.Config) (*K8sV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &K8sV1Client{client}, nil
}
// NewForConfigOrDie creates a new K8sV1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *K8sV1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new K8sV1Client for the given RESTClient.
func New(c rest.Interface) *K8sV1Client {
return &K8sV1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *K8sV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
| {
"pile_set_name": "Github"
} |
package org.hswebframework.web.bean;
@FunctionalInterface
public interface Converter {
<T> T convert(Object source, Class<T> targetClass,Class[] genericType);
} | {
"pile_set_name": "Github"
} |
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2017-07-04
* Description : Autodetect Netscape Messenger binary program
*
* Copyright (C) 2017-2019 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef NETSCAPE_BINARY_H
#define NETSCAPE_BINARY_H
// Local includes
#include "dbinaryiface.h"
using namespace Digikam;
namespace DigikamGenericSendByMailPlugin
{
class NetscapeBinary : public DBinaryIface
{
public:
explicit NetscapeBinary()
: DBinaryIface(
QLatin1String("netscape"),
QLatin1String("Netscape Messenger"),
QLatin1String("https://en.wikipedia.org/wiki/Netscape_Mail_%26_Newsgroups"),
QLatin1String("SendByMail"),
QStringList(QLatin1String("-v")),
i18n("Netscape Mail Client.")
)
{
setup();
}
~NetscapeBinary()
{
}
};
} // namespace DigikamGenericSendByMailPlugin
#endif // NETSCAPE_BINARY_H
| {
"pile_set_name": "Github"
} |
/* ------------------------------------------------------------------------------
*
* # C3.js - lines and areas
*
* Demo setup of line, step and area charts
*
* Version: 1.0
* Latest update: August 1, 2015
*
* ---------------------------------------------------------------------------- */
$(function () {
// Line chart
// ------------------------------
// Generate chart
var line_chart = c3.generate({
bindto: '#c3-line-chart',
point: {
r: 4
},
size: { height: 400 },
color: {
pattern: ['#4CAF50', '#F4511E', '#1E88E5']
},
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
],
type: 'spline'
},
grid: {
y: {
show: true
}
}
});
// Change data
setTimeout(function () {
line_chart.load({
columns: [
['data1', 230, 190, 300, 500, 300, 400]
]
});
}, 3000);
setTimeout(function () {
line_chart.load({
columns: [
['data3', 130, 150, 200, 300, 200, 100]
]
});
}, 6000);
setTimeout(function () {
line_chart.unload({
ids: 'data1'
});
}, 9000);
// Line chart with regions
// ------------------------------
// Generate chart
var chart_line_regions = c3.generate({
bindto: '#c3-line-regions-chart',
size: { height: 400 },
point: {
r: 4
},
color: {
pattern: ['#E53935', '#5E35B1']
},
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
],
regions: {
'data1': [{'start':1, 'end':2, 'style':'dashed'},{'start':3}],
'data2': [{'end':3}]
}
},
grid: {
y: {
show: true
}
}
});
// Area chart
// ------------------------------
// Generate chart
var area_chart = c3.generate({
bindto: '#c3-area-chart',
size: { height: 400 },
point: {
r: 4
},
color: {
pattern: ['#E53935', '#3949AB']
},
data: {
columns: [
['data1', 300, 350, 300, 0, 0, 0],
['data2', 130, 100, 140, 200, 150, 50]
],
types: {
data1: 'area-spline',
data2: 'area-spline'
}
},
grid: {
y: {
show: true
}
}
});
// Stacked area chart
// ------------------------------
// Generate chart
var area_stacked_chart = c3.generate({
bindto: '#c3-area-stacked-chart',
size: { height: 400 },
color: {
pattern: ['#1E88E5', '#F4511E']
},
point: {
r: 4
},
data: {
columns: [
['data1', 300, 350, 300, 0, 0, 120],
['data2', 130, 100, 140, 200, 150, 50]
],
types: {
data1: 'area-spline',
data2: 'area-spline'
},
groups: [['data1', 'data2']]
},
grid: {
y: {
show: true
}
}
});
// Step chart
// ------------------------------
// Generate chart
var step_chart = c3.generate({
bindto: '#c3-step-chart',
size: { height: 400 },
color: {
pattern: ['#6D4C41', '#039BE5']
},
data: {
columns: [
['data1', 300, 350, 300, 0, 0, 100],
['data2', 130, 100, 140, 200, 150, 50]
],
types: {
data1: 'step',
data2: 'area-step'
}
},
grid: {
y: {
show: true
}
}
});
// Resize chart on sidebar width change
$(".sidebar-control").on('click', function() {
line_chart.resize();
chart_line_regions.resize();
area_chart.resize();
area_stacked_chart.resize();
step_chart.resize();
});
}); | {
"pile_set_name": "Github"
} |
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QHARFBUZZ_P_H
#define QHARFBUZZ_P_H
#include <QtCore/qglobal.h>
#include <harfbuzz-shaper.h>
QT_BEGIN_NAMESPACE
// temporary forward until all the textengine code has been moved to QtCore
Q_CORE_EXPORT void qGetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
const HB_ScriptItem *items, hb_uint32 numItems,
HB_CharAttributes *attributes);
Q_CORE_EXPORT HB_Bool qShapeItem(HB_ShaperItem *item);
// ### temporary
Q_CORE_EXPORT HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc);
Q_CORE_EXPORT void qHBFreeFace(HB_Face);
Q_DECLARE_TYPEINFO(HB_GlyphAttributes, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(HB_FixedPoint, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M12,22c0,0,0.01,0,0.01,0c5.51,0,9.98-4.46,9.99-9.98c0-0.01,0-0.01,0-0.02c0-5.52-4.48-10-10-10S2,6.48,2,12 S6.48,22,12,22z M12,3.5c4.69,0,8.5,3.81,8.5,8.52c-0.01,4.68-3.81,8.48-8.5,8.48c-4.69,0-8.5-3.81-8.5-8.5 C3.5,7.31,7.31,3.5,12,3.5z" />
<path
android:fillColor="@android:color/white"
android:pathData="M8.57,9.89c0.4,0.1,0.81-0.15,0.9-0.56c0.12-0.5,0.36-0.94,0.71-1.29c1.06-1.06,2.78-1.06,3.84,0 c0.53,0.53,0.79,1.23,0.72,1.92c-0.06,0.62-0.39,1.15-0.92,1.5c-0.17,0.11-0.35,0.19-0.52,0.27c-0.7,0.33-1.67,0.78-1.93,2.37 c-0.07,0.41,0.21,0.8,0.61,0.86C12.02,14.99,12.06,15,12.1,15c0.36,0,0.68-0.26,0.74-0.62c0.14-0.82,0.48-0.98,1.09-1.26 c0.25-0.11,0.49-0.23,0.72-0.38c0.91-0.6,1.48-1.53,1.58-2.61c0.12-1.14-0.31-2.28-1.15-3.13c-1.64-1.64-4.32-1.64-5.96,0 c-0.54,0.54-0.93,1.24-1.11,2C7.92,9.39,8.16,9.8,8.57,9.89z" />
<path
android:fillColor="@android:color/white"
android:pathData="M 12 16.5 C 12.5522847498 16.5 13 16.9477152502 13 17.5 C 13 18.0522847498 12.5522847498 18.5 12 18.5 C 11.4477152502 18.5 11 18.0522847498 11 17.5 C 11 16.9477152502 11.4477152502 16.5 12 16.5 Z" />
</vector> | {
"pile_set_name": "Github"
} |
/**
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
*
* Camunda licenses this file to you under the MIT; you may not use this file
* except in compliance with the MIT License.
*/
import React, { PureComponent } from 'react';
import classNames from 'classnames';
import css from './Button.less';
export default class Button extends PureComponent {
render() {
const {
disabled,
className,
...rest
} = this.props;
return (
<button className={
classNames(css.Button, {
disabled
}, className)
} { ...rest } />
);
}
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Tue Mar 25 15:16:45 CET 2014 -->
<title>amten.ml.examples</title>
<meta name="date" content="2014-03-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="amten.ml.examples";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../amten/ml/package-summary.html">Prev Package</a></li>
<li><a href="../../../amten/ml/matrix/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?amten/ml/examples/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package amten.ml.examples</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../amten/ml/examples/NNClassificationExample.html" title="class in amten.ml.examples">NNClassificationExample</a></td>
<td class="colLast">
<div class="block">Examples of using NeuralNetwork for classification.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../amten/ml/examples/NNRegressionExample.html" title="class in amten.ml.examples">NNRegressionExample</a></td>
<td class="colLast">
<div class="block">Examples of using NeuralNetwork for regression.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../amten/ml/package-summary.html">Prev Package</a></li>
<li><a href="../../../amten/ml/matrix/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?amten/ml/examples/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
#ifndef MAXMINDDB_CONFIG_H
#define MAXMINDDB_CONFIG_H
#ifndef MMDB_UINT128_USING_MODE
/* Define as 1 if we we use unsigned int __atribute__ ((__mode__(TI))) for uint128 values */
#define MMDB_UINT128_USING_MODE 0
#endif
#ifndef MMDB_UINT128_IS_BYTE_ARRAY
/* Define as 1 if we don't have an unsigned __int128 type */
#define MMDB_UINT128_IS_BYTE_ARRAY 1
#endif
#endif /* MAXMINDDB_CONFIG_H */
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
# This script shows how to build the Docker image and push it to ECR to be ready for use
# by SageMaker.
# The argument to this script is the image name. This will be used as the image on the local
# machine and combined with the account and region to form the repository name for ECR.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/set_env.sh
# set region
region=
if [ "$#" -eq 1 ]; then
region=$1
else
echo "usage: $0 <aws-region>"
exit 1
fi
image=$IMAGE_NAME
tag=$IMAGE_TAG
# Get the account number associated with the current IAM credentials
account=$(aws sts get-caller-identity --query Account --output text)
if [ $? -ne 0 ]
then
exit 255
fi
fullname="${account}.dkr.ecr.${region}.amazonaws.com/${image}:${tag}"
# If the repository doesn't exist in ECR, create it.
aws ecr describe-repositories --region ${region} --repository-names "${image}" > /dev/null 2>&1
if [ $? -ne 0 ]; then
aws ecr create-repository --region ${region} --repository-name "${image}" > /dev/null
fi
# Build the docker image locally with the image name and then push it to ECR
# with the full name.
# Get the login command from ECR and execute it directly
$(aws ecr get-login --no-include-email --region us-west-2 --registry-ids 763104351884)
docker build -t ${image} $DIR/..
docker tag ${image} ${fullname}
# Get the login command from ECR and execute it directly
$(aws ecr get-login --region ${region} --no-include-email)
docker push ${fullname}
if [ $? -eq 0 ]; then
echo "Amazon ECR URI: ${fullname}"
else
echo "Error: Image build and push failed"
exit 1
fi
| {
"pile_set_name": "Github"
} |
var vows = require('vows');
var assert = require('assert');
var suite = vows.describe('jStat');
require('../env.js');
suite.addBatch({
'linearalgebra': {
'topic': function() {
return jStat;
},
'exp function works': function(jStat) {
var A = jStat([[-1, 0], [1, 2]]);
assert.deepEqual(A.exp(), jStat([[Math.exp(-1), 1], [Math.E, Math.exp(2)]]));
}
}
});
suite.export(module);
| {
"pile_set_name": "Github"
} |
s(:block,
s(:send,
s(:lvar, :foo), :fun,
s(:begin,
s(:int, "1"))), nil, nil)
| {
"pile_set_name": "Github"
} |
/* -------------------------------------------------------------------------
*
* pg_range.cpp
* routines to support manipulation of the pg_range relation
*
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/common/backend/catalog/pg_range.cpp
*
* -------------------------------------------------------------------------
*/
#include "postgres.h"
#include "knl/knl_variable.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_range.h"
#include "catalog/pg_type.h"
#include "utils/fmgroids.h"
#include "utils/rel.h"
#include "utils/rel_gs.h"
#include "utils/tqual.h"
/*
* RangeCreate
* Create an entry in pg_range.
*/
void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, Oid rangeSubOpclass,
RegProcedure rangeCanonical, RegProcedure rangeSubDiff)
{
Relation pg_range;
Datum values[Natts_pg_range];
bool nulls[Natts_pg_range];
HeapTuple tup;
ObjectAddress myself;
ObjectAddress referenced;
pg_range = heap_open(RangeRelationId, RowExclusiveLock);
errno_t rc = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check(rc, "", "");
values[Anum_pg_range_rngtypid - 1] = ObjectIdGetDatum(rangeTypeOid);
values[Anum_pg_range_rngsubtype - 1] = ObjectIdGetDatum(rangeSubType);
values[Anum_pg_range_rngcollation - 1] = ObjectIdGetDatum(rangeCollation);
values[Anum_pg_range_rngsubopc - 1] = ObjectIdGetDatum(rangeSubOpclass);
values[Anum_pg_range_rngcanonical - 1] = ObjectIdGetDatum(rangeCanonical);
values[Anum_pg_range_rngsubdiff - 1] = ObjectIdGetDatum(rangeSubDiff);
tup = heap_form_tuple(RelationGetDescr(pg_range), values, nulls);
(void)simple_heap_insert(pg_range, tup);
CatalogUpdateIndexes(pg_range, tup);
heap_freetuple_ext(tup);
/* record type's dependencies on range-related items */
myself.classId = TypeRelationId;
myself.objectId = rangeTypeOid;
myself.objectSubId = 0;
referenced.classId = TypeRelationId;
referenced.objectId = rangeSubType;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
referenced.classId = OperatorClassRelationId;
referenced.objectId = rangeSubOpclass;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
if (OidIsValid(rangeCollation)) {
referenced.classId = CollationRelationId;
referenced.objectId = rangeCollation;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
if (OidIsValid(rangeCanonical)) {
referenced.classId = ProcedureRelationId;
referenced.objectId = rangeCanonical;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
if (OidIsValid(rangeSubDiff)) {
referenced.classId = ProcedureRelationId;
referenced.objectId = rangeSubDiff;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
heap_close(pg_range, RowExclusiveLock);
}
/*
* RangeDelete
* Remove the pg_range entry for the specified type.
*/
void RangeDelete(Oid rangeTypeOid)
{
Relation pg_range;
ScanKeyData key[1];
SysScanDesc scan;
HeapTuple tup;
pg_range = heap_open(RangeRelationId, RowExclusiveLock);
ScanKeyInit(&key[0], Anum_pg_range_rngtypid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(rangeTypeOid));
scan = systable_beginscan(pg_range, RangeTypidIndexId, true, SnapshotNow, 1, key);
while (HeapTupleIsValid(tup = systable_getnext(scan))) {
simple_heap_delete(pg_range, &tup->t_self);
}
systable_endscan(scan);
heap_close(pg_range, RowExclusiveLock);
}
| {
"pile_set_name": "Github"
} |
import io
import unittest
class TestFileBasedBuffer(unittest.TestCase):
def _makeOne(self, file=None, from_buffer=None):
from waitress.buffers import FileBasedBuffer
buf = FileBasedBuffer(file, from_buffer=from_buffer)
self.buffers_to_close.append(buf)
return buf
def setUp(self):
self.buffers_to_close = []
def tearDown(self):
for buf in self.buffers_to_close:
buf.close()
def test_ctor_from_buffer_None(self):
inst = self._makeOne("file")
self.assertEqual(inst.file, "file")
def test_ctor_from_buffer(self):
from_buffer = io.BytesIO(b"data")
from_buffer.getfile = lambda *x: from_buffer
f = io.BytesIO()
inst = self._makeOne(f, from_buffer)
self.assertEqual(inst.file, f)
del from_buffer.getfile
self.assertEqual(inst.remain, 4)
from_buffer.close()
def test___len__(self):
inst = self._makeOne()
inst.remain = 10
self.assertEqual(len(inst), 10)
def test___nonzero__(self):
inst = self._makeOne()
inst.remain = 10
self.assertEqual(bool(inst), True)
inst.remain = 0
self.assertEqual(bool(inst), True)
def test_append(self):
f = io.BytesIO(b"data")
inst = self._makeOne(f)
inst.append(b"data2")
self.assertEqual(f.getvalue(), b"datadata2")
self.assertEqual(inst.remain, 5)
def test_get_skip_true(self):
f = io.BytesIO(b"data")
inst = self._makeOne(f)
result = inst.get(100, skip=True)
self.assertEqual(result, b"data")
self.assertEqual(inst.remain, -4)
def test_get_skip_false(self):
f = io.BytesIO(b"data")
inst = self._makeOne(f)
result = inst.get(100, skip=False)
self.assertEqual(result, b"data")
self.assertEqual(inst.remain, 0)
def test_get_skip_bytes_less_than_zero(self):
f = io.BytesIO(b"data")
inst = self._makeOne(f)
result = inst.get(-1, skip=False)
self.assertEqual(result, b"data")
self.assertEqual(inst.remain, 0)
def test_skip_remain_gt_bytes(self):
f = io.BytesIO(b"d")
inst = self._makeOne(f)
inst.remain = 1
inst.skip(1)
self.assertEqual(inst.remain, 0)
def test_skip_remain_lt_bytes(self):
f = io.BytesIO(b"d")
inst = self._makeOne(f)
inst.remain = 1
self.assertRaises(ValueError, inst.skip, 2)
def test_newfile(self):
inst = self._makeOne()
self.assertRaises(NotImplementedError, inst.newfile)
def test_prune_remain_notzero(self):
f = io.BytesIO(b"d")
inst = self._makeOne(f)
inst.remain = 1
nf = io.BytesIO()
inst.newfile = lambda *x: nf
inst.prune()
self.assertTrue(inst.file is not f)
self.assertEqual(nf.getvalue(), b"d")
def test_prune_remain_zero_tell_notzero(self):
f = io.BytesIO(b"d")
inst = self._makeOne(f)
nf = io.BytesIO(b"d")
inst.newfile = lambda *x: nf
inst.remain = 0
inst.prune()
self.assertTrue(inst.file is not f)
self.assertEqual(nf.getvalue(), b"d")
def test_prune_remain_zero_tell_zero(self):
f = io.BytesIO()
inst = self._makeOne(f)
inst.remain = 0
inst.prune()
self.assertTrue(inst.file is f)
def test_close(self):
f = io.BytesIO()
inst = self._makeOne(f)
inst.close()
self.assertTrue(f.closed)
self.buffers_to_close.remove(inst)
class TestTempfileBasedBuffer(unittest.TestCase):
def _makeOne(self, from_buffer=None):
from waitress.buffers import TempfileBasedBuffer
buf = TempfileBasedBuffer(from_buffer=from_buffer)
self.buffers_to_close.append(buf)
return buf
def setUp(self):
self.buffers_to_close = []
def tearDown(self):
for buf in self.buffers_to_close:
buf.close()
def test_newfile(self):
inst = self._makeOne()
r = inst.newfile()
self.assertTrue(hasattr(r, "fileno")) # file
r.close()
class TestBytesIOBasedBuffer(unittest.TestCase):
def _makeOne(self, from_buffer=None):
from waitress.buffers import BytesIOBasedBuffer
return BytesIOBasedBuffer(from_buffer=from_buffer)
def test_ctor_from_buffer_not_None(self):
f = io.BytesIO()
f.getfile = lambda *x: f
inst = self._makeOne(f)
self.assertTrue(hasattr(inst.file, "read"))
def test_ctor_from_buffer_None(self):
inst = self._makeOne()
self.assertTrue(hasattr(inst.file, "read"))
def test_newfile(self):
inst = self._makeOne()
r = inst.newfile()
self.assertTrue(hasattr(r, "read"))
class TestReadOnlyFileBasedBuffer(unittest.TestCase):
def _makeOne(self, file, block_size=8192):
from waitress.buffers import ReadOnlyFileBasedBuffer
buf = ReadOnlyFileBasedBuffer(file, block_size)
self.buffers_to_close.append(buf)
return buf
def setUp(self):
self.buffers_to_close = []
def tearDown(self):
for buf in self.buffers_to_close:
buf.close()
def test_prepare_not_seekable(self):
f = KindaFilelike(b"abc")
inst = self._makeOne(f)
result = inst.prepare()
self.assertEqual(result, False)
self.assertEqual(inst.remain, 0)
def test_prepare_not_seekable_closeable(self):
f = KindaFilelike(b"abc", close=1)
inst = self._makeOne(f)
result = inst.prepare()
self.assertEqual(result, False)
self.assertEqual(inst.remain, 0)
self.assertTrue(hasattr(inst, "close"))
def test_prepare_seekable_closeable(self):
f = Filelike(b"abc", close=1, tellresults=[0, 10])
inst = self._makeOne(f)
result = inst.prepare()
self.assertEqual(result, 10)
self.assertEqual(inst.remain, 10)
self.assertEqual(inst.file.seeked, 0)
self.assertTrue(hasattr(inst, "close"))
def test_get_numbytes_neg_one(self):
f = io.BytesIO(b"abcdef")
inst = self._makeOne(f)
inst.remain = 2
result = inst.get(-1)
self.assertEqual(result, b"ab")
self.assertEqual(inst.remain, 2)
self.assertEqual(f.tell(), 0)
def test_get_numbytes_gt_remain(self):
f = io.BytesIO(b"abcdef")
inst = self._makeOne(f)
inst.remain = 2
result = inst.get(3)
self.assertEqual(result, b"ab")
self.assertEqual(inst.remain, 2)
self.assertEqual(f.tell(), 0)
def test_get_numbytes_lt_remain(self):
f = io.BytesIO(b"abcdef")
inst = self._makeOne(f)
inst.remain = 2
result = inst.get(1)
self.assertEqual(result, b"a")
self.assertEqual(inst.remain, 2)
self.assertEqual(f.tell(), 0)
def test_get_numbytes_gt_remain_withskip(self):
f = io.BytesIO(b"abcdef")
inst = self._makeOne(f)
inst.remain = 2
result = inst.get(3, skip=True)
self.assertEqual(result, b"ab")
self.assertEqual(inst.remain, 0)
self.assertEqual(f.tell(), 2)
def test_get_numbytes_lt_remain_withskip(self):
f = io.BytesIO(b"abcdef")
inst = self._makeOne(f)
inst.remain = 2
result = inst.get(1, skip=True)
self.assertEqual(result, b"a")
self.assertEqual(inst.remain, 1)
self.assertEqual(f.tell(), 1)
def test___iter__(self):
data = b"a" * 10000
f = io.BytesIO(data)
inst = self._makeOne(f)
r = b""
for val in inst:
r += val
self.assertEqual(r, data)
def test_append(self):
inst = self._makeOne(None)
self.assertRaises(NotImplementedError, inst.append, "a")
class TestOverflowableBuffer(unittest.TestCase):
def _makeOne(self, overflow=10):
from waitress.buffers import OverflowableBuffer
buf = OverflowableBuffer(overflow)
self.buffers_to_close.append(buf)
return buf
def setUp(self):
self.buffers_to_close = []
def tearDown(self):
for buf in self.buffers_to_close:
buf.close()
def test___len__buf_is_None(self):
inst = self._makeOne()
self.assertEqual(len(inst), 0)
def test___len__buf_is_not_None(self):
inst = self._makeOne()
inst.buf = b"abc"
self.assertEqual(len(inst), 3)
self.buffers_to_close.remove(inst)
def test___nonzero__(self):
inst = self._makeOne()
inst.buf = b"abc"
self.assertEqual(bool(inst), True)
inst.buf = b""
self.assertEqual(bool(inst), False)
self.buffers_to_close.remove(inst)
def test___nonzero___on_int_overflow_buffer(self):
inst = self._makeOne()
class int_overflow_buf(bytes):
def __len__(self):
# maxint + 1
return 0x7FFFFFFFFFFFFFFF + 1
inst.buf = int_overflow_buf()
self.assertEqual(bool(inst), True)
inst.buf = b""
self.assertEqual(bool(inst), False)
self.buffers_to_close.remove(inst)
def test__create_buffer_large(self):
from waitress.buffers import TempfileBasedBuffer
inst = self._makeOne()
inst.strbuf = b"x" * 11
inst._create_buffer()
self.assertEqual(inst.buf.__class__, TempfileBasedBuffer)
self.assertEqual(inst.buf.get(100), b"x" * 11)
self.assertEqual(inst.strbuf, b"")
def test__create_buffer_small(self):
from waitress.buffers import BytesIOBasedBuffer
inst = self._makeOne()
inst.strbuf = b"x" * 5
inst._create_buffer()
self.assertEqual(inst.buf.__class__, BytesIOBasedBuffer)
self.assertEqual(inst.buf.get(100), b"x" * 5)
self.assertEqual(inst.strbuf, b"")
def test_append_with_len_more_than_max_int(self):
from waitress.compat import MAXINT
inst = self._makeOne()
inst.overflowed = True
buf = DummyBuffer(length=MAXINT)
inst.buf = buf
result = inst.append(b"x")
# we don't want this to throw an OverflowError on Python 2 (see
# https://github.com/Pylons/waitress/issues/47)
self.assertEqual(result, None)
self.buffers_to_close.remove(inst)
def test_append_buf_None_not_longer_than_srtbuf_limit(self):
inst = self._makeOne()
inst.strbuf = b"x" * 5
inst.append(b"hello")
self.assertEqual(inst.strbuf, b"xxxxxhello")
def test_append_buf_None_longer_than_strbuf_limit(self):
inst = self._makeOne(10000)
inst.strbuf = b"x" * 8192
inst.append(b"hello")
self.assertEqual(inst.strbuf, b"")
self.assertEqual(len(inst.buf), 8197)
def test_append_overflow(self):
inst = self._makeOne(10)
inst.strbuf = b"x" * 8192
inst.append(b"hello")
self.assertEqual(inst.strbuf, b"")
self.assertEqual(len(inst.buf), 8197)
def test_append_sz_gt_overflow(self):
from waitress.buffers import BytesIOBasedBuffer
f = io.BytesIO(b"data")
inst = self._makeOne(f)
buf = BytesIOBasedBuffer()
inst.buf = buf
inst.overflow = 2
inst.append(b"data2")
self.assertEqual(f.getvalue(), b"data")
self.assertTrue(inst.overflowed)
self.assertNotEqual(inst.buf, buf)
def test_get_buf_None_skip_False(self):
inst = self._makeOne()
inst.strbuf = b"x" * 5
r = inst.get(5)
self.assertEqual(r, b"xxxxx")
def test_get_buf_None_skip_True(self):
inst = self._makeOne()
inst.strbuf = b"x" * 5
r = inst.get(5, skip=True)
self.assertFalse(inst.buf is None)
self.assertEqual(r, b"xxxxx")
def test_skip_buf_None(self):
inst = self._makeOne()
inst.strbuf = b"data"
inst.skip(4)
self.assertEqual(inst.strbuf, b"")
self.assertNotEqual(inst.buf, None)
def test_skip_buf_None_allow_prune_True(self):
inst = self._makeOne()
inst.strbuf = b"data"
inst.skip(4, True)
self.assertEqual(inst.strbuf, b"")
self.assertEqual(inst.buf, None)
def test_prune_buf_None(self):
inst = self._makeOne()
inst.prune()
self.assertEqual(inst.strbuf, b"")
def test_prune_with_buf(self):
inst = self._makeOne()
class Buf:
def prune(self):
self.pruned = True
inst.buf = Buf()
inst.prune()
self.assertEqual(inst.buf.pruned, True)
self.buffers_to_close.remove(inst)
def test_prune_with_buf_overflow(self):
inst = self._makeOne()
class DummyBuffer(io.BytesIO):
def getfile(self):
return self
def prune(self):
return True
def __len__(self):
return 5
def close(self):
pass
buf = DummyBuffer(b"data")
inst.buf = buf
inst.overflowed = True
inst.overflow = 10
inst.prune()
self.assertNotEqual(inst.buf, buf)
def test_prune_with_buflen_more_than_max_int(self):
from waitress.compat import MAXINT
inst = self._makeOne()
inst.overflowed = True
buf = DummyBuffer(length=MAXINT + 1)
inst.buf = buf
result = inst.prune()
# we don't want this to throw an OverflowError on Python 2 (see
# https://github.com/Pylons/waitress/issues/47)
self.assertEqual(result, None)
def test_getfile_buf_None(self):
inst = self._makeOne()
f = inst.getfile()
self.assertTrue(hasattr(f, "read"))
def test_getfile_buf_not_None(self):
inst = self._makeOne()
buf = io.BytesIO()
buf.getfile = lambda *x: buf
inst.buf = buf
f = inst.getfile()
self.assertEqual(f, buf)
def test_close_nobuf(self):
inst = self._makeOne()
inst.buf = None
self.assertEqual(inst.close(), None) # doesnt raise
self.buffers_to_close.remove(inst)
def test_close_withbuf(self):
class Buffer:
def close(self):
self.closed = True
buf = Buffer()
inst = self._makeOne()
inst.buf = buf
inst.close()
self.assertTrue(buf.closed)
self.buffers_to_close.remove(inst)
class KindaFilelike:
def __init__(self, bytes, close=None, tellresults=None):
self.bytes = bytes
self.tellresults = tellresults
if close is not None:
self.close = lambda: close
class Filelike(KindaFilelike):
def seek(self, v, whence=0):
self.seeked = v
def tell(self):
v = self.tellresults.pop(0)
return v
class DummyBuffer:
def __init__(self, length=0):
self.length = length
def __len__(self):
return self.length
def append(self, s):
self.length = self.length + len(s)
def prune(self):
pass
def close(self):
pass
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2020 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "Hash.hpp"
#include "Fd.hpp"
#include "Logging.hpp"
using Logging::log;
using nonstd::string_view;
const string_view HASH_DELIMITER("\000cCaChE\000", 8);
Hash::Hash()
{
blake3_hasher_init(&m_hasher);
}
void
Hash::enable_debug(string_view section_name,
FILE* debug_binary,
FILE* debug_text)
{
m_debug_binary = debug_binary;
m_debug_text = debug_text;
add_debug_text("=== ");
add_debug_text(section_name);
add_debug_text(" ===\n");
}
Digest
Hash::digest() const
{
// Note that blake3_hasher_finalize doesn't modify the hasher itself, thus it
// is possible to finalize again after more data has been added.
Digest digest;
blake3_hasher_finalize(&m_hasher, digest.bytes(), digest.size());
return digest;
}
Hash&
Hash::hash_delimiter(string_view type)
{
hash_buffer(HASH_DELIMITER);
hash_buffer(type);
hash_buffer(string_view("", 1)); // NUL
add_debug_text("### ");
add_debug_text(type);
add_debug_text("\n");
return *this;
}
Hash&
Hash::hash(const void* data, size_t size, HashType hash_type)
{
string_view buffer(static_cast<const char*>(data), size);
hash_buffer(buffer);
switch (hash_type) {
case HashType::binary:
add_debug_text(
Util::format_base16(static_cast<const uint8_t*>(data), size));
break;
case HashType::text:
add_debug_text(buffer);
break;
}
add_debug_text("\n");
return *this;
}
Hash&
Hash::hash(string_view data)
{
hash(data.data(), data.length());
return *this;
}
Hash&
Hash::hash(int64_t x)
{
hash_buffer(string_view(reinterpret_cast<const char*>(&x), sizeof(x)));
add_debug_text(fmt::format("{}\n", x));
return *this;
}
bool
Hash::hash_fd(int fd)
{
return Util::read_fd(
fd, [=](const void* data, size_t size) { hash(data, size); });
}
bool
Hash::hash_file(const std::string& path)
{
Fd fd(open(path.c_str(), O_RDONLY | O_BINARY));
if (!fd) {
log("Failed to open {}: {}", path, strerror(errno));
return false;
}
bool ret = hash_fd(*fd);
return ret;
}
void
Hash::hash_buffer(string_view buffer)
{
blake3_hasher_update(&m_hasher, buffer.data(), buffer.size());
if (!buffer.empty() && m_debug_binary) {
(void)fwrite(buffer.data(), 1, buffer.size(), m_debug_binary);
}
}
void
Hash::add_debug_text(string_view text)
{
if (!text.empty() && m_debug_text) {
(void)fwrite(text.data(), 1, text.length(), m_debug_text);
}
}
| {
"pile_set_name": "Github"
} |
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_App_iOS : NSObject
@end
@implementation PodsDummy_Pods_App_iOS
@end
| {
"pile_set_name": "Github"
} |
<?php
/**
* Author: Nil Portugués Calderó <contact@nilportugues.com>
* Date: 6/3/14
* Time: 12:07 AM.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace NilPortugues\Sql\QueryBuilder\Syntax;
use NilPortugues\Sql\QueryBuilder\Manipulation\QueryException;
/**
* Class Column.
*/
class Column implements QueryPartInterface
{
const ALL = '*';
/**
* @var Table
*/
protected $table;
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $alias;
/**
* @param string $name
* @param string $table
* @param string $alias
*/
public function __construct($name, $table, $alias = '')
{
$this->setName($name);
$this->setTable($table);
$this->setAlias($alias);
}
/**
* @return string
*/
public function partName()
{
return 'COLUMN';
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return $this
*/
public function setName($name)
{
$this->name = (string) $name;
return $this;
}
/**
* @return Table
*/
public function getTable()
{
return $this->table;
}
/**
* @param string $table
*
* @return $this
*/
public function setTable($table)
{
$newTable = array($table);
$this->table = SyntaxFactory::createTable($newTable);
return $this;
}
/**
* @return string
*/
public function getAlias()
{
return $this->alias;
}
/**
* @param null|string $alias
*
* @return $this
*
* @throws QueryException
*/
public function setAlias($alias)
{
if (0 == \strlen($alias)) {
$this->alias = null;
return $this;
}
if ($this->isAll()) {
throw new QueryException("Can't use alias because column name is ALL (*)");
}
$this->alias = (string) $alias;
return $this;
}
/**
* Check whether column name is '*' or not.
*
* @return bool
*/
public function isAll()
{
return $this->getName() == self::ALL;
}
}
| {
"pile_set_name": "Github"
} |
@import '~scss/variables';
@import '~scss/mixins';
.annotations {
& > li {
padding: 12px 32px;
border-radius: 60px;
background-color: $bg-color;
border: solid 1px $border-color;
font-family: $font-family-id;
& + li {
margin-top: 8px;
}
}
}
| {
"pile_set_name": "Github"
} |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Hook = require("./Hook");
const HookCodeFactory = require("./HookCodeFactory");
class SyncHookCodeFactory extends HookCodeFactory {
content({ onError, onDone, rethrowIfPossible }) {
return this.callTapsSeries({
onError: (i, err) => onError(err),
onDone,
rethrowIfPossible
});
}
}
const factory = new SyncHookCodeFactory();
class SyncHook extends Hook {
tapAsync() {
throw new Error("tapAsync is not supported on a SyncHook");
}
tapPromise() {
throw new Error("tapPromise is not supported on a SyncHook");
}
compile(options) {
factory.setup(this, options);
return factory.create(options);
}
}
module.exports = SyncHook;
| {
"pile_set_name": "Github"
} |
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,linux
package unix
const (
SizeofPtr = 0x8
SizeofLong = 0x8
)
type (
_C_long int64
)
type Timespec struct {
Sec int64
Nsec int64
}
type Timeval struct {
Sec int64
Usec int64
}
type Timex struct {
Modes uint32
Offset int64
Freq int64
Maxerror int64
Esterror int64
Status int32
Constant int64
Precision int64
Tolerance int64
Time Timeval
Tick int64
Ppsfreq int64
Jitter int64
Shift int32
Stabil int64
Jitcnt int64
Calcnt int64
Errcnt int64
Stbcnt int64
Tai int32
_ [44]byte
}
type Time_t int64
type Tms struct {
Utime int64
Stime int64
Cutime int64
Cstime int64
}
type Utimbuf struct {
Actime int64
Modtime int64
}
type Rusage struct {
Utime Timeval
Stime Timeval
Maxrss int64
Ixrss int64
Idrss int64
Isrss int64
Minflt int64
Majflt int64
Nswap int64
Inblock int64
Oublock int64
Msgsnd int64
Msgrcv int64
Nsignals int64
Nvcsw int64
Nivcsw int64
}
type Stat_t struct {
Dev uint64
Ino uint64
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
_ uint64
Size int64
Blksize int32
_ int32
Blocks int64
Atim Timespec
Mtim Timespec
Ctim Timespec
_ [2]int32
}
type Dirent struct {
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]int8
_ [5]byte
}
type Flock_t struct {
Type int16
Whence int16
Start int64
Len int64
Pid int32
_ [4]byte
}
const (
FADV_DONTNEED = 0x4
FADV_NOREUSE = 0x5
)
type RawSockaddr struct {
Family uint16
Data [14]int8
}
type RawSockaddrAny struct {
Addr RawSockaddr
Pad [96]int8
}
type Iovec struct {
Base *byte
Len uint64
}
type Msghdr struct {
Name *byte
Namelen uint32
Iov *Iovec
Iovlen uint64
Control *byte
Controllen uint64
Flags int32
_ [4]byte
}
type Cmsghdr struct {
Len uint64
Level int32
Type int32
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (
SizeofSockFprog = 0x10
)
type PtraceRegs struct {
Regs [31]uint64
Sp uint64
Pc uint64
Pstate uint64
}
type FdSet struct {
Bits [16]int64
}
type Sysinfo_t struct {
Uptime int64
Loads [3]uint64
Totalram uint64
Freeram uint64
Sharedram uint64
Bufferram uint64
Totalswap uint64
Freeswap uint64
Procs uint16
Pad uint16
Totalhigh uint64
Freehigh uint64
Unit uint32
_ [0]int8
_ [4]byte
}
type Ustat_t struct {
Tfree int32
Tinode uint64
Fname [6]int8
Fpack [6]int8
_ [4]byte
}
type EpollEvent struct {
Events uint32
PadFd int32
Fd int32
Pad int32
}
const (
POLLRDHUP = 0x2000
)
type Sigset_t struct {
Val [16]uint64
}
const _C__NSIG = 0x41
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Line uint8
Cc [19]uint8
Ispeed uint32
Ospeed uint32
}
type Taskstats struct {
Version uint16
Ac_exitcode uint32
Ac_flag uint8
Ac_nice uint8
Cpu_count uint64
Cpu_delay_total uint64
Blkio_count uint64
Blkio_delay_total uint64
Swapin_count uint64
Swapin_delay_total uint64
Cpu_run_real_total uint64
Cpu_run_virtual_total uint64
Ac_comm [32]int8
Ac_sched uint8
Ac_pad [3]uint8
_ [4]byte
Ac_uid uint32
Ac_gid uint32
Ac_pid uint32
Ac_ppid uint32
Ac_btime uint32
Ac_etime uint64
Ac_utime uint64
Ac_stime uint64
Ac_minflt uint64
Ac_majflt uint64
Coremem uint64
Virtmem uint64
Hiwater_rss uint64
Hiwater_vm uint64
Read_char uint64
Write_char uint64
Read_syscalls uint64
Write_syscalls uint64
Read_bytes uint64
Write_bytes uint64
Cancelled_write_bytes uint64
Nvcsw uint64
Nivcsw uint64
Ac_utimescaled uint64
Ac_stimescaled uint64
Cpu_scaled_run_real_total uint64
Freepages_count uint64
Freepages_delay_total uint64
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
}
type cpuMask uint64
const (
_NCPUBITS = 0x40
)
const (
CBitFieldMaskBit0 = 0x1
CBitFieldMaskBit1 = 0x2
CBitFieldMaskBit2 = 0x4
CBitFieldMaskBit3 = 0x8
CBitFieldMaskBit4 = 0x10
CBitFieldMaskBit5 = 0x20
CBitFieldMaskBit6 = 0x40
CBitFieldMaskBit7 = 0x80
CBitFieldMaskBit8 = 0x100
CBitFieldMaskBit9 = 0x200
CBitFieldMaskBit10 = 0x400
CBitFieldMaskBit11 = 0x800
CBitFieldMaskBit12 = 0x1000
CBitFieldMaskBit13 = 0x2000
CBitFieldMaskBit14 = 0x4000
CBitFieldMaskBit15 = 0x8000
CBitFieldMaskBit16 = 0x10000
CBitFieldMaskBit17 = 0x20000
CBitFieldMaskBit18 = 0x40000
CBitFieldMaskBit19 = 0x80000
CBitFieldMaskBit20 = 0x100000
CBitFieldMaskBit21 = 0x200000
CBitFieldMaskBit22 = 0x400000
CBitFieldMaskBit23 = 0x800000
CBitFieldMaskBit24 = 0x1000000
CBitFieldMaskBit25 = 0x2000000
CBitFieldMaskBit26 = 0x4000000
CBitFieldMaskBit27 = 0x8000000
CBitFieldMaskBit28 = 0x10000000
CBitFieldMaskBit29 = 0x20000000
CBitFieldMaskBit30 = 0x40000000
CBitFieldMaskBit31 = 0x80000000
CBitFieldMaskBit32 = 0x100000000
CBitFieldMaskBit33 = 0x200000000
CBitFieldMaskBit34 = 0x400000000
CBitFieldMaskBit35 = 0x800000000
CBitFieldMaskBit36 = 0x1000000000
CBitFieldMaskBit37 = 0x2000000000
CBitFieldMaskBit38 = 0x4000000000
CBitFieldMaskBit39 = 0x8000000000
CBitFieldMaskBit40 = 0x10000000000
CBitFieldMaskBit41 = 0x20000000000
CBitFieldMaskBit42 = 0x40000000000
CBitFieldMaskBit43 = 0x80000000000
CBitFieldMaskBit44 = 0x100000000000
CBitFieldMaskBit45 = 0x200000000000
CBitFieldMaskBit46 = 0x400000000000
CBitFieldMaskBit47 = 0x800000000000
CBitFieldMaskBit48 = 0x1000000000000
CBitFieldMaskBit49 = 0x2000000000000
CBitFieldMaskBit50 = 0x4000000000000
CBitFieldMaskBit51 = 0x8000000000000
CBitFieldMaskBit52 = 0x10000000000000
CBitFieldMaskBit53 = 0x20000000000000
CBitFieldMaskBit54 = 0x40000000000000
CBitFieldMaskBit55 = 0x80000000000000
CBitFieldMaskBit56 = 0x100000000000000
CBitFieldMaskBit57 = 0x200000000000000
CBitFieldMaskBit58 = 0x400000000000000
CBitFieldMaskBit59 = 0x800000000000000
CBitFieldMaskBit60 = 0x1000000000000000
CBitFieldMaskBit61 = 0x2000000000000000
CBitFieldMaskBit62 = 0x4000000000000000
CBitFieldMaskBit63 = 0x8000000000000000
)
type SockaddrStorage struct {
Family uint16
_ [118]int8
_ uint64
}
type HDGeometry struct {
Heads uint8
Sectors uint8
Cylinders uint16
Start uint64
}
type Statfs_t struct {
Type int64
Bsize int64
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid Fsid
Namelen int64
Frsize int64
Flags int64
Spare [4]int64
}
type TpacketHdr struct {
Status uint64
Len uint32
Snaplen uint32
Mac uint16
Net uint16
Sec uint32
Usec uint32
_ [4]byte
}
const (
SizeofTpacketHdr = 0x20
)
type RTCPLLInfo struct {
Ctrl int32
Value int32
Max int32
Min int32
Posmult int32
Negmult int32
Clock int64
}
type BlkpgPartition struct {
Start int64
Length int64
Pno int32
Devname [64]uint8
Volname [64]uint8
_ [4]byte
}
const (
BLKPG = 0x1269
)
type XDPUmemReg struct {
Addr uint64
Len uint64
Size uint32
Headroom uint32
Flags uint32
_ [4]byte
}
type CryptoUserAlg struct {
Name [64]int8
Driver_name [64]int8
Module_name [64]int8
Type uint32
Mask uint32
Refcnt uint32
Flags uint32
}
type CryptoStatAEAD struct {
Type [64]int8
Encrypt_cnt uint64
Encrypt_tlen uint64
Decrypt_cnt uint64
Decrypt_tlen uint64
Err_cnt uint64
}
type CryptoStatAKCipher struct {
Type [64]int8
Encrypt_cnt uint64
Encrypt_tlen uint64
Decrypt_cnt uint64
Decrypt_tlen uint64
Verify_cnt uint64
Sign_cnt uint64
Err_cnt uint64
}
type CryptoStatCipher struct {
Type [64]int8
Encrypt_cnt uint64
Encrypt_tlen uint64
Decrypt_cnt uint64
Decrypt_tlen uint64
Err_cnt uint64
}
type CryptoStatCompress struct {
Type [64]int8
Compress_cnt uint64
Compress_tlen uint64
Decompress_cnt uint64
Decompress_tlen uint64
Err_cnt uint64
}
type CryptoStatHash struct {
Type [64]int8
Hash_cnt uint64
Hash_tlen uint64
Err_cnt uint64
}
type CryptoStatKPP struct {
Type [64]int8
Setsecret_cnt uint64
Generate_public_key_cnt uint64
Compute_shared_secret_cnt uint64
Err_cnt uint64
}
type CryptoStatRNG struct {
Type [64]int8
Generate_cnt uint64
Generate_tlen uint64
Seed_cnt uint64
Err_cnt uint64
}
type CryptoStatLarval struct {
Type [64]int8
}
type CryptoReportLarval struct {
Type [64]int8
}
type CryptoReportHash struct {
Type [64]int8
Blocksize uint32
Digestsize uint32
}
type CryptoReportCipher struct {
Type [64]int8
Blocksize uint32
Min_keysize uint32
Max_keysize uint32
}
type CryptoReportBlkCipher struct {
Type [64]int8
Geniv [64]int8
Blocksize uint32
Min_keysize uint32
Max_keysize uint32
Ivsize uint32
}
type CryptoReportAEAD struct {
Type [64]int8
Geniv [64]int8
Blocksize uint32
Maxauthsize uint32
Ivsize uint32
}
type CryptoReportComp struct {
Type [64]int8
}
type CryptoReportRNG struct {
Type [64]int8
Seedsize uint32
}
type CryptoReportAKCipher struct {
Type [64]int8
}
type CryptoReportKPP struct {
Type [64]int8
}
type CryptoReportAcomp struct {
Type [64]int8
}
type LoopInfo struct {
Number int32
Device uint32
Inode uint64
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type TIPCSubscr struct {
Seq TIPCServiceRange
Timeout uint32
Filter uint32
Handle [8]int8
}
type TIPCSIOCLNReq struct {
Peer uint32
Id uint32
Linkname [68]int8
}
type TIPCSIOCNodeIDReq struct {
Peer uint32
Id [16]int8
}
| {
"pile_set_name": "Github"
} |
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface MKResizableImage : NSObject
@end
| {
"pile_set_name": "Github"
} |
extends layout
block content
.home-hero
h1= title
p Welcome to the CP&L outage reporting tool. From here you can view all reported outages via the dashboard screen, or report a new outage. Our technicians will address outages as soon as possible.
.text-center
a(href='/dashboard').btn.btn-lg.btn-primary
i.glyphicon.glyphicon-list-alt
| Dashboard
a(href='/new').btn.btn-lg.btn-primary
i.glyphicon.glyphicon-bullhorn
| Report Outage
| {
"pile_set_name": "Github"
} |
'use strict';
require('./setup');
var Peaks = require('../../src/main');
var Point = require('../../src/point');
describe('Point', function() {
describe('update', function() {
var p;
beforeEach(function(done) {
var options = {
containers: {
overview: document.getElementById('overview-container'),
zoomview: document.getElementById('zoomview-container')
},
mediaElement: document.getElementById('media'),
dataUri: { arraybuffer: 'base/test_data/sample.dat' }
};
Peaks.init(options, function(err, instance) {
expect(err).to.equal(null);
p = instance;
done();
});
});
afterEach(function() {
if (p) {
p.destroy();
}
});
it('should be possible to update all properties programatically', function() {
p.points.add({ time: 10, editable: true, color: '#ff0000', labelText: 'A point' });
var newLabelText = 'new label text';
var newTime = 12;
var point = p.points.getPoints()[0];
point.update({
time: newTime,
labelText: newLabelText
});
expect(point.time).to.equal(newTime);
expect(point.labelText).to.equal(newLabelText);
});
it('should not allow invalid updates', function() {
p.points.add({
time: 10,
editable: true,
color: '#ff0000',
labelText: 'A point'
});
var point = p.points.getPoints()[0];
expect(function() {
point.update({ time: NaN });
}).to.throw(TypeError);
expect(function() {
point.update({ time: -10 });
}).to.throw(RangeError);
point.update({ labelText: undefined });
expect(point.labelText).to.equal('');
});
it('should not update any attributes if invalid', function() {
p.points.add({
time: 10,
editable: true,
color: '#ff0000',
labelText: 'A point'
});
var point = p.points.getPoints()[0];
expect(function() {
point.update({
time: NaN,
editable: false,
color: '#000000',
labelText: 'Updated'
});
}).to.throw(TypeError);
expect(point.time).to.equal(10);
expect(point.editable).to.equal(true);
expect(point.color).to.equal('#ff0000');
expect(point.labelText).to.equal('A point');
});
it('should allow a user data attribute to be created', function() {
var peaks = { emit: function() {} };
var point = new Point({
peaks: peaks,
id: 'point.1',
time: 0.0,
editable: false,
color: '#000000',
labelText: ''
});
point.update({ data: 'test' });
expect(point.data).to.equal('test');
});
it('should allow a user data attribute to be updated', function() {
var peaks = { emit: function() {} };
var point = new Point({
peaks: peaks,
id: 'point.1',
time: 0.0,
editable: false,
color: '#000000',
labelText: '',
data: 'test'
});
point.update({ data: 'updated' });
expect(point.data).to.equal('updated');
});
});
describe('isVisible', function() {
it('should return false if point is before visible range', function() {
var point = new Point({
peaks: null,
id: 'point.1',
labelText: '',
editable: true,
time: 9.0
});
expect(point.isVisible(10.0, 20.0)).to.equal(false);
});
it('should return false if point is after visible range', function() {
var point = new Point({
peaks: null,
id: 'point.1',
labelText: '',
editable: true,
time: 20.0
});
expect(point.isVisible(10.0, 20.0)).to.equal(false);
});
it('should return true if point is within visible range', function() {
var point = new Point({
peaks: null,
id: 'point.1',
labelText: '',
editable: true,
time: 10.0
});
expect(point.isVisible(10.0, 20.0)).to.equal(true);
});
});
});
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ff000000"
android:pathData="M5,15H3v4c0,1.1 0.9,2 2,2h4v-2H5v-4zM5,5h4V3H5c-1.1,0 -2,0.9 -2,2v4h2V5zm14,-2h-4v2h4v4h2V5c0,-1.1 -0.9,-2 -2,-2zm0,16h-4v2h4c1.1,0 2,-0.9 2,-2v-4h-2v4zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector> | {
"pile_set_name": "Github"
} |
package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.StandardCategoryInfo;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.item.category.children.batchquery response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class KoubeiItemCategoryChildrenBatchqueryResponse extends AlipayResponse {
private static final long serialVersionUID = 8128293622517435852L;
/**
* 口碑标准后台类目信息列表
*/
@ApiListField("category_list")
@ApiField("standard_category_info")
private List<StandardCategoryInfo> categoryList;
public void setCategoryList(List<StandardCategoryInfo> categoryList) {
this.categoryList = categoryList;
}
public List<StandardCategoryInfo> getCategoryList( ) {
return this.categoryList;
}
}
| {
"pile_set_name": "Github"
} |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u01c1goagas",
"\u01c3uias"
],
"DAY": [
"Sontaxtsees",
"Mantaxtsees",
"Denstaxtsees",
"Wunstaxtsees",
"Dondertaxtsees",
"Fraitaxtsees",
"Satertaxtsees"
],
"ERANAMES": [
"Xristub ai\u01c3\u00e2",
"Xristub khao\u01c3g\u00e2"
],
"ERAS": [
"BC",
"AD"
],
"MONTH": [
"\u01c3Khanni",
"\u01c3Khan\u01c0g\u00f4ab",
"\u01c0Khuu\u01c1kh\u00e2b",
"\u01c3H\u00f4a\u01c2khaib",
"\u01c3Khaits\u00e2b",
"Gama\u01c0aeb",
"\u01c2Khoesaob",
"Ao\u01c1khuum\u00fb\u01c1kh\u00e2b",
"Tara\u01c0khuum\u00fb\u01c1kh\u00e2b",
"\u01c2N\u00fb\u01c1n\u00e2iseb",
"\u01c0Hoo\u01c2gaeb",
"H\u00f4asore\u01c1kh\u00e2b"
],
"SHORTDAY": [
"Son",
"Ma",
"De",
"Wu",
"Do",
"Fr",
"Sat"
],
"SHORTMONTH": [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "naq-na",
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
| {
"pile_set_name": "Github"
} |
/*
* Generic libav* helpers
*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_AV_HELPERS_H
#define MPLAYER_AV_HELPERS_H
void init_avcodec(void);
void init_avformat(void);
#endif /* MPLAYER_AV_HELPERS_H */
| {
"pile_set_name": "Github"
} |
# Copyright (C) 2015 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.
.class public LTestCase;
.super Ljava/lang/Object;
# The phi in this method has no actual uses but one environment use. It will
# be eliminated in normal mode but kept live in debuggable mode. Test that
# Checker runs the correct test for each compilation mode.
## CHECK-START: int TestCase.deadPhi(int, int, int) builder (after)
## CHECK-NOT: Phi
## CHECK-START-DEBUGGABLE: int TestCase.deadPhi(int, int, int) builder (after)
## CHECK: Phi
.method public static deadPhi(III)I
.registers 8
move v0, p1
if-eqz p0, :after
move v0, p2
:after
# v0 = Phi [p1, p2] with no uses
invoke-static {}, Ljava/lang/System;->nanoTime()J # create an env use
:return
return p2
.end method
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2012 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __AMDGPU_UCODE_H__
#define __AMDGPU_UCODE_H__
#include "amdgpu_socbb.h"
struct common_firmware_header {
uint32_t size_bytes; /* size of the entire header+image(s) in bytes */
uint32_t header_size_bytes; /* size of just the header in bytes */
uint16_t header_version_major; /* header version */
uint16_t header_version_minor; /* header version */
uint16_t ip_version_major; /* IP version */
uint16_t ip_version_minor; /* IP version */
uint32_t ucode_version;
uint32_t ucode_size_bytes; /* size of ucode in bytes */
uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */
uint32_t crc32; /* crc32 checksum of the payload */
};
/* version_major=1, version_minor=0 */
struct mc_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t io_debug_size_bytes; /* size of debug array in dwords */
uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */
};
/* version_major=1, version_minor=0 */
struct smc_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_start_addr;
};
/* version_major=2, version_minor=0 */
struct smc_firmware_header_v2_0 {
struct smc_firmware_header_v1_0 v1_0;
uint32_t ppt_offset_bytes; /* soft pptable offset */
uint32_t ppt_size_bytes; /* soft pptable size */
};
struct smc_soft_pptable_entry {
uint32_t id;
uint32_t ppt_offset_bytes;
uint32_t ppt_size_bytes;
};
/* version_major=2, version_minor=1 */
struct smc_firmware_header_v2_1 {
struct smc_firmware_header_v1_0 v1_0;
uint32_t pptable_count;
uint32_t pptable_entry_offset;
};
/* version_major=1, version_minor=0 */
struct psp_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t sos_offset_bytes;
uint32_t sos_size_bytes;
};
/* version_major=1, version_minor=1 */
struct psp_firmware_header_v1_1 {
struct psp_firmware_header_v1_0 v1_0;
uint32_t toc_header_version;
uint32_t toc_offset_bytes;
uint32_t toc_size_bytes;
uint32_t kdb_header_version;
uint32_t kdb_offset_bytes;
uint32_t kdb_size_bytes;
};
/* version_major=1, version_minor=2 */
struct psp_firmware_header_v1_2 {
struct psp_firmware_header_v1_0 v1_0;
uint32_t reserve[3];
uint32_t kdb_header_version;
uint32_t kdb_offset_bytes;
uint32_t kdb_size_bytes;
};
/* version_major=1, version_minor=3 */
struct psp_firmware_header_v1_3 {
struct psp_firmware_header_v1_1 v1_1;
uint32_t spl_header_version;
uint32_t spl_offset_bytes;
uint32_t spl_size_bytes;
};
/* version_major=1, version_minor=0 */
struct ta_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ta_xgmi_ucode_version;
uint32_t ta_xgmi_offset_bytes;
uint32_t ta_xgmi_size_bytes;
uint32_t ta_ras_ucode_version;
uint32_t ta_ras_offset_bytes;
uint32_t ta_ras_size_bytes;
uint32_t ta_hdcp_ucode_version;
uint32_t ta_hdcp_offset_bytes;
uint32_t ta_hdcp_size_bytes;
uint32_t ta_dtm_ucode_version;
uint32_t ta_dtm_offset_bytes;
uint32_t ta_dtm_size_bytes;
};
enum ta_fw_type {
TA_FW_TYPE_UNKOWN,
TA_FW_TYPE_PSP_ASD,
TA_FW_TYPE_PSP_XGMI,
TA_FW_TYPE_PSP_RAS,
TA_FW_TYPE_PSP_HDCP,
TA_FW_TYPE_PSP_DTM,
};
struct ta_fw_bin_desc {
uint32_t fw_type;
uint32_t fw_version;
uint32_t offset_bytes;
uint32_t size_bytes;
};
/* version_major=2, version_minor=0 */
struct ta_firmware_header_v2_0 {
struct common_firmware_header header;
uint32_t ta_fw_bin_count;
struct ta_fw_bin_desc ta_fw_bin[];
};
/* version_major=1, version_minor=0 */
struct gfx_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t jt_offset; /* jt location */
uint32_t jt_size; /* size of jt */
};
/* version_major=1, version_minor=0 */
struct mes_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t mes_ucode_version;
uint32_t mes_ucode_size_bytes;
uint32_t mes_ucode_offset_bytes;
uint32_t mes_ucode_data_version;
uint32_t mes_ucode_data_size_bytes;
uint32_t mes_ucode_data_offset_bytes;
uint32_t mes_uc_start_addr_lo;
uint32_t mes_uc_start_addr_hi;
uint32_t mes_data_start_addr_lo;
uint32_t mes_data_start_addr_hi;
};
/* version_major=1, version_minor=0 */
struct rlc_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t save_and_restore_offset;
uint32_t clear_state_descriptor_offset;
uint32_t avail_scratch_ram_locations;
uint32_t master_pkt_description_offset;
};
/* version_major=2, version_minor=0 */
struct rlc_firmware_header_v2_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t jt_offset; /* jt location */
uint32_t jt_size; /* size of jt */
uint32_t save_and_restore_offset;
uint32_t clear_state_descriptor_offset;
uint32_t avail_scratch_ram_locations;
uint32_t reg_restore_list_size;
uint32_t reg_list_format_start;
uint32_t reg_list_format_separate_start;
uint32_t starting_offsets_start;
uint32_t reg_list_format_size_bytes; /* size of reg list format array in bytes */
uint32_t reg_list_format_array_offset_bytes; /* payload offset from the start of the header */
uint32_t reg_list_size_bytes; /* size of reg list array in bytes */
uint32_t reg_list_array_offset_bytes; /* payload offset from the start of the header */
uint32_t reg_list_format_separate_size_bytes; /* size of reg list format array in bytes */
uint32_t reg_list_format_separate_array_offset_bytes; /* payload offset from the start of the header */
uint32_t reg_list_separate_size_bytes; /* size of reg list array in bytes */
uint32_t reg_list_separate_array_offset_bytes; /* payload offset from the start of the header */
};
/* version_major=2, version_minor=1 */
struct rlc_firmware_header_v2_1 {
struct rlc_firmware_header_v2_0 v2_0;
uint32_t reg_list_format_direct_reg_list_length; /* length of direct reg list format array */
uint32_t save_restore_list_cntl_ucode_ver;
uint32_t save_restore_list_cntl_feature_ver;
uint32_t save_restore_list_cntl_size_bytes;
uint32_t save_restore_list_cntl_offset_bytes;
uint32_t save_restore_list_gpm_ucode_ver;
uint32_t save_restore_list_gpm_feature_ver;
uint32_t save_restore_list_gpm_size_bytes;
uint32_t save_restore_list_gpm_offset_bytes;
uint32_t save_restore_list_srm_ucode_ver;
uint32_t save_restore_list_srm_feature_ver;
uint32_t save_restore_list_srm_size_bytes;
uint32_t save_restore_list_srm_offset_bytes;
};
/* version_major=1, version_minor=0 */
struct sdma_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t ucode_change_version;
uint32_t jt_offset; /* jt location */
uint32_t jt_size; /* size of jt */
};
/* version_major=1, version_minor=1 */
struct sdma_firmware_header_v1_1 {
struct sdma_firmware_header_v1_0 v1_0;
uint32_t digest_size;
};
/* gpu info payload */
struct gpu_info_firmware_v1_0 {
uint32_t gc_num_se;
uint32_t gc_num_cu_per_sh;
uint32_t gc_num_sh_per_se;
uint32_t gc_num_rb_per_se;
uint32_t gc_num_tccs;
uint32_t gc_num_gprs;
uint32_t gc_num_max_gs_thds;
uint32_t gc_gs_table_depth;
uint32_t gc_gsprim_buff_depth;
uint32_t gc_parameter_cache_depth;
uint32_t gc_double_offchip_lds_buffer;
uint32_t gc_wave_size;
uint32_t gc_max_waves_per_simd;
uint32_t gc_max_scratch_slots_per_cu;
uint32_t gc_lds_size;
};
struct gpu_info_firmware_v1_1 {
struct gpu_info_firmware_v1_0 v1_0;
uint32_t num_sc_per_sh;
uint32_t num_packer_per_sc;
};
/* gpu info payload
* version_major=1, version_minor=1 */
struct gpu_info_firmware_v1_2 {
struct gpu_info_firmware_v1_1 v1_1;
struct gpu_info_soc_bounding_box_v1_0 soc_bounding_box;
};
/* version_major=1, version_minor=0 */
struct gpu_info_firmware_header_v1_0 {
struct common_firmware_header header;
uint16_t version_major; /* version */
uint16_t version_minor; /* version */
};
/* version_major=1, version_minor=0 */
struct dmcu_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t intv_offset_bytes; /* interrupt vectors offset from end of header, in bytes */
uint32_t intv_size_bytes; /* size of interrupt vectors, in bytes */
};
/* version_major=1, version_minor=0 */
struct dmcub_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t inst_const_bytes; /* size of instruction region, in bytes */
uint32_t bss_data_bytes; /* size of bss/data region, in bytes */
};
/* header is fixed size */
union amdgpu_firmware_header {
struct common_firmware_header common;
struct mc_firmware_header_v1_0 mc;
struct smc_firmware_header_v1_0 smc;
struct smc_firmware_header_v2_0 smc_v2_0;
struct psp_firmware_header_v1_0 psp;
struct psp_firmware_header_v1_1 psp_v1_1;
struct psp_firmware_header_v1_3 psp_v1_3;
struct ta_firmware_header_v1_0 ta;
struct ta_firmware_header_v2_0 ta_v2_0;
struct gfx_firmware_header_v1_0 gfx;
struct rlc_firmware_header_v1_0 rlc;
struct rlc_firmware_header_v2_0 rlc_v2_0;
struct rlc_firmware_header_v2_1 rlc_v2_1;
struct sdma_firmware_header_v1_0 sdma;
struct sdma_firmware_header_v1_1 sdma_v1_1;
struct gpu_info_firmware_header_v1_0 gpu_info;
struct dmcu_firmware_header_v1_0 dmcu;
struct dmcub_firmware_header_v1_0 dmcub;
uint8_t raw[0x100];
};
#define UCODE_MAX_TA_PACKAGING ((sizeof(union amdgpu_firmware_header) - sizeof(struct common_firmware_header) - 4) / sizeof(struct ta_fw_bin_desc))
/*
* fw loading support
*/
enum AMDGPU_UCODE_ID {
AMDGPU_UCODE_ID_SDMA0 = 0,
AMDGPU_UCODE_ID_SDMA1,
AMDGPU_UCODE_ID_SDMA2,
AMDGPU_UCODE_ID_SDMA3,
AMDGPU_UCODE_ID_SDMA4,
AMDGPU_UCODE_ID_SDMA5,
AMDGPU_UCODE_ID_SDMA6,
AMDGPU_UCODE_ID_SDMA7,
AMDGPU_UCODE_ID_CP_CE,
AMDGPU_UCODE_ID_CP_PFP,
AMDGPU_UCODE_ID_CP_ME,
AMDGPU_UCODE_ID_CP_MEC1,
AMDGPU_UCODE_ID_CP_MEC1_JT,
AMDGPU_UCODE_ID_CP_MEC2,
AMDGPU_UCODE_ID_CP_MEC2_JT,
AMDGPU_UCODE_ID_CP_MES,
AMDGPU_UCODE_ID_CP_MES_DATA,
AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL,
AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM,
AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM,
AMDGPU_UCODE_ID_RLC_G,
AMDGPU_UCODE_ID_STORAGE,
AMDGPU_UCODE_ID_SMC,
AMDGPU_UCODE_ID_UVD,
AMDGPU_UCODE_ID_UVD1,
AMDGPU_UCODE_ID_VCE,
AMDGPU_UCODE_ID_VCN,
AMDGPU_UCODE_ID_VCN1,
AMDGPU_UCODE_ID_DMCU_ERAM,
AMDGPU_UCODE_ID_DMCU_INTV,
AMDGPU_UCODE_ID_VCN0_RAM,
AMDGPU_UCODE_ID_VCN1_RAM,
AMDGPU_UCODE_ID_DMCUB,
AMDGPU_UCODE_ID_MAXIMUM,
};
/* engine firmware status */
enum AMDGPU_UCODE_STATUS {
AMDGPU_UCODE_STATUS_INVALID,
AMDGPU_UCODE_STATUS_NOT_LOADED,
AMDGPU_UCODE_STATUS_LOADED,
};
enum amdgpu_firmware_load_type {
AMDGPU_FW_LOAD_DIRECT = 0,
AMDGPU_FW_LOAD_SMU,
AMDGPU_FW_LOAD_PSP,
AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO,
};
/* conform to smu_ucode_xfer_cz.h */
#define AMDGPU_SDMA0_UCODE_LOADED 0x00000001
#define AMDGPU_SDMA1_UCODE_LOADED 0x00000002
#define AMDGPU_CPCE_UCODE_LOADED 0x00000004
#define AMDGPU_CPPFP_UCODE_LOADED 0x00000008
#define AMDGPU_CPME_UCODE_LOADED 0x00000010
#define AMDGPU_CPMEC1_UCODE_LOADED 0x00000020
#define AMDGPU_CPMEC2_UCODE_LOADED 0x00000040
#define AMDGPU_CPRLC_UCODE_LOADED 0x00000100
/* amdgpu firmware info */
struct amdgpu_firmware_info {
/* ucode ID */
enum AMDGPU_UCODE_ID ucode_id;
/* request_firmware */
const struct firmware *fw;
/* starting mc address */
uint64_t mc_addr;
/* kernel linear address */
void *kaddr;
/* ucode_size_bytes */
uint32_t ucode_size;
/* starting tmr mc address */
uint32_t tmr_mc_addr_lo;
uint32_t tmr_mc_addr_hi;
};
struct amdgpu_firmware {
struct amdgpu_firmware_info ucode[AMDGPU_UCODE_ID_MAXIMUM];
enum amdgpu_firmware_load_type load_type;
struct amdgpu_bo *fw_buf;
unsigned int fw_size;
unsigned int max_ucodes;
/* firmwares are loaded by psp instead of smu from vega10 */
const struct amdgpu_psp_funcs *funcs;
struct amdgpu_bo *rbuf;
struct mutex mutex;
/* gpu info firmware data pointer */
const struct firmware *gpu_info_fw;
void *fw_buf_ptr;
uint64_t fw_buf_mc;
};
void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr);
int amdgpu_ucode_validate(const struct firmware *fw);
bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,
uint16_t hdr_major, uint16_t hdr_minor);
int amdgpu_ucode_init_bo(struct amdgpu_device *adev);
int amdgpu_ucode_create_bo(struct amdgpu_device *adev);
int amdgpu_ucode_sysfs_init(struct amdgpu_device *adev);
void amdgpu_ucode_free_bo(struct amdgpu_device *adev);
void amdgpu_ucode_sysfs_fini(struct amdgpu_device *adev);
enum amdgpu_firmware_load_type
amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type);
#endif
| {
"pile_set_name": "Github"
} |
.redactor-clips-list {
list-style: none;
margin: 0;
padding: 0;
}
.redactor-clips-list li {
display: inline-block;
margin-right: 4px;
margin-bottom: 4px;
}
.redactor-clips-list span {
white-space: nowrap;
background: rgba(0,125,255, .75);
color: #fff;
display: inline-block;
padding: 3px 6px;
line-height: 1;
border-radius: 4px;
cursor: pointer;
} | {
"pile_set_name": "Github"
} |
/*
* Copyright 2002 Michael Günnewig
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "extrachunk.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "vfw.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
/* reads a chunk out of the extrachunk-structure */
HRESULT ReadExtraChunk(const EXTRACHUNKS *extra,FOURCC ckid,LPVOID lpData,LPLONG size)
{
LPBYTE lp;
DWORD cb;
/* pre-conditions */
assert(extra != NULL);
assert(size != NULL);
lp = extra->lp;
cb = extra->cb;
if (lp != NULL) {
while (cb > 0) {
if (((FOURCC*)lp)[0] == ckid) {
/* found correct chunk */
if (lpData != NULL && *size > 0)
memcpy(lpData, lp + 2 * sizeof(DWORD),
min(((LPDWORD)lp)[1], *(LPDWORD)size));
*(LPDWORD)size = ((LPDWORD)lp)[1];
return AVIERR_OK;
} else {
/* skip to next chunk */
cb -= ((LPDWORD)lp)[1] + 2 * sizeof(DWORD);
lp += ((LPDWORD)lp)[1] + 2 * sizeof(DWORD);
}
}
}
/* wanted chunk doesn't exist */
*size = 0;
return AVIERR_NODATA;
}
/* writes a chunk into the extrachunk-structure */
HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPCVOID lpData, LONG size)
{
LPDWORD lp;
/* pre-conditions */
assert(extra != NULL);
assert(lpData != NULL);
assert(size > 0);
if (extra->lp)
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + size + 2 * sizeof(DWORD));
else
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 2 * sizeof(DWORD));
if (lp == NULL)
return AVIERR_MEMORY;
extra->lp = lp;
lp = (LPDWORD) ((LPBYTE)lp + extra->cb);
extra->cb += size + 2 * sizeof(DWORD);
/* insert chunk-header in block */
lp[0] = ckid;
lp[1] = size;
if (lpData != NULL && size > 0)
memcpy(lp + 2, lpData, size);
return AVIERR_OK;
}
/* reads a chunk from the HMMIO into the extrachunk-structure */
HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,const MMCKINFO *lpck)
{
LPDWORD lp;
DWORD cb;
/* pre-conditions */
assert(extra != NULL);
assert(hmmio != NULL);
assert(lpck != NULL);
cb = lpck->cksize + 2 * sizeof(DWORD);
cb += (cb & 1);
if (extra->lp != NULL)
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + cb);
else
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
if (lp == NULL)
return AVIERR_MEMORY;
extra->lp = lp;
lp = (LPDWORD) ((LPBYTE)lp + extra->cb);
extra->cb += cb;
/* insert chunk-header in block */
lp[0] = lpck->ckid;
lp[1] = lpck->cksize;
if (lpck->cksize > 0) {
if (mmioSeek(hmmio, lpck->dwDataOffset, SEEK_SET) == -1)
return AVIERR_FILEREAD;
if (mmioRead(hmmio, (HPSTR)&lp[2], lpck->cksize) != (LONG)lpck->cksize)
return AVIERR_FILEREAD;
}
return AVIERR_OK;
}
/* reads all non-junk chunks into the extrachunk-structure until it finds
* the given chunk or the optional parent-chunk is at the end */
HRESULT FindChunkAndKeepExtras(LPEXTRACHUNKS extra,HMMIO hmmio,MMCKINFO *lpck,
MMCKINFO *lpckParent,UINT flags)
{
FOURCC ckid;
FOURCC fccType;
MMRESULT mmr;
/* pre-conditions */
assert(extra != NULL);
assert(hmmio != NULL);
assert(lpck != NULL);
TRACE("({%p,%u},%p,%p,%p,0x%X)\n", extra->lp, extra->cb, hmmio, lpck,
lpckParent, flags);
/* what chunk id and form/list type should we search? */
if (flags & MMIO_FINDCHUNK) {
ckid = lpck->ckid;
fccType = 0;
} else if (flags & MMIO_FINDLIST) {
ckid = FOURCC_LIST;
fccType = lpck->fccType;
} else if (flags & MMIO_FINDRIFF) {
ckid = FOURCC_RIFF;
fccType = lpck->fccType;
} else
ckid = fccType = (FOURCC)-1; /* collect everything into extra! */
TRACE(": find ckid=0x%08X fccType=0x%08X\n", ckid, fccType);
for (;;) {
mmr = mmioDescend(hmmio, lpck, lpckParent, 0);
if (mmr != MMSYSERR_NOERROR) {
/* No extra chunks in front of desired chunk? */
if (flags == 0 && mmr == MMIOERR_CHUNKNOTFOUND)
return AVIERR_OK;
else
return AVIERR_FILEREAD;
}
/* Have we found what we search for? */
if ((lpck->ckid == ckid) &&
(fccType == 0 || lpck->fccType == fccType))
return AVIERR_OK;
/* Skip padding chunks, the others put into the extrachunk-structure */
if (lpck->ckid == ckidAVIPADDING ||
lpck->ckid == mmioFOURCC('p','a','d','d'))
{
mmr = mmioAscend(hmmio, lpck, 0);
if (mmr != MMSYSERR_NOERROR) return AVIERR_FILEREAD;
}
else
{
HRESULT hr = ReadChunkIntoExtra(extra, hmmio, lpck);
if (FAILED(hr))
return hr;
}
}
}
| {
"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.
*/
/**
* Standard factory for creating CharacterReaders.
*
* @author Chris Corbyn
*/
class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift_CharacterReaderFactory
{
/**
* A map of charset patterns to their implementation classes.
*
* @var array
*/
private static $_map = array();
/**
* Factories which have already been loaded.
*
* @var Swift_CharacterReaderFactory[]
*/
private static $_loaded = array();
/**
* Creates a new CharacterReaderFactory.
*/
public function __construct()
{
$this->init();
}
public function __wakeup()
{
$this->init();
}
public function init()
{
if (count(self::$_map) > 0) {
return;
}
$prefix = 'Swift_CharacterReader_';
$singleByte = array(
'class' => $prefix . 'GenericFixedWidthReader',
'constructor' => array(1)
);
$doubleByte = array(
'class' => $prefix . 'GenericFixedWidthReader',
'constructor' => array(2)
);
$fourBytes = array(
'class' => $prefix . 'GenericFixedWidthReader',
'constructor' => array(4)
);
// Utf-8
self::$_map['utf-?8'] = array(
'class' => $prefix . 'Utf8Reader',
'constructor' => array()
);
//7-8 bit charsets
self::$_map['(us-)?ascii'] = $singleByte;
self::$_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;
self::$_map['windows-?125[0-9]'] = $singleByte;
self::$_map['cp-?[0-9]+'] = $singleByte;
self::$_map['ansi'] = $singleByte;
self::$_map['macintosh'] = $singleByte;
self::$_map['koi-?7'] = $singleByte;
self::$_map['koi-?8-?.+'] = $singleByte;
self::$_map['mik'] = $singleByte;
self::$_map['(cork|t1)'] = $singleByte;
self::$_map['v?iscii'] = $singleByte;
//16 bits
self::$_map['(ucs-?2|utf-?16)'] = $doubleByte;
//32 bits
self::$_map['(ucs-?4|utf-?32)'] = $fourBytes;
// Fallback
self::$_map['.*'] = $singleByte;
}
/**
* Returns a CharacterReader suitable for the charset applied.
*
* @param string $charset
*
* @return Swift_CharacterReader
*/
public function getReaderFor($charset)
{
$charset = trim(strtolower($charset));
foreach (self::$_map as $pattern => $spec) {
$re = '/^' . $pattern . '$/D';
if (preg_match($re, $charset)) {
if (!array_key_exists($pattern, self::$_loaded)) {
$reflector = new ReflectionClass($spec['class']);
if ($reflector->getConstructor()) {
$reader = $reflector->newInstanceArgs($spec['constructor']);
} else {
$reader = $reflector->newInstance();
}
self::$_loaded[$pattern] = $reader;
}
return self::$_loaded[$pattern];
}
}
}
}
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Contracts\Cache;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Cache\InvalidArgumentException;
use Psr\Log\LoggerInterface;
// Help opcache.preload discover always-needed symbols
class_exists(InvalidArgumentException::class);
/**
* An implementation of CacheInterface for PSR-6 CacheItemPoolInterface classes.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
trait CacheTrait
{
/**
* {@inheritdoc}
*/
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
return $this->doGet($this, $key, $callback, $beta, $metadata);
}
/**
* {@inheritdoc}
*/
public function delete(string $key): bool
{
return $this->deleteItem($key);
}
private function doGet(CacheItemPoolInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null, LoggerInterface $logger = null)
{
if (0 > $beta = $beta ?? 1.0) {
throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta)) extends \InvalidArgumentException implements InvalidArgumentException { };
}
$item = $pool->getItem($key);
$recompute = !$item->isHit() || \INF === $beta;
$metadata = $item instanceof ItemInterface ? $item->getMetadata() : [];
if (!$recompute && $metadata) {
$expiry = $metadata[ItemInterface::METADATA_EXPIRY] ?? false;
$ctime = $metadata[ItemInterface::METADATA_CTIME] ?? false;
if ($recompute = $ctime && $expiry && $expiry <= ($now = microtime(true)) - $ctime / 1000 * $beta * log(random_int(1, \PHP_INT_MAX) / \PHP_INT_MAX)) {
// force applying defaultLifetime to expiry
$item->expiresAt(null);
$logger && $logger->info('Item "{key}" elected for early recomputation {delta}s before its expiration', [
'key' => $key,
'delta' => sprintf('%.1f', $expiry - $now),
]);
}
}
if ($recompute) {
$save = true;
$item->set($callback($item, $save));
if ($save) {
$pool->save($item);
}
}
return $item->get();
}
}
| {
"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 strategicpatch
import (
"errors"
"strings"
"k8s.io/apimachinery/pkg/util/mergepatch"
openapi "k8s.io/kube-openapi/pkg/util/proto"
)
const (
patchStrategyOpenapiextensionKey = "x-kubernetes-patch-strategy"
patchMergeKeyOpenapiextensionKey = "x-kubernetes-patch-merge-key"
)
type LookupPatchItem interface {
openapi.SchemaVisitor
Error() error
Path() *openapi.Path
}
type kindItem struct {
key string
path *openapi.Path
err error
patchmeta PatchMeta
subschema openapi.Schema
hasVisitKind bool
}
func NewKindItem(key string, path *openapi.Path) *kindItem {
return &kindItem{
key: key,
path: path,
}
}
var _ LookupPatchItem = &kindItem{}
func (item *kindItem) Error() error {
return item.err
}
func (item *kindItem) Path() *openapi.Path {
return item.path
}
func (item *kindItem) VisitPrimitive(schema *openapi.Primitive) {
item.err = errors.New("expected kind, but got primitive")
}
func (item *kindItem) VisitArray(schema *openapi.Array) {
item.err = errors.New("expected kind, but got slice")
}
func (item *kindItem) VisitMap(schema *openapi.Map) {
item.err = errors.New("expected kind, but got map")
}
func (item *kindItem) VisitReference(schema openapi.Reference) {
if !item.hasVisitKind {
schema.SubSchema().Accept(item)
}
}
func (item *kindItem) VisitKind(schema *openapi.Kind) {
subschema, ok := schema.Fields[item.key]
if !ok {
item.err = FieldNotFoundError{Path: schema.GetPath().String(), Field: item.key}
return
}
mergeKey, patchStrategies, err := parsePatchMetadata(subschema.GetExtensions())
if err != nil {
item.err = err
return
}
item.patchmeta = PatchMeta{
patchStrategies: patchStrategies,
patchMergeKey: mergeKey,
}
item.subschema = subschema
}
type sliceItem struct {
key string
path *openapi.Path
err error
patchmeta PatchMeta
subschema openapi.Schema
hasVisitKind bool
}
func NewSliceItem(key string, path *openapi.Path) *sliceItem {
return &sliceItem{
key: key,
path: path,
}
}
var _ LookupPatchItem = &sliceItem{}
func (item *sliceItem) Error() error {
return item.err
}
func (item *sliceItem) Path() *openapi.Path {
return item.path
}
func (item *sliceItem) VisitPrimitive(schema *openapi.Primitive) {
item.err = errors.New("expected slice, but got primitive")
}
func (item *sliceItem) VisitArray(schema *openapi.Array) {
if !item.hasVisitKind {
item.err = errors.New("expected visit kind first, then visit array")
}
subschema := schema.SubType
item.subschema = subschema
}
func (item *sliceItem) VisitMap(schema *openapi.Map) {
item.err = errors.New("expected slice, but got map")
}
func (item *sliceItem) VisitReference(schema openapi.Reference) {
if !item.hasVisitKind {
schema.SubSchema().Accept(item)
} else {
item.subschema = schema.SubSchema()
}
}
func (item *sliceItem) VisitKind(schema *openapi.Kind) {
subschema, ok := schema.Fields[item.key]
if !ok {
item.err = FieldNotFoundError{Path: schema.GetPath().String(), Field: item.key}
return
}
mergeKey, patchStrategies, err := parsePatchMetadata(subschema.GetExtensions())
if err != nil {
item.err = err
return
}
item.patchmeta = PatchMeta{
patchStrategies: patchStrategies,
patchMergeKey: mergeKey,
}
item.hasVisitKind = true
subschema.Accept(item)
}
func parsePatchMetadata(extensions map[string]interface{}) (string, []string, error) {
ps, foundPS := extensions[patchStrategyOpenapiextensionKey]
var patchStrategies []string
var mergeKey, patchStrategy string
var ok bool
if foundPS {
patchStrategy, ok = ps.(string)
if ok {
patchStrategies = strings.Split(patchStrategy, ",")
} else {
return "", nil, mergepatch.ErrBadArgType(patchStrategy, ps)
}
}
mk, foundMK := extensions[patchMergeKeyOpenapiextensionKey]
if foundMK {
mergeKey, ok = mk.(string)
if !ok {
return "", nil, mergepatch.ErrBadArgType(mergeKey, mk)
}
}
return mergeKey, patchStrategies, nil
}
| {
"pile_set_name": "Github"
} |
import * as fs from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import { Cache } from '../src/Cache';
describe('Cache', () => {
let cacheDir: string;
let cache: Cache;
const dummyUrl = 'dummy://';
const sanitizedDummyUrl = 'dummy';
beforeEach(async () => {
cacheDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-download-spec-'));
cache = new Cache(cacheDir);
});
afterEach(() => fs.remove(cacheDir));
describe('getCachePath()', () => {
it('should strip the hash and query params off the url', async () => {
const firstUrl = 'https://example.com?foo=1';
const secondUrl = 'https://example.com?foo=2';
const assetName = 'electron-v7.2.4-darwin-x64.zip-v7.2.4-darwin-x64.zip';
expect(await cache.getCachePath(firstUrl, assetName)).toEqual(
await cache.getCachePath(secondUrl, assetName),
);
});
});
describe('getPathForFileInCache()', () => {
it('should return null for a file not in the cache', async () => {
expect(await cache.getPathForFileInCache(dummyUrl, 'test.txt')).toBeNull();
});
it('should return an absolute path for a file in the cache', async () => {
const cachePath = path.resolve(cacheDir, sanitizedDummyUrl, 'test.txt');
await fs.outputFile(cachePath, 'dummy data');
expect(await cache.getPathForFileInCache(dummyUrl, 'test.txt')).toEqual(cachePath);
});
});
describe('putFileInCache()', () => {
it('should throw an error if the provided file path does not exist', async () => {
const fakePath = path.resolve(__dirname, 'fake.file');
await expect(cache.putFileInCache(dummyUrl, fakePath, 'fake.file')).rejects.toHaveProperty(
'message',
`ENOENT: no such file or directory, stat '${fakePath}'`,
);
});
it('should delete the original file', async () => {
const originalPath = path.resolve(cacheDir, sanitizedDummyUrl, 'original.txt');
await fs.outputFile(originalPath, 'dummy data');
await cache.putFileInCache(dummyUrl, originalPath, 'test.txt');
expect(await fs.pathExists(originalPath)).toEqual(false);
});
it('should create a new file in the cache with exactly the same content', async () => {
const originalPath = path.resolve(cacheDir, sanitizedDummyUrl, 'original.txt');
await fs.outputFile(originalPath, 'example content');
const cachePath = await cache.putFileInCache(dummyUrl, originalPath, 'test.txt');
expect(cachePath.startsWith(cacheDir)).toEqual(true);
expect(await fs.readFile(cachePath, 'utf8')).toEqual('example content');
});
it('should overwrite the file if it already exists in cache', async () => {
const originalPath = path.resolve(cacheDir, 'original.txt');
await fs.outputFile(originalPath, 'example content');
await fs.outputFile(path.resolve(cacheDir, sanitizedDummyUrl, 'test.txt'), 'bad content');
const cachePath = await cache.putFileInCache(dummyUrl, originalPath, 'test.txt');
expect(cachePath.startsWith(cacheDir)).toEqual(true);
expect(await fs.readFile(cachePath, 'utf8')).toEqual('example content');
});
});
});
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="ISO-8859-1"?>
<decorators>
<decorator name="authorizedViewDecorator" page="/WEB-INF/views/layout/layout.jsp">
<pattern>/*</pattern>
</decorator>
<!-- <decorator name="guestViewDecorator" page="/WEB-INF/views/layout/guestLayout.jsp">
<pattern>/login.htm</pattern>
<pattern>/register.htm</pattern>
</decorator> -->
</decorators> | {
"pile_set_name": "Github"
} |
module Sum where
import Prelude hiding (sum)
fold c n [] = n
fold c n ((h : t)) = c h (fold c n t)
main = sum [1 .. 4] where sum = fold (+) 0
| {
"pile_set_name": "Github"
} |
# 1 "qpmouse.c"
static __inline__ void atomic_sub(int i, volatile atomic_t *v)
{
__asm__ __volatile__(
"" "subl %1,%0"
:"=m" ((*(volatile struct { int a[100]; } *) v ) )
:"ir" (i), "m" ((*(volatile struct { int a[100]; } *) v ) ));
}
union task_union {
struct task_struct task;
unsigned long stack[2048];
};
extern union task_union init_task_union;
extern struct mm_struct init_mm;
extern struct task_struct *task[512 ];
extern struct task_struct **tarray_freelist;
extern spinlock_t taskslot_lock;
extern __inline__ void add_free_taskslot(struct task_struct **t)
{
(void)( &taskslot_lock ) ;
*t = (struct task_struct *) tarray_freelist;
tarray_freelist = t;
do { } while(0) ;
}
extern __inline__ struct task_struct **get_free_taskslot(void)
{
struct task_struct **tslot;
(void)( &taskslot_lock ) ;
if((tslot = tarray_freelist) != ((void *)0) )
tarray_freelist = (struct task_struct **) *tslot;
do { } while(0) ;
return tslot;
}
# 1 "/home/scott/wrk/driver/linux/include/linux/module.h" 1
# 1 "/home/scott/wrk/driver/linux/include/linux/config.h" 1
# 1 "/home/scott/wrk/driver/linux/include/linux/autoconf.h" 1
# 4 "/home/scott/wrk/driver/linux/include/linux/config.h" 2
# 10 "/home/scott/wrk/driver/linux/include/linux/module.h" 2
# 1 "/home/scott/wrk/driver/linux/include/asm/atomic.h" 1
typedef struct { int counter; } atomic_t;
static __inline__ void atomic_add(int i, volatile atomic_t *v)
{
__asm__ __volatile__(
"" "addl %1,%0"
:"=m" ((*(volatile struct { int a[100]; } *) v ) )
:"ir" (i), "m" ((*(volatile struct { int a[100]; } *) v ) ));
}
static __inline__ void atomic_sub(int i, volatile atomic_t *v)
{
__asm__ __volatile__(
"" "subl %1,%0"
:"=m" ((*(volatile struct { int a[100]; } *) v ) )
:"ir" (i), "m" ((*(volatile struct { int a[100]; } *) v ) ));
}
| {
"pile_set_name": "Github"
} |
{ "extends": "dtslint/dt.json" }
| {
"pile_set_name": "Github"
} |
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace Fonlow.DocComment
{
/// <summary>
/// Helper functions of accessing doc comments of a method
/// </summary>
public class DocCommentHelper
{
public static string GetSummary(docMember m)
{
if (m == null || m.summary == null || m.summary.Text == null || m.summary.Text.Length == 0)
{
return null;
}
var noIndent = StringFunctions.TrimTrimIndentsOfArray(m.summary.Text);
return String.Join(Environment.NewLine, noIndent);
}
public static string GetReturnComment(docMember m)
{
if (m == null || m.returns == null || m.returns.Text == null || m.returns.Text.Length == 0)
{
return null;
}
var noIndent = StringFunctions.TrimTrimIndentsOfArray(m.returns.Text);
return String.Join(Environment.NewLine, noIndent);
}
public static string GetParameterComment(docMember m, string name)
{
if (m == null || m.param == null)
{
return null;
}
var mc = m.param.SingleOrDefault(d => d.name == name);
if (mc == null || mc.Text == null || mc.Text.Length == 0)
{
return null;
}
var noIndent = StringFunctions.TrimTrimIndentsOfArray(mc.Text);
return String.Join(Environment.NewLine, noIndent);
}
}
}
| {
"pile_set_name": "Github"
} |
#
# Note: Due to MELPA distributing directly from github source version
# needs to be embedded in files as is without preprocessing.
#
# Version string is present in:
# - Makefile
# - haskell-mode.el
# - haskell-mode.texi
#
# We should have a script that changes it everywhere it is needed and
# syncs it with current git tag.
#
VERSION = 16.2-git
INSTALL_INFO = install-info
# Use $EMACS environment variable if present, so that all of these are
# equivalent:
#
# 1. export EMACS=/path/to/emacs && make
# 2. EMACS=/path/to/emacs make
# 3. make EMACS=/path/to/emacs
#
# This is particularly useful when EMACS is set in ~/.bash_profile
#
EMACS := $(shell which "$${EMACS}" 2> /dev/null || which "emacs" 2> /dev/null)
EMACS_VERSION := $(shell "$(EMACS)" -Q --batch --eval '(princ emacs-version)')
EFLAGS = --eval "(add-to-list 'load-path (expand-file-name \"tests/compat\") 'append)" \
--eval "(when (boundp 'load-prefer-newer) (setq load-prefer-newer t))"
BATCH = @echo EMACS $@; $(EMACS) $(EFLAGS) --batch -Q -L .
ELFILES := $(filter-out haskell-mode-autoloads.el haskell-mode-pkg.el,$(wildcard *.el))
ELCHECKS := $(wildcard tests/*-tests.el)
AUTOLOADS = haskell-mode-autoloads.el
PKG_DIST_FILES = $(ELFILES) logo.svg NEWS haskell-mode.info dir
.PHONY: all compile info clean check check-emacs-version
all: check-emacs-version compile $(AUTOLOADS) info
check-emacs-version :
$(BATCH) --eval "(when (version< emacs-version \"24.3\") \
(message \"Error: haskell-mode requires Emacs 24.3 or later\") \
(message \"Your version of Emacs is %s\" emacs-version) \
(message \"Found as '$(EMACS)'\") \
(message \"Use one of:\") \
(message \" 1. export EMACS=/path/to/emacs && make\") \
(message \" 2. EMACS=/path/to/emacs make\") \
(message \" 3. make EMACS=/path/to/emacs\") \
(kill-emacs 2))"
@echo Using EMACS = $(EMACS), version = $(EMACS_VERSION)
compile: build-$(EMACS_VERSION)/build-flag
build-$(EMACS_VERSION) :
mkdir $@
# Emacs byte compilation state leaks from file to file if multiple
# files are requested to be build at the same time. We have to
# workaround this issue on Makefile level. Note also that we consider
# an .el file to be dependent on all other files because we do not do
# proper dependency tracking (yet).
build-$(EMACS_VERSION)/%.elc : %.el $(ELFILES)
$(BATCH) --eval '(setq byte-compile-error-on-warn t)' \
--eval "(defun byte-compile-dest-file (filename) \
(concat (file-name-directory filename) \"build-\" emacs-version \"/\" \
(file-name-nondirectory filename) \"c\"))" \
--eval "(when (check-declare-file \"$<\") (kill-emacs 2))" \
-f batch-byte-compile $< \
build-$(EMACS_VERSION)/build-flag : build-$(EMACS_VERSION) $(patsubst %.el,build-$(EMACS_VERSION)/%.elc,$(ELFILES))
touch $@
check-%: tests/%-tests.el
$(BATCH) -l "$<" -f ert-run-tests-batch-and-exit;
check: compile $(AUTOLOADS) check-ert check-conventions
check-conventions :
$(BATCH) -l tests/haskell-code-conventions.el \
-f haskell-check-conventions-batch-and-exit
@echo "conventions are okay"
check-ert: $(ELCHECKS)
$(BATCH) --eval "(when (= emacs-major-version 24) \
(require 'undercover) \
(undercover \"*.el\" \
(:exclude \"haskell-mode-pkg.el\" \"haskell-compat.el\")))" \
-L tests \
$(patsubst %,-l %,$(ELCHECKS)) \
-f ert-run-tests-batch-and-exit
@echo "checks passed!"
clean:
$(RM) -r build-$(EMACS_VERSION) $(AUTOLOADS) $(AUTOLOADS:.el=.elc) haskell-mode.info dir
info: haskell-mode.info dir
dir: haskell-mode.info
$(INSTALL_INFO) --dir=$@ $<
haskell-mode.info: doc/haskell-mode.texi
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $<
doc/haskell-mode.html: doc/haskell-mode.texi doc/haskell-mode.css
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) --html --css-include=doc/haskell-mode.css --no-split -o $@ $<
$(BATCH) -l doc/haskell-manual-fixups.el -f haskell-manual-fixups-batch-and-exit $@
doc/html/index.html : doc/haskell-mode.texi
if [ -e doc/html ]; then rm -r doc/html; fi
mkdir doc/html
cp -r doc/anim doc/html/anim
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) --html \
--css-ref=haskell-mode.css \
-c AFTER_BODY_OPEN='<div class="background"> </div>' \
-c EXTRA_HEAD='<link rel="shortcut icon" href="haskell-mode-32x32.png">' \
-c SHOW_TITLE=0 \
-o doc/html $<
$(BATCH) -l doc/haskell-manual-fixups.el -f haskell-manual-fixups-batch-and-exit doc/html/*.html
doc/html/haskell-mode.css : doc/haskell-mode.css doc/html/index.html
cp $< $@
doc/html/haskell-mode.svg : images/haskell-mode.svg doc/html/index.html
cp $< $@
doc/html/haskell-mode-32x32.png : images/haskell-mode-32x32.png doc/html/index.html
cp $< $@
doc/html : doc/html/index.html \
doc/html/haskell-mode.css \
doc/html/haskell-mode.svg \
doc/html/haskell-mode-32x32.png
deploy-manual : doc/html
cd doc && ./deploy-manual.sh
$(AUTOLOADS): $(ELFILES)
$(BATCH) \
--eval '(setq make-backup-files nil)' \
--eval "(setq generated-autoload-file (concat command-line-default-directory \"/\" \"$@\"))" \
-f batch-update-autoloads "."
# check if autoloads will really load
$(BATCH) -l "$@"
check-external : check-emacs-version $(AUTOLOADS)
$(BATCH) -l tests/haskell-external.el \
-f haskell-check-external-batch-and-exit
@echo "external packages okay"
| {
"pile_set_name": "Github"
} |
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H
#ifndef FLEX_ARRAY
/*
* See if our compiler is known to support flexible array members.
*/
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
# define FLEX_ARRAY /* empty */
#elif defined(__GNUC__)
# if (__GNUC__ >= 3)
# define FLEX_ARRAY /* empty */
# else
# define FLEX_ARRAY 0 /* older GNU extension */
# endif
#endif
/*
* Otherwise, default to safer but a bit wasteful traditional style
*/
#ifndef FLEX_ARRAY
# define FLEX_ARRAY 1
#endif
#endif
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#ifdef __GNUC__
#define TYPEOF(x) (__typeof__(x))
#else
#define TYPEOF(x)
#endif
#define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (sizeof(x) * 8 - (bits))))
#define HAS_MULTI_BITS(i) ((i) & ((i) - 1)) /* checks if an integer has more than 1 bit set */
/* Approximation of the length of the decimal representation of this type. */
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
#define _ALL_SOURCE 1
#define _BSD_SOURCE 1
#define HAS_BOOL
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <sys/param.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/time.h>
#include <time.h>
#include <signal.h>
#include <fnmatch.h>
#include <assert.h>
#include <regex.h>
#include <utime.h>
#include <sys/wait.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <inttypes.h>
#include <linux/magic.h>
#include "types.h"
#include <sys/ttydefaults.h>
#include <lk/debugfs.h>
#include <termios.h>
extern const char *graph_line;
extern const char *graph_dotted_line;
extern char buildid_dir[];
extern char tracing_events_path[];
extern void perf_debugfs_set_path(const char *mountpoint);
const char *perf_debugfs_mount(const char *mountpoint);
/* On most systems <limits.h> would have given us this, but
* not on some systems (e.g. GNU/Hurd).
*/
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
#ifndef PRIuMAX
#define PRIuMAX "llu"
#endif
#ifndef PRIu32
#define PRIu32 "u"
#endif
#ifndef PRIx32
#define PRIx32 "x"
#endif
#ifndef PATH_SEP
#define PATH_SEP ':'
#endif
#ifndef STRIP_EXTENSION
#define STRIP_EXTENSION ""
#endif
#ifndef has_dos_drive_prefix
#define has_dos_drive_prefix(path) 0
#endif
#ifndef is_dir_sep
#define is_dir_sep(c) ((c) == '/')
#endif
#ifdef __GNUC__
#define NORETURN __attribute__((__noreturn__))
#else
#define NORETURN
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
/* General helper functions */
extern void usage(const char *err) NORETURN;
extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
#include "../../../include/linux/stringify.h"
#define DIE_IF(cnd) \
do { if (cnd) \
die(" at (" __FILE__ ":" __stringify(__LINE__) "): " \
__stringify(cnd) "\n"); \
} while (0)
extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
extern int prefixcmp(const char *str, const char *prefix);
extern void set_buildid_dir(void);
extern void disable_buildid_cache(void);
static inline const char *skip_prefix(const char *str, const char *prefix)
{
size_t len = strlen(prefix);
return strncmp(str, prefix, len) ? NULL : str + len;
}
#ifdef __GLIBC_PREREQ
#if __GLIBC_PREREQ(2, 1)
#define HAVE_STRCHRNUL
#endif
#endif
#ifndef HAVE_STRCHRNUL
#define strchrnul gitstrchrnul
static inline char *gitstrchrnul(const char *s, int c)
{
while (*s && *s != c)
s++;
return (char *)s;
}
#endif
/*
* Wrappers:
*/
extern char *xstrdup(const char *str);
extern void *xrealloc(void *ptr, size_t size) __attribute__((weak));
static inline void *zalloc(size_t size)
{
return calloc(1, size);
}
static inline int has_extension(const char *filename, const char *ext)
{
size_t len = strlen(filename);
size_t extlen = strlen(ext);
return len > extlen && !memcmp(filename + len - extlen, ext, extlen);
}
/* Sane ctype - no locale, and works with signed chars */
#undef isascii
#undef isspace
#undef isdigit
#undef isxdigit
#undef isalpha
#undef isprint
#undef isalnum
#undef islower
#undef isupper
#undef tolower
#undef toupper
#ifndef NSEC_PER_MSEC
#define NSEC_PER_MSEC 1000000L
#endif
extern unsigned char sane_ctype[256];
#define GIT_SPACE 0x01
#define GIT_DIGIT 0x02
#define GIT_ALPHA 0x04
#define GIT_GLOB_SPECIAL 0x08
#define GIT_REGEX_SPECIAL 0x10
#define GIT_PRINT_EXTRA 0x20
#define GIT_PRINT 0x3E
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
#define isascii(x) (((x) & ~0x7f) == 0)
#define isspace(x) sane_istest(x,GIT_SPACE)
#define isdigit(x) sane_istest(x,GIT_DIGIT)
#define isxdigit(x) \
(sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G')
#define isalpha(x) sane_istest(x,GIT_ALPHA)
#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
#define isprint(x) sane_istest(x,GIT_PRINT)
#define islower(x) (sane_istest(x,GIT_ALPHA) && (x & 0x20))
#define isupper(x) (sane_istest(x,GIT_ALPHA) && !(x & 0x20))
#define tolower(x) sane_case((unsigned char)(x), 0x20)
#define toupper(x) sane_case((unsigned char)(x), 0)
static inline int sane_case(int x, int high)
{
if (sane_istest(x, GIT_ALPHA))
x = (x & ~0x20) | high;
return x;
}
int mkdir_p(char *path, mode_t mode);
int copyfile(const char *from, const char *to);
s64 perf_atoll(const char *str);
char **argv_split(const char *str, int *argcp);
void argv_free(char **argv);
bool strglobmatch(const char *str, const char *pat);
bool strlazymatch(const char *str, const char *pat);
int strtailcmp(const char *s1, const char *s2);
char *strxfrchar(char *s, char from, char to);
unsigned long convert_unit(unsigned long value, char *unit);
int readn(int fd, void *buf, size_t size);
struct perf_event_attr;
void event_attr_init(struct perf_event_attr *attr);
#define _STR(x) #x
#define STR(x) _STR(x)
/*
* Determine whether some value is a power of two, where zero is
* *not* considered a power of two.
*/
static inline __attribute__((const))
bool is_power_of_2(unsigned long n)
{
return (n != 0 && ((n & (n - 1)) == 0));
}
size_t hex_width(u64 v);
int hex2u64(const char *ptr, u64 *val);
char *ltrim(char *s);
char *rtrim(char *s);
void dump_stack(void);
extern unsigned int page_size;
void get_term_dimensions(struct winsize *ws);
#endif /* GIT_COMPAT_UTIL_H */
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 080a5732fc1b26945be5524e7f65ec9a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2018 Sam Sun <github-contact@samczsun.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.javadeobfuscator.deobfuscator.transformers.zelix.string;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.*;
import com.javadeobfuscator.deobfuscator.config.*;
import com.javadeobfuscator.deobfuscator.exceptions.*;
import com.javadeobfuscator.deobfuscator.matcher.*;
import com.javadeobfuscator.deobfuscator.transformers.*;
import com.javadeobfuscator.deobfuscator.utils.*;
import com.javadeobfuscator.javavm.*;
import com.javadeobfuscator.javavm.exceptions.*;
import com.javadeobfuscator.javavm.mirrors.*;
import com.javadeobfuscator.javavm.values.*;
import org.objectweb.asm.*;
import org.objectweb.asm.tree.*;
import org.objectweb.asm.tree.analysis.*;
import org.objectweb.asm.tree.analysis.Frame;
import java.util.*;
import java.util.function.Supplier;
/**
* This is a transformer for the enhanced version of Zelix string encryption
*/
@TransformerConfig.ConfigOptions(configClass = EnhancedStringEncryptionTransformer.Config.class)
public class EnhancedStringEncryptionTransformer extends Transformer<EnhancedStringEncryptionTransformer.Config> implements Opcodes {
private static final InstructionPattern DECRYPT_PATTERN = new InstructionPattern(
new LoadIntStep(),
new LoadIntStep(),
new CapturingStep(new InvocationStep(INVOKESTATIC, null, null, "(II)Ljava/lang/String;", false), "invoke")
);
@Override
public boolean transform() throws Throwable, WrongTransformerException {
VirtualMachine vm = TransformerHelper.newVirtualMachine(this);
for (ClassNode classNode : classes.values()) {
// Just YOLO through the initialization process
try {
vm.initialize(JavaClass.forName(vm, classNode.name));
} catch (VMException e) {
JavaClass.forName(vm, classNode.name).setInitializationState(JavaClass.InitializationState.INITIALIZED, null); // of course we initialized it
logger.debug("Exception while initializing {}, should be fine", classNode.name);
logger.debug(vm.exceptionToString(e));
} catch (Throwable e) {
JavaClass.forName(vm, classNode.name).setInitializationState(JavaClass.InitializationState.INITIALIZED, null); // of course we initialized it
logger.debug("(Severe) Exception while initializing {}, should be fine", classNode.name, e);
}
for (MethodNode methodNode : new ArrayList<>(classNode.methods)) {
InstructionModifier modifier = new InstructionModifier();
// If we want the slow version, memoize the analysis
Supplier<Frame<SourceValue>[]> framesSupplier = Suppliers.memoize(() -> {
try {
return new Analyzer<>(new SourceInterpreter()).analyze(classNode.name, methodNode);
} catch (AnalyzerException e) {
oops("unexpected analyzer exception", e);
return null;
}
})::get;
for (AbstractInsnNode insnNode : TransformerHelper.instructionIterator(methodNode)) {
AbstractInsnNode invocation;
MethodNode decryptNode;
if (!getConfig().isSlowlyDetermineMagicNumbers()) {
InstructionMatcher matcher = DECRYPT_PATTERN.matcher(insnNode);
if (!matcher.find()) continue;
decryptNode = new MethodNode(ASM6, ACC_PUBLIC | ACC_STATIC, "Decryptor", "()Ljava/lang/String;", null, null);
InsnList decryptInsns = new InsnList();
for (AbstractInsnNode matched : matcher.getCapturedInstructions("all")) {
decryptInsns.add(matched.clone(null));
}
decryptInsns.add(new InsnNode(ARETURN));
decryptNode.instructions = decryptInsns;
invocation = matcher.getCapturedInstruction("invoke");
} else {
if (insnNode.getOpcode() != INVOKESTATIC) continue;
MethodInsnNode methodInsnNode = (MethodInsnNode) insnNode;
if (!methodInsnNode.desc.equals("(II)Ljava/lang/String;")) continue;
Frame<SourceValue>[] frames = framesSupplier.get();
if (frames == null) continue;
Frame<SourceValue> frame = frames[methodNode.instructions.indexOf(insnNode)];
if (frame == null) continue;
SourceValue cst1 = frame.getStack(frame.getStackSize() - 2);
SourceValue cst2 = frame.getStack(frame.getStackSize() - 1);
if (cst1.insns.size() != 1) continue;
if (cst2.insns.size() != 1) continue;
AbstractInsnNode insn1 = cst1.insns.iterator().next();
AbstractInsnNode insn2 = cst2.insns.iterator().next();
if (insn1.getOpcode() != SIPUSH) continue;
if (insn2.getOpcode() != SIPUSH) continue;
decryptNode = new MethodNode(ASM6, ACC_PUBLIC | ACC_STATIC, "Decryptor", "()Ljava/lang/String;", null, null);
InsnList decryptInsns = new InsnList();
decryptInsns.add(insn1.clone(null));
decryptInsns.add(insn2.clone(null));
decryptInsns.add(methodInsnNode.clone(null));
decryptInsns.add(new InsnNode(ARETURN));
decryptNode.instructions = decryptInsns;
invocation = methodInsnNode;
}
JavaWrapper result;
classNode.methods.add(decryptNode);
try {
result = vm.execute(classNode, decryptNode).getReturnValue();
} catch (VMException e) {
logger.debug("Exception while decrypting a string in {} {}{}", classNode.name, methodNode.name, methodNode.desc);
logger.debug(vm.exceptionToString(e));
continue;
} finally {
classNode.methods.remove(decryptNode);
}
if (result == null) {
logger.info("Warning: decrypted null string in {} {}{}", classNode.name, methodNode.name, methodNode.desc);
continue;
}
String decrypted = vm.convertJavaObjectToString(result);
logger.info("Decrypted string in {} {}{}: {}", classNode.name, methodNode.name, methodNode.desc, decrypted);
modifier.replace(invocation, new InsnNode(POP2), new LdcInsnNode(decrypted));
}
modifier.apply(methodNode);
}
}
vm.shutdown();
return false;
}
public static class Config extends TransformerConfig {
@JsonProperty("slowly-determine-magic-numbers")
private boolean slowlyDetermineMagicNumbers;
public Config() {
super(EnhancedStringEncryptionTransformer.class);
}
public boolean isSlowlyDetermineMagicNumbers() {
return slowlyDetermineMagicNumbers;
}
public void setSlowlyDetermineMagicNumbers(boolean slowlyDetermineMagicNumbers) {
this.slowlyDetermineMagicNumbers = slowlyDetermineMagicNumbers;
}
}
}
| {
"pile_set_name": "Github"
} |
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Before Submitting an Issue**
* If you are having issues loading a world, please attach it to the current version world thread (see pinned issues).
* If you get an unhandled exception or crash, please _**check your log before posting**_.
* _Copy paste using code [block tags](https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks) into the issue as a comment_
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. Windows 10]
- Version [Tedit 4 beta 9]
- Terraria Version [e.g. 1.4.0.4]
**Additional context**
Add any other context about the problem here.
| {
"pile_set_name": "Github"
} |
/* global
angular, lazyLoadResolver, BASE_PATH
*/
angular.module('starter').config(function ($stateProvider) {
$stateProvider
.state('facebook-list', {
url: BASE_PATH + '/social/mobile_facebook_list/index/value_id/:value_id',
controller: 'FacebookListController',
templateUrl: 'templates/html/l1/list.html',
resolve: lazyLoadResolver('facebook'),
cache: false
}).state('facebook-view', {
url: BASE_PATH + '/social/mobile_facebook_view/index/value_id/:value_id/post_id/:post_id',
controller: 'FacebookViewController',
templateUrl: 'templates/facebook/l1/view.html',
resolve: lazyLoadResolver('facebook'),
cache: false
});
});
| {
"pile_set_name": "Github"
} |
import { Menu, Message, SplitButton } from '@alifd/next';
import React, { useState } from 'react';
import styles from './index.module.scss';
const descriptor = {
'darwin-x64-prod': {
download: 'For MacOS',
env: 'macOS 10.9 及以上',
},
'win-x64-prod': {
download: 'For Windows X64',
env: '64位,Win 7 及以上',
},
};
export default function ReleaseIntro() {
const [osType, setOsType] = useState('darwin-x64-prod');
const [loading] = useState(false);
const [data] = useState({
'darwin-x64-prod': {
name: 'iceworks',
description: 'ICE Desktop Application.',
install:
'http://iceworks.oss-cn-hangzhou.aliyuncs.com/mac/Iceworks-1.6.2.dmg',
version: '1.6.2',
releaseDate: '2018-04-23',
},
'win-x64-prod': {
name: 'iceworks',
description: 'ICE Desktop Application.',
install:
'http://iceworks.oss-cn-hangzhou.aliyuncs.com/win/Iceworks-setup-1.6.2.exe',
version: '1.6.2',
releaseDate: '2018-04-23',
},
});
const changeSelectMenu = (select) => {
setOsType(select);
};
const download = () => {
if (loading) {
Message.success('请稍等');
} else {
// 开始下载
location.href = data[osType].install;
}
};
const menu = (
<Menu>
<Menu.Item
onClick={() => changeSelectMenu('darwin-x64-prod')}
key="darwin-x64-prod"
>
For MacOS 版本
</Menu.Item>
<Menu.Item
onClick={() => changeSelectMenu('win-x64-prod')}
key="win-x64-prod"
>
For Windows 版本(64位)
</Menu.Item>
</Menu>
);
const ver = loading ? '0' : data[osType].version;
const subTitle = ver[0] === '0' ? 'Beta' : '';
return (
<div className={styles.wrapperContainer}>
<div className={styles.bgImage2} />
<div className={styles.wrapper}>
<div className={styles.bgImage}>
<div className={styles.bgImageMask} />
</div>
<div className={styles.wrapperBody}>
<div className={styles.softwareIntro}>
<div className={styles.title}>
Iceworks <span className={styles.subtitle}>{subTitle}</span>
</div>
<div className={styles.slogan}>让前端工程变的轻松便捷</div>
<div className={styles.box}>
<SplitButton
menu={menu}
onClick={download}
size="large"
className="iceworks-download-btn">
立即下载
<span className={styles.boxspan1}>
{descriptor[osType].download}
</span>
</SplitButton>
</div>
{loading ? null : (
<div className={styles.softwareDetail}>
<div className={styles.version}>
<span className={styles.boxspan2}>
{data[osType].version}
</span>
<span className={styles.boxspan3}>
当前版本
</span>
</div>
<div className={styles.separator} />
<div className={styles.history}>
<span className={styles.soana}>
{data[osType].releaseDate}
</span>
<span className={styles.boxspan4}>
发布日期
</span>
</div>
</div>
)}
<div className={styles.box2}>
<div className={styles.box3}>
运行环境:{descriptor[osType].env}
</div>
</div>
<div className={styles.box2}>
<a className={styles.box2a} href="#get-started">
立即开始
</a>
</div>
</div>
<div className={styles.software} />
</div>
</div>
</div>
);
}
| {
"pile_set_name": "Github"
} |
{
"settings": {
"actions": [
{
"action": "iced-coffee-script",
"enabled": 1,
"version": "*-stable"
}
]
},
"2x-settings": {
"legacyCompilationEnabled": true
},
"sources": {
"test.coffee.md": true
},
"outputs": {
"test.js": [
"alert(42)",
".prototype.defer = function(",
"setTimeout(__iced_deferrals.defer("
]
}
}
| {
"pile_set_name": "Github"
} |
package io.spring2go.piggymetrics.statistics.controller;
import io.spring2go.piggymetrics.statistics.domain.Account;
import io.spring2go.piggymetrics.statistics.domain.timeseries.DataPoint;
import io.spring2go.piggymetrics.statistics.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
public class StatisticsController {
@Autowired
private StatisticsService statisticsService;
@RequestMapping(value = "/current", method = RequestMethod.GET)
public List<DataPoint> getCurrentAccountStatistics(@RequestHeader("X-S2G-USERNAME") String accountName) {
return statisticsService.findByAccountName(accountName);
}
@RequestMapping(value = "/{accountName}", method = RequestMethod.GET)
public List<DataPoint> getStatisticsByAccountName(@PathVariable String accountName) {
return statisticsService.findByAccountName(accountName);
}
@RequestMapping(value = "/{accountName}", method = RequestMethod.PUT)
public void saveAccountStatistics(@PathVariable String accountName, @Valid @RequestBody Account account) {
statisticsService.save(accountName, account);
}
}
| {
"pile_set_name": "Github"
} |
//! Computing stack layout.
use crate::ir::stackslot::{StackOffset, StackSize, StackSlotKind};
use crate::ir::{StackLayoutInfo, StackSlots};
use crate::result::{CodegenError, CodegenResult};
use core::cmp::{max, min};
/// Compute the stack frame layout.
///
/// Determine the total size of this stack frame and assign offsets to all `Spill` and `Explicit`
/// stack slots.
///
/// The total frame size will be a multiple of `alignment` which must be a power of two, unless the
/// function doesn't perform any call.
///
/// Returns the total stack frame size which is also saved in `frame.frame_size`.
///
/// If the stack frame is too big, returns an `ImplLimitExceeded` error.
pub fn layout_stack(
frame: &mut StackSlots,
is_leaf: bool,
alignment: StackSize,
) -> CodegenResult<StackSize> {
// Each object and the whole stack frame must fit in 2 GB such that any relative offset within
// the frame fits in a `StackOffset`.
let max_size = StackOffset::max_value() as StackSize;
debug_assert!(alignment.is_power_of_two() && alignment <= max_size);
// We assume a stack that grows toward lower addresses as implemented by modern ISAs. The
// stack layout from high to low addresses will be:
//
// 1. incoming arguments.
// 2. spills + explicits + struct returns.
// 3. outgoing arguments.
//
// The incoming arguments can have both positive and negative offsets. A negative offset
// incoming arguments is usually the x86 return address pushed by the call instruction, but
// it can also be fixed stack slots pushed by an externally generated prologue.
//
// Both incoming and outgoing argument slots have fixed offsets that are treated as
// reserved zones by the layout algorithm.
//
// If a function only has incoming arguments and does not perform any calls, then it doesn't
// require the stack to be aligned.
let mut incoming_min = 0;
let mut incoming_max = 0;
let mut outgoing_max = 0;
let mut min_align = alignment;
let mut must_align = !is_leaf;
for slot in frame.values() {
if slot.size > max_size {
return Err(CodegenError::ImplLimitExceeded);
}
match slot.kind {
StackSlotKind::IncomingArg => {
incoming_min = min(incoming_min, slot.offset.unwrap());
incoming_max = max(incoming_max, slot.offset.unwrap() + slot.size as i32);
}
StackSlotKind::OutgoingArg => {
let offset = slot
.offset
.unwrap()
.checked_add(slot.size as StackOffset)
.ok_or(CodegenError::ImplLimitExceeded)?;
outgoing_max = max(outgoing_max, offset);
must_align = true;
}
StackSlotKind::StructReturnSlot
| StackSlotKind::SpillSlot
| StackSlotKind::ExplicitSlot
| StackSlotKind::EmergencySlot => {
// Determine the smallest alignment of any explicit or spill slot.
min_align = slot.alignment(min_align);
must_align = true;
}
}
}
// Lay out spill slots, struct return slots, and explicit slots below the
// incoming arguments. The offset is negative, growing downwards. Start with
// the smallest alignments for better packing.
let mut offset = incoming_min;
debug_assert!(min_align.is_power_of_two());
while min_align <= alignment {
for slot in frame.values_mut() {
// Pick out explicit and spill slots with exact alignment `min_align`.
match slot.kind {
StackSlotKind::SpillSlot
| StackSlotKind::StructReturnSlot
| StackSlotKind::ExplicitSlot
| StackSlotKind::EmergencySlot => {
if slot.alignment(alignment) != min_align {
continue;
}
}
StackSlotKind::IncomingArg | StackSlotKind::OutgoingArg => continue,
}
offset = offset
.checked_sub(slot.size as StackOffset)
.ok_or(CodegenError::ImplLimitExceeded)?;
// Aligning the negative offset can never cause overflow. We're only clearing bits.
offset &= -(min_align as StackOffset);
slot.offset = Some(offset);
}
// Move on to the next higher alignment.
min_align *= 2;
}
// Finally, make room for the outgoing arguments.
offset = offset
.checked_sub(outgoing_max)
.ok_or(CodegenError::ImplLimitExceeded)?;
if must_align {
offset &= -(alignment as StackOffset);
}
// Set the computed layout information for the frame
let frame_size = (offset as StackSize).wrapping_neg();
let inbound_args_size = incoming_max as u32;
frame.layout_info = Some(StackLayoutInfo {
frame_size,
inbound_args_size,
});
Ok(frame_size)
}
#[cfg(test)]
mod tests {
use super::layout_stack;
use crate::ir::stackslot::StackOffset;
use crate::ir::types;
use crate::ir::{StackSlotData, StackSlotKind, StackSlots};
use crate::result::CodegenError;
#[test]
fn layout() {
let sss = &mut StackSlots::new();
// For all these test cases, assume it will call.
let is_leaf = false;
// An empty layout should have 0-sized stack frame.
assert_eq!(layout_stack(sss, is_leaf, 1), Ok(0));
assert_eq!(layout_stack(sss, is_leaf, 16), Ok(0));
// Same for incoming arguments with non-negative offsets.
let in0 = sss.make_incoming_arg(8, 0);
let in1 = sss.make_incoming_arg(8, 8);
assert_eq!(layout_stack(sss, is_leaf, 1), Ok(0));
assert_eq!(layout_stack(sss, is_leaf, 16), Ok(0));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
// Add some spill slots.
let ss0 = sss.make_spill_slot(types::I64);
let ss1 = sss.make_spill_slot(types::I32);
assert_eq!(layout_stack(sss, is_leaf, 1), Ok(12));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
assert_eq!(sss[ss0].offset, Some(-8));
assert_eq!(sss[ss1].offset, Some(-12));
assert_eq!(layout_stack(sss, is_leaf, 16), Ok(16));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
assert_eq!(sss[ss0].offset, Some(-16));
assert_eq!(sss[ss1].offset, Some(-4));
// An incoming argument with negative offset counts towards the total frame size, but it
// should still pack nicely with the spill slots.
let in2 = sss.make_incoming_arg(4, -4);
assert_eq!(layout_stack(sss, is_leaf, 1), Ok(16));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
assert_eq!(sss[in2].offset, Some(-4));
assert_eq!(sss[ss0].offset, Some(-12));
assert_eq!(sss[ss1].offset, Some(-16));
assert_eq!(layout_stack(sss, is_leaf, 16), Ok(16));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
assert_eq!(sss[in2].offset, Some(-4));
assert_eq!(sss[ss0].offset, Some(-16));
assert_eq!(sss[ss1].offset, Some(-8));
// Finally, make sure there is room for the outgoing args.
let out0 = sss.get_outgoing_arg(4, 0);
assert_eq!(layout_stack(sss, is_leaf, 1), Ok(20));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
assert_eq!(sss[in2].offset, Some(-4));
assert_eq!(sss[ss0].offset, Some(-12));
assert_eq!(sss[ss1].offset, Some(-16));
assert_eq!(sss[out0].offset, Some(0));
assert_eq!(layout_stack(sss, is_leaf, 16), Ok(32));
assert_eq!(sss[in0].offset, Some(0));
assert_eq!(sss[in1].offset, Some(8));
assert_eq!(sss[in2].offset, Some(-4));
assert_eq!(sss[ss0].offset, Some(-16));
assert_eq!(sss[ss1].offset, Some(-8));
assert_eq!(sss[out0].offset, Some(0));
// Also test that an unsupported offset is rejected.
sss.get_outgoing_arg(1, StackOffset::max_value() - 1);
assert_eq!(
layout_stack(sss, is_leaf, 1),
Err(CodegenError::ImplLimitExceeded)
);
}
#[test]
fn slot_kinds() {
let sss = &mut StackSlots::new();
// Add some slots of various kinds.
let ss0 = sss.make_spill_slot(types::I32);
let ss1 = sss.push(StackSlotData::new(
StackSlotKind::ExplicitSlot,
types::I32.bytes(),
));
let ss2 = sss.get_emergency_slot(types::I32, &[]);
assert_eq!(layout_stack(sss, true, 1), Ok(12));
assert_eq!(sss[ss0].offset, Some(-4));
assert_eq!(sss[ss1].offset, Some(-8));
assert_eq!(sss[ss2].offset, Some(-12));
}
}
| {
"pile_set_name": "Github"
} |
import React from 'react';
import * as CSS from 'csstype';
import cx from 'clsx';
import { createStyles, makeStyles } from '@material-ui/core/styles';
import { Theme } from '@material-ui/core';
import {
At,
Gap,
Provider,
useGapLookup,
BreakpointProvider,
useBreakpointLookup,
} from './core';
import Item, { ItemProps } from './Item';
import { getLowerMediaQuery } from './utils';
export type ColumnToRowProps = ItemProps & {
columnStyle?: CSS.Properties;
rowStyle?: CSS.Properties;
at?: At;
gap?: Gap;
rowReversed?: boolean;
children: React.ReactNode | React.ReactElement | React.ReactElement[];
};
const styles = (theme: Theme) => {
const { breakpoints } = theme;
return createStyles({
root: ({
at,
columnStyle,
rowStyle,
rowReversed,
}: Pick<
ColumnToRowProps,
'columnStyle' | 'rowStyle' | 'at' | 'gap' | 'rowReversed'
>) => ({
display: 'flex',
[getLowerMediaQuery(theme, at)]: {
...columnStyle,
flexDirection: 'column' as const,
},
[breakpoints.up(at)]: {
alignItems: 'center',
flexDirection: rowReversed ? 'row-reverse' : ('row' as const),
...rowStyle,
},
}),
});
};
const useStyles = makeStyles(styles, { name: 'FlexColumnToRow' });
const ColumnToRow = ({
className,
children,
gap,
at,
columnStyle,
rowStyle,
rowReversed,
...props
}: ColumnToRowProps) => {
const { calculatedAt } = useBreakpointLookup(at)
const { calculatedGap, itemProps } = useGapLookup(gap);
const styles = useStyles({
at: calculatedAt,
columnStyle,
rowStyle,
rowReversed,
gap: calculatedGap,
});
return (
<Item
className={cx('FlexColumnToRow', styles.root, className)}
{...itemProps}
{...props}
gapDisabled
>
<Provider flexDirection={'column-row'} gap={calculatedGap}>
<BreakpointProvider at={calculatedAt}>
{children}
</BreakpointProvider>
</Provider>
</Item>
);
};
export default ColumnToRow;
| {
"pile_set_name": "Github"
} |
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !gccgo,!purego
#include "go_asm.h"
#include "textflag.h"
// This is an implementation of the ChaCha20 encryption algorithm as
// specified in RFC 7539. It uses vector instructions to compute
// 4 keystream blocks in parallel (256 bytes) which are then XORed
// with the bytes in the input slice.
GLOBL ·constants<>(SB), RODATA|NOPTR, $32
// BSWAP: swap bytes in each 4-byte element
DATA ·constants<>+0x00(SB)/4, $0x03020100
DATA ·constants<>+0x04(SB)/4, $0x07060504
DATA ·constants<>+0x08(SB)/4, $0x0b0a0908
DATA ·constants<>+0x0c(SB)/4, $0x0f0e0d0c
// J0: [j0, j1, j2, j3]
DATA ·constants<>+0x10(SB)/4, $0x61707865
DATA ·constants<>+0x14(SB)/4, $0x3320646e
DATA ·constants<>+0x18(SB)/4, $0x79622d32
DATA ·constants<>+0x1c(SB)/4, $0x6b206574
#define BSWAP V5
#define J0 V6
#define KEY0 V7
#define KEY1 V8
#define NONCE V9
#define CTR V10
#define M0 V11
#define M1 V12
#define M2 V13
#define M3 V14
#define INC V15
#define X0 V16
#define X1 V17
#define X2 V18
#define X3 V19
#define X4 V20
#define X5 V21
#define X6 V22
#define X7 V23
#define X8 V24
#define X9 V25
#define X10 V26
#define X11 V27
#define X12 V28
#define X13 V29
#define X14 V30
#define X15 V31
#define NUM_ROUNDS 20
#define ROUND4(a0, a1, a2, a3, b0, b1, b2, b3, c0, c1, c2, c3, d0, d1, d2, d3) \
VAF a1, a0, a0 \
VAF b1, b0, b0 \
VAF c1, c0, c0 \
VAF d1, d0, d0 \
VX a0, a2, a2 \
VX b0, b2, b2 \
VX c0, c2, c2 \
VX d0, d2, d2 \
VERLLF $16, a2, a2 \
VERLLF $16, b2, b2 \
VERLLF $16, c2, c2 \
VERLLF $16, d2, d2 \
VAF a2, a3, a3 \
VAF b2, b3, b3 \
VAF c2, c3, c3 \
VAF d2, d3, d3 \
VX a3, a1, a1 \
VX b3, b1, b1 \
VX c3, c1, c1 \
VX d3, d1, d1 \
VERLLF $12, a1, a1 \
VERLLF $12, b1, b1 \
VERLLF $12, c1, c1 \
VERLLF $12, d1, d1 \
VAF a1, a0, a0 \
VAF b1, b0, b0 \
VAF c1, c0, c0 \
VAF d1, d0, d0 \
VX a0, a2, a2 \
VX b0, b2, b2 \
VX c0, c2, c2 \
VX d0, d2, d2 \
VERLLF $8, a2, a2 \
VERLLF $8, b2, b2 \
VERLLF $8, c2, c2 \
VERLLF $8, d2, d2 \
VAF a2, a3, a3 \
VAF b2, b3, b3 \
VAF c2, c3, c3 \
VAF d2, d3, d3 \
VX a3, a1, a1 \
VX b3, b1, b1 \
VX c3, c1, c1 \
VX d3, d1, d1 \
VERLLF $7, a1, a1 \
VERLLF $7, b1, b1 \
VERLLF $7, c1, c1 \
VERLLF $7, d1, d1
#define PERMUTE(mask, v0, v1, v2, v3) \
VPERM v0, v0, mask, v0 \
VPERM v1, v1, mask, v1 \
VPERM v2, v2, mask, v2 \
VPERM v3, v3, mask, v3
#define ADDV(x, v0, v1, v2, v3) \
VAF x, v0, v0 \
VAF x, v1, v1 \
VAF x, v2, v2 \
VAF x, v3, v3
#define XORV(off, dst, src, v0, v1, v2, v3) \
VLM off(src), M0, M3 \
PERMUTE(BSWAP, v0, v1, v2, v3) \
VX v0, M0, M0 \
VX v1, M1, M1 \
VX v2, M2, M2 \
VX v3, M3, M3 \
VSTM M0, M3, off(dst)
#define SHUFFLE(a, b, c, d, t, u, v, w) \
VMRHF a, c, t \ // t = {a[0], c[0], a[1], c[1]}
VMRHF b, d, u \ // u = {b[0], d[0], b[1], d[1]}
VMRLF a, c, v \ // v = {a[2], c[2], a[3], c[3]}
VMRLF b, d, w \ // w = {b[2], d[2], b[3], d[3]}
VMRHF t, u, a \ // a = {a[0], b[0], c[0], d[0]}
VMRLF t, u, b \ // b = {a[1], b[1], c[1], d[1]}
VMRHF v, w, c \ // c = {a[2], b[2], c[2], d[2]}
VMRLF v, w, d // d = {a[3], b[3], c[3], d[3]}
// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0
MOVD $·constants<>(SB), R1
MOVD dst+0(FP), R2 // R2=&dst[0]
LMG src+24(FP), R3, R4 // R3=&src[0] R4=len(src)
MOVD key+48(FP), R5 // R5=key
MOVD nonce+56(FP), R6 // R6=nonce
MOVD counter+64(FP), R7 // R7=counter
// load BSWAP and J0
VLM (R1), BSWAP, J0
// setup
MOVD $95, R0
VLM (R5), KEY0, KEY1
VLL R0, (R6), NONCE
VZERO M0
VLEIB $7, $32, M0
VSRLB M0, NONCE, NONCE
// initialize counter values
VLREPF (R7), CTR
VZERO INC
VLEIF $1, $1, INC
VLEIF $2, $2, INC
VLEIF $3, $3, INC
VAF INC, CTR, CTR
VREPIF $4, INC
chacha:
VREPF $0, J0, X0
VREPF $1, J0, X1
VREPF $2, J0, X2
VREPF $3, J0, X3
VREPF $0, KEY0, X4
VREPF $1, KEY0, X5
VREPF $2, KEY0, X6
VREPF $3, KEY0, X7
VREPF $0, KEY1, X8
VREPF $1, KEY1, X9
VREPF $2, KEY1, X10
VREPF $3, KEY1, X11
VLR CTR, X12
VREPF $1, NONCE, X13
VREPF $2, NONCE, X14
VREPF $3, NONCE, X15
MOVD $(NUM_ROUNDS/2), R1
loop:
ROUND4(X0, X4, X12, X8, X1, X5, X13, X9, X2, X6, X14, X10, X3, X7, X15, X11)
ROUND4(X0, X5, X15, X10, X1, X6, X12, X11, X2, X7, X13, X8, X3, X4, X14, X9)
ADD $-1, R1
BNE loop
// decrement length
ADD $-256, R4
// rearrange vectors
SHUFFLE(X0, X1, X2, X3, M0, M1, M2, M3)
ADDV(J0, X0, X1, X2, X3)
SHUFFLE(X4, X5, X6, X7, M0, M1, M2, M3)
ADDV(KEY0, X4, X5, X6, X7)
SHUFFLE(X8, X9, X10, X11, M0, M1, M2, M3)
ADDV(KEY1, X8, X9, X10, X11)
VAF CTR, X12, X12
SHUFFLE(X12, X13, X14, X15, M0, M1, M2, M3)
ADDV(NONCE, X12, X13, X14, X15)
// increment counters
VAF INC, CTR, CTR
// xor keystream with plaintext
XORV(0*64, R2, R3, X0, X4, X8, X12)
XORV(1*64, R2, R3, X1, X5, X9, X13)
XORV(2*64, R2, R3, X2, X6, X10, X14)
XORV(3*64, R2, R3, X3, X7, X11, X15)
// increment pointers
MOVD $256(R2), R2
MOVD $256(R3), R3
CMPBNE R4, $0, chacha
VSTEF $0, CTR, (R7)
RET
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.