text
stringlengths
2
99k
meta
dict
/* =========================================================================== Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. =========================================================================== */ #pragma hdrstop #include "../precompiled.h" idVec2 vec2_origin( 0.0f, 0.0f ); idVec3 vec3_origin( 0.0f, 0.0f, 0.0f ); idVec4 vec4_origin( 0.0f, 0.0f, 0.0f, 0.0f ); idVec5 vec5_origin( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ); idVec6 vec6_origin( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ); idVec6 vec6_infinity( idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY ); //=============================================================== // // idVec2 // //=============================================================== /* ============= idVec2::ToString ============= */ const char *idVec2::ToString( int precision ) const { return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); } /* ============= Lerp Linearly inperpolates one vector to another. ============= */ void idVec2::Lerp( const idVec2 &v1, const idVec2 &v2, const float l ) { if ( l <= 0.0f ) { (*this) = v1; } else if ( l >= 1.0f ) { (*this) = v2; } else { (*this) = v1 + l * ( v2 - v1 ); } } //=============================================================== // // idVec3 // //=============================================================== /* ============= idVec3::ToYaw ============= */ float idVec3::ToYaw() const { float yaw; if ( ( y == 0.0f ) && ( x == 0.0f ) ) { yaw = 0.0f; } else { yaw = RAD2DEG( atan2( y, x ) ); if ( yaw < 0.0f ) { yaw += 360.0f; } } return yaw; } /* ============= idVec3::ToPitch ============= */ float idVec3::ToPitch() const { float forward; float pitch; if ( ( x == 0.0f ) && ( y == 0.0f ) ) { if ( z > 0.0f ) { pitch = 90.0f; } else { pitch = 270.0f; } } else { forward = ( float )idMath::Sqrt( x * x + y * y ); pitch = RAD2DEG( atan2( z, forward ) ); if ( pitch < 0.0f ) { pitch += 360.0f; } } return pitch; } /* ============= idVec3::ToAngles ============= */ idAngles idVec3::ToAngles() const { float forward; float yaw; float pitch; if ( ( x == 0.0f ) && ( y == 0.0f ) ) { yaw = 0.0f; if ( z > 0.0f ) { pitch = 90.0f; } else { pitch = 270.0f; } } else { yaw = RAD2DEG( atan2( y, x ) ); if ( yaw < 0.0f ) { yaw += 360.0f; } forward = ( float )idMath::Sqrt( x * x + y * y ); pitch = RAD2DEG( atan2( z, forward ) ); if ( pitch < 0.0f ) { pitch += 360.0f; } } return idAngles( -pitch, yaw, 0.0f ); } /* ============= idVec3::ToPolar ============= */ idPolar3 idVec3::ToPolar() const { float forward; float yaw; float pitch; if ( ( x == 0.0f ) && ( y == 0.0f ) ) { yaw = 0.0f; if ( z > 0.0f ) { pitch = 90.0f; } else { pitch = 270.0f; } } else { yaw = RAD2DEG( atan2( y, x ) ); if ( yaw < 0.0f ) { yaw += 360.0f; } forward = ( float )idMath::Sqrt( x * x + y * y ); pitch = RAD2DEG( atan2( z, forward ) ); if ( pitch < 0.0f ) { pitch += 360.0f; } } return idPolar3( idMath::Sqrt( x * x + y * y + z * z ), yaw, -pitch ); } /* ============= idVec3::ToMat3 ============= */ idMat3 idVec3::ToMat3() const { idMat3 mat; float d; mat[0] = *this; d = x * x + y * y; if ( !d ) { mat[1][0] = 1.0f; mat[1][1] = 0.0f; mat[1][2] = 0.0f; } else { d = idMath::InvSqrt( d ); mat[1][0] = -y * d; mat[1][1] = x * d; mat[1][2] = 0.0f; } mat[2] = Cross( mat[1] ); return mat; } /* ============= idVec3::ToString ============= */ const char *idVec3::ToString( int precision ) const { return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); } /* ============= Lerp Linearly inperpolates one vector to another. ============= */ void idVec3::Lerp( const idVec3 &v1, const idVec3 &v2, const float l ) { if ( l <= 0.0f ) { (*this) = v1; } else if ( l >= 1.0f ) { (*this) = v2; } else { (*this) = v1 + l * ( v2 - v1 ); } } /* ============= SLerp Spherical linear interpolation from v1 to v2. Vectors are expected to be normalized. ============= */ #define LERP_DELTA 1e-6 void idVec3::SLerp( const idVec3 &v1, const idVec3 &v2, const float t ) { float omega, cosom, sinom, scale0, scale1; if ( t <= 0.0f ) { (*this) = v1; return; } else if ( t >= 1.0f ) { (*this) = v2; return; } cosom = v1 * v2; if ( ( 1.0f - cosom ) > LERP_DELTA ) { omega = acos( cosom ); sinom = sin( omega ); scale0 = sin( ( 1.0f - t ) * omega ) / sinom; scale1 = sin( t * omega ) / sinom; } else { scale0 = 1.0f - t; scale1 = t; } (*this) = ( v1 * scale0 + v2 * scale1 ); } /* ============= ProjectSelfOntoSphere Projects the z component onto a sphere. ============= */ void idVec3::ProjectSelfOntoSphere( const float radius ) { float rsqr = radius * radius; float len = Length(); if ( len < rsqr * 0.5f ) { z = sqrt( rsqr - len ); } else { z = rsqr / ( 2.0f * sqrt( len ) ); } } //=============================================================== // // idVec4 // //=============================================================== /* ============= idVec4::ToString ============= */ const char *idVec4::ToString( int precision ) const { return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); } /* ============= Lerp Linearly inperpolates one vector to another. ============= */ void idVec4::Lerp( const idVec4 &v1, const idVec4 &v2, const float l ) { if ( l <= 0.0f ) { (*this) = v1; } else if ( l >= 1.0f ) { (*this) = v2; } else { (*this) = v1 + l * ( v2 - v1 ); } } //=============================================================== // // idVec5 // //=============================================================== /* ============= idVec5::ToString ============= */ const char *idVec5::ToString( int precision ) const { return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); } /* ============= idVec5::Lerp ============= */ void idVec5::Lerp( const idVec5 &v1, const idVec5 &v2, const float l ) { if ( l <= 0.0f ) { (*this) = v1; } else if ( l >= 1.0f ) { (*this) = v2; } else { x = v1.x + l * ( v2.x - v1.x ); y = v1.y + l * ( v2.y - v1.y ); z = v1.z + l * ( v2.z - v1.z ); s = v1.s + l * ( v2.s - v1.s ); t = v1.t + l * ( v2.t - v1.t ); } } //=============================================================== // // idVec6 // //=============================================================== /* ============= idVec6::ToString ============= */ const char *idVec6::ToString( int precision ) const { return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); }
{ "pile_set_name": "Github" }
google-youtube ===================== See https://elements.polymer-project.org/elements/google-youtube
{ "pile_set_name": "Github" }
package com.stuffwithstuff.magpie.ast; import java.util.*; import com.stuffwithstuff.magpie.parser.Position; import com.stuffwithstuff.magpie.util.Pair; public class RecordExpr extends Expr { RecordExpr(Position position, List<Pair<String, Expr>> fields) { super(position); mFields = fields; } /** * Gets the fields for the record. We're using a list of entries instead of a * map because we need to ensure that fields are evaluated in the order that * they appear in the source. */ public List<Pair<String, Expr>> getFields() { return mFields; } @Override public <R, C> R accept(ExprVisitor<R, C> visitor, C context) { return visitor.visit(this, context); } @Override public void toString(StringBuilder builder, String indent) { int i = 0; for (Pair<String, Expr> Pair : mFields) { if (i++ > 0) builder.append(", "); builder.append(Pair.getKey()).append(": "); Pair.getValue().toString(builder, indent); } } private final List<Pair<String, Expr>> mFields; }
{ "pile_set_name": "Github" }
// Automatically generated by the Fast Binary Encoding compiler, do not modify! // https://github.com/chronoxor/FastBinaryEncoding // Source: test.fbe // Version: 1.4.0.0 package com.chronoxor.test.fbe; // Fast Binary Encoding optional WChar field model public final class FieldModelOptionalWChar extends com.chronoxor.fbe.FieldModel { public FieldModelOptionalWChar(com.chronoxor.fbe.Buffer buffer, long offset) { super(buffer, offset); value = new com.chronoxor.fbe.FieldModelWChar(buffer, 0); } // Get the field size @Override public long fbeSize() { return 1 + 4; } // Get the field extra size @Override public long fbeExtra() { if (!hasValue()) return 0; int fbeOptionalOffset = readInt32(fbeOffset() + 1); if ((fbeOptionalOffset == 0) || ((_buffer.getOffset() + fbeOptionalOffset + 4) > _buffer.getSize())) return 0; _buffer.shift(fbeOptionalOffset); long fbeResult = value.fbeSize() + value.fbeExtra(); _buffer.unshift(fbeOptionalOffset); return fbeResult; } // Checks if the object contains a value public boolean hasValue() { if ((_buffer.getOffset() + fbeOffset() + fbeSize()) > _buffer.getSize()) return false; byte fbeHasValue = readInt8(fbeOffset()); return (fbeHasValue != 0); } // Base field model value public final com.chronoxor.fbe.FieldModelWChar value; // Check if the optional value is valid @Override public boolean verify() { if ((_buffer.getOffset() + fbeOffset() + fbeSize()) > _buffer.getSize()) return true; byte fbeHasValue = readInt8(fbeOffset()); if (fbeHasValue == 0) return true; int fbeOptionalOffset = readInt32(fbeOffset() + 1); if (fbeOptionalOffset == 0) return false; _buffer.shift(fbeOptionalOffset); boolean fbeResult = value.verify(); _buffer.unshift(fbeOptionalOffset); return fbeResult; } // Get the optional value (being phase) public long getBegin() { if (!hasValue()) return 0; int fbeOptionalOffset = readInt32(fbeOffset() + 1); assert (fbeOptionalOffset > 0) : "Model is broken!"; if (fbeOptionalOffset <= 0) return 0; _buffer.shift(fbeOptionalOffset); return fbeOptionalOffset; } // Get the optional value (end phase) public void getEnd(long fbeBegin) { _buffer.unshift(fbeBegin); } // Get the optional value public Character get() { return get(null); } public Character get(Character defaults) { long fbeBegin = getBegin(); if (fbeBegin == 0) return defaults; Character optional = value.get(); getEnd(fbeBegin); return optional; } // Set the optional value (begin phase) public long setBegin(boolean hasValue) { assert ((_buffer.getOffset() + fbeOffset() + fbeSize()) <= _buffer.getSize()) : "Model is broken!"; if ((_buffer.getOffset() + fbeOffset() + fbeSize()) > _buffer.getSize()) return 0; byte fbeHasValue = (byte)(hasValue ? 1 : 0); write(fbeOffset(), fbeHasValue); if (fbeHasValue == 0) return 0; int fbeOptionalSize = (int)value.fbeSize(); int fbeOptionalOffset = (int)(_buffer.allocate(fbeOptionalSize) - _buffer.getOffset()); assert ((fbeOptionalOffset > 0) && ((_buffer.getOffset() + fbeOptionalOffset + fbeOptionalSize) <= _buffer.getSize())) : "Model is broken!"; if ((fbeOptionalOffset <= 0) || ((_buffer.getOffset() + fbeOptionalOffset + fbeOptionalSize) > _buffer.getSize())) return 0; write(fbeOffset() + 1, fbeOptionalOffset); _buffer.shift(fbeOptionalOffset); return fbeOptionalOffset; } // Set the optional value (end phase) public void setEnd(long fbeBegin) { _buffer.unshift(fbeBegin); } // Set the optional value public void set(Character optional) { long fbeBegin = setBegin(optional != null); if (fbeBegin == 0) return; value.set(optional); setEnd(fbeBegin); } }
{ "pile_set_name": "Github" }
package sockaddr import ( "fmt" "net" ) // IfAddr is a union of a SockAddr and a net.Interface. type IfAddr struct { SockAddr net.Interface } // Attr returns the named attribute as a string func (ifAddr IfAddr) Attr(attrName AttrName) (string, error) { val := IfAddrAttr(ifAddr, attrName) if val != "" { return val, nil } return Attr(ifAddr.SockAddr, attrName) } // Attr returns the named attribute as a string func Attr(sa SockAddr, attrName AttrName) (string, error) { switch sockType := sa.Type(); { case sockType&TypeIP != 0: ip := *ToIPAddr(sa) attrVal := IPAddrAttr(ip, attrName) if attrVal != "" { return attrVal, nil } if sockType == TypeIPv4 { ipv4 := *ToIPv4Addr(sa) attrVal := IPv4AddrAttr(ipv4, attrName) if attrVal != "" { return attrVal, nil } } else if sockType == TypeIPv6 { ipv6 := *ToIPv6Addr(sa) attrVal := IPv6AddrAttr(ipv6, attrName) if attrVal != "" { return attrVal, nil } } case sockType == TypeUnix: us := *ToUnixSock(sa) attrVal := UnixSockAttr(us, attrName) if attrVal != "" { return attrVal, nil } } // Non type-specific attributes switch attrName { case "string": return sa.String(), nil case "type": return sa.Type().String(), nil } return "", fmt.Errorf("unsupported attribute name %q", attrName) }
{ "pile_set_name": "Github" }
declare namespace cpFile { interface Options { /** Overwrite existing file. @default true */ readonly overwrite?: boolean; } interface ProgressData { /** Absolute path to source. */ src: string; /** Absolute path to destination. */ dest: string; /** File size in bytes. */ size: number; /** Copied size in bytes. */ written: number; /** Copied percentage, a value between `0` and `1`. */ percent: number; } interface ProgressEmitter { /** For empty files, the `progress` event is emitted only once. */ on(event: 'progress', handler: (data: ProgressData) => void): Promise<void>; } } declare const cpFile: { /** Copy a file. @param source - File you want to copy. @param destination - Where you want the file copied. @returns A `Promise` that resolves when the file is copied. @example ``` import cpFile = require('cp-file'); (async () => { await cpFile('source/unicorn.png', 'destination/unicorn.png'); console.log('File copied'); })(); ``` */ (source: string, destination: string, options?: cpFile.Options): Promise<void> & cpFile.ProgressEmitter; /** Copy a file synchronously. @param source - File you want to copy. @param destination - Where you want the file copied. */ sync(source: string, destination: string, options?: cpFile.Options): void; // TODO: Remove this for the next major release default: typeof cpFile; }; export = cpFile;
{ "pile_set_name": "Github" }
/* * ebt_log * * Authors: * Bart De Schuymer <bdschuym@pandora.be> * Harald Welte <laforge@netfilter.org> * * April, 2002 * */ #include <linux/module.h> #include <linux/ip.h> #include <linux/in.h> #include <linux/if_arp.h> #include <linux/spinlock.h> #include <net/netfilter/nf_log.h> #include <linux/ipv6.h> #include <net/ipv6.h> #include <linux/in6.h> #include <linux/netfilter/x_tables.h> #include <linux/netfilter_bridge/ebtables.h> #include <linux/netfilter_bridge/ebt_log.h> #include <linux/netfilter.h> static DEFINE_SPINLOCK(ebt_log_lock); static int ebt_log_tg_check(const struct xt_tgchk_param *par) { struct ebt_log_info *info = par->targinfo; if (info->bitmask & ~EBT_LOG_MASK) return -EINVAL; if (info->loglevel >= 8) return -EINVAL; info->prefix[EBT_LOG_PREFIX_SIZE - 1] = '\0'; return 0; } struct tcpudphdr { __be16 src; __be16 dst; }; struct arppayload { unsigned char mac_src[ETH_ALEN]; unsigned char ip_src[4]; unsigned char mac_dst[ETH_ALEN]; unsigned char ip_dst[4]; }; static void print_ports(const struct sk_buff *skb, uint8_t protocol, int offset) { if (protocol == IPPROTO_TCP || protocol == IPPROTO_UDP || protocol == IPPROTO_UDPLITE || protocol == IPPROTO_SCTP || protocol == IPPROTO_DCCP) { const struct tcpudphdr *pptr; struct tcpudphdr _ports; pptr = skb_header_pointer(skb, offset, sizeof(_ports), &_ports); if (pptr == NULL) { printk(" INCOMPLETE TCP/UDP header"); return; } printk(" SPT=%u DPT=%u", ntohs(pptr->src), ntohs(pptr->dst)); } } static void ebt_log_packet(struct net *net, u_int8_t pf, unsigned int hooknum, const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const struct nf_loginfo *loginfo, const char *prefix) { unsigned int bitmask; /* FIXME: Disabled from containers until syslog ns is supported */ if (!net_eq(net, &init_net)) return; spin_lock_bh(&ebt_log_lock); printk(KERN_SOH "%c%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x", '0' + loginfo->u.log.level, prefix, in ? in->name : "", out ? out->name : "", eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, ntohs(eth_hdr(skb)->h_proto)); if (loginfo->type == NF_LOG_TYPE_LOG) bitmask = loginfo->u.log.logflags; else bitmask = NF_LOG_MASK; if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto == htons(ETH_P_IP)){ const struct iphdr *ih; struct iphdr _iph; ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); if (ih == NULL) { printk(" INCOMPLETE IP header"); goto out; } printk(" IP SRC=%pI4 IP DST=%pI4, IP tos=0x%02X, IP proto=%d", &ih->saddr, &ih->daddr, ih->tos, ih->protocol); print_ports(skb, ih->protocol, ih->ihl*4); goto out; } #if IS_ENABLED(CONFIG_BRIDGE_EBT_IP6) if ((bitmask & EBT_LOG_IP6) && eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) { const struct ipv6hdr *ih; struct ipv6hdr _iph; uint8_t nexthdr; __be16 frag_off; int offset_ph; ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); if (ih == NULL) { printk(" INCOMPLETE IPv6 header"); goto out; } printk(" IPv6 SRC=%pI6 IPv6 DST=%pI6, IPv6 priority=0x%01X, Next Header=%d", &ih->saddr, &ih->daddr, ih->priority, ih->nexthdr); nexthdr = ih->nexthdr; offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr, &frag_off); if (offset_ph == -1) goto out; print_ports(skb, nexthdr, offset_ph); goto out; } #endif if ((bitmask & EBT_LOG_ARP) && ((eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) || (eth_hdr(skb)->h_proto == htons(ETH_P_RARP)))) { const struct arphdr *ah; struct arphdr _arph; ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); if (ah == NULL) { printk(" INCOMPLETE ARP header"); goto out; } printk(" ARP HTYPE=%d, PTYPE=0x%04x, OPCODE=%d", ntohs(ah->ar_hrd), ntohs(ah->ar_pro), ntohs(ah->ar_op)); /* If it's for Ethernet and the lengths are OK, * then log the ARP payload */ if (ah->ar_hrd == htons(1) && ah->ar_hln == ETH_ALEN && ah->ar_pln == sizeof(__be32)) { const struct arppayload *ap; struct arppayload _arpp; ap = skb_header_pointer(skb, sizeof(_arph), sizeof(_arpp), &_arpp); if (ap == NULL) { printk(" INCOMPLETE ARP payload"); goto out; } printk(" ARP MAC SRC=%pM ARP IP SRC=%pI4 ARP MAC DST=%pM ARP IP DST=%pI4", ap->mac_src, ap->ip_src, ap->mac_dst, ap->ip_dst); } } out: printk("\n"); spin_unlock_bh(&ebt_log_lock); } static unsigned int ebt_log_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct ebt_log_info *info = par->targinfo; struct nf_loginfo li; struct net *net = dev_net(par->in ? par->in : par->out); li.type = NF_LOG_TYPE_LOG; li.u.log.level = info->loglevel; li.u.log.logflags = info->bitmask; if (info->bitmask & EBT_LOG_NFLOG) nf_log_packet(net, NFPROTO_BRIDGE, par->hooknum, skb, par->in, par->out, &li, "%s", info->prefix); else ebt_log_packet(net, NFPROTO_BRIDGE, par->hooknum, skb, par->in, par->out, &li, info->prefix); return EBT_CONTINUE; } static struct xt_target ebt_log_tg_reg __read_mostly = { .name = "log", .revision = 0, .family = NFPROTO_BRIDGE, .target = ebt_log_tg, .checkentry = ebt_log_tg_check, .targetsize = sizeof(struct ebt_log_info), .me = THIS_MODULE, }; static struct nf_logger ebt_log_logger __read_mostly = { .name = "ebt_log", .logfn = &ebt_log_packet, .me = THIS_MODULE, }; static int __net_init ebt_log_net_init(struct net *net) { nf_log_set(net, NFPROTO_BRIDGE, &ebt_log_logger); return 0; } static void __net_exit ebt_log_net_fini(struct net *net) { nf_log_unset(net, &ebt_log_logger); } static struct pernet_operations ebt_log_net_ops = { .init = ebt_log_net_init, .exit = ebt_log_net_fini, }; static int __init ebt_log_init(void) { int ret; ret = register_pernet_subsys(&ebt_log_net_ops); if (ret < 0) goto err_pernet; ret = xt_register_target(&ebt_log_tg_reg); if (ret < 0) goto err_target; nf_log_register(NFPROTO_BRIDGE, &ebt_log_logger); return ret; err_target: unregister_pernet_subsys(&ebt_log_net_ops); err_pernet: return ret; } static void __exit ebt_log_fini(void) { unregister_pernet_subsys(&ebt_log_net_ops); nf_log_unregister(&ebt_log_logger); xt_unregister_target(&ebt_log_tg_reg); } module_init(ebt_log_init); module_exit(ebt_log_fini); MODULE_DESCRIPTION("Ebtables: Packet logging to syslog"); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
{ "name": "Zero", "description": "An eraser.", "url": "https://www.amazon.com/Value-Tombow-Mono-Erasers-refills/dp/B00JNVWEUQ/" }
{ "pile_set_name": "Github" }
/** * Copyright 2005-2020 Talend * * The contents of this file are subject to the terms of one of the following * open source licenses: Apache 2.0 or or EPL 1.0 (the "Licenses"). You can * select the license that you prefer but you may not use this file except in * compliance with one of these Licenses. * * You can obtain a copy of the Apache 2.0 license at * http://www.opensource.org/licenses/apache-2.0 * * You can obtain a copy of the EPL 1.0 license at * http://www.opensource.org/licenses/eclipse-1.0 * * See the Licenses for the specific language governing permissions and * limitations under the Licenses. * * Alternatively, you can obtain a royalty free commercial license with less * limitations, transferable or non-transferable, directly at * https://restlet.talend.com/ * * Restlet is a registered trademark of Talend S.A. */ package org.restlet.test.ext.jaxrs.services.resources; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.restlet.test.ext.jaxrs.services.tests.ThrowWebAppExcProviderTest; /** * @author Stephan Koops * @see ThrowWebAppExcProviderTest */ @Path("simple") public class SimpleResource { @GET @Produces("text/plain") public String get() { return "fxgsgdg"; } @POST @Produces("text/plain") public String post(String entity) { return entity; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> </Project>
{ "pile_set_name": "Github" }
"use strict"; module.exports = require("./shim");
{ "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 --> <title>MutateStatementHandler (scalardb API)</title> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="MutateStatementHandler (scalardb API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../com/scalar/db/storage/cassandra/InsertStatementHandler.html" title="class in com.scalar.db.storage.cassandra"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../com/scalar/db/storage/cassandra/ResultImpl.html" title="class in com.scalar.db.storage.cassandra"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/scalar/db/storage/cassandra/MutateStatementHandler.html" target="_top">Frames</a></li> <li><a href="MutateStatementHandler.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#fields.inherited.from.class.com.scalar.db.storage.cassandra.StatementHandler">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.scalar.db.storage.cassandra</div> <h2 title="Class MutateStatementHandler" class="title">Class MutateStatementHandler</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html" title="class in com.scalar.db.storage.cassandra">com.scalar.db.storage.cassandra.StatementHandler</a></li> <li> <ul class="inheritance"> <li>com.scalar.db.storage.cassandra.MutateStatementHandler</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Direct Known Subclasses:</dt> <dd><a href="../../../../../com/scalar/db/storage/cassandra/DeleteStatementHandler.html" title="class in com.scalar.db.storage.cassandra">DeleteStatementHandler</a>, <a href="../../../../../com/scalar/db/storage/cassandra/InsertStatementHandler.html" title="class in com.scalar.db.storage.cassandra">InsertStatementHandler</a>, <a href="../../../../../com/scalar/db/storage/cassandra/UpdateStatementHandler.html" title="class in com.scalar.db.storage.cassandra">UpdateStatementHandler</a></dd> </dl> <hr> <br> <pre>@ThreadSafe public abstract class <span class="typeNameLabel">MutateStatementHandler</span> extends <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html" title="class in com.scalar.db.storage.cassandra">StatementHandler</a></pre> <div class="block">An abstraction for handler classes for mutate statements</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <ul class="blockList"> <li class="blockList"><a name="fields.inherited.from.class.com.scalar.db.storage.cassandra.StatementHandler"> <!-- --> </a> <h3>Fields inherited from class&nbsp;com.scalar.db.storage.cassandra.<a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html" title="class in com.scalar.db.storage.cassandra">StatementHandler</a></h3> <code><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#cache">cache</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#session">session</a></code></li> </ul> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/scalar/db/storage/cassandra/MutateStatementHandler.html#MutateStatementHandler-com.datastax.driver.core.Session-">MutateStatementHandler</a></span>(com.datastax.driver.core.Session&nbsp;session)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/scalar/db/storage/cassandra/MutateStatementHandler.html#bindCondition-com.scalar.db.storage.cassandra.ValueBinder-com.scalar.db.api.Mutation-">bindCondition</a></span>(<a href="../../../../../com/scalar/db/storage/cassandra/ValueBinder.html" title="class in com.scalar.db.storage.cassandra">ValueBinder</a>&nbsp;binder, <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api">Mutation</a>&nbsp;mutation)</code>&nbsp;</td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>com.datastax.driver.core.ResultSet</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/scalar/db/storage/cassandra/MutateStatementHandler.html#handle-com.scalar.db.api.Operation-">handle</a></span>(<a href="../../../../../com/scalar/db/api/Operation.html" title="class in com.scalar.db.api">Operation</a>&nbsp;operation)</code> <div class="block">Executes the specified <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api"><code>Mutation</code></a> <a href="../../../../../com/scalar/db/api/Operation.html" title="class in com.scalar.db.api"><code>Operation</code></a></div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/scalar/db/storage/cassandra/MutateStatementHandler.html#overwriteConsistency-com.datastax.driver.core.BoundStatement-com.scalar.db.api.Operation-">overwriteConsistency</a></span>(com.datastax.driver.core.BoundStatement&nbsp;bound, <a href="../../../../../com/scalar/db/api/Operation.html" title="class in com.scalar.db.api">Operation</a>&nbsp;operation)</code>&nbsp;</td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/scalar/db/storage/cassandra/MutateStatementHandler.html#setCondition-com.datastax.driver.core.querybuilder.BuiltStatement-com.scalar.db.api.Mutation-">setCondition</a></span>(com.datastax.driver.core.querybuilder.BuiltStatement&nbsp;statement, <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api">Mutation</a>&nbsp;mutation)</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.com.scalar.db.storage.cassandra.StatementHandler"> <!-- --> </a> <h3>Methods inherited from class&nbsp;com.scalar.db.storage.cassandra.<a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html" title="class in com.scalar.db.storage.cassandra">StatementHandler</a></h3> <code><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#bind-com.datastax.driver.core.PreparedStatement-com.scalar.db.api.Operation-">bind</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#checkArgument-com.scalar.db.api.Operation-java.lang.Class...-">checkArgument</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#convert-com.scalar.db.api.Operation-com.scalar.db.api.Consistency-">convert</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#execute-com.datastax.driver.core.BoundStatement-com.scalar.db.api.Operation-">execute</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#handleInternal-com.scalar.db.api.Operation-">handleInternal</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#prepare-com.scalar.db.api.Operation-">prepare</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#prepare-java.lang.String-">prepare</a>, <a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#setConsistency-com.datastax.driver.core.BoundStatement-com.scalar.db.api.Operation-">setConsistency</a></code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="MutateStatementHandler-com.datastax.driver.core.Session-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>MutateStatementHandler</h4> <pre>public&nbsp;MutateStatementHandler(com.datastax.driver.core.Session&nbsp;session)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="handle-com.scalar.db.api.Operation-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>handle</h4> <pre>@Nonnull public&nbsp;com.datastax.driver.core.ResultSet&nbsp;handle(<a href="../../../../../com/scalar/db/api/Operation.html" title="class in com.scalar.db.api">Operation</a>&nbsp;operation) throws <a href="../../../../../com/scalar/db/exception/storage/ExecutionException.html" title="class in com.scalar.db.exception.storage">ExecutionException</a></pre> <div class="block">Executes the specified <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api"><code>Mutation</code></a> <a href="../../../../../com/scalar/db/api/Operation.html" title="class in com.scalar.db.api"><code>Operation</code></a></div> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#handle-com.scalar.db.api.Operation-">handle</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html" title="class in com.scalar.db.storage.cassandra">StatementHandler</a></code></dd> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>operation</code> - <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api"><code>Mutation</code></a> operation</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a <code>ResultSet</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../../../../../com/scalar/db/exception/storage/RetriableExecutionException.html" title="class in com.scalar.db.exception.storage">RetriableExecutionException</a></code> - if the execution failed, but it can be retriable</dd> <dd><code><a href="../../../../../com/scalar/db/exception/storage/ReadRepairableExecutionException.html" title="class in com.scalar.db.exception.storage">ReadRepairableExecutionException</a></code> - if the execution partially failed, which can be repaired by a following read</dd> <dd><code><a href="../../../../../com/scalar/db/exception/storage/ExecutionException.html" title="class in com.scalar.db.exception.storage">ExecutionException</a></code> - if the execution failed</dd> </dl> </li> </ul> <a name="overwriteConsistency-com.datastax.driver.core.BoundStatement-com.scalar.db.api.Operation-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>overwriteConsistency</h4> <pre>protected&nbsp;void&nbsp;overwriteConsistency(com.datastax.driver.core.BoundStatement&nbsp;bound, <a href="../../../../../com/scalar/db/api/Operation.html" title="class in com.scalar.db.api">Operation</a>&nbsp;operation)</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html#overwriteConsistency-com.datastax.driver.core.BoundStatement-com.scalar.db.api.Operation-">overwriteConsistency</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../com/scalar/db/storage/cassandra/StatementHandler.html" title="class in com.scalar.db.storage.cassandra">StatementHandler</a></code></dd> </dl> </li> </ul> <a name="setCondition-com.datastax.driver.core.querybuilder.BuiltStatement-com.scalar.db.api.Mutation-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setCondition</h4> <pre>protected&nbsp;void&nbsp;setCondition(com.datastax.driver.core.querybuilder.BuiltStatement&nbsp;statement, <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api">Mutation</a>&nbsp;mutation)</pre> </li> </ul> <a name="bindCondition-com.scalar.db.storage.cassandra.ValueBinder-com.scalar.db.api.Mutation-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>bindCondition</h4> <pre>protected&nbsp;void&nbsp;bindCondition(<a href="../../../../../com/scalar/db/storage/cassandra/ValueBinder.html" title="class in com.scalar.db.storage.cassandra">ValueBinder</a>&nbsp;binder, <a href="../../../../../com/scalar/db/api/Mutation.html" title="class in com.scalar.db.api">Mutation</a>&nbsp;mutation)</pre> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../com/scalar/db/storage/cassandra/InsertStatementHandler.html" title="class in com.scalar.db.storage.cassandra"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../com/scalar/db/storage/cassandra/ResultImpl.html" title="class in com.scalar.db.storage.cassandra"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/scalar/db/storage/cassandra/MutateStatementHandler.html" target="_top">Frames</a></li> <li><a href="MutateStatementHandler.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#fields.inherited.from.class.com.scalar.db.storage.cassandra.StatementHandler">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) 19yy <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
{ "pile_set_name": "Github" }
# Generating PowerShell Completions For Your Own cobra.Command Cobra can generate PowerShell completion scripts. Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles. # What's supported - Completion for subcommands using their `.Short` description - Completion for non-hidden flags using their `.Name` and `.Shorthand` # What's not yet supported - Command aliases - Required, filename or custom flags (they will work like normal flags) - Custom completion scripts
{ "pile_set_name": "Github" }
-----BEGIN PRIVATE KEY----- MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDcg5h5TVO1gECK yNCXbpJduNqJvhE6hyVb9q0WRR8zKHE7DnOog9JqOcrz4mv3TmszDZ2511mGxo/v j2dAYakU7HxEuSqKX1CsjbDP3xa7IvVCaKQbcMImq7dzmenXkCdPivuglZmooZen c18QZ6YkrunDeh/OcP8WAA+9yYXp82lmKPzKNkJETfGVXff0loXWR5SSjGXYvjqm XK6IXqPcuNriUTmylLx2149O6RWJPaZ2YYxTOHTeV5OMeEHjLpAOShCfZi4VYvAe GZSFq5UdMv5QD1k6BueS1Ruf6ChCLjfqkMcCAw8DOY8oxvzovgM/sgBcx3L00/pe QeSegG+3AgMBAAECggEAW9qJEcYvH0SMHgNmOB375ARTK9s7S/jti/Aly0gBpgqr l+D+NmyqokruikZ/mKVWrA546+eTSDu/yxcd+Eh16NxVKz9CRB9N+IKQ6xXPXyZB D/jXYW7pcafOGT0PTbHxUMrUxahhAjKKfPt3Y7JVcQKBgQDzIhmN7SbQvu2dl54X XezrgKteDVd4q7VYVpiAjNEZA+kNdBcXC6k2T5WMNPesNwyFIoDLDFWUg4FMG/Mc KA1eArBocGQ0gQvLlnlUxBy519e/AAj7jTspLi7gAwLqfTo0TGdTH/Hfq+1uCXys dd3BKYnDKc4aDPTQCEkRzfPHDwKBgQDoLw7MZecGnNNrqArqsOaOO1uUKFysW6pi 2ZU7KKj1x6vKGIW88YmzNBPCj4LU8XlXbR1isaSs5TaWgc6N0aAEXwA6TN/8PXhq 6IXarR1WJIq2DEDtdBrj2AiaPoF8Y6hsebsQs+EpyLx8MCGLaucYJvqyK87ep000 mXQuyfgM2QKBgHCLy2qAaeRdTV8S7TKB3wcQ88LAyEnqqjJvO37eMHi076+zmnCn jDfA1UgmyLNmdBw44YeceQ0bZsHVek8BV1a6RfDCfhAz4ELor9eGRInemVcn7ACN 2uHwJ/C4VCQ5vbSx3W6ELhHM40Z5i8XFddZRpRy7gFVcxAJ8o15jiMIPAoGAHiq3 DoGS8b4AjjVILdQMMKCvtmFEITTLv4orpIMU6NInlNt4zOLJFFqI0reYtRgmvuAz eDZCgiBJ5mY5Mx3wX4EEY47Hb1uBQMqzUYU6kY2v5BVVfkSelcnk3D2Qz1uXb3il gHcOo0IskyohwZ6DJhUyb2HXwAAWvOXPPaEKNIkCgYAqWhzYCAoxZ6f7i2I3J1JO 5OaMi4+9YR3ivTDcKVYp1ZOzANe0gsQlal/gf2fTjG35b9FyK3Lo5rp0QLKxv2vh 6dR+sk+58jJhk8H1kPNIVzvA4SAd51YoE0x7edi7+5vDMwlz57yz5rwMQvN1wUOO 5Ev9F9qrVJZFF4Ei+fRW9Q== -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIIDzzCCAregAwIBAgIJAOa6xwibkwczMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApXYXNoaW5ndG9uMRAwDgYDVQQHDAdTZWF0dGxlMQ8w DQYDVQQKDAZIYXJha2ExFTATBgNVBAMMDGhhcmFrYS5sb2NhbDEgMB4GCSqGSIb3 DQEJARYRbWF0dEBoYXJha2EubG9jYWwwHhcNMTcwMzA0MjMyODQ5WhcNMjMwMzAz MjMyODQ5WjB+MQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjEQMA4G A1UEBwwHU2VhdHRsZTEPMA0GA1UECgwGSGFyYWthMRUwEwYDVQQDDAxoYXJha2Eu bG9jYWwxIDAeBgkqhkiG9w0BCQEWEW1hdHRAaGFyYWthLmxvY2FsMIIBIjANBgkq FgAPvcmF6fNpZij8yjZCRE3xlV339JaF1keUkoxl2L46plyuiF6j3Lja4lE5spS8 dtePTukViT2mdmGMUzh03leTjHhB4y6QDkoQn2YuFWLwHhmUhauVHTL+UA9ZOgbn ktUbn+goQi436pDHAgMPAzmPKMb86L4DP7IAXMdy9NP6XkHknoBvtwIDAQABo1Aw TjAdBgNVHQ4EFgQUsfam5K8yKVyyJG7NQfKXjpr6gYEwHwYDVR0jBBgwFoAUsfam 5K8yKVyyJG7NQfKXjpr6gYEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC AQEAL7vMH/sYj/rDzo+pYn8qK9eZBpTPQLsuiotNYqoH/tOJzaOBI2cMSrbGM3zG aegTqKOduO6vpXun7MT4tGilOxt+1eve6RbsjKMeTkZr+A44rRRUZ4LHZe38oaGk A8jB6YHiiefH1mgfSN1igcT7SkOxv8WM4jsCyOCy3wG8b4V8wvDytOtJOJo041hX njmypWHaZ1IDYu1ybnb/Macnno0NMkEMx0uIlG/c3+KvJwpz2WHrKrKA5l5oGp/n +F3pt6NhSJCDG0cktax07LIvxMpAoOaJ6cYSfwB/v0HiYh2733bEXEiQ2jxO5vXo NS2fKRYBqs2ATDVHpzknBC1KcA== -----END CERTIFICATE-----
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico"> <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0"> <title>FixedColumns example - Basic initialisation</title> <link rel="stylesheet" type="text/css" href="../../../../media/css/jquery.dataTables.css"> <link rel="stylesheet" type="text/css" href="../../css/fixedColumns.dataTables.css"> <link rel="stylesheet" type="text/css" href="../../../../examples/resources/syntax/shCore.css"> <link rel="stylesheet" type="text/css" href="../../../../examples/resources/demo.css"> <style type="text/css" class="init"> /* Ensure that the demo table scrolls */ th, td { white-space: nowrap; } div.dataTables_wrapper { width: 800px; margin: 0 auto; } </style> <script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.3.min.js"> </script> <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.dataTables.js"> </script> <script type="text/javascript" language="javascript" src="../../js/dataTables.fixedColumns.js"> </script> <script type="text/javascript" language="javascript" src="../../../../examples/resources/syntax/shCore.js"> </script> <script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"> </script> <script type="text/javascript" language="javascript" class="init"> $(document).ready(function() { $('#example').DataTable( { scrollY: 300, scrollX: true, scrollCollapse: true, paging: false, fixedColumns: true } ); } ); </script> </head> <body class="dt-example"> <div class="container"> <section> <h1>FixedColumns example <span>Basic initialisation</span></h1> <div class="info"> <p>When displaying a table which scrolls along the x-axis, it can sometimes be useful to the end user for the left most column to be fixed in place, if it shows grouping, index or similar information. This is basically the same idea as 'freeze columns' in Excel. This can be achieved with the FixedColumns plug-in for DataTables, as shown below.</p> <p>Note that FixedColumns is suitable only for use with the scrolling features in <a href="http://datatables.net">DataTables</a>. If you want to achieve a similar effect without scrolling enabled, please checkout <a href="http://datatables.net/extensions/fixedheader">FixedHeader</a>, also for DataTables.</p> <p>FixedColumns is initialised using the <a href="//datatables.net/reference/option/fixedColumns"><code class="option" title= "FixedColumns initialisation option">fixedColumns</code></a> option as part of the DataTables construction as shown below. This example also has vertical scrolling enabled (<a href="//datatables.net/reference/option/scrollY"><code class="option" title="DataTables initialisation option">scrollY</code></a>) and paging disabled (<a href="//datatables.net/reference/option/paging"><code class="option" title="DataTables initialisation option">paging</code></a>).</p> </div> <table id="example" class="stripe row-border order-column" cellspacing="0" width="100%"> <thead> <tr> <th>First name</th> <th>Last name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> <th>Extn.</th> <th>E-mail</th> </tr> </thead> <tbody> <tr> <td>Tiger</td> <td>Nixon</td> <td>System Architect</td> <td>Edinburgh</td> <td>61</td> <td>2011/04/25</td> <td>$320,800</td> <td>5421</td> <td>t.nixon@datatables.net</td> </tr> <tr> <td>Garrett</td> <td>Winters</td> <td>Accountant</td> <td>Tokyo</td> <td>63</td> <td>2011/07/25</td> <td>$170,750</td> <td>8422</td> <td>g.winters@datatables.net</td> </tr> <tr> <td>Ashton</td> <td>Cox</td> <td>Junior Technical Author</td> <td>San Francisco</td> <td>66</td> <td>2009/01/12</td> <td>$86,000</td> <td>1562</td> <td>a.cox@datatables.net</td> </tr> <tr> <td>Cedric</td> <td>Kelly</td> <td>Senior Javascript Developer</td> <td>Edinburgh</td> <td>22</td> <td>2012/03/29</td> <td>$433,060</td> <td>6224</td> <td>c.kelly@datatables.net</td> </tr> <tr> <td>Airi</td> <td>Satou</td> <td>Accountant</td> <td>Tokyo</td> <td>33</td> <td>2008/11/28</td> <td>$162,700</td> <td>5407</td> <td>a.satou@datatables.net</td> </tr> <tr> <td>Brielle</td> <td>Williamson</td> <td>Integration Specialist</td> <td>New York</td> <td>61</td> <td>2012/12/02</td> <td>$372,000</td> <td>4804</td> <td>b.williamson@datatables.net</td> </tr> <tr> <td>Herrod</td> <td>Chandler</td> <td>Sales Assistant</td> <td>San Francisco</td> <td>59</td> <td>2012/08/06</td> <td>$137,500</td> <td>9608</td> <td>h.chandler@datatables.net</td> </tr> <tr> <td>Rhona</td> <td>Davidson</td> <td>Integration Specialist</td> <td>Tokyo</td> <td>55</td> <td>2010/10/14</td> <td>$327,900</td> <td>6200</td> <td>r.davidson@datatables.net</td> </tr> <tr> <td>Colleen</td> <td>Hurst</td> <td>Javascript Developer</td> <td>San Francisco</td> <td>39</td> <td>2009/09/15</td> <td>$205,500</td> <td>2360</td> <td>c.hurst@datatables.net</td> </tr> <tr> <td>Sonya</td> <td>Frost</td> <td>Software Engineer</td> <td>Edinburgh</td> <td>23</td> <td>2008/12/13</td> <td>$103,600</td> <td>1667</td> <td>s.frost@datatables.net</td> </tr> <tr> <td>Jena</td> <td>Gaines</td> <td>Office Manager</td> <td>London</td> <td>30</td> <td>2008/12/19</td> <td>$90,560</td> <td>3814</td> <td>j.gaines@datatables.net</td> </tr> <tr> <td>Quinn</td> <td>Flynn</td> <td>Support Lead</td> <td>Edinburgh</td> <td>22</td> <td>2013/03/03</td> <td>$342,000</td> <td>9497</td> <td>q.flynn@datatables.net</td> </tr> <tr> <td>Charde</td> <td>Marshall</td> <td>Regional Director</td> <td>San Francisco</td> <td>36</td> <td>2008/10/16</td> <td>$470,600</td> <td>6741</td> <td>c.marshall@datatables.net</td> </tr> <tr> <td>Haley</td> <td>Kennedy</td> <td>Senior Marketing Designer</td> <td>London</td> <td>43</td> <td>2012/12/18</td> <td>$313,500</td> <td>3597</td> <td>h.kennedy@datatables.net</td> </tr> <tr> <td>Tatyana</td> <td>Fitzpatrick</td> <td>Regional Director</td> <td>London</td> <td>19</td> <td>2010/03/17</td> <td>$385,750</td> <td>1965</td> <td>t.fitzpatrick@datatables.net</td> </tr> <tr> <td>Michael</td> <td>Silva</td> <td>Marketing Designer</td> <td>London</td> <td>66</td> <td>2012/11/27</td> <td>$198,500</td> <td>1581</td> <td>m.silva@datatables.net</td> </tr> <tr> <td>Paul</td> <td>Byrd</td> <td>Chief Financial Officer (CFO)</td> <td>New York</td> <td>64</td> <td>2010/06/09</td> <td>$725,000</td> <td>3059</td> <td>p.byrd@datatables.net</td> </tr> <tr> <td>Gloria</td> <td>Little</td> <td>Systems Administrator</td> <td>New York</td> <td>59</td> <td>2009/04/10</td> <td>$237,500</td> <td>1721</td> <td>g.little@datatables.net</td> </tr> <tr> <td>Bradley</td> <td>Greer</td> <td>Software Engineer</td> <td>London</td> <td>41</td> <td>2012/10/13</td> <td>$132,000</td> <td>2558</td> <td>b.greer@datatables.net</td> </tr> <tr> <td>Dai</td> <td>Rios</td> <td>Personnel Lead</td> <td>Edinburgh</td> <td>35</td> <td>2012/09/26</td> <td>$217,500</td> <td>2290</td> <td>d.rios@datatables.net</td> </tr> <tr> <td>Jenette</td> <td>Caldwell</td> <td>Development Lead</td> <td>New York</td> <td>30</td> <td>2011/09/03</td> <td>$345,000</td> <td>1937</td> <td>j.caldwell@datatables.net</td> </tr> <tr> <td>Yuri</td> <td>Berry</td> <td>Chief Marketing Officer (CMO)</td> <td>New York</td> <td>40</td> <td>2009/06/25</td> <td>$675,000</td> <td>6154</td> <td>y.berry@datatables.net</td> </tr> <tr> <td>Caesar</td> <td>Vance</td> <td>Pre-Sales Support</td> <td>New York</td> <td>21</td> <td>2011/12/12</td> <td>$106,450</td> <td>8330</td> <td>c.vance@datatables.net</td> </tr> <tr> <td>Doris</td> <td>Wilder</td> <td>Sales Assistant</td> <td>Sidney</td> <td>23</td> <td>2010/09/20</td> <td>$85,600</td> <td>3023</td> <td>d.wilder@datatables.net</td> </tr> <tr> <td>Angelica</td> <td>Ramos</td> <td>Chief Executive Officer (CEO)</td> <td>London</td> <td>47</td> <td>2009/10/09</td> <td>$1,200,000</td> <td>5797</td> <td>a.ramos@datatables.net</td> </tr> <tr> <td>Gavin</td> <td>Joyce</td> <td>Developer</td> <td>Edinburgh</td> <td>42</td> <td>2010/12/22</td> <td>$92,575</td> <td>8822</td> <td>g.joyce@datatables.net</td> </tr> <tr> <td>Jennifer</td> <td>Chang</td> <td>Regional Director</td> <td>Singapore</td> <td>28</td> <td>2010/11/14</td> <td>$357,650</td> <td>9239</td> <td>j.chang@datatables.net</td> </tr> <tr> <td>Brenden</td> <td>Wagner</td> <td>Software Engineer</td> <td>San Francisco</td> <td>28</td> <td>2011/06/07</td> <td>$206,850</td> <td>1314</td> <td>b.wagner@datatables.net</td> </tr> <tr> <td>Fiona</td> <td>Green</td> <td>Chief Operating Officer (COO)</td> <td>San Francisco</td> <td>48</td> <td>2010/03/11</td> <td>$850,000</td> <td>2947</td> <td>f.green@datatables.net</td> </tr> <tr> <td>Shou</td> <td>Itou</td> <td>Regional Marketing</td> <td>Tokyo</td> <td>20</td> <td>2011/08/14</td> <td>$163,000</td> <td>8899</td> <td>s.itou@datatables.net</td> </tr> <tr> <td>Michelle</td> <td>House</td> <td>Integration Specialist</td> <td>Sidney</td> <td>37</td> <td>2011/06/02</td> <td>$95,400</td> <td>2769</td> <td>m.house@datatables.net</td> </tr> <tr> <td>Suki</td> <td>Burks</td> <td>Developer</td> <td>London</td> <td>53</td> <td>2009/10/22</td> <td>$114,500</td> <td>6832</td> <td>s.burks@datatables.net</td> </tr> <tr> <td>Prescott</td> <td>Bartlett</td> <td>Technical Author</td> <td>London</td> <td>27</td> <td>2011/05/07</td> <td>$145,000</td> <td>3606</td> <td>p.bartlett@datatables.net</td> </tr> <tr> <td>Gavin</td> <td>Cortez</td> <td>Team Leader</td> <td>San Francisco</td> <td>22</td> <td>2008/10/26</td> <td>$235,500</td> <td>2860</td> <td>g.cortez@datatables.net</td> </tr> <tr> <td>Martena</td> <td>Mccray</td> <td>Post-Sales support</td> <td>Edinburgh</td> <td>46</td> <td>2011/03/09</td> <td>$324,050</td> <td>8240</td> <td>m.mccray@datatables.net</td> </tr> <tr> <td>Unity</td> <td>Butler</td> <td>Marketing Designer</td> <td>San Francisco</td> <td>47</td> <td>2009/12/09</td> <td>$85,675</td> <td>5384</td> <td>u.butler@datatables.net</td> </tr> <tr> <td>Howard</td> <td>Hatfield</td> <td>Office Manager</td> <td>San Francisco</td> <td>51</td> <td>2008/12/16</td> <td>$164,500</td> <td>7031</td> <td>h.hatfield@datatables.net</td> </tr> <tr> <td>Hope</td> <td>Fuentes</td> <td>Secretary</td> <td>San Francisco</td> <td>41</td> <td>2010/02/12</td> <td>$109,850</td> <td>6318</td> <td>h.fuentes@datatables.net</td> </tr> <tr> <td>Vivian</td> <td>Harrell</td> <td>Financial Controller</td> <td>San Francisco</td> <td>62</td> <td>2009/02/14</td> <td>$452,500</td> <td>9422</td> <td>v.harrell@datatables.net</td> </tr> <tr> <td>Timothy</td> <td>Mooney</td> <td>Office Manager</td> <td>London</td> <td>37</td> <td>2008/12/11</td> <td>$136,200</td> <td>7580</td> <td>t.mooney@datatables.net</td> </tr> <tr> <td>Jackson</td> <td>Bradshaw</td> <td>Director</td> <td>New York</td> <td>65</td> <td>2008/09/26</td> <td>$645,750</td> <td>1042</td> <td>j.bradshaw@datatables.net</td> </tr> <tr> <td>Olivia</td> <td>Liang</td> <td>Support Engineer</td> <td>Singapore</td> <td>64</td> <td>2011/02/03</td> <td>$234,500</td> <td>2120</td> <td>o.liang@datatables.net</td> </tr> <tr> <td>Bruno</td> <td>Nash</td> <td>Software Engineer</td> <td>London</td> <td>38</td> <td>2011/05/03</td> <td>$163,500</td> <td>6222</td> <td>b.nash@datatables.net</td> </tr> <tr> <td>Sakura</td> <td>Yamamoto</td> <td>Support Engineer</td> <td>Tokyo</td> <td>37</td> <td>2009/08/19</td> <td>$139,575</td> <td>9383</td> <td>s.yamamoto@datatables.net</td> </tr> <tr> <td>Thor</td> <td>Walton</td> <td>Developer</td> <td>New York</td> <td>61</td> <td>2013/08/11</td> <td>$98,540</td> <td>8327</td> <td>t.walton@datatables.net</td> </tr> <tr> <td>Finn</td> <td>Camacho</td> <td>Support Engineer</td> <td>San Francisco</td> <td>47</td> <td>2009/07/07</td> <td>$87,500</td> <td>2927</td> <td>f.camacho@datatables.net</td> </tr> <tr> <td>Serge</td> <td>Baldwin</td> <td>Data Coordinator</td> <td>Singapore</td> <td>64</td> <td>2012/04/09</td> <td>$138,575</td> <td>8352</td> <td>s.baldwin@datatables.net</td> </tr> <tr> <td>Zenaida</td> <td>Frank</td> <td>Software Engineer</td> <td>New York</td> <td>63</td> <td>2010/01/04</td> <td>$125,250</td> <td>7439</td> <td>z.frank@datatables.net</td> </tr> <tr> <td>Zorita</td> <td>Serrano</td> <td>Software Engineer</td> <td>San Francisco</td> <td>56</td> <td>2012/06/01</td> <td>$115,000</td> <td>4389</td> <td>z.serrano@datatables.net</td> </tr> <tr> <td>Jennifer</td> <td>Acosta</td> <td>Junior Javascript Developer</td> <td>Edinburgh</td> <td>43</td> <td>2013/02/01</td> <td>$75,650</td> <td>3431</td> <td>j.acosta@datatables.net</td> </tr> <tr> <td>Cara</td> <td>Stevens</td> <td>Sales Assistant</td> <td>New York</td> <td>46</td> <td>2011/12/06</td> <td>$145,600</td> <td>3990</td> <td>c.stevens@datatables.net</td> </tr> <tr> <td>Hermione</td> <td>Butler</td> <td>Regional Director</td> <td>London</td> <td>47</td> <td>2011/03/21</td> <td>$356,250</td> <td>1016</td> <td>h.butler@datatables.net</td> </tr> <tr> <td>Lael</td> <td>Greer</td> <td>Systems Administrator</td> <td>London</td> <td>21</td> <td>2009/02/27</td> <td>$103,500</td> <td>6733</td> <td>l.greer@datatables.net</td> </tr> <tr> <td>Jonas</td> <td>Alexander</td> <td>Developer</td> <td>San Francisco</td> <td>30</td> <td>2010/07/14</td> <td>$86,500</td> <td>8196</td> <td>j.alexander@datatables.net</td> </tr> <tr> <td>Shad</td> <td>Decker</td> <td>Regional Director</td> <td>Edinburgh</td> <td>51</td> <td>2008/11/13</td> <td>$183,000</td> <td>6373</td> <td>s.decker@datatables.net</td> </tr> <tr> <td>Michael</td> <td>Bruce</td> <td>Javascript Developer</td> <td>Singapore</td> <td>29</td> <td>2011/06/27</td> <td>$183,000</td> <td>5384</td> <td>m.bruce@datatables.net</td> </tr> <tr> <td>Donna</td> <td>Snider</td> <td>Customer Support</td> <td>New York</td> <td>27</td> <td>2011/01/25</td> <td>$112,000</td> <td>4226</td> <td>d.snider@datatables.net</td> </tr> </tbody> </table> <ul class="tabs"> <li class="active">Javascript</li> <li>HTML</li> <li>CSS</li> <li>Ajax</li> <li>Server-side script</li> </ul> <div class="tabs"> <div class="js"> <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() { $('#example').DataTable( { scrollY: 300, scrollX: true, scrollCollapse: true, paging: false, fixedColumns: true } ); } );</code> <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p> <ul> <li> <a href="//code.jquery.com/jquery-1.12.3.min.js">//code.jquery.com/jquery-1.12.3.min.js</a> </li> <li> <a href="../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js</a> </li> <li> <a href="../../js/dataTables.fixedColumns.js">../../js/dataTables.fixedColumns.js</a> </li> </ul> </div> <div class="table"> <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p> </div> <div class="css"> <div> <p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The additional CSS used is shown below:</p><code class="multiline language-css">/* Ensure that the demo table scrolls */ th, td { white-space: nowrap; } div.dataTables_wrapper { width: 800px; margin: 0 auto; }</code> </div> <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p> <ul> <li> <a href="../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css</a> </li> <li> <a href="../../css/fixedColumns.dataTables.css">../../css/fixedColumns.dataTables.css</a> </li> </ul> </div> <div class="ajax"> <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is loaded.</p> </div> <div class="php"> <p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables documentation</a>.</p> </div> </div> </section> </div> <section> <div class="footer"> <div class="gradient"></div> <div class="liner"> <h2>Other examples</h2> <div class="toc"> <div class="toc-group"> <h3><a href="./index.html">Initialisation and options</a></h3> <ul class="toc active"> <li class="active"> <a href="./simple.html">Basic initialisation</a> </li> <li> <a href="./left_right_columns.html">Left and right fixed columns</a> </li> <li> <a href="./two_columns.html">Multiple fixed columns</a> </li> <li> <a href="./right_column.html">Right column only</a> </li> <li> <a href="./colvis.html">Column visibility integration</a> </li> <li> <a href="./server-side-processing.html">Server-side processing</a> </li> <li> <a href="./css_size.html">CSS row sizing</a> </li> <li> <a href="./size_fixed.html">Assigned column width</a> </li> <li> <a href="./size_fluid.html">Fluid column width</a> </li> <li> <a href="./index_column.html">Index column</a> </li> </ul> </div> <div class="toc-group"> <h3><a href="../integration/index.html">Integration with other DataTables extensions</a></h3> <ul class="toc"> <li> <a href="../integration/select.html">Select - whole row</a> </li> <li> <a href="../integration/select-checkbox.html">Select - checkboxes</a> </li> <li> <a href="../integration/api.html">DataTables API</a> </li> </ul> </div> <div class="toc-group"> <h3><a href="../styling/index.html">Styling</a></h3> <ul class="toc"> <li> <a href="../styling/rowspan.html">Complex headers</a> </li> <li> <a href="../styling/colvis.html">Column visibility integration</a> </li> <li> <a href="../styling/server-side-processing.html">Server-side processing</a> </li> <li> <a href="../styling/col_filter.html">Individual column filtering</a> </li> <li> <a href="../styling/rtl.html">Right-to-left text direction</a> </li> <li> <a href="../styling/bootstrap.html">Bootstrap</a> </li> <li> <a href="../styling/bootstrap4.html">Bootstrap 4</a> </li> <li> <a href="../styling/foundation.html">Foundation</a> </li> <li> <a href="../styling/semanticui.html">Semantic UI</a> </li> <li> <a href="../styling/jqueryui.html">jQuery UI</a> </li> </ul> </div> </div> <div class="epilogue"> <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br> Additionally, there are a wide range of <a href="http://www.datatables.net/extensions">extensions</a> and <a href= "http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of DataTables.</p> <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2016<br> DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p> </div> </div> </div> </section> </body> </html>
{ "pile_set_name": "Github" }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.pepsoft.worldpainter.vo; import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import static java.util.stream.Collectors.toMap; /** * * @author pepijn */ public final class EventVO implements Serializable { public EventVO(String key) { this.key = key; } public EventVO count(long count) { setAttribute(ATTRIBUTE_COUNT, count); return this; } public EventVO duration(long duration) { setAttribute(ATTRIBUTE_DURATION, duration); return this; } public EventVO addTimestamp() { setAttribute(ATTRIBUTE_TIMESTAMP, new Date()); return this; } public String getKey() { return key; } public Map<String, Serializable> getAttributes() { return (attributes != null) ? attributes.entrySet().stream().collect(toMap(entry -> entry.getKey().getKey(), Entry::getValue)) : null; } public void setAttributes(Map<String, Serializable> attributes) { this.attributes = (attributes != null) ? attributes.entrySet().stream().collect(toMap(entry -> new AttributeKeyVO<>(entry.getKey()), Entry::getValue)) : null; } public <T extends Serializable> EventVO setAttribute(AttributeKeyVO<T> key, T value) { if (value != null) { if (attributes == null) { attributes = new HashMap<>(); } attributes.put(key, value); } else if ((attributes != null) && attributes.containsKey(key)) { attributes.remove(key); if (attributes.isEmpty()) { attributes = null; } } return this; } @SuppressWarnings("unchecked") public <T extends Serializable> T getAttribute(AttributeKeyVO<T> key) { if (attributes != null) { return (T) attributes.get(key); } else { return null; } } @Override public String toString() { return "EventVO{" + "key=" + key + ", attributes=" + attributes + '}'; } private final String key; private Map<AttributeKeyVO<? extends Serializable>, Serializable> attributes; public static final AttributeKeyVO<Long> ATTRIBUTE_COUNT = new AttributeKeyVO<>("count"); public static final AttributeKeyVO<Long> ATTRIBUTE_DURATION = new AttributeKeyVO<>("duration"); public static final AttributeKeyVO<Date> ATTRIBUTE_TIMESTAMP = new AttributeKeyVO<>("timestamp"); private static final long serialVersionUID = 1L; }
{ "pile_set_name": "Github" }
// +build js package runewidth func IsEastAsian() bool { // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. return false }
{ "pile_set_name": "Github" }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/iotanalytics/IoTAnalyticsEndpoint.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <aws/core/utils/HashingUtils.h> using namespace Aws; using namespace Aws::IoTAnalytics; namespace Aws { namespace IoTAnalytics { namespace IoTAnalyticsEndpoint { static const int CN_NORTH_1_HASH = Aws::Utils::HashingUtils::HashString("cn-north-1"); static const int CN_NORTHWEST_1_HASH = Aws::Utils::HashingUtils::HashString("cn-northwest-1"); static const int US_ISO_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-iso-east-1"); static const int US_ISOB_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-isob-east-1"); Aws::String ForRegion(const Aws::String& regionName, bool useDualStack) { // Fallback to us-east-1 if global endpoint does not exists. Aws::String region = regionName == Aws::Region::AWS_GLOBAL ? Aws::Region::US_EAST_1 : regionName; auto hash = Aws::Utils::HashingUtils::HashString(region.c_str()); Aws::StringStream ss; ss << "iotanalytics" << "."; if(useDualStack) { ss << "dualstack."; } ss << region; if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH) { ss << ".amazonaws.com.cn"; } else if (hash == US_ISO_EAST_1_HASH) { ss << ".c2s.ic.gov"; } else if (hash == US_ISOB_EAST_1_HASH) { ss << ".sc2s.sgov.gov"; } else { ss << ".amazonaws.com"; } return ss.str(); } } // namespace IoTAnalyticsEndpoint } // namespace IoTAnalytics } // namespace Aws
{ "pile_set_name": "Github" }
using Project1.UI.Controls; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace ProjectEye.Views { /// <summary> /// UpdateWindow.xaml 的交互逻辑 /// </summary> public partial class UpdateWindow : Project1UIWindow { public UpdateWindow() { InitializeComponent(); } } }
{ "pile_set_name": "Github" }
[ { "user": "6232d723-4ba8-4fc9-93c5-5d3270e0d74a", "id": 681, "probeGroup": "3040afe0-8e68-4468-b1b3-2b59230ccf47", "closed": false, "suppressed": false, "timeOpened": 1363053864198, "timeClosed": null, "timeLastEvent": 1363105882278, "faults": [ { "type": "probe", "probe": "61966877-60a4-44f2-9fa8-b6737adec13b", "event": { "v": 1, "type": "probe", "user": "6232d723-4ba8-4fc9-93c5-5d3270e0d74a", "probeUuid": "61966877-60a4-44f2-9fa8-b6737adec13b", "clear": false, "data": { "message": "Log \"/var/svc/log/sds-application-manatee-sitter:default.log\" matched /finished transition/.", "value": 2, "details": { "matches": [ { "match": "finished transition", "context": "\"newStandby\",\"msg\":\"finished transition\",\"time\":\"2013-03-12" } ] } }, "machine": "99f62b05-b6ba-4d06-a496-354aef6a7dbc", "uuid": "62090b60-f468-4e5c-9371-9050cdc66d8e", "time": 1363105882278, "agent": "99f62b05-b6ba-4d06-a496-354aef6a7dbc", "agentAlias": "3.pg.us-beta-2.joyent.us-99f62b05" } } ], "maintFaults": [], "numEvents": 544, "v": 1 }, { "user": "6232d723-4ba8-4fc9-93c5-5d3270e0d74a", "id": 682, "probeGroup": "053c66e3-3a17-4959-8725-2e1088b214b6", "closed": false, "suppressed": false, "timeOpened": 1363053993373, "timeClosed": null, "timeLastEvent": 1363105949117, "faults": [ { "type": "probe", "probe": "cbbf01e3-8b0c-4818-9c54-f94ab4a4883e", "event": { "v": 1, "type": "probe", "user": "6232d723-4ba8-4fc9-93c5-5d3270e0d74a", "probeUuid": "cbbf01e3-8b0c-4818-9c54-f94ab4a4883e", "clear": false, "data": { "message": "Log \"/var/svc/log/sds-application-manatee-sitter:default.log\" matched /finished transition/.", "value": 2, "details": { "matches": [ { "match": "finished transition", "context": "\"newStandby\",\"msg\":\"finished transition\",\"time\":\"2013-03-12" } ] } }, "machine": "19cbfbe9-a842-4785-b564-6bce7f9501ab", "uuid": "59db5e47-2d16-465e-a845-d573775f463c", "time": 1363105949117, "agent": "19cbfbe9-a842-4785-b564-6bce7f9501ab", "agentAlias": "4.pg.us-beta-2.joyent.us-19cbfbe9" } } ], "maintFaults": [], "numEvents": 522, "v": 1 } ]
{ "pile_set_name": "Github" }
# Copyright 2020 Lynn Root """Unit tests for interrogate/badge_gen.py module""" import os import sys import pytest from interrogate import badge_gen HERE = os.path.abspath(os.path.join(os.path.abspath(__file__), os.path.pardir)) FIXTURES = os.path.join(HERE, "fixtures") IS_WINDOWS = sys.platform in ("cygwin", "win32") @pytest.mark.skipif(IS_WINDOWS, reason="unix-only tests") def test_save_badge(mocker): """Badge is saved in the expected location.""" mock_open = mocker.mock_open() m = mocker.patch("interrogate.badge_gen.open", mock_open) output = "foo/bar/my_badge.svg" badge_contents = "<svg>foo</svg>" actual = badge_gen.save_badge(badge_contents, output) assert output == actual m.assert_called_once_with(output, "w") @pytest.mark.skipif(not IS_WINDOWS, reason="windows-only tests") def test_save_badge_windows(mocker): """Badge is saved in the expected location.""" mock_open = mocker.mock_open() m = mocker.patch("interrogate.badge_gen.open", mock_open) output = "C:\\foo\\bar\\my_badge.svg" badge_contents = "<svg>foo</svg>" actual = badge_gen.save_badge(badge_contents, output) assert output == actual m.assert_called_once_with(output, "w") def test_get_badge(): """SVG badge is templated as expected.""" actual = badge_gen.get_badge(99.9, "#4c1") actual = actual.replace("\n", "").replace("\r", "") expected_fixture = os.path.join(FIXTURES, "99.svg") with open(expected_fixture, "r") as f: expected = f.read() expected = expected.replace("\n", "").replace("\r", "") assert expected == actual @pytest.mark.parametrize( "fixture,color,result,expected", ( ("99.svg", "#4c1", 99.9, False), ("99.svg", "#97CA00", 99.9, True), ("99.svg", "#4c1", 80.0, True), ("does_not_exist.svg", "#4c1", 80.0, True), ("no_logo.svg", "#4c1", 99.9, True), ), ) def test_should_generate(fixture, color, result, expected): """Only return True if existing badge needs updating""" output = os.path.join(FIXTURES, fixture) actual = badge_gen.should_generate_badge(output, color, result) assert actual is expected @pytest.mark.parametrize( "result,expected", ( (0, "#e05d44"), (45, "#fe7d37"), (60, "#dfb317"), (89, "#a4a61d"), (90.0, "#97CA00"), (99.9, "#4c1"), (-1, "#9f9f9f"), ), ) def test_get_color(result, expected): """Expected color returned according to results.""" assert expected == badge_gen.get_color(result) @pytest.mark.parametrize( "result,is_dir,should_generate,expected_fixture", ( (99.9, True, True, "99.svg"), (90.0, True, True, "90.svg"), (89.9, True, True, "89.svg"), (60.0, True, True, "60.svg"), (45.0, True, True, "45.svg"), (0.0, True, True, "0.svg"), (-1, True, True, "default.svg"), (99.9, False, True, "99.svg"), (99.9, False, False, "99.svg"), ), ) def test_create( result, is_dir, should_generate, expected_fixture, mocker, monkeypatch, tmpdir, ): """Status badges are created according to interrogation results.""" monkeypatch.setattr(badge_gen.os.path, "isdir", lambda x: is_dir) output = tmpdir.mkdir("output") if not is_dir: output = output.join("badge.svg") if not should_generate: # pre-generate the badge mock_result = mocker.Mock(perc_covered=result) actual = badge_gen.create(str(output), mock_result) mock_result = mocker.Mock(perc_covered=result) actual = badge_gen.create(str(output), mock_result) with open(actual, "r") as f: actual_contents = f.read() actual_contents = actual_contents.replace("\n", "") expected_fixture = os.path.join(FIXTURES, expected_fixture) with open(expected_fixture, "r") as f: expected_contents = f.read() expected_contents = expected_contents.replace("\n", "") assert expected_contents == actual_contents
{ "pile_set_name": "Github" }
/*************************************************************************** * include/stxxl/bits/common/mutex.h * * Part of the STXXL. See http://stxxl.sourceforge.net * * Copyright (C) 2002 Roman Dementiev <dementiev@mpi-sb.mpg.de> * Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> * Copyright (C) 2013 Timo Bingmann <tb@panthema.net> * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) **************************************************************************/ #ifndef STXXL_COMMON_MUTEX_HEADER #define STXXL_COMMON_MUTEX_HEADER #include <stxxl/bits/config.h> #include <stxxl/bits/namespace.h> #if STXXL_STD_THREADS && STXXL_WINDOWS && STXXL_MSVC >= 1700 #include <atomic> #endif #if STXXL_STD_THREADS #include <mutex> #elif STXXL_BOOST_THREADS #include <boost/thread/mutex.hpp> #elif STXXL_POSIX_THREADS #include <pthread.h> #include <stxxl/bits/noncopyable.h> #include <stxxl/bits/common/error_handling.h> #else #error "Thread implementation not detected." #endif STXXL_BEGIN_NAMESPACE #if STXXL_STD_THREADS typedef std::mutex mutex; #elif STXXL_BOOST_THREADS typedef boost::mutex mutex; #elif STXXL_POSIX_THREADS class mutex : private noncopyable { //! mutex handle pthread_mutex_t m_mutex; public: //! construct unlocked mutex mutex() { STXXL_CHECK_PTHREAD_CALL(pthread_mutex_init(&m_mutex, NULL)); } //! destroy mutex handle ~mutex() noexcept(false) { // try simple delete first int res = pthread_mutex_destroy(&m_mutex); if (res == 0) return; // try to lock and unlock mutex res = pthread_mutex_trylock(&m_mutex); if (res == 0 || res == EBUSY) { STXXL_CHECK_PTHREAD_CALL(pthread_mutex_unlock(&m_mutex)); } else { STXXL_THROW_ERRNO2(resource_error, "pthread_mutex_trylock() failed", res); } STXXL_CHECK_PTHREAD_CALL(pthread_mutex_destroy(&m_mutex)); } //! lock mutex, may block void lock() { STXXL_CHECK_PTHREAD_CALL(pthread_mutex_lock(&m_mutex)); } //! unlock mutex void unlock() { STXXL_CHECK_PTHREAD_CALL(pthread_mutex_unlock(&m_mutex)); } //! return platform specific handle pthread_mutex_t & native_handle() { return m_mutex; } }; #endif // STXXL_POSIX_THREADS #if STXXL_STD_THREADS && STXXL_WINDOWS && STXXL_MSVC >= 1700 class spin_lock; typedef spin_lock fastmutex; #else typedef mutex fastmutex; #endif #if STXXL_STD_THREADS typedef std::unique_lock<std::mutex> scoped_mutex_lock; typedef std::unique_lock<fastmutex> scoped_fast_mutex_lock; #elif STXXL_BOOST_THREADS typedef boost::mutex::scoped_lock scoped_mutex_lock; typedef boost::mutex::scoped_lock scoped_fast_mutex_lock; #else //! Aquire a lock that's valid until the end of scope. class scoped_mutex_lock { //! mutex reference mutex& m_mutex; //! marker if already unlocked by this thread (needs no synchronization) bool is_locked; public: //! lock mutex scoped_mutex_lock(mutex& m) : m_mutex(m), is_locked(true) { m_mutex.lock(); } //! unlock mutex hold when object goes out of scope. ~scoped_mutex_lock() { unlock(); } //! unlock mutex hold prematurely void unlock() { if (is_locked) { is_locked = false; m_mutex.unlock(); } } //! return platform specific handle pthread_mutex_t & native_handle() { return m_mutex.native_handle(); } }; typedef scoped_mutex_lock scoped_fast_mutex_lock; #endif #if STXXL_STD_THREADS && STXXL_WINDOWS && STXXL_MSVC >= 1700 class spin_lock { public: #if STXXL_MSVC < 1800 spin_lock() { lck.clear(std::memory_order_release); } #else spin_lock() { } #endif void lock() { while (lck.test_and_set(std::memory_order_acquire)) { } } void unlock() { lck.clear(std::memory_order_release); } private: #if STXXL_MSVC >= 1800 std::atomic_flag lck = ATOMIC_FLAG_INIT; spin_lock(const spin_lock&) = delete; spin_lock& operator = (const spin_lock&) = delete; #else std::atomic_flag lck; spin_lock(const spin_lock&); spin_lock& operator = (const spin_lock&); #endif }; #endif STXXL_END_NAMESPACE #endif // !STXXL_COMMON_MUTEX_HEADER
{ "pile_set_name": "Github" }
# [SPARK](https://www.adacore.com/sparkpro) ## About SPARK SPARK is both the name of a programming language and the tool which allows the programmer to prove properties of SPARK programs. SPARK the language is a subset of the Ada language. Ada is a general purpose programming language, but it is mostly used in embedded and safety-critical applications. It is an imperative language like C++, but with a stronger and more precise type system, and clearer syntax. SPARK is like Ada, but with a few features removed, to remove sources of mistakes and improve the applicability of static analysis. For example, pointers have been removed from the SPARK subset, as they make verification more difficult even in simple cases, and are a source of many bugs. Many language features like built-in arrays and parameter modes make pointers less useful in SPARK than in other languages. When they are still needed, one can step out of the SPARK subset into full Ada for some part of the program, but cannot apply static analysis/proof to this part of the program. SPARK is used whenever even more guarantees are required, in highly critical parts of an embedded application, or in a security context. SPARK proofs are based on pre- and postconditions (contracts in SPARK terms), and use SMT solvers to prove the verification conditions. In this respect it is similar to Dafny. However, SPARK contracts are executable, so that one can also check them dynamically if one wishes. SPARK is co-developed by [Altran](https://www.altran.com/uk/en/), [AdaCore](https://www.adacore.com/) and [Inria](https://www.inria.fr/). It is a commercial application, but it is fully open source, and a [GPL version](https://www.adacore.com/download) is available. ## About Me My name is Johannes Kanig, and I'm member of the development team of SPARK at AdaCore. ## About the proof The idea of program proof is to express the same thing twice, once as a specification, and once as the actual program, and showing that the latter is the same as the former. The specification can either be given as an expression (or pure function) that computes the same thing as the program. In this case, one usually uses the fact that the specification is not executed to write more succinct and clearer, but less efficient code. Or, one can write the specification in a predicate style, where one expresses the relation between input and output of a function, but not explaining how one should derive one from the other. Ada (and thus SPARK) has built-in concatenation of arrays and strings, using the `&` operator. So leftpad can be simply implemented as ``` padding & string ``` where the only difficulty lies in computing the amount of padding required. In a real SPARK program, because it's built-in, one would probably not write the padding function in the first place, because it's just a simple concatenation. Or one would write it as a pure function (or expression function in SPARK terms), and can use it directly without doing any proofs. But for the purposes of the leftpad exercise, I wanted to actually prove something. So I had two choices: 1) I could use the above concatenation as the specification of leftpad, and use a loop in the implementation; 2) I could use the above concatenation as the implementation of leftpad, and write the specification in predicate style. I decided to do (2) above for the reason that it wouldn't be very idiomatic SPARK to write the code using a loop to implement concatenation. As we already have the implementation (it is in the `padding.adb` file), all there is to do is to write the specification of leftpad in predicate style (in `padding.ads`). The postcondition looks like this, where the argument of the function is called `S`, and the result of is written as `Left_Pad'Result` (we only mention the case where padding is actually required): ``` Left_Pad'Result'Length = Len and then (for all I in Left_Pad'Result'Range => Left_Pad'Result (I) = (if I <= Len - S'Length then Pad_Char else S (I - (Len - S'Length + 1) + S'First))) ``` Some explanations: - For a string `S`, one can write `S'Length` to get its length. - `and then` is conjunction. - So the first part of the conjunction simply states that the result of the function is of the expected length. - To access a character at position `I` of the string `S`, (this is *not* the ith character as per the next point) one writes `S (I)`. - Strings in Ada are not 0-based nor 1-based, the user can choose the bounds freely. We have written `Left_Pad` in such a way that it accepts strings with arbitrary bounds, but returns 1-based strings (the most common usage in Ada). This makes it necessary to do some gymnastics to determine the correct index in the argument string `S`. Bounds of strings are written `S'First` and `S'Last`. - So the second part of the conjunction states that the ith character of the result (the result is 1-based, so it's indeed the ith character) is a padding character if `I` is smaller than some value, otherwise equal to the input string `S` at some specific position. Like in Dafny, no manual proof is necessary. Everything is proved automatically in this simple example. ## How to run the proof Follow these steps to reproduce the proof: 1) Download and install the [SPARK Discovery GPL package](https://www.adacore.com/download). Don't forget to put the `bin` folder of the install in your `PATH`. 2) run ``` gnatprove -P test.gpr --steps=0 ``` Explanations: - `gnatprove` is the name of the commandline tool of SPARK - `-P test.gpr` indicates the name of the project File, which is called test.gpr - By default, SMT provers are allowed a certain small number of reasoning steps, which is not sufficient in this example. With the argument `--steps=0`, we disable this limit. The automatic proofs are still very quick (roughly 1 second on my machine for the entire file). 3) The tool gives no interesting output, which means that all proofs went through. You can also check this in the mentioned summary file, or add `--report=all` or `--report=prover` to the command line to get success messages for all proofs.
{ "pile_set_name": "Github" }
--- layout: base title: vslot20x80 --- <div class="page-title-bar"> <div class="inner-content"> <h2>{{ page.title }}</h2> </div> </div> <div id="content"> <div class="inner-content"> <table> <tr><th><strong>Author:</strong></th><td><a href='mailto:jreinhardt@ist-dein-freund.de'>Johannes Reinhardt</a></td></tr> <tr><th><strong>License:</strong></th><td><a href='http://www.gnu.org/licenses/lgpl-2.1'>LGPL 2.1+</a></td></tr> <tr><th><strong>Collection:</strong></th><td><a href='../collections/profiles.html'>Profiles</a></td></tr> <tr><th><strong>Class ID:</strong></th><td>vslot20x80</td></tr> <tr><th><strong>Url:</strong></th><td>http://openbuildspartstore.com/v-slot/</td></tr> <tr><th><strong>Source:</strong></th><td>dimensions from https://store-itwgldve.mybigcommerce.com/product_images/uploaded_images/opensource-button.png</td></tr> </table> <div id="threedview" style="border: 1px solid black"></div> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r50/three.min.js"></script> <script type="text/javascript" src="../3dviews/profiles/vslot20x80.js"></script> <script type="text/javascript"> window.onload = function() { attach_renderer(document.getElementById("threedview")); }</script> </div> <div class="inner-content"> <h1>Drawing</h1> <img width=600 src="../drawings/no_drawing.png"/> <table class="table"> <tr><th>Parameter name</th> <th>Description</th><tr> <tr><td>finish_name</td> <td>Material finish used in naming</td></tr> <tr><td>finish</td> <td>Material finish</td></tr> <tr><td>l</td> <td>Length</td></tr> </table> </div> <div class="inner-content"> <h1>Description</h1> V-Slot is a high quality extruded aluminum profile building block that has an extremely smooth linear v groove rail on all 4 sides. </div> <div class="inner-content"> <h1>FreeCAD</h1> <table class="table"> <tr><th><strong>Author:</strong></th><td><a href='mailto:jreinhardt@ist-dein-freund.de'>Johannes Reinhardt</a></td></tr> <tr><th><strong>License:</strong></th><td><a href='http://creativecommons.org/publicdomain/zero/1.0/'>CC0 1.0</a></td></tr> </table> </div> <div class="inner-content"> <h1>OpenSCAD</h1> <table class="table"> <tr><td>Class not available in OpenSCAD</td></tr> </table> </div> <div class="inner-content"> <h1>Dimensions</h1> <table class="table"> <table class="table"> <tr><th>finish</th> <th>finish_name</th><tr> <tr><td>Black</td> <td>Black </td></tr> <tr><td>Clear anodized</td> <td></td></tr> </table> </table> </div> </div>
{ "pile_set_name": "Github" }
@prefix : <#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . [] rdf:type rs:ResultSet ; rs:boolean "true"^^xsd:boolean .
{ "pile_set_name": "Github" }
/*! * Date picker for pickadate.js v3.5.4 * http://amsul.github.io/pickadate.js/date.htm */ (function ( factory ) { // AMD. if ( typeof define == 'function' && define.amd ) define( ['picker','jquery'], factory ) // Node.js/browserify. else if ( typeof exports == 'object' ) module.exports = factory( require('./picker.js'), require('jquery') ) // Browser globals. else factory( Picker, jQuery ) }(function( Picker, $ ) { /** * Globals and constants */ var DAYS_IN_WEEK = 7, WEEKS_IN_CALENDAR = 6, _ = Picker._ /** * The date picker constructor */ function DatePicker( picker, settings ) { var calendar = this, element = picker.$node[ 0 ], elementValue = element.value, elementDataValue = picker.$node.data( 'value' ), valueString = elementDataValue || elementValue, formatString = elementDataValue ? settings.formatSubmit : settings.format, isRTL = function() { return element.currentStyle ? // For IE. element.currentStyle.direction == 'rtl' : // For normal browsers. getComputedStyle( picker.$root[0] ).direction == 'rtl' } calendar.settings = settings calendar.$node = picker.$node // The queue of methods that will be used to build item objects. calendar.queue = { min: 'measure create', max: 'measure create', now: 'now create', select: 'parse create validate', highlight: 'parse navigate create validate', view: 'parse create validate viewset', disable: 'deactivate', enable: 'activate' } // The component's item object. calendar.item = {} calendar.item.clear = null calendar.item.disable = ( settings.disable || [] ).slice( 0 ) calendar.item.enable = -(function( collectionDisabled ) { return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1 })( calendar.item.disable ) calendar. set( 'min', settings.min ). set( 'max', settings.max ). set( 'now' ) // When there’s a value, set the `select`, which in turn // also sets the `highlight` and `view`. if ( valueString ) { calendar.set( 'select', valueString, { format: formatString }) } // If there’s no value, default to highlighting “today”. else { calendar. set( 'select', null ). set( 'highlight', calendar.item.now ) } // The keycode to movement mapping. calendar.key = { 40: 7, // Down 38: -7, // Up 39: function() { return isRTL() ? -1 : 1 }, // Right 37: function() { return isRTL() ? 1 : -1 }, // Left go: function( timeChange ) { var highlightedObject = calendar.item.highlight, targetDate = new Date( Date.UTC(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange) ) calendar.set( 'highlight', targetDate, { interval: timeChange } ) this.render() } } // Bind some picker events. picker. on( 'render', function() { picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() { var value = this.value if ( value ) { picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] ) picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' ) } }) picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() { var value = this.value if ( value ) { picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] ) picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' ) } }) }, 1 ). on( 'open', function() { var includeToday = '' if ( calendar.disabled( calendar.get('now') ) ) { includeToday = ':not(.' + settings.klass.buttonToday + ')' } picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false ) }, 1 ). on( 'close', function() { picker.$root.find( 'button, select' ).attr( 'disabled', true ) }, 1 ) } //DatePicker /** * Set a datepicker item object. */ DatePicker.prototype.set = function( type, value, options ) { var calendar = this, calendarItem = calendar.item // If the value is `null` just set it immediately. if ( value === null ) { if ( type == 'clear' ) type = 'select' calendarItem[ type ] = value return calendar } // Otherwise go through the queue of methods, and invoke the functions. // Update this as the time unit, and set the final value as this item. // * In the case of `enable`, keep the queue but set `disable` instead. // And in the case of `flip`, keep the queue but set `enable` instead. calendarItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = calendar.queue[ type ].split( ' ' ).map( function( method ) { value = calendar[ method ]( type, value, options ) return value }).pop() // Check if we need to cascade through more updates. if ( type == 'select' ) { calendar.set( 'highlight', calendarItem.select, options ) } else if ( type == 'highlight' ) { calendar.set( 'view', calendarItem.highlight, options ) } else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) { if ( calendarItem.select && calendar.disabled( calendarItem.select ) ) { calendar.set( 'select', calendarItem.select, options ) } if ( calendarItem.highlight && calendar.disabled( calendarItem.highlight ) ) { calendar.set( 'highlight', calendarItem.highlight, options ) } } return calendar } //DatePicker.prototype.set /** * Get a datepicker item object. */ DatePicker.prototype.get = function( type ) { return this.item[ type ] } //DatePicker.prototype.get /** * Create a picker date object. */ DatePicker.prototype.create = function( type, value, options ) { var isInfiniteValue, calendar = this // If there’s no value, use the type as the value. value = value === undefined ? type : value // If it’s infinity, update the value. if ( value == -Infinity || value == Infinity ) { isInfiniteValue = value } // If it’s an object, use the native date object. else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) { value = value.obj } // If it’s an array, convert it into a date and make sure // that it’s a valid date – otherwise default to today. else if ( $.isArray( value ) ) { value = new Date(Date.UTC(value[ 0 ], value[ 1 ], value[ 2 ] )) value = _.isDate( value ) ? value : calendar.create().obj } // If it’s a number, make a normalized date. else if ( _.isInteger( value ) ) { value = calendar.normalize( new Date( value ), options ) } // If it’s a date object, make a normalized date. else if ( _.isDate( value ) ) { value = calendar.normalize( value, options ) } // If it’s a literal true or any other case, set it to now. else /*if ( value === true )*/ { value = calendar.now( type, value, options ) } // Return the compiled object. return { year: isInfiniteValue || value.getUTCFullYear(), month: isInfiniteValue || value.getUTCMonth(), date: isInfiniteValue || value.getUTCDate(), day: isInfiniteValue || value.getUTCDay(), obj: isInfiniteValue || value, pick: isInfiniteValue || value.getTime() } } //DatePicker.prototype.create /** * Create a range limit object using an array, date object, * literal “true”, or integer relative to another time. */ DatePicker.prototype.createRange = function( from, to ) { var calendar = this, createDate = function( date ) { if ( date === true || $.isArray( date ) || _.isDate( date ) ) { return calendar.create( date ) } return date } // Create objects if possible. if ( !_.isInteger( from ) ) { from = createDate( from ) } if ( !_.isInteger( to ) ) { to = createDate( to ) } // Create relative dates. if ( _.isInteger( from ) && $.isPlainObject( to ) ) { from = [ to.year, to.month, to.date + from ]; } else if ( _.isInteger( to ) && $.isPlainObject( from ) ) { to = [ from.year, from.month, from.date + to ]; } return { from: createDate( from ), to: createDate( to ) } } //DatePicker.prototype.createRange /** * Check if a date unit falls within a date range object. */ DatePicker.prototype.withinRange = function( range, dateUnit ) { range = this.createRange(range.from, range.to) return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick } /** * Check if two date range objects overlap. */ DatePicker.prototype.overlapRanges = function( one, two ) { var calendar = this // Convert the ranges into comparable dates. one = calendar.createRange( one.from, one.to ) two = calendar.createRange( two.from, two.to ) return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) || calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to ) } /** * Get the date today. */ DatePicker.prototype.now = function( type, value, options ) { value = new Date() if ( options && options.rel ) { value.setUTCDate( value.getUTCDate() + options.rel ) } return this.normalize( value, options ) } /** * Navigate to next/prev month. */ DatePicker.prototype.navigate = function( type, value, options ) { var targetDateObject, targetYear, targetMonth, targetDate, isTargetArray = $.isArray( value ), isTargetObject = $.isPlainObject( value ), viewsetObject = this.item.view/*, safety = 100*/ if ( isTargetArray || isTargetObject ) { if ( isTargetObject ) { targetYear = value.year targetMonth = value.month targetDate = value.date } else { targetYear = +value[0] targetMonth = +value[1] targetDate = +value[2] } // If we’re navigating months but the view is in a different // month, navigate to the view’s year and month. if ( options && options.nav && viewsetObject && viewsetObject.month !== targetMonth ) { targetYear = viewsetObject.year targetMonth = viewsetObject.month } // Figure out the expected target year and month. targetDateObject = new Date( Date.UTC( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 ) ) targetYear = targetDateObject.getUTCFullYear() targetMonth = targetDateObject.getUTCMonth() // If the month we’re going to doesn’t have enough days, // keep decreasing the date until we reach the month’s last date. while ( /*safety &&*/ new Date( Date.UTC( targetYear, targetMonth, targetDate ) ).getUTCMonth() !== targetMonth ) { targetDate -= 1 /*safety -= 1 if ( !safety ) { throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.' }*/ } value = [ targetYear, targetMonth, targetDate ] } return value } //DatePicker.prototype.navigate /** * Normalize a date by setting the hours to midnight. */ DatePicker.prototype.normalize = function( value/*, options*/ ) { value.setUTCHours( 0, 0, 0, 0 ) return value } /** * Measure the range of dates. */ DatePicker.prototype.measure = function( type, value/*, options*/ ) { var calendar = this // If it’s anything false-y, remove the limits. if ( !value ) { value = type == 'min' ? -Infinity : Infinity } // If it’s a string, parse it. else if ( typeof value == 'string' ) { value = calendar.parse( type, value ) } // If it's an integer, get a date relative to today. else if ( _.isInteger( value ) ) { value = calendar.now( type, value, { rel: value } ) } return value } ///DatePicker.prototype.measure /** * Create a viewset object based on navigation. */ DatePicker.prototype.viewset = function( type, dateObject/*, options*/ ) { return this.create([ dateObject.year, dateObject.month, 1 ]) } /** * Validate a date as enabled and shift if needed. */ DatePicker.prototype.validate = function( type, dateObject, options ) { var calendar = this, // Keep a reference to the original date. originalDateObject = dateObject, // Make sure we have an interval. interval = options && options.interval ? options.interval : 1, // Check if the calendar enabled dates are inverted. isFlippedBase = calendar.item.enable === -1, // Check if we have any enabled dates after/before now. hasEnabledBeforeTarget, hasEnabledAfterTarget, // The min & max limits. minLimitObject = calendar.item.min, maxLimitObject = calendar.item.max, // Check if we’ve reached the limit during shifting. reachedMin, reachedMax, // Check if the calendar is inverted and at least one weekday is enabled. hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter( function( value ) { // If there’s a date, check where it is relative to the target. if ( $.isArray( value ) ) { var dateTime = calendar.create( value ).pick if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true } // Return only integers for enabled weekdays. return _.isInteger( value ) }).length/*, safety = 100*/ // Cases to validate for: // [1] Not inverted and date disabled. // [2] Inverted and some dates enabled. // [3] Not inverted and out of range. // // Cases to **not** validate for: // • Navigating months. // • Not inverted and date enabled. // • Inverted and all dates disabled. // • ..and anything else. if ( !options || !options.nav ) if ( /* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) || /* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) || /* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) ) ) { // When inverted, flip the direction if there aren’t any enabled weekdays // and there are no enabled dates in the direction of the interval. if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) { interval *= -1 } // Keep looping until we reach an enabled date. while ( /*safety &&*/ calendar.disabled( dateObject ) ) { /*safety -= 1 if ( !safety ) { throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.' }*/ // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval. if ( Math.abs( interval ) > 1 && ( dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month ) ) { dateObject = originalDateObject interval = interval > 0 ? 1 : -1 } // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit. if ( dateObject.pick <= minLimitObject.pick ) { reachedMin = true interval = 1 dateObject = calendar.create([ minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1) ]) } else if ( dateObject.pick >= maxLimitObject.pick ) { reachedMax = true interval = -1 dateObject = calendar.create([ maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1) ]) } // If we’ve reached both limits, just break out of the loop. if ( reachedMin && reachedMax ) { break } // Finally, create the shifted date using the interval and keep looping. dateObject = calendar.create([ dateObject.year, dateObject.month, dateObject.date + interval ]) } } //endif // Return the date object settled on. return dateObject } //DatePicker.prototype.validate /** * Check if a date is disabled. */ DatePicker.prototype.disabled = function( dateToVerify ) { var calendar = this, // Filter through the disabled dates to check if this is one. isDisabledMatch = calendar.item.disable.filter( function( dateToDisable ) { // If the date is a number, match the weekday with 0index and `firstDay` check. if ( _.isInteger( dateToDisable ) ) { return dateToVerify.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7 } // If it’s an array or a native JS date, create and match the exact date. if ( $.isArray( dateToDisable ) || _.isDate( dateToDisable ) ) { return dateToVerify.pick === calendar.create( dateToDisable ).pick } // If it’s an object, match a date within the “from” and “to” range. if ( $.isPlainObject( dateToDisable ) ) { return calendar.withinRange( dateToDisable, dateToVerify ) } }) // If this date matches a disabled date, confirm it’s not inverted. isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( dateToDisable ) { return $.isArray( dateToDisable ) && dateToDisable[3] == 'inverted' || $.isPlainObject( dateToDisable ) && dateToDisable.inverted }).length // Check the calendar “enabled” flag and respectively flip the // disabled state. Then also check if it’s beyond the min/max limits. return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick } //DatePicker.prototype.disabled /** * Parse a string into a usable type. */ DatePicker.prototype.parse = function( type, value, options ) { var calendar = this, parsingObject = {} // If it’s already parsed, we’re good. if ( !value || typeof value != 'string' ) { return value } // We need a `.format` to parse the value with. if ( !( options && options.format ) ) { options = options || {} options.format = calendar.settings.format } // Convert the format into an array and then map through it. calendar.formats.toArray( options.format ).map( function( label ) { var // Grab the formatting label. formattingLabel = calendar.formats[ label ], // The format length is from the formatting label function or the // label length without the escaping exclamation (!) mark. formatLength = formattingLabel ? _.trigger( formattingLabel, calendar, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length // If there's a format label, split the value up to the format length. // Then add it to the parsing object with appropriate label. if ( formattingLabel ) { parsingObject[ label ] = value.substr( 0, formatLength ) } // Update the value as the substring from format length to end. value = value.substr( formatLength ) }) // Compensate for month 0index. return [ parsingObject.yyyy || parsingObject.yy, +( parsingObject.mm || parsingObject.m ) - 1, parsingObject.dd || parsingObject.d ] } //DatePicker.prototype.parse /** * Various formats to display the object in. */ DatePicker.prototype.formats = (function() { // Return the length of the first word in a collection. function getWordLengthFromCollection( string, collection, dateObject ) { // Grab the first word from the string. var word = string.match( /\w+/ )[ 0 ] // If there's no month index, add it to the date object if ( !dateObject.mm && !dateObject.m ) { dateObject.m = collection.indexOf( word ) + 1 } // Return the length of the word. return word.length } // Get the length of the first word in a string. function getFirstWordLength( string ) { return string.match( /\w+/ )[ 0 ].length } return { d: function( string, dateObject ) { // If there's string, then get the digits length. // Otherwise return the selected date. return string ? _.digits( string ) : dateObject.date }, dd: function( string, dateObject ) { // If there's a string, then the length is always 2. // Otherwise return the selected date with a leading zero. return string ? 2 : _.lead( dateObject.date ) }, ddd: function( string, dateObject ) { // If there's a string, then get the length of the first word. // Otherwise return the short selected weekday. return string ? getFirstWordLength( string ) : this.settings.weekdaysShort[ dateObject.day ] }, dddd: function( string, dateObject ) { // If there's a string, then get the length of the first word. // Otherwise return the full selected weekday. return string ? getFirstWordLength( string ) : this.settings.weekdaysFull[ dateObject.day ] }, m: function( string, dateObject ) { // If there's a string, then get the length of the digits // Otherwise return the selected month with 0index compensation. return string ? _.digits( string ) : dateObject.month + 1 }, mm: function( string, dateObject ) { // If there's a string, then the length is always 2. // Otherwise return the selected month with 0index and leading zero. return string ? 2 : _.lead( dateObject.month + 1 ) }, mmm: function( string, dateObject ) { var collection = this.settings.monthsShort // If there's a string, get length of the relevant month from the short // months collection. Otherwise return the selected month from that collection. return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ] }, mmmm: function( string, dateObject ) { var collection = this.settings.monthsFull // If there's a string, get length of the relevant month from the full // months collection. Otherwise return the selected month from that collection. return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ] }, yy: function( string, dateObject ) { // If there's a string, then the length is always 2. // Otherwise return the selected year by slicing out the first 2 digits. return string ? 2 : ( '' + dateObject.year ).slice( 2 ) }, yyyy: function( string, dateObject ) { // If there's a string, then the length is always 4. // Otherwise return the selected year. return string ? 4 : dateObject.year }, // Create an array by splitting the formatting string passed. toArray: function( formatString ) { return formatString.split( /(d{1,4}|m{1,4}|y{4}|yy|!.)/g ) }, // Format an object into a string using the formatting options. toString: function ( formatString, itemObject ) { var calendar = this return calendar.formats.toArray( formatString ).map( function( label ) { return _.trigger( calendar.formats[ label ], calendar, [ 0, itemObject ] ) || label.replace( /^!/, '' ) }).join( '' ) } } })() //DatePicker.prototype.formats /** * Check if two date units are the exact. */ DatePicker.prototype.isDateExact = function( one, two ) { var calendar = this // When we’re working with weekdays, do a direct comparison. if ( ( _.isInteger( one ) && _.isInteger( two ) ) || ( typeof one == 'boolean' && typeof two == 'boolean' ) ) { return one === two } // When we’re working with date representations, compare the “pick” value. if ( ( _.isDate( one ) || $.isArray( one ) ) && ( _.isDate( two ) || $.isArray( two ) ) ) { return calendar.create( one ).pick === calendar.create( two ).pick } // When we’re working with range objects, compare the “from” and “to”. if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) { return calendar.isDateExact( one.from, two.from ) && calendar.isDateExact( one.to, two.to ) } return false } /** * Check if two date units overlap. */ DatePicker.prototype.isDateOverlap = function( one, two ) { var calendar = this, firstDay = calendar.settings.firstDay ? 1 : 0 // When we’re working with a weekday index, compare the days. if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) { one = one % 7 + firstDay return one === calendar.create( two ).day + 1 } if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) { two = two % 7 + firstDay return two === calendar.create( one ).day + 1 } // When we’re working with range objects, check if the ranges overlap. if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) { return calendar.overlapRanges( one, two ) } return false } /** * Flip the “enabled” state. */ DatePicker.prototype.flipEnable = function(val) { var itemObject = this.item itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1) } /** * Mark a collection of dates as “disabled”. */ DatePicker.prototype.deactivate = function( type, datesToDisable ) { var calendar = this, disabledItems = calendar.item.disable.slice(0) // If we’re flipping, that’s all we need to do. if ( datesToDisable == 'flip' ) { calendar.flipEnable() } else if ( datesToDisable === false ) { calendar.flipEnable(1) disabledItems = [] } else if ( datesToDisable === true ) { calendar.flipEnable(-1) disabledItems = [] } // Otherwise go through the dates to disable. else { datesToDisable.map(function( unitToDisable ) { var matchFound // When we have disabled items, check for matches. // If something is matched, immediately break out. for ( var index = 0; index < disabledItems.length; index += 1 ) { if ( calendar.isDateExact( unitToDisable, disabledItems[index] ) ) { matchFound = true break } } // If nothing was found, add the validated unit to the collection. if ( !matchFound ) { if ( _.isInteger( unitToDisable ) || _.isDate( unitToDisable ) || $.isArray( unitToDisable ) || ( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to ) ) { disabledItems.push( unitToDisable ) } } }) } // Return the updated collection. return disabledItems } //DatePicker.prototype.deactivate /** * Mark a collection of dates as “enabled”. */ DatePicker.prototype.activate = function( type, datesToEnable ) { var calendar = this, disabledItems = calendar.item.disable, disabledItemsCount = disabledItems.length // If we’re flipping, that’s all we need to do. if ( datesToEnable == 'flip' ) { calendar.flipEnable() } else if ( datesToEnable === true ) { calendar.flipEnable(1) disabledItems = [] } else if ( datesToEnable === false ) { calendar.flipEnable(-1) disabledItems = [] } // Otherwise go through the disabled dates. else { datesToEnable.map(function( unitToEnable ) { var matchFound, disabledUnit, index, isExactRange // Go through the disabled items and try to find a match. for ( index = 0; index < disabledItemsCount; index += 1 ) { disabledUnit = disabledItems[index] // When an exact match is found, remove it from the collection. if ( calendar.isDateExact( disabledUnit, unitToEnable ) ) { matchFound = disabledItems[index] = null isExactRange = true break } // When an overlapped match is found, add the “inverted” state to it. else if ( calendar.isDateOverlap( disabledUnit, unitToEnable ) ) { if ( $.isPlainObject( unitToEnable ) ) { unitToEnable.inverted = true matchFound = unitToEnable } else if ( $.isArray( unitToEnable ) ) { matchFound = unitToEnable if ( !matchFound[3] ) matchFound.push( 'inverted' ) } else if ( _.isDate( unitToEnable ) ) { matchFound = [ unitToEnable.getUTCFullYear(), unitToEnable.getUTCMonth(), unitToEnable.getUTCDate(), 'inverted' ] } break } } // If a match was found, remove a previous duplicate entry. if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) { if ( calendar.isDateExact( disabledItems[index], unitToEnable ) ) { disabledItems[index] = null break } } // In the event that we’re dealing with an exact range of dates, // make sure there are no “inverted” dates because of it. if ( isExactRange ) for ( index = 0; index < disabledItemsCount; index += 1 ) { if ( calendar.isDateOverlap( disabledItems[index], unitToEnable ) ) { disabledItems[index] = null break } } // If something is still matched, add it into the collection. if ( matchFound ) { disabledItems.push( matchFound ) } }) } // Return the updated collection. return disabledItems.filter(function( val ) { return val != null }) } //DatePicker.prototype.activate /** * Create a string for the nodes in the picker. */ DatePicker.prototype.nodes = function( isOpen ) { var calendar = this, settings = calendar.settings, calendarItem = calendar.item, nowObject = calendarItem.now, selectedObject = calendarItem.select, highlightedObject = calendarItem.highlight, viewsetObject = calendarItem.view, disabledCollection = calendarItem.disable, minLimitObject = calendarItem.min, maxLimitObject = calendarItem.max, // Create the calendar table head using a copy of weekday labels collection. // * We do a copy so we don't mutate the original array. tableHead = (function( collection, fullCollection ) { // If the first day should be Monday, move Sunday to the end. if ( settings.firstDay ) { collection.push( collection.shift() ) fullCollection.push( fullCollection.shift() ) } // Create and return the table head group. return _.node( 'thead', _.node( 'tr', _.group({ min: 0, max: DAYS_IN_WEEK - 1, i: 1, node: 'th', item: function( counter ) { return [ collection[ counter ], settings.klass.weekdays, 'scope=col title="' + fullCollection[ counter ] + '"' ] } }) ) ) //endreturn })( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead // Create the nav for next/prev month. createMonthNav = function( next ) { // Otherwise, return the created month tag. return _.node( 'div', ' ', settings.klass[ 'nav' + ( next ? 'Next' : 'Prev' ) ] + ( // If the focused month is outside the range, disabled the button. ( next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month ) || ( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ? ' ' + settings.klass.navDisabled : '' ), 'data-nav=' + ( next || -1 ) + ' ' + _.ariaAttr({ role: 'button', controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"' ) //endreturn }, //createMonthNav // Create the month label. createMonthLabel = function() { var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull // If there are months to select, add a dropdown menu. if ( settings.selectMonths ) { return _.node( 'select', _.group({ min: 0, max: 11, i: 1, node: 'option', item: function( loopedMonth ) { return [ // The looped month and no classes. monthsCollection[ loopedMonth ], 0, // Set the value and selected index. 'value=' + loopedMonth + ( viewsetObject.month == loopedMonth ? ' selected' : '' ) + ( ( ( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) || ( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ) ) ? ' disabled' : '' ) ] } }), settings.klass.selectMonth, ( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelMonthSelect + '"' ) } // If there's a need for a month selector return _.node( 'div', monthsCollection[ viewsetObject.month ], settings.klass.month ) }, //createMonthLabel // Create the year label. createYearLabel = function() { var focusedYear = viewsetObject.year, // If years selector is set to a literal "true", set it to 5. Otherwise // divide in half to get half before and half after focused year. numberYears = settings.selectYears === true ? 5 : ~~( settings.selectYears / 2 ) // If there are years to select, add a dropdown menu. if ( numberYears ) { var minYear = minLimitObject.year, maxYear = maxLimitObject.year, lowestYear = focusedYear - numberYears, highestYear = focusedYear + numberYears // If the min year is greater than the lowest year, increase the highest year // by the difference and set the lowest year to the min year. if ( minYear > lowestYear ) { highestYear += minYear - lowestYear lowestYear = minYear } // If the max year is less than the highest year, decrease the lowest year // by the lower of the two: available and needed years. Then set the // highest year to the max year. if ( maxYear < highestYear ) { var availableYears = lowestYear - minYear, neededYears = highestYear - maxYear lowestYear -= availableYears > neededYears ? neededYears : availableYears highestYear = maxYear } return _.node( 'select', _.group({ min: lowestYear, max: highestYear, i: 1, node: 'option', item: function( loopedYear ) { return [ // The looped year and no classes. loopedYear, 0, // Set the value and selected index. 'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' ) ] } }), settings.klass.selectYear, ( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelYearSelect + '"' ) } // Otherwise just return the year focused return _.node( 'div', focusedYear, settings.klass.year ) } //createYearLabel // Create and return the entire calendar. return _.node( 'div', ( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ) + createMonthNav() + createMonthNav( 1 ), settings.klass.header ) + _.node( 'table', tableHead + _.node( 'tbody', _.group({ min: 0, max: WEEKS_IN_CALENDAR - 1, i: 1, node: 'tr', item: function( rowCounter ) { // If Monday is the first day and the month starts on Sunday, shift the date back a week. var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0 return [ _.group({ min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index max: function() { return this.min + DAYS_IN_WEEK - 1 }, i: 1, node: 'td', item: function( targetDate ) { // Convert the time date from a relative date to a target date. targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ]) var isSelected = selectedObject && selectedObject.pick == targetDate.pick, isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick, isDisabled = disabledCollection && calendar.disabled( targetDate ) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick return [ _.node( 'div', targetDate.date, (function( klasses ) { // Add the `infocus` or `outfocus` classes based on month in view. klasses.push( viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus ) // Add the `today` class if needed. if ( nowObject.pick == targetDate.pick ) { klasses.push( settings.klass.now ) } // Add the `selected` class if something's selected and the time matches. if ( isSelected ) { klasses.push( settings.klass.selected ) } // Add the `highlighted` class if something's highlighted and the time matches. if ( isHighlighted ) { klasses.push( settings.klass.highlighted ) } // Add the `disabled` class if something's disabled and the object matches. if ( isDisabled ) { klasses.push( settings.klass.disabled ) } return klasses.join( ' ' ) })([ settings.klass.day ]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({ role: 'gridcell', selected: isSelected && calendar.$node.val() === _.trigger( calendar.formats.toString, calendar, [ settings.format, targetDate ] ) ? true : null, activedescendant: isHighlighted ? true : null, disabled: isDisabled ? true : null }) ), '', _.ariaAttr({ role: 'presentation' }) ] //endreturn } }) ] //endreturn } }) ), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({ role: 'grid', controls: calendar.$node[0].id, readonly: true }) ) + // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”. _.node( 'div', _.node( 'button', settings.today, settings.klass.buttonToday, 'type=button data-pick=' + nowObject.pick + ( isOpen && !calendar.disabled(nowObject) ? '' : ' disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id }) ) + _.node( 'button', settings.clear, settings.klass.buttonClear, 'type=button data-clear=1' + ( isOpen ? '' : ' disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id }) ) + _.node('button', settings.close, settings.klass.buttonClose, 'type=button data-close=true ' + ( isOpen ? '' : ' disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id }) ), settings.klass.footer ) //endreturn } //DatePicker.prototype.nodes /** * The date picker defaults. */ DatePicker.defaults = (function( prefix ) { return { // The title label to use for the month nav buttons labelMonthNext: 'Next month', labelMonthPrev: 'Previous month', // The title label to use for the dropdown selectors labelMonthSelect: 'Select a month', labelYearSelect: 'Select a year', // Months and weekdays monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ], monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ], weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ], weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ], // Today and clear today: 'Today', clear: 'Clear', close: 'Close', // The format to show on the `input` element format: 'd mmmm, yyyy', // Classes klass: { table: prefix + 'table', header: prefix + 'header', navPrev: prefix + 'nav--prev', navNext: prefix + 'nav--next', navDisabled: prefix + 'nav--disabled', month: prefix + 'month', year: prefix + 'year', selectMonth: prefix + 'select--month', selectYear: prefix + 'select--year', weekdays: prefix + 'weekday', day: prefix + 'day', disabled: prefix + 'day--disabled', selected: prefix + 'day--selected', highlighted: prefix + 'day--highlighted', now: prefix + 'day--today', infocus: prefix + 'day--infocus', outfocus: prefix + 'day--outfocus', footer: prefix + 'footer', buttonClear: prefix + 'button--clear', buttonToday: prefix + 'button--today', buttonClose: prefix + 'button--close' } } })( Picker.klasses().picker + '__' ) /** * Extend the picker to add the date picker. */ Picker.extend( 'pickadate', DatePicker ) }));
{ "pile_set_name": "Github" }
/***** includes *****/ #include "libshared_memory_internal.h" /***** private prototypes *****/ static void alloc_and_init_memory_element( struct libshared_memory_element **me, void *memory, lfds710_pal_uint_t memory_size_in_bytes ); /****************************************************************************/ void libshared_memory_add_memory_from_numa_node( struct libshared_memory_state *ms, lfds710_pal_uint_t numa_node_id, void *memory, lfds710_pal_uint_t memory_size_in_bytes ) { struct libshared_memory_element *me; LFDS710_PAL_ASSERT( ms != NULL ); // TRD : numa_node_id can be any value in its range LFDS710_PAL_ASSERT( memory != NULL ); // TRD : memory_size_in_bytes can be any value in its range alloc_and_init_memory_element( &me, memory, memory_size_in_bytes ); me->known_numa_node_flag = RAISED; me->numa_node_id = numa_node_id; LFDS710_LIST_ASU_SET_KEY_IN_ELEMENT( me->lasue, me ); LFDS710_LIST_ASU_SET_VALUE_IN_ELEMENT( me->lasue, me ); lfds710_list_asu_insert_at_start( &ms->list_of_allocations, &me->lasue ); return; } /****************************************************************************/ void libshared_memory_add_memory( struct libshared_memory_state *ms, void *memory, lfds710_pal_uint_t memory_size_in_bytes ) { struct libshared_memory_element *me; LFDS710_PAL_ASSERT( ms != NULL ); LFDS710_PAL_ASSERT( memory != NULL ); // TRD : memory_size_in_bytes can be any value in its range alloc_and_init_memory_element( &me, memory, memory_size_in_bytes ); me->known_numa_node_flag = LOWERED; LFDS710_LIST_ASU_SET_KEY_IN_ELEMENT( me->lasue, me ); LFDS710_LIST_ASU_SET_VALUE_IN_ELEMENT( me->lasue, me ); lfds710_list_asu_insert_at_start( &ms->list_of_allocations, &me->lasue ); return; } /****************************************************************************/ static void alloc_and_init_memory_element( struct libshared_memory_element **me, void *memory, lfds710_pal_uint_t memory_size_in_bytes ) { lfds710_pal_uint_t alignment_bump, size_in_bytes, total_size_in_bytes; LFDS710_PAL_ASSERT( me != NULL ); LFDS710_PAL_ASSERT( memory != NULL ); // TRD : memory_size_in_bytes can be any value in its range alignment_bump = (lfds710_pal_uint_t) memory % LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES; if( alignment_bump != 0 ) alignment_bump = LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES - alignment_bump; size_in_bytes = sizeof( struct libshared_memory_element ); total_size_in_bytes = size_in_bytes + alignment_bump; *me = (struct libshared_memory_element *) ( (char unsigned *) memory + alignment_bump ); (*me)->original = memory; (*me)->original_memory_size_in_bytes = memory_size_in_bytes; (*me)->original_after_me_alloc = (*me)->current_pointer = (char unsigned *) memory + total_size_in_bytes; (*me)->original_after_me_alloc_memory_size_in_bytes = (*me)->current_memory_size_in_bytes = memory_size_in_bytes - total_size_in_bytes; return; }
{ "pile_set_name": "Github" }
# vim:set ft= ts=4 sw=4 et fdm=marker: use Test::Nginx::Socket::Lua; #worker_connections(1014); #master_process_enabled(1); log_level('warn'); repeat_each(2); plan tests => repeat_each() * (blocks() * 2); #no_diff(); #no_long_string(); run_tests(); __DATA__ === TEST 1: use ngx.today in content_by_lua --- config location = /today { content_by_lua 'ngx.say(ngx.today())'; } --- request GET /today --- response_body_like: ^\d{4}-\d{2}-\d{2}$ === TEST 2: use ngx.today in set_by_lua --- config location = /today { set_by_lua $a 'return ngx.today()'; echo $a; } --- request GET /today --- response_body_like: ^\d{4}-\d{2}-\d{2}$
{ "pile_set_name": "Github" }
"""Test that user ops can be used as expected.""" from __future__ import print_function import tensorflow.python.platform import tensorflow as tf class FactTest(tf.test.TestCase): def test(self): with self.test_session(): print(tf.user_ops.my_fact().eval()) if __name__ == '__main__': tf.test.main()
{ "pile_set_name": "Github" }
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FF000000" android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19L3,19v-3h18v3z"/> </vector>
{ "pile_set_name": "Github" }
overload_simple # unless explicitly casted via {{u}int{8,16,32,64},double,single}, # octave will take numeric literals as doubles. if (!strcmp(foo(3),"foo:int")) error("foo(int)") endif if (!strcmp(foo(3.1),"foo:double")) error("foo(double)") endif if (!strcmp(foo("hello"),"foo:char *")) error("foo(char *)") endif f = Foo(); b = Bar(); if (!strcmp(foo(f),"foo:Foo *")) error("foo(Foo *)") endif if (!strcmp(foo(b),"foo:Bar *")) error("foo(Bar *)") endif v = malloc_void(32); if (!strcmp(foo(v),"foo:void *")) error("foo(void *)") endif s = Spam(); if (!strcmp(s.foo(3),"foo:int")) error("Spam::foo(int)") endif if (!strcmp(s.foo(3.1),"foo:double")) error("Spam::foo(double)") endif if (!strcmp(s.foo("hello"),"foo:char *")) error("Spam::foo(char *)") endif if (!strcmp(s.foo(f),"foo:Foo *")) error("Spam::foo(Foo *)") endif if (!strcmp(s.foo(b),"foo:Bar *")) error("Spam::foo(Bar *)") endif if (!strcmp(s.foo(v),"foo:void *")) error("Spam::foo(void *)") endif if (!strcmp(Spam_bar(3),"bar:int")) error("Spam::bar(int)") endif if (!strcmp(Spam_bar(3.1),"bar:double")) error("Spam::bar(double)") endif if (!strcmp(Spam_bar("hello"),"bar:char *")) error("Spam::bar(char *)") endif if (!strcmp(Spam_bar(f),"bar:Foo *")) error("Spam::bar(Foo *)") endif if (!strcmp(Spam_bar(b),"bar:Bar *")) error("Spam::bar(Bar *)") endif if (!strcmp(Spam_bar(v),"bar:void *")) error("Spam::bar(void *)") endif # Test constructors s = Spam(); if (!strcmp(s.type,"none")) error("Spam()") endif s = Spam(3); if (!strcmp(s.type,"int")) error("Spam(int)") endif s = Spam(3.4); if (!strcmp(s.type,"double")) error("Spam(double)") endif s = Spam("hello"); if (!strcmp(s.type,"char *")) error("Spam(char *)") endif s = Spam(f); if (!strcmp(s.type,"Foo *")) error("Spam(Foo *)") endif s = Spam(b); if (!strcmp(s.type,"Bar *")) error("Spam(Bar *)") endif s = Spam(v); if (!strcmp(s.type,"void *")) error("Spam(void *)") endif free_void(v); a = ClassA(); b = a.method1(1);
{ "pile_set_name": "Github" }
/* * [The "BSD licence"] * Copyright (c) 2010 Ben Gruver (JesusFreke) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 org.jf.baksmali.Adaptors; import com.google.common.collect.ImmutableList; import org.jf.baksmali.Adaptors.Debug.DebugMethodItem; import org.jf.baksmali.Adaptors.Format.InstructionMethodItemFactory; import org.jf.baksmali.baksmaliOptions; import org.jf.dexlib2.AccessFlags; import org.jf.dexlib2.Format; import org.jf.dexlib2.Opcode; import org.jf.dexlib2.ReferenceType; import org.jf.dexlib2.analysis.AnalysisException; import org.jf.dexlib2.analysis.AnalyzedInstruction; import org.jf.dexlib2.analysis.MethodAnalyzer; import org.jf.dexlib2.dexbacked.DexBackedDexFile.InvalidItemIndex; import org.jf.dexlib2.iface.*; import org.jf.dexlib2.iface.debug.DebugItem; import org.jf.dexlib2.iface.instruction.Instruction; import org.jf.dexlib2.iface.instruction.OffsetInstruction; import org.jf.dexlib2.iface.instruction.ReferenceInstruction; import org.jf.dexlib2.iface.reference.MethodReference; import org.jf.dexlib2.util.InstructionOffsetMap; import org.jf.dexlib2.util.InstructionOffsetMap.InvalidInstructionOffset; import org.jf.dexlib2.util.ReferenceUtil; import org.jf.dexlib2.util.SyntheticAccessorResolver; import org.jf.dexlib2.util.TypeUtils; import org.jf.util.ExceptionWithContext; import org.jf.util.IndentingWriter; import org.jf.util.SparseIntArray; import javax.annotation.Nonnull; import java.io.IOException; import java.util.*; public class MethodDefinition { @Nonnull public final ClassDefinition classDef; @Nonnull public final Method method; @Nonnull public final MethodImplementation methodImpl; @Nonnull public final ImmutableList<Instruction> instructions; @Nonnull public final ImmutableList<MethodParameter> methodParameters; public RegisterFormatter registerFormatter; @Nonnull private final LabelCache labelCache = new LabelCache(); @Nonnull private final SparseIntArray packedSwitchMap; @Nonnull private final SparseIntArray sparseSwitchMap; @Nonnull private final InstructionOffsetMap instructionOffsetMap; public MethodDefinition(@Nonnull ClassDefinition classDef, @Nonnull Method method, @Nonnull MethodImplementation methodImpl) { this.classDef = classDef; this.method = method; this.methodImpl = methodImpl; try { //TODO: what about try/catch blocks inside the dead code? those will need to be commented out too. ugh. instructions = ImmutableList.copyOf(methodImpl.getInstructions()); methodParameters = ImmutableList.copyOf(method.getParameters()); packedSwitchMap = new SparseIntArray(0); sparseSwitchMap = new SparseIntArray(0); instructionOffsetMap = new InstructionOffsetMap(instructions); //Logger.log("the method:"+method.getDefiningClass()+":"+method.getName()); for (int i=0; i<instructions.size(); i++) { Instruction instruction = instructions.get(i); Opcode opcode = instruction.getOpcode(); //Logger.log("the opcode:"+opcode.name +" opcode value:"+opcode.value +" opcode size:"+instruction.getCodeUnits()); if (opcode == Opcode.PACKED_SWITCH) { boolean valid = true; int codeOffset = instructionOffsetMap.getInstructionCodeOffset(i); int targetOffset = codeOffset + ((OffsetInstruction)instruction).getCodeOffset(); try { targetOffset = findSwitchPayload(targetOffset, Opcode.PACKED_SWITCH_PAYLOAD); } catch (InvalidSwitchPayload ex) { valid = false; } if (valid) { packedSwitchMap.append(targetOffset, codeOffset); } } else if (opcode == Opcode.SPARSE_SWITCH) { boolean valid = true; int codeOffset = instructionOffsetMap.getInstructionCodeOffset(i); int targetOffset = codeOffset + ((OffsetInstruction)instruction).getCodeOffset(); try { targetOffset = findSwitchPayload(targetOffset, Opcode.SPARSE_SWITCH_PAYLOAD); } catch (InvalidSwitchPayload ex) { valid = false; // The offset to the payload instruction was invalid. Nothing to do, except that we won't // add this instruction to the map. } if (valid) { sparseSwitchMap.append(targetOffset, codeOffset); } } } }catch (Exception ex) { String methodString; try { methodString = ReferenceUtil.getMethodDescriptor(method); } catch (Exception ex2) { throw ExceptionWithContext.withContext(ex, "Error while processing method"); } throw ExceptionWithContext.withContext(ex, "Error while processing method %s", methodString); } } public static void writeEmptyMethodTo(IndentingWriter writer, Method method, baksmaliOptions options) throws IOException { writer.write(".method "); writeAccessFlags(writer, method.getAccessFlags()); writer.write(method.getName()); writer.write("("); ImmutableList<MethodParameter> methodParameters = ImmutableList.copyOf(method.getParameters()); for (MethodParameter parameter: methodParameters) { writer.write(parameter.getType()); } writer.write(")"); writer.write(method.getReturnType()); writer.write('\n'); writer.indent(4); writeParameters(writer, method, methodParameters, options); AnnotationFormatter.writeTo(writer, method.getAnnotations()); writer.deindent(4); writer.write(".end method\n"); } public void writeTo(IndentingWriter writer) throws IOException { int parameterRegisterCount = 0; if (!AccessFlags.STATIC.isSet(method.getAccessFlags())) { parameterRegisterCount++; } writer.write(".method "); writeAccessFlags(writer, method.getAccessFlags()); writer.write(method.getName()); writer.write("("); for (MethodParameter parameter: methodParameters) { String type = parameter.getType(); writer.write(type); parameterRegisterCount++; if (TypeUtils.isWideType(type)) { parameterRegisterCount++; } } writer.write(")"); writer.write(method.getReturnType()); writer.write('\n'); writer.indent(4); if (classDef.options.useLocalsDirective) { writer.write(".locals "); writer.printSignedIntAsDec(methodImpl.getRegisterCount() - parameterRegisterCount); } else { writer.write(".registers "); writer.printSignedIntAsDec(methodImpl.getRegisterCount()); } writer.write('\n'); writeParameters(writer, method, methodParameters, classDef.options); if (registerFormatter == null) { registerFormatter = new RegisterFormatter(classDef.options, methodImpl.getRegisterCount(), parameterRegisterCount); } AnnotationFormatter.writeTo(writer, method.getAnnotations()); writer.write('\n'); List<MethodItem> methodItems = getMethodItems(); for (MethodItem methodItem: methodItems) { if (methodItem.writeTo(writer)) { writer.write('\n'); } } writer.deindent(4); writer.write(".end method\n"); } public int findSwitchPayload(int targetOffset, Opcode type) { int targetIndex; try { targetIndex = instructionOffsetMap.getInstructionIndexAtCodeOffset(targetOffset); } catch (InvalidInstructionOffset ex) { throw new InvalidSwitchPayload(targetOffset); } //TODO: does dalvik let you pad with multiple nops? //TODO: does dalvik let a switch instruction point to a non-payload instruction? Instruction instruction = instructions.get(targetIndex); if (instruction.getOpcode() != type) { // maybe it's pointing to a NOP padding instruction. Look at the next instruction if (instruction.getOpcode() == Opcode.NOP) { targetIndex += 1; if (targetIndex < instructions.size()) { instruction = instructions.get(targetIndex); if (instruction.getOpcode() == type) { return instructionOffsetMap.getInstructionCodeOffset(targetIndex); } } } throw new InvalidSwitchPayload(targetOffset); } else { return targetOffset; } } private static void writeAccessFlags(IndentingWriter writer, int accessFlags) throws IOException { for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForMethod(accessFlags)) { writer.write(accessFlag.toString()); writer.write(' '); } } private static void writeParameters(IndentingWriter writer, Method method, List<? extends MethodParameter> parameters, baksmaliOptions options) throws IOException { boolean isStatic = AccessFlags.STATIC.isSet(method.getAccessFlags()); int registerNumber = isStatic?0:1; for (MethodParameter parameter: parameters) { String parameterType = parameter.getType(); String parameterName = parameter.getName(); Collection<? extends Annotation> annotations = parameter.getAnnotations(); if (parameterName != null || annotations.size() != 0) { writer.write(".param p"); writer.printSignedIntAsDec(registerNumber); if (parameterName != null && options.outputDebugInfo) { writer.write(", "); ReferenceFormatter.writeStringReference(writer, parameterName); } writer.write(" # "); writer.write(parameterType); writer.write("\n"); if (annotations.size() > 0) { writer.indent(4); AnnotationFormatter.writeTo(writer, annotations); writer.deindent(4); writer.write(".end param\n"); } } registerNumber++; if (TypeUtils.isWideType(parameterType)) { registerNumber++; } } } @Nonnull public LabelCache getLabelCache() { return labelCache; } public int getPackedSwitchBaseAddress(int packedSwitchPayloadCodeOffset) { return packedSwitchMap.get(packedSwitchPayloadCodeOffset, -1); } public int getSparseSwitchBaseAddress(int sparseSwitchPayloadCodeOffset) { return sparseSwitchMap.get(sparseSwitchPayloadCodeOffset, -1); } private List<MethodItem> getMethodItems() { ArrayList<MethodItem> methodItems = new ArrayList<MethodItem>(); if ((classDef.options.registerInfo != 0) || (classDef.options.deodex && needsAnalyzed())) { addAnalyzedInstructionMethodItems(methodItems); } else { addInstructionMethodItems(methodItems); } addTries(methodItems); if (classDef.options.outputDebugInfo) { addDebugInfo(methodItems); } if (classDef.options.useSequentialLabels) { setLabelSequentialNumbers(); } for (LabelMethodItem labelMethodItem: labelCache.getLabels()) { methodItems.add(labelMethodItem); } Collections.sort(methodItems); return methodItems; } private boolean needsAnalyzed() { for (Instruction instruction: methodImpl.getInstructions()) { if (instruction.getOpcode().odexOnly()) { return true; } } return false; } private void addInstructionMethodItems(List<MethodItem> methodItems) { int currentCodeAddress = 0; for (int i=0; i<instructions.size(); i++) { Instruction instruction = instructions.get(i); MethodItem methodItem = InstructionMethodItemFactory.makeInstructionFormatMethodItem(this, currentCodeAddress, instruction); methodItems.add(methodItem); if (i != instructions.size() - 1) { methodItems.add(new BlankMethodItem(currentCodeAddress)); } if (classDef.options.addCodeOffsets) { methodItems.add(new MethodItem(currentCodeAddress) { @Override public double getSortOrder() { return -1000; } @Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write("#@"); writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFFL); return true; } }); } if (!classDef.options.noAccessorComments && (instruction instanceof ReferenceInstruction)) { Opcode opcode = instruction.getOpcode(); if (opcode.referenceType == ReferenceType.METHOD) { MethodReference methodReference = null; try { methodReference = (MethodReference)((ReferenceInstruction)instruction).getReference(); } catch (InvalidItemIndex ex) { // just ignore it for now. We'll deal with it later, when processing the instructions // themselves } if (methodReference != null && SyntheticAccessorResolver.looksLikeSyntheticAccessor(methodReference.getName())) { SyntheticAccessorResolver.AccessedMember accessedMember = classDef.options.syntheticAccessorResolver.getAccessedMember(methodReference); if (accessedMember != null) { methodItems.add(new SyntheticAccessCommentMethodItem(accessedMember, currentCodeAddress)); } } } } currentCodeAddress += instruction.getCodeUnits(); } } private void addAnalyzedInstructionMethodItems(List<MethodItem> methodItems) { MethodAnalyzer methodAnalyzer = new MethodAnalyzer(classDef.options.classPath, method, classDef.options.inlineResolver); AnalysisException analysisException = methodAnalyzer.getAnalysisException(); if (analysisException != null) { // TODO: need to keep track of whether any errors occurred, so we can exit with a non-zero result methodItems.add(new CommentMethodItem( String.format("AnalysisException: %s", analysisException.getMessage()), analysisException.codeAddress, Integer.MIN_VALUE)); analysisException.printStackTrace(System.err); } List<AnalyzedInstruction> instructions = methodAnalyzer.getAnalyzedInstructions(); int currentCodeAddress = 0; for (int i=0; i<instructions.size(); i++) { AnalyzedInstruction instruction = instructions.get(i); MethodItem methodItem = InstructionMethodItemFactory.makeInstructionFormatMethodItem( this, currentCodeAddress, instruction.getInstruction()); methodItems.add(methodItem); if (instruction.getInstruction().getOpcode().format == Format.UnresolvedOdexInstruction) { methodItems.add(new CommentedOutMethodItem( InstructionMethodItemFactory.makeInstructionFormatMethodItem( this, currentCodeAddress, instruction.getOriginalInstruction()))); } if (i != instructions.size() - 1) { methodItems.add(new BlankMethodItem(currentCodeAddress)); } if (classDef.options.addCodeOffsets) { methodItems.add(new MethodItem(currentCodeAddress) { @Override public double getSortOrder() { return -1000; } @Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write("#@"); writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFFL); return true; } }); } if (classDef.options.registerInfo != 0 && !instruction.getInstruction().getOpcode().format.isPayloadFormat) { methodItems.add( new PreInstructionRegisterInfoMethodItem(classDef.options.registerInfo, methodAnalyzer, registerFormatter, instruction, currentCodeAddress)); methodItems.add( new PostInstructionRegisterInfoMethodItem(registerFormatter, instruction, currentCodeAddress)); } currentCodeAddress += instruction.getInstruction().getCodeUnits(); } } private void addTries(List<MethodItem> methodItems) { List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = methodImpl.getTryBlocks(); if (tryBlocks.size() == 0) { return; } int lastInstructionAddress = instructionOffsetMap.getInstructionCodeOffset(instructions.size() - 1); int codeSize = lastInstructionAddress + instructions.get(instructions.size() - 1).getCodeUnits(); for (TryBlock<? extends ExceptionHandler> tryBlock: tryBlocks) { int startAddress = tryBlock.getStartCodeAddress(); int endAddress = startAddress + tryBlock.getCodeUnitCount(); if (startAddress >= codeSize) { throw new RuntimeException(String.format("Try start offset %d is past the end of the code block.", startAddress)); } // Note: not >=. endAddress == codeSize is valid, when the try covers the last instruction if (endAddress > codeSize) { throw new RuntimeException(String.format("Try end offset %d is past the end of the code block.", endAddress)); } /** * The end address points to the address immediately after the end of the last * instruction that the try block covers. We want the .catch directive and end_try * label to be associated with the last covered instruction, so we need to get * the address for that instruction */ int lastCoveredIndex = instructionOffsetMap.getInstructionIndexAtCodeOffset(endAddress - 1, false); int lastCoveredAddress = instructionOffsetMap.getInstructionCodeOffset(lastCoveredIndex); for (ExceptionHandler handler: tryBlock.getExceptionHandlers()) { int handlerAddress = handler.getHandlerCodeAddress(); if (handlerAddress >= codeSize) { throw new ExceptionWithContext( "Exception handler offset %d is past the end of the code block.", handlerAddress); } //use the address from the last covered instruction CatchMethodItem catchMethodItem = new CatchMethodItem(classDef.options, labelCache, lastCoveredAddress, handler.getExceptionType(), startAddress, endAddress, handlerAddress); methodItems.add(catchMethodItem); } } } private void addDebugInfo(final List<MethodItem> methodItems) { for (DebugItem debugItem: methodImpl.getDebugItems()) { methodItems.add(DebugMethodItem.build(registerFormatter, debugItem)); } } private void setLabelSequentialNumbers() { HashMap<String, Integer> nextLabelSequenceByType = new HashMap<String, Integer>(); ArrayList<LabelMethodItem> sortedLabels = new ArrayList<LabelMethodItem>(labelCache.getLabels()); //sort the labels by their location in the method Collections.sort(sortedLabels); for (LabelMethodItem labelMethodItem: sortedLabels) { Integer labelSequence = nextLabelSequenceByType.get(labelMethodItem.getLabelPrefix()); if (labelSequence == null) { labelSequence = 0; } labelMethodItem.setLabelSequence(labelSequence); nextLabelSequenceByType.put(labelMethodItem.getLabelPrefix(), labelSequence + 1); } } public static class LabelCache { protected HashMap<LabelMethodItem, LabelMethodItem> labels = new HashMap<LabelMethodItem, LabelMethodItem>(); public LabelCache() { } public LabelMethodItem internLabel(LabelMethodItem labelMethodItem) { LabelMethodItem internedLabelMethodItem = labels.get(labelMethodItem); if (internedLabelMethodItem != null) { return internedLabelMethodItem; } labels.put(labelMethodItem, labelMethodItem); return labelMethodItem; } public Collection<LabelMethodItem> getLabels() { return labels.values(); } } public static class InvalidSwitchPayload extends ExceptionWithContext { private final int payloadOffset; public InvalidSwitchPayload(int payloadOffset) { super("No switch payload at offset: %d", payloadOffset); this.payloadOffset = payloadOffset; } public int getPayloadOffset() { return payloadOffset; } } }
{ "pile_set_name": "Github" }
using Ship; using System; using System.Collections.Generic; using UnityEngine; using Upgrade; namespace Abilities { public abstract class CombinedAbility : TemplateAbility { public abstract List<Type> CombinedAbilities { get; } private List<GenericAbility> StoredAbilities { get; } = new List<GenericAbility>(); public override void ActivateAbility() { if (StoredAbilities.Count == 0) { foreach (Type ability in CombinedAbilities) { StoredAbilities.Add((GenericAbility)Activator.CreateInstance(ability)); } } foreach (GenericAbility ability in StoredAbilities) { ability.Initialize(Selection.ThisShip); } } public override void DeactivateAbility() { foreach (GenericAbility ability in StoredAbilities) { ability.DeactivateAbility(); } } public override void Initialize(GenericShip hostShip) { if (StoredAbilities.Count == 0) { foreach (Type ability in CombinedAbilities) { StoredAbilities.Add((GenericAbility)Activator.CreateInstance(ability)); } } foreach (GenericAbility ability in StoredAbilities) { ability.Initialize(hostShip); } } public override void InitializeForSquadBuilder(GenericShip hostShip) { HostShip = HostUpgrade.HostShip; foreach (GenericAbility ability in StoredAbilities) { ability.InitializeForSquadBuilder(hostShip); } } public override void InitializeForSquadBuilder(GenericUpgrade hostUpgrade) { HostUpgrade = hostUpgrade; HostShip = HostUpgrade.HostShip; if (StoredAbilities.Count == 0) { foreach (Type ability in CombinedAbilities) { StoredAbilities.Add((GenericAbility)Activator.CreateInstance(ability)); } } foreach (GenericAbility ability in StoredAbilities) { ability.InitializeForSquadBuilder(hostUpgrade); } } } }
{ "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. */ /* * $Id: SAX2PrintHandlers.hpp 557282 2007-07-18 14:54:15Z amassari $ */ #include <xercesc/sax2/DefaultHandler.hpp> #include <xercesc/framework/XMLFormatter.hpp> XERCES_CPP_NAMESPACE_USE class SAX2PrintHandlers : public DefaultHandler, private XMLFormatTarget { public: // ----------------------------------------------------------------------- // Constructors // ----------------------------------------------------------------------- SAX2PrintHandlers ( const char* const encodingName , const XMLFormatter::UnRepFlags unRepFlags , const bool expandNamespaces ); ~SAX2PrintHandlers(); // ----------------------------------------------------------------------- // Implementations of the format target interface // ----------------------------------------------------------------------- void writeChars ( const XMLByte* const toWrite ); virtual void writeChars ( const XMLByte* const toWrite , const XMLSize_t count , XMLFormatter* const formatter ); // ----------------------------------------------------------------------- // Implementations of the SAX DocumentHandler interface // ----------------------------------------------------------------------- void endDocument(); void endElement( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname); void characters(const XMLCh* const chars, const XMLSize_t length); void ignorableWhitespace ( const XMLCh* const chars , const XMLSize_t length ); void processingInstruction ( const XMLCh* const target , const XMLCh* const data ); void startDocument(); void startElement( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attributes); // ----------------------------------------------------------------------- // Implementations of the SAX ErrorHandler interface // ----------------------------------------------------------------------- void warning(const SAXParseException& exc); void error(const SAXParseException& exc); void fatalError(const SAXParseException& exc); // ----------------------------------------------------------------------- // Implementation of the SAX DTDHandler interface // ----------------------------------------------------------------------- void notationDecl ( const XMLCh* const name , const XMLCh* const publicId , const XMLCh* const systemId ); void unparsedEntityDecl ( const XMLCh* const name , const XMLCh* const publicId , const XMLCh* const systemId , const XMLCh* const notationName ); private : // ----------------------------------------------------------------------- // Private data members // // fFormatter // This is the formatter object that is used to output the data // to the target. It is set up to format to the standard output // stream. // ----------------------------------------------------------------------- XMLFormatter fFormatter; bool fExpandNS ; };
{ "pile_set_name": "Github" }
int = 42 neg = -123 notint = 42 a toolarge = 10000000000000000000000 double = 3.14 expnot = 3.7e14 nan = 3 .14 danglingdot = 1. ----- HOCON_FILE HObjectEntries(OBJECT_ENTRIES) HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('int') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HNumber(NUMBER) PsiElement(UNQUOTED_CHARS)('42') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('neg') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HNumber(NUMBER) PsiElement(UNQUOTED_CHARS)('-123') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('notint') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HStringValue(STRING_VALUE) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('42') PsiWhiteSpace(' ') PsiElement(UNQUOTED_CHARS)('a') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('toolarge') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HStringValue(STRING_VALUE) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('10000000000000000000000') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('double') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HNumber(NUMBER) PsiElement(UNQUOTED_CHARS)('3') PsiElement(PERIOD)('.') PsiElement(UNQUOTED_CHARS)('14') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('expnot') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HNumber(NUMBER) PsiElement(UNQUOTED_CHARS)('3') PsiElement(PERIOD)('.') PsiElement(UNQUOTED_CHARS)('7e14') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('nan') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HStringValue(STRING_VALUE) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('3') PsiWhiteSpace(' ') PsiElement(PERIOD)('.') PsiElement(UNQUOTED_CHARS)('14') PsiWhiteSpace('\n') HObjectField(OBJECT_FIELD) HValuedField(VALUED_FIELD) HKey(KEY) HKeyPart(KEY_PART) HUnquotedString(UNQUOTED_STRING) PsiElement(UNQUOTED_CHARS)('danglingdot') PsiWhiteSpace(' ') PsiElement(EQUALS)('=') PsiWhiteSpace(' ') HNumber(NUMBER) PsiElement(UNQUOTED_CHARS)('1') PsiElement(PERIOD)('.')
{ "pile_set_name": "Github" }
require_relative '../../spec_helper' require_relative 'fixtures/classes' describe "Module#prepend_features" do it "is a private method" do Module.should have_private_instance_method(:prepend_features, true) end it "gets called when self is included in another module/class" do ScratchPad.record [] m = Module.new do def self.prepend_features(mod) ScratchPad << mod end end c = Class.new do prepend m end ScratchPad.recorded.should == [c] end it "raises an ArgumentError on a cyclic prepend" do -> { ModuleSpecs::CyclicPrepend.send(:prepend_features, ModuleSpecs::CyclicPrepend) }.should raise_error(ArgumentError) end ruby_version_is ''...'2.7' do it "copies own tainted status to the given module" do other = Module.new Module.new.taint.send :prepend_features, other other.tainted?.should be_true end it "copies own untrusted status to the given module" do other = Module.new Module.new.untrust.send :prepend_features, other other.untrusted?.should be_true end end it "clears caches of the given module" do parent = Class.new do def bar; :bar; end end child = Class.new(parent) do def foo; :foo; end def bar; super; end end mod = Module.new do def foo; :fooo; end end child.new.foo child.new.bar child.prepend(mod) child.new.bar.should == :bar end describe "on Class" do it "is undefined" do Class.should_not have_private_instance_method(:prepend_features, true) end it "raises a TypeError if calling after rebinded to Class" do -> { Module.instance_method(:prepend_features).bind(Class.new).call Module.new }.should raise_error(TypeError) end end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug Unicode|Win32"> <Configuration>Debug Unicode</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{8C7B228E-7EF7-4691-8B6C-724209CF031D}</ProjectGuid> <RootNamespace>WavPackDecoder</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <PlatformToolset>v110</PlatformToolset> <CharacterSet>NotSet</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <PlatformToolset>v110</PlatformToolset> <CharacterSet>NotSet</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v110</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(SolutionDir)src\common.props" /> <Import Project="$(SolutionDir)src\release.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(SolutionDir)src\common.props" /> <Import Project="$(SolutionDir)src\release.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <OutDir>$(SolutionDir)$(Configuration)\</OutDir> <IntDir>$(Configuration)\</IntDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <OutDir>$(SolutionDir)\out\bin\</OutDir> <IntDir>$(SolutionDir)\out\obj\$(ProjectName)\</IntDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'"> <OutDir>$(SolutionDir)\out\bin\</OutDir> <IntDir>$(SolutionDir)\out\obj\$(ProjectName)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <AdditionalIncludeDirectories>..\..\BaseClasses;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'"> <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <AdditionalIncludeDirectories>..\..\BaseClasses;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\IWavPackDSDecoder.h" /> <ClInclude Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\resource.h" /> <ClInclude Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoder.h" /> <ClInclude Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoderAboutProp.h" /> <ClInclude Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoderInfoProp.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoder.cpp" /> <ClCompile Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoderAboutProp.cpp" /> <ClCompile Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoderInfoProp.cpp" /> </ItemGroup> <ItemGroup> <None Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoder.def" /> </ItemGroup> <ItemGroup> <ResourceCompile Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\WavPackDSDecoder\WavPackDSDecoder.rc" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\..\Thirdparty\wavpack-ds-wavpack-directshow\wavpack\libwavpack.vcxproj"> <Project>{5cccb9cf-0384-458f-ba08-72b73866840f}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>
{ "pile_set_name": "Github" }
A function which calls the two provided functions and returns the `&&` of the results. It returns the result of the first function if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning that the second function will not be invoked if the first returns a false-y value. In addition to functions, `R.both` also accepts any fantasy-land compatible applicative functor. @func @memberOf R @since v0.12.0 @category Logic @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) @param {Function} f A predicate @param {Function} g Another predicate @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together. @see R.and @example var gt10 = R.gt(R.__, 10) var lt20 = R.lt(R.__, 20) var f = R.both(gt10, lt20); f(15); //=> true f(30); //=> false
{ "pile_set_name": "Github" }
/* * Copyright (c) 2017 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ package org.eclipse.ditto.protocoladapter; import java.net.URI; import java.text.MessageFormat; import javax.annotation.Nullable; import javax.annotation.concurrent.NotThreadSafe; import org.eclipse.ditto.json.JsonObject; import org.eclipse.ditto.model.base.common.HttpStatusCode; import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException; import org.eclipse.ditto.model.base.exceptions.DittoRuntimeExceptionBuilder; import org.eclipse.ditto.model.base.headers.DittoHeaders; import org.eclipse.ditto.model.base.json.JsonParsableException; /** * Thrown if a {@link org.eclipse.ditto.signals.commands.base.CommandResponse} is not supported. */ @JsonParsableException(errorCode = UnknownCommandResponseException.ERROR_CODE) public final class UnknownCommandResponseException extends DittoRuntimeException { /** * Error code of this exception. */ public static final String ERROR_CODE = "things.protocol.adapter:unknown.response"; private static final String MESSAGE_TEMPLATE = "The response ''{0}'' is not supported by the adapter."; private static final String DEFAULT_DESCRIPTION = "Check if the response is correct."; private static final long serialVersionUID = 3886410099324151406L; private UnknownCommandResponseException(final DittoHeaders dittoHeaders, @Nullable final String message, @Nullable final String description, @Nullable final Throwable cause, @Nullable final URI href) { super(ERROR_CODE, HttpStatusCode.BAD_REQUEST, dittoHeaders, message, description, cause, href); } /** * A mutable builder for a {@code UnknownCommandResponseException}. * * @param responseName the response not supported. * @return the builder. */ public static Builder newBuilder(final String responseName) { return new Builder(responseName); } /** * Constructs a new {@code UnknownCommandResponseException} object with given message. * * @param message detail message. This message can be later retrieved by the {@link #getMessage()} method. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new UnknownCommandResponseException. * @throws NullPointerException if {@code dittoHeaders} is {@code null}. */ public static UnknownCommandResponseException fromMessage(@Nullable final String message, final DittoHeaders dittoHeaders) { return DittoRuntimeException.fromMessage(message, dittoHeaders, new Builder()); } /** * Constructs a new {@code UnknownCommandResponseException} object with the exception message extracted from the * given JSON object. * * @param jsonObject the JSON to read the {@link DittoRuntimeException.JsonFields#MESSAGE} field from. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new UnknownCommandResponseException. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if this JsonObject did not contain an error message. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static UnknownCommandResponseException fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return DittoRuntimeException.fromJson(jsonObject, dittoHeaders, new Builder()); } /** * A mutable builder with a fluent API for a {@link UnknownCommandResponseException}. */ @NotThreadSafe public static final class Builder extends DittoRuntimeExceptionBuilder<UnknownCommandResponseException> { private Builder() { description(DEFAULT_DESCRIPTION); } private Builder(final String responseName) { this(); message(MessageFormat.format(MESSAGE_TEMPLATE, responseName)); } @Override protected UnknownCommandResponseException doBuild(final DittoHeaders dittoHeaders, @Nullable final String message, @Nullable final String description, @Nullable final Throwable cause, @Nullable final URI href) { return new UnknownCommandResponseException(dittoHeaders, message, description, cause, href); } } }
{ "pile_set_name": "Github" }
#!/bin/sh # # Script to create an m2 POM from a library and its related artifacts # # USAGE # mkpom.sh file.jar [file-sources.jar] [file-javadoc.jar] # # The target repository path DEPENDENCIES="." # Maven expects hexadecimal letters as lowercase so you might have to add -l here MD5="md5sum" if [ $# = 1 ] then echo "Enter groupId (can be multi-part, such as javax.mail):" read groupId echo "Enter artifactId:" read artifactId echo "Enter version:" read version echo "Enter classifier:" read classifier # Convert the group's package to a path (e.g. javax.mail --> javax/mail) groupPath=`echo $groupId | sed s*[.]*/*g` # Create file name path=$DEPENDENCIES/$groupPath/$artifactId/$version if [[ "$classifier" > "" ]]; then file=$artifactId-$version-$classifier else file=$artifactId-$version fi echo "Creating directory $path" mkdir -p $path echo "Setting directory privileges" chmod -fR 775 $DEPENDENCIES echo "Installing library as $file.jar" cp $1 $path/$file.jar echo "Generating basic POM" echo "<project>" > $path/$file.pom echo " <modelVersion>4.0.0</modelVersion>" >> $path/$file.pom echo " <groupId>$groupId</groupId>" >> $path/$file.pom echo " <artifactId>$artifactId</artifactId>" >> $path/$file.pom echo " <version>$version</version>" >> $path/$file.pom if [[ "$classifier" > "" ]] ; then echo " <classifier>$classifier</classifier>" >> $path/$file.pom fi echo "</project>" >> $path/$file.pom echo "Generating checksums" $MD5 $path/$file.jar > $path/$file.jar.md5 $MD5 $path/$file.pom > $path/$file.pom.md5 # optional sources sources=`basename $1 .jar`-sources.jar if [ -f $sources ]; then echo "Copying sources to $file-sources.jar" cp $sources $path/$file-sources.jar $MD5 $path/$file-sources.jar > $path/$file-sources.jar.md5 fi # optional javadoc javadoc=`basename $1 .jar`-javadoc.jar if [ -f $javadoc ]; then echo "Copying javadoc to $file-javadoc.jar" cp $javadoc $path/$file-javadoc.jar $MD5 $path/$file-javadoc.jar > $path/$file-javadoc.jar.md5 fi echo "Setting file privileges" chmod 664 $path/* else echo "Usage: `basename $0` <file>.jar [<file>-sources.jar] [<file>-javadoc.jar]" fi
{ "pile_set_name": "Github" }
# Copyright 2020 QuantumBlack Visual Analytics Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # 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 WILL THE LICENSOR OR OTHER CONTRIBUTORS # 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. # # The QuantumBlack Visual Analytics Limited ("QuantumBlack") name and logo # (either separately or in combination, "QuantumBlack Trademarks") are # trademarks of QuantumBlack. The License does not grant you any right or # license to the QuantumBlack Trademarks. You may not use the QuantumBlack # Trademarks or any confusingly similar mark as a trademark for your product, # or use the QuantumBlack Trademarks in any other manner that might cause # confusion in the marketplace, including but not limited to in advertising, # on websites, or on software. # # See the License for the specific language governing permissions and # limitations under the License. from pathlib import Path, PurePosixPath from time import sleep import pytest from fsspec.implementations.http import HTTPFileSystem from fsspec.implementations.local import LocalFileSystem from PIL import Image, ImageChops from s3fs.core import S3FileSystem from kedro.extras.datasets.pillow import ImageDataSet from kedro.io import DataSetError from kedro.io.core import PROTOCOL_DELIMITER, Version, generate_timestamp @pytest.fixture def filepath_png(tmp_path): return (tmp_path / "test.png").as_posix() @pytest.fixture def image_dataset(filepath_png, save_args, fs_args): return ImageDataSet(filepath=filepath_png, save_args=save_args, fs_args=fs_args) @pytest.fixture def versioned_image_dataset(filepath_png, load_version, save_version): return ImageDataSet( filepath=filepath_png, version=Version(load_version, save_version) ) @pytest.fixture(scope="module") def image_object(): filepath = str(Path(__file__).parent / "data/image.png") return Image.open(filepath).copy() def images_equal(image_1, image_2): diff = ImageChops.difference(image_1, image_2) return not diff.getbbox() class TestImageDataSet: def test_save_and_load(self, image_dataset, image_object): """Test saving and reloading the data set.""" image_dataset.save(image_object) reloaded_image = image_dataset.load() assert images_equal(image_object, reloaded_image) assert image_dataset._fs_open_args_save == {"mode": "wb"} def test_exists(self, image_dataset, image_object): """Test `exists` method invocation for both existing and nonexistent data set.""" assert not image_dataset.exists() image_dataset.save(image_object) assert image_dataset.exists() @pytest.mark.parametrize( "save_args", [{"format": "png", "index": "value"}], indirect=True ) def test_load_extra_params(self, image_dataset, save_args): """Test overriding the default load arguments.""" for key, value in save_args.items(): assert image_dataset._save_args[key] == value @pytest.mark.parametrize( "fs_args", [ { "open_args_load": {"mode": "r", "compression": "gzip"}, "open_args_save": {"fs_save": "fs_save"}, } ], indirect=True, ) def test_open_extra_args(self, image_dataset, fs_args): assert image_dataset._fs_open_args_load == fs_args["open_args_load"] expected_save_fs_args = {"mode": "wb"} # default expected_save_fs_args.update(fs_args["open_args_save"]) assert image_dataset._fs_open_args_save == expected_save_fs_args def test_load_missing_file(self, image_dataset): """Check the error when trying to load missing file.""" pattern = r"Failed while loading data from data set ImageDataSet\(.*\)" with pytest.raises(DataSetError, match=pattern): image_dataset.load() @pytest.mark.parametrize( "filepath,instance_type", [ ("s3://bucket/file.png", S3FileSystem), ("file:///tmp/test.png", LocalFileSystem), ("/tmp/test.png", LocalFileSystem), ("https://example.com/file.png", HTTPFileSystem), ], ) def test_protocol_usage(self, filepath, instance_type): data_set = ImageDataSet(filepath=filepath) assert isinstance(data_set._fs, instance_type) path = filepath.split(PROTOCOL_DELIMITER, 1)[-1] assert str(data_set._filepath) == path assert isinstance(data_set._filepath, PurePosixPath) def test_catalog_release(self, mocker): fs_mock = mocker.patch("fsspec.filesystem").return_value filepath = "test.png" data_set = ImageDataSet(filepath=filepath) data_set.release() fs_mock.invalidate_cache.assert_called_once_with(filepath) class TestImageDataSetVersioned: def test_version_str_repr(self, load_version, save_version): """Test that version is in string representation of the class instance when applicable.""" filepath = "/tmp/test.png" ds = ImageDataSet(filepath=filepath) ds_versioned = ImageDataSet( filepath=filepath, version=Version(load_version, save_version) ) assert filepath in str(ds) assert filepath in str(ds_versioned) assert "version" not in str(ds) ver_str = f"version=Version(load={load_version}, save='{save_version}')" assert ver_str in str(ds_versioned) assert "ImageDataSet" in str(ds_versioned) assert "ImageDataSet" in str(ds) assert "protocol" in str(ds_versioned) assert "protocol" in str(ds) def test_save_and_load(self, versioned_image_dataset, image_object): """Test that saved and reloaded data matches the original one for the versioned data set.""" versioned_image_dataset.save(image_object) reloaded_image = versioned_image_dataset.load() assert images_equal(image_object, reloaded_image) def test_multiple_loads(self, versioned_image_dataset, image_object, filepath_png): """Test that if a new version is created mid-run, by an external system, it won't be loaded in the current run.""" versioned_image_dataset.save(image_object) v1 = versioned_image_dataset.resolve_load_version() # Sometimes for some reason `v1 == v_new` on Windows. # `sleep()` was added to fix this. sleep(0.5) # force-drop a newer version into the same location v_new = generate_timestamp() ImageDataSet(filepath=filepath_png, version=Version(v_new, v_new)).save( image_object ) v2 = versioned_image_dataset.resolve_load_version() assert v2 == v1 # v2 should not be v_new! ds_new = ImageDataSet(filepath=filepath_png, version=Version(None, None)) assert ( ds_new.resolve_load_version() == v_new ) # new version is discoverable by a new instance def test_no_versions(self, versioned_image_dataset): """Check the error if no versions are available for load.""" pattern = r"Did not find any versions for ImageDataSet\(.+\)" with pytest.raises(DataSetError, match=pattern): versioned_image_dataset.load() def test_exists(self, versioned_image_dataset, image_object): """Test `exists` method invocation for versioned data set.""" assert not versioned_image_dataset.exists() versioned_image_dataset.save(image_object) assert versioned_image_dataset.exists() def test_prevent_overwrite(self, versioned_image_dataset, image_object): """Check the error when attempting to override the data set if the corresponding image file for a given save version already exists.""" versioned_image_dataset.save(image_object) pattern = ( r"Save path \`.+\` for ImageDataSet\(.+\) must " r"not exist if versioning is enabled\." ) with pytest.raises(DataSetError, match=pattern): versioned_image_dataset.save(image_object) @pytest.mark.parametrize( "load_version", ["2019-01-01T23.59.59.999Z"], indirect=True ) @pytest.mark.parametrize( "save_version", ["2019-01-02T00.00.00.000Z"], indirect=True ) def test_save_version_warning( self, versioned_image_dataset, load_version, save_version, image_object ): """Check the warning when saving to the path that differs from the subsequent load path.""" pattern = ( r"Save version `{0}` did not match load version `{1}` " r"for ImageDataSet\(.+\)".format(save_version, load_version) ) with pytest.warns(UserWarning, match=pattern): versioned_image_dataset.save(image_object) def test_http_filesystem_no_versioning(self): pattern = r"HTTP\(s\) DataSet doesn't support versioning\." with pytest.raises(DataSetError, match=pattern): ImageDataSet( filepath="https://example.com/file.png", version=Version(None, None) )
{ "pile_set_name": "Github" }
require_relative './helper' class VerboseFormatterTest < Test::Unit::TestCase def setup require_relative File.join(DidYouMean::TestHelper.root, 'verbose') DidYouMean.formatter = DidYouMean::VerboseFormatter.new end def teardown DidYouMean.formatter = DidYouMean::PlainFormatter.new end def test_message @error = assert_raise(NoMethodError){ 1.zeor? } assert_match <<~MESSAGE.strip, @error.message undefined method `zeor?' for 1:Integer Did you mean? zero? MESSAGE end end
{ "pile_set_name": "Github" }
var util = require('../util'); var arrow = util.arrow; module.exports = { key: 'queen', title: 'theQueen', subtitle: 'queenCombinesRookAndBishop', image: util.assetUrl + 'images/learn/pieces/Q.svg', intro: 'queenIntro', illustration: util.pieceImg('queen'), levels: [{ goal: 'grabAllTheStars', fen: '8/8/8/8/8/8/4Q3/8 w - -', apples: 'e5 b8', nbMoves: 2, shapes: [arrow('e2e5'), arrow('e5b8')] }, { goal: 'grabAllTheStars', fen: '8/8/8/8/3Q4/8/8/8 w - -', apples: 'a3 f2 f8 h3', nbMoves: 4 }, { goal: 'grabAllTheStars', fen: '8/8/8/8/2Q5/8/8/8 w - -', apples: 'a3 d6 f1 f8 g3 h6', nbMoves: 6 }, { goal: 'grabAllTheStars', fen: '8/6Q1/8/8/8/8/8/8 w - -', apples: 'a2 b5 d3 g1 g8 h2 h5', nbMoves: 7 }, { goal: 'grabAllTheStars', fen: '8/8/8/8/8/8/8/4Q3 w - -', apples: 'a6 d1 f2 f6 g6 g8 h1 h4', nbMoves: 9 }].map(util.toLevel), complete: 'queenComplete' };
{ "pile_set_name": "Github" }
/* * Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com> * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Standard functionality for the common clock API. See Documentation/clk.txt */ #include <linux/clk-private.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/err.h> #include <linux/list.h> #include <linux/slab.h> #include <linux/of.h> #include <linux/device.h> #include <linux/init.h> #include <linux/sched.h> static DEFINE_SPINLOCK(enable_lock); static DEFINE_MUTEX(prepare_lock); static struct task_struct *prepare_owner; static struct task_struct *enable_owner; static int prepare_refcnt; static int enable_refcnt; static HLIST_HEAD(clk_root_list); static HLIST_HEAD(clk_orphan_list); static LIST_HEAD(clk_notifier_list); /*** locking ***/ static void clk_prepare_lock(void) { if (!mutex_trylock(&prepare_lock)) { if (prepare_owner == current) { prepare_refcnt++; return; } mutex_lock(&prepare_lock); } WARN_ON_ONCE(prepare_owner != NULL); WARN_ON_ONCE(prepare_refcnt != 0); prepare_owner = current; prepare_refcnt = 1; } static void clk_prepare_unlock(void) { WARN_ON_ONCE(prepare_owner != current); WARN_ON_ONCE(prepare_refcnt == 0); if (--prepare_refcnt) return; prepare_owner = NULL; mutex_unlock(&prepare_lock); } static unsigned long clk_enable_lock(void) { unsigned long flags; if (!spin_trylock_irqsave(&enable_lock, flags)) { if (enable_owner == current) { enable_refcnt++; return flags; } spin_lock_irqsave(&enable_lock, flags); } WARN_ON_ONCE(enable_owner != NULL); WARN_ON_ONCE(enable_refcnt != 0); enable_owner = current; enable_refcnt = 1; return flags; } static void clk_enable_unlock(unsigned long flags) { WARN_ON_ONCE(enable_owner != current); WARN_ON_ONCE(enable_refcnt == 0); if (--enable_refcnt) return; enable_owner = NULL; spin_unlock_irqrestore(&enable_lock, flags); } /*** debugfs support ***/ #ifdef CONFIG_COMMON_CLK_DEBUG #include <linux/debugfs.h> static struct dentry *rootdir; static struct dentry *orphandir; static int inited = 0; static void clk_summary_show_one(struct seq_file *s, struct clk *c, int level) { if (!c) return; seq_printf(s, "%*s%-*s %-11d %-12d %-10lu", level * 3 + 1, "", 30 - level * 3, c->name, c->enable_count, c->prepare_count, c->rate); seq_printf(s, "\n"); } static void clk_summary_show_subtree(struct seq_file *s, struct clk *c, int level) { struct clk *child; if (!c) return; clk_summary_show_one(s, c, level); hlist_for_each_entry(child, &c->children, child_node) clk_summary_show_subtree(s, child, level + 1); } static int clk_summary_show(struct seq_file *s, void *data) { struct clk *c; seq_printf(s, " clock enable_cnt prepare_cnt rate\n"); seq_printf(s, "---------------------------------------------------------------------\n"); clk_prepare_lock(); hlist_for_each_entry(c, &clk_root_list, child_node) clk_summary_show_subtree(s, c, 0); hlist_for_each_entry(c, &clk_orphan_list, child_node) clk_summary_show_subtree(s, c, 0); clk_prepare_unlock(); return 0; } static int clk_summary_open(struct inode *inode, struct file *file) { return single_open(file, clk_summary_show, inode->i_private); } static const struct file_operations clk_summary_fops = { .open = clk_summary_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static void clk_dump_one(struct seq_file *s, struct clk *c, int level) { if (!c) return; seq_printf(s, "\"%s\": { ", c->name); seq_printf(s, "\"enable_count\": %d,", c->enable_count); seq_printf(s, "\"prepare_count\": %d,", c->prepare_count); seq_printf(s, "\"rate\": %lu", c->rate); } static void clk_dump_subtree(struct seq_file *s, struct clk *c, int level) { struct clk *child; if (!c) return; clk_dump_one(s, c, level); hlist_for_each_entry(child, &c->children, child_node) { seq_printf(s, ","); clk_dump_subtree(s, child, level + 1); } seq_printf(s, "}"); } static int clk_dump(struct seq_file *s, void *data) { struct clk *c; bool first_node = true; seq_printf(s, "{"); clk_prepare_lock(); hlist_for_each_entry(c, &clk_root_list, child_node) { if (!first_node) seq_printf(s, ","); first_node = false; clk_dump_subtree(s, c, 0); } hlist_for_each_entry(c, &clk_orphan_list, child_node) { seq_printf(s, ","); clk_dump_subtree(s, c, 0); } clk_prepare_unlock(); seq_printf(s, "}"); return 0; } static int clk_dump_open(struct inode *inode, struct file *file) { return single_open(file, clk_dump, inode->i_private); } static const struct file_operations clk_dump_fops = { .open = clk_dump_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; /* caller must hold prepare_lock */ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry) { struct dentry *d; int ret = -ENOMEM; if (!clk || !pdentry) { ret = -EINVAL; goto out; } d = debugfs_create_dir(clk->name, pdentry); if (!d) goto out; clk->dentry = d; d = debugfs_create_u32("clk_rate", S_IRUGO, clk->dentry, (u32 *)&clk->rate); if (!d) goto err_out; d = debugfs_create_x32("clk_flags", S_IRUGO, clk->dentry, (u32 *)&clk->flags); if (!d) goto err_out; d = debugfs_create_u32("clk_prepare_count", S_IRUGO, clk->dentry, (u32 *)&clk->prepare_count); if (!d) goto err_out; d = debugfs_create_u32("clk_enable_count", S_IRUGO, clk->dentry, (u32 *)&clk->enable_count); if (!d) goto err_out; d = debugfs_create_u32("clk_notifier_count", S_IRUGO, clk->dentry, (u32 *)&clk->notifier_count); if (!d) goto err_out; ret = 0; goto out; err_out: debugfs_remove(clk->dentry); out: return ret; } /* caller must hold prepare_lock */ static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry) { struct clk *child; int ret = -EINVAL;; if (!clk || !pdentry) goto out; ret = clk_debug_create_one(clk, pdentry); if (ret) goto out; hlist_for_each_entry(child, &clk->children, child_node) clk_debug_create_subtree(child, clk->dentry); ret = 0; out: return ret; } /** * clk_debug_register - add a clk node to the debugfs clk tree * @clk: the clk being added to the debugfs clk tree * * Dynamically adds a clk to the debugfs clk tree if debugfs has been * initialized. Otherwise it bails out early since the debugfs clk tree * will be created lazily by clk_debug_init as part of a late_initcall. * * Caller must hold prepare_lock. Only clk_init calls this function (so * far) so this is taken care. */ static int clk_debug_register(struct clk *clk) { struct clk *parent; struct dentry *pdentry; int ret = 0; if (!inited) goto out; parent = clk->parent; /* * Check to see if a clk is a root clk. Also check that it is * safe to add this clk to debugfs */ if (!parent) if (clk->flags & CLK_IS_ROOT) pdentry = rootdir; else pdentry = orphandir; else if (parent->dentry) pdentry = parent->dentry; else goto out; ret = clk_debug_create_subtree(clk, pdentry); out: return ret; } /** * clk_debug_reparent - reparent clk node in the debugfs clk tree * @clk: the clk being reparented * @new_parent: the new clk parent, may be NULL * * Rename clk entry in the debugfs clk tree if debugfs has been * initialized. Otherwise it bails out early since the debugfs clk tree * will be created lazily by clk_debug_init as part of a late_initcall. * * Caller must hold prepare_lock. */ static void clk_debug_reparent(struct clk *clk, struct clk *new_parent) { struct dentry *d; struct dentry *new_parent_d; if (!inited) return; if (new_parent) new_parent_d = new_parent->dentry; else new_parent_d = orphandir; d = debugfs_rename(clk->dentry->d_parent, clk->dentry, new_parent_d, clk->name); if (d) clk->dentry = d; else pr_debug("%s: failed to rename debugfs entry for %s\n", __func__, clk->name); } /** * clk_debug_init - lazily create the debugfs clk tree visualization * * clks are often initialized very early during boot before memory can * be dynamically allocated and well before debugfs is setup. * clk_debug_init walks the clk tree hierarchy while holding * prepare_lock and creates the topology as part of a late_initcall, * thus insuring that clks initialized very early will still be * represented in the debugfs clk tree. This function should only be * called once at boot-time, and all other clks added dynamically will * be done so with clk_debug_register. */ static int __init clk_debug_init(void) { struct clk *clk; struct dentry *d; rootdir = debugfs_create_dir("clk", NULL); if (!rootdir) return -ENOMEM; d = debugfs_create_file("clk_summary", S_IRUGO, rootdir, NULL, &clk_summary_fops); if (!d) return -ENOMEM; d = debugfs_create_file("clk_dump", S_IRUGO, rootdir, NULL, &clk_dump_fops); if (!d) return -ENOMEM; orphandir = debugfs_create_dir("orphans", rootdir); if (!orphandir) return -ENOMEM; clk_prepare_lock(); hlist_for_each_entry(clk, &clk_root_list, child_node) clk_debug_create_subtree(clk, rootdir); hlist_for_each_entry(clk, &clk_orphan_list, child_node) clk_debug_create_subtree(clk, orphandir); inited = 1; clk_prepare_unlock(); return 0; } late_initcall(clk_debug_init); #else static inline int clk_debug_register(struct clk *clk) { return 0; } static inline void clk_debug_reparent(struct clk *clk, struct clk *new_parent) { } #endif /* caller must hold prepare_lock */ static void clk_unprepare_unused_subtree(struct clk *clk) { struct clk *child; if (!clk) return; hlist_for_each_entry(child, &clk->children, child_node) clk_unprepare_unused_subtree(child); if (clk->prepare_count) return; if (clk->flags & CLK_IGNORE_UNUSED) return; if (__clk_is_prepared(clk)) { if (clk->ops->unprepare_unused) clk->ops->unprepare_unused(clk->hw); else if (clk->ops->unprepare) clk->ops->unprepare(clk->hw); } } EXPORT_SYMBOL_GPL(__clk_get_flags); /* caller must hold prepare_lock */ static void clk_disable_unused_subtree(struct clk *clk) { struct clk *child; unsigned long flags; if (!clk) goto out; hlist_for_each_entry(child, &clk->children, child_node) clk_disable_unused_subtree(child); flags = clk_enable_lock(); if (clk->enable_count) goto unlock_out; if (clk->flags & CLK_IGNORE_UNUSED) goto unlock_out; /* * some gate clocks have special needs during the disable-unused * sequence. call .disable_unused if available, otherwise fall * back to .disable */ if (__clk_is_enabled(clk)) { if (clk->ops->disable_unused) clk->ops->disable_unused(clk->hw); else if (clk->ops->disable) clk->ops->disable(clk->hw); } unlock_out: clk_enable_unlock(flags); out: return; } static bool clk_ignore_unused; static int __init clk_ignore_unused_setup(char *__unused) { clk_ignore_unused = true; return 1; } __setup("clk_ignore_unused", clk_ignore_unused_setup); static int clk_disable_unused(void) { struct clk *clk; if (clk_ignore_unused) { pr_warn("clk: Not disabling unused clocks\n"); return 0; } clk_prepare_lock(); hlist_for_each_entry(clk, &clk_root_list, child_node) clk_disable_unused_subtree(clk); hlist_for_each_entry(clk, &clk_orphan_list, child_node) clk_disable_unused_subtree(clk); hlist_for_each_entry(clk, &clk_root_list, child_node) clk_unprepare_unused_subtree(clk); hlist_for_each_entry(clk, &clk_orphan_list, child_node) clk_unprepare_unused_subtree(clk); clk_prepare_unlock(); return 0; } late_initcall(clk_disable_unused); /*** helper functions ***/ const char *__clk_get_name(struct clk *clk) { return !clk ? NULL : clk->name; } EXPORT_SYMBOL_GPL(__clk_get_name); struct clk_hw *__clk_get_hw(struct clk *clk) { return !clk ? NULL : clk->hw; } u8 __clk_get_num_parents(struct clk *clk) { return !clk ? 0 : clk->num_parents; } struct clk *__clk_get_parent(struct clk *clk) { return !clk ? NULL : clk->parent; } unsigned int __clk_get_enable_count(struct clk *clk) { return !clk ? 0 : clk->enable_count; } unsigned int __clk_get_prepare_count(struct clk *clk) { return !clk ? 0 : clk->prepare_count; } unsigned long __clk_get_rate(struct clk *clk) { unsigned long ret; if (!clk) { ret = 0; goto out; } ret = clk->rate; if (clk->flags & CLK_IS_ROOT) goto out; if (!clk->parent) ret = 0; out: return ret; } unsigned long __clk_get_flags(struct clk *clk) { return !clk ? 0 : clk->flags; } bool __clk_is_prepared(struct clk *clk) { int ret; if (!clk) return false; /* * .is_prepared is optional for clocks that can prepare * fall back to software usage counter if it is missing */ if (!clk->ops->is_prepared) { ret = clk->prepare_count ? 1 : 0; goto out; } ret = clk->ops->is_prepared(clk->hw); out: return !!ret; } bool __clk_is_enabled(struct clk *clk) { int ret; if (!clk) return false; /* * .is_enabled is only mandatory for clocks that gate * fall back to software usage counter if .is_enabled is missing */ if (!clk->ops->is_enabled) { ret = clk->enable_count ? 1 : 0; goto out; } ret = clk->ops->is_enabled(clk->hw); out: return !!ret; } static struct clk *__clk_lookup_subtree(const char *name, struct clk *clk) { struct clk *child; struct clk *ret; if (!strcmp(clk->name, name)) return clk; hlist_for_each_entry(child, &clk->children, child_node) { ret = __clk_lookup_subtree(name, child); if (ret) return ret; } return NULL; } struct clk *__clk_lookup(const char *name) { struct clk *root_clk; struct clk *ret; if (!name) return NULL; /* search the 'proper' clk tree first */ hlist_for_each_entry(root_clk, &clk_root_list, child_node) { ret = __clk_lookup_subtree(name, root_clk); if (ret) return ret; } /* if not found, then search the orphan tree */ hlist_for_each_entry(root_clk, &clk_orphan_list, child_node) { ret = __clk_lookup_subtree(name, root_clk); if (ret) return ret; } return NULL; } EXPORT_SYMBOL(__clk_lookup); /*** clk api ***/ void __clk_unprepare(struct clk *clk) { if (!clk) return; if (WARN_ON(clk->prepare_count == 0)) return; if (--clk->prepare_count > 0) return; WARN_ON(clk->enable_count > 0); if (clk->ops->unprepare) clk->ops->unprepare(clk->hw); __clk_unprepare(clk->parent); } /** * clk_unprepare - undo preparation of a clock source * @clk: the clk being unprepare * * clk_unprepare may sleep, which differentiates it from clk_disable. In a * simple case, clk_unprepare can be used instead of clk_disable to gate a clk * if the operation may sleep. One example is a clk which is accessed over * I2c. In the complex case a clk gate operation may require a fast and a slow * part. It is this reason that clk_unprepare and clk_disable are not mutually * exclusive. In fact clk_disable must be called before clk_unprepare. */ void clk_unprepare(struct clk *clk) { clk_prepare_lock(); __clk_unprepare(clk); clk_prepare_unlock(); } EXPORT_SYMBOL_GPL(clk_unprepare); int __clk_prepare(struct clk *clk) { int ret = 0; if (!clk) return 0; if (clk->prepare_count == 0) { ret = __clk_prepare(clk->parent); if (ret) return ret; if (clk->ops->prepare) { ret = clk->ops->prepare(clk->hw); if (ret) { __clk_unprepare(clk->parent); return ret; } } } clk->prepare_count++; return 0; } /** * clk_prepare - prepare a clock source * @clk: the clk being prepared * * clk_prepare may sleep, which differentiates it from clk_enable. In a simple * case, clk_prepare can be used instead of clk_enable to ungate a clk if the * operation may sleep. One example is a clk which is accessed over I2c. In * the complex case a clk ungate operation may require a fast and a slow part. * It is this reason that clk_prepare and clk_enable are not mutually * exclusive. In fact clk_prepare must be called before clk_enable. * Returns 0 on success, -EERROR otherwise. */ int clk_prepare(struct clk *clk) { int ret; clk_prepare_lock(); ret = __clk_prepare(clk); clk_prepare_unlock(); return ret; } EXPORT_SYMBOL_GPL(clk_prepare); static void __clk_disable(struct clk *clk) { if (!clk) return; if (WARN_ON(IS_ERR(clk))) return; if (WARN_ON(clk->enable_count == 0)) return; if (--clk->enable_count > 0) return; if (clk->ops->disable) clk->ops->disable(clk->hw); __clk_disable(clk->parent); } /** * clk_disable - gate a clock * @clk: the clk being gated * * clk_disable must not sleep, which differentiates it from clk_unprepare. In * a simple case, clk_disable can be used instead of clk_unprepare to gate a * clk if the operation is fast and will never sleep. One example is a * SoC-internal clk which is controlled via simple register writes. In the * complex case a clk gate operation may require a fast and a slow part. It is * this reason that clk_unprepare and clk_disable are not mutually exclusive. * In fact clk_disable must be called before clk_unprepare. */ void clk_disable(struct clk *clk) { unsigned long flags; flags = clk_enable_lock(); __clk_disable(clk); clk_enable_unlock(flags); } EXPORT_SYMBOL_GPL(clk_disable); static int __clk_enable(struct clk *clk) { int ret = 0; if (!clk) return 0; if (WARN_ON(clk->prepare_count == 0)) return -ESHUTDOWN; if (clk->enable_count == 0) { ret = __clk_enable(clk->parent); if (ret) return ret; if (clk->ops->enable) { ret = clk->ops->enable(clk->hw); if (ret) { __clk_disable(clk->parent); return ret; } } } clk->enable_count++; return 0; } /** * clk_enable - ungate a clock * @clk: the clk being ungated * * clk_enable must not sleep, which differentiates it from clk_prepare. In a * simple case, clk_enable can be used instead of clk_prepare to ungate a clk * if the operation will never sleep. One example is a SoC-internal clk which * is controlled via simple register writes. In the complex case a clk ungate * operation may require a fast and a slow part. It is this reason that * clk_enable and clk_prepare are not mutually exclusive. In fact clk_prepare * must be called before clk_enable. Returns 0 on success, -EERROR * otherwise. */ int clk_enable(struct clk *clk) { unsigned long flags; int ret; flags = clk_enable_lock(); ret = __clk_enable(clk); clk_enable_unlock(flags); return ret; } EXPORT_SYMBOL_GPL(clk_enable); /** * __clk_round_rate - round the given rate for a clk * @clk: round the rate of this clock * * Caller must hold prepare_lock. Useful for clk_ops such as .set_rate */ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) { unsigned long parent_rate = 0; if (!clk) return 0; if (!clk->ops->round_rate) { if (clk->flags & CLK_SET_RATE_PARENT) return __clk_round_rate(clk->parent, rate); else return clk->rate; } if (clk->parent) parent_rate = clk->parent->rate; return clk->ops->round_rate(clk->hw, rate, &parent_rate); } /** * clk_round_rate - round the given rate for a clk * @clk: the clk for which we are rounding a rate * @rate: the rate which is to be rounded * * Takes in a rate as input and rounds it to a rate that the clk can actually * use which is then returned. If clk doesn't support round_rate operation * then the parent rate is returned. */ long clk_round_rate(struct clk *clk, unsigned long rate) { unsigned long ret; clk_prepare_lock(); ret = __clk_round_rate(clk, rate); clk_prepare_unlock(); return ret; } EXPORT_SYMBOL_GPL(clk_round_rate); /** * __clk_notify - call clk notifier chain * @clk: struct clk * that is changing rate * @msg: clk notifier type (see include/linux/clk.h) * @old_rate: old clk rate * @new_rate: new clk rate * * Triggers a notifier call chain on the clk rate-change notification * for 'clk'. Passes a pointer to the struct clk and the previous * and current rates to the notifier callback. Intended to be called by * internal clock code only. Returns NOTIFY_DONE from the last driver * called if all went well, or NOTIFY_STOP or NOTIFY_BAD immediately if * a driver returns that. */ static int __clk_notify(struct clk *clk, unsigned long msg, unsigned long old_rate, unsigned long new_rate) { struct clk_notifier *cn; struct clk_notifier_data cnd; int ret = NOTIFY_DONE; cnd.clk = clk; cnd.old_rate = old_rate; cnd.new_rate = new_rate; list_for_each_entry(cn, &clk_notifier_list, node) { if (cn->clk == clk) { ret = srcu_notifier_call_chain(&cn->notifier_head, msg, &cnd); break; } } return ret; } /** * __clk_recalc_rates * @clk: first clk in the subtree * @msg: notification type (see include/linux/clk.h) * * Walks the subtree of clks starting with clk and recalculates rates as it * goes. Note that if a clk does not implement the .recalc_rate callback then * it is assumed that the clock will take on the rate of it's parent. * * clk_recalc_rates also propagates the POST_RATE_CHANGE notification, * if necessary. * * Caller must hold prepare_lock. */ static void __clk_recalc_rates(struct clk *clk, unsigned long msg) { unsigned long old_rate; unsigned long parent_rate = 0; struct clk *child; old_rate = clk->rate; if (clk->parent) parent_rate = clk->parent->rate; if (clk->ops->recalc_rate) clk->rate = clk->ops->recalc_rate(clk->hw, parent_rate); else clk->rate = parent_rate; /* * ignore NOTIFY_STOP and NOTIFY_BAD return values for POST_RATE_CHANGE * & ABORT_RATE_CHANGE notifiers */ if (clk->notifier_count && msg) __clk_notify(clk, msg, old_rate, clk->rate); hlist_for_each_entry(child, &clk->children, child_node) __clk_recalc_rates(child, msg); } /** * clk_get_rate - return the rate of clk * @clk: the clk whose rate is being returned * * Simply returns the cached rate of the clk, unless CLK_GET_RATE_NOCACHE flag * is set, which means a recalc_rate will be issued. * If clk is NULL then returns 0. */ unsigned long clk_get_rate(struct clk *clk) { unsigned long rate; clk_prepare_lock(); if (clk && (clk->flags & CLK_GET_RATE_NOCACHE)) __clk_recalc_rates(clk, 0); rate = __clk_get_rate(clk); clk_prepare_unlock(); return rate; } EXPORT_SYMBOL_GPL(clk_get_rate); /** * __clk_speculate_rates * @clk: first clk in the subtree * @parent_rate: the "future" rate of clk's parent * * Walks the subtree of clks starting with clk, speculating rates as it * goes and firing off PRE_RATE_CHANGE notifications as necessary. * * Unlike clk_recalc_rates, clk_speculate_rates exists only for sending * pre-rate change notifications and returns early if no clks in the * subtree have subscribed to the notifications. Note that if a clk does not * implement the .recalc_rate callback then it is assumed that the clock will * take on the rate of it's parent. * * Caller must hold prepare_lock. */ static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate) { struct clk *child; unsigned long new_rate; int ret = NOTIFY_DONE; if (clk->ops->recalc_rate) new_rate = clk->ops->recalc_rate(clk->hw, parent_rate); else new_rate = parent_rate; /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */ if (clk->notifier_count) ret = __clk_notify(clk, PRE_RATE_CHANGE, clk->rate, new_rate); if (ret & NOTIFY_STOP_MASK) goto out; hlist_for_each_entry(child, &clk->children, child_node) { ret = __clk_speculate_rates(child, new_rate); if (ret & NOTIFY_STOP_MASK) break; } out: return ret; } static void clk_calc_subtree(struct clk *clk, unsigned long new_rate) { struct clk *child; clk->new_rate = new_rate; hlist_for_each_entry(child, &clk->children, child_node) { if (child->ops->recalc_rate) child->new_rate = child->ops->recalc_rate(child->hw, new_rate); else child->new_rate = new_rate; clk_calc_subtree(child, child->new_rate); } } /* * calculate the new rates returning the topmost clock that has to be * changed. */ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) { struct clk *top = clk; unsigned long best_parent_rate = 0; unsigned long new_rate; /* sanity */ if (IS_ERR_OR_NULL(clk)) return NULL; /* save parent rate, if it exists */ if (clk->parent) best_parent_rate = clk->parent->rate; /* never propagate up to the parent */ if (!(clk->flags & CLK_SET_RATE_PARENT)) { if (!clk->ops->round_rate) { clk->new_rate = clk->rate; return NULL; } new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); goto out; } /* need clk->parent from here on out */ if (!clk->parent) { pr_debug("%s: %s has NULL parent\n", __func__, clk->name); return NULL; } if (!clk->ops->round_rate) { top = clk_calc_new_rates(clk->parent, rate); new_rate = clk->parent->new_rate; goto out; } new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); if (best_parent_rate != clk->parent->rate) { top = clk_calc_new_rates(clk->parent, best_parent_rate); goto out; } out: clk_calc_subtree(clk, new_rate); return top; } /* * Notify about rate changes in a subtree. Always walk down the whole tree * so that in case of an error we can walk down the whole tree again and * abort the change. */ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long event) { struct clk *child, *fail_clk = NULL; int ret = NOTIFY_DONE; if (clk->rate == clk->new_rate) return NULL; if (clk->notifier_count) { ret = __clk_notify(clk, event, clk->rate, clk->new_rate); if (ret & NOTIFY_STOP_MASK) fail_clk = clk; } hlist_for_each_entry(child, &clk->children, child_node) { clk = clk_propagate_rate_change(child, event); if (clk) fail_clk = clk; } return fail_clk; } /* * walk down a subtree and set the new rates notifying the rate * change on the way */ static void clk_change_rate(struct clk *clk) { struct clk *child; unsigned long old_rate; unsigned long best_parent_rate = 0; old_rate = clk->rate; if (clk->parent) best_parent_rate = clk->parent->rate; if (clk->ops->set_rate) clk->ops->set_rate(clk->hw, clk->new_rate, best_parent_rate); if (clk->ops->recalc_rate) clk->rate = clk->ops->recalc_rate(clk->hw, best_parent_rate); else clk->rate = best_parent_rate; if (clk->notifier_count && old_rate != clk->rate) __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); hlist_for_each_entry(child, &clk->children, child_node) clk_change_rate(child); } /** * clk_set_rate - specify a new rate for clk * @clk: the clk whose rate is being changed * @rate: the new rate for clk * * In the simplest case clk_set_rate will only adjust the rate of clk. * * Setting the CLK_SET_RATE_PARENT flag allows the rate change operation to * propagate up to clk's parent; whether or not this happens depends on the * outcome of clk's .round_rate implementation. If *parent_rate is unchanged * after calling .round_rate then upstream parent propagation is ignored. If * *parent_rate comes back with a new rate for clk's parent then we propagate * up to clk's parent and set it's rate. Upward propagation will continue * until either a clk does not support the CLK_SET_RATE_PARENT flag or * .round_rate stops requesting changes to clk's parent_rate. * * Rate changes are accomplished via tree traversal that also recalculates the * rates for the clocks and fires off POST_RATE_CHANGE notifiers. * * Returns 0 on success, -EERROR otherwise. */ int clk_set_rate(struct clk *clk, unsigned long rate) { struct clk *top, *fail_clk; int ret = 0; /* prevent racing with updates to the clock topology */ clk_prepare_lock(); /* bail early if nothing to do */ if (rate == clk->rate) goto out; if ((clk->flags & CLK_SET_RATE_GATE) && clk->prepare_count) { ret = -EBUSY; goto out; } /* calculate new rates and get the topmost changed clock */ top = clk_calc_new_rates(clk, rate); if (!top) { ret = -EINVAL; goto out; } /* notify that we are about to change rates */ fail_clk = clk_propagate_rate_change(top, PRE_RATE_CHANGE); if (fail_clk) { pr_warn("%s: failed to set %s rate\n", __func__, fail_clk->name); clk_propagate_rate_change(top, ABORT_RATE_CHANGE); ret = -EBUSY; goto out; } /* change the rates */ clk_change_rate(top); out: clk_prepare_unlock(); return ret; } EXPORT_SYMBOL_GPL(clk_set_rate); /** * clk_get_parent - return the parent of a clk * @clk: the clk whose parent gets returned * * Simply returns clk->parent. Returns NULL if clk is NULL. */ struct clk *clk_get_parent(struct clk *clk) { struct clk *parent; clk_prepare_lock(); parent = __clk_get_parent(clk); clk_prepare_unlock(); return parent; } EXPORT_SYMBOL_GPL(clk_get_parent); /* * .get_parent is mandatory for clocks with multiple possible parents. It is * optional for single-parent clocks. Always call .get_parent if it is * available and WARN if it is missing for multi-parent clocks. * * For single-parent clocks without .get_parent, first check to see if the * .parents array exists, and if so use it to avoid an expensive tree * traversal. If .parents does not exist then walk the tree with __clk_lookup. */ static struct clk *__clk_init_parent(struct clk *clk) { struct clk *ret = NULL; u8 index; /* handle the trivial cases */ if (!clk->num_parents) goto out; if (clk->num_parents == 1) { if (IS_ERR_OR_NULL(clk->parent)) ret = clk->parent = __clk_lookup(clk->parent_names[0]); ret = clk->parent; goto out; } if (!clk->ops->get_parent) { WARN(!clk->ops->get_parent, "%s: multi-parent clocks must implement .get_parent\n", __func__); goto out; }; /* * Do our best to cache parent clocks in clk->parents. This prevents * unnecessary and expensive calls to __clk_lookup. We don't set * clk->parent here; that is done by the calling function */ index = clk->ops->get_parent(clk->hw); if (!clk->parents) clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), GFP_KERNEL); if (!clk->parents) ret = __clk_lookup(clk->parent_names[index]); else if (!clk->parents[index]) ret = clk->parents[index] = __clk_lookup(clk->parent_names[index]); else ret = clk->parents[index]; out: return ret; } static void clk_reparent(struct clk *clk, struct clk *new_parent) { hlist_del(&clk->child_node); if (new_parent) hlist_add_head(&clk->child_node, &new_parent->children); else hlist_add_head(&clk->child_node, &clk_orphan_list); clk->parent = new_parent; } void __clk_reparent(struct clk *clk, struct clk *new_parent) { clk_reparent(clk, new_parent); clk_debug_reparent(clk, new_parent); __clk_recalc_rates(clk, POST_RATE_CHANGE); } static u8 clk_fetch_parent_index(struct clk *clk, struct clk *parent) { u8 i; if (!clk->parents) clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), GFP_KERNEL); /* * find index of new parent clock using cached parent ptrs, * or if not yet cached, use string name comparison and cache * them now to avoid future calls to __clk_lookup. */ for (i = 0; i < clk->num_parents; i++) { if (clk->parents && clk->parents[i] == parent) break; else if (!strcmp(clk->parent_names[i], parent->name)) { if (clk->parents) clk->parents[i] = __clk_lookup(parent->name); break; } } return i; } static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index) { unsigned long flags; int ret = 0; struct clk *old_parent = clk->parent; bool migrated_enable = false; /* migrate prepare */ if (clk->prepare_count) __clk_prepare(parent); flags = clk_enable_lock(); /* migrate enable */ if (clk->enable_count) { __clk_enable(parent); migrated_enable = true; } /* update the clk tree topology */ clk_reparent(clk, parent); clk_enable_unlock(flags); /* change clock input source */ if (parent && clk->ops->set_parent) ret = clk->ops->set_parent(clk->hw, p_index); if (ret) { /* * The error handling is tricky due to that we need to release * the spinlock while issuing the .set_parent callback. This * means the new parent might have been enabled/disabled in * between, which must be considered when doing rollback. */ flags = clk_enable_lock(); clk_reparent(clk, old_parent); if (migrated_enable && clk->enable_count) { __clk_disable(parent); } else if (migrated_enable && (clk->enable_count == 0)) { __clk_disable(old_parent); } else if (!migrated_enable && clk->enable_count) { __clk_disable(parent); __clk_enable(old_parent); } clk_enable_unlock(flags); if (clk->prepare_count) __clk_unprepare(parent); return ret; } /* clean up enable for old parent if migration was done */ if (migrated_enable) { flags = clk_enable_lock(); __clk_disable(old_parent); clk_enable_unlock(flags); } /* clean up prepare for old parent if migration was done */ if (clk->prepare_count) __clk_unprepare(old_parent); /* update debugfs with new clk tree topology */ clk_debug_reparent(clk, parent); return 0; } /** * clk_set_parent - switch the parent of a mux clk * @clk: the mux clk whose input we are switching * @parent: the new input to clk * * Re-parent clk to use parent as it's new input source. If clk has the * CLK_SET_PARENT_GATE flag set then clk must be gated for this * operation to succeed. After successfully changing clk's parent * clk_set_parent will update the clk topology, sysfs topology and * propagate rate recalculation via __clk_recalc_rates. Returns 0 on * success, -EERROR otherwise. */ int clk_set_parent(struct clk *clk, struct clk *parent) { int ret = 0; u8 p_index = 0; unsigned long p_rate = 0; if (!clk || !clk->ops) return -EINVAL; /* verify ops for for multi-parent clks */ if ((clk->num_parents > 1) && (!clk->ops->set_parent)) return -ENOSYS; /* prevent racing with updates to the clock topology */ clk_prepare_lock(); if (clk->parent == parent) goto out; /* check that we are allowed to re-parent if the clock is in use */ if ((clk->flags & CLK_SET_PARENT_GATE) && clk->prepare_count) { ret = -EBUSY; goto out; } /* try finding the new parent index */ if (parent) { p_index = clk_fetch_parent_index(clk, parent); p_rate = parent->rate; if (p_index == clk->num_parents) { pr_debug("%s: clk %s can not be parent of clk %s\n", __func__, parent->name, clk->name); ret = -EINVAL; goto out; } } /* propagate PRE_RATE_CHANGE notifications */ if (clk->notifier_count) ret = __clk_speculate_rates(clk, p_rate); /* abort if a driver objects */ if (ret & NOTIFY_STOP_MASK) goto out; /* do the re-parent */ ret = __clk_set_parent(clk, parent, p_index); /* propagate rate recalculation accordingly */ if (ret) __clk_recalc_rates(clk, ABORT_RATE_CHANGE); else __clk_recalc_rates(clk, POST_RATE_CHANGE); out: clk_prepare_unlock(); return ret; } EXPORT_SYMBOL_GPL(clk_set_parent); /** * __clk_init - initialize the data structures in a struct clk * @dev: device initializing this clk, placeholder for now * @clk: clk being initialized * * Initializes the lists in struct clk, queries the hardware for the * parent and rate and sets them both. */ int __clk_init(struct device *dev, struct clk *clk) { int i, ret = 0; struct clk *orphan; struct hlist_node *tmp2; if (!clk) return -EINVAL; clk_prepare_lock(); /* check to see if a clock with this name is already registered */ if (__clk_lookup(clk->name)) { pr_debug("%s: clk %s already initialized\n", __func__, clk->name); ret = -EEXIST; goto out; } /* check that clk_ops are sane. See Documentation/clk.txt */ if (clk->ops->set_rate && !(clk->ops->round_rate && clk->ops->recalc_rate)) { pr_warning("%s: %s must implement .round_rate & .recalc_rate\n", __func__, clk->name); ret = -EINVAL; goto out; } if (clk->ops->set_parent && !clk->ops->get_parent) { pr_warning("%s: %s must implement .get_parent & .set_parent\n", __func__, clk->name); ret = -EINVAL; goto out; } /* throw a WARN if any entries in parent_names are NULL */ for (i = 0; i < clk->num_parents; i++) WARN(!clk->parent_names[i], "%s: invalid NULL in %s's .parent_names\n", __func__, clk->name); /* * Allocate an array of struct clk *'s to avoid unnecessary string * look-ups of clk's possible parents. This can fail for clocks passed * in to clk_init during early boot; thus any access to clk->parents[] * must always check for a NULL pointer and try to populate it if * necessary. * * If clk->parents is not NULL we skip this entire block. This allows * for clock drivers to statically initialize clk->parents. */ if (clk->num_parents > 1 && !clk->parents) { clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), GFP_KERNEL); /* * __clk_lookup returns NULL for parents that have not been * clk_init'd; thus any access to clk->parents[] must check * for a NULL pointer. We can always perform lazy lookups for * missing parents later on. */ if (clk->parents) for (i = 0; i < clk->num_parents; i++) clk->parents[i] = __clk_lookup(clk->parent_names[i]); } clk->parent = __clk_init_parent(clk); /* * Populate clk->parent if parent has already been __clk_init'd. If * parent has not yet been __clk_init'd then place clk in the orphan * list. If clk has set the CLK_IS_ROOT flag then place it in the root * clk list. * * Every time a new clk is clk_init'd then we walk the list of orphan * clocks and re-parent any that are children of the clock currently * being clk_init'd. */ if (clk->parent) hlist_add_head(&clk->child_node, &clk->parent->children); else if (clk->flags & CLK_IS_ROOT) hlist_add_head(&clk->child_node, &clk_root_list); else hlist_add_head(&clk->child_node, &clk_orphan_list); /* * Set clk's rate. The preferred method is to use .recalc_rate. For * simple clocks and lazy developers the default fallback is to use the * parent's rate. If a clock doesn't have a parent (or is orphaned) * then rate is set to zero. */ if (clk->ops->recalc_rate) clk->rate = clk->ops->recalc_rate(clk->hw, __clk_get_rate(clk->parent)); else if (clk->parent) clk->rate = clk->parent->rate; else clk->rate = 0; /* * walk the list of orphan clocks and reparent any that are children of * this clock */ hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { if (orphan->ops->get_parent) { i = orphan->ops->get_parent(orphan->hw); if (!strcmp(clk->name, orphan->parent_names[i])) __clk_reparent(orphan, clk); continue; } for (i = 0; i < orphan->num_parents; i++) if (!strcmp(clk->name, orphan->parent_names[i])) { __clk_reparent(orphan, clk); break; } } /* * optional platform-specific magic * * The .init callback is not used by any of the basic clock types, but * exists for weird hardware that must perform initialization magic. * Please consider other ways of solving initialization problems before * using this callback, as it's use is discouraged. */ if (clk->ops->init) clk->ops->init(clk->hw); clk_debug_register(clk); out: clk_prepare_unlock(); return ret; } /** * __clk_register - register a clock and return a cookie. * * Same as clk_register, except that the .clk field inside hw shall point to a * preallocated (generally statically allocated) struct clk. None of the fields * of the struct clk need to be initialized. * * The data pointed to by .init and .clk field shall NOT be marked as init * data. * * __clk_register is only exposed via clk-private.h and is intended for use with * very large numbers of clocks that need to be statically initialized. It is * a layering violation to include clk-private.h from any code which implements * a clock's .ops; as such any statically initialized clock data MUST be in a * separate C file from the logic that implements it's operations. Returns 0 * on success, otherwise an error code. */ struct clk *__clk_register(struct device *dev, struct clk_hw *hw) { int ret; struct clk *clk; clk = hw->clk; clk->name = hw->init->name; clk->ops = hw->init->ops; clk->hw = hw; clk->flags = hw->init->flags; clk->parent_names = hw->init->parent_names; clk->num_parents = hw->init->num_parents; ret = __clk_init(dev, clk); if (ret) return ERR_PTR(ret); return clk; } EXPORT_SYMBOL_GPL(__clk_register); static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk) { int i, ret; clk->name = kstrdup(hw->init->name, GFP_KERNEL); if (!clk->name) { pr_err("%s: could not allocate clk->name\n", __func__); ret = -ENOMEM; goto fail_name; } clk->ops = hw->init->ops; clk->hw = hw; clk->flags = hw->init->flags; clk->num_parents = hw->init->num_parents; hw->clk = clk; /* allocate local copy in case parent_names is __initdata */ clk->parent_names = kzalloc((sizeof(char*) * clk->num_parents), GFP_KERNEL); if (!clk->parent_names) { pr_err("%s: could not allocate clk->parent_names\n", __func__); ret = -ENOMEM; goto fail_parent_names; } /* copy each string name in case parent_names is __initdata */ for (i = 0; i < clk->num_parents; i++) { clk->parent_names[i] = kstrdup(hw->init->parent_names[i], GFP_KERNEL); if (!clk->parent_names[i]) { pr_err("%s: could not copy parent_names\n", __func__); ret = -ENOMEM; goto fail_parent_names_copy; } } ret = __clk_init(dev, clk); if (!ret) return 0; fail_parent_names_copy: while (--i >= 0) kfree(clk->parent_names[i]); kfree(clk->parent_names); fail_parent_names: kfree(clk->name); fail_name: return ret; } /** * clk_register - allocate a new clock, register it and return an opaque cookie * @dev: device that is registering this clock * @hw: link to hardware-specific clock data * * clk_register is the primary interface for populating the clock tree with new * clock nodes. It returns a pointer to the newly allocated struct clk which * cannot be dereferenced by driver code but may be used in conjuction with the * rest of the clock API. In the event of an error clk_register will return an * error code; drivers must test for an error code after calling clk_register. */ struct clk *clk_register(struct device *dev, struct clk_hw *hw) { int ret; struct clk *clk; clk = kzalloc(sizeof(*clk), GFP_KERNEL); if (!clk) { pr_err("%s: could not allocate clk\n", __func__); ret = -ENOMEM; goto fail_out; } ret = _clk_register(dev, hw, clk); if (!ret) return clk; kfree(clk); fail_out: return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(clk_register); /** * clk_unregister - unregister a currently registered clock * @clk: clock to unregister * * Currently unimplemented. */ void clk_unregister(struct clk *clk) {} EXPORT_SYMBOL_GPL(clk_unregister); static void devm_clk_release(struct device *dev, void *res) { clk_unregister(res); } /** * devm_clk_register - resource managed clk_register() * @dev: device that is registering this clock * @hw: link to hardware-specific clock data * * Managed clk_register(). Clocks returned from this function are * automatically clk_unregister()ed on driver detach. See clk_register() for * more information. */ struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw) { struct clk *clk; int ret; clk = devres_alloc(devm_clk_release, sizeof(*clk), GFP_KERNEL); if (!clk) return ERR_PTR(-ENOMEM); ret = _clk_register(dev, hw, clk); if (!ret) { devres_add(dev, clk); } else { devres_free(clk); clk = ERR_PTR(ret); } return clk; } EXPORT_SYMBOL_GPL(devm_clk_register); static int devm_clk_match(struct device *dev, void *res, void *data) { struct clk *c = res; if (WARN_ON(!c)) return 0; return c == data; } /** * devm_clk_unregister - resource managed clk_unregister() * @clk: clock to unregister * * Deallocate a clock allocated with devm_clk_register(). Normally * this function will not need to be called and the resource management * code will ensure that the resource is freed. */ void devm_clk_unregister(struct device *dev, struct clk *clk) { WARN_ON(devres_release(dev, devm_clk_release, devm_clk_match, clk)); } EXPORT_SYMBOL_GPL(devm_clk_unregister); /*** clk rate change notifiers ***/ /** * clk_notifier_register - add a clk rate change notifier * @clk: struct clk * to watch * @nb: struct notifier_block * with callback info * * Request notification when clk's rate changes. This uses an SRCU * notifier because we want it to block and notifier unregistrations are * uncommon. The callbacks associated with the notifier must not * re-enter into the clk framework by calling any top-level clk APIs; * this will cause a nested prepare_lock mutex. * * Pre-change notifier callbacks will be passed the current, pre-change * rate of the clk via struct clk_notifier_data.old_rate. The new, * post-change rate of the clk is passed via struct * clk_notifier_data.new_rate. * * Post-change notifiers will pass the now-current, post-change rate of * the clk in both struct clk_notifier_data.old_rate and struct * clk_notifier_data.new_rate. * * Abort-change notifiers are effectively the opposite of pre-change * notifiers: the original pre-change clk rate is passed in via struct * clk_notifier_data.new_rate and the failed post-change rate is passed * in via struct clk_notifier_data.old_rate. * * clk_notifier_register() must be called from non-atomic context. * Returns -EINVAL if called with null arguments, -ENOMEM upon * allocation failure; otherwise, passes along the return value of * srcu_notifier_chain_register(). */ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) { struct clk_notifier *cn; int ret = -ENOMEM; if (!clk || !nb) return -EINVAL; clk_prepare_lock(); /* search the list of notifiers for this clk */ list_for_each_entry(cn, &clk_notifier_list, node) if (cn->clk == clk) break; /* if clk wasn't in the notifier list, allocate new clk_notifier */ if (cn->clk != clk) { cn = kzalloc(sizeof(struct clk_notifier), GFP_KERNEL); if (!cn) goto out; cn->clk = clk; srcu_init_notifier_head(&cn->notifier_head); list_add(&cn->node, &clk_notifier_list); } ret = srcu_notifier_chain_register(&cn->notifier_head, nb); clk->notifier_count++; out: clk_prepare_unlock(); return ret; } EXPORT_SYMBOL_GPL(clk_notifier_register); /** * clk_notifier_unregister - remove a clk rate change notifier * @clk: struct clk * * @nb: struct notifier_block * with callback info * * Request no further notification for changes to 'clk' and frees memory * allocated in clk_notifier_register. * * Returns -EINVAL if called with null arguments; otherwise, passes * along the return value of srcu_notifier_chain_unregister(). */ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) { struct clk_notifier *cn = NULL; int ret = -EINVAL; if (!clk || !nb) return -EINVAL; clk_prepare_lock(); list_for_each_entry(cn, &clk_notifier_list, node) if (cn->clk == clk) break; if (cn->clk == clk) { ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); clk->notifier_count--; /* XXX the notifier code should handle this better */ if (!cn->notifier_head.head) { srcu_cleanup_notifier_head(&cn->notifier_head); list_del(&cn->node); kfree(cn); } } else { ret = -ENOENT; } clk_prepare_unlock(); return ret; } EXPORT_SYMBOL_GPL(clk_notifier_unregister); #ifdef CONFIG_OF /** * struct of_clk_provider - Clock provider registration structure * @link: Entry in global list of clock providers * @node: Pointer to device tree node of clock provider * @get: Get clock callback. Returns NULL or a struct clk for the * given clock specifier * @data: context pointer to be passed into @get callback */ struct of_clk_provider { struct list_head link; struct device_node *node; struct clk *(*get)(struct of_phandle_args *clkspec, void *data); void *data; }; extern struct of_device_id __clk_of_table[]; static const struct of_device_id __clk_of_table_sentinel __used __section(__clk_of_table_end); static LIST_HEAD(of_clk_providers); static DEFINE_MUTEX(of_clk_lock); struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data) { return data; } EXPORT_SYMBOL_GPL(of_clk_src_simple_get); struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data) { struct clk_onecell_data *clk_data = data; unsigned int idx = clkspec->args[0]; if (idx >= clk_data->clk_num) { pr_err("%s: invalid clock index %d\n", __func__, idx); return ERR_PTR(-EINVAL); } return clk_data->clks[idx]; } EXPORT_SYMBOL_GPL(of_clk_src_onecell_get); /** * of_clk_add_provider() - Register a clock provider for a node * @np: Device node pointer associated with clock provider * @clk_src_get: callback for decoding clock * @data: context pointer for @clk_src_get callback. */ int of_clk_add_provider(struct device_node *np, struct clk *(*clk_src_get)(struct of_phandle_args *clkspec, void *data), void *data) { struct of_clk_provider *cp; cp = kzalloc(sizeof(struct of_clk_provider), GFP_KERNEL); if (!cp) return -ENOMEM; cp->node = of_node_get(np); cp->data = data; cp->get = clk_src_get; mutex_lock(&of_clk_lock); list_add(&cp->link, &of_clk_providers); mutex_unlock(&of_clk_lock); pr_debug("Added clock from %s\n", np->full_name); return 0; } EXPORT_SYMBOL_GPL(of_clk_add_provider); /** * of_clk_del_provider() - Remove a previously registered clock provider * @np: Device node pointer associated with clock provider */ void of_clk_del_provider(struct device_node *np) { struct of_clk_provider *cp; mutex_lock(&of_clk_lock); list_for_each_entry(cp, &of_clk_providers, link) { if (cp->node == np) { list_del(&cp->link); of_node_put(cp->node); kfree(cp); break; } } mutex_unlock(&of_clk_lock); } EXPORT_SYMBOL_GPL(of_clk_del_provider); struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) { struct of_clk_provider *provider; struct clk *clk = ERR_PTR(-ENOENT); /* Check if we have such a provider in our array */ mutex_lock(&of_clk_lock); list_for_each_entry(provider, &of_clk_providers, link) { if (provider->node == clkspec->np) clk = provider->get(clkspec, provider->data); if (!IS_ERR(clk)) break; } mutex_unlock(&of_clk_lock); return clk; } int of_clk_get_parent_count(struct device_node *np) { return of_count_phandle_with_args(np, "clocks", "#clock-cells"); } EXPORT_SYMBOL_GPL(of_clk_get_parent_count); const char *of_clk_get_parent_name(struct device_node *np, int index) { struct of_phandle_args clkspec; const char *clk_name; int rc; if (index < 0) return NULL; rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index, &clkspec); if (rc) return NULL; if (of_property_read_string_index(clkspec.np, "clock-output-names", clkspec.args_count ? clkspec.args[0] : 0, &clk_name) < 0) clk_name = clkspec.np->name; of_node_put(clkspec.np); return clk_name; } EXPORT_SYMBOL_GPL(of_clk_get_parent_name); /** * of_clk_init() - Scan and init clock providers from the DT * @matches: array of compatible values and init functions for providers. * * This function scans the device tree for matching clock providers and * calls their initialization functions */ void __init of_clk_init(const struct of_device_id *matches) { struct device_node *np; if (!matches) matches = __clk_of_table; pr_debug("[%s][%d]match-name:%s\n", __func__, __LINE__, matches->name); for_each_matching_node(np, matches) { const struct of_device_id *match = of_match_node(matches, np); of_clk_init_cb_t clk_init_cb = match->data; pr_debug("[%s][%d]match-name:%s\n", __func__, __LINE__, matches->name); clk_init_cb(np); } } #endif
{ "pile_set_name": "Github" }
Slide with Picture With Caption layout.
{ "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. // Package errors implements functions to manipulate errors. package errors import ( "errors" "fmt" "google.golang.org/protobuf/internal/detrand" ) // Error is a sentinel matching all errors produced by this package. var Error = errors.New("protobuf error") // New formats a string according to the format specifier and arguments and // returns an error that has a "proto" prefix. func New(f string, x ...interface{}) error { return &prefixError{s: format(f, x...)} } type prefixError struct{ s string } var prefix = func() string { // Deliberately introduce instability into the error message string to // discourage users from performing error string comparisons. if detrand.Bool() { return "proto: " // use non-breaking spaces (U+00a0) } else { return "proto: " // use regular spaces (U+0020) } }() func (e *prefixError) Error() string { return prefix + e.s } func (e *prefixError) Unwrap() error { return Error } // Wrap returns an error that has a "proto" prefix, the formatted string described // by the format specifier and arguments, and a suffix of err. The error wraps err. func Wrap(err error, f string, x ...interface{}) error { return &wrapError{ s: format(f, x...), err: err, } } type wrapError struct { s string err error } func (e *wrapError) Error() string { return format("%v%v: %v", prefix, e.s, e.err) } func (e *wrapError) Unwrap() error { return e.err } func (e *wrapError) Is(target error) bool { return target == Error } func format(f string, x ...interface{}) string { // avoid "proto: " prefix when chaining for i := 0; i < len(x); i++ { switch e := x[i].(type) { case *prefixError: x[i] = e.s case *wrapError: x[i] = format("%v: %v", e.s, e.err) } } return fmt.Sprintf(f, x...) } func InvalidUTF8(name string) error { return New("field %v contains invalid UTF-8", name) } func RequiredNotSet(name string) error { return New("required field %v not set", name) }
{ "pile_set_name": "Github" }
{ "keys": [ {"kid":"21d9eefe-34b6-42b3-b643-2b30e0ab59e0","use":"sig","kty":"EC","crv":"P-256","alg":"ES256","x":"kiqIyeqJSFUSVpXkqFFzs1ZjmNv0zcRVFVwBAxt_g9U","y":"0bpeB75l6lJQs6t5tUkQcaa1yNd8W2o50zYWd-xjeFU"}, {"kid":"76a19c1b-5dbe-46cb-b3f3-a8c38c8bb8eb","use":"sig","kty":"EC","crv":"P-256","alg":"ES256","x":"kiqIyeqJSFUSVpXkqFFzs1ZjmNv0zcRVFVwBAxt_g9U","y":"0bpeB75l6lJQs6t5tUkQcaa1yNd8W2o50zYWd-xjeFU","d":"6vMo_q1f-OvMBDbnPL7d2cTRIi-izFY-G5j8AhJmZ3M"} ] }
{ "pile_set_name": "Github" }
package Paws::ServiceCatalog::AccessLevelFilter; use Moose; has Key => (is => 'ro', isa => 'Str'); has Value => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::ServiceCatalog::AccessLevelFilter =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::ServiceCatalog::AccessLevelFilter object: $service_obj->Method(Att1 => { Key => $value, ..., Value => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::ServiceCatalog::AccessLevelFilter object: $result = $service_obj->Method(...); $result->Att1->Key =head1 DESCRIPTION The access level to use to filter results. =head1 ATTRIBUTES =head2 Key => Str The access level. =over =item * C<Account> - Filter results based on the account. =item * C<Role> - Filter results based on the federated role of the specified user. =item * C<User> - Filter results based on the specified user. =back =head2 Value => Str The user to which the access level applies. The only supported value is C<Self>. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::ServiceCatalog> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
{ "pile_set_name": "Github" }
; RUN: opt < %s -instcombine -S | grep and ; PR1907 define i1 @test(i32 %c84.17) { %tmp2696 = icmp ne i32 %c84.17, 34 ; <i1> [#uses=2] %tmp2699 = icmp sgt i32 %c84.17, -1 ; <i1> [#uses=1] %tmp2703 = and i1 %tmp2696, %tmp2699 ; <i1> [#uses=1] ret i1 %tmp2703 }
{ "pile_set_name": "Github" }
{ stdenv, fetchgit, postgresql }: stdenv.mkDerivation rec { pname = "smlar-unstable"; version = "2020-04-08"; src = fetchgit { url = "git://sigaev.ru/smlar.git"; rev = "0c345af71969d9863bb76efa833391d00705669e"; sha256 = "1pr3pbnjc9n209l52sgsn4xqzp92qk6wci55hcqjjrwf2gdxy0yr"; }; buildInputs = [ postgresql ]; makeFlags = [ "USE_PGXS=1" ]; installPhase = '' install -D -t $out/lib *.so install -D -t $out/share/postgresql/extension *.sql install -D -t $out/share/postgresql/extension *.control ''; meta = with stdenv.lib; { description = "Compute similary of any one-dimensional arrays"; homepage = "http://sigaev.ru/git/gitweb.cgi?p=smlar.git"; platforms = postgresql.meta.platforms; license = licenses.bsd2; maintainers = [ maintainers.marsam ]; }; }
{ "pile_set_name": "Github" }
{ "desc": "Novatel E371", "type": "qmi" }
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- """ Download Sub-Application """ from sage_bootstrap.download.transfer import Download from sage_bootstrap.download.mirror_list import MirrorList
{ "pile_set_name": "Github" }
<?php $type = 'Core'; $name = 'Times-BoldItalic'; $up = -100; $ut = 50; $cw = array( chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); $enc = 'cp1252'; $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?>
{ "pile_set_name": "Github" }
{% autoescape off %}{% block content %} {% endblock %} GovTrack.us ---- {% block below_signature_content %} {% endblock %} GovTrack.us is a project of {accountcompany} (https://civicimpulse.com), {accountaddress1}, {accountcity} {accountstate} {accountzip} {accountcountry}. You can reach us at hello@govtrack.us. To stop all future emails from us, click {unsubscribe}. {% endautoescape %}
{ "pile_set_name": "Github" }
/* * Copyright 2009 Joubin Houshyar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jredis.examples; import org.jredis.JRedis; import org.jredis.RedisException; import org.jredis.connector.ConnectionSpec; import org.jredis.ri.alphazero.JRedisClient; import org.jredis.ri.alphazero.JRedisPipelineService; import org.jredis.ri.alphazero.connection.DefaultConnectionSpec; import org.jredis.ri.alphazero.support.Log; import static org.jredis.ri.alphazero.support.DefaultCodec.*; /** * JRedisPipelineService provides blocking synchronous semantics backed by a pipeline and is suitable * for concurrent usages with a single (socket) connection to the server. There is really nothing * different here than using a vanial {@link JRedisClient}. * * @author Joubin Houshyar (alphazero@sensesay.net) * @version alpha.0, Nov 6, 2009 * @since alpha.0 * */ public class UsingJRedisPipelineService { final JRedis jredis; private UsingJRedisPipelineService() { // same as usual. ConnectionSpec spec = DefaultConnectionSpec.newSpec(); spec.setDatabase(11).setCredentials("jredis".getBytes()); // only need to use the specific class. jredis = new JRedisPipelineService(spec); } private void run () { try { jredis.ping(); basicStuff(); elicitErrors(); } catch (RedisException e) { e.printStackTrace(); } // Use the connection concurrently final int wcnt = 10; final int opcnt = 20000; final Thread[] workers = new Thread[wcnt]; final JRedis client = jredis; for(int i=0; i<workers.length; i++) { final int j = i; workers[i] = new Thread(new Runnable() { @Override public void run() { final String wkey = "foo" + j; String wvalue = null; for(int i=0; i< opcnt; i++) { try { client.incr(wkey); wvalue = toStr(client.get(wkey)); } catch (RedisException e) { e.printStackTrace(); break; } } System.out.format("%s => %s\n", wkey, wvalue); } }); workers[i].start(); } for(Thread t : workers){ try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } } // jredis.quit(); } private void elicitErrors () { String key = "foo" ; try { jredis.set(key, "bar"); jredis.sadd(key, "foobar"); } catch (RedisException e) { Log.log("Expected elicited error: %s", e.getMessage()); } } private void basicStuff () throws RedisException { jredis.flushdb(); String key = "foo" ; jredis.set(key, "bar"); String value = toStr(jredis.get(key)); System.out.format("%s => %s\n", key, value); } public static void main (String[] args) { (new UsingJRedisPipelineService()).run(); } }
{ "pile_set_name": "Github" }
use strict; use warnings; use PostgresNode; use TestLib; use Test::More tests => 11; program_help_ok('dropdb'); program_version_ok('dropdb'); program_options_handling_ok('dropdb'); my $node = get_new_node('main'); $node->init; $node->start; $node->safe_psql('postgres', 'CREATE DATABASE foobar1'); $node->issues_sql_like( [ 'dropdb', 'foobar1' ], qr/statement: DROP DATABASE foobar1/, 'SQL DROP DATABASE run'); $node->command_fails([ 'dropdb', 'nonexistent' ], 'fails with nonexistent database');
{ "pile_set_name": "Github" }
%YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 9d1de2691495b304e9843ac3335b626d, type: 3} m_Name: overly_uniformblood m_EditorClassIdentifier: Variance: - Frames: - sprite: {fileID: 21300000, guid: 9baeded49d38ae546b917fd159b2de35, type: 3} secondDelay: 0 - Frames: - sprite: {fileID: 21300002, guid: 9baeded49d38ae546b917fd159b2de35, type: 3} secondDelay: 0 - Frames: - sprite: {fileID: 21300004, guid: 9baeded49d38ae546b917fd159b2de35, type: 3} secondDelay: 0 - Frames: - sprite: {fileID: 21300006, guid: 9baeded49d38ae546b917fd159b2de35, type: 3} secondDelay: 0 IsPalette: 0 setID: 972
{ "pile_set_name": "Github" }
const makeEmail = require('../../lib/email.js'); const TestUtils = require('../utils'); describe('lib/email.js', async function () { const utils = new TestUtils(); if (utils.config.smtpConfigured() && process.env.SQLPAD_TEST_EMAIL) { const email = makeEmail(utils.config); it('should send invites', function () { return email.sendInvite(process.env.SQLPAD_TEST_EMAIL); }); it('should send forgot passwords', function () { return email.sendForgotPassword( process.env.SQLPAD_TEST_EMAIL, '/password-resset/id' ); }); } else { describe('Set env vars to enable:', function () { it.skip('SQLPAD_SMTP_HOST'); it.skip('SQLPAD_SMTP_PORT'); it.skip('SQLPAD_SMTP_USER'); it.skip('SQLPAD_SMTP_PASSWORD'); it.skip('SQLPAD_SMTP_FROM'); it.skip('PUBLIC_URL'); it.skip('SQLPAD_TEST_EMAIL'); it.skip('SQLPAD_SMTP_SECURE (opt. probably to false)'); }); } });
{ "pile_set_name": "Github" }
{ "RawExtCodeSizeGas_d0g0v0_Istanbul" : { "_info" : { "comment" : "", "filling-rpc-server" : "Geth-1.9.6-unstable-63b18027-20190920", "filling-tool-version" : "retesteth-0.0.1+commit.0ae18aef.Linux.g++", "lllcversion" : "Version: 0.5.12-develop.2019.9.13+commit.2d601a4f.Linux.g++", "source" : "src/GeneralStateTestsFiller/stEIP150singleCodeGasPrices/RawExtCodeSizeGasFiller.json", "sourceHash" : "0272378b6ff54a62ce07a51d03d4385b6cc298c06675828dc584c7158006918f" }, "genesisBlockHeader" : { "bloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "difficulty" : "0x20000", "extraData" : "0x00", "gasLimit" : "0x989680", "gasUsed" : "0x0", "hash" : "0x8a7a661316a31ceec3562493cdb23b3053e9aa5c2f1e06bb40009b851967c51a", "mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "nonce" : "0x0000000000000000", "number" : "0x0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "stateRoot" : "0x6f0e31302cc80057dae40235f0cf15d1079c61cd7bffd2d1986fdb91dde5a794", "timestamp" : "0x0", "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, "pre" : { "0x094f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "0x00", "code" : "0x0112233445566778899101112131415161718191202122232425", "nonce" : "0x00", "storage" : { } }, "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "0xe8d4a51000", "code" : "0x", "nonce" : "0x00", "storage" : { } }, "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "0x00", "code" : "0x5a60005573094f5374fce5edbc8e2a8697c15331677e6ebf0b3b505a60015500", "nonce" : "0x00", "storage" : { } } }, "postState" : { "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "code" : "0x", "nonce" : "0x01", "balance" : "0xe8d4a41eed", "storage" : { } }, "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { "code" : "0x", "nonce" : "0x00", "balance" : "0x1bc16d674ec8f113", "storage" : { } }, "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "code" : "0x5a60005573094f5374fce5edbc8e2a8697c15331677e6ebf0b3b505a60015500", "nonce" : "0x00", "balance" : "0x00", "storage" : { "0x00" : "0x08d5b6", "0x01" : "0x0884d0" } }, "0x094f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "code" : "0x0112233445566778899101112131415161718191202122232425", "nonce" : "0x00", "balance" : "0x00", "storage" : { } } }, "network" : "Istanbul", "sealEngine" : "NoProof", "lastblockhash" : "0xec417b3b90a05e4628b92a81a41204a051bf357641ec65dd5ba31c914d241b2b", "genesisRLP" : "0xf901f8f901f3a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa06f0e31302cc80057dae40235f0cf15d1079c61cd7bffd2d1986fdb91dde5a794a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083989680808000a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0", "blocks" : [ { "rlp" : "0xf9025ff901f7a08a7a661316a31ceec3562493cdb23b3053e9aa5c2f1e06bb40009b851967c51aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa05c9d3a9fe89d1d235265e44194db9dae6688f385d2de3506e93834fa882f7a9ea059652e5662eb625efd106d67b9b25d3c12a15e69494d1d24f59d867c211f6761a0183476213dfb6fae980073a1ec61a63bd2ae59776666d485f2486e00d3530dfcb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018398bca482f1138203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f862f8608001830927c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80801ba08d0699f23d032b86db35ed7bb39c2357bec870fbfbe7db30b1795d320d8965c6a002f578fd949e84f0dc1307f5dd714c9a7158b31891d43f45459edcb52e345f7cc0", "blockHeader" : { "bloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "difficulty" : "0x20000", "extraData" : "0x00", "gasLimit" : "0x98bca4", "gasUsed" : "0xf113", "hash" : "0xec417b3b90a05e4628b92a81a41204a051bf357641ec65dd5ba31c914d241b2b", "mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "nonce" : "0x0000000000000000", "number" : "0x1", "parentHash" : "0x8a7a661316a31ceec3562493cdb23b3053e9aa5c2f1e06bb40009b851967c51a", "receiptTrie" : "0x183476213dfb6fae980073a1ec61a63bd2ae59776666d485f2486e00d3530dfc", "stateRoot" : "0x5c9d3a9fe89d1d235265e44194db9dae6688f385d2de3506e93834fa882f7a9e", "timestamp" : "0x3e8", "transactionsTrie" : "0x59652e5662eb625efd106d67b9b25d3c12a15e69494d1d24f59d867c211f6761", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, "transactions" : [ { "data" : "0x", "gasLimit" : "0x0927c0", "gasPrice" : "0x01", "nonce" : "0x00", "to" : "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b", "value" : "0x00", "v" : "0x1b", "r" : "0x8d0699f23d032b86db35ed7bb39c2357bec870fbfbe7db30b1795d320d8965c6", "s" : "0x02f578fd949e84f0dc1307f5dd714c9a7158b31891d43f45459edcb52e345f7c" } ] } ] } }
{ "pile_set_name": "Github" }
<?php namespace nspl\a\lazy; use nspl\a; class LazyChainableSequence extends a\ChainableSequence { /** * Applies function of one argument to each sequence item * * @param callable $function * @return $this */ public function map(callable $function) { return new self(map($function, $this->sequence)); } /** * Applies function of one argument to each sequence item and flattens the result * * @param callable $function * @return $this */ public function flatMap(callable $function) { return new self(flatMap($function, $this->sequence)); } /** * Zips sequence with a sequence * * @param array|\Traversable $sequence * @return $this */ public function zip($sequence) { return new self(zip($this->sequence, $sequence)); } /** * Generalises zip by zipping with the function given as the first argument * * @param callable $function * @param array|\Traversable $sequence * @return $this */ public function zipWith(callable $function, $sequence) { return new self(zipWith($function, $this->sequence, $sequence)); } /** * Returns sequence items that satisfy the predicate * * @param callable $predicate * @return $this */ public function filter(callable $predicate) { return new self(filter($predicate, $this->sequence)); } /** * Returns sequence items that don't satisfy the predicate * * @param callable $predicate * @return $this */ public function filterNot(callable $predicate) { return new self(filterNot($predicate, $this->sequence)); } /** * Returns the first N sequence items with the given step * * @param int $N * @param int $step * @return $this */ public function take($N, $step = 1) { return new self(take($this->sequence, $N, $step)); } /** * Returns the longest sequence prefix of all items which satisfy the predicate * * @param callable $predicate * @return $this */ public function takeWhile(callable $predicate) { return new self(takeWhile($predicate, $this->sequence)); } /** * Drops the first N sequence items * * @param int $N * @return $this */ public function drop($N) { return drop($this->sequence, $N); } /** * Drops the longest sequence prefix of all items which satisfy the predicate * * @param callable $predicate * @return $this */ public function dropWhile(callable $predicate) { return dropWhile($predicate, $this->sequence); } /** * Returns two sequences, one containing values for which the predicate returned true, and the other containing * the items that returned false * * @param callable $predicate * @return $this */ public function partition(callable $predicate) { $result = partition($predicate, $this->sequence); return new self([ new self($result[0]), new self($result[1]) ]); } /** * Flattens multidimensional sequence * * @param int|null $depth * @return $this */ public function flatten($depth = null) { return new self(flatten($this->sequence, $depth)); } /** * Returns a sequence of (key, value) pairs * * @param bool $valueKey If true then returns (value, key) pairs * @return $this */ public function pairs($valueKey = false) { return new self(pairs($this->sequence, $valueKey)); } /** * Returns the sequence keys * * @return $this */ public function keys() { return new self(keys($this->sequence)); } }
{ "pile_set_name": "Github" }
# Copyright (C) 2002 - 2015 Tristan Gingold # # GHDL 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. # # GHDL 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 GCC; see the file COPYING. If not, write to the Free # Software Foundation, 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # Some files are automatically generated using pnodes.py # This Makefile can be used to regenerate these files. Generated files must # be committed and distribued with the sources, so that users don't need to # regenerate them (and don't need to have python installed). PNODES=../../python/xtools/pnodes.py PNODESPY=../../python/xtools/pnodespy.py DEPS=vhdl-nodes.ads vhdl-nodes.adb.in $(PNODES) GEN_FILES=vhdl-nodes.adb vhdl-nodes_meta.ads vhdl-nodes_meta.adb \ vhdl-elocations.adb vhdl-elocations_meta.ads vhdl-elocations_meta.adb \ ../../python/libghdl/thin/vhdl/nodes.py \ ../../python/libghdl/thin/vhdl/nodes_meta.py \ ../../python/libghdl/thin/vhdl/tokens.py \ ../../python/libghdl/thin/vhdl/elocations.py \ ../../python/libghdl/thin/errorout.py ../../python/libghdl/thin/std_names.py NODES_FLAGS=--node-file=vhdl-nodes.ads --field-file=vhdl-nodes.adb.in \ --template-file=vhdl-nodes.adb.in --kind-file=vhdl-nodes.ads \ --meta-basename=vhdl-nodes_meta ELOCATIONS_FLAGS=--node-file=vhdl-elocations.ads \ --field-file=vhdl-elocations.adb.in --kind-file=vhdl-nodes.ads \ --template-file=vhdl-elocations.adb.in --meta-basename=vhdl-elocations_meta all: $(GEN_FILES) vhdl-nodes.adb: vhdl-nodes.adb.in $(DEPS) $(RM) $@ $(PNODES) $(NODES_FLAGS) body > $@ chmod -w $@ vhdl-nodes_meta.ads: vhdl-nodes_meta.ads.in $(DEPS) $(RM) $@ $(PNODES) $(NODES_FLAGS) meta_specs > $@ chmod -w $@ vhdl-nodes_meta.adb: vhdl-nodes_meta.adb.in $(DEPS) $(RM) $@ $(PNODES) $(NODES_FLAGS) meta_body > $@ chmod -w $@ vhdl-elocations.adb: vhdl-elocations.adb.in vhdl-elocations.ads $(DEPS) $(RM) $@ $(PNODES) $(ELOCATIONS_FLAGS) body > $@ chmod -w $@ vhdl-elocations_meta.ads: vhdl-elocations_meta.ads.in vhdl-elocations.ads $(DEPS) $(RM) $@ $(PNODES) $(ELOCATIONS_FLAGS) meta_specs > $@ chmod -w $@ vhdl-elocations_meta.adb: vhdl-elocations_meta.adb.in vhdl-elocations.ads $(DEPS) $(RM) $@ $(PNODES) $(ELOCATIONS_FLAGS) meta_body > $@ chmod -w $@ ../../python/libghdl/thin/vhdl/nodes.py: $(DEPS) $(PNODESPY) $(RM) $@ $(PNODESPY) $(NODES_FLAGS) libghdl-nodes > $@ chmod -w $@ ../../python/libghdl/thin/vhdl/nodes_meta.py: $(DEPS) $(PNODESPY) $(RM) $@ $(PNODESPY) $(NODES_FLAGS) libghdl-meta > $@ chmod -w $@ ../../python/libghdl/thin/std_names.py: $(PNODESPY) ../std_names.ads $(RM) $@ $(PNODESPY) $(NODES_FLAGS) libghdl-names > $@ chmod -w $@ ../../python/libghdl/thin/vhdl/tokens.py: $(PNODESPY) vhdl-tokens.ads $(RM) $@ $(PNODESPY) $(NODES_FLAGS) libghdl-tokens > $@ chmod -w $@ ../../python/libghdl/thin/vhdl/elocations.py: $(PNODESPY) vhdl-elocations.ads $(RM) $@ $(PNODESPY) $(ELOCATIONS_FLAGS) libghdl-elocs > $@ chmod -w $@ ../../python/libghdl/thin/errorout.py: $(PNODESPY) ../errorout.ads $(RM) $@ $(PNODESPY) $(ELOCATIONS_FLAGS) libghdl-errorout > $@ chmod -w $@ clean: $(RM) -f $(GEN_FILES)
{ "pile_set_name": "Github" }
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2000-2006 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ #ifndef __VERSION_H__ #define __VERSION_H__ #include <timestamp.h> #ifndef DO_DEPS_ONLY #include "generated/version_autogenerated.h" #endif #define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING #ifndef __ASSEMBLY__ extern const char version_string[]; #endif /* __ASSEMBLY__ */ #endif /* __VERSION_H__ */
{ "pile_set_name": "Github" }
/* * This file is part of the SDWebImage package. * (c) Olivier Poitrey <rs@dailymotion.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ #import "UIView+WebCache.h" #import "objc/runtime.h" #import "UIView+WebCacheOperation.h" #import "SDWebImageError.h" #import "SDInternalMacros.h" const int64_t SDWebImageProgressUnitCountUnknown = 1LL; @implementation UIView (WebCache) - (nullable NSURL *)sd_imageURL { return objc_getAssociatedObject(self, @selector(sd_imageURL)); } - (void)setSd_imageURL:(NSURL * _Nullable)sd_imageURL { objc_setAssociatedObject(self, @selector(sd_imageURL), sd_imageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } - (nullable NSString *)sd_latestOperationKey { return objc_getAssociatedObject(self, @selector(sd_latestOperationKey)); } - (void)setSd_latestOperationKey:(NSString * _Nullable)sd_latestOperationKey { objc_setAssociatedObject(self, @selector(sd_latestOperationKey), sd_latestOperationKey, OBJC_ASSOCIATION_COPY_NONATOMIC); } - (NSProgress *)sd_imageProgress { NSProgress *progress = objc_getAssociatedObject(self, @selector(sd_imageProgress)); if (!progress) { progress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; self.sd_imageProgress = progress; } return progress; } - (void)setSd_imageProgress:(NSProgress *)sd_imageProgress { objc_setAssociatedObject(self, @selector(sd_imageProgress), sd_imageProgress, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } - (void)sd_internalSetImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context setImageBlock:(nullable SDSetImageBlock)setImageBlock progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDInternalCompletionBlock)completedBlock { context = [context copy]; // copy to avoid mutable object NSString *validOperationKey = context[SDWebImageContextSetImageOperationKey]; if (!validOperationKey) { validOperationKey = NSStringFromClass([self class]); } self.sd_latestOperationKey = validOperationKey; [self sd_cancelImageLoadOperationWithKey:validOperationKey]; self.sd_imageURL = url; if (!(options & SDWebImageDelayPlaceholder)) { dispatch_main_async_safe(^{ [self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:SDImageCacheTypeNone imageURL:url]; }); } if (url) { // reset the progress NSProgress *imageProgress = objc_getAssociatedObject(self, @selector(sd_imageProgress)); if (imageProgress) { imageProgress.totalUnitCount = 0; imageProgress.completedUnitCount = 0; } #if SD_UIKIT || SD_MAC // check and start image indicator [self sd_startImageIndicator]; id<SDWebImageIndicator> imageIndicator = self.sd_imageIndicator; #endif SDWebImageManager *manager = context[SDWebImageContextCustomManager]; if (!manager) { manager = [SDWebImageManager sharedManager]; } SDImageLoaderProgressBlock combinedProgressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { if (imageProgress) { imageProgress.totalUnitCount = expectedSize; imageProgress.completedUnitCount = receivedSize; } #if SD_UIKIT || SD_MAC if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) { double progress = 0; if (expectedSize != 0) { progress = (double)receivedSize / expectedSize; } progress = MAX(MIN(progress, 1), 0); // 0.0 - 1.0 dispatch_async(dispatch_get_main_queue(), ^{ [imageIndicator updateIndicatorProgress:progress]; }); } #endif if (progressBlock) { progressBlock(receivedSize, expectedSize, targetURL); } }; @weakify(self); id <SDWebImageOperation> operation = [manager loadImageWithURL:url options:options context:context progress:combinedProgressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { @strongify(self); if (!self) { return; } // if the progress not been updated, mark it to complete state if (imageProgress && finished && !error && imageProgress.totalUnitCount == 0 && imageProgress.completedUnitCount == 0) { imageProgress.totalUnitCount = SDWebImageProgressUnitCountUnknown; imageProgress.completedUnitCount = SDWebImageProgressUnitCountUnknown; } #if SD_UIKIT || SD_MAC // check and stop image indicator if (finished) { [self sd_stopImageIndicator]; } #endif BOOL shouldCallCompletedBlock = finished || (options & SDWebImageAvoidAutoSetImage); BOOL shouldNotSetImage = ((image && (options & SDWebImageAvoidAutoSetImage)) || (!image && !(options & SDWebImageDelayPlaceholder))); SDWebImageNoParamsBlock callCompletedBlockClojure = ^{ if (!self) { return; } if (!shouldNotSetImage) { [self sd_setNeedsLayout]; } if (completedBlock && shouldCallCompletedBlock) { completedBlock(image, data, error, cacheType, finished, url); } }; // case 1a: we got an image, but the SDWebImageAvoidAutoSetImage flag is set // OR // case 1b: we got no image and the SDWebImageDelayPlaceholder is not set if (shouldNotSetImage) { dispatch_main_async_safe(callCompletedBlockClojure); return; } UIImage *targetImage = nil; NSData *targetData = nil; if (image) { // case 2a: we got an image and the SDWebImageAvoidAutoSetImage is not set targetImage = image; targetData = data; } else if (options & SDWebImageDelayPlaceholder) { // case 2b: we got no image and the SDWebImageDelayPlaceholder flag is set targetImage = placeholder; targetData = nil; } #if SD_UIKIT || SD_MAC // check whether we should use the image transition SDWebImageTransition *transition = nil; if (finished && (options & SDWebImageForceTransition || cacheType == SDImageCacheTypeNone)) { transition = self.sd_imageTransition; } #endif dispatch_main_async_safe(^{ #if SD_UIKIT || SD_MAC [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:transition cacheType:cacheType imageURL:imageURL]; #else [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:cacheType imageURL:imageURL]; #endif callCompletedBlockClojure(); }); }]; [self sd_setImageLoadOperation:operation forKey:validOperationKey]; } else { #if SD_UIKIT || SD_MAC [self sd_stopImageIndicator]; #endif dispatch_main_async_safe(^{ if (completedBlock) { NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @"Image url is nil"}]; completedBlock(nil, nil, error, SDImageCacheTypeNone, YES, url); } }); } } - (void)sd_cancelCurrentImageLoad { [self sd_cancelImageLoadOperationWithKey:self.sd_latestOperationKey]; } - (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL { #if SD_UIKIT || SD_MAC [self sd_setImage:image imageData:imageData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:nil cacheType:cacheType imageURL:imageURL]; #else // watchOS does not support view transition. Simplify the logic if (setImageBlock) { setImageBlock(image, imageData, cacheType, imageURL); } else if ([self isKindOfClass:[UIImageView class]]) { UIImageView *imageView = (UIImageView *)self; [imageView setImage:image]; } #endif } #if SD_UIKIT || SD_MAC - (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock transition:(SDWebImageTransition *)transition cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL { UIView *view = self; SDSetImageBlock finalSetImageBlock; if (setImageBlock) { finalSetImageBlock = setImageBlock; } else if ([view isKindOfClass:[UIImageView class]]) { UIImageView *imageView = (UIImageView *)view; finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { imageView.image = setImage; }; } #if SD_UIKIT else if ([view isKindOfClass:[UIButton class]]) { UIButton *button = (UIButton *)view; finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { [button setImage:setImage forState:UIControlStateNormal]; }; } #endif #if SD_MAC else if ([view isKindOfClass:[NSButton class]]) { NSButton *button = (NSButton *)view; finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { button.image = setImage; }; } #endif if (transition) { #if SD_UIKIT [UIView transitionWithView:view duration:0 options:0 animations:^{ // 0 duration to let UIKit render placeholder and prepares block if (transition.prepares) { transition.prepares(view, image, imageData, cacheType, imageURL); } } completion:^(BOOL finished) { [UIView transitionWithView:view duration:transition.duration options:transition.animationOptions animations:^{ if (finalSetImageBlock && !transition.avoidAutoSetImage) { finalSetImageBlock(image, imageData, cacheType, imageURL); } if (transition.animations) { transition.animations(view, image); } } completion:transition.completion]; }]; #elif SD_MAC [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull prepareContext) { // 0 duration to let AppKit render placeholder and prepares block prepareContext.duration = 0; if (transition.prepares) { transition.prepares(view, image, imageData, cacheType, imageURL); } } completionHandler:^{ [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { context.duration = transition.duration; context.timingFunction = transition.timingFunction; context.allowsImplicitAnimation = SD_OPTIONS_CONTAINS(transition.animationOptions, SDWebImageAnimationOptionAllowsImplicitAnimation); if (finalSetImageBlock && !transition.avoidAutoSetImage) { finalSetImageBlock(image, imageData, cacheType, imageURL); } if (transition.animations) { transition.animations(view, image); } } completionHandler:^{ if (transition.completion) { transition.completion(YES); } }]; }]; #endif } else { if (finalSetImageBlock) { finalSetImageBlock(image, imageData, cacheType, imageURL); } } } #endif - (void)sd_setNeedsLayout { #if SD_UIKIT [self setNeedsLayout]; #elif SD_MAC [self setNeedsLayout:YES]; #elif SD_WATCH // Do nothing because WatchKit automatically layout the view after property change #endif } #if SD_UIKIT || SD_MAC #pragma mark - Image Transition - (SDWebImageTransition *)sd_imageTransition { return objc_getAssociatedObject(self, @selector(sd_imageTransition)); } - (void)setSd_imageTransition:(SDWebImageTransition *)sd_imageTransition { objc_setAssociatedObject(self, @selector(sd_imageTransition), sd_imageTransition, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } #pragma mark - Indicator - (id<SDWebImageIndicator>)sd_imageIndicator { return objc_getAssociatedObject(self, @selector(sd_imageIndicator)); } - (void)setSd_imageIndicator:(id<SDWebImageIndicator>)sd_imageIndicator { // Remove the old indicator view id<SDWebImageIndicator> previousIndicator = self.sd_imageIndicator; [previousIndicator.indicatorView removeFromSuperview]; objc_setAssociatedObject(self, @selector(sd_imageIndicator), sd_imageIndicator, OBJC_ASSOCIATION_RETAIN_NONATOMIC); // Add the new indicator view UIView *view = sd_imageIndicator.indicatorView; if (CGRectEqualToRect(view.frame, CGRectZero)) { view.frame = self.bounds; } // Center the indicator view #if SD_MAC CGPoint center = CGPointMake(NSMidX(self.bounds), NSMidY(self.bounds)); NSRect frame = view.frame; view.frame = NSMakeRect(center.x - NSMidX(frame), center.y - NSMidY(frame), NSWidth(frame), NSHeight(frame)); #else view.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); #endif view.hidden = NO; [self addSubview:view]; } - (void)sd_startImageIndicator { id<SDWebImageIndicator> imageIndicator = self.sd_imageIndicator; if (!imageIndicator) { return; } dispatch_main_async_safe(^{ [imageIndicator startAnimatingIndicator]; }); } - (void)sd_stopImageIndicator { id<SDWebImageIndicator> imageIndicator = self.sd_imageIndicator; if (!imageIndicator) { return; } dispatch_main_async_safe(^{ [imageIndicator stopAnimatingIndicator]; }); } #endif @end
{ "pile_set_name": "Github" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Linq; using System.Threading; using Xunit; namespace System.IO.Tests { public class FileInfo_GetSetTimes : InfoGetSetTimes<FileInfo> { protected override FileInfo GetExistingItem() { string path = GetTestFilePath(); File.Create(path).Dispose(); return new FileInfo(path); } private static bool HasNonZeroNanoseconds(DateTime dt) => dt.Ticks % 10 != 0; public FileInfo GetNonZeroMilliseconds() { FileInfo fileinfo = new FileInfo(GetTestFilePath()); fileinfo.Create().Dispose(); if (fileinfo.LastWriteTime.Millisecond == 0) { DateTime dt = fileinfo.LastWriteTime; dt = dt.AddMilliseconds(1); fileinfo.LastWriteTime = dt; } Assert.NotEqual(0, fileinfo.LastWriteTime.Millisecond); return fileinfo; } public FileInfo GetNonZeroNanoseconds() { FileInfo fileinfo = new FileInfo(GetTestFilePath()); fileinfo.Create().Dispose(); if (!HasNonZeroNanoseconds(fileinfo.LastWriteTime)) { if (PlatformDetection.IsOSXLike) return null; DateTime dt = fileinfo.LastWriteTime; dt = dt.AddTicks(1); fileinfo.LastWriteTime = dt; } Assert.True(HasNonZeroNanoseconds(fileinfo.LastWriteTime)); return fileinfo; } protected override FileInfo GetMissingItem() => new FileInfo(GetTestFilePath()); protected override string GetItemPath(FileInfo item) => item.FullName; protected override void InvokeCreate(FileInfo item) => item.Create(); public override IEnumerable<TimeFunction> TimeFunctions(bool requiresRoundtripping = false) { if (IOInputs.SupportsGettingCreationTime && (!requiresRoundtripping || IOInputs.SupportsSettingCreationTime)) { yield return TimeFunction.Create( ((testFile, time) => { testFile.CreationTime = time; }), ((testFile) => testFile.CreationTime), DateTimeKind.Local); yield return TimeFunction.Create( ((testFile, time) => { testFile.CreationTimeUtc = time; }), ((testFile) => testFile.CreationTimeUtc), DateTimeKind.Unspecified); yield return TimeFunction.Create( ((testFile, time) => { testFile.CreationTimeUtc = time; }), ((testFile) => testFile.CreationTimeUtc), DateTimeKind.Utc); } yield return TimeFunction.Create( ((testFile, time) => { testFile.LastAccessTime = time; }), ((testFile) => testFile.LastAccessTime), DateTimeKind.Local); yield return TimeFunction.Create( ((testFile, time) => { testFile.LastAccessTimeUtc = time; }), ((testFile) => testFile.LastAccessTimeUtc), DateTimeKind.Unspecified); yield return TimeFunction.Create( ((testFile, time) => { testFile.LastAccessTimeUtc = time; }), ((testFile) => testFile.LastAccessTimeUtc), DateTimeKind.Utc); yield return TimeFunction.Create( ((testFile, time) => { testFile.LastWriteTime = time; }), ((testFile) => testFile.LastWriteTime), DateTimeKind.Local); yield return TimeFunction.Create( ((testFile, time) => { testFile.LastWriteTimeUtc = time; }), ((testFile) => testFile.LastWriteTimeUtc), DateTimeKind.Unspecified); yield return TimeFunction.Create( ((testFile, time) => { testFile.LastWriteTimeUtc = time; }), ((testFile) => testFile.LastWriteTimeUtc), DateTimeKind.Utc); } [ConditionalFact(nameof(HighTemporalResolution))] public void CopyToMillisecondPresent() { FileInfo input = GetNonZeroMilliseconds(); FileInfo output = new FileInfo(Path.Combine(GetTestFilePath(), input.Name)); Assert.Equal(0, output.LastWriteTime.Millisecond); output.Directory.Create(); output = input.CopyTo(output.FullName, true); Assert.Equal(input.LastWriteTime.Millisecond, output.LastWriteTime.Millisecond); Assert.NotEqual(0, output.LastWriteTime.Millisecond); } [ConditionalFact(nameof(HighTemporalResolution))] public void CopyToNanosecondsPresent() { FileInfo input = GetNonZeroNanoseconds(); if (input == null) return; FileInfo output = new FileInfo(Path.Combine(GetTestFilePath(), input.Name)); output.Directory.Create(); output = input.CopyTo(output.FullName, true); Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); Assert.True(HasNonZeroNanoseconds(output.LastWriteTime)); } [ConditionalFact(nameof(LowTemporalResolution))] public void CopyToNanosecondsPresent_LowTempRes() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); FileInfo output = new FileInfo(Path.Combine(GetTestFilePath(), input.Name)); output.Directory.Create(); output = input.CopyTo(output.FullName, true); Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); Assert.False(HasNonZeroNanoseconds(output.LastWriteTime)); } [ConditionalFact(nameof(LowTemporalResolution))] public void MoveToMillisecondPresent_LowTempRes() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); string dest = Path.Combine(input.DirectoryName, GetTestFileName()); input.MoveTo(dest); FileInfo output = new FileInfo(dest); Assert.Equal(0, output.LastWriteTime.Millisecond); } [ConditionalFact(nameof(HighTemporalResolution))] public void MoveToMillisecondPresent() { FileInfo input = GetNonZeroMilliseconds(); string dest = Path.Combine(input.DirectoryName, GetTestFileName()); input.MoveTo(dest); FileInfo output = new FileInfo(dest); Assert.NotEqual(0, output.LastWriteTime.Millisecond); } [ConditionalFact(nameof(LowTemporalResolution))] public void CopyToMillisecondPresent_LowTempRes() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); FileInfo output = new FileInfo(Path.Combine(GetTestFilePath(), input.Name)); output.Directory.Create(); output = input.CopyTo(output.FullName, true); Assert.Equal(input.LastWriteTime.Millisecond, output.LastWriteTime.Millisecond); Assert.Equal(0, output.LastWriteTime.Millisecond); } [Fact] public void DeleteAfterEnumerate_TimesStillSet() { // When enumerating we populate the state as we already have it. string filePath = GetTestFilePath(); File.Create(filePath).Dispose(); FileInfo info = new DirectoryInfo(TestDirectory).EnumerateFiles().First(); info.Delete(); Assert.Equal(DateTime.FromFileTimeUtc(0), info.LastAccessTimeUtc); } [Fact] [PlatformSpecific(TestPlatforms.Linux)] public void BirthTimeIsNotNewerThanLowestOfAccessModifiedTimes() { // On Linux (if no birth time), we synthesize CreationTime from the oldest of // status changed time (ctime) and write time (mtime) // Sanity check that it is in that range. DateTime before = DateTime.UtcNow.AddMinutes(-1); FileInfo fi = GetExistingItem(); // should set ctime fi.LastWriteTimeUtc = DateTime.UtcNow.AddMinutes(1); // mtime fi.LastAccessTimeUtc = DateTime.UtcNow.AddMinutes(2); // atime // Assert.InRange is inclusive Assert.InRange(fi.CreationTimeUtc, before, fi.LastWriteTimeUtc); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInAppContainer))] // Can't read root in appcontainer [PlatformSpecific(TestPlatforms.Windows)] public void PageFileHasTimes() { // Typically there is a page file on the C: drive, if not, don't bother trying to track it down. string pageFilePath = Directory.EnumerateFiles(@"C:\", "pagefile.sys").FirstOrDefault(); if (pageFilePath != null) { Assert.All(TimeFunctions(), (item) => { var time = item.Getter(new FileInfo(pageFilePath)); Assert.NotEqual(DateTime.FromFileTime(0), time); }); } } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#ff000000" android:endColor="#ff272d33" android:angle="270" /> </shape>
{ "pile_set_name": "Github" }
#! gmake # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. ####################################################################### # (1) Include initial platform-independent assignments (MANDATORY). # ####################################################################### include manifest.mn ####################################################################### # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### # (3) Include "component" configuration information. (OPTIONAL) # ####################################################################### ####################################################################### # (4) Include "local" platform-dependent assignments (OPTIONAL). # ####################################################################### include config.mk # default for all platforms # unset this on those that have multiple freebl libraries FREEBL_BUILD_SINGLE_SHLIB = 1 ifdef USE_64 DEFINES += -DNSS_USE_64 endif ifdef USE_ABI32_FPU DEFINES += -DNSS_USE_ABI32_FPU endif ifeq ($(FREEBL_NO_DEPEND),1) DEFINES += -DFREEBL_NO_DEPEND STUBS_SRCS = stubs.c endif ifeq ($(FREEBL_LOWHASH),1) DEFINES += -DFREEBL_LOWHASH LOWHASH_SRCS = nsslowhash.c LOWHASH_EXPORTS = nsslowhash.h MAPFILE_SOURCE = freebl_hash_vector.def NEED_STUB_BUILD = 1 else MAPFILE_SOURCE = freebl.def endif ifdef USE_STUB_BUILD CSRCS = lowhash_vector.c SIMPLE_OBJS = $(CSRCS:.c=$(OBJ_SUFFIX)) OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS)) ALL_TRASH := $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \ $(NOSUCHFILE) so_locations MAPFILE_SOURCE = freebl_hash.def endif # FREEBL_USE_PRELINK # # Most modern version of Linux support a speed optimization scheme where an # application called prelink modifies programs and shared libraries to quickly # load if they fit into an already designed address space. In short, prelink # scans the list of programs and libraries on your system, assigns them a # predefined space in the the address space, then provides the fixups to the # library. # # The modification of the shared library is correctly detected by the freebl # FIPS checksum scheme where we check a signed hash of the library against the # library itself. # # The prelink command itself can reverse the process of modification and output # the prestine shared library as it was before prelink made it's changes. # This option tells Freebl could use prelink to output the original copy of # the shared library before prelink modified it. # # FREEBL_PRELINK_COMMAND # # This is an optional environment variable which can override the default # prelink command. It could be used on systems that did something similiar to # prelink but used a different command and syntax. The only requirement is the # program must take the library as the last argument, the program must output # the original library to standard out, and the program does not need to take # any quoted or imbedded spaces in its arguments (except the path to the # library itself, which can have imbedded spaces or special characters). # ifdef FREEBL_USE_PRELINK DEFINES += -DFREEBL_USE_PRELINK ifdef LINUX DEFINES += -D__GNU_SOURCE=1 endif endif ifdef NSS_NO_INIT_SUPPORT DEFINES += -DNSS_NO_INIT_SUPPORT endif ifdef FREEBL_PRELINK_COMMAND DEFINES +=-DFREEBL_PRELINK_COMMAND=\"$(FREEBL_PRELINK_COMMAND)\" endif # NSS_X86 means the target is a 32-bits x86 CPU architecture # NSS_X64 means the target is a 64-bits 64 CPU architecture # NSS_X86_OR_X64 means the target is either x86 or x64 ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH))) DEFINES += -DNSS_X86_OR_X64 EXTRA_SRCS += gcm-x86.c aes-x86.c $(OBJDIR)/gcm-x86.o: CFLAGS += -mpclmul -maes $(OBJDIR)/aes-x86.o: CFLAGS += -mpclmul -maes ifneq (,$(USE_64)$(USE_X32)) DEFINES += -DNSS_X64 else DEFINES += -DNSS_X86 endif endif ifeq ($(CPU_ARCH),aarch64) ifdef CC_IS_CLANG DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2 EXTRA_SRCS += aes-armv8.c gcm-aarch64.c sha1-armv8.c sha256-armv8.c else ifeq (1,$(CC_IS_GCC)) # GCC versions older than 4.9 don't support ARM AES. The check # is done in two parts, first allows "major.minor" == "4.9", # and then rejects any major versions prior to 5. Note that # there has been no GCC 4.10, as it was renamed to GCC 5. ifneq (,$(filter 4.9,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION)))) DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2 EXTRA_SRCS += aes-armv8.c gcm-aarch64.c sha1-armv8.c sha256-armv8.c endif ifeq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION)))) DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2 EXTRA_SRCS += aes-armv8.c gcm-aarch64.c sha1-armv8.c sha256-armv8.c endif endif endif ifeq ($(CPU_ARCH),arm) ifndef NSS_DISABLE_ARM32_NEON EXTRA_SRCS += gcm-arm32-neon.c endif ifdef CC_IS_CLANG DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2 EXTRA_SRCS += aes-armv8.c sha1-armv8.c sha256-armv8.c else ifeq (1,$(CC_IS_GCC)) # GCC versions older than 4.9 don't support ARM AES. The check # is done in two parts, first allows "major.minor" == "4.9", # and then rejects any major versions prior to 5. Note that # there has been no GCC 4.10, as it was renamed to GCC 5. ifneq (,$(filter 4.9,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION)))) DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2 EXTRA_SRCS += aes-armv8.c sha1-armv8.c sha256-armv8.c endif ifeq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION)))) DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2 EXTRA_SRCS += aes-armv8.c sha1-armv8.c sha256-armv8.c endif endif endif ifeq ($(OS_TARGET),OSF1) DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD MPI_SRCS += mpvalpha.c endif ifeq (OS2,$(OS_TARGET)) ASFILES = mpi_x86_os2.s DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_ASSEMBLY_DIV_2DX1D DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD DEFINES += -DMP_IS_LITTLE_ENDIAN endif ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) ifndef USE_64 # 32-bit Windows ifdef NS_USE_GCC # Ideally, we want to use assembler # ASFILES = mpi_x86.s # DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE \ # -DMP_ASSEMBLY_DIV_2DX1D # but we haven't figured out how to make it work, so we are not # using assembler right now. ASFILES = DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT else # MSVC MPI_SRCS += mpi_x86_asm.c DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD ifdef BUILD_OPT OPTIMIZER += -Ox # maximum optimization for freebl endif # The Intel AES assembly code requires Visual C++ 2010. # if $(_MSC_VER) >= 1600 (Visual C++ 2010) ifeq ($(firstword $(sort $(_MSC_VER) 1600)),1600) DEFINES += -DUSE_HW_AES -DINTEL_GCM ASFILES += intel-aes-x86-masm.asm intel-gcm-x86-masm.asm EXTRA_SRCS += intel-gcm-wrap.c ifeq ($(CLANG_CL),1) INTEL_GCM_CLANG_CL = 1 endif endif endif else # -DMP_NO_MP_WORD DEFINES += -DMP_IS_LITTLE_ENDIAN ifdef NS_USE_GCC # Ideally, we should use amd64 assembly code, but it's not yet mingw-w64 # compatible. else # MSVC ifdef BUILD_OPT OPTIMIZER += -Ox # maximum optimization for freebl endif ifeq ($(CPU_ARCH),x86_64) ASFILES = arcfour-amd64-masm.asm mpi_amd64_masm.asm mp_comba_amd64_masm.asm DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY DEFINES += -DNSS_USE_COMBA # The Intel AES assembly code requires Visual C++ 2010 (10.0). The _xgetbv # compiler intrinsic function requires Visual C++ 2010 (10.0) SP1. ifeq ($(_MSC_VER_GE_10SP1),1) DEFINES += -DUSE_HW_AES -DINTEL_GCM ASFILES += intel-aes-x64-masm.asm intel-gcm-x64-masm.asm EXTRA_SRCS += intel-gcm-wrap.c ifeq ($(CLANG_CL),1) INTEL_GCM_CLANG_CL = 1 endif endif MPI_SRCS += mpi_amd64.c endif endif endif endif ifeq ($(OS_TARGET),IRIX) ifeq ($(USE_N32),1) ASFILES = mpi_mips.s ifeq ($(NS_USE_GCC),1) ASFLAGS = -Wp,-P -Wp,-traditional -O -mips3 else ASFLAGS = -O -OPT:Olimit=4000 -dollar -fullwarn -xansi -n32 -mips3 endif DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_USE_UINT_DIGIT endif endif ifeq ($(OS_TARGET),Darwin) ifeq ($(CPU_ARCH),x86_64) ASFILES = mpi_amd64_common.s DEFINES += -DMPI_AMD64 -DMP_IS_LITTLE_ENDIAN DEFINES += -DMP_ASSEMBLY_MULTIPLY -DNSS_USE_COMBA MPI_SRCS += mpi_amd64.c mp_comba.c else ifeq ($(CPU_ARCH),x86) ASFILES = mpi_sse2.s DEFINES += -DMP_USE_UINT_DIGIT DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_ASSEMBLY_DIV_2DX1D endif endif # Darwin ifeq ($(OS_TARGET),Linux) ifeq ($(CPU_ARCH),x86_64) # Lower case s on mpi_amd64_common due to make implicit rules. ASFILES = arcfour-amd64-gas.s mpi_amd64_common.s ASFLAGS += -fPIC -Wa,--noexecstack DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY DEFINES += -DNSS_USE_COMBA DEFINES += -DMP_IS_LITTLE_ENDIAN # DEFINES += -DMPI_AMD64_ADD # comment the next four lines to turn off Intel HW acceleration. DEFINES += -DUSE_HW_AES -DINTEL_GCM ASFILES += intel-aes.s intel-gcm.s EXTRA_SRCS += intel-gcm-wrap.c INTEL_GCM = 1 MPI_SRCS += mpi_amd64.c mp_comba.c endif ifeq ($(CPU_ARCH),x86) ASFILES = mpi_x86.s DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT DEFINES += -DMP_IS_LITTLE_ENDIAN endif ifeq ($(CPU_ARCH),arm) DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_USE_UINT_DIGIT DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 MPI_SRCS += mpi_arm.c endif ifeq ($(CPU_ARCH),ppc) EXTRA_SRCS += gcm-ppc.c ASFILES += sha512-p8.s ifdef USE_64 DEFINES += -DNSS_NO_INIT_SUPPORT endif # USE_64 endif # ppc endif # Linux ifeq ($(OS_TARGET),AIX) DEFINES += -DMP_USE_UINT_DIGIT ifndef USE_64 DEFINES += -DMP_NO_DIV_WORD -DMP_NO_ADD_WORD -DMP_NO_SUB_WORD endif endif # AIX ifeq ($(OS_TARGET), HP-UX) ifneq ($(OS_TEST), ia64) # PA-RISC ASFILES += ret_cr16.s ifndef USE_64 FREEBL_BUILD_SINGLE_SHLIB = HAVE_ABI32_INT32 = 1 HAVE_ABI32_FPU = 1 endif ifdef FREEBL_CHILD_BUILD ifdef USE_ABI32_INT32 # build for DA1.1 (HP PA 1.1) 32-bit ABI build with 32-bit arithmetic DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 else ifdef USE_64 # this builds for DA2.0W (HP PA 2.0 Wide), the LP64 ABI, using 64-bit digits MPI_SRCS += mpi_hp.c ASFILES += hpma512.s hppa20.s DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE else # this builds for DA2.0 (HP PA 2.0 Narrow) ABI32_FPU model # (the 32-bit ABI with 64-bit registers) using 64-bit digits MPI_SRCS += mpi_hp.c ASFILES += hpma512.s hppa20.s DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE ifndef NS_USE_GCC ARCHFLAG = -Aa +e +DA2.0 +DS2.0 endif endif endif endif endif endif # The blapi functions are defined not only in the freebl shared # libraries but also in the shared libraries linked with loader.c # (libsoftokn3.so and libssl3.so). We need to use GNU ld's # -Bsymbolic option or the equivalent option for other linkers # to bind the blapi function references in FREEBLVector vector # (ldvector.c) to the blapi functions defined in the freebl # shared libraries. ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET))) MKSHLIB += -Wl,-Bsymbolic endif ifeq ($(OS_TARGET),SunOS) ifdef NS_USE_GCC ifdef GCC_USE_GNU_LD MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text else MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text endif # GCC_USE_GNU_LD else MKSHLIB += -B symbolic -z now -z text endif # NS_USE_GCC # Sun's WorkShop defines v8, v8plus and v9 architectures. # gcc on Solaris defines v8 and v9 "cpus". # gcc's v9 is equivalent to Workshop's v8plus. # gcc's -m64 is equivalent to Workshop's v9 # We always use Sun's assembler, which uses Sun's naming convention. ifeq ($(CPU_ARCH),sparc) FREEBL_BUILD_SINGLE_SHLIB= ifdef USE_64 HAVE_ABI64_INT = 1 HAVE_ABI64_FPU = 1 else HAVE_ABI32_FPU = 1 HAVE_ABI32_INT64 = 1 endif SYSV_SPARC = 1 SOLARIS_AS = /usr/ccs/bin/as #### set arch, asm, c flags ifdef NS_USE_GCC ifdef USE_ABI32_INT64 ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC endif ifdef USE_ABI32_FPU ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plusa SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC endif # USE_ABI32_FPU ifdef USE_ABI64_INT # this builds for Sparc v9a pure 64-bit architecture ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9 SOLARIS_AS_FLAGS = -xarch=v9 -K PIC endif ifdef USE_ABI64_FPU # this builds for Sparc v9a pure 64-bit architecture # It uses floating point, and 32-bit word size ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9a SOLARIS_AS_FLAGS = -xarch=v9a -K PIC endif else # NS_USE_GCC # FPU_TARGET_OPTIMIZER specifies the target processor and cache # properties of the ABI32_FPU and ABI64_FPU architectures for use # by the optimizer. ifeq (,$(findstring Sun WorkShop 6,$(shell $(CC) -V 2>&1))) # if the compiler is not Forte 6 FPU_TARGET_OPTIMIZER = -xcache=64/32/4:1024/64/4 -xchip=ultra3 else # Forte 6 C compiler generates incorrect code for rijndael.c # if -xchip=ultra3 is used (Bugzilla bug 333925). So we revert # to what we used in NSS 3.10. FPU_TARGET_OPTIMIZER = -xchip=ultra2 endif ifdef USE_ABI32_INT64 # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, # 32-bit ABI, it uses 64-bit words, integer arithmetic, # no FPU (non-VIS cpus). # These flags were suggested by the compiler group for building # with SunStudio 10. ifdef BUILD_OPT SOL_CFLAGS += -xO4 endif SOL_CFLAGS += -xtarget=generic ARCHFLAG = -xarch=v8plus SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC endif ifdef USE_ABI32_FPU # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, # 32-bit ABI, it uses FPU code, and 32-bit word size. # these flags were determined by running cc -### -fast and copying # the generated flag settings SOL_CFLAGS += -fsingle -xmemalign=8s ifdef BUILD_OPT SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend SOL_CFLAGS += -xlibmil -xO5 endif ARCHFLAG = -xarch=v8plusa SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC endif ifdef USE_ABI64_INT # this builds for Sparc v9a pure 64-bit architecture, # no FPU (non-VIS cpus). For building with SunStudio 10. ifdef BUILD_OPT SOL_CFLAGS += -xO4 endif SOL_CFLAGS += -xtarget=generic ARCHFLAG = -xarch=v9 SOLARIS_AS_FLAGS = -xarch=v9 -K PIC endif ifdef USE_ABI64_FPU # this builds for Sparc v9a pure 64-bit architecture # It uses floating point, and 32-bit word size. # See comment for USE_ABI32_FPU. SOL_CFLAGS += -fsingle -xmemalign=8s ifdef BUILD_OPT SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend SOL_CFLAGS += -xlibmil -xO5 endif ARCHFLAG = -xarch=v9a SOLARIS_AS_FLAGS = -xarch=v9a -K PIC endif endif # NS_USE_GCC ### set flags for both GCC and Sun cc ifdef USE_ABI32_INT64 # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, # 32-bit ABI, it uses 64-bit words, integer arithmetic, no FPU # best times are with no MP_ flags specified endif ifdef USE_ABI32_FPU # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, # 32-bit ABI, it uses FPU code, and 32-bit word size MPI_SRCS += mpi_sparc.c ASFILES = mpv_sparcv8.s montmulfv8.s DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL endif ifdef USE_ABI64_INT # this builds for Sparc v9a pure 64-bit architecture # best times are with no MP_ flags specified endif ifdef USE_ABI64_FPU # this builds for Sparc v9a pure 64-bit architecture # It uses floating point, and 32-bit word size MPI_SRCS += mpi_sparc.c ASFILES = mpv_sparcv9.s montmulfv9.s DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL endif else # Solaris for non-sparc family CPUs ifdef NS_USE_GCC LD = gcc AS = gcc ASFLAGS = -x assembler-with-cpp endif ifeq ($(USE_64),1) # Solaris for AMD64 ifdef NS_USE_GCC ASFILES = arcfour-amd64-gas.s mpi_amd64_common.s ASFLAGS += -march=opteron -m64 -fPIC MPI_SRCS += mp_comba.c # comment the next four lines to turn off Intel HW acceleration ASFILES += intel-gcm.s EXTRA_SRCS += intel-gcm-wrap.c INTEL_GCM = 1 DEFINES += -DINTEL_GCM else ASFILES = arcfour-amd64-sun.s mpi_amd64_sun.s sha-fast-amd64-sun.s ASFILES += mp_comba_amd64_sun.s mpcpucache_amd64.s ASFLAGS += -xarch=generic64 -K PIC SOL_CFLAGS += -xprefetch=no SHA_SRCS = MPCPU_SRCS = # Intel acceleration for GCM does not build currently with Studio endif DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY DEFINES += -DNSS_USE_COMBA -DMP_IS_LITTLE_ENDIAN # comment the next two lines to turn off Intel HW acceleration DEFINES += -DUSE_HW_AES ASFILES += intel-aes.s MPI_SRCS += mpi_amd64.c else # Solaris x86 DEFINES += -DMP_USE_UINT_DIGIT DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE DEFINES += -DMP_ASSEMBLY_DIV_2DX1D ASFILES = mpi_i86pc.s ifndef NS_USE_GCC MPCPU_SRCS = ASFILES += mpcpucache_x86.s endif endif endif # Solaris for non-sparc family CPUs endif # target == SunO ifdef USE_64 # no __int128 at least up to lcc 1.23 (pretending to be gcc5) # NB: CC_NAME is not defined here ifneq ($(shell $(CC) -? 2>&1 >/dev/null </dev/null | sed -e 's/:.*//;1q'),lcc) ifdef CC_IS_CLANG HAVE_INT128_SUPPORT = 1 DEFINES += -DHAVE_INT128_SUPPORT else ifeq (1,$(CC_IS_GCC)) ifneq (,$(filter 4.6 4.7 4.8 4.9,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION)))) HAVE_INT128_SUPPORT = 1 DEFINES += -DHAVE_INT128_SUPPORT endif ifneq (,$(filter 0 1 2 3,$(word 1,$(GCC_VERSION)))) NSS_DISABLE_AVX2 = 1 endif ifeq (4,$(word 1,$(GCC_VERSION))) ifeq (,$(filter 8 9,$(word 2,$(GCC_VERSION)))) NSS_DISABLE_AVX2 = 1 endif endif ifeq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION)))) HAVE_INT128_SUPPORT = 1 DEFINES += -DHAVE_INT128_SUPPORT endif endif endif # lcc endif # USE_64 ifndef HAVE_INT128_SUPPORT DEFINES += -DKRML_VERIFIED_UINT128 endif ifndef NSS_DISABLE_CHACHAPOLY ifeq ($(CPU_ARCH),x86_64) ifndef NSS_DISABLE_AVX2 EXTRA_SRCS += Hacl_Poly1305_256.c Hacl_Chacha20_Vec256.c Hacl_Chacha20Poly1305_256.c endif # NSS_DISABLE_AVX2 EXTRA_SRCS += Hacl_Poly1305_128.c Hacl_Chacha20_Vec128.c Hacl_Chacha20Poly1305_128.c endif # x86_64 VERIFIED_SRCS += Hacl_Poly1305_32.c Hacl_Chacha20.c Hacl_Chacha20Poly1305_32.c endif # NSS_DISABLE_CHACHAPOLY ifeq (,$(filter-out x86_64 aarch64,$(CPU_ARCH))) # All 64-bit architectures get the 64 bit version. ECL_SRCS += curve25519_64.c VERIFIED_SRCS += Hacl_Curve25519_51.c else # All other architectures get the generic 32 bit implementation ECL_SRCS += curve25519_32.c endif ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # ####################################################################### include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### # (6) Execute "component" rules. (OPTIONAL) # ####################################################################### ####################################################################### # (7) Execute "local" rules. (OPTIONAL). # ####################################################################### rijndael_tables: $(CC) -o $(OBJDIR)/make_rijndael_tab rijndael_tables.c \ $(DEFINES) $(INCLUDES) $(OBJDIR)/libfreebl.a $(OBJDIR)/make_rijndael_tab vpath %.h mpi ecl verified deprecated vpath %.c mpi ecl verified deprecated vpath %.S mpi ecl vpath %.s mpi ecl vpath %.asm mpi ecl INCLUDES += -Impi -Iecl -Iverified -Iverified/kremlin/include -Iverified/kremlin/kremlib/dist/minimal -Ideprecated DEFINES += -DMP_API_COMPATIBLE MPI_USERS = dh.c pqg.c dsa.c rsa.c ec.c MPI_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_SRCS:.c=$(OBJ_SUFFIX))) MPI_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_USERS:.c=$(OBJ_SUFFIX))) $(MPI_OBJS): $(MPI_HDRS) ECL_USERS = ec.c ECL_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_SRCS:.c=$(OBJ_SUFFIX)) $(ECL_ASM_SRCS:$(ASM_SUFFIX)=$(OBJ_SUFFIX))) ECL_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_USERS:.c=$(OBJ_SUFFIX))) $(ECL_OBJS): $(ECL_HDRS) $(OBJDIR)/sysrand$(OBJ_SUFFIX): sysrand.c unix_rand.c win_rand.c $(OBJDIR)/$(PROG_PREFIX)mpprime$(OBJ_SUFFIX): primes.c $(OBJDIR)/ldvector$(OBJ_SUFFIX) $(OBJDIR)/loader$(OBJ_SUFFIX) : loader.h ifeq ($(SYSV_SPARC),1) $(OBJDIR)/mpv_sparcv8.o $(OBJDIR)/mpv_sparcv8x.o $(OBJDIR)/montmulfv8.o : $(OBJDIR)/%.o : %.s | $$(@D)/d $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< $(OBJDIR)/mpv_sparcv9.o $(OBJDIR)/montmulfv9.o : $(OBJDIR)/%.o : %.s | $$(@D)/d $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< $(OBJDIR)/mpmontg.o: mpmontg.c montmulf.h endif ifndef FREEBL_CHILD_BUILD # Parent build. This is where we decide which shared libraries to build # too suppress the SINGLE_SHLIB override warning FREEBL_OBJDIRS := define target_freebl_SHLIB ifdef $(2) $(1)_DIR = $$(OBJDIR)/$$(OS_TARGET)_$(1) ALL_TRASH += $$($(1)_DIR) ifeq (,$$(filter $$($(1)_DIR)/d,$$(FREEBL_OBJDIRS))) FREEBL_OBJDIRS += $$($(1)_DIR)/d endif release_md:: freebl_$(2) libs: freebl_$(2) freebl_$(2): | $$($(1)_DIR)/d $$(MAKE) FREEBL_CHILD_BUILD=1 $(3)=1 OBJDIR=$$($(1)_DIR) libs endif endef # target_freebl_SHLIB target_freebl_ABI = $(call target_freebl_SHLIB,$(1),HAVE_$(1),USE_$(1)) $(eval $(call target_freebl_SHLIB,SINGLE_SHLIB,FREEBL_BUILD_SINGLE_SHLIB,NEEDED_DUMMY)) $(eval $(call target_freebl_SHLIB,SINGLE_SHLIB,NEED_STUB_BUILD,USE_STUB_BUILD)) $(eval $(call target_freebl_ABI,ABI32_FPU)) $(eval $(call target_freebl_ABI,ABI32_INT32)) $(eval $(call target_freebl_ABI,ABI32_INT64)) $(eval $(call target_freebl_ABI,ABI64_FPU)) $(eval $(call target_freebl_ABI,ABI64_INT)) endif # FREEBL_CHILD_BUILD # Bugzilla Bug 333917: the non-x86 code in desblapi.c seems to violate # ANSI C's strict aliasing rules. ifeq ($(OS_TARGET),Linux) ifneq ($(CPU_ARCH),x86) $(OBJDIR)/$(PROG_PREFIX)desblapi$(OBJ_SUFFIX): desblapi.c | $$(@D)/d ifdef NEED_ABSOLUTE_PATH $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $(call core_abspath,$<) else $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $< endif endif endif ifdef INTEL_GCM # # GCM binary needs -mssse3 # $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 # The integrated assembler in Clang 3.2 does not support % in the # expression of a .set directive. intel-gcm.s uses .set to give # symbolic names to registers, for example, # .set Htbl, %rdi # So we can't use Clang's integrated assembler with intel-gcm.s. ifdef CC_IS_CLANG $(OBJDIR)/$(PROG_PREFIX)intel-gcm$(OBJ_SUFFIX): CFLAGS += -no-integrated-as endif endif ifdef INTEL_GCM_CLANG_CL # # clang-cl needs -mssse3 # $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 endif ifeq ($(CPU_ARCH),arm) # When the compiler uses the softfloat ABI, we want to use the compatible softfp ABI when # enabling NEON for these objects. # Confusingly, __SOFTFP__ is the name of the define for the softfloat ABI, not for the softfp ABI. USES_SOFTFLOAT_ABI := $(shell $(CC) -o - -E -dM - $(CFLAGS) < /dev/null | grep __SOFTFP__ > /dev/null && echo 1) $(OBJDIR)/$(PROG_PREFIX)aes-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a -mfpu=crypto-neon-fp-armv8$(if $(USES_SOFTFLOAT_ABI), -mfloat-abi=softfp) $(OBJDIR)/$(PROG_PREFIX)sha1-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a -mfpu=crypto-neon-fp-armv8$(if $(USES_SOFTFLOAT_ABI), -mfloat-abi=softfp) $(OBJDIR)/$(PROG_PREFIX)sha256-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a -mfpu=crypto-neon-fp-armv8$(if $(USES_SOFTFLOAT_ABI), -mfloat-abi=softfp) ifndef NSS_DISABLE_ARM32_NEON $(OBJDIR)/$(PROG_PREFIX)gcm-arm32-neon$(OBJ_SUFFIX): CFLAGS += -mfpu=neon$(if $(USES_SOFTFLOAT_ABI), -mfloat-abi=softfp) endif endif ifeq ($(CPU_ARCH),aarch64) $(OBJDIR)/$(PROG_PREFIX)aes-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto $(OBJDIR)/$(PROG_PREFIX)sha1-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto $(OBJDIR)/$(PROG_PREFIX)sha256-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto endif ifeq ($(CPU_ARCH),ppc) ifndef NSS_DISABLE_ALTIVEC $(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx $(OBJDIR)/$(PROG_PREFIX)gcm$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx $(OBJDIR)/$(PROG_PREFIX)rijndael$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx $(OBJDIR)/$(PROG_PREFIX)sha512$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx \ -funroll-loops -fpeel-loops endif endif $(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20_Vec128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -maes $(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20Poly1305_128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -maes $(OBJDIR)/$(PROG_PREFIX)Hacl_Poly1305_128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul ifndef NSS_DISABLE_AVX2 $(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20Poly1305_256$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx2 -maes $(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20_Vec256$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -maes $(OBJDIR)/$(PROG_PREFIX)Hacl_Poly1305_256$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -maes -mpclmul endif
{ "pile_set_name": "Github" }
require('../modules/es6.function.name'); require('../modules/es6.function.has-instance'); module.exports = require('../modules/$.core').Function;
{ "pile_set_name": "Github" }
/* * Noekeon * (C) 1999-2008 Jack Lloyd * * Distributed under the terms of the Botan license */ #include <botan/noekeon.h> #include <botan/loadstor.h> #include <botan/rotate.h> namespace Botan { namespace { /* * Noekeon's Theta Operation */ inline void theta(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3, const u32bit EK[4]) { u32bit T = A0 ^ A2; T ^= rotate_left(T, 8) ^ rotate_right(T, 8); A1 ^= T; A3 ^= T; A0 ^= EK[0]; A1 ^= EK[1]; A2 ^= EK[2]; A3 ^= EK[3]; T = A1 ^ A3; T ^= rotate_left(T, 8) ^ rotate_right(T, 8); A0 ^= T; A2 ^= T; } /* * Theta With Null Key */ inline void theta(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) { u32bit T = A0 ^ A2; T ^= rotate_left(T, 8) ^ rotate_right(T, 8); A1 ^= T; A3 ^= T; T = A1 ^ A3; T ^= rotate_left(T, 8) ^ rotate_right(T, 8); A0 ^= T; A2 ^= T; } /* * Noekeon's Gamma S-Box Layer */ inline void gamma(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) { A1 ^= ~A3 & ~A2; A0 ^= A2 & A1; u32bit T = A3; A3 = A0; A0 = T; A2 ^= A0 ^ A1 ^ A3; A1 ^= ~A3 & ~A2; A0 ^= A2 & A1; } } /* * Noekeon Round Constants */ const byte Noekeon::RC[] = { 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4 }; /* * Noekeon Encryption */ void Noekeon::encrypt_n(const byte in[], byte out[], size_t blocks) const { for(size_t i = 0; i != blocks; ++i) { u32bit A0 = load_be<u32bit>(in, 0); u32bit A1 = load_be<u32bit>(in, 1); u32bit A2 = load_be<u32bit>(in, 2); u32bit A3 = load_be<u32bit>(in, 3); for(size_t j = 0; j != 16; ++j) { A0 ^= RC[j]; theta(A0, A1, A2, A3, &EK[0]); A1 = rotate_left(A1, 1); A2 = rotate_left(A2, 5); A3 = rotate_left(A3, 2); gamma(A0, A1, A2, A3); A1 = rotate_right(A1, 1); A2 = rotate_right(A2, 5); A3 = rotate_right(A3, 2); } A0 ^= RC[16]; theta(A0, A1, A2, A3, &EK[0]); store_be(out, A0, A1, A2, A3); in += BLOCK_SIZE; out += BLOCK_SIZE; } } /* * Noekeon Encryption */ void Noekeon::decrypt_n(const byte in[], byte out[], size_t blocks) const { for(size_t i = 0; i != blocks; ++i) { u32bit A0 = load_be<u32bit>(in, 0); u32bit A1 = load_be<u32bit>(in, 1); u32bit A2 = load_be<u32bit>(in, 2); u32bit A3 = load_be<u32bit>(in, 3); for(size_t j = 16; j != 0; --j) { theta(A0, A1, A2, A3, &DK[0]); A0 ^= RC[j]; A1 = rotate_left(A1, 1); A2 = rotate_left(A2, 5); A3 = rotate_left(A3, 2); gamma(A0, A1, A2, A3); A1 = rotate_right(A1, 1); A2 = rotate_right(A2, 5); A3 = rotate_right(A3, 2); } theta(A0, A1, A2, A3, &DK[0]); A0 ^= RC[0]; store_be(out, A0, A1, A2, A3); in += BLOCK_SIZE; out += BLOCK_SIZE; } } /* * Noekeon Key Schedule */ void Noekeon::key_schedule(const byte key[], size_t) { u32bit A0 = load_be<u32bit>(key, 0); u32bit A1 = load_be<u32bit>(key, 1); u32bit A2 = load_be<u32bit>(key, 2); u32bit A3 = load_be<u32bit>(key, 3); for(size_t i = 0; i != 16; ++i) { A0 ^= RC[i]; theta(A0, A1, A2, A3); A1 = rotate_left(A1, 1); A2 = rotate_left(A2, 5); A3 = rotate_left(A3, 2); gamma(A0, A1, A2, A3); A1 = rotate_right(A1, 1); A2 = rotate_right(A2, 5); A3 = rotate_right(A3, 2); } A0 ^= RC[16]; DK[0] = A0; DK[1] = A1; DK[2] = A2; DK[3] = A3; theta(A0, A1, A2, A3); EK[0] = A0; EK[1] = A1; EK[2] = A2; EK[3] = A3; } /* * Clear memory of sensitive data */ void Noekeon::clear() { zeroise(EK); zeroise(DK); } }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Mesa Release Notes</title> <link rel="stylesheet" type="text/css" href="../mesa.css"> </head> <body> <div class="header"> The Mesa 3D Graphics Library </div> <iframe src="../contents.html"></iframe> <div class="content"> <h1>Mesa 10.2.4 Release Notes / July 18, 2014</h1> <p> Mesa 10.2.4 is a bug fix release which fixes bugs found since the 10.2.3 release. </p> <p> Mesa 10.2.4 implements the OpenGL 3.3 API, but the version reported by glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. Some drivers don't support all the features required in OpenGL 3.3. OpenGL 3.3 is <strong>only</strong> available if requested at context creation because compatibility contexts are not supported. </p> <h2>SHA256 checksums</h2> <pre> 06a2341244eb85c283f59f70161e06ded106f835ed9b6be1ef0243bd9344811a MesaLib-10.2.4.tar.bz2 33e3c8b4343503e7d7d17416c670438860a2fd99ec93ea3327f73c3abe33b5e4 MesaLib-10.2.4.tar.gz e26791a4a62a61b82e506e6ba031812d09697d1a831e8239af67e5722a8ee538 MesaLib-10.2.4.zip </pre> <h2>New features</h2> <p>None</p> <h2>Bug fixes</h2> <p>This list is likely incomplete.</p> <ul> <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81157">Bug 81157</a> - [BDW]Piglit some spec_glsl-1.50_execution_built-in-functions* cases fail</li> </ul> <h2>Changes</h2> <p>Abdiel Janulgue (3):</p> <ul> <li>i965/fs: Refactor check for potential copy propagated instructions.</li> <li>i965/fs: skip copy-propate for logical instructions with negated src entries</li> <li>i965/vec4: skip copy-propate for logical instructions with negated src entries</li> </ul> <p>Brian Paul (3):</p> <ul> <li>mesa: fix geometry shader memory leaks</li> <li>st/mesa: fix geometry shader memory leak</li> <li>gallium/u_blitter: fix some shader memory leaks</li> </ul> <p>Carl Worth (2):</p> <ul> <li>docs: Add sha256 checksums for the 10.2.3 release</li> <li>Update VERSION to 10.2.4</li> </ul> <p>Eric Anholt (1):</p> <ul> <li>i965: Generalize the pixel_x/y workaround for all UW types.</li> </ul> <p>Ilia Mirkin (4):</p> <ul> <li>nv50/ir: retrieve shadow compare from first arg</li> <li>nv50/ir: ignore bias for samplerCubeShadow on nv50</li> <li>nvc0/ir: do quadops on the right texture coordinates for TXD</li> <li>nvc0/ir: use manual TXD when offsets are involved</li> </ul> <p>Jordan Justen (1):</p> <ul> <li>i965: Add auxiliary surface field #defines for Broadwell.</li> </ul> <p>Kenneth Graunke (9):</p> <ul> <li>i965: Don't copy propagate abs into Broadwell logic instructions.</li> <li>i965: Set execution size to 8 for instructions with force_sechalf set.</li> <li>i965/fs: Set force_uncompressed and force_sechalf on samplepos setup.</li> <li>i965/fs: Use WE_all for gl_SampleID header register munging.</li> <li>i965: Add plumbing for Broadwell's auxiliary surface support.</li> <li>i965: Drop SINT workaround for CMS layout on Broadwell.</li> <li>i965: Hook up the MCS buffers in SURFACE_STATE on Broadwell.</li> <li>i965: Add 2x MSAA support to the MCS allocation function.</li> <li>i965: Enable compressed multisample support (CMS) on Broadwell.</li> </ul> <p>Marek Olšák (4):</p> <ul> <li>gallium: fix u_default_transfer_inline_write for textures</li> <li>st/mesa: fix samplerCubeShadow with bias</li> <li>radeonsi: fix samplerCubeShadow with bias</li> <li>radeonsi: add support for TXB2</li> </ul> <p>Matt Turner (8):</p> <ul> <li>i965/vec4: Don't return void from a void function.</li> <li>i965/vec4: Don't fix_math_operand() on Gen &gt;= 8.</li> <li>i965/fs: Don't fix_math_operand() on Gen &gt;= 8.</li> <li>i965/fs: Make try_constant_propagate() static.</li> <li>i965/fs: Constant propagate into 2-src math instructions on Gen8.</li> <li>i965/vec4: Constant propagate into 2-src math instructions on Gen8.</li> <li>i965/fs: Don't use brw_imm_* unnecessarily.</li> <li>i965/fs: Set correct number of regs_written for MCS fetches.</li> </ul> </div> </body> </html>
{ "pile_set_name": "Github" }
defmodule Slack.FakeSlack.Websocket do @behaviour :cowboy_websocket_handler def init(_, _req, _opts) do {:upgrade, :protocol, :cowboy_websocket} end @activity_timeout 5000 def websocket_init(_type, req, _opts) do state = %{} pid = Application.get_env(:slack, :test_pid) send(pid, {:websocket_connected, self()}) {:ok, req, state, @activity_timeout} end def websocket_handle({:text, "ping"}, req, state) do {:reply, {:text, "pong"}, req, state} end def websocket_handle({:text, message}, req, state) do pid = Application.get_env(:slack, :test_pid) send(pid, {:bot_message, Jason.decode!(message)}) {:ok, req, state} end def websocket_info(message, req, state) do {:reply, {:text, message}, req, state} end def websocket_terminate(_reason, _req, _state) do :ok end end
{ "pile_set_name": "Github" }
# Finnish SFS 5966 layout by gitdrik 2020.
{ "pile_set_name": "Github" }
# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: msgid "" msgstr "" "Project-Id-Version: CivilHub\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-07-13 15:01+0200\n" "PO-Revision-Date: 2015-06-27 08:55+0000\n" "Last-Translator: CivilHub <grzegorz@civilhub.org>\n" "Language-Team: Basque (http://www.transifex.com/projects/p/civilhub/language/" "eu/)\n" "Language: eu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/inlines/view.js:74 #: places_core/static/places_core/js/modules/moment.js:13 msgid "just now" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/ui/ui.js:122 msgid "Are you sure you want to do this?" msgstr "Are you sure you want to do this?" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/modules/inlines/view.js:296 msgid "Are you sure" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/bookmarks.js:55 msgid "Remove bookmark" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/bookmarks.js:69 msgid "Add bookmark" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:25 msgid "You are here" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:26 msgid "Right now you can see the location you are currently in." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:31 msgid "Summary" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:32 msgid "Here you can see a list of all of the place's activities." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:37 msgid "An activity" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:38 msgid "" "In this manner we present the activities to you. Each activity has a " "category (e.g. Poll, Discussion, Idea etc.). You can view them by simply " "clicking on text below the title." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:43 msgid "User activity" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:44 msgid "Here you can see all of the user's activities in this place." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:50 msgid "Blog" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:51 msgid "" "Here you can see all of the news connected with the given place. " "Additionally, you can add your own news, to do so click 'add news' in the " "right side menu." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:56 msgid "Discussions" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:57 msgid "" "Here you can view or join discussions of a given place. If you feel like " "adding a new discussion topic you are also free to do so." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:62 msgid "Ideas" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:63 msgid "" "View ideas of other users and vote on them. You can also share your creative " "ideas with others." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:68 msgid "Voting" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:69 msgid "" "Here you can cast your vote. You can view other user's votes by clicking on " "the number of votes in the bottom part of the window." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:74 msgid "Polls" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:75 msgid "A place where you can view all polls of a given place." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:80 msgid "Followers" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:81 msgid "" "Find out who else is active within this place. Here you can find all of the " "users that are following this place." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:86 msgid "See the map" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:87 msgid "Jump into the map and see what is happening in your place." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:92 #: places_core/static/places_core/tpl/city-search-result.html:3 msgid "Country" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/tour.js:93 msgid "" "Choose the place which you want to alter. Remember that you have the power " "to change what is happening within your surroundings." msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/follow-button.js:33 #: places_core/static/places_core/js/modules/locations/follow-button.js:30 #: places_core/static/places_core/js/src/location-list.js:99 #: places_core/static/places_core/js/src/location-list.js:109 msgid "Stop following" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/follow-button.js:34 #: places_core/static/places_core/js/modules/locations/follow-button.js:31 #: places_core/static/places_core/js/modules/userspace/user-follow.js:27 #: places_core/static/places_core/js/src/location-list.js:103 #: places_core/static/places_core/js/src/location-list.js:110 msgid "Follow" msgstr "" #: places_core/static/places_core/js/dist/comment-summary.js:360 #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/dist/location-background.js:394 #: places_core/static/places_core/js/dist/location-delete.js:354 #: places_core/static/places_core/js/dist/organization-background.js:394 #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/dist/postman-write.js:354 #: places_core/static/places_core/js/dist/project-background.js:394 #: places_core/static/places_core/js/dist/projects-details.js:360 #: places_core/static/places_core/js/dist/userspace-background.js:394 #: places_core/static/places_core/js/dist/userspace-form.js:394 #: places_core/static/places_core/js/modules/common/blessbox.js:144 msgid "Thank you for your recommendation" msgstr "" #: places_core/static/places_core/js/dist/location-activity.js:354 #: places_core/static/places_core/js/modules/actstream/action-list.js:100 #: places_core/static/places_core/js/modules/actstream/actions/actionList.js:97 msgid "No activity yet" msgstr "" #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/modules/polls/chartmaker.js:200 msgid "Click and drag in the plot area to zoom in" msgstr "" #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/modules/polls/chartmaker.js:201 msgid "Pinch the chart to zoom in" msgstr "" #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/modules/polls/chartmaker.js:209 msgid "Total visits" msgstr "" #: places_core/static/places_core/js/dist/poll-results.js:370 #: places_core/static/places_core/js/modules/polls/chartmaker.js:240 msgid "Visits" msgstr "" #: places_core/static/places_core/js/modules/actstream/action-list.js:53 #: places_core/static/places_core/js/modules/actstream/action-model.js:19 msgid "Join the discussion" msgstr "" #: places_core/static/places_core/js/modules/blog/news-form.js:27 #: places_core/static/places_core/js/modules/ideas/idea-form.js:29 #: places_core/static/places_core/js/modules/polls/poll-form/create-poll.js:53 #: places_core/static/places_core/js/modules/topics/discussion-form.js:26 msgid "Add tag" msgstr "" #: places_core/static/places_core/js/modules/comments/comment-list-view.js:94 #: places_core/static/places_core/js/modules/comments/comment-model.js:35 #: places_core/static/places_core/js/modules/comments/comment-view.js:213 msgid "Comment cannot be empty" msgstr "" #: places_core/static/places_core/js/modules/comments/comment-view.js:246 msgid "(show)" msgstr "" #: places_core/static/places_core/js/modules/comments/comment-view.js:250 msgid "(hide)" msgstr "" #: places_core/static/places_core/js/modules/comments/comments.js:31 msgid "Show comments" msgstr "" #: places_core/static/places_core/js/modules/comments/comments.js:35 msgid "Hide comments" msgstr "" #: places_core/static/places_core/js/modules/common.js:89 msgid "Scroll to top" msgstr "" #: places_core/static/places_core/js/modules/content/content-collection.js:99 msgid "You are currently not following any location." msgstr "" #: places_core/static/places_core/js/modules/content/content-collection.js:99 msgid "Find your first location." msgstr "" #: places_core/static/places_core/js/modules/ideas/templates/share-modal.html:6 msgid "Share" msgstr "" #: places_core/static/places_core/js/modules/ideas/templates/share-modal.html:9 msgid "Thank you for your vote. Please, share this page with your friends" msgstr "" #: places_core/static/places_core/js/modules/ideas/votes/vote-area.js:106 msgid "How can you help?" msgstr "" #: places_core/static/places_core/js/modules/ideas/votes/vote-area.js:108 #: places_core/static/places_core/js/modules/inlines/templates/reason_form.html:1 msgid "Reason" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/comment.html:29 msgid "Reply" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/comment.html:39 #: places_core/static/places_core/js/modules/inlines/templates/reply_form.html:12 msgid "Submit comment" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/comment_removed.html:9 msgid "This comment has been hidden by moderator" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/comment_removed.html:10 msgid "Show me why" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/comment_removed.html:15 msgid "hide" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/edit_form.html:6 msgid "Cancel" msgstr "" #: places_core/static/places_core/js/modules/inlines/templates/reply_form.html:7 msgid "Comment" msgstr "" #: places_core/static/places_core/js/modules/locations/stats.js:125 #: places_core/static/places_core/js/modules/locations/stats.js:168 msgid "Total objects" msgstr "" #: places_core/static/places_core/js/modules/maps/templates/map-location.html:3 msgid "Place" msgstr "" #: places_core/static/places_core/js/modules/topics/discussion-form.js:35 msgid "Opened" msgstr "" #: places_core/static/places_core/js/modules/topics/discussion-form.js:36 msgid "Closed" msgstr "" #: places_core/static/places_core/js/modules/userspace/google-contacts.js:97 msgid "All messages sent successfully" msgstr "" #: places_core/static/places_core/js/modules/userspace/user-follow.js:23 msgid "You are following" msgstr "" #: places_core/static/places_core/js/modules/userspace/user-follow.js:24 msgid "You are not following" msgstr "" #: places_core/static/places_core/js/modules/userspace/user-follow.js:26 msgid "Following" msgstr "" #: places_core/static/places_core/js/src/location-list.js:88 msgid "Go to" msgstr "" #: places_core/static/places_core/tpl/adminarea-search-result.html:4 msgid "Latitude" msgstr "" #: places_core/static/places_core/tpl/cookie_if.html:2 msgid "Your friends don’t know about CivilHub yet?" msgstr "" #: places_core/static/places_core/tpl/cookie_if.html:3 msgid "Send them an invite!" msgstr "" #: places_core/static/places_core/tpl/cookie_msg.html:2 msgid "" "Cookies help us to deliver our services. By using our services, you agree to " "our use of cookies" msgstr "" #: places_core/static/places_core/tpl/cookie_msg.html:3 msgid "Cookies Policy" msgstr "" #: templates/postman/base_folder.html:70 msgid "g:i A,M j,n/j/y" msgstr ""
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 # # Copyright 2016 The Fontbakery Authors # Copyright 2017 The Google Font Tools 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. # from __future__ import print_function import argparse import os import sys import requests if int(sys.version[0]) == 2: import urlparse elif int(sys.version[0]) == 3: import urllib.parse as urlparse from gftools.fonts_public_pb2 import FamilyProto from google.protobuf import text_format description = ("This script compares the info on local METADATA.pb files" " with data fetched from the Google Fonts Developer API.\n\n" " In order to use it you need to provide an API key.") parser = argparse.ArgumentParser(description=description) parser.add_argument('key', help='Key from Google Fonts Developer API') parser.add_argument('repo', help=('Directory tree that contains' ' directories with METADATA.pb files.')) parser.add_argument('--cache', help=('Directory to store a copy' ' of the files in the fonts developer API.'), default="/tmp/gftools-compare-git-api") parser.add_argument('--verbose', help='Print additional information', action="store_true") parser.add_argument('--ignore-copy-existing-ttf', action="store_true") parser.add_argument('--autofix', help='Apply automatic fixes to files.', action="store_true") parser.add_argument('--api', help='Domain string to use to request.', default="fonts.googleapis.com") def get_cache_font_path(cache_dir, fonturl): urlparts = urlparse.urlparse(fonturl) cache_dir = os.path.join(cache_dir, urlparts.netloc, os.path.dirname(urlparts.path).strip('/')) if not os.path.exists(cache_dir): os.makedirs(cache_dir) fontname = os.path.basename(fonturl) return os.path.join(cache_dir, fontname) def getVariantName(item): if item.style == "normal" and item.weight == 400: return "regular" name = "" if item.weight != 400: name = str(item.weight) if item.style != "normal": name += item.style return name API_URL = 'https://www.googleapis.com/webfonts/v1/webfonts?key={}' def main(): args = parser.parse_args() response = requests.get(API_URL.format(args.key)) try: webfontList = response.json()['items'] webfontListFamilyNames = [item['family'] for item in webfontList] except (ValueError, KeyError): sys.exit("Unable to load and parse" " list of families from Google Web Fonts API.") for dirpath, dirnames, filenames in os.walk(args.repo): metadata_path = os.path.join(dirpath, 'METADATA.pb') if not os.path.exists(metadata_path): continue metadata = FamilyProto() text_data = open(metadata_path, "rb").read() text_format.Merge(text_data, metadata) try: family = metadata.name except KeyError: print(('ERROR: "{}" does not contain' ' familyname info.').format(metadata_path), file=sys.stderr) continue try: index = webfontListFamilyNames.index(family) webfontsItem = webfontList[index] except ValueError: print(('ERROR: Family "{}" could not be found' ' in Google Web Fonts API.').format(family)) continue webfontVariants = [] log_messages = [] for variant, fonturl in webfontsItem['files'].items(): cache_font_path = get_cache_font_path(args.cache, fonturl) webfontVariants.append(variant) if args.ignore_copy_existing_ttf and os.path.exists(cache_font_path): continue with open(cache_font_path, 'w') as fp: found = False for font in metadata.fonts: if getVariantName(font) == variant: found = True if args.verbose: print('Downloading "{}"' ' as "{}"'.format(fonturl, font.filename)) #Saving: fp.write(requests.get(fonturl).text) #Symlinking: src = cache_font_path dst_dir = os.path.dirname(cache_font_path) dst = os.path.join(dst_dir, font.filename) if not os.path.exists(dst): os.symlink(src, dst) if not found: print(("ERROR: Google Fonts API references" " a '{}' variant which is not declared" " on local '{}'.").format(variant, metadata_path)) for subset in webfontsItem['subsets']: if subset == "menu": # note about Google Web Fonts: # Menu subsets are no longer generated offline. continue if subset not in metadata.subsets: print(('ERROR: "{}" ' 'lacks subset "{}" in git.').format(family, subset), file=sys.stderr) else: if args.verbose: print(('OK: "{}" ' 'subset "{}" in sync.').format(family, subset)) for subset in metadata.subsets: if subset != "menu" and subset not in webfontsItem['subsets']: print(('ERROR: "{}" ' 'lacks subset "{}" in API.').format(family, subset), file=sys.stderr) if metadata.category == "SANS_SERIF": # That's fine :-) category = "sans-serif" else: category = metadata.category.lower() if category != webfontsItem['category']: print(('ERROR: "{}" category "{}" in git' ' does not match category "{}"' ' in API.').format(family, metadata.category, webfontsItem['category'])) else: if args.verbose: print(('OK: "{}" ' 'category "{}" in sync.').format(family, metadata.category)) for variant in webfontVariants: try: idx = [getVariantName(f) for f in metadata.fonts].index(variant) repoFileName = metadata.fonts[idx].filename fonturl = webfontsItem['files'][variant] fontpath = get_cache_font_path(args.cache, fonturl) import hashlib google_md5 = hashlib.md5(open(fontpath, 'rb').read()).hexdigest() data = open(os.path.join(dirpath, repoFileName), 'rb').read() repo_md5 = hashlib.md5(data).hexdigest() if repo_md5 == google_md5: log_messages.append([variant, 'OK', '"{}" in sync'.format(repoFileName)]) else: log_messages.append([variant, 'ERROR', ('"{}" checksum mismatch, file' ' in API does not match file' ' in git.').format(repoFileName)]) except ValueError: log_messages.append([variant, 'ERROR', ('"{}" available in API but' ' not in git.').format(font.filename)]) for font in metadata.fonts: variant = getVariantName(font) try: webfontVariants.index(variant) except ValueError: log_messages.append([variant, 'ERROR', ('"{}" available in git but' ' not in API.').format(font.filename)]) # Sort all the messages by their respective # metadataFileName and print them: for message in sorted(log_messages, key=lambda x: x[0].lower()): variant, status, text = message if status == "OK": if args.verbose: print('{}: {}'.format(status, text)) else: print('{}: {}'.format(status, text), file=sys.stderr) if __name__ == '__main__': main()
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include "core/providers/dml/DmlExecutionProvider/inc/DmlExecutionProvider.h" namespace Dml { struct Binding { // Non-null if required at the stage where it is used, i.e. Initialization IMLOperatorTensor* tensor; UINT64 sizeInBytes; }; // DML specific interface into the execution provider, which avoids any dependencies with // internal Lotus data types. interface __declspec(uuid("b2488edb-fad2-4704-a6d2-5b5b129d4b8e")) IExecutionProvider : public IUnknown { public: STDMETHOD(GetD3DDevice)(_COM_Outptr_ ID3D12Device** d3dDevice) const noexcept = 0; STDMETHOD(GetDmlDevice)(_COM_Outptr_ IDMLDevice** dmlDevice) const noexcept = 0; STDMETHOD(ExecuteCommandList)( ID3D12GraphicsCommandList* commandList, _Outptr_ ID3D12Fence** fence, _Out_ uint64_t* completionValue ) const noexcept = 0; STDMETHOD(AddUAVBarrier)() const noexcept = 0; STDMETHOD(InitializeOperator)( IDMLCompiledOperator* op, _In_opt_ const DML_BUFFER_BINDING* persistentResourceBinding, gsl::span<const DML_BUFFER_BINDING> inputTensors ) const noexcept = 0; STDMETHOD(ExecuteOperator)( IDMLCompiledOperator* op, _In_opt_ const DML_BUFFER_BINDING* persistentResourceBinding, gsl::span<IMLOperatorTensor*> inputTensors, gsl::span<IMLOperatorTensor*> outputTensors ) const noexcept = 0; STDMETHOD(ExecuteOperator)( IDMLCompiledOperator* op, _In_opt_ const DML_BUFFER_BINDING* persistentResourceBinding, gsl::span<DML_BINDING_DESC> inputTensors, gsl::span<DML_BINDING_DESC> outputTensors ) const noexcept = 0; STDMETHOD(CopyTensor)(IMLOperatorTensor* dst, IMLOperatorTensor* src) const noexcept = 0; STDMETHOD(FillTensorWithPattern)( IMLOperatorTensor* dst, gsl::span<const std::byte> value ) const noexcept = 0; STDMETHOD(UploadToResource)(ID3D12Resource* dstData, const void* srcData, uint64_t srcDataSize) const noexcept = 0; STDMETHOD_(D3D12_COMMAND_LIST_TYPE, GetCommandListTypeForQueue)() const noexcept = 0; STDMETHOD_(void, Flush)() const noexcept = 0; STDMETHOD_(ID3D12Resource*, DecodeResource)(void* allocation) const noexcept = 0; STDMETHOD(AllocatePooledResource(size_t size, AllocatorRoundingMode roundingMode, ID3D12Resource **d3dResource, IUnknown* *pooledResource)) const noexcept = 0; STDMETHOD_(bool, IsMcdmDevice)() const noexcept = 0; STDMETHOD_(bool, MetacommandsEnabled)() const noexcept = 0; }; } // namespace Dml
{ "pile_set_name": "Github" }
/* A set of validators for common color formats such as {r, g, b}, {h, s, v}, {h, s, l} and [ r, g, b ] */ import { rgbObject, hslObject, rgbArray } from './validators' import Colr from 'colr' let withAlpha = (color, a) => a !== undefined ? { a, ...color } : color let normalizeRGB = c => ({ r: c.r * 255, g: c.g * 255, b: c.b * 255}) let deNormalizeRGB = c => ({ r: c.r / 255, g: c.g / 255, b: c.b / 255}) export let rgb2Hsv = c => withAlpha(Colr.fromRgbObject(normalizeRGB(c)).toRawHsvObject(), c.a) export let rgbArr2Hsv = c => withAlpha(Colr.fromRgbArray(c.map(channel => channel * 255)).toRawHsvObject(), c[3]) export let hsv2Hsv = c => c rgb2Hsv.invert = c => withAlpha(deNormalizeRGB(Colr.fromHsvObject(c).toRawRgbObject()), c.a) rgbArr2Hsv.invert = c => Colr.fromHsvObject(c).toRawRgbArray().map(channel => channel / 255).concat([ c.a ]) hsv2Hsv.invert = c => c export default value => { let converter = hsv2Hsv if (rgbObject(value)) converter = rgb2Hsv else if (rgbArray(value)) converter = rgbArr2Hsv return converter }
{ "pile_set_name": "Github" }
--- title: EndpointIdPattern simpleType TOCTitle: EndpointIdPattern simpleType ms:assetid: 20c01d5f-044c-24bf-f9f0-a4600db1b6ce ms:mtpsurl: https://msdn.microsoft.com/en-us/library/Mt171047(v=office.16) ms:contentKeyID: 65855621 ms.date: 08/24/2015 mtps_version: v=office.16 dev_langs: - xml --- # EndpointIdPattern simpleType (Skype for Business SDN Interface 2.2, Schema "D") ## Type information <table> <colgroup> <col style="width: 50%" /> <col style="width: 50%" /> </colgroup> <tbody> <tr class="odd"> <td><p><strong>Base type</strong></p></td> <td><p>xs:string</p></td> </tr> <tr class="even"> <td><p><strong>Namespace</strong></p></td> <td><p></p></td> </tr> <tr class="odd"> <td><p><strong>Schema file</strong></p></td> <td><p>SDNInterface.Schema.D.XSD</p></td> </tr> </tbody> </table> ## Definition ```xml <xs:simpleType name="EndpointIdPattern"> <xs:restriction base="xs:string"> <xs:pattern value="[0-9a-fA-F]{1,40}"/> </xs:restriction> </xs:simpleType> ```
{ "pile_set_name": "Github" }
# Lint as: python3 # Copyright 2019 DeepMind Technologies Limited. 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. # ============================================================================== """Tests for pop_art.py.""" import functools from absl.testing import absltest from absl.testing import parameterized import chex import haiku as hk from haiku import data_structures from haiku import initializers import jax import jax.nn import jax.numpy as jnp import numpy as np from rlax._src import pop_art _INPUT_DIM = 3 def setUpModule(): chex.set_n_cpu_devices(n=4) chex.assert_devices_available(n=4, devtype='cpu', backend='cpu') def get_constant_linear_params(num_outputs): w = np.ones([_INPUT_DIM, num_outputs]) b = np.zeros([num_outputs]) return dict(w=w, b=b) def get_fake_pop_art_state(num_outputs): """Returns a fake PopArtState.""" shift = np.arange(num_outputs).astype(np.float32) + 1 scale = shift second_moment = np.square(scale) + np.square(shift) return pop_art.PopArtState(shift, scale, second_moment) class PopArtTest(parameterized.TestCase): @parameterized.parameters( (None, np.array([[[0., 0., 1.], [0., 5., 0.]], [[9., 0., 0.], [0., 0., 0.]]])), ([], np.array([[[0., 0., 1.], [0., 5., 0.]], [[9., 0., 0.], [0., 0., 0.]]])), (['i'], np.array([[[0., 5., 1.], [0., 5., 1.]], [[9., 0., 0.], [9., 0., 0.]]])), (['j'], np.array([[[9., 0., 1.], [0., 5., 0.]], [[9., 0., 1.], [0., 5., 0.]]])), (['i', 'j'], np.array([[[9., 5., 1.], [9., 5., 1.]], [[9., 5., 1.], [9., 5., 1.]]]))) def test_cross_replica_scatter_add(self, axes, expected): shape = (2, 2, 3) source = np.zeros(shape) fn = functools.partial(pop_art._cross_replica_scatter_add, axis_name=axes) mapped_fn = jax.pmap(fn, axis_name='i', backend='cpu') mapped_fn = jax.pmap(mapped_fn, axis_name='j', backend='cpu') updates = np.array([[[1., 0., 0.], [0., 5., 0.]], [[0., 0., 9.], [0., 0., 0.]]]) indices = np.array([[[2, 2, 2], [1, 1, 1]], [[0, 0, 0], [0, 1, 2]]]) np.testing.assert_equal(mapped_fn(source, indices, updates), expected) def test_normalize_unnormalize_is_identity(self): num_outputs = 3 state = get_fake_pop_art_state(num_outputs) np.random.seed(42) # Draws random numbers with the same magnitude as the pop art shift and # scales to ensure numerical stability. values = np.random.randint(-10, 10, size=(100,)).astype(np.float32) indices = np.random.randint(0, num_outputs, size=(100,)) np.testing.assert_allclose( values, pop_art.normalize(state, pop_art.unnormalize(state, values, indices), indices)) np.testing.assert_allclose( values, pop_art.unnormalize(state, pop_art.normalize(state, values, indices), indices)) def test_unnormalize_linear(self): num_outputs = 3 state = get_fake_pop_art_state(num_outputs) # Verify that it denormalizes as planned. inputs = np.ones([num_outputs, num_outputs]) indices = np.arange(num_outputs)[::-1] out = pop_art.unnormalize_linear(state, inputs, indices) expected_normalized = np.asarray([1, 1, 1]) expected_unnormalized = np.asarray([6, 4, 2]) np.testing.assert_allclose(out.normalized, expected_normalized) np.testing.assert_allclose(out.unnormalized, expected_unnormalized) def test_learn_scale_shift(self): num_outputs = 2 initial_state, update = pop_art.popart( num_outputs, step_size=1e-1, scale_lb=1e-6, scale_ub=1e6) state = initial_state() params = get_constant_linear_params(num_outputs) targets = np.arange(6) - 3 indices = np.asarray([0, 0, 0, 1, 1, 1]) # Learn the parameters. for _ in range(10): _, state = update(params, state, targets, indices) expected_scale = np.std(targets[:3]) expected_scale = np.asarray([expected_scale, expected_scale]) expected_shift = np.asarray([-2., 1.]) # Loose tolerances; just get close. np.testing.assert_allclose( state.scale, expected_scale, atol=1e-1, rtol=1e-1) np.testing.assert_allclose( state.shift, expected_shift, atol=1e-1, rtol=1e-1) def test_slow_update(self): num_outputs = 2 # Two step sizes: 0.1, and 0.8 kwargs = dict( num_outputs=num_outputs, scale_lb=1e-6, scale_ub=1e6, ) initial_state, slow_update = pop_art.popart(step_size=1e-2, **kwargs) _, fast_update = pop_art.popart(step_size=1e-1, **kwargs) state = initial_state() params = get_constant_linear_params(num_outputs) targets = np.arange(6) * 3 # standard deviation > 1 and mean > 0 indices = np.asarray([0, 0, 0, 1, 1, 1]) _, slow_state = slow_update(params, state, targets, indices) _, fast_state = fast_update(params, state, targets, indices) # Faster step size means faster adjustment. np.testing.assert_array_less(slow_state.shift, fast_state.shift) np.testing.assert_array_less(slow_state.scale, fast_state.scale) def test_scale_bounded(self): num_outputs = 1 # Set scale_lb and scale_ub to 1 and verify this is obeyed. initial_state, update = pop_art.popart( num_outputs, step_size=1e-1, scale_lb=1., scale_ub=1.) state = initial_state() params = get_constant_linear_params(num_outputs) targets = np.ones((4, 2)) indices = np.zeros((4, 2), dtype=np.int32) for _ in range(4): _, state = update(params, state, targets, indices) self.assertAlmostEqual(float(state.scale[0]), 1.) def test_outputs_preserved(self): num_outputs = 2 initial_state, update = pop_art.popart( num_outputs, step_size=1e-3, scale_lb=1e-6, scale_ub=1e6) state = initial_state() key = jax.random.PRNGKey(428) def net(x): linear = hk.Linear( num_outputs, b_init=initializers.RandomUniform(), name='head') return linear(x) init_fn, apply_fn = hk.without_apply_rng(hk.transform(net)) key, subkey1, subkey2 = jax.random.split(key, 3) fixed_data = jax.random.uniform(subkey1, (4, 3)) params = init_fn(subkey2, fixed_data) initial_result = apply_fn(params, fixed_data) indices = np.asarray([0, 1, 0, 1, 0, 1, 0, 1]) # Repeatedly update state and verify that params still preserve outputs. for _ in range(30): key, subkey1, subkey2 = jax.random.split(key, 3) targets = jax.random.uniform(subkey1, (8,)) linear_params, state = update(params['head'], state, targets, indices) params = data_structures.to_mutable_dict(params) params['head'] = linear_params # Apply updated linear transformation and unnormalize outputs. transform = apply_fn(params, fixed_data) out = jnp.broadcast_to(state.scale, transform.shape) * transform + jnp.broadcast_to( state.shift, transform.shape) np.testing.assert_allclose(initial_result, out, atol=1e-2) if __name__ == '__main__': jax.config.update('jax_numpy_rank_promotion', 'raise') absltest.main()
{ "pile_set_name": "Github" }
/* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Landon Curt Noll. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. */ #ifndef lint static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93"; #endif /* not lint */ /* * prime - prime table * * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo * * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\ * * We are able to sieve 2^32-1 because this table has primes up to 65537 * and 65537^2 > 2^32-1. */ #include "primes.h" ubig prime[] = { 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103, 107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199, 211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313, 317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433, 439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563, 569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673, 677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811, 821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941, 947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051, 1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163, 1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279, 1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399, 1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489, 1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601, 1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709, 1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831, 1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951, 1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069, 2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179, 2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297, 2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399, 2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543, 2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671, 2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753, 2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879, 2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011, 3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163, 3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271, 3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389, 3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527, 3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623, 3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739, 3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877, 3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003, 4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127, 4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243, 4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373, 4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513, 4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643, 4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783, 4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919, 4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011, 5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153, 5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297, 5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431, 5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531, 5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669, 5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807, 5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903, 5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073, 6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203, 6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317, 6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449, 6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581, 6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719, 6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857, 6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977, 6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121, 7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247, 7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433, 7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547, 7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669, 7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793, 7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933, 7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089, 8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231, 8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363, 8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521, 8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647, 8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753, 8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887, 8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029, 9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173, 9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311, 9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431, 9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547, 9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697, 9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829, 9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949, 9967,9973,10007,10009,10037,10039,10061,10067,10069,10079,10091,10093,10099, 10103,10111,10133,10139,10141,10151,10159,10163,10169,10177,10181,10193,10211, 10223,10243,10247,10253,10259,10267,10271,10273,10289,10301,10303,10313,10321, 10331,10333,10337,10343,10357,10369,10391,10399,10427,10429,10433,10453,10457, 10459,10463,10477,10487,10499,10501,10513,10529,10531,10559,10567,10589,10597, 10601,10607,10613,10627,10631,10639,10651,10657,10663,10667,10687,10691,10709, 10711,10723,10729,10733,10739,10753,10771,10781,10789,10799,10831,10837,10847, 10853,10859,10861,10867,10883,10889,10891,10903,10909,10937,10939,10949,10957, 10973,10979,10987,10993,11003,11027,11047,11057,11059,11069,11071,11083,11087, 11093,11113,11117,11119,11131,11149,11159,11161,11171,11173,11177,11197,11213, 11239,11243,11251,11257,11261,11273,11279,11287,11299,11311,11317,11321,11329, 11351,11353,11369,11383,11393,11399,11411,11423,11437,11443,11447,11467,11471, 11483,11489,11491,11497,11503,11519,11527,11549,11551,11579,11587,11593,11597, 11617,11621,11633,11657,11677,11681,11689,11699,11701,11717,11719,11731,11743, 11777,11779,11783,11789,11801,11807,11813,11821,11827,11831,11833,11839,11863, 11867,11887,11897,11903,11909,11923,11927,11933,11939,11941,11953,11959,11969, 11971,11981,11987,12007,12011,12037,12041,12043,12049,12071,12073,12097,12101, 12107,12109,12113,12119,12143,12149,12157,12161,12163,12197,12203,12211,12227, 12239,12241,12251,12253,12263,12269,12277,12281,12289,12301,12323,12329,12343, 12347,12373,12377,12379,12391,12401,12409,12413,12421,12433,12437,12451,12457, 12473,12479,12487,12491,12497,12503,12511,12517,12527,12539,12541,12547,12553, 12569,12577,12583,12589,12601,12611,12613,12619,12637,12641,12647,12653,12659, 12671,12689,12697,12703,12713,12721,12739,12743,12757,12763,12781,12791,12799, 12809,12821,12823,12829,12841,12853,12889,12893,12899,12907,12911,12917,12919, 12923,12941,12953,12959,12967,12973,12979,12983,13001,13003,13007,13009,13033, 13037,13043,13049,13063,13093,13099,13103,13109,13121,13127,13147,13151,13159, 13163,13171,13177,13183,13187,13217,13219,13229,13241,13249,13259,13267,13291, 13297,13309,13313,13327,13331,13337,13339,13367,13381,13397,13399,13411,13417, 13421,13441,13451,13457,13463,13469,13477,13487,13499,13513,13523,13537,13553, 13567,13577,13591,13597,13613,13619,13627,13633,13649,13669,13679,13681,13687, 13691,13693,13697,13709,13711,13721,13723,13729,13751,13757,13759,13763,13781, 13789,13799,13807,13829,13831,13841,13859,13873,13877,13879,13883,13901,13903, 13907,13913,13921,13931,13933,13963,13967,13997,13999,14009,14011,14029,14033, 14051,14057,14071,14081,14083,14087,14107,14143,14149,14153,14159,14173,14177, 14197,14207,14221,14243,14249,14251,14281,14293,14303,14321,14323,14327,14341, 14347,14369,14387,14389,14401,14407,14411,14419,14423,14431,14437,14447,14449, 14461,14479,14489,14503,14519,14533,14537,14543,14549,14551,14557,14561,14563, 14591,14593,14621,14627,14629,14633,14639,14653,14657,14669,14683,14699,14713, 14717,14723,14731,14737,14741,14747,14753,14759,14767,14771,14779,14783,14797, 14813,14821,14827,14831,14843,14851,14867,14869,14879,14887,14891,14897,14923, 14929,14939,14947,14951,14957,14969,14983,15013,15017,15031,15053,15061,15073, 15077,15083,15091,15101,15107,15121,15131,15137,15139,15149,15161,15173,15187, 15193,15199,15217,15227,15233,15241,15259,15263,15269,15271,15277,15287,15289, 15299,15307,15313,15319,15329,15331,15349,15359,15361,15373,15377,15383,15391, 15401,15413,15427,15439,15443,15451,15461,15467,15473,15493,15497,15511,15527, 15541,15551,15559,15569,15581,15583,15601,15607,15619,15629,15641,15643,15647, 15649,15661,15667,15671,15679,15683,15727,15731,15733,15737,15739,15749,15761, 15767,15773,15787,15791,15797,15803,15809,15817,15823,15859,15877,15881,15887, 15889,15901,15907,15913,15919,15923,15937,15959,15971,15973,15991,16001,16007, 16033,16057,16061,16063,16067,16069,16073,16087,16091,16097,16103,16111,16127, 16139,16141,16183,16187,16189,16193,16217,16223,16229,16231,16249,16253,16267, 16273,16301,16319,16333,16339,16349,16361,16363,16369,16381,16411,16417,16421, 16427,16433,16447,16451,16453,16477,16481,16487,16493,16519,16529,16547,16553, 16561,16567,16573,16603,16607,16619,16631,16633,16649,16651,16657,16661,16673, 16691,16693,16699,16703,16729,16741,16747,16759,16763,16787,16811,16823,16829, 16831,16843,16871,16879,16883,16889,16901,16903,16921,16927,16931,16937,16943, 16963,16979,16981,16987,16993,17011,17021,17027,17029,17033,17041,17047,17053, 17077,17093,17099,17107,17117,17123,17137,17159,17167,17183,17189,17191,17203, 17207,17209,17231,17239,17257,17291,17293,17299,17317,17321,17327,17333,17341, 17351,17359,17377,17383,17387,17389,17393,17401,17417,17419,17431,17443,17449, 17467,17471,17477,17483,17489,17491,17497,17509,17519,17539,17551,17569,17573, 17579,17581,17597,17599,17609,17623,17627,17657,17659,17669,17681,17683,17707, 17713,17729,17737,17747,17749,17761,17783,17789,17791,17807,17827,17837,17839, 17851,17863,17881,17891,17903,17909,17911,17921,17923,17929,17939,17957,17959, 17971,17977,17981,17987,17989,18013,18041,18043,18047,18049,18059,18061,18077, 18089,18097,18119,18121,18127,18131,18133,18143,18149,18169,18181,18191,18199, 18211,18217,18223,18229,18233,18251,18253,18257,18269,18287,18289,18301,18307, 18311,18313,18329,18341,18353,18367,18371,18379,18397,18401,18413,18427,18433, 18439,18443,18451,18457,18461,18481,18493,18503,18517,18521,18523,18539,18541, 18553,18583,18587,18593,18617,18637,18661,18671,18679,18691,18701,18713,18719, 18731,18743,18749,18757,18773,18787,18793,18797,18803,18839,18859,18869,18899, 18911,18913,18917,18919,18947,18959,18973,18979,19001,19009,19013,19031,19037, 19051,19069,19073,19079,19081,19087,19121,19139,19141,19157,19163,19181,19183, 19207,19211,19213,19219,19231,19237,19249,19259,19267,19273,19289,19301,19309, 19319,19333,19373,19379,19381,19387,19391,19403,19417,19421,19423,19427,19429, 19433,19441,19447,19457,19463,19469,19471,19477,19483,19489,19501,19507,19531, 19541,19543,19553,19559,19571,19577,19583,19597,19603,19609,19661,19681,19687, 19697,19699,19709,19717,19727,19739,19751,19753,19759,19763,19777,19793,19801, 19813,19819,19841,19843,19853,19861,19867,19889,19891,19913,19919,19927,19937, 19949,19961,19963,19973,19979,19991,19993,19997,20011,20021,20023,20029,20047, 20051,20063,20071,20089,20101,20107,20113,20117,20123,20129,20143,20147,20149, 20161,20173,20177,20183,20201,20219,20231,20233,20249,20261,20269,20287,20297, 20323,20327,20333,20341,20347,20353,20357,20359,20369,20389,20393,20399,20407, 20411,20431,20441,20443,20477,20479,20483,20507,20509,20521,20533,20543,20549, 20551,20563,20593,20599,20611,20627,20639,20641,20663,20681,20693,20707,20717, 20719,20731,20743,20747,20749,20753,20759,20771,20773,20789,20807,20809,20849, 20857,20873,20879,20887,20897,20899,20903,20921,20929,20939,20947,20959,20963, 20981,20983,21001,21011,21013,21017,21019,21023,21031,21059,21061,21067,21089, 21101,21107,21121,21139,21143,21149,21157,21163,21169,21179,21187,21191,21193, 21211,21221,21227,21247,21269,21277,21283,21313,21317,21319,21323,21341,21347, 21377,21379,21383,21391,21397,21401,21407,21419,21433,21467,21481,21487,21491, 21493,21499,21503,21517,21521,21523,21529,21557,21559,21563,21569,21577,21587, 21589,21599,21601,21611,21613,21617,21647,21649,21661,21673,21683,21701,21713, 21727,21737,21739,21751,21757,21767,21773,21787,21799,21803,21817,21821,21839, 21841,21851,21859,21863,21871,21881,21893,21911,21929,21937,21943,21961,21977, 21991,21997,22003,22013,22027,22031,22037,22039,22051,22063,22067,22073,22079, 22091,22093,22109,22111,22123,22129,22133,22147,22153,22157,22159,22171,22189, 22193,22229,22247,22259,22271,22273,22277,22279,22283,22291,22303,22307,22343, 22349,22367,22369,22381,22391,22397,22409,22433,22441,22447,22453,22469,22481, 22483,22501,22511,22531,22541,22543,22549,22567,22571,22573,22613,22619,22621, 22637,22639,22643,22651,22669,22679,22691,22697,22699,22709,22717,22721,22727, 22739,22741,22751,22769,22777,22783,22787,22807,22811,22817,22853,22859,22861, 22871,22877,22901,22907,22921,22937,22943,22961,22963,22973,22993,23003,23011, 23017,23021,23027,23029,23039,23041,23053,23057,23059,23063,23071,23081,23087, 23099,23117,23131,23143,23159,23167,23173,23189,23197,23201,23203,23209,23227, 23251,23269,23279,23291,23293,23297,23311,23321,23327,23333,23339,23357,23369, 23371,23399,23417,23431,23447,23459,23473,23497,23509,23531,23537,23539,23549, 23557,23561,23563,23567,23581,23593,23599,23603,23609,23623,23627,23629,23633, 23663,23669,23671,23677,23687,23689,23719,23741,23743,23747,23753,23761,23767, 23773,23789,23801,23813,23819,23827,23831,23833,23857,23869,23873,23879,23887, 23893,23899,23909,23911,23917,23929,23957,23971,23977,23981,23993,24001,24007, 24019,24023,24029,24043,24049,24061,24071,24077,24083,24091,24097,24103,24107, 24109,24113,24121,24133,24137,24151,24169,24179,24181,24197,24203,24223,24229, 24239,24247,24251,24281,24317,24329,24337,24359,24371,24373,24379,24391,24407, 24413,24419,24421,24439,24443,24469,24473,24481,24499,24509,24517,24527,24533, 24547,24551,24571,24593,24611,24623,24631,24659,24671,24677,24683,24691,24697, 24709,24733,24749,24763,24767,24781,24793,24799,24809,24821,24841,24847,24851, 24859,24877,24889,24907,24917,24919,24923,24943,24953,24967,24971,24977,24979, 24989,25013,25031,25033,25037,25057,25073,25087,25097,25111,25117,25121,25127, 25147,25153,25163,25169,25171,25183,25189,25219,25229,25237,25243,25247,25253, 25261,25301,25303,25307,25309,25321,25339,25343,25349,25357,25367,25373,25391, 25409,25411,25423,25439,25447,25453,25457,25463,25469,25471,25523,25537,25541, 25561,25577,25579,25583,25589,25601,25603,25609,25621,25633,25639,25643,25657, 25667,25673,25679,25693,25703,25717,25733,25741,25747,25759,25763,25771,25793, 25799,25801,25819,25841,25847,25849,25867,25873,25889,25903,25913,25919,25931, 25933,25939,25943,25951,25969,25981,25997,25999,26003,26017,26021,26029,26041, 26053,26083,26099,26107,26111,26113,26119,26141,26153,26161,26171,26177,26183, 26189,26203,26209,26227,26237,26249,26251,26261,26263,26267,26293,26297,26309, 26317,26321,26339,26347,26357,26371,26387,26393,26399,26407,26417,26423,26431, 26437,26449,26459,26479,26489,26497,26501,26513,26539,26557,26561,26573,26591, 26597,26627,26633,26641,26647,26669,26681,26683,26687,26693,26699,26701,26711, 26713,26717,26723,26729,26731,26737,26759,26777,26783,26801,26813,26821,26833, 26839,26849,26861,26863,26879,26881,26891,26893,26903,26921,26927,26947,26951, 26953,26959,26981,26987,26993,27011,27017,27031,27043,27059,27061,27067,27073, 27077,27091,27103,27107,27109,27127,27143,27179,27191,27197,27211,27239,27241, 27253,27259,27271,27277,27281,27283,27299,27329,27337,27361,27367,27397,27407, 27409,27427,27431,27437,27449,27457,27479,27481,27487,27509,27527,27529,27539, 27541,27551,27581,27583,27611,27617,27631,27647,27653,27673,27689,27691,27697, 27701,27733,27737,27739,27743,27749,27751,27763,27767,27773,27779,27791,27793, 27799,27803,27809,27817,27823,27827,27847,27851,27883,27893,27901,27917,27919, 27941,27943,27947,27953,27961,27967,27983,27997,28001,28019,28027,28031,28051, 28057,28069,28081,28087,28097,28099,28109,28111,28123,28151,28163,28181,28183, 28201,28211,28219,28229,28277,28279,28283,28289,28297,28307,28309,28319,28349, 28351,28387,28393,28403,28409,28411,28429,28433,28439,28447,28463,28477,28493, 28499,28513,28517,28537,28541,28547,28549,28559,28571,28573,28579,28591,28597, 28603,28607,28619,28621,28627,28631,28643,28649,28657,28661,28663,28669,28687, 28697,28703,28711,28723,28729,28751,28753,28759,28771,28789,28793,28807,28813, 28817,28837,28843,28859,28867,28871,28879,28901,28909,28921,28927,28933,28949, 28961,28979,29009,29017,29021,29023,29027,29033,29059,29063,29077,29101,29123, 29129,29131,29137,29147,29153,29167,29173,29179,29191,29201,29207,29209,29221, 29231,29243,29251,29269,29287,29297,29303,29311,29327,29333,29339,29347,29363, 29383,29387,29389,29399,29401,29411,29423,29429,29437,29443,29453,29473,29483, 29501,29527,29531,29537,29567,29569,29573,29581,29587,29599,29611,29629,29633, 29641,29663,29669,29671,29683,29717,29723,29741,29753,29759,29761,29789,29803, 29819,29833,29837,29851,29863,29867,29873,29879,29881,29917,29921,29927,29947, 29959,29983,29989,30011,30013,30029,30047,30059,30071,30089,30091,30097,30103, 30109,30113,30119,30133,30137,30139,30161,30169,30181,30187,30197,30203,30211, 30223,30241,30253,30259,30269,30271,30293,30307,30313,30319,30323,30341,30347, 30367,30389,30391,30403,30427,30431,30449,30467,30469,30491,30493,30497,30509, 30517,30529,30539,30553,30557,30559,30577,30593,30631,30637,30643,30649,30661, 30671,30677,30689,30697,30703,30707,30713,30727,30757,30763,30773,30781,30803, 30809,30817,30829,30839,30841,30851,30853,30859,30869,30871,30881,30893,30911, 30931,30937,30941,30949,30971,30977,30983,31013,31019,31033,31039,31051,31063, 31069,31079,31081,31091,31121,31123,31139,31147,31151,31153,31159,31177,31181, 31183,31189,31193,31219,31223,31231,31237,31247,31249,31253,31259,31267,31271, 31277,31307,31319,31321,31327,31333,31337,31357,31379,31387,31391,31393,31397, 31469,31477,31481,31489,31511,31513,31517,31531,31541,31543,31547,31567,31573, 31583,31601,31607,31627,31643,31649,31657,31663,31667,31687,31699,31721,31723, 31727,31729,31741,31751,31769,31771,31793,31799,31817,31847,31849,31859,31873, 31883,31891,31907,31957,31963,31973,31981,31991,32003,32009,32027,32029,32051, 32057,32059,32063,32069,32077,32083,32089,32099,32117,32119,32141,32143,32159, 32173,32183,32189,32191,32203,32213,32233,32237,32251,32257,32261,32297,32299, 32303,32309,32321,32323,32327,32341,32353,32359,32363,32369,32371,32377,32381, 32401,32411,32413,32423,32429,32441,32443,32467,32479,32491,32497,32503,32507, 32531,32533,32537,32561,32563,32569,32573,32579,32587,32603,32609,32611,32621, 32633,32647,32653,32687,32693,32707,32713,32717,32719,32749,32771,32779,32783, 32789,32797,32801,32803,32831,32833,32839,32843,32869,32887,32909,32911,32917, 32933,32939,32941,32957,32969,32971,32983,32987,32993,32999,33013,33023,33029, 33037,33049,33053,33071,33073,33083,33091,33107,33113,33119,33149,33151,33161, 33179,33181,33191,33199,33203,33211,33223,33247,33287,33289,33301,33311,33317, 33329,33331,33343,33347,33349,33353,33359,33377,33391,33403,33409,33413,33427, 33457,33461,33469,33479,33487,33493,33503,33521,33529,33533,33547,33563,33569, 33577,33581,33587,33589,33599,33601,33613,33617,33619,33623,33629,33637,33641, 33647,33679,33703,33713,33721,33739,33749,33751,33757,33767,33769,33773,33791, 33797,33809,33811,33827,33829,33851,33857,33863,33871,33889,33893,33911,33923, 33931,33937,33941,33961,33967,33997,34019,34031,34033,34039,34057,34061,34123, 34127,34129,34141,34147,34157,34159,34171,34183,34211,34213,34217,34231,34253, 34259,34261,34267,34273,34283,34297,34301,34303,34313,34319,34327,34337,34351, 34361,34367,34369,34381,34403,34421,34429,34439,34457,34469,34471,34483,34487, 34499,34501,34511,34513,34519,34537,34543,34549,34583,34589,34591,34603,34607, 34613,34631,34649,34651,34667,34673,34679,34687,34693,34703,34721,34729,34739, 34747,34757,34759,34763,34781,34807,34819,34841,34843,34847,34849,34871,34877, 34883,34897,34913,34919,34939,34949,34961,34963,34981,35023,35027,35051,35053, 35059,35069,35081,35083,35089,35099,35107,35111,35117,35129,35141,35149,35153, 35159,35171,35201,35221,35227,35251,35257,35267,35279,35281,35291,35311,35317, 35323,35327,35339,35353,35363,35381,35393,35401,35407,35419,35423,35437,35447, 35449,35461,35491,35507,35509,35521,35527,35531,35533,35537,35543,35569,35573, 35591,35593,35597,35603,35617,35671,35677,35729,35731,35747,35753,35759,35771, 35797,35801,35803,35809,35831,35837,35839,35851,35863,35869,35879,35897,35899, 35911,35923,35933,35951,35963,35969,35977,35983,35993,35999,36007,36011,36013, 36017,36037,36061,36067,36073,36083,36097,36107,36109,36131,36137,36151,36161, 36187,36191,36209,36217,36229,36241,36251,36263,36269,36277,36293,36299,36307, 36313,36319,36341,36343,36353,36373,36383,36389,36433,36451,36457,36467,36469, 36473,36479,36493,36497,36523,36527,36529,36541,36551,36559,36563,36571,36583, 36587,36599,36607,36629,36637,36643,36653,36671,36677,36683,36691,36697,36709, 36713,36721,36739,36749,36761,36767,36779,36781,36787,36791,36793,36809,36821, 36833,36847,36857,36871,36877,36887,36899,36901,36913,36919,36923,36929,36931, 36943,36947,36973,36979,36997,37003,37013,37019,37021,37039,37049,37057,37061, 37087,37097,37117,37123,37139,37159,37171,37181,37189,37199,37201,37217,37223, 37243,37253,37273,37277,37307,37309,37313,37321,37337,37339,37357,37361,37363, 37369,37379,37397,37409,37423,37441,37447,37463,37483,37489,37493,37501,37507, 37511,37517,37529,37537,37547,37549,37561,37567,37571,37573,37579,37589,37591, 37607,37619,37633,37643,37649,37657,37663,37691,37693,37699,37717,37747,37781, 37783,37799,37811,37813,37831,37847,37853,37861,37871,37879,37889,37897,37907, 37951,37957,37963,37967,37987,37991,37993,37997,38011,38039,38047,38053,38069, 38083,38113,38119,38149,38153,38167,38177,38183,38189,38197,38201,38219,38231, 38237,38239,38261,38273,38281,38287,38299,38303,38317,38321,38327,38329,38333, 38351,38371,38377,38393,38431,38447,38449,38453,38459,38461,38501,38543,38557, 38561,38567,38569,38593,38603,38609,38611,38629,38639,38651,38653,38669,38671, 38677,38693,38699,38707,38711,38713,38723,38729,38737,38747,38749,38767,38783, 38791,38803,38821,38833,38839,38851,38861,38867,38873,38891,38903,38917,38921, 38923,38933,38953,38959,38971,38977,38993,39019,39023,39041,39043,39047,39079, 39089,39097,39103,39107,39113,39119,39133,39139,39157,39161,39163,39181,39191, 39199,39209,39217,39227,39229,39233,39239,39241,39251,39293,39301,39313,39317, 39323,39341,39343,39359,39367,39371,39373,39383,39397,39409,39419,39439,39443, 39451,39461,39499,39503,39509,39511,39521,39541,39551,39563,39569,39581,39607, 39619,39623,39631,39659,39667,39671,39679,39703,39709,39719,39727,39733,39749, 39761,39769,39779,39791,39799,39821,39827,39829,39839,39841,39847,39857,39863, 39869,39877,39883,39887,39901,39929,39937,39953,39971,39979,39983,39989,40009, 40013,40031,40037,40039,40063,40087,40093,40099,40111,40123,40127,40129,40151, 40153,40163,40169,40177,40189,40193,40213,40231,40237,40241,40253,40277,40283, 40289,40343,40351,40357,40361,40387,40423,40427,40429,40433,40459,40471,40483, 40487,40493,40499,40507,40519,40529,40531,40543,40559,40577,40583,40591,40597, 40609,40627,40637,40639,40693,40697,40699,40709,40739,40751,40759,40763,40771, 40787,40801,40813,40819,40823,40829,40841,40847,40849,40853,40867,40879,40883, 40897,40903,40927,40933,40939,40949,40961,40973,40993,41011,41017,41023,41039, 41047,41051,41057,41077,41081,41113,41117,41131,41141,41143,41149,41161,41177, 41179,41183,41189,41201,41203,41213,41221,41227,41231,41233,41243,41257,41263, 41269,41281,41299,41333,41341,41351,41357,41381,41387,41389,41399,41411,41413, 41443,41453,41467,41479,41491,41507,41513,41519,41521,41539,41543,41549,41579, 41593,41597,41603,41609,41611,41617,41621,41627,41641,41647,41651,41659,41669, 41681,41687,41719,41729,41737,41759,41761,41771,41777,41801,41809,41813,41843, 41849,41851,41863,41879,41887,41893,41897,41903,41911,41927,41941,41947,41953, 41957,41959,41969,41981,41983,41999,42013,42017,42019,42023,42043,42061,42071, 42073,42083,42089,42101,42131,42139,42157,42169,42179,42181,42187,42193,42197, 42209,42221,42223,42227,42239,42257,42281,42283,42293,42299,42307,42323,42331, 42337,42349,42359,42373,42379,42391,42397,42403,42407,42409,42433,42437,42443, 42451,42457,42461,42463,42467,42473,42487,42491,42499,42509,42533,42557,42569, 42571,42577,42589,42611,42641,42643,42649,42667,42677,42683,42689,42697,42701, 42703,42709,42719,42727,42737,42743,42751,42767,42773,42787,42793,42797,42821, 42829,42839,42841,42853,42859,42863,42899,42901,42923,42929,42937,42943,42953, 42961,42967,42979,42989,43003,43013,43019,43037,43049,43051,43063,43067,43093, 43103,43117,43133,43151,43159,43177,43189,43201,43207,43223,43237,43261,43271, 43283,43291,43313,43319,43321,43331,43391,43397,43399,43403,43411,43427,43441, 43451,43457,43481,43487,43499,43517,43541,43543,43573,43577,43579,43591,43597, 43607,43609,43613,43627,43633,43649,43651,43661,43669,43691,43711,43717,43721, 43753,43759,43777,43781,43783,43787,43789,43793,43801,43853,43867,43889,43891, 43913,43933,43943,43951,43961,43963,43969,43973,43987,43991,43997,44017,44021, 44027,44029,44041,44053,44059,44071,44087,44089,44101,44111,44119,44123,44129, 44131,44159,44171,44179,44189,44201,44203,44207,44221,44249,44257,44263,44267, 44269,44273,44279,44281,44293,44351,44357,44371,44381,44383,44389,44417,44449, 44453,44483,44491,44497,44501,44507,44519,44531,44533,44537,44543,44549,44563, 44579,44587,44617,44621,44623,44633,44641,44647,44651,44657,44683,44687,44699, 44701,44711,44729,44741,44753,44771,44773,44777,44789,44797,44809,44819,44839, 44843,44851,44867,44879,44887,44893,44909,44917,44927,44939,44953,44959,44963, 44971,44983,44987,45007,45013,45053,45061,45077,45083,45119,45121,45127,45131, 45137,45139,45161,45179,45181,45191,45197,45233,45247,45259,45263,45281,45289, 45293,45307,45317,45319,45329,45337,45341,45343,45361,45377,45389,45403,45413, 45427,45433,45439,45481,45491,45497,45503,45523,45533,45541,45553,45557,45569, 45587,45589,45599,45613,45631,45641,45659,45667,45673,45677,45691,45697,45707, 45737,45751,45757,45763,45767,45779,45817,45821,45823,45827,45833,45841,45853, 45863,45869,45887,45893,45943,45949,45953,45959,45971,45979,45989,46021,46027, 46049,46051,46061,46073,46091,46093,46099,46103,46133,46141,46147,46153,46171, 46181,46183,46187,46199,46219,46229,46237,46261,46271,46273,46279,46301,46307, 46309,46327,46337,46349,46351,46381,46399,46411,46439,46441,46447,46451,46457, 46471,46477,46489,46499,46507,46511,46523,46549,46559,46567,46573,46589,46591, 46601,46619,46633,46639,46643,46649,46663,46679,46681,46687,46691,46703,46723, 46727,46747,46751,46757,46769,46771,46807,46811,46817,46819,46829,46831,46853, 46861,46867,46877,46889,46901,46919,46933,46957,46993,46997,47017,47041,47051, 47057,47059,47087,47093,47111,47119,47123,47129,47137,47143,47147,47149,47161, 47189,47207,47221,47237,47251,47269,47279,47287,47293,47297,47303,47309,47317, 47339,47351,47353,47363,47381,47387,47389,47407,47417,47419,47431,47441,47459, 47491,47497,47501,47507,47513,47521,47527,47533,47543,47563,47569,47581,47591, 47599,47609,47623,47629,47639,47653,47657,47659,47681,47699,47701,47711,47713, 47717,47737,47741,47743,47777,47779,47791,47797,47807,47809,47819,47837,47843, 47857,47869,47881,47903,47911,47917,47933,47939,47947,47951,47963,47969,47977, 47981,48017,48023,48029,48049,48073,48079,48091,48109,48119,48121,48131,48157, 48163,48179,48187,48193,48197,48221,48239,48247,48259,48271,48281,48299,48311, 48313,48337,48341,48353,48371,48383,48397,48407,48409,48413,48437,48449,48463, 48473,48479,48481,48487,48491,48497,48523,48527,48533,48539,48541,48563,48571, 48589,48593,48611,48619,48623,48647,48649,48661,48673,48677,48679,48731,48733, 48751,48757,48761,48767,48779,48781,48787,48799,48809,48817,48821,48823,48847, 48857,48859,48869,48871,48883,48889,48907,48947,48953,48973,48989,48991,49003, 49009,49019,49031,49033,49037,49043,49057,49069,49081,49103,49109,49117,49121, 49123,49139,49157,49169,49171,49177,49193,49199,49201,49207,49211,49223,49253, 49261,49277,49279,49297,49307,49331,49333,49339,49363,49367,49369,49391,49393, 49409,49411,49417,49429,49433,49451,49459,49463,49477,49481,49499,49523,49529, 49531,49537,49547,49549,49559,49597,49603,49613,49627,49633,49639,49663,49667, 49669,49681,49697,49711,49727,49739,49741,49747,49757,49783,49787,49789,49801, 49807,49811,49823,49831,49843,49853,49871,49877,49891,49919,49921,49927,49937, 49939,49943,49957,49991,49993,49999,50021,50023,50033,50047,50051,50053,50069, 50077,50087,50093,50101,50111,50119,50123,50129,50131,50147,50153,50159,50177, 50207,50221,50227,50231,50261,50263,50273,50287,50291,50311,50321,50329,50333, 50341,50359,50363,50377,50383,50387,50411,50417,50423,50441,50459,50461,50497, 50503,50513,50527,50539,50543,50549,50551,50581,50587,50591,50593,50599,50627, 50647,50651,50671,50683,50707,50723,50741,50753,50767,50773,50777,50789,50821, 50833,50839,50849,50857,50867,50873,50891,50893,50909,50923,50929,50951,50957, 50969,50971,50989,50993,51001,51031,51043,51047,51059,51061,51071,51109,51131, 51133,51137,51151,51157,51169,51193,51197,51199,51203,51217,51229,51239,51241, 51257,51263,51283,51287,51307,51329,51341,51343,51347,51349,51361,51383,51407, 51413,51419,51421,51427,51431,51437,51439,51449,51461,51473,51479,51481,51487, 51503,51511,51517,51521,51539,51551,51563,51577,51581,51593,51599,51607,51613, 51631,51637,51647,51659,51673,51679,51683,51691,51713,51719,51721,51749,51767, 51769,51787,51797,51803,51817,51827,51829,51839,51853,51859,51869,51871,51893, 51899,51907,51913,51929,51941,51949,51971,51973,51977,51991,52009,52021,52027, 52051,52057,52067,52069,52081,52103,52121,52127,52147,52153,52163,52177,52181, 52183,52189,52201,52223,52237,52249,52253,52259,52267,52289,52291,52301,52313, 52321,52361,52363,52369,52379,52387,52391,52433,52453,52457,52489,52501,52511, 52517,52529,52541,52543,52553,52561,52567,52571,52579,52583,52609,52627,52631, 52639,52667,52673,52691,52697,52709,52711,52721,52727,52733,52747,52757,52769, 52783,52807,52813,52817,52837,52859,52861,52879,52883,52889,52901,52903,52919, 52937,52951,52957,52963,52967,52973,52981,52999,53003,53017,53047,53051,53069, 53077,53087,53089,53093,53101,53113,53117,53129,53147,53149,53161,53171,53173, 53189,53197,53201,53231,53233,53239,53267,53269,53279,53281,53299,53309,53323, 53327,53353,53359,53377,53381,53401,53407,53411,53419,53437,53441,53453,53479, 53503,53507,53527,53549,53551,53569,53591,53593,53597,53609,53611,53617,53623, 53629,53633,53639,53653,53657,53681,53693,53699,53717,53719,53731,53759,53773, 53777,53783,53791,53813,53819,53831,53849,53857,53861,53881,53887,53891,53897, 53899,53917,53923,53927,53939,53951,53959,53987,53993,54001,54011,54013,54037, 54049,54059,54083,54091,54101,54121,54133,54139,54151,54163,54167,54181,54193, 54217,54251,54269,54277,54287,54293,54311,54319,54323,54331,54347,54361,54367, 54371,54377,54401,54403,54409,54413,54419,54421,54437,54443,54449,54469,54493, 54497,54499,54503,54517,54521,54539,54541,54547,54559,54563,54577,54581,54583, 54601,54617,54623,54629,54631,54647,54667,54673,54679,54709,54713,54721,54727, 54751,54767,54773,54779,54787,54799,54829,54833,54851,54869,54877,54881,54907, 54917,54919,54941,54949,54959,54973,54979,54983,55001,55009,55021,55049,55051, 55057,55061,55073,55079,55103,55109,55117,55127,55147,55163,55171,55201,55207, 55213,55217,55219,55229,55243,55249,55259,55291,55313,55331,55333,55337,55339, 55343,55351,55373,55381,55399,55411,55439,55441,55457,55469,55487,55501,55511, 55529,55541,55547,55579,55589,55603,55609,55619,55621,55631,55633,55639,55661, 55663,55667,55673,55681,55691,55697,55711,55717,55721,55733,55763,55787,55793, 55799,55807,55813,55817,55819,55823,55829,55837,55843,55849,55871,55889,55897, 55901,55903,55921,55927,55931,55933,55949,55967,55987,55997,56003,56009,56039, 56041,56053,56081,56087,56093,56099,56101,56113,56123,56131,56149,56167,56171, 56179,56197,56207,56209,56237,56239,56249,56263,56267,56269,56299,56311,56333, 56359,56369,56377,56383,56393,56401,56417,56431,56437,56443,56453,56467,56473, 56477,56479,56489,56501,56503,56509,56519,56527,56531,56533,56543,56569,56591, 56597,56599,56611,56629,56633,56659,56663,56671,56681,56687,56701,56711,56713, 56731,56737,56747,56767,56773,56779,56783,56807,56809,56813,56821,56827,56843, 56857,56873,56891,56893,56897,56909,56911,56921,56923,56929,56941,56951,56957, 56963,56983,56989,56993,56999,57037,57041,57047,57059,57073,57077,57089,57097, 57107,57119,57131,57139,57143,57149,57163,57173,57179,57191,57193,57203,57221, 57223,57241,57251,57259,57269,57271,57283,57287,57301,57329,57331,57347,57349, 57367,57373,57383,57389,57397,57413,57427,57457,57467,57487,57493,57503,57527, 57529,57557,57559,57571,57587,57593,57601,57637,57641,57649,57653,57667,57679, 57689,57697,57709,57713,57719,57727,57731,57737,57751,57773,57781,57787,57791, 57793,57803,57809,57829,57839,57847,57853,57859,57881,57899,57901,57917,57923, 57943,57947,57973,57977,57991,58013,58027,58031,58043,58049,58057,58061,58067, 58073,58099,58109,58111,58129,58147,58151,58153,58169,58171,58189,58193,58199, 58207,58211,58217,58229,58231,58237,58243,58271,58309,58313,58321,58337,58363, 58367,58369,58379,58391,58393,58403,58411,58417,58427,58439,58441,58451,58453, 58477,58481,58511,58537,58543,58549,58567,58573,58579,58601,58603,58613,58631, 58657,58661,58679,58687,58693,58699,58711,58727,58733,58741,58757,58763,58771, 58787,58789,58831,58889,58897,58901,58907,58909,58913,58921,58937,58943,58963, 58967,58979,58991,58997,59009,59011,59021,59023,59029,59051,59053,59063,59069, 59077,59083,59093,59107,59113,59119,59123,59141,59149,59159,59167,59183,59197, 59207,59209,59219,59221,59233,59239,59243,59263,59273,59281,59333,59341,59351, 59357,59359,59369,59377,59387,59393,59399,59407,59417,59419,59441,59443,59447, 59453,59467,59471,59473,59497,59509,59513,59539,59557,59561,59567,59581,59611, 59617,59621,59627,59629,59651,59659,59663,59669,59671,59693,59699,59707,59723, 59729,59743,59747,59753,59771,59779,59791,59797,59809,59833,59863,59879,59887, 59921,59929,59951,59957,59971,59981,59999,60013,60017,60029,60037,60041,60077, 60083,60089,60091,60101,60103,60107,60127,60133,60139,60149,60161,60167,60169, 60209,60217,60223,60251,60257,60259,60271,60289,60293,60317,60331,60337,60343, 60353,60373,60383,60397,60413,60427,60443,60449,60457,60493,60497,60509,60521, 60527,60539,60589,60601,60607,60611,60617,60623,60631,60637,60647,60649,60659, 60661,60679,60689,60703,60719,60727,60733,60737,60757,60761,60763,60773,60779, 60793,60811,60821,60859,60869,60887,60889,60899,60901,60913,60917,60919,60923, 60937,60943,60953,60961,61001,61007,61027,61031,61043,61051,61057,61091,61099, 61121,61129,61141,61151,61153,61169,61211,61223,61231,61253,61261,61283,61291, 61297,61331,61333,61339,61343,61357,61363,61379,61381,61403,61409,61417,61441, 61463,61469,61471,61483,61487,61493,61507,61511,61519,61543,61547,61553,61559, 61561,61583,61603,61609,61613,61627,61631,61637,61643,61651,61657,61667,61673, 61681,61687,61703,61717,61723,61729,61751,61757,61781,61813,61819,61837,61843, 61861,61871,61879,61909,61927,61933,61949,61961,61967,61979,61981,61987,61991, 62003,62011,62017,62039,62047,62053,62057,62071,62081,62099,62119,62129,62131, 62137,62141,62143,62171,62189,62191,62201,62207,62213,62219,62233,62273,62297, 62299,62303,62311,62323,62327,62347,62351,62383,62401,62417,62423,62459,62467, 62473,62477,62483,62497,62501,62507,62533,62539,62549,62563,62581,62591,62597, 62603,62617,62627,62633,62639,62653,62659,62683,62687,62701,62723,62731,62743, 62753,62761,62773,62791,62801,62819,62827,62851,62861,62869,62873,62897,62903, 62921,62927,62929,62939,62969,62971,62981,62983,62987,62989,63029,63031,63059, 63067,63073,63079,63097,63103,63113,63127,63131,63149,63179,63197,63199,63211, 63241,63247,63277,63281,63299,63311,63313,63317,63331,63337,63347,63353,63361, 63367,63377,63389,63391,63397,63409,63419,63421,63439,63443,63463,63467,63473, 63487,63493,63499,63521,63527,63533,63541,63559,63577,63587,63589,63599,63601, 63607,63611,63617,63629,63647,63649,63659,63667,63671,63689,63691,63697,63703, 63709,63719,63727,63737,63743,63761,63773,63781,63793,63799,63803,63809,63823, 63839,63841,63853,63857,63863,63901,63907,63913,63929,63949,63977,63997,64007, 64013,64019,64033,64037,64063,64067,64081,64091,64109,64123,64151,64153,64157, 64171,64187,64189,64217,64223,64231,64237,64271,64279,64283,64301,64303,64319, 64327,64333,64373,64381,64399,64403,64433,64439,64451,64453,64483,64489,64499, 64513,64553,64567,64577,64579,64591,64601,64609,64613,64621,64627,64633,64661, 64663,64667,64679,64693,64709,64717,64747,64763,64781,64783,64793,64811,64817, 64849,64853,64871,64877,64879,64891,64901,64919,64921,64927,64937,64951,64969, 64997,65003,65011,65027,65029,65033,65053,65063,65071,65089,65099,65101,65111, 65119,65123,65129,65141,65147,65167,65171,65173,65179,65183,65203,65213,65239, 65257,65267,65269,65287,65293,65309,65323,65327,65353,65357,65371,65381,65393, 65407,65413,65419,65423,65437,65447,65449,65479,65497,65519,65521,65537 }; /* pr_limit - largest prime in the prime table */ unsigned long *pr_limit = &prime[(sizeof(prime)/sizeof(prime[0]))-1];
{ "pile_set_name": "Github" }
@import "sass/card"; :host { user-select: auto; } #press-content { background: #F7FCFB; -webkit-font-smoothing: antialiased; } .clearfix { &:after { content: ''; display: table; clear: both; } } .square { &:before { content: ""; display: block; padding-top: 100%; } } .rect { &:before { content: ""; display: block; padding-top: 20%; } } #press-banner { display: block; height: 315px; } a { color: #00ACC1; opacity: 1; text-decoration: none; transition: opacity .3s; &:hover { opacity: 0.75; } } h1 { margin: 0; padding: 0; font-family: 'Lobster', sans-serif; font-size: 115px; font-weight: normal; margin: 10px; float: left; color: #fff; &::first-letter { font-size: 161px; vertical-align: middle; } } h2 { margin: 0; padding: 0; font-family: 'Lobster', sans-serif; font-weight: normal; font-size: 48px; color: #9575CD; } h3 { margin: 0; padding: 0; font-weight: 600; font-size: 30px; color: #fff; } h4 { margin: 0; padding: 0; font-size: 22px; } p { font-size: 16px; font-wight: normal; line-height: 28px; } ul { font-size: 16px; font-wight: normal; line-height: 24px; } #press-hero { background: url(img/bg-press-page-hero.png) 50% 100% no-repeat; background-size: cover; height: 1000px; padding: 20px 0 0 0; width: 100%; .press-header, .press-description { box-sizing: border-box; margin: 0 auto; max-width: 1010px; padding: 0 30px; } .press-header { background: url(img/title-bg-swirl_2x.png) center/contain no-repeat; padding: 30px 0 50px 0; text-align: center; width: 100%; .press-title { @extend .clearfix; display: inline-block; transform: rotate(-5deg); } } h3 { margin-top: -10px; color: #fff; } .press-description { @extend .clearfix; p { color: rgba(38, 50, 56, 0.8); font-weight: 300; } } .press-description-left { float: left; padding: 30px 0 0 0; width: 26%; .square { background: url(img/illust-reporter_2x.png) 50% 50% no-repeat; background-size: contain; width: 100%; } } .press-description-right { float: left; width: 74%; } } #press-intro { display: flex; align-items: stretch; a { color: #fff; text-decoration: underline; } h2, { color: #fff; } p, ul { color: #fff; } ul { text-align: left; li { margin-bottom: 10px; } } .press-intro-inner { text-align: center; width: 75%; } .press-intro-col { display: flex; justify-content: center; padding: 25px 0; width: 50%; .rect { margin: 5% 0; width: 100%; } } .press-intro-left { background: #17CC82; .rect { background: url(img/illust-educational_2x.png) 50% 50% no-repeat; background-size: contain; } } .press-intro-right { background: #9575CD; .rect { background: url(img/illust-new-in2015_2x.png) 50% 50% no-repeat; background-size: contain; } } } #press-primary { text-align: center; padding: 100px 0 0 0; h2 { margin-bottom: 50px; } .press-primary-inner { margin: 0 auto; overflow: auto; padding: 0 0 10px; width: 1010px; display: flex; flex-wrap: wrap; justify-content: center; } p { min-height: 144px; } .press-card-links { a { float: left; width: 50%; } } } #press-secondary { padding: 100px 0 100px 0; text-align: center; h2 { margin-bottom: 25px; } .press-card-container { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; } .press-card { width: calc(33% - 30px); .press-card-img { height: 175px; } } .press-secondary-inner { margin: 0 auto; overflow: auto; width: 1010px; .press-card-tabs { padding-bottom: 50px; button { font: inherit; border: none; cursor: pointer; font-size: 14px; font-weight: 600; padding: 20px; position: relative; text-transform: uppercase; z-index: 1; display: inline-block; border-radius: 8px; background: transparent; color: #9575CD; &.active { background: #9575CD; color: white; } } } } } #press-embed { background: #9575CD; padding: 100px 0; text-align: center; .press-embed-inner { margin: 0 auto; width: 640px; } a { color: #80DEEA; text-decoration: none; } p { color: #fff; } .rect { background: url(img/illust-embed_2x.png) 50% 50% no-repeat; background-size: contain; } } #press-device { padding: 50px 0; text-align: center; h3, h4, p { color: #607D8B; } h3 { font-weight: 600; } p { font-size: 16px; line-height: 24px; } a { font-size: 16px; } .press-device-grid { margin: 0 auto; max-width: 1010px; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; .press-device-square { will-change: transform; // avoid chrome hiding this layer padding: 0 15px 30px; text-align: center; box-sizing: border-box; width: 25%; min-width: 240px; .square { background: transparent center/contain no-repeat; width: 128px; margin: 25px auto; } } } } #press-footer { will-change: transform; // avoid chrome hiding this layer background: #17CC82; text-align: center; padding: 100px; p { color: #fff; padding-bottom: 25px; font-size: 16px; } a { background: #FFBE26; border: none; border-radius: 5px; color: #fff; font-size: 16px; font-weight: bold; height: 50px; opacity: 1; padding: 15px 35px; text-decoration: none; transition: background .3s; width: 250px; &:hover { background: #ffd54f; } } } @import "sass/responsive";
{ "pile_set_name": "Github" }
/***************************************************************************/ /* */ /* afdummy.c */ /* */ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ /* Copyright 2003-2005, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #include "afdummy.h" #include "afhints.h" #include "aferrors.h" static FT_Error af_dummy_hints_init( AF_GlyphHints hints, AF_ScriptMetrics metrics ) { af_glyph_hints_rescale( hints, metrics ); return FT_Err_Ok; } static FT_Error af_dummy_hints_apply( AF_GlyphHints hints, FT_Outline* outline ) { FT_UNUSED( hints ); FT_UNUSED( outline ); return FT_Err_Ok; } AF_DEFINE_SCRIPT_CLASS( af_dummy_script_class, AF_SCRIPT_DUMMY, NULL, 0, sizeof ( AF_ScriptMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, (AF_Script_DoneMetricsFunc) NULL, (AF_Script_InitHintsFunc) af_dummy_hints_init, (AF_Script_ApplyHintsFunc) af_dummy_hints_apply ) /* END */
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0-or-later /* * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. */ #include "dtc.h" #include "srcpos.h" #define FTF_FULLPATH 0x1 #define FTF_VARALIGN 0x2 #define FTF_NAMEPROPS 0x4 #define FTF_BOOTCPUID 0x8 #define FTF_STRTABSIZE 0x10 #define FTF_STRUCTSIZE 0x20 #define FTF_NOPS 0x40 static struct version_info { int version; int last_comp_version; int hdr_size; int flags; } version_table[] = { {1, 1, FDT_V1_SIZE, FTF_FULLPATH|FTF_VARALIGN|FTF_NAMEPROPS}, {2, 1, FDT_V2_SIZE, FTF_FULLPATH|FTF_VARALIGN|FTF_NAMEPROPS|FTF_BOOTCPUID}, {3, 1, FDT_V3_SIZE, FTF_FULLPATH|FTF_VARALIGN|FTF_NAMEPROPS|FTF_BOOTCPUID|FTF_STRTABSIZE}, {16, 16, FDT_V3_SIZE, FTF_BOOTCPUID|FTF_STRTABSIZE|FTF_NOPS}, {17, 16, FDT_V17_SIZE, FTF_BOOTCPUID|FTF_STRTABSIZE|FTF_STRUCTSIZE|FTF_NOPS}, }; struct emitter { void (*cell)(void *, cell_t); void (*string)(void *, const char *, int); void (*align)(void *, int); void (*data)(void *, struct data); void (*beginnode)(void *, struct label *labels); void (*endnode)(void *, struct label *labels); void (*property)(void *, struct label *labels); }; static void bin_emit_cell(void *e, cell_t val) { struct data *dtbuf = e; *dtbuf = data_append_cell(*dtbuf, val); } static void bin_emit_string(void *e, const char *str, int len) { struct data *dtbuf = e; if (len == 0) len = strlen(str); *dtbuf = data_append_data(*dtbuf, str, len); *dtbuf = data_append_byte(*dtbuf, '\0'); } static void bin_emit_align(void *e, int a) { struct data *dtbuf = e; *dtbuf = data_append_align(*dtbuf, a); } static void bin_emit_data(void *e, struct data d) { struct data *dtbuf = e; *dtbuf = data_append_data(*dtbuf, d.val, d.len); } static void bin_emit_beginnode(void *e, struct label *labels) { bin_emit_cell(e, FDT_BEGIN_NODE); } static void bin_emit_endnode(void *e, struct label *labels) { bin_emit_cell(e, FDT_END_NODE); } static void bin_emit_property(void *e, struct label *labels) { bin_emit_cell(e, FDT_PROP); } static struct emitter bin_emitter = { .cell = bin_emit_cell, .string = bin_emit_string, .align = bin_emit_align, .data = bin_emit_data, .beginnode = bin_emit_beginnode, .endnode = bin_emit_endnode, .property = bin_emit_property, }; static void emit_label(FILE *f, const char *prefix, const char *label) { fprintf(f, "\t.globl\t%s_%s\n", prefix, label); fprintf(f, "%s_%s:\n", prefix, label); fprintf(f, "_%s_%s:\n", prefix, label); } static void emit_offset_label(FILE *f, const char *label, int offset) { fprintf(f, "\t.globl\t%s\n", label); fprintf(f, "%s\t= . + %d\n", label, offset); } #define ASM_EMIT_BELONG(f, fmt, ...) \ { \ fprintf((f), "\t.byte\t((" fmt ") >> 24) & 0xff\n", __VA_ARGS__); \ fprintf((f), "\t.byte\t((" fmt ") >> 16) & 0xff\n", __VA_ARGS__); \ fprintf((f), "\t.byte\t((" fmt ") >> 8) & 0xff\n", __VA_ARGS__); \ fprintf((f), "\t.byte\t(" fmt ") & 0xff\n", __VA_ARGS__); \ } static void asm_emit_cell(void *e, cell_t val) { FILE *f = e; fprintf(f, "\t.byte 0x%02x; .byte 0x%02x; .byte 0x%02x; .byte 0x%02x\n", (val >> 24) & 0xff, (val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff); } static void asm_emit_string(void *e, const char *str, int len) { FILE *f = e; if (len != 0) fprintf(f, "\t.string\t\"%.*s\"\n", len, str); else fprintf(f, "\t.string\t\"%s\"\n", str); } static void asm_emit_align(void *e, int a) { FILE *f = e; fprintf(f, "\t.balign\t%d, 0\n", a); } static void asm_emit_data(void *e, struct data d) { FILE *f = e; int off = 0; struct marker *m = d.markers; for_each_marker_of_type(m, LABEL) emit_offset_label(f, m->ref, m->offset); while ((d.len - off) >= sizeof(uint32_t)) { asm_emit_cell(e, dtb_ld32(d.val + off)); off += sizeof(uint32_t); } while ((d.len - off) >= 1) { fprintf(f, "\t.byte\t0x%hhx\n", d.val[off]); off += 1; } assert(off == d.len); } static void asm_emit_beginnode(void *e, struct label *labels) { FILE *f = e; struct label *l; for_each_label(labels, l) { fprintf(f, "\t.globl\t%s\n", l->label); fprintf(f, "%s:\n", l->label); } fprintf(f, "\t/* FDT_BEGIN_NODE */\n"); asm_emit_cell(e, FDT_BEGIN_NODE); } static void asm_emit_endnode(void *e, struct label *labels) { FILE *f = e; struct label *l; fprintf(f, "\t/* FDT_END_NODE */\n"); asm_emit_cell(e, FDT_END_NODE); for_each_label(labels, l) { fprintf(f, "\t.globl\t%s_end\n", l->label); fprintf(f, "%s_end:\n", l->label); } } static void asm_emit_property(void *e, struct label *labels) { FILE *f = e; struct label *l; for_each_label(labels, l) { fprintf(f, "\t.globl\t%s\n", l->label); fprintf(f, "%s:\n", l->label); } fprintf(f, "\t/* FDT_PROP */\n"); asm_emit_cell(e, FDT_PROP); } static struct emitter asm_emitter = { .cell = asm_emit_cell, .string = asm_emit_string, .align = asm_emit_align, .data = asm_emit_data, .beginnode = asm_emit_beginnode, .endnode = asm_emit_endnode, .property = asm_emit_property, }; static int stringtable_insert(struct data *d, const char *str) { int i; /* FIXME: do this more efficiently? */ for (i = 0; i < d->len; i++) { if (streq(str, d->val + i)) return i; } *d = data_append_data(*d, str, strlen(str)+1); return i; } static void flatten_tree(struct node *tree, struct emitter *emit, void *etarget, struct data *strbuf, struct version_info *vi) { struct property *prop; struct node *child; bool seen_name_prop = false; if (tree->deleted) return; emit->beginnode(etarget, tree->labels); if (vi->flags & FTF_FULLPATH) emit->string(etarget, tree->fullpath, 0); else emit->string(etarget, tree->name, 0); emit->align(etarget, sizeof(cell_t)); for_each_property(tree, prop) { int nameoff; if (streq(prop->name, "name")) seen_name_prop = true; nameoff = stringtable_insert(strbuf, prop->name); emit->property(etarget, prop->labels); emit->cell(etarget, prop->val.len); emit->cell(etarget, nameoff); if ((vi->flags & FTF_VARALIGN) && (prop->val.len >= 8)) emit->align(etarget, 8); emit->data(etarget, prop->val); emit->align(etarget, sizeof(cell_t)); } if ((vi->flags & FTF_NAMEPROPS) && !seen_name_prop) { emit->property(etarget, NULL); emit->cell(etarget, tree->basenamelen+1); emit->cell(etarget, stringtable_insert(strbuf, "name")); if ((vi->flags & FTF_VARALIGN) && ((tree->basenamelen+1) >= 8)) emit->align(etarget, 8); emit->string(etarget, tree->name, tree->basenamelen); emit->align(etarget, sizeof(cell_t)); } for_each_child(tree, child) { flatten_tree(child, emit, etarget, strbuf, vi); } emit->endnode(etarget, tree->labels); } static struct data flatten_reserve_list(struct reserve_info *reservelist, struct version_info *vi) { struct reserve_info *re; struct data d = empty_data; int j; for (re = reservelist; re; re = re->next) { d = data_append_re(d, re->address, re->size); } /* * Add additional reserved slots if the user asked for them. */ for (j = 0; j < reservenum; j++) { d = data_append_re(d, 0, 0); } return d; } static void make_fdt_header(struct fdt_header *fdt, struct version_info *vi, int reservesize, int dtsize, int strsize, int boot_cpuid_phys) { int reserve_off; reservesize += sizeof(struct fdt_reserve_entry); memset(fdt, 0xff, sizeof(*fdt)); fdt->magic = cpu_to_fdt32(FDT_MAGIC); fdt->version = cpu_to_fdt32(vi->version); fdt->last_comp_version = cpu_to_fdt32(vi->last_comp_version); /* Reserve map should be doubleword aligned */ reserve_off = ALIGN(vi->hdr_size, 8); fdt->off_mem_rsvmap = cpu_to_fdt32(reserve_off); fdt->off_dt_struct = cpu_to_fdt32(reserve_off + reservesize); fdt->off_dt_strings = cpu_to_fdt32(reserve_off + reservesize + dtsize); fdt->totalsize = cpu_to_fdt32(reserve_off + reservesize + dtsize + strsize); if (vi->flags & FTF_BOOTCPUID) fdt->boot_cpuid_phys = cpu_to_fdt32(boot_cpuid_phys); if (vi->flags & FTF_STRTABSIZE) fdt->size_dt_strings = cpu_to_fdt32(strsize); if (vi->flags & FTF_STRUCTSIZE) fdt->size_dt_struct = cpu_to_fdt32(dtsize); } void dt_to_blob(FILE *f, struct dt_info *dti, int version) { struct version_info *vi = NULL; int i; struct data blob = empty_data; struct data reservebuf = empty_data; struct data dtbuf = empty_data; struct data strbuf = empty_data; struct fdt_header fdt; int padlen = 0; for (i = 0; i < ARRAY_SIZE(version_table); i++) { if (version_table[i].version == version) vi = &version_table[i]; } if (!vi) die("Unknown device tree blob version %d\n", version); flatten_tree(dti->dt, &bin_emitter, &dtbuf, &strbuf, vi); bin_emit_cell(&dtbuf, FDT_END); reservebuf = flatten_reserve_list(dti->reservelist, vi); /* Make header */ make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len, dti->boot_cpuid_phys); /* * If the user asked for more space than is used, adjust the totalsize. */ if (minsize > 0) { padlen = minsize - fdt32_to_cpu(fdt.totalsize); if (padlen < 0) { padlen = 0; if (quiet < 1) fprintf(stderr, "Warning: blob size %"PRIu32" >= minimum size %d\n", fdt32_to_cpu(fdt.totalsize), minsize); } } if (padsize > 0) padlen = padsize; if (alignsize > 0) padlen = ALIGN(fdt32_to_cpu(fdt.totalsize) + padlen, alignsize) - fdt32_to_cpu(fdt.totalsize); if (padlen > 0) { int tsize = fdt32_to_cpu(fdt.totalsize); tsize += padlen; fdt.totalsize = cpu_to_fdt32(tsize); } /* * Assemble the blob: start with the header, add with alignment * the reserve buffer, add the reserve map terminating zeroes, * the device tree itself, and finally the strings. */ blob = data_append_data(blob, &fdt, vi->hdr_size); blob = data_append_align(blob, 8); blob = data_merge(blob, reservebuf); blob = data_append_zeroes(blob, sizeof(struct fdt_reserve_entry)); blob = data_merge(blob, dtbuf); blob = data_merge(blob, strbuf); /* * If the user asked for more space than is used, pad out the blob. */ if (padlen > 0) blob = data_append_zeroes(blob, padlen); if (fwrite(blob.val, blob.len, 1, f) != 1) { if (ferror(f)) die("Error writing device tree blob: %s\n", strerror(errno)); else die("Short write on device tree blob\n"); } /* * data_merge() frees the right-hand element so only the blob * remains to be freed. */ data_free(blob); } static void dump_stringtable_asm(FILE *f, struct data strbuf) { const char *p; int len; p = strbuf.val; while (p < (strbuf.val + strbuf.len)) { len = strlen(p); fprintf(f, "\t.string \"%s\"\n", p); p += len+1; } } void dt_to_asm(FILE *f, struct dt_info *dti, int version) { struct version_info *vi = NULL; int i; struct data strbuf = empty_data; struct reserve_info *re; const char *symprefix = "dt"; for (i = 0; i < ARRAY_SIZE(version_table); i++) { if (version_table[i].version == version) vi = &version_table[i]; } if (!vi) die("Unknown device tree blob version %d\n", version); fprintf(f, "/* autogenerated by dtc, do not edit */\n\n"); emit_label(f, symprefix, "blob_start"); emit_label(f, symprefix, "header"); fprintf(f, "\t/* magic */\n"); asm_emit_cell(f, FDT_MAGIC); fprintf(f, "\t/* totalsize */\n"); ASM_EMIT_BELONG(f, "_%s_blob_abs_end - _%s_blob_start", symprefix, symprefix); fprintf(f, "\t/* off_dt_struct */\n"); ASM_EMIT_BELONG(f, "_%s_struct_start - _%s_blob_start", symprefix, symprefix); fprintf(f, "\t/* off_dt_strings */\n"); ASM_EMIT_BELONG(f, "_%s_strings_start - _%s_blob_start", symprefix, symprefix); fprintf(f, "\t/* off_mem_rsvmap */\n"); ASM_EMIT_BELONG(f, "_%s_reserve_map - _%s_blob_start", symprefix, symprefix); fprintf(f, "\t/* version */\n"); asm_emit_cell(f, vi->version); fprintf(f, "\t/* last_comp_version */\n"); asm_emit_cell(f, vi->last_comp_version); if (vi->flags & FTF_BOOTCPUID) { fprintf(f, "\t/* boot_cpuid_phys */\n"); asm_emit_cell(f, dti->boot_cpuid_phys); } if (vi->flags & FTF_STRTABSIZE) { fprintf(f, "\t/* size_dt_strings */\n"); ASM_EMIT_BELONG(f, "_%s_strings_end - _%s_strings_start", symprefix, symprefix); } if (vi->flags & FTF_STRUCTSIZE) { fprintf(f, "\t/* size_dt_struct */\n"); ASM_EMIT_BELONG(f, "_%s_struct_end - _%s_struct_start", symprefix, symprefix); } /* * Reserve map entries. * Align the reserve map to a doubleword boundary. * Each entry is an (address, size) pair of u64 values. * Always supply a zero-sized temination entry. */ asm_emit_align(f, 8); emit_label(f, symprefix, "reserve_map"); fprintf(f, "/* Memory reserve map from source file */\n"); /* * Use .long on high and low halves of u64s to avoid .quad * as it appears .quad isn't available in some assemblers. */ for (re = dti->reservelist; re; re = re->next) { struct label *l; for_each_label(re->labels, l) { fprintf(f, "\t.globl\t%s\n", l->label); fprintf(f, "%s:\n", l->label); } ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->address >> 32)); ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->address & 0xffffffff)); ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->size >> 32)); ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->size & 0xffffffff)); } for (i = 0; i < reservenum; i++) { fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n"); } fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n"); emit_label(f, symprefix, "struct_start"); flatten_tree(dti->dt, &asm_emitter, f, &strbuf, vi); fprintf(f, "\t/* FDT_END */\n"); asm_emit_cell(f, FDT_END); emit_label(f, symprefix, "struct_end"); emit_label(f, symprefix, "strings_start"); dump_stringtable_asm(f, strbuf); emit_label(f, symprefix, "strings_end"); emit_label(f, symprefix, "blob_end"); /* * If the user asked for more space than is used, pad it out. */ if (minsize > 0) { fprintf(f, "\t.space\t%d - (_%s_blob_end - _%s_blob_start), 0\n", minsize, symprefix, symprefix); } if (padsize > 0) { fprintf(f, "\t.space\t%d, 0\n", padsize); } if (alignsize > 0) asm_emit_align(f, alignsize); emit_label(f, symprefix, "blob_abs_end"); data_free(strbuf); } struct inbuf { char *base, *limit, *ptr; }; static void inbuf_init(struct inbuf *inb, void *base, void *limit) { inb->base = base; inb->limit = limit; inb->ptr = inb->base; } static void flat_read_chunk(struct inbuf *inb, void *p, int len) { if ((inb->ptr + len) > inb->limit) die("Premature end of data parsing flat device tree\n"); memcpy(p, inb->ptr, len); inb->ptr += len; } static uint32_t flat_read_word(struct inbuf *inb) { fdt32_t val; assert(((inb->ptr - inb->base) % sizeof(val)) == 0); flat_read_chunk(inb, &val, sizeof(val)); return fdt32_to_cpu(val); } static void flat_realign(struct inbuf *inb, int align) { int off = inb->ptr - inb->base; inb->ptr = inb->base + ALIGN(off, align); if (inb->ptr > inb->limit) die("Premature end of data parsing flat device tree\n"); } static char *flat_read_string(struct inbuf *inb) { int len = 0; const char *p = inb->ptr; char *str; do { if (p >= inb->limit) die("Premature end of data parsing flat device tree\n"); len++; } while ((*p++) != '\0'); str = xstrdup(inb->ptr); inb->ptr += len; flat_realign(inb, sizeof(uint32_t)); return str; } static struct data flat_read_data(struct inbuf *inb, int len) { struct data d = empty_data; if (len == 0) return empty_data; d = data_grow_for(d, len); d.len = len; flat_read_chunk(inb, d.val, len); flat_realign(inb, sizeof(uint32_t)); return d; } static char *flat_read_stringtable(struct inbuf *inb, int offset) { const char *p; p = inb->base + offset; while (1) { if (p >= inb->limit || p < inb->base) die("String offset %d overruns string table\n", offset); if (*p == '\0') break; p++; } return xstrdup(inb->base + offset); } static struct property *flat_read_property(struct inbuf *dtbuf, struct inbuf *strbuf, int flags) { uint32_t proplen, stroff; char *name; struct data val; proplen = flat_read_word(dtbuf); stroff = flat_read_word(dtbuf); name = flat_read_stringtable(strbuf, stroff); if ((flags & FTF_VARALIGN) && (proplen >= 8)) flat_realign(dtbuf, 8); val = flat_read_data(dtbuf, proplen); return build_property(name, val, NULL); } static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) { struct reserve_info *reservelist = NULL; struct reserve_info *new; struct fdt_reserve_entry re; /* * Each entry is a pair of u64 (addr, size) values for 4 cell_t's. * List terminates at an entry with size equal to zero. * * First pass, count entries. */ while (1) { uint64_t address, size; flat_read_chunk(inb, &re, sizeof(re)); address = fdt64_to_cpu(re.address); size = fdt64_to_cpu(re.size); if (size == 0) break; new = build_reserve_entry(address, size); reservelist = add_reserve_entry(reservelist, new); } return reservelist; } static char *nodename_from_path(const char *ppath, const char *cpath) { int plen; plen = strlen(ppath); if (!strstarts(cpath, ppath)) die("Path \"%s\" is not valid as a child of \"%s\"\n", cpath, ppath); /* root node is a special case */ if (!streq(ppath, "/")) plen++; return xstrdup(cpath + plen); } static struct node *unflatten_tree(struct inbuf *dtbuf, struct inbuf *strbuf, const char *parent_flatname, int flags) { struct node *node; char *flatname; uint32_t val; node = build_node(NULL, NULL, NULL); flatname = flat_read_string(dtbuf); if (flags & FTF_FULLPATH) node->name = nodename_from_path(parent_flatname, flatname); else node->name = flatname; do { struct property *prop; struct node *child; val = flat_read_word(dtbuf); switch (val) { case FDT_PROP: if (node->children) fprintf(stderr, "Warning: Flat tree input has " "subnodes preceding a property.\n"); prop = flat_read_property(dtbuf, strbuf, flags); add_property(node, prop); break; case FDT_BEGIN_NODE: child = unflatten_tree(dtbuf,strbuf, flatname, flags); add_child(node, child); break; case FDT_END_NODE: break; case FDT_END: die("Premature FDT_END in device tree blob\n"); break; case FDT_NOP: if (!(flags & FTF_NOPS)) fprintf(stderr, "Warning: NOP tag found in flat tree" " version <16\n"); /* Ignore */ break; default: die("Invalid opcode word %08x in device tree blob\n", val); } } while (val != FDT_END_NODE); if (node->name != flatname) { free(flatname); } return node; } struct dt_info *dt_from_blob(const char *fname) { FILE *f; fdt32_t magic_buf, totalsize_buf; uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys; uint32_t off_dt, off_str, off_mem_rsvmap; int rc; char *blob; struct fdt_header *fdt; char *p; struct inbuf dtbuf, strbuf; struct inbuf memresvbuf; int sizeleft; struct reserve_info *reservelist; struct node *tree; uint32_t val; int flags = 0; f = srcfile_relative_open(fname, NULL); rc = fread(&magic_buf, sizeof(magic_buf), 1, f); if (ferror(f)) die("Error reading DT blob magic number: %s\n", strerror(errno)); if (rc < 1) { if (feof(f)) die("EOF reading DT blob magic number\n"); else die("Mysterious short read reading magic number\n"); } magic = fdt32_to_cpu(magic_buf); if (magic != FDT_MAGIC) die("Blob has incorrect magic number\n"); rc = fread(&totalsize_buf, sizeof(totalsize_buf), 1, f); if (ferror(f)) die("Error reading DT blob size: %s\n", strerror(errno)); if (rc < 1) { if (feof(f)) die("EOF reading DT blob size\n"); else die("Mysterious short read reading blob size\n"); } totalsize = fdt32_to_cpu(totalsize_buf); if (totalsize < FDT_V1_SIZE) die("DT blob size (%d) is too small\n", totalsize); blob = xmalloc(totalsize); fdt = (struct fdt_header *)blob; fdt->magic = cpu_to_fdt32(magic); fdt->totalsize = cpu_to_fdt32(totalsize); sizeleft = totalsize - sizeof(magic) - sizeof(totalsize); p = blob + sizeof(magic) + sizeof(totalsize); while (sizeleft) { if (feof(f)) die("EOF before reading %d bytes of DT blob\n", totalsize); rc = fread(p, 1, sizeleft, f); if (ferror(f)) die("Error reading DT blob: %s\n", strerror(errno)); sizeleft -= rc; p += rc; } off_dt = fdt32_to_cpu(fdt->off_dt_struct); off_str = fdt32_to_cpu(fdt->off_dt_strings); off_mem_rsvmap = fdt32_to_cpu(fdt->off_mem_rsvmap); version = fdt32_to_cpu(fdt->version); boot_cpuid_phys = fdt32_to_cpu(fdt->boot_cpuid_phys); if (off_mem_rsvmap >= totalsize) die("Mem Reserve structure offset exceeds total size\n"); if (off_dt >= totalsize) die("DT structure offset exceeds total size\n"); if (off_str > totalsize) die("String table offset exceeds total size\n"); if (version >= 3) { uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings); if ((off_str+size_str < off_str) || (off_str+size_str > totalsize)) die("String table extends past total size\n"); inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str); } else { inbuf_init(&strbuf, blob + off_str, blob + totalsize); } if (version >= 17) { size_dt = fdt32_to_cpu(fdt->size_dt_struct); if ((off_dt+size_dt < off_dt) || (off_dt+size_dt > totalsize)) die("Structure block extends past total size\n"); } if (version < 16) { flags |= FTF_FULLPATH | FTF_NAMEPROPS | FTF_VARALIGN; } else { flags |= FTF_NOPS; } inbuf_init(&memresvbuf, blob + off_mem_rsvmap, blob + totalsize); inbuf_init(&dtbuf, blob + off_dt, blob + totalsize); reservelist = flat_read_mem_reserve(&memresvbuf); val = flat_read_word(&dtbuf); if (val != FDT_BEGIN_NODE) die("Device tree blob doesn't begin with FDT_BEGIN_NODE (begins with 0x%08x)\n", val); tree = unflatten_tree(&dtbuf, &strbuf, "", flags); val = flat_read_word(&dtbuf); if (val != FDT_END) die("Device tree blob doesn't end with FDT_END\n"); free(blob); fclose(f); return build_dt_info(DTSF_V1, reservelist, tree, boot_cpuid_phys); }
{ "pile_set_name": "Github" }
-----BEGIN CERTIFICATE----- MIIGLTCCBRWgAwIBAgISBF3d+Vix9rVMUC/wukfLMR8sMA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNzA4MjQwNTI3MDBaFw0x NzExMjIwNTI3MDBaMBcxFTATBgNVBAMTDG1hdGhkb3duLm5ldDCCAiIwDQYJKoZI hvcNAQEBBQADggIPADCCAgoCggIBAPHuX8G8pt6nHgsq5pdiHq3k9YuTq1HXDk6F YVJnr2bWMzSfINAgFs9eCcbnGzADoNnWx1S2afQ9ivtBiE+Ihwl0z/osIHa2uYAr vMXjGSUekyhFE9ULODvvqnQ7a+Y1vD6lqLuI6YjIcYuU81Fza5zIGE+PbsCMa/q2 9Ta5hFBE2DaqwDWLpb4LN2C+qpk2IrhwRebmDrsm8k0XgPTAjwet1yKyGdb5Tq6a W3RaAHZvOMxLKWucIqnjPR8MyPJnmIDMd/WIfa3ZoGISaY6SHb32kyq/OjIycdPu tGZ+C1U56A0j5HBbt9PwaGK0e+5B8lSGhOOG7GOhMy0pH3C9j3YZA4tfgTjcz07Z LItwakM7F3xe9xVLhevfvT6Fqr+EB9tFlKbgFotQzBRNUtRIuEbGwUTYXNFC108d Z8vHgoq/no84cc+K0bZ1rMZiCOBfB2EyjJB5ZSJLSnXH0zcSBe1bJ9LyoKHclPZ0 xi6RrgUs4QGUqd1L19tE2FxsUJLgKmM4FEMfsgg8GhaVesC9xEa6Ds+ZgWJ+5dn2 J11h+YLAXJ6/XoIMzlWRIhX8CwqUg4CJQ+as1/OHzxxoSmE3SiqX4xmCnAGV894R +zEoT0YRoRyvwJPyAsH8S1d9HzYXjdH1cSdzOUz3erVoTBQWH/u9Cy8WFAn69YXl uffirC25AgMBAAGjggI+MIICOjAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYI KwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFN414Rl3 4iCHHTXFOTKLv6gpAzGiMB8GA1UdIwQYMBaAFKhKamMEfd265tE5t6ZFZe/zqOyh MG8GCCsGAQUFBwEBBGMwYTAuBggrBgEFBQcwAYYiaHR0cDovL29jc3AuaW50LXgz LmxldHNlbmNyeXB0Lm9yZzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgz LmxldHNlbmNyeXB0Lm9yZy8wSQYDVR0RBEIwQIIMbWF0aGRvd24uY29tggxtYXRo ZG93bi5uZXSCEHd3dy5tYXRoZG93bi5jb22CEHd3dy5tYXRoZG93bi5uZXQwgf4G A1UdIASB9jCB8zAIBgZngQwBAgEwgeYGCysGAQQBgt8TAQEBMIHWMCYGCCsGAQUF BwIBFhpodHRwOi8vY3BzLmxldHNlbmNyeXB0Lm9yZzCBqwYIKwYBBQUHAgIwgZ4M gZtUaGlzIENlcnRpZmljYXRlIG1heSBvbmx5IGJlIHJlbGllZCB1cG9uIGJ5IFJl bHlpbmcgUGFydGllcyBhbmQgb25seSBpbiBhY2NvcmRhbmNlIHdpdGggdGhlIENl cnRpZmljYXRlIFBvbGljeSBmb3VuZCBhdCBodHRwczovL2xldHNlbmNyeXB0Lm9y Zy9yZXBvc2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAQEAlKCuCCi9Npl1+ltjJX0f L9oCDYBMX+DlZMpAJ9/FjWDpvQGDA/7Z0vq+OZ831mpcx7VcMIGfLqUXktsh1ooj 6FMZBdN0KqKrg463B0lSbcKbTLS4wsLUYEUZYW79hqrQ9cA/DhFPyfM5cVGjDC+d 5Nrx7NcubjSLijyLOVGmMbGhUI2VUJYNcCPrgzRJSiQTqHJaPZ3edjEHxiTe7GwD 6Rlj/lMfwlcgecQ/lom5SsSWJ+aANENq7me9abp9MW41SdvWf1S6CReEKn1Jichm FyDpdFykjmU0qmxz5HpAXyD87DE83Z+RTMAbQ3m2xTcomUTez9RCcbF3Nh3Zx9CC Xw== -----END CERTIFICATE-----
{ "pile_set_name": "Github" }
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.spinnaker.swabbie.aws.edda.caches import com.netflix.spinnaker.security.AuthenticatedRequest.allowAnonymous import com.netflix.spinnaker.swabbie.InMemoryCache import com.netflix.spinnaker.swabbie.aws.edda.EddaEndpointsService import com.netflix.spinnaker.swabbie.model.EddaEndpoint class EddaEndpointCache( private val eddaEndpointsService: EddaEndpointsService ) : InMemoryCache<EddaEndpoint>({ allowAnonymous { load(eddaEndpointsService) } }) { companion object { fun load(eddaEndpointsService: EddaEndpointsService): Set<EddaEndpoint> { return eddaEndpointsService.getEddaEndpoints().get() .asSequence() .mapNotNull { buildEndpoint(it) } .toSet() } // i.e. "http://edda-account.region.foo.bar.com", private fun buildEndpoint(endpoint: String): EddaEndpoint? { val regex = """^https?://edda-([\w\-]+)\.([\w\-]+)\.([\w\-]+)\..*$""".toRegex() val match = regex.matchEntire(endpoint) ?: return null val (account, region, env) = match.destructured return EddaEndpoint(region, account, env, endpoint, "$region-$account-$env") } } }
{ "pile_set_name": "Github" }
package yaml import ( "encoding" "fmt" "io" "reflect" "regexp" "sort" "strconv" "strings" "time" "unicode/utf8" ) // jsonNumber is the interface of the encoding/json.Number datatype. // Repeating the interface here avoids a dependency on encoding/json, and also // supports other libraries like jsoniter, which use a similar datatype with // the same interface. Detecting this interface is useful when dealing with // structures containing json.Number, which is a string under the hood. The // encoder should prefer the use of Int64(), Float64() and string(), in that // order, when encoding this type. type jsonNumber interface { Float64() (float64, error) Int64() (int64, error) String() string } type encoder struct { emitter yaml_emitter_t event yaml_event_t out []byte flow bool // doneInit holds whether the initial stream_start_event has been // emitted. doneInit bool } func newEncoder() *encoder { e := &encoder{} yaml_emitter_initialize(&e.emitter) yaml_emitter_set_output_string(&e.emitter, &e.out) yaml_emitter_set_unicode(&e.emitter, true) return e } func newEncoderWithWriter(w io.Writer) *encoder { e := &encoder{} yaml_emitter_initialize(&e.emitter) yaml_emitter_set_output_writer(&e.emitter, w) yaml_emitter_set_unicode(&e.emitter, true) return e } func (e *encoder) init() { if e.doneInit { return } yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) e.emit() e.doneInit = true } func (e *encoder) finish() { e.emitter.open_ended = false yaml_stream_end_event_initialize(&e.event) e.emit() } func (e *encoder) destroy() { yaml_emitter_delete(&e.emitter) } func (e *encoder) emit() { // This will internally delete the e.event value. e.must(yaml_emitter_emit(&e.emitter, &e.event)) } func (e *encoder) must(ok bool) { if !ok { msg := e.emitter.problem if msg == "" { msg = "unknown problem generating YAML content" } failf("%s", msg) } } func (e *encoder) marshalDoc(tag string, in reflect.Value) { e.init() yaml_document_start_event_initialize(&e.event, nil, nil, true) e.emit() e.marshal(tag, in) yaml_document_end_event_initialize(&e.event, true) e.emit() } func (e *encoder) marshal(tag string, in reflect.Value) { if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { e.nilv() return } iface := in.Interface() switch m := iface.(type) { case jsonNumber: integer, err := m.Int64() if err == nil { // In this case the json.Number is a valid int64 in = reflect.ValueOf(integer) break } float, err := m.Float64() if err == nil { // In this case the json.Number is a valid float64 in = reflect.ValueOf(float) break } // fallback case - no number could be obtained in = reflect.ValueOf(m.String()) case time.Time, *time.Time: // Although time.Time implements TextMarshaler, // we don't want to treat it as a string for YAML // purposes because YAML has special support for // timestamps. case Marshaler: v, err := m.MarshalYAML() if err != nil { fail(err) } if v == nil { e.nilv() return } in = reflect.ValueOf(v) case encoding.TextMarshaler: text, err := m.MarshalText() if err != nil { fail(err) } in = reflect.ValueOf(string(text)) case nil: e.nilv() return } switch in.Kind() { case reflect.Interface: e.marshal(tag, in.Elem()) case reflect.Map: e.mapv(tag, in) case reflect.Ptr: if in.Type() == ptrTimeType { e.timev(tag, in.Elem()) } else { e.marshal(tag, in.Elem()) } case reflect.Struct: if in.Type() == timeType { e.timev(tag, in) } else { e.structv(tag, in) } case reflect.Slice, reflect.Array: if in.Type().Elem() == mapItemType { e.itemsv(tag, in) } else { e.slicev(tag, in) } case reflect.String: e.stringv(tag, in) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if in.Type() == durationType { e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String())) } else { e.intv(tag, in) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: e.uintv(tag, in) case reflect.Float32, reflect.Float64: e.floatv(tag, in) case reflect.Bool: e.boolv(tag, in) default: panic("cannot marshal type: " + in.Type().String()) } } func (e *encoder) mapv(tag string, in reflect.Value) { e.mappingv(tag, func() { keys := keyList(in.MapKeys()) sort.Sort(keys) for _, k := range keys { e.marshal("", k) e.marshal("", in.MapIndex(k)) } }) } func (e *encoder) itemsv(tag string, in reflect.Value) { e.mappingv(tag, func() { slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem) for _, item := range slice { e.marshal("", reflect.ValueOf(item.Key)) e.marshal("", reflect.ValueOf(item.Value)) } }) } func (e *encoder) structv(tag string, in reflect.Value) { sinfo, err := getStructInfo(in.Type()) if err != nil { panic(err) } e.mappingv(tag, func() { for _, info := range sinfo.FieldsList { var value reflect.Value if info.Inline == nil { value = in.Field(info.Num) } else { value = in.FieldByIndex(info.Inline) } if info.OmitEmpty && isZero(value) { continue } e.marshal("", reflect.ValueOf(info.Key)) e.flow = info.Flow e.marshal("", value) } if sinfo.InlineMap >= 0 { m := in.Field(sinfo.InlineMap) if m.Len() > 0 { e.flow = false keys := keyList(m.MapKeys()) sort.Sort(keys) for _, k := range keys { if _, found := sinfo.FieldsMap[k.String()]; found { panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String())) } e.marshal("", k) e.flow = false e.marshal("", m.MapIndex(k)) } } } }) } func (e *encoder) mappingv(tag string, f func()) { implicit := tag == "" style := yaml_BLOCK_MAPPING_STYLE if e.flow { e.flow = false style = yaml_FLOW_MAPPING_STYLE } yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) e.emit() f() yaml_mapping_end_event_initialize(&e.event) e.emit() } func (e *encoder) slicev(tag string, in reflect.Value) { implicit := tag == "" style := yaml_BLOCK_SEQUENCE_STYLE if e.flow { e.flow = false style = yaml_FLOW_SEQUENCE_STYLE } e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) e.emit() n := in.Len() for i := 0; i < n; i++ { e.marshal("", in.Index(i)) } e.must(yaml_sequence_end_event_initialize(&e.event)) e.emit() } // isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. // // The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported // in YAML 1.2 and by this package, but these should be marshalled quoted for // the time being for compatibility with other parsers. func isBase60Float(s string) (result bool) { // Fast path. if s == "" { return false } c := s[0] if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { return false } // Do the full match. return base60float.MatchString(s) } // From http://yaml.org/type/float.html, except the regular expression there // is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) func (e *encoder) stringv(tag string, in reflect.Value) { var style yaml_scalar_style_t s := in.String() canUsePlain := true switch { case !utf8.ValidString(s): if tag == yaml_BINARY_TAG { failf("explicitly tagged !!binary data must be base64-encoded") } if tag != "" { failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) } // It can't be encoded directly as YAML so use a binary tag // and encode it as base64. tag = yaml_BINARY_TAG s = encodeBase64(s) case tag == "": // Check to see if it would resolve to a specific // tag when encoded unquoted. If it doesn't, // there's no need to quote it. rtag, _ := resolve("", s) canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s) } // Note: it's possible for user code to emit invalid YAML // if they explicitly specify a tag and a string containing // text that's incompatible with that tag. switch { case strings.Contains(s, "\n"): style = yaml_LITERAL_SCALAR_STYLE case canUsePlain: style = yaml_PLAIN_SCALAR_STYLE default: style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } e.emitScalar(s, "", tag, style) } func (e *encoder) boolv(tag string, in reflect.Value) { var s string if in.Bool() { s = "true" } else { s = "false" } e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) } func (e *encoder) intv(tag string, in reflect.Value) { s := strconv.FormatInt(in.Int(), 10) e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) } func (e *encoder) uintv(tag string, in reflect.Value) { s := strconv.FormatUint(in.Uint(), 10) e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) } func (e *encoder) timev(tag string, in reflect.Value) { t := in.Interface().(time.Time) s := t.Format(time.RFC3339Nano) e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) } func (e *encoder) floatv(tag string, in reflect.Value) { // Issue #352: When formatting, use the precision of the underlying value precision := 64 if in.Kind() == reflect.Float32 { precision = 32 } s := strconv.FormatFloat(in.Float(), 'g', -1, precision) switch s { case "+Inf": s = ".inf" case "-Inf": s = "-.inf" case "NaN": s = ".nan" } e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) } func (e *encoder) nilv() { e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) } func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { implicit := tag == "" e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) e.emit() }
{ "pile_set_name": "Github" }
This library is a goodie-bag of Unix shell and environment management tools for automated tests. WWW: https://github.com/manahl/pytest-plugins/tree/master/pytest-shutil
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 2.0 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">2.0</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <value>[base64 mime encoded serialized .NET Framework object]</value> </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <comment>This is a comment</comment> </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used for serialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="metadata"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root>
{ "pile_set_name": "Github" }
; ModuleID = "" target triple = "x86_64-pc-linux-gnu" target datalayout = "" define i64 @"SECRET"(i64 %"SymVar_0") nounwind { .3: %".4" = zext i8 5 to i64 %".5" = and i64 %".4", 63 %".6" = lshr i64 %"SymVar_0", %".5" %".7" = sext i64 %".6" to i128 %".8" = sub i64 %"SymVar_0", 275339905 %".9" = xor i64 %".6", 810798164723513605 %".10" = add i64 %".8", %".9" %".11" = add i64 %".6", %".10" %".12" = add i64 %"SymVar_0", %".11" %".13" = sext i64 %".12" to i128 %".14" = mul i128 %".7", %".13" %".15" = trunc i128 %".14" to i64 %".16" = and i64 %".15", 7 %".17" = zext i8 2 to i64 %".18" = and i64 %".17", 63 %".19" = shl i64 %".16", %".18" %".20" = or i64 %".6", %".19" %".21" = sext i64 1015975030 to i128 %".22" = sext i64 %".6" to i128 %".23" = mul i128 %".21", %".22" %".24" = trunc i128 %".23" to i64 %".25" = and i64 %".24", 7 %".26" = or i64 %".25", 1 %".27" = trunc i64 %".26" to i32 %".28" = zext i32 %".27" to i64 %".29" = trunc i64 %".28" to i8 %".30" = zext i8 %".29" to i64 %".31" = and i64 %".30", 63 %".32" = lshr i64 %"SymVar_0", %".31" %".33" = zext i8 4 to i64 %".34" = and i64 %".33", 63 %".35" = lshr i64 %".10", %".34" %".36" = and i64 %".35", 15 %".37" = or i64 %".36", 1 %".38" = trunc i64 %".37" to i32 %".39" = zext i32 %".38" to i64 %".40" = trunc i64 %".39" to i8 %".41" = zext i8 %".40" to i64 %".42" = and i64 %".41", 63 %".43" = shl i64 %".32", %".42" %".44" = zext i8 4 to i64 %".45" = and i64 %".44", 63 %".46" = lshr i64 %".10", %".45" %".47" = and i64 %".46", 15 %".48" = or i64 %".47", 1 %".49" = sub i64 64, %".48" %".50" = trunc i64 %".49" to i32 %".51" = zext i32 %".50" to i64 %".52" = trunc i64 %".51" to i8 %".53" = zext i8 %".52" to i64 %".54" = and i64 %".53", 63 %".55" = lshr i64 %".32", %".54" %".56" = or i64 %".43", %".55" %".57" = and i64 %".56", 15 %".58" = zext i8 3 to i64 %".59" = and i64 %".58", 63 %".60" = shl i64 %".57", %".59" %".61" = or i64 %".10", %".60" %".62" = and i64 %".61", 15 %".63" = or i64 %".62", 1 %".64" = trunc i64 %".63" to i32 %".65" = zext i32 %".64" to i64 %".66" = trunc i64 %".65" to i8 %".67" = zext i8 %".66" to i64 %".68" = and i64 %".67", 63 %".69" = shl i64 %".20", %".68" %".70" = and i64 %".61", 15 %".71" = or i64 %".70", 1 %".72" = sub i64 64, %".71" %".73" = trunc i64 %".72" to i32 %".74" = zext i32 %".73" to i64 %".75" = trunc i64 %".74" to i8 %".76" = zext i8 %".75" to i64 %".77" = and i64 %".76", 63 %".78" = lshr i64 %".20", %".77" %".79" = or i64 %".69", %".78" %".80" = zext i8 3 to i64 %".81" = and i64 %".80", 63 %".82" = lshr i64 %".32", %".81" %".83" = and i64 %".82", 15 %".84" = or i64 %".83", 1 %".85" = trunc i64 %".84" to i32 %".86" = zext i32 %".85" to i64 %".87" = trunc i64 %".86" to i8 %".88" = zext i8 %".87" to i64 %".89" = and i64 %".88", 63 %".90" = shl i64 %".12", %".89" %".91" = zext i8 3 to i64 %".92" = and i64 %".91", 63 %".93" = lshr i64 %".32", %".92" %".94" = and i64 %".93", 15 %".95" = or i64 %".94", 1 %".96" = sub i64 64, %".95" %".97" = trunc i64 %".96" to i32 %".98" = zext i32 %".97" to i64 %".99" = trunc i64 %".98" to i8 %".100" = zext i8 %".99" to i64 %".101" = and i64 %".100", 63 %".102" = lshr i64 %".12", %".101" %".103" = or i64 %".90", %".102" %".104" = sub i64 %".79", %".103" %".105" = xor i64 %".103", %".104" %".106" = xor i64 %".79", %".105" %".107" = xor i64 %".79", %".104" %".108" = xor i64 %".79", %".103" %".109" = and i64 %".107", %".108" %".110" = xor i64 %".106", %".109" %".111" = lshr i64 %".110", 63 %".112" = trunc i64 %".111" to i1 %".113" = icmp eq i64 %".104", 0 br i1 %".113", label %".3.if", label %".3.else" .3.if: br label %".3.endif" .3.else: br label %".3.endif" .3.endif: %".117" = phi i1 [1, %".3.if"], [0, %".3.else"] %".118" = or i1 %".112", %".117" %".119" = icmp eq i1 %".118", 1 br i1 %".119", label %".3.endif.if", label %".3.endif.else" .3.endif.if: br label %".3.endif.endif" .3.endif.else: br label %".3.endif.endif" .3.endif.endif: %".123" = phi i8 [1, %".3.endif.if"], [0, %".3.endif.else"] %".124" = zext i8 %".123" to i64 %".125" = lshr i64 %".103", 8 %".126" = trunc i64 %".125" to i56 %".127" = zext i56 %".126" to i64 %".128" = shl i64 %".127", 8 %".129" = or i64 %".124", %".128" %".130" = trunc i64 %".129" to i8 %".131" = zext i8 %".130" to i32 %".132" = zext i32 %".131" to i64 %".133" = trunc i64 %".132" to i32 %".134" = zext i32 %".133" to i64 %".135" = trunc i64 %".134" to i32 %".136" = trunc i64 %".134" to i32 %".137" = and i32 %".135", %".136" %".138" = icmp eq i32 %".137", 0 br i1 %".138", label %".3.endif.endif.if", label %".3.endif.endif.else" .3.endif.endif.if: br label %".3.endif.endif.endif" .3.endif.endif.else: br label %".3.endif.endif.endif" .3.endif.endif.endif: %".142" = phi i1 [1, %".3.endif.endif.if"], [0, %".3.endif.endif.else"] %".143" = icmp eq i1 %".142", 1 br i1 %".143", label %".3.endif.endif.endif.if", label %".3.endif.endif.endif.else" .3.endif.endif.endif.if: br label %".3.endif.endif.endif.endif" .3.endif.endif.endif.else: br label %".3.endif.endif.endif.endif" .3.endif.endif.endif.endif: %".147" = phi i1 [1, %".3.endif.endif.endif.if"], [0, %".3.endif.endif.endif.else"] br i1 %".147", label %".3.endif.endif.endif.endif.if", label %".3.endif.endif.endif.endif.else" .3.endif.endif.endif.endif.if: %".149" = zext i8 5 to i64 %".150" = and i64 %".149", 63 %".151" = lshr i64 %"SymVar_0", %".150" %".152" = sext i64 %".151" to i128 %".153" = sub i64 %"SymVar_0", 275339905 %".154" = xor i64 %".151", 810798164723513605 %".155" = add i64 %".153", %".154" %".156" = add i64 %".151", %".155" %".157" = add i64 %"SymVar_0", %".156" %".158" = sext i64 %".157" to i128 %".159" = mul i128 %".152", %".158" %".160" = trunc i128 %".159" to i64 %".161" = and i64 %".160", 7 %".162" = zext i8 2 to i64 %".163" = and i64 %".162", 63 %".164" = shl i64 %".161", %".163" %".165" = or i64 %".151", %".164" %".166" = lshr i64 %".165", 56 %".167" = trunc i64 %".166" to i8 %".168" = zext i8 %".167" to i32 %".169" = zext i32 %".168" to i64 %".170" = trunc i64 %".169" to i8 %".171" = zext i8 %".170" to i32 %".172" = zext i32 %".171" to i64 %".173" = trunc i64 %".172" to i8 %".174" = zext i8 %".173" to i32 %".175" = zext i32 %".174" to i64 %".176" = trunc i64 %".175" to i8 %".177" = zext i8 %".176" to i32 %".178" = zext i32 %".177" to i64 %".179" = trunc i64 %".178" to i8 %".180" = zext i8 %".179" to i64 %".181" = lshr i64 %".165", 8 %".182" = trunc i64 %".181" to i8 %".183" = zext i8 %".182" to i64 %".184" = shl i64 %".183", 8 %".185" = or i64 %".180", %".184" %".186" = lshr i64 %".165", 16 %".187" = trunc i64 %".186" to i8 %".188" = zext i8 %".187" to i64 %".189" = shl i64 %".188", 16 %".190" = or i64 %".185", %".189" %".191" = lshr i64 %".165", 24 %".192" = trunc i64 %".191" to i8 %".193" = zext i8 %".192" to i64 %".194" = shl i64 %".193", 24 %".195" = or i64 %".190", %".194" %".196" = lshr i64 %".165", 32 %".197" = trunc i64 %".196" to i8 %".198" = zext i8 %".197" to i64 %".199" = shl i64 %".198", 32 %".200" = or i64 %".195", %".199" %".201" = lshr i64 %".165", 40 %".202" = trunc i64 %".201" to i8 %".203" = zext i8 %".202" to i64 %".204" = shl i64 %".203", 40 %".205" = or i64 %".200", %".204" %".206" = lshr i64 %".165", 48 %".207" = trunc i64 %".206" to i8 %".208" = zext i8 %".207" to i64 %".209" = shl i64 %".208", 48 %".210" = or i64 %".205", %".209" %".211" = trunc i64 %".165" to i8 %".212" = zext i8 %".211" to i32 %".213" = zext i32 %".212" to i64 %".214" = trunc i64 %".213" to i8 %".215" = zext i8 %".214" to i32 %".216" = zext i32 %".215" to i64 %".217" = trunc i64 %".216" to i8 %".218" = zext i8 %".217" to i64 %".219" = shl i64 %".218", 56 %".220" = or i64 %".210", %".219" %".221" = sext i64 1015975030 to i128 %".222" = sext i64 %".151" to i128 %".223" = mul i128 %".221", %".222" %".224" = trunc i128 %".223" to i64 %".225" = and i64 %".224", 7 %".226" = or i64 %".225", 1 %".227" = trunc i64 %".226" to i32 %".228" = zext i32 %".227" to i64 %".229" = trunc i64 %".228" to i8 %".230" = zext i8 %".229" to i64 %".231" = and i64 %".230", 63 %".232" = lshr i64 %"SymVar_0", %".231" %".233" = zext i8 4 to i64 %".234" = and i64 %".233", 63 %".235" = lshr i64 %".155", %".234" %".236" = and i64 %".235", 15 %".237" = or i64 %".236", 1 %".238" = trunc i64 %".237" to i32 %".239" = zext i32 %".238" to i64 %".240" = trunc i64 %".239" to i8 %".241" = zext i8 %".240" to i64 %".242" = and i64 %".241", 63 %".243" = shl i64 %".232", %".242" %".244" = zext i8 4 to i64 %".245" = and i64 %".244", 63 %".246" = lshr i64 %".155", %".245" %".247" = and i64 %".246", 15 %".248" = or i64 %".247", 1 %".249" = sub i64 64, %".248" %".250" = trunc i64 %".249" to i32 %".251" = zext i32 %".250" to i64 %".252" = trunc i64 %".251" to i8 %".253" = zext i8 %".252" to i64 %".254" = and i64 %".253", 63 %".255" = lshr i64 %".232", %".254" %".256" = or i64 %".243", %".255" %".257" = and i64 %".256", 15 %".258" = zext i8 3 to i64 %".259" = and i64 %".258", 63 %".260" = shl i64 %".257", %".259" %".261" = or i64 %".155", %".260" %".262" = and i64 %".261", 15 %".263" = zext i8 3 to i64 %".264" = and i64 %".263", 63 %".265" = shl i64 %".262", %".264" %".266" = or i64 %".261", %".265" %".267" = trunc i64 %".266" to i8 %".268" = zext i8 %".267" to i32 %".269" = lshr i64 %".266", 8 %".270" = trunc i64 %".269" to i8 %".271" = zext i8 %".270" to i32 %".272" = shl i32 %".271", 8 %".273" = or i32 %".268", %".272" %".274" = lshr i64 %".266", 16 %".275" = trunc i64 %".274" to i8 %".276" = zext i8 %".275" to i32 %".277" = shl i32 %".276", 16 %".278" = or i32 %".273", %".277" %".279" = lshr i64 %".266", 24 %".280" = trunc i64 %".279" to i8 %".281" = zext i8 %".280" to i32 %".282" = shl i32 %".281", 24 %".283" = or i32 %".278", %".282" %".284" = zext i32 %".283" to i64 %".285" = trunc i64 %".284" to i32 %".286" = zext i32 %".285" to i64 %".287" = trunc i64 %".286" to i32 %".288" = zext i32 %".287" to i64 %".289" = trunc i64 %".288" to i32 %".290" = zext i32 %".289" to i64 %".291" = trunc i64 %".290" to i32 %".292" = zext i32 %".291" to i64 %".293" = trunc i64 %".292" to i32 %".294" = zext i32 %".293" to i64 %".295" = trunc i64 %".294" to i32 %".296" = zext i32 %".295" to i64 %".297" = trunc i64 %".296" to i32 %".298" = zext i32 %".297" to i64 %".299" = trunc i64 %".298" to i32 %".300" = trunc i32 %".299" to i8 %".301" = zext i8 %".300" to i64 %".302" = trunc i64 %".298" to i32 %".303" = lshr i32 %".302", 8 %".304" = trunc i32 %".303" to i8 %".305" = zext i8 %".304" to i64 %".306" = shl i64 %".305", 8 %".307" = or i64 %".301", %".306" %".308" = trunc i64 %".298" to i32 %".309" = lshr i32 %".308", 16 %".310" = trunc i32 %".309" to i8 %".311" = zext i8 %".310" to i64 %".312" = shl i64 %".311", 16 %".313" = or i64 %".307", %".312" %".314" = trunc i64 %".298" to i32 %".315" = lshr i32 %".314", 24 %".316" = trunc i32 %".315" to i8 %".317" = zext i8 %".316" to i64 %".318" = shl i64 %".317", 24 %".319" = or i64 %".313", %".318" %".320" = lshr i64 %".266", 32 %".321" = trunc i64 %".320" to i8 %".322" = zext i8 %".321" to i32 %".323" = lshr i64 %".266", 40 %".324" = trunc i64 %".323" to i8 %".325" = zext i8 %".324" to i32 %".326" = shl i32 %".325", 8 %".327" = or i32 %".322", %".326" %".328" = lshr i64 %".266", 48 %".329" = trunc i64 %".328" to i8 %".330" = zext i8 %".329" to i32 %".331" = shl i32 %".330", 16 %".332" = or i32 %".327", %".331" %".333" = lshr i64 %".266", 56 %".334" = trunc i64 %".333" to i8 %".335" = zext i8 %".334" to i32 %".336" = shl i32 %".335", 24 %".337" = or i32 %".332", %".336" %".338" = zext i32 %".337" to i64 %".339" = trunc i64 %".338" to i32 %".340" = zext i32 %".339" to i64 %".341" = trunc i64 %".340" to i32 %".342" = zext i32 %".341" to i64 %".343" = trunc i64 %".342" to i32 %".344" = zext i32 %".343" to i64 %".345" = trunc i64 %".344" to i32 %".346" = trunc i32 %".345" to i8 %".347" = zext i8 %".346" to i64 %".348" = shl i64 %".347", 32 %".349" = or i64 %".319", %".348" %".350" = trunc i64 %".344" to i32 %".351" = lshr i32 %".350", 8 %".352" = trunc i32 %".351" to i8 %".353" = zext i8 %".352" to i64 %".354" = shl i64 %".353", 40 %".355" = or i64 %".349", %".354" %".356" = trunc i64 %".344" to i32 %".357" = lshr i32 %".356", 16 %".358" = trunc i32 %".357" to i8 %".359" = zext i8 %".358" to i64 %".360" = shl i64 %".359", 48 %".361" = or i64 %".355", %".360" %".362" = trunc i64 %".344" to i32 %".363" = lshr i32 %".362", 24 %".364" = trunc i32 %".363" to i8 %".365" = zext i8 %".364" to i64 %".366" = shl i64 %".365", 56 %".367" = or i64 %".361", %".366" %".368" = zext i8 %".179" to i64 %".369" = zext i8 %".182" to i64 %".370" = shl i64 %".369", 8 %".371" = or i64 %".368", %".370" %".372" = zext i8 %".187" to i64 %".373" = shl i64 %".372", 16 %".374" = or i64 %".371", %".373" %".375" = zext i8 %".192" to i64 %".376" = shl i64 %".375", 24 %".377" = or i64 %".374", %".376" %".378" = zext i8 %".197" to i64 %".379" = shl i64 %".378", 32 %".380" = or i64 %".377", %".379" %".381" = zext i8 %".202" to i64 %".382" = shl i64 %".381", 40 %".383" = or i64 %".380", %".382" %".384" = zext i8 %".207" to i64 %".385" = shl i64 %".384", 48 %".386" = or i64 %".383", %".385" %".387" = zext i8 %".217" to i64 %".388" = shl i64 %".387", 56 %".389" = or i64 %".386", %".388" %".390" = sub i64 %".367", %".389" %".391" = and i64 %".390", 63 %".392" = zext i8 4 to i64 %".393" = and i64 %".392", 63 %".394" = shl i64 %".391", %".393" %".395" = or i64 %".220", %".394" %".396" = zext i8 %".300" to i64 %".397" = zext i8 %".304" to i64 %".398" = shl i64 %".397", 8 %".399" = or i64 %".396", %".398" %".400" = zext i8 %".310" to i64 %".401" = shl i64 %".400", 16 %".402" = or i64 %".399", %".401" %".403" = zext i8 %".316" to i64 %".404" = shl i64 %".403", 24 %".405" = or i64 %".402", %".404" %".406" = zext i8 %".346" to i64 %".407" = shl i64 %".406", 32 %".408" = or i64 %".405", %".407" %".409" = zext i8 %".352" to i64 %".410" = shl i64 %".409", 40 %".411" = or i64 %".408", %".410" %".412" = zext i8 %".358" to i64 %".413" = shl i64 %".412", 48 %".414" = or i64 %".411", %".413" %".415" = zext i8 %".364" to i64 %".416" = shl i64 %".415", 56 %".417" = or i64 %".414", %".416" %".418" = zext i8 2 to i64 %".419" = and i64 %".418", 63 %".420" = lshr i64 %".417", %".419" %".421" = and i64 %".420", 7 %".422" = or i64 %".421", 1 %".423" = trunc i64 %".422" to i32 %".424" = zext i32 %".423" to i64 %".425" = trunc i64 %".424" to i8 %".426" = zext i8 %".425" to i64 %".427" = and i64 %".426", 63 %".428" = shl i64 %".395", %".427" %".429" = or i64 %".390", %".232" %".430" = add i64 %".428", %".429" br label %".3.endif.endif.endif.endif.endif" .3.endif.endif.endif.endif.else: %".432" = zext i8 5 to i64 %".433" = and i64 %".432", 63 %".434" = lshr i64 %"SymVar_0", %".433" %".435" = sext i64 %".434" to i128 %".436" = sub i64 %"SymVar_0", 275339905 %".437" = xor i64 %".434", 810798164723513605 %".438" = add i64 %".436", %".437" %".439" = add i64 %".434", %".438" %".440" = add i64 %"SymVar_0", %".439" %".441" = sext i64 %".440" to i128 %".442" = mul i128 %".435", %".441" %".443" = trunc i128 %".442" to i64 %".444" = and i64 %".443", 7 %".445" = zext i8 2 to i64 %".446" = and i64 %".445", 63 %".447" = shl i64 %".444", %".446" %".448" = or i64 %".434", %".447" %".449" = sext i64 1015975030 to i128 %".450" = sext i64 %".434" to i128 %".451" = mul i128 %".449", %".450" %".452" = trunc i128 %".451" to i64 %".453" = and i64 %".452", 7 %".454" = or i64 %".453", 1 %".455" = trunc i64 %".454" to i32 %".456" = zext i32 %".455" to i64 %".457" = trunc i64 %".456" to i8 %".458" = zext i8 %".457" to i64 %".459" = and i64 %".458", 63 %".460" = lshr i64 %"SymVar_0", %".459" %".461" = zext i8 4 to i64 %".462" = and i64 %".461", 63 %".463" = lshr i64 %".438", %".462" %".464" = and i64 %".463", 15 %".465" = or i64 %".464", 1 %".466" = trunc i64 %".465" to i32 %".467" = zext i32 %".466" to i64 %".468" = trunc i64 %".467" to i8 %".469" = zext i8 %".468" to i64 %".470" = and i64 %".469", 63 %".471" = shl i64 %".460", %".470" %".472" = zext i8 4 to i64 %".473" = and i64 %".472", 63 %".474" = lshr i64 %".438", %".473" %".475" = and i64 %".474", 15 %".476" = or i64 %".475", 1 %".477" = sub i64 64, %".476" %".478" = trunc i64 %".477" to i32 %".479" = zext i32 %".478" to i64 %".480" = trunc i64 %".479" to i8 %".481" = zext i8 %".480" to i64 %".482" = and i64 %".481", 63 %".483" = lshr i64 %".460", %".482" %".484" = or i64 %".471", %".483" %".485" = and i64 %".484", 15 %".486" = zext i8 3 to i64 %".487" = and i64 %".486", 63 %".488" = shl i64 %".485", %".487" %".489" = or i64 %".438", %".488" %".490" = and i64 %".489", 31 %".491" = zext i8 4 to i64 %".492" = and i64 %".491", 63 %".493" = shl i64 %".490", %".492" %".494" = or i64 %".448", %".493" %".495" = trunc i64 %".489" to i8 %".496" = zext i8 %".495" to i32 %".497" = lshr i64 %".489", 8 %".498" = trunc i64 %".497" to i8 %".499" = zext i8 %".498" to i32 %".500" = shl i32 %".499", 8 %".501" = or i32 %".496", %".500" %".502" = lshr i64 %".489", 16 %".503" = trunc i64 %".502" to i8 %".504" = zext i8 %".503" to i32 %".505" = shl i32 %".504", 16 %".506" = or i32 %".501", %".505" %".507" = lshr i64 %".489", 24 %".508" = trunc i64 %".507" to i8 %".509" = zext i8 %".508" to i32 %".510" = shl i32 %".509", 24 %".511" = or i32 %".506", %".510" %".512" = zext i32 %".511" to i64 %".513" = trunc i64 %".512" to i32 %".514" = zext i32 %".513" to i64 %".515" = trunc i64 %".514" to i32 %".516" = zext i32 %".515" to i64 %".517" = trunc i64 %".516" to i32 %".518" = zext i32 %".517" to i64 %".519" = trunc i64 %".518" to i32 %".520" = zext i32 %".519" to i64 %".521" = trunc i64 %".520" to i32 %".522" = zext i32 %".521" to i64 %".523" = trunc i64 %".522" to i32 %".524" = zext i32 %".523" to i64 %".525" = trunc i64 %".524" to i32 %".526" = zext i32 %".525" to i64 %".527" = trunc i64 %".526" to i32 %".528" = trunc i32 %".527" to i8 %".529" = zext i8 %".528" to i64 %".530" = trunc i64 %".526" to i32 %".531" = lshr i32 %".530", 8 %".532" = trunc i32 %".531" to i8 %".533" = zext i8 %".532" to i64 %".534" = shl i64 %".533", 8 %".535" = or i64 %".529", %".534" %".536" = trunc i64 %".526" to i32 %".537" = lshr i32 %".536", 16 %".538" = trunc i32 %".537" to i8 %".539" = zext i8 %".538" to i64 %".540" = shl i64 %".539", 16 %".541" = or i64 %".535", %".540" %".542" = trunc i64 %".526" to i32 %".543" = lshr i32 %".542", 24 %".544" = trunc i32 %".543" to i8 %".545" = zext i8 %".544" to i64 %".546" = shl i64 %".545", 24 %".547" = or i64 %".541", %".546" %".548" = lshr i64 %".489", 32 %".549" = trunc i64 %".548" to i8 %".550" = zext i8 %".549" to i32 %".551" = lshr i64 %".489", 40 %".552" = trunc i64 %".551" to i8 %".553" = zext i8 %".552" to i32 %".554" = shl i32 %".553", 8 %".555" = or i32 %".550", %".554" %".556" = lshr i64 %".489", 48 %".557" = trunc i64 %".556" to i8 %".558" = zext i8 %".557" to i32 %".559" = shl i32 %".558", 16 %".560" = or i32 %".555", %".559" %".561" = lshr i64 %".489", 56 %".562" = trunc i64 %".561" to i8 %".563" = zext i8 %".562" to i32 %".564" = shl i32 %".563", 24 %".565" = or i32 %".560", %".564" %".566" = zext i32 %".565" to i64 %".567" = trunc i64 %".566" to i32 %".568" = zext i32 %".567" to i64 %".569" = trunc i64 %".568" to i32 %".570" = zext i32 %".569" to i64 %".571" = trunc i64 %".570" to i32 %".572" = zext i32 %".571" to i64 %".573" = trunc i64 %".572" to i32 %".574" = trunc i32 %".573" to i8 %".575" = zext i8 %".574" to i64 %".576" = shl i64 %".575", 32 %".577" = or i64 %".547", %".576" %".578" = trunc i64 %".572" to i32 %".579" = lshr i32 %".578", 8 %".580" = trunc i32 %".579" to i8 %".581" = zext i8 %".580" to i64 %".582" = shl i64 %".581", 40 %".583" = or i64 %".577", %".582" %".584" = trunc i64 %".572" to i32 %".585" = lshr i32 %".584", 16 %".586" = trunc i32 %".585" to i8 %".587" = zext i8 %".586" to i64 %".588" = shl i64 %".587", 48 %".589" = or i64 %".583", %".588" %".590" = trunc i64 %".572" to i32 %".591" = lshr i32 %".590", 24 %".592" = trunc i32 %".591" to i8 %".593" = zext i8 %".592" to i64 %".594" = shl i64 %".593", 56 %".595" = or i64 %".589", %".594" %".596" = sub i64 %".595", %".494" %".597" = and i64 %".596", 63 %".598" = zext i8 4 to i64 %".599" = and i64 %".598", 63 %".600" = shl i64 %".597", %".599" %".601" = or i64 %".494", %".600" %".602" = zext i8 %".528" to i64 %".603" = zext i8 %".532" to i64 %".604" = shl i64 %".603", 8 %".605" = or i64 %".602", %".604" %".606" = zext i8 %".538" to i64 %".607" = shl i64 %".606", 16 %".608" = or i64 %".605", %".607" %".609" = zext i8 %".544" to i64 %".610" = shl i64 %".609", 24 %".611" = or i64 %".608", %".610" %".612" = zext i8 %".574" to i64 %".613" = shl i64 %".612", 32 %".614" = or i64 %".611", %".613" %".615" = zext i8 %".580" to i64 %".616" = shl i64 %".615", 40 %".617" = or i64 %".614", %".616" %".618" = zext i8 %".586" to i64 %".619" = shl i64 %".618", 48 %".620" = or i64 %".617", %".619" %".621" = zext i8 %".592" to i64 %".622" = shl i64 %".621", 56 %".623" = or i64 %".620", %".622" %".624" = zext i8 2 to i64 %".625" = and i64 %".624", 63 %".626" = lshr i64 %".623", %".625" %".627" = and i64 %".626", 7 %".628" = or i64 %".627", 1 %".629" = trunc i64 %".628" to i32 %".630" = zext i32 %".629" to i64 %".631" = trunc i64 %".630" to i8 %".632" = zext i8 %".631" to i64 %".633" = and i64 %".632", 63 %".634" = shl i64 %".601", %".633" %".635" = sub i64 %".448", %".440" %".636" = and i64 %".635", 31 %".637" = zext i8 3 to i64 %".638" = and i64 %".637", 63 %".639" = shl i64 %".636", %".638" %".640" = or i64 %".460", %".639" %".641" = or i64 %".596", %".640" %".642" = add i64 %".634", %".641" br label %".3.endif.endif.endif.endif.endif" .3.endif.endif.endif.endif.endif: %".644" = phi i64 [%".430", %".3.endif.endif.endif.endif.if"], [%".642", %".3.endif.endif.endif.endif.else"] ret i64 %".644" }
{ "pile_set_name": "Github" }
using System; using SLua; using System.Collections.Generic; [UnityEngine.Scripting.Preserve] public class Lua_Unity_Jobs_IJob : LuaObject { [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int Execute(IntPtr l) { try { Unity.Jobs.IJob self=(Unity.Jobs.IJob)checkSelf(l); self.Execute(); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } } [UnityEngine.Scripting.Preserve] static public void reg(IntPtr l) { getTypeTable(l,"Unity.Jobs.IJob"); addMember(l,Execute); createTypeMetatable(l,null, typeof(Unity.Jobs.IJob)); } }
{ "pile_set_name": "Github" }
// ============================================================================= // === spqr_rmap =============================================================== // ============================================================================= // R is squeezed, find the mapping that permutes it to trapezoidal form // Rmap is a permutation that converts R from squeezed to upper trapezoidal. // If R is already in upper triangular form, then Rmap is NULL (an implicit // identity; Rmap [0:n-1] = 0:n-1), and this function is not used. // If R is rank deficient, Rmap [j] = k if column j of the squeezed R is the // kth column in the trapezoidal R. If j is a live column then // k = Rmap [j] < QR->rank; otherwise k = Rmap [j] > QR->rank. RmapInv is // the inverse of Rmap. // Example: Suppose R has the following format: // // 0 1 2 3 4 5 6 // X x x x x x x // . X x x x x x // . . . X x x x // . . . . . X x // . . . . . . X // // Then Rmap is [0 1 5 2 6 3 4] and RmapInv is [0 1 3 5 6 2 4]. The rank of R // is 5, and thus columns 2 and 4 (with Rmap [2] = 5 and Rmap [4] = 6) are both // dead. #include "spqr.hpp" template <typename Entry> int spqr_rmap ( SuiteSparseQR_factorization <Entry> *QR, cholmod_common *cc ) { Long n, j, i, p, n1rows, n1cols ; Long *Rmap, *RmapInv, *R1p, *R1j ; n = QR->nacols ; Rmap = QR->Rmap ; RmapInv = QR->RmapInv ; if (Rmap == NULL) { ASSERT (RmapInv == NULL) ; QR->Rmap = Rmap = (Long *) cholmod_l_malloc (n, sizeof(Long), cc); QR->RmapInv = RmapInv = (Long *) cholmod_l_malloc (n, sizeof(Long), cc); if (cc->status < CHOLMOD_OK) { // out of memory return (FALSE) ; } } for (j = 0 ; j < n ; j++) { Rmap [j] = EMPTY ; } R1p = QR->R1p ; R1j = QR->R1j ; n1rows = QR->n1rows ; n1cols = QR->n1cols ; // find the mapping for the singleton rows for (i = 0 ; i < n1rows ; i++) { // The ith row of R is a singleton row; find its corresponding // pivotal column. p = R1p [i] ; ASSERT (R1p [i] < R1p [i+1]) ; j = R1j [p] ; ASSERT (j >= 0 && j < n1cols) ; Rmap [j] = i ; } // find the mapping for the pivotal rows of the multifrontal R char *Rdead = QR->QRnum->Rdead ; for (j = n1cols ; j < n ; j++) { if (!Rdead [j-n1cols]) { Rmap [j] = i++ ; } } ASSERT (i == QR->rank) ; // finish the mapping with the dead columns of R, both in the singleton // part of R and the multifrontal part of R for (j = 0 ; j < n ; j++) { if (Rmap [j] == EMPTY) { Rmap [j] = i++ ; } PR (("Rmap [%ld] = %ld (%d), rank = %ld\n", j, Rmap [j], Rmap [j] >= QR->rank, QR->rank)) ; } ASSERT (i == n) ; // construct the inverse of Rmap for (j = 0 ; j < n ; j++) { i = Rmap [j] ; RmapInv [i] = j ; } return (TRUE) ; } template int spqr_rmap <double> ( SuiteSparseQR_factorization <double> *QR, cholmod_common *cc ) ; template int spqr_rmap <Complex> ( SuiteSparseQR_factorization <Complex> *QR, cholmod_common *cc ) ;
{ "pile_set_name": "Github" }
define(['knockout'], function (ko) { var debug = false; function Period(data) { var self = this; data = data || {}; self.StartDate = ko.observable(data.StartDate === 0 ? 0 : data.StartDate || null); self.EndDate = ko.observable(data.EndDate === 0 ? 0 : data.EndDate || null); } Period.prototype.toJSON = function () { return { StartDate : this.StartDate instanceof Date ? (this.StartDate.toISOString().slice(0,10)) : this.StartDate, EndDate: this.EndDate instanceof Date ? (this.EndDate.toISOString().slice(0,10)) : this.EndDate } } return Period; });
{ "pile_set_name": "Github" }
/* pngpread.c - read a png file in push mode * * Last changed in libpng 1.6.0 [February 14, 2013] * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ #include "pngpriv.h" #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Push model modes */ #define PNG_READ_SIG_MODE 0 #define PNG_READ_CHUNK_MODE 1 #define PNG_READ_IDAT_MODE 2 #define PNG_SKIP_MODE 3 #define PNG_READ_tEXt_MODE 4 #define PNG_READ_zTXt_MODE 5 #define PNG_READ_DONE_MODE 6 #define PNG_READ_iTXt_MODE 7 #define PNG_ERROR_MODE 8 void PNGAPI png_process_data(png_structrp png_ptr, png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size) { if (png_ptr == NULL || info_ptr == NULL) return; png_push_restore_buffer(png_ptr, buffer, buffer_size); while (png_ptr->buffer_size) { png_process_some_data(png_ptr, info_ptr); } } png_size_t PNGAPI png_process_data_pause(png_structrp png_ptr, int save) { if (png_ptr != NULL) { /* It's easiest for the caller if we do the save, then the caller doesn't * have to supply the same data again: */ if (save) png_push_save_buffer(png_ptr); else { /* This includes any pending saved bytes: */ png_size_t remaining = png_ptr->buffer_size; png_ptr->buffer_size = 0; /* So subtract the saved buffer size, unless all the data * is actually 'saved', in which case we just return 0 */ if (png_ptr->save_buffer_size < remaining) return remaining - png_ptr->save_buffer_size; } } return 0; } png_uint_32 PNGAPI png_process_data_skip(png_structrp png_ptr) { png_uint_32 remaining = 0; if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE && png_ptr->skip_length > 0) { /* At the end of png_process_data the buffer size must be 0 (see the loop * above) so we can detect a broken call here: */ if (png_ptr->buffer_size != 0) png_error(png_ptr, "png_process_data_skip called inside png_process_data"); /* If is impossible for there to be a saved buffer at this point - * otherwise we could not be in SKIP mode. This will also happen if * png_process_skip is called inside png_process_data (but only very * rarely.) */ if (png_ptr->save_buffer_size != 0) png_error(png_ptr, "png_process_data_skip called with saved data"); remaining = png_ptr->skip_length; png_ptr->skip_length = 0; png_ptr->process_mode = PNG_READ_CHUNK_MODE; } return remaining; } /* What we do with the incoming data depends on what we were previously * doing before we ran out of data... */ void /* PRIVATE */ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr) { if (png_ptr == NULL) return; switch (png_ptr->process_mode) { case PNG_READ_SIG_MODE: { png_push_read_sig(png_ptr, info_ptr); break; } case PNG_READ_CHUNK_MODE: { png_push_read_chunk(png_ptr, info_ptr); break; } case PNG_READ_IDAT_MODE: { png_push_read_IDAT(png_ptr); break; } case PNG_SKIP_MODE: { png_push_crc_finish(png_ptr); break; } default: { png_ptr->buffer_size = 0; break; } } } /* Read any remaining signature bytes from the stream and compare them with * the correct PNG signature. It is possible that this routine is called * with bytes already read from the signature, either because they have been * checked by the calling application, or because of multiple calls to this * routine. */ void /* PRIVATE */ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr) { png_size_t num_checked = png_ptr->sig_bytes, num_to_check = 8 - num_checked; if (png_ptr->buffer_size < num_to_check) { num_to_check = png_ptr->buffer_size; } png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]), num_to_check); png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check); if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) { if (num_checked < 4 && png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) png_error(png_ptr, "Not a PNG file"); else png_error(png_ptr, "PNG file corrupted by ASCII conversion"); } else { if (png_ptr->sig_bytes >= 8) { png_ptr->process_mode = PNG_READ_CHUNK_MODE; } } } void /* PRIVATE */ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) { png_uint_32 chunk_name; #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED int keep; /* unknown handling method */ #endif /* First we make sure we have enough data for the 4 byte chunk name * and the 4 byte chunk length before proceeding with decoding the * chunk data. To fully decode each of these chunks, we also make * sure we have enough data in the buffer for the 4 byte CRC at the * end of every chunk (except IDAT, which is handled separately). */ if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) { png_byte chunk_length[4]; png_byte chunk_tag[4]; if (png_ptr->buffer_size < 8) { png_push_save_buffer(png_ptr); return; } png_push_fill_buffer(png_ptr, chunk_length, 4); png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); png_reset_crc(png_ptr); png_crc_read(png_ptr, chunk_tag, 4); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_check_chunk_name(png_ptr, png_ptr->chunk_name); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; } chunk_name = png_ptr->chunk_name; if (chunk_name == png_IDAT) { if (png_ptr->mode & PNG_AFTER_IDAT) png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; /* If we reach an IDAT chunk, this means we have read all of the * header chunks, and we can start reading the image (or if this * is called after the image has been read - we have an error). */ if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before IDAT"); else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && !(png_ptr->mode & PNG_HAVE_PLTE)) png_error(png_ptr, "Missing PLTE before IDAT"); png_ptr->mode |= PNG_HAVE_IDAT; if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) if (png_ptr->push_length == 0) return; if (png_ptr->mode & PNG_AFTER_IDAT) png_benign_error(png_ptr, "Too many IDATs found"); } if (chunk_name == png_IHDR) { if (png_ptr->push_length != 13) png_error(png_ptr, "Invalid IHDR length"); if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); } else if (chunk_name == png_IEND) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); png_ptr->process_mode = PNG_READ_DONE_MODE; png_push_have_end(png_ptr, info_ptr); } #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep); if (chunk_name == png_PLTE) png_ptr->mode |= PNG_HAVE_PLTE; } #endif else if (chunk_name == png_PLTE) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); } else if (chunk_name == png_IDAT) { png_ptr->idat_size = png_ptr->push_length; png_ptr->process_mode = PNG_READ_IDAT_MODE; png_push_have_info(png_ptr, info_ptr); png_ptr->zstream.avail_out = (uInt) PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1; png_ptr->zstream.next_out = png_ptr->row_buf; return; } #ifdef PNG_READ_gAMA_SUPPORTED else if (png_ptr->chunk_name == png_gAMA) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_sBIT_SUPPORTED else if (png_ptr->chunk_name == png_sBIT) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_cHRM_SUPPORTED else if (png_ptr->chunk_name == png_cHRM) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_sRGB_SUPPORTED else if (chunk_name == png_sRGB) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_iCCP_SUPPORTED else if (png_ptr->chunk_name == png_iCCP) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_sPLT_SUPPORTED else if (chunk_name == png_sPLT) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_tRNS_SUPPORTED else if (chunk_name == png_tRNS) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_bKGD_SUPPORTED else if (chunk_name == png_bKGD) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_hIST_SUPPORTED else if (chunk_name == png_hIST) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_pHYs_SUPPORTED else if (chunk_name == png_pHYs) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_oFFs_SUPPORTED else if (chunk_name == png_oFFs) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_pCAL_SUPPORTED else if (chunk_name == png_pCAL) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_sCAL_SUPPORTED else if (chunk_name == png_sCAL) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_tIME_SUPPORTED else if (chunk_name == png_tIME) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_tEXt_SUPPORTED else if (chunk_name == png_tEXt) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_zTXt_SUPPORTED else if (chunk_name == png_zTXt) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); } #endif #ifdef PNG_READ_iTXt_SUPPORTED else if (chunk_name == png_iTXt) { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); } #endif else { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { png_push_save_buffer(png_ptr); return; } png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, PNG_HANDLE_CHUNK_AS_DEFAULT); } png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; } void /* PRIVATE */ png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip) { png_ptr->process_mode = PNG_SKIP_MODE; png_ptr->skip_length = skip; } void /* PRIVATE */ png_push_crc_finish(png_structrp png_ptr) { if (png_ptr->skip_length && png_ptr->save_buffer_size) { png_size_t save_size = png_ptr->save_buffer_size; png_uint_32 skip_length = png_ptr->skip_length; /* We want the smaller of 'skip_length' and 'save_buffer_size', but * they are of different types and we don't know which variable has the * fewest bits. Carefully select the smaller and cast it to the type of * the larger - this cannot overflow. Do not cast in the following test * - it will break on either 16 or 64 bit platforms. */ if (skip_length < save_size) save_size = (png_size_t)skip_length; else skip_length = (png_uint_32)save_size; png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); png_ptr->skip_length -= skip_length; png_ptr->buffer_size -= save_size; png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_ptr += save_size; } if (png_ptr->skip_length && png_ptr->current_buffer_size) { png_size_t save_size = png_ptr->current_buffer_size; png_uint_32 skip_length = png_ptr->skip_length; /* We want the smaller of 'skip_length' and 'current_buffer_size', here, * the same problem exists as above and the same solution. */ if (skip_length < save_size) save_size = (png_size_t)skip_length; else skip_length = (png_uint_32)save_size; png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); png_ptr->skip_length -= skip_length; png_ptr->buffer_size -= save_size; png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_ptr += save_size; } if (!png_ptr->skip_length) { if (png_ptr->buffer_size < 4) { png_push_save_buffer(png_ptr); return; } png_crc_finish(png_ptr, 0); png_ptr->process_mode = PNG_READ_CHUNK_MODE; } } void PNGCBAPI png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) { png_bytep ptr; if (png_ptr == NULL) return; ptr = buffer; if (png_ptr->save_buffer_size) { png_size_t save_size; if (length < png_ptr->save_buffer_size) save_size = length; else save_size = png_ptr->save_buffer_size; memcpy(ptr, png_ptr->save_buffer_ptr, save_size); length -= save_size; ptr += save_size; png_ptr->buffer_size -= save_size; png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_ptr += save_size; } if (length && png_ptr->current_buffer_size) { png_size_t save_size; if (length < png_ptr->current_buffer_size) save_size = length; else save_size = png_ptr->current_buffer_size; memcpy(ptr, png_ptr->current_buffer_ptr, save_size); png_ptr->buffer_size -= save_size; png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_ptr += save_size; } } void /* PRIVATE */ png_push_save_buffer(png_structrp png_ptr) { if (png_ptr->save_buffer_size) { if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) { png_size_t i, istop; png_bytep sp; png_bytep dp; istop = png_ptr->save_buffer_size; for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; i < istop; i++, sp++, dp++) { *dp = *sp; } } } if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > png_ptr->save_buffer_max) { png_size_t new_max; png_bytep old_buffer; if (png_ptr->save_buffer_size > PNG_SIZE_MAX - (png_ptr->current_buffer_size + 256)) { png_error(png_ptr, "Potential overflow of save_buffer"); } new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; old_buffer = png_ptr->save_buffer; png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr, (png_size_t)new_max); if (png_ptr->save_buffer == NULL) { png_free(png_ptr, old_buffer); png_error(png_ptr, "Insufficient memory for save_buffer"); } memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); png_free(png_ptr, old_buffer); png_ptr->save_buffer_max = new_max; } if (png_ptr->current_buffer_size) { memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size, png_ptr->current_buffer_ptr, png_ptr->current_buffer_size); png_ptr->save_buffer_size += png_ptr->current_buffer_size; png_ptr->current_buffer_size = 0; } png_ptr->save_buffer_ptr = png_ptr->save_buffer; png_ptr->buffer_size = 0; } void /* PRIVATE */ png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer, png_size_t buffer_length) { png_ptr->current_buffer = buffer; png_ptr->current_buffer_size = buffer_length; png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; png_ptr->current_buffer_ptr = png_ptr->current_buffer; } void /* PRIVATE */ png_push_read_IDAT(png_structrp png_ptr) { if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) { png_byte chunk_length[4]; png_byte chunk_tag[4]; /* TODO: this code can be commoned up with the same code in push_read */ if (png_ptr->buffer_size < 8) { png_push_save_buffer(png_ptr); return; } png_push_fill_buffer(png_ptr, chunk_length, 4); png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); png_reset_crc(png_ptr); png_crc_read(png_ptr, chunk_tag, 4); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; if (png_ptr->chunk_name != png_IDAT) { png_ptr->process_mode = PNG_READ_CHUNK_MODE; if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)) png_error(png_ptr, "Not enough compressed data"); return; } png_ptr->idat_size = png_ptr->push_length; } if (png_ptr->idat_size && png_ptr->save_buffer_size) { png_size_t save_size = png_ptr->save_buffer_size; png_uint_32 idat_size = png_ptr->idat_size; /* We want the smaller of 'idat_size' and 'current_buffer_size', but they * are of different types and we don't know which variable has the fewest * bits. Carefully select the smaller and cast it to the type of the * larger - this cannot overflow. Do not cast in the following test - it * will break on either 16 or 64 bit platforms. */ if (idat_size < save_size) save_size = (png_size_t)idat_size; else idat_size = (png_uint_32)save_size; png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size); png_ptr->idat_size -= idat_size; png_ptr->buffer_size -= save_size; png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_ptr += save_size; } if (png_ptr->idat_size && png_ptr->current_buffer_size) { png_size_t save_size = png_ptr->current_buffer_size; png_uint_32 idat_size = png_ptr->idat_size; /* We want the smaller of 'idat_size' and 'current_buffer_size', but they * are of different types and we don't know which variable has the fewest * bits. Carefully select the smaller and cast it to the type of the * larger - this cannot overflow. */ if (idat_size < save_size) save_size = (png_size_t)idat_size; else idat_size = (png_uint_32)save_size; png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size); png_ptr->idat_size -= idat_size; png_ptr->buffer_size -= save_size; png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_ptr += save_size; } if (!png_ptr->idat_size) { if (png_ptr->buffer_size < 4) { png_push_save_buffer(png_ptr); return; } png_crc_finish(png_ptr, 0); png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->zowner = 0; } } void /* PRIVATE */ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, png_size_t buffer_length) { /* The caller checks for a non-zero buffer length. */ if (!(buffer_length > 0) || buffer == NULL) png_error(png_ptr, "No IDAT data (internal error)"); /* This routine must process all the data it has been given * before returning, calling the row callback as required to * handle the uncompressed results. */ png_ptr->zstream.next_in = buffer; /* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */ png_ptr->zstream.avail_in = (uInt)buffer_length; /* Keep going until the decompressed data is all processed * or the stream marked as finished. */ while (png_ptr->zstream.avail_in > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)) { int ret; /* We have data for zlib, but we must check that zlib * has someplace to put the results. It doesn't matter * if we don't expect any results -- it may be the input * data is just the LZ end code. */ if (!(png_ptr->zstream.avail_out > 0)) { /* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */ png_ptr->zstream.avail_out = (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); png_ptr->zstream.next_out = png_ptr->row_buf; } /* Using Z_SYNC_FLUSH here means that an unterminated * LZ stream (a stream with a missing end code) can still * be handled, otherwise (Z_NO_FLUSH) a future zlib * implementation might defer output and therefore * change the current behavior (see comments in inflate.c * for why this doesn't happen at present with zlib 1.2.5). */ ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH); /* Check for any failure before proceeding. */ if (ret != Z_OK && ret != Z_STREAM_END) { /* Terminate the decompression. */ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; png_ptr->zowner = 0; /* This may be a truncated stream (missing or * damaged end code). Treat that as a warning. */ if (png_ptr->row_number >= png_ptr->num_rows || png_ptr->pass > 6) png_warning(png_ptr, "Truncated compressed data in IDAT"); else png_error(png_ptr, "Decompression error in IDAT"); /* Skip the check on unprocessed input */ return; } /* Did inflate output any data? */ if (png_ptr->zstream.next_out != png_ptr->row_buf) { /* Is this unexpected data after the last row? * If it is, artificially terminate the LZ output * here. */ if (png_ptr->row_number >= png_ptr->num_rows || png_ptr->pass > 6) { /* Extra data. */ png_warning(png_ptr, "Extra compressed data in IDAT"); png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; png_ptr->zowner = 0; /* Do no more processing; skip the unprocessed * input check below. */ return; } /* Do we have a complete row? */ if (png_ptr->zstream.avail_out == 0) png_push_process_row(png_ptr); } /* And check for the end of the stream. */ if (ret == Z_STREAM_END) png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; } /* All the data should have been processed, if anything * is left at this point we have bytes of IDAT data * after the zlib end code. */ if (png_ptr->zstream.avail_in > 0) png_warning(png_ptr, "Extra compression data in IDAT"); } void /* PRIVATE */ png_push_process_row(png_structrp png_ptr) { /* 1.5.6: row_info moved out of png_struct to a local here. */ png_row_info row_info; row_info.width = png_ptr->iwidth; /* NOTE: width of current interlaced row */ row_info.color_type = png_ptr->color_type; row_info.bit_depth = png_ptr->bit_depth; row_info.channels = png_ptr->channels; row_info.pixel_depth = png_ptr->pixel_depth; row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width); if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) { if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST) png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1, png_ptr->prev_row + 1, png_ptr->row_buf[0]); else png_error(png_ptr, "bad adaptive filter value"); } /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before * 1.5.6, while the buffer really is this big in current versions of libpng * it may not be in the future, so this was changed just to copy the * interlaced row count: */ memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1); #ifdef PNG_READ_TRANSFORMS_SUPPORTED if (png_ptr->transformations) png_do_read_transformations(png_ptr, &row_info); #endif /* The transformed pixel depth should match the depth now in row_info. */ if (png_ptr->transformed_pixel_depth == 0) { png_ptr->transformed_pixel_depth = row_info.pixel_depth; if (row_info.pixel_depth > png_ptr->maximum_pixel_depth) png_error(png_ptr, "progressive row overflow"); } else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth) png_error(png_ptr, "internal progressive row size calculation error"); #ifdef PNG_READ_INTERLACING_SUPPORTED /* Blow up interlaced rows to full size */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { if (png_ptr->pass < 6) png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); switch (png_ptr->pass) { case 0: { int i; for (i = 0; i < 8 && png_ptr->pass == 0; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */ } if (png_ptr->pass == 2) /* Pass 1 might be empty */ { for (i = 0; i < 4 && png_ptr->pass == 2; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } } if (png_ptr->pass == 4 && png_ptr->height <= 4) { for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } } if (png_ptr->pass == 6 && png_ptr->height <= 4) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } break; } case 1: { int i; for (i = 0; i < 8 && png_ptr->pass == 1; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } if (png_ptr->pass == 2) /* Skip top 4 generated rows */ { for (i = 0; i < 4 && png_ptr->pass == 2; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } } break; } case 2: { int i; for (i = 0; i < 4 && png_ptr->pass == 2; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } for (i = 0; i < 4 && png_ptr->pass == 2; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } if (png_ptr->pass == 4) /* Pass 3 might be empty */ { for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } } break; } case 3: { int i; for (i = 0; i < 4 && png_ptr->pass == 3; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } if (png_ptr->pass == 4) /* Skip top two generated rows */ { for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } } break; } case 4: { int i; for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } if (png_ptr->pass == 6) /* Pass 5 might be empty */ { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } break; } case 5: { int i; for (i = 0; i < 2 && png_ptr->pass == 5; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } if (png_ptr->pass == 6) /* Skip top generated row */ { png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } break; } default: case 6: { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); if (png_ptr->pass != 6) break; png_push_have_row(png_ptr, NULL); png_read_push_finish_row(png_ptr); } } } else #endif { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } } void /* PRIVATE */ png_read_push_finish_row(png_structrp png_ptr) { #ifdef PNG_READ_INTERLACING_SUPPORTED /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ #endif png_ptr->row_number++; if (png_ptr->row_number < png_ptr->num_rows) return; #ifdef PNG_READ_INTERLACING_SUPPORTED if (png_ptr->interlaced) { png_ptr->row_number = 0; memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1); do { png_ptr->pass++; if ((png_ptr->pass == 1 && png_ptr->width < 5) || (png_ptr->pass == 3 && png_ptr->width < 3) || (png_ptr->pass == 5 && png_ptr->width < 2)) png_ptr->pass++; if (png_ptr->pass > 7) png_ptr->pass--; if (png_ptr->pass >= 7) break; png_ptr->iwidth = (png_ptr->width + png_pass_inc[png_ptr->pass] - 1 - png_pass_start[png_ptr->pass]) / png_pass_inc[png_ptr->pass]; if (png_ptr->transformations & PNG_INTERLACE) break; png_ptr->num_rows = (png_ptr->height + png_pass_yinc[png_ptr->pass] - 1 - png_pass_ystart[png_ptr->pass]) / png_pass_yinc[png_ptr->pass]; } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } #endif /* PNG_READ_INTERLACING_SUPPORTED */ } void /* PRIVATE */ png_push_have_info(png_structrp png_ptr, png_inforp info_ptr) { if (png_ptr->info_fn != NULL) (*(png_ptr->info_fn))(png_ptr, info_ptr); } void /* PRIVATE */ png_push_have_end(png_structrp png_ptr, png_inforp info_ptr) { if (png_ptr->end_fn != NULL) (*(png_ptr->end_fn))(png_ptr, info_ptr); } void /* PRIVATE */ png_push_have_row(png_structrp png_ptr, png_bytep row) { if (png_ptr->row_fn != NULL) (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, (int)png_ptr->pass); } #ifdef PNG_READ_INTERLACING_SUPPORTED void PNGAPI png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, png_const_bytep new_row) { if (png_ptr == NULL) return; /* new_row is a flag here - if it is NULL then the app callback was called * from an empty row (see the calls to png_struct::row_fn below), otherwise * it must be png_ptr->row_buf+1 */ if (new_row != NULL) png_combine_row(png_ptr, old_row, 1/*display*/); } #endif /* PNG_READ_INTERLACING_SUPPORTED */ void PNGAPI png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn) { if (png_ptr == NULL) return; png_ptr->info_fn = info_fn; png_ptr->row_fn = row_fn; png_ptr->end_fn = end_fn; png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); } png_voidp PNGAPI png_get_progressive_ptr(png_const_structrp png_ptr) { if (png_ptr == NULL) return (NULL); return png_ptr->io_ptr; } #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
{ "pile_set_name": "Github" }
/* * Copyright (c) 2014 Tim Walker <tdskywalker@gmail.com> * * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVUTIL_DOWNMIX_INFO_H #define AVUTIL_DOWNMIX_INFO_H #include "frame.h" /** * @file * audio downmix medatata */ /** * @addtogroup lavu_audio * @{ */ /** * @defgroup downmix_info Audio downmix metadata * @{ */ /** * Possible downmix types. */ enum AVDownmixType { AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ }; /** * This structure describes optional metadata relevant to a downmix procedure. * * All fields are set by the decoder to the value indicated in the audio * bitstream (if present), or to a "sane" default otherwise. */ typedef struct AVDownmixInfo { /** * Type of downmix preferred by the mastering engineer. */ enum AVDownmixType preferred_downmix_type; /** * Absolute scale factor representing the nominal level of the center * channel during a regular downmix. */ double center_mix_level; /** * Absolute scale factor representing the nominal level of the center * channel during an Lt/Rt compatible downmix. */ double center_mix_level_ltrt; /** * Absolute scale factor representing the nominal level of the surround * channels during a regular downmix. */ double surround_mix_level; /** * Absolute scale factor representing the nominal level of the surround * channels during an Lt/Rt compatible downmix. */ double surround_mix_level_ltrt; /** * Absolute scale factor representing the level at which the LFE data is * mixed into L/R channels during downmixing. */ double lfe_mix_level; } AVDownmixInfo; /** * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. * * If the side data is absent, it is created and added to the frame. * * @param frame the frame for which the side data is to be obtained or created * * @return the AVDownmixInfo structure to be edited by the caller, or NULL if * the structure cannot be allocated. */ AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); /** * @} */ /** * @} */ #endif /* AVUTIL_DOWNMIX_INFO_H */
{ "pile_set_name": "Github" }
# # Include user definition # # TO suppress recursive includes INCLUDED = 1 ifndef TOPDIR TOPDIR = . endif ifndef NETLIB_LAPACK_DIR NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-3.4.1 endif # Default C compiler CC = gcc ifndef MAKEFILE_RULE include $(TOPDIR)/Makefile.rule else include $(TOPDIR)/$(MAKEFILE_RULE) endif # # Beginning of system configuration # ifndef HOSTCC HOSTCC = $(CC) endif ifdef TARGET GETARCH_FLAGS := -DFORCE_$(TARGET) endif #TARGET_CORE will override TARGET which is used in DYNAMIC_ARCH=1. # ifdef TARGET_CORE GETARCH_FLAGS := -DFORCE_$(TARGET_CORE) endif ifdef INTERFACE64 GETARCH_FLAGS += -DUSE64BITINT endif ifndef GEMM_MULTITHREAD_THRESHOLD GEMM_MULTITHREAD_THRESHOLD=4 endif GETARCH_FLAGS += -DGEMM_MULTITHREAD_THRESHOLD=$(GEMM_MULTITHREAD_THRESHOLD) # This operation is expensive, so execution should be once. ifndef GOTOBLAS_MAKEFILE export GOTOBLAS_MAKEFILE = 1 # Generating Makefile.conf and config.h DUMMY := $(shell $(MAKE) -C $(TOPDIR) -f Makefile.getarch CC="$(CC)" FC="$(FC)" HOSTCC="$(HOSTCC)" CFLAGS="$(GETARCH_FLAGS)" BINARY=$(BINARY) USE_OPENMP=$(USE_OPENMP) TARGET_CORE=$(TARGET_CORE) all) ifndef TARGET_CORE include $(TOPDIR)/Makefile.conf else include $(TOPDIR)/Makefile_kernel.conf endif endif ifndef NUM_THREADS NUM_THREADS = $(NUM_CORES) endif ifeq ($(NUM_THREADS), 1) override USE_THREAD = 0 endif ifdef USE_THREAD ifeq ($(USE_THREAD), 0) SMP = else SMP = 1 endif else ifeq ($(NUM_THREAD), 1) SMP = else SMP = 1 endif endif ifndef NEED_PIC NEED_PIC = 1 endif ARFLAGS = CPP = $(COMPILER) -E AR = $(CROSS_SUFFIX)ar AS = $(CROSS_SUFFIX)as LD = $(CROSS_SUFFIX)ld RANLIB = $(CROSS_SUFFIX)ranlib NM = $(CROSS_SUFFIX)nm DLLWRAP = $(CROSS_SUFFIX)dllwrap # # OS dependent settings # ifeq ($(OSNAME), Darwin) export MACOSX_DEPLOYMENT_TARGET=10.2 MD5SUM = md5 -r endif ifeq ($(OSNAME), Linux) EXTRALIB += -lm endif ifeq ($(OSNAME), AIX) EXTRALIB += -lm endif ifeq ($(OSNAME), WINNT) NEED_PIC = 0 NO_EXPRECISION = 1 EXTRALIB += -defaultlib:advapi32 SUFFIX = obj PSUFFIX = pobj LIBSUFFIX = lib endif ifeq ($(OSNAME), Interix) NEED_PIC = 0 NO_EXPRECISION = 1 INTERIX_TOOL_DIR = /opt/gcc.3.3/i586-pc-interix3/bin endif ifeq ($(OSNAME), CYGWIN_NT) NEED_PIC = 0 NO_EXPRECISION = 1 endif ifneq ($(OSNAME), WINNT) ifneq ($(OSNAME), CYGWIN_NT) ifneq ($(OSNAME), Interix) ifdef SMP EXTRALIB += -lpthread endif endif endif endif ifdef QUAD_PRECISION CCOMMON_OPT += -DQUAD_PRECISION NO_EXPRECISION = 1 endif ifneq ($(ARCH), x86) ifneq ($(ARCH), x86_64) NO_EXPRECISION = 1 endif endif ifdef UTEST_CHECK CCOMMON_OPT += -DUTEST_CHECK SANITY_CHECK = 1 endif ifdef SANITY_CHECK CCOMMON_OPT += -DSANITY_CHECK -DREFNAME=$(*F)f$(BU) endif # # Architecture dependent settings # ifeq ($(ARCH), x86) ifndef BINARY NO_BINARY_MODE = 1 endif ifndef NO_EXPRECISION ifeq ($(F_COMPILER), GFORTRAN) ifeq ($(C_COMPILER), GCC) EXPRECISION = 1 CCOMMON_OPT += -DEXPRECISION -m128bit-long-double FCOMMON_OPT += -m128bit-long-double endif endif endif endif ifeq ($(ARCH), x86_64) ifndef NO_EXPRECISION ifeq ($(F_COMPILER), GFORTRAN) ifeq ($(C_COMPILER), GCC) EXPRECISION = 1 CCOMMON_OPT += -DEXPRECISION -m128bit-long-double FCOMMON_OPT += -m128bit-long-double endif endif endif endif ifeq ($(C_COMPILER), INTEL) CCOMMON_OPT += -wd981 endif ifeq ($(USE_OPENMP), 1) ifeq ($(C_COMPILER), GCC) CCOMMON_OPT += -fopenmp endif ifeq ($(C_COMPILER), INTEL) CCOMMON_OPT += -openmp endif ifeq ($(C_COMPILER), PGI) CCOMMON_OPT += -mp endif ifeq ($(C_COMPILER), OPEN64) CCOMMON_OPT += -mp CEXTRALIB += -lstdc++ endif ifeq ($(C_COMPILER), PATHSCALE) CCOMMON_OPT += -mp endif endif ifdef DYNAMIC_ARCH ifeq ($(ARCH), x86) DYNAMIC_CORE = KATMAI COPPERMINE NORTHWOOD PRESCOTT BANIAS \ CORE2 PENRYN DUNNINGTON NEHALEM ATHLON OPTERON OPTERON_SSE3 BARCELONA ATOM NANO endif ifeq ($(ARCH), x86_64) DYNAMIC_CORE = PRESCOTT CORE2 PENRYN DUNNINGTON NEHALEM OPTERON OPTERON_SSE3 BARCELONA ATOM NANO endif ifndef DYNAMIC_CORE DYNAMIC_ARCH = endif endif ifeq ($(ARCH), ia64) NO_BINARY_MODE = 1 BINARY_DEFINED = 1 ifeq ($(F_COMPILER), GFORTRAN) ifeq ($(C_COMPILER), GCC) # EXPRECISION = 1 # CCOMMON_OPT += -DEXPRECISION endif endif endif ifeq ($(ARCH), mips64) NO_BINARY_MODE = 1 endif ifeq ($(ARCH), alpha) NO_BINARY_MODE = 1 BINARY_DEFINED = 1 endif # # C Compiler dependent settings # ifeq ($(C_COMPILER), GCC) CCOMMON_OPT += -Wall COMMON_PROF += -fno-inline NO_UNINITIALIZED_WARN = -Wno-uninitialized ifdef NO_BINARY_MODE ifeq ($(ARCH), mips64) ifdef BINARY64 CCOMMON_OPT += -mabi=64 else CCOMMON_OPT += -mabi=n32 endif BINARY_DEFINED = 1 endif ifeq ($(CORE), LOONGSON3A) CCOMMON_OPT += -march=mips64 FCOMMON_OPT += -march=mips64 endif ifeq ($(CORE), LOONGSON3B) CCOMMON_OPT += -march=mips64 FCOMMON_OPT += -march=mips64 endif ifeq ($(OSNAME), AIX) BINARY_DEFINED = 1 endif endif ifndef BINARY_DEFINED ifdef BINARY64 CCOMMON_OPT += -m64 else CCOMMON_OPT += -m32 endif endif endif ifeq ($(C_COMPILER), PGI) ifdef BINARY64 CCOMMON_OPT += -tp p7-64 else CCOMMON_OPT += -tp p7 endif endif ifeq ($(C_COMPILER), PATHSCALE) ifdef BINARY64 CCOMMON_OPT += -m64 else CCOMMON_OPT += -m32 endif endif # # Fortran Compiler dependent settings # ifeq ($(F_COMPILER), G77) CCOMMON_OPT += -DF_INTERFACE_G77 FCOMMON_OPT += -Wall ifndef NO_BINARY_MODE ifdef BINARY64 FCOMMON_OPT += -m64 else FCOMMON_OPT += -m32 endif endif endif ifeq ($(F_COMPILER), G95) CCOMMON_OPT += -DF_INTERFACE_G95 FCOMMON_OPT += -Wall ifndef NO_BINARY_MODE ifdef BINARY64 FCOMMON_OPT += -m64 else FCOMMON_OPT += -m32 endif endif endif ifeq ($(F_COMPILER), GFORTRAN) CCOMMON_OPT += -DF_INTERFACE_GFORT FCOMMON_OPT += -Wall EXTRALIB += -lgfortran ifdef NO_BINARY_MODE ifeq ($(ARCH), mips64) ifdef BINARY64 FCOMMON_OPT += -mabi=64 else FCOMMON_OPT += -mabi=n32 endif endif else ifdef BINARY64 FCOMMON_OPT += -m64 ifdef INTERFACE64 FCOMMON_OPT += -fdefault-integer-8 endif else FCOMMON_OPT += -m32 endif endif ifdef USE_OPENMP FCOMMON_OPT += -fopenmp endif endif ifeq ($(F_COMPILER), INTEL) CCOMMON_OPT += -DF_INTERFACE_INTEL ifdef INTERFACE64 FCOMMON_OPT += -i8 endif ifdef USE_OPENMP FCOMMON_OPT += -openmp endif endif ifeq ($(F_COMPILER), FUJITSU) CCOMMON_OPT += -DF_INTERFACE_FUJITSU ifdef USE_OPENMP FCOMMON_OPT += -openmp endif endif ifeq ($(F_COMPILER), IBM) CCOMMON_OPT += -DF_INTERFACE_IBM # FCOMMON_OPT += -qarch=440 ifdef BINARY64 FCOMMON_OPT += -q64 ifdef INTERFACE64 FCOMMON_OPT += -qintsize=8 endif else FCOMMON_OPT += -q32 endif ifdef USE_OPENMP FCOMMON_OPT += -openmp endif endif ifeq ($(F_COMPILER), PGI) CCOMMON_OPT += -DF_INTERFACE_PGI COMMON_PROF += -DPGICOMPILER ifdef BINARY64 ifdef INTERFACE64 FCOMMON_OPT += -i8 endif FCOMMON_OPT += -tp p7-64 else FCOMMON_OPT += -tp p7 endif ifdef USE_OPENMP FCOMMON_OPT += -mp endif endif ifeq ($(F_COMPILER), PATHSCALE) CCOMMON_OPT += -DF_INTERFACE_PATHSCALE ifdef BINARY64 ifdef INTERFACE64 FCOMMON_OPT += -i8 endif endif ifneq ($(ARCH), mips64) ifndef BINARY64 FCOMMON_OPT += -m32 else FCOMMON_OPT += -m64 endif else ifdef BINARY64 FCOMMON_OPT += -mabi=64 else FCOMMON_OPT += -mabi=n32 endif endif ifdef USE_OPENMP FCOMMON_OPT += -mp endif endif ifeq ($(F_COMPILER), OPEN64) CCOMMON_OPT += -DF_INTERFACE_OPEN64 ifdef BINARY64 ifdef INTERFACE64 FCOMMON_OPT += -i8 endif endif ifndef BINARY64 FCOMMON_OPT += -m32 else FCOMMON_OPT += -m64 endif ifdef USE_OPENMP FEXTRALIB += -lstdc++ FCOMMON_OPT += -mp endif endif ifeq ($(C_COMPILER), OPEN64) ifndef BINARY64 CCOMMON_OPT += -m32 else CCOMMON_OPT += -m64 endif endif ifeq ($(C_COMPILER), SUN) CCOMMON_OPT += -w ifeq ($(ARCH), x86) CCOMMON_OPT += -m32 else FCOMMON_OPT += -m64 endif endif ifeq ($(F_COMPILER), SUN) CCOMMON_OPT += -DF_INTERFACE_SUN ifeq ($(ARCH), x86) FCOMMON_OPT += -m32 else FCOMMON_OPT += -m64 endif ifdef USE_OPENMP FCOMMON_OPT += -xopenmp=parallel endif endif ifeq ($(F_COMPILER), COMPAQ) CCOMMON_OPT += -DF_INTERFACE_COMPAQ ifdef USE_OPENMP FCOMMON_OPT += -openmp endif endif ifdef BINARY64 ifdef INTERFACE64 CCOMMON_OPT += #-DUSE64BITINT endif endif ifeq ($(NEED_PIC), 1) ifeq ($(C_COMPILER), IBM) CCOMMON_OPT += -qpic=large else CCOMMON_OPT += -fPIC endif ifeq ($(F_COMPILER), SUN) FCOMMON_OPT += -pic else FCOMMON_OPT += -fPIC endif endif ifeq ($(DYNAMIC_ARCH), 1) CCOMMON_OPT += -DDYNAMIC_ARCH endif ifeq ($(NO_LAPACK), 1) CCOMMON_OPT += -DNO_LAPACK #Disable LAPACK C interface NO_LAPACKE = 1 endif ifeq ($(NO_LAPACKE), 1) CCOMMON_OPT += -DNO_LAPACKE endif ifdef SMP CCOMMON_OPT += -DSMP_SERVER ifeq ($(ARCH), mips64) ifneq ($(CORE), LOONGSON3B) USE_SIMPLE_THREADED_LEVEL3 = 1 endif endif ifeq ($(USE_OPENMP), 1) # USE_SIMPLE_THREADED_LEVEL3 = 1 # NO_AFFINITY = 1 CCOMMON_OPT += -DUSE_OPENMP endif endif ifeq ($(NO_WARMUP), 1) CCOMMON_OPT += -DNO_WARMUP endif ifeq ($(CONSISTENT_FPCSR), 1) CCOMMON_OPT += -DCONSISTENT_FPCSR endif # Only for development # CCOMMON_OPT += -DPARAMTEST # CCOMMON_OPT += -DPREFETCHTEST # CCOMMON_OPT += -DNO_SWITCHING # USE_PAPI = 1 ifdef USE_PAPI CCOMMON_OPT += -DUSE_PAPI EXTRALIB += -lpapi -lperfctr endif ifdef DYNAMIC_THREADS CCOMMON_OPT += -DDYNAMIC_THREADS endif CCOMMON_OPT += -DMAX_CPU_NUMBER=$(NUM_THREADS) ifdef USE_SIMPLE_THREADED_LEVEL3 CCOMMON_OPT += -DUSE_SIMPLE_THREADED_LEVEL3 endif ifndef LIBNAMESUFFIX LIBPREFIX = libopenblas else LIBPREFIX = libopenblas_$(LIBNAMESUFFIX) endif KERNELDIR = $(TOPDIR)/kernel/$(ARCH) include $(TOPDIR)/Makefile.$(ARCH) CCOMMON_OPT += -DASMNAME=$(FU)$(*F) -DASMFNAME=$(FU)$(*F)$(BU) -DNAME=$(*F)$(BU) -DCNAME=$(*F) -DCHAR_NAME=\"$(*F)$(BU)\" -DCHAR_CNAME=\"$(*F)\" ifeq ($(CORE), PPC440) CCOMMON_OPT += -DALLOC_QALLOC endif ifeq ($(CORE), PPC440FP2) STATIC_ALLOCATION = 1 endif ifneq ($(OSNAME), Linux) NO_AFFINITY = 1 endif ifneq ($(ARCH), x86_64) ifneq ($(ARCH), x86) ifneq ($(CORE), LOONGSON3B) NO_AFFINITY = 1 endif endif endif ifdef NO_AFFINITY CCOMMON_OPT += -DNO_AFFINITY endif ifdef FUNCTION_PROFILE CCOMMON_OPT += -DFUNCTION_PROFILE endif ifdef HUGETLB_ALLOCATION CCOMMON_OPT += -DALLOC_HUGETLB endif ifdef HUGETLBFILE_ALLOCATION CCOMMON_OPT += -DALLOC_HUGETLBFILE -DHUGETLB_FILE_NAME=$(HUGETLBFILE_ALLOCATION) endif ifdef STATIC_ALLOCATION CCOMMON_OPT += -DALLOC_STATIC endif ifdef DEVICEDRIVER_ALLOCATION CCOMMON_OPT += -DALLOC_DEVICEDRIVER -DDEVICEDRIVER_NAME=\"/dev/mapper\" endif ifdef MIXED_MEMORY_ALLOCATION CCOMMON_OPT += -DMIXED_MEMORY_ALLOCATION endif ifeq ($(OSNAME), SunOS) TAR = gtar PATCH = gpatch GREP = ggrep else TAR = tar PATCH = patch GREP = grep endif ifndef MD5SUM MD5SUM = md5sum endif AWK = awk REVISION = -r$(VERSION) MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION))) CFLAGS = $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) PFLAGS = $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) -DPROFILE $(COMMON_PROF) FFLAGS = $(COMMON_OPT) $(FCOMMON_OPT) FPFLAGS = $(COMMON_OPT) $(FCOMMON_OPT) $(COMMON_PROF) ifndef SUFFIX SUFFIX = o endif ifndef PSUFFIX PSUFFIX = po endif ifndef LIBSUFFIX LIBSUFFIX = a endif ifndef DYNAMIC_ARCH ifndef SMP LIBNAME = $(LIBPREFIX)_$(LIBCORE)$(REVISION).$(LIBSUFFIX) LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)$(REVISION)_p.$(LIBSUFFIX) else LIBNAME = $(LIBPREFIX)_$(LIBCORE)p$(REVISION).$(LIBSUFFIX) LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)p$(REVISION)_p.$(LIBSUFFIX) endif else ifndef SMP LIBNAME = $(LIBPREFIX)$(REVISION).$(LIBSUFFIX) LIBNAME_P = $(LIBPREFIX)$(REVISION)_p.$(LIBSUFFIX) else LIBNAME = $(LIBPREFIX)p$(REVISION).$(LIBSUFFIX) LIBNAME_P = $(LIBPREFIX)p$(REVISION)_p.$(LIBSUFFIX) endif endif LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.so) LIBDLLNAME = $(LIBNAME:.$(LIBSUFFIX)=.dll) LIBDYNNAME = $(LIBNAME:.$(LIBSUFFIX)=.dylib) LIBDEFNAME = $(LIBNAME:.$(LIBSUFFIX)=.def) LIBEXPNAME = $(LIBNAME:.$(LIBSUFFIX)=.exp) LIBZIPNAME = $(LIBNAME:.$(LIBSUFFIX)=.zip) LIBS = $(TOPDIR)/$(LIBNAME) LIBS_P = $(TOPDIR)/$(LIBNAME_P) export OSNAME export ARCH export CORE export LIBCORE export PGCPATH export CONFIG export CC export FC export BU export FU export USE_THREAD export NUM_THREADS export NUM_CORES export SMP export MAKEFILE_RULE export NEED_PIC export BINARY export BINARY32 export BINARY64 export F_COMPILER export C_COMPILER export USE_OPENMP export CROSS export CROSS_SUFFIX export NOFORTRAN export EXTRALIB export CEXTRALIB export FEXTRALIB export HAVE_SSE export HAVE_SSE2 export HAVE_SSE3 export HAVE_SSSE3 export HAVE_SSE4_1 export HAVE_SSE4_2 export HAVE_SSE4A export HAVE_SSE5 export KERNELDIR export FUNCTION_PROFILE export TARGET_CORE export SGEMM_UNROLL_M export SGEMM_UNROLL_N export DGEMM_UNROLL_M export DGEMM_UNROLL_N export QGEMM_UNROLL_M export QGEMM_UNROLL_N export CGEMM_UNROLL_M export CGEMM_UNROLL_N export ZGEMM_UNROLL_M export ZGEMM_UNROLL_N export XGEMM_UNROLL_M export XGEMM_UNROLL_N ifdef USE_CUDA export CUDADIR export CUCC export CUFLAGS export CULIB endif .SUFFIXES: .$(PSUFFIX) .$(SUFFIX) .f .f.$(SUFFIX): $(FC) $(FFLAGS) -c $< -o $(@F) .f.$(PSUFFIX): $(FC) $(FPFLAGS) -pg -c $< -o $(@F) ifdef BINARY64 PATHSCALEPATH = /opt/pathscale/lib/3.1 PGIPATH = /opt/pgi/linux86-64/7.1-5/lib else PATHSCALEPATH = /opt/pathscale/lib/3.1/32 PGIPATH = /opt/pgi/linux86/7.1-5/lib endif ACMLPATH = /opt/acml/4.3.0 ifneq ($(OSNAME), Darwin) MKLPATH = /opt/intel/mkl/10.2.2.025/lib else MKLPATH = /Library/Frameworks/Intel_MKL.framework/Versions/10.0.1.014/lib endif ATLASPATH = /opt/atlas/3.9.17/opteron FLAMEPATH = $(HOME)/flame/lib ifneq ($(OSNAME), SunOS) SUNPATH = /opt/sunstudio12.1 else SUNPATH = /opt/SUNWspro endif
{ "pile_set_name": "Github" }
package stdlib import ( "strings" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" "github.com/zclconf/go-cty/cty/gocty" "github.com/apparentlymart/go-textseg/textseg" ) var UpperFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, AllowDynamicType: true, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { in := args[0].AsString() out := strings.ToUpper(in) return cty.StringVal(out), nil }, }) var LowerFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, AllowDynamicType: true, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { in := args[0].AsString() out := strings.ToLower(in) return cty.StringVal(out), nil }, }) var ReverseFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, AllowDynamicType: true, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { in := []byte(args[0].AsString()) out := make([]byte, len(in)) pos := len(out) inB := []byte(in) for i := 0; i < len(in); { d, _, _ := textseg.ScanGraphemeClusters(inB[i:], true) cluster := in[i : i+d] pos -= len(cluster) copy(out[pos:], cluster) i += d } return cty.StringVal(string(out)), nil }, }) var StrlenFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, AllowDynamicType: true, }, }, Type: function.StaticReturnType(cty.Number), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { in := args[0].AsString() l := 0 inB := []byte(in) for i := 0; i < len(in); { d, _, _ := textseg.ScanGraphemeClusters(inB[i:], true) l++ i += d } return cty.NumberIntVal(int64(l)), nil }, }) var SubstrFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, AllowDynamicType: true, }, { Name: "offset", Type: cty.Number, AllowDynamicType: true, }, { Name: "length", Type: cty.Number, AllowDynamicType: true, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { in := []byte(args[0].AsString()) var offset, length int var err error err = gocty.FromCtyValue(args[1], &offset) if err != nil { return cty.NilVal, err } err = gocty.FromCtyValue(args[2], &length) if err != nil { return cty.NilVal, err } if offset < 0 { totalLenNum, err := Strlen(args[0]) if err != nil { // should never happen panic("Stdlen returned an error") } var totalLen int err = gocty.FromCtyValue(totalLenNum, &totalLen) if err != nil { // should never happen panic("Stdlen returned a non-int number") } offset += totalLen } sub := in pos := 0 var i int // First we'll seek forward to our offset if offset > 0 { for i = 0; i < len(sub); { d, _, _ := textseg.ScanGraphemeClusters(sub[i:], true) i += d pos++ if pos == offset { break } if i >= len(in) { return cty.StringVal(""), nil } } sub = sub[i:] } if length < 0 { // Taking the remainder of the string is a fast path since // we can just return the rest of the buffer verbatim. return cty.StringVal(string(sub)), nil } // Otherwise we need to start seeking forward again until we // reach the length we want. pos = 0 for i = 0; i < len(sub); { d, _, _ := textseg.ScanGraphemeClusters(sub[i:], true) i += d pos++ if pos == length { break } } sub = sub[:i] return cty.StringVal(string(sub)), nil }, }) // Upper is a Function that converts a given string to uppercase. func Upper(str cty.Value) (cty.Value, error) { return UpperFunc.Call([]cty.Value{str}) } // Lower is a Function that converts a given string to lowercase. func Lower(str cty.Value) (cty.Value, error) { return LowerFunc.Call([]cty.Value{str}) } // Reverse is a Function that reverses the order of the characters in the // given string. // // As usual, "character" for the sake of this function is a grapheme cluster, // so combining diacritics (for example) will be considered together as a // single character. func Reverse(str cty.Value) (cty.Value, error) { return ReverseFunc.Call([]cty.Value{str}) } // Strlen is a Function that returns the length of the given string in // characters. // // As usual, "character" for the sake of this function is a grapheme cluster, // so combining diacritics (for example) will be considered together as a // single character. func Strlen(str cty.Value) (cty.Value, error) { return StrlenFunc.Call([]cty.Value{str}) } // Substr is a Function that extracts a sequence of characters from another // string and creates a new string. // // As usual, "character" for the sake of this function is a grapheme cluster, // so combining diacritics (for example) will be considered together as a // single character. // // The "offset" index may be negative, in which case it is relative to the // end of the given string. // // The "length" may be -1, in which case the remainder of the string after // the given offset will be returned. func Substr(str cty.Value, offset cty.Value, length cty.Value) (cty.Value, error) { return SubstrFunc.Call([]cty.Value{str, offset, length}) }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2017 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MOVIDIUS_NCS_IMAGE_NCS_SERVER_H #define MOVIDIUS_NCS_IMAGE_NCS_SERVER_H #include <string> #include <vector> #include <ros/ros.h> #include <object_msgs/ClassifyObject.h> #include <object_msgs/DetectObject.h> #include "movidius_ncs_lib/ncs.h" #include "movidius_ncs_lib/ncs_manager.h" namespace movidius_ncs_image { class NCSServer { public: explicit NCSServer(ros::NodeHandle& nh); private: void getParameters(); void init(); bool cbDetectObject(object_msgs::DetectObject::Request& request, object_msgs::DetectObject::Response& response); bool cbClassifyObject(object_msgs::ClassifyObject::Request& request, object_msgs::ClassifyObject::Response& response); ros::ServiceServer service_; std::shared_ptr<movidius_ncs_lib::NCSManager> ncs_manager_handle_; ros::NodeHandle nh_; int max_device_number_; int start_device_index_; int log_level_; std::string cnn_type_; std::string graph_file_path_; std::string category_file_path_; int network_dimension_; std::vector<float> mean_; float scale_; int top_n_; }; } // namespace movidius_ncs_image #endif // MOVIDIUS_NCS_IMAGE_NCS_SERVER_H
{ "pile_set_name": "Github" }
require 'formula' class ArpackJulia < Formula homepage 'https://github.com/opencollab/arpack-ng' url 'https://github.com/opencollab/arpack-ng/archive/3.3.0.tar.gz' sha256 'ad59811e7d79d50b8ba19fd908f92a3683d883597b2c7759fdcc38f6311fe5b3' revision 4 bottle do root_url 'https://juliabottles.s3.amazonaws.com' cellar :any rebuild 2 sha256 "176bef36b77bf8cf6a92bc5c20f25982783286e2062fd50b7329e43aaa602cf9" => :el_capitan sha256 "535d1aff9d8acb49469bb95de55feb02f68eae3e2f76ee732f5db9f1dba54cc7" => :sierra end keg_only 'Conflicts with arpack in homebrew-science.' depends_on "gcc" depends_on 'staticfloat/julia/openblas-julia' depends_on 'autoconf' => :build depends_on 'automake' => :build depends_on 'libtool' => :build def install system "./bootstrap" configure_args = ["--disable-dependency-tracking", "--prefix=#{prefix}", "--enable-shared", "--with-blas=openblas", "--with-lapack=openblas"] system "./configure", *configure_args system "make install" end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> 0
{ "pile_set_name": "Github" }
// // Variables // -------------------------------------------------- //== Colors // //## Gray and brand colors for use across Bootstrap. @gray-darker: lighten(#000, 13.5%); // #222 @gray-dark: lighten(#000, 20%); // #333 @gray: lighten(#000, 33.5%); // #555 @gray-light: lighten(#000, 60%); // #999 @gray-lighter: lighten(#000, 93.5%); // #eee @brand-primary: #428bca; @brand-success: #5cb85c; @brand-info: #5bc0de; @brand-warning: #f0ad4e; @brand-danger: #d9534f; //== Scaffolding // // ## Settings for some of the most global styles. //** Background color for `<body>`. @body-bg: #fff; //** Global text color on `<body>`. @text-color: @gray-dark; //** Global textual link color. @link-color: @brand-primary; //** Link hover color set via `darken()` function. @link-hover-color: darken(@link-color, 15%); //== Typography // //## Font, line-height, and color for body text, headings, and more. @font-family-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif; @font-family-serif: Georgia, "Times New Roman", Times, serif; //** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`. @font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace; @font-family-base: @font-family-sans-serif; @font-size-base: 14px; @font-size-large: ceil((@font-size-base * 1.25)); // ~18px @font-size-small: ceil((@font-size-base * 0.85)); // ~12px @font-size-h1: floor((@font-size-base * 2.6)); // ~36px @font-size-h2: floor((@font-size-base * 2.15)); // ~30px @font-size-h3: ceil((@font-size-base * 1.7)); // ~24px @font-size-h4: ceil((@font-size-base * 1.25)); // ~18px @font-size-h5: @font-size-base; @font-size-h6: ceil((@font-size-base * 0.85)); // ~12px //** Unit-less `line-height` for use in components like buttons. @line-height-base: 1.428571429; // 20/14 //** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc. @line-height-computed: floor((@font-size-base * @line-height-base)); // ~20px //** By default, this inherits from the `<body>`. @headings-font-family: inherit; @headings-font-weight: 500; @headings-line-height: 1.1; @headings-color: inherit; //-- Iconography // //## Specify custom locations of the include Glyphicons icon font. Useful for those including Bootstrap via Bower. @icon-font-path: "../fonts/"; @icon-font-name: "glyphicons-halflings-regular"; @icon-font-svg-id: "glyphicons_halflingsregular"; //== Components // //## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start). @padding-base-vertical: 6px; @padding-base-horizontal: 12px; @padding-large-vertical: 10px; @padding-large-horizontal: 16px; @padding-small-vertical: 5px; @padding-small-horizontal: 10px; @padding-xs-vertical: 1px; @padding-xs-horizontal: 5px; @line-height-large: 1.33; @line-height-small: 1.5; @border-radius-base: 4px; @border-radius-large: 6px; @border-radius-small: 3px; //** Global color for active items (e.g., navs or dropdowns). @component-active-color: #fff; //** Global background color for active items (e.g., navs or dropdowns). @component-active-bg: @brand-primary; //** Width of the `border` for generating carets that indicator dropdowns. @caret-width-base: 4px; //** Carets increase slightly in size for larger components. @caret-width-large: 5px; //== Tables // //## Customizes the `.table` component with basic values, each used across all table variations. //** Padding for `<th>`s and `<td>`s. @table-cell-padding: 8px; //** Padding for cells in `.table-condensed`. @table-condensed-cell-padding: 5px; //** Default background color used for all tables. @table-bg: transparent; //** Background color used for `.table-striped`. @table-bg-accent: #f9f9f9; //** Background color used for `.table-hover`. @table-bg-hover: #f5f5f5; @table-bg-active: @table-bg-hover; //** Border color for table and cell borders. @table-border-color: #ddd; //== Buttons // //## For each of Bootstrap's buttons, define text, background and border color. @btn-font-weight: normal; @btn-default-color: #333; @btn-default-bg: #fff; @btn-default-border: #ccc; @btn-primary-color: #fff; @btn-primary-bg: @brand-primary; @btn-primary-border: darken(@btn-primary-bg, 5%); @btn-success-color: #fff; @btn-success-bg: @brand-success; @btn-success-border: darken(@btn-success-bg, 5%); @btn-info-color: #fff; @btn-info-bg: @brand-info; @btn-info-border: darken(@btn-info-bg, 5%); @btn-warning-color: #fff; @btn-warning-bg: @brand-warning; @btn-warning-border: darken(@btn-warning-bg, 5%); @btn-danger-color: #fff; @btn-danger-bg: @brand-danger; @btn-danger-border: darken(@btn-danger-bg, 5%); @btn-link-disabled-color: @gray-light; //== Forms // //## //** `<input>` background color @input-bg: #fff; //** `<input disabled>` background color @input-bg-disabled: @gray-lighter; //** Text color for `<input>`s @input-color: @gray; //** `<input>` border color @input-border: #ccc; //** `<input>` border radius @input-border-radius: @border-radius-base; //** Border color for inputs on focus @input-border-focus: #66afe9; //** Placeholder text color @input-color-placeholder: @gray-light; //** Default `.form-control` height @input-height-base: (@line-height-computed + (@padding-base-vertical * 2) + 2); //** Large `.form-control` height @input-height-large: (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2); //** Small `.form-control` height @input-height-small: (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2); @legend-color: @gray-dark; @legend-border-color: #e5e5e5; //** Background color for textual input addons @input-group-addon-bg: @gray-lighter; //** Border color for textual input addons @input-group-addon-border-color: @input-border; //== Dropdowns // //## Dropdown menu container and contents. //** Background for the dropdown menu. @dropdown-bg: #fff; //** Dropdown menu `border-color`. @dropdown-border: rgba(0,0,0,.15); //** Dropdown menu `border-color` **for IE8**. @dropdown-fallback-border: #ccc; //** Divider color for between dropdown items. @dropdown-divider-bg: #e5e5e5; //** Dropdown link text color. @dropdown-link-color: @gray-dark; //** Hover color for dropdown links. @dropdown-link-hover-color: darken(@gray-dark, 5%); //** Hover background for dropdown links. @dropdown-link-hover-bg: #f5f5f5; //** Active dropdown menu item text color. @dropdown-link-active-color: @component-active-color; //** Active dropdown menu item background color. @dropdown-link-active-bg: @component-active-bg; //** Disabled dropdown menu item background color. @dropdown-link-disabled-color: @gray-light; //** Text color for headers within dropdown menus. @dropdown-header-color: @gray-light; // Note: Deprecated @dropdown-caret-color as of v3.1.0 @dropdown-caret-color: #000; //-- Z-index master list // // Warning: Avoid customizing these values. They're used for a bird's eye view // of components dependent on the z-axis and are designed to all work together. // // Note: These variables are not generated into the Customizer. @zindex-navbar: 1000; @zindex-dropdown: 1000; @zindex-popover: 1010; @zindex-tooltip: 1030; @zindex-navbar-fixed: 1030; @zindex-modal-background: 1040; @zindex-modal: 1050; //== Media queries breakpoints // //## Define the breakpoints at which your layout will change, adapting to different screen sizes. // Extra small screen / phone // Note: Deprecated @screen-xs and @screen-phone as of v3.0.1 @screen-xs: 480px; @screen-xs-min: @screen-xs; @screen-phone: @screen-xs-min; // Small screen / tablet // Note: Deprecated @screen-sm and @screen-tablet as of v3.0.1 @screen-sm: 768px; @screen-sm-min: @screen-sm; @screen-tablet: @screen-sm-min; // Medium screen / desktop // Note: Deprecated @screen-md and @screen-desktop as of v3.0.1 @screen-md: 992px; @screen-md-min: @screen-md; @screen-desktop: @screen-md-min; // Large screen / wide desktop // Note: Deprecated @screen-lg and @screen-lg-desktop as of v3.0.1 @screen-lg: 1200px; @screen-lg-min: @screen-lg; @screen-lg-desktop: @screen-lg-min; // So media queries don't overlap when required, provide a maximum @screen-xs-max: (@screen-sm-min - 1); @screen-sm-max: (@screen-md-min - 1); @screen-md-max: (@screen-lg-min - 1); //== Grid system // //## Define your custom responsive grid. //** Number of columns in the grid. @grid-columns: 12; //** Padding between columns. Gets divided in half for the left and right. @grid-gutter-width: 30px; // Navbar collapse //** Point at which the navbar becomes uncollapsed. @grid-float-breakpoint: @screen-sm-min; //** Point at which the navbar begins collapsing. @grid-float-breakpoint-max: (@grid-float-breakpoint - 1); //== Navbar // //## // Basics of a navbar @navbar-height: 50px; @navbar-margin-bottom: @line-height-computed; @navbar-border-radius: @border-radius-base; @navbar-padding-horizontal: floor((@grid-gutter-width / 2)); @navbar-padding-vertical: ((@navbar-height - @line-height-computed) / 2); @navbar-collapse-max-height: 340px; @navbar-default-color: #777; @navbar-default-bg: #f8f8f8; @navbar-default-border: darken(@navbar-default-bg, 6.5%); // Navbar links @navbar-default-link-color: #777; @navbar-default-link-hover-color: #333; @navbar-default-link-hover-bg: transparent; @navbar-default-link-active-color: #555; @navbar-default-link-active-bg: darken(@navbar-default-bg, 6.5%); @navbar-default-link-disabled-color: #ccc; @navbar-default-link-disabled-bg: transparent; // Navbar brand label @navbar-default-brand-color: @navbar-default-link-color; @navbar-default-brand-hover-color: darken(@navbar-default-brand-color, 10%); @navbar-default-brand-hover-bg: transparent; // Navbar toggle @navbar-default-toggle-hover-bg: #ddd; @navbar-default-toggle-icon-bar-bg: #888; @navbar-default-toggle-border-color: #ddd; // Inverted navbar // Reset inverted navbar basics @navbar-inverse-color: @gray-light; @navbar-inverse-bg: #222; @navbar-inverse-border: darken(@navbar-inverse-bg, 10%); // Inverted navbar links @navbar-inverse-link-color: @gray-light; @navbar-inverse-link-hover-color: #fff; @navbar-inverse-link-hover-bg: transparent; @navbar-inverse-link-active-color: @navbar-inverse-link-hover-color; @navbar-inverse-link-active-bg: darken(@navbar-inverse-bg, 10%); @navbar-inverse-link-disabled-color: #444; @navbar-inverse-link-disabled-bg: transparent; // Inverted navbar brand label @navbar-inverse-brand-color: @navbar-inverse-link-color; @navbar-inverse-brand-hover-color: #fff; @navbar-inverse-brand-hover-bg: transparent; // Inverted navbar toggle @navbar-inverse-toggle-hover-bg: #333; @navbar-inverse-toggle-icon-bar-bg: #fff; @navbar-inverse-toggle-border-color: #333; //== Navs // //## //=== Shared nav styles @nav-link-padding: 10px 15px; @nav-link-hover-bg: @gray-lighter; @nav-disabled-link-color: @gray-light; @nav-disabled-link-hover-color: @gray-light; @nav-open-link-hover-color: #fff; //== Tabs @nav-tabs-border-color: #ddd; @nav-tabs-link-hover-border-color: @gray-lighter; @nav-tabs-active-link-hover-bg: @body-bg; @nav-tabs-active-link-hover-color: @gray; @nav-tabs-active-link-hover-border-color: #ddd; @nav-tabs-justified-link-border-color: #ddd; @nav-tabs-justified-active-link-border-color: @body-bg; //== Pills @nav-pills-border-radius: @border-radius-base; @nav-pills-active-link-hover-bg: @component-active-bg; @nav-pills-active-link-hover-color: @component-active-color; //== Pagination // //## @pagination-color: @link-color; @pagination-bg: #fff; @pagination-border: #ddd; @pagination-hover-color: @link-hover-color; @pagination-hover-bg: @gray-lighter; @pagination-hover-border: #ddd; @pagination-active-color: #fff; @pagination-active-bg: @brand-primary; @pagination-active-border: @brand-primary; @pagination-disabled-color: @gray-light; @pagination-disabled-bg: #fff; @pagination-disabled-border: #ddd; //== Pager // //## @pager-bg: @pagination-bg; @pager-border: @pagination-border; @pager-border-radius: 15px; @pager-hover-bg: @pagination-hover-bg; @pager-active-bg: @pagination-active-bg; @pager-active-color: @pagination-active-color; @pager-disabled-color: @pagination-disabled-color; //== Jumbotron // //## @jumbotron-padding: 30px; @jumbotron-color: inherit; @jumbotron-bg: @gray-lighter; @jumbotron-heading-color: inherit; @jumbotron-font-size: ceil((@font-size-base * 1.5)); //== Form states and alerts // //## Define colors for form feedback states and, by default, alerts. @state-success-text: #3c763d; @state-success-bg: #dff0d8; @state-success-border: darken(spin(@state-success-bg, -10), 5%); @state-info-text: #31708f; @state-info-bg: #d9edf7; @state-info-border: darken(spin(@state-info-bg, -10), 7%); @state-warning-text: #8a6d3b; @state-warning-bg: #fcf8e3; @state-warning-border: darken(spin(@state-warning-bg, -10), 5%); @state-danger-text: #a94442; @state-danger-bg: #f2dede; @state-danger-border: darken(spin(@state-danger-bg, -10), 5%); //== Tooltips // //## //** Tooltip max width @tooltip-max-width: 200px; //** Tooltip text color @tooltip-color: #fff; //** Tooltip background color @tooltip-bg: #000; @tooltip-opacity: .9; //** Tooltip arrow width @tooltip-arrow-width: 5px; //** Tooltip arrow color @tooltip-arrow-color: @tooltip-bg; //== Popovers // //## //** Popover body background color @popover-bg: #fff; //** Popover maximum width @popover-max-width: 276px; //** Popover border color @popover-border-color: rgba(0,0,0,.2); //** Popover fallback border color @popover-fallback-border-color: #ccc; //** Popover title background color @popover-title-bg: darken(@popover-bg, 3%); //** Popover arrow width @popover-arrow-width: 10px; //** Popover arrow color @popover-arrow-color: #fff; //** Popover outer arrow width @popover-arrow-outer-width: (@popover-arrow-width + 1); //** Popover outer arrow color @popover-arrow-outer-color: rgba(0,0,0,.25); //** Popover outer arrow fallback color @popover-arrow-outer-fallback-color: #999; //== Labels // //## //** Default label background color @label-default-bg: @gray-light; //** Primary label background color @label-primary-bg: @brand-primary; //** Success label background color @label-success-bg: @brand-success; //** Info label background color @label-info-bg: @brand-info; //** Warning label background color @label-warning-bg: @brand-warning; //** Danger label background color @label-danger-bg: @brand-danger; //** Default label text color @label-color: #fff; //** Default text color of a linked label @label-link-hover-color: #fff; //== Modals // //## //** Padding applied to the modal body @modal-inner-padding: 20px; //** Padding applied to the modal title @modal-title-padding: 15px; //** Modal title line-height @modal-title-line-height: @line-height-base; //** Background color of modal content area @modal-content-bg: #fff; //** Modal content border color @modal-content-border-color: rgba(0,0,0,.2); //** Modal content border color **for IE8** @modal-content-fallback-border-color: #999; //** Modal backdrop background color @modal-backdrop-bg: #000; //** Modal backdrop opacity @modal-backdrop-opacity: .5; //** Modal header border color @modal-header-border-color: #e5e5e5; //** Modal footer border color @modal-footer-border-color: @modal-header-border-color; @modal-lg: 900px; @modal-md: 600px; @modal-sm: 300px; //== Alerts // //## Define alert colors, border radius, and padding. @alert-padding: 15px; @alert-border-radius: @border-radius-base; @alert-link-font-weight: bold; @alert-success-bg: @state-success-bg; @alert-success-text: @state-success-text; @alert-success-border: @state-success-border; @alert-info-bg: @state-info-bg; @alert-info-text: @state-info-text; @alert-info-border: @state-info-border; @alert-warning-bg: @state-warning-bg; @alert-warning-text: @state-warning-text; @alert-warning-border: @state-warning-border; @alert-danger-bg: @state-danger-bg; @alert-danger-text: @state-danger-text; @alert-danger-border: @state-danger-border; //== Progress bars // //## //** Background color of the whole progress component @progress-bg: #f5f5f5; //** Progress bar text color @progress-bar-color: #fff; //** Default progress bar color @progress-bar-bg: @brand-primary; //** Success progress bar color @progress-bar-success-bg: @brand-success; //** Warning progress bar color @progress-bar-warning-bg: @brand-warning; //** Danger progress bar color @progress-bar-danger-bg: @brand-danger; //** Info progress bar color @progress-bar-info-bg: @brand-info; //== List group // //## //** Background color on `.list-group-item` @list-group-bg: #fff; //** `.list-group-item` border color @list-group-border: #ddd; //** List group border radius @list-group-border-radius: @border-radius-base; //** Background color of single list elements on hover @list-group-hover-bg: #f5f5f5; //** Text color of active list elements @list-group-active-color: @component-active-color; //** Background color of active list elements @list-group-active-bg: @component-active-bg; //** Border color of active list elements @list-group-active-border: @list-group-active-bg; @list-group-active-text-color: lighten(@list-group-active-bg, 40%); @list-group-link-color: #555; @list-group-link-heading-color: #333; //== Panels // //## @panel-bg: #fff; @panel-body-padding: 15px; @panel-border-radius: @border-radius-base; //** Border color for elements within panels @panel-inner-border: #ddd; @panel-footer-bg: #f5f5f5; @panel-default-text: @gray-dark; @panel-default-border: #ddd; @panel-default-heading-bg: #f5f5f5; @panel-primary-text: #fff; @panel-primary-border: @brand-primary; @panel-primary-heading-bg: @brand-primary; @panel-success-text: @state-success-text; @panel-success-border: @state-success-border; @panel-success-heading-bg: @state-success-bg; @panel-info-text: @state-info-text; @panel-info-border: @state-info-border; @panel-info-heading-bg: @state-info-bg; @panel-warning-text: @state-warning-text; @panel-warning-border: @state-warning-border; @panel-warning-heading-bg: @state-warning-bg; @panel-danger-text: @state-danger-text; @panel-danger-border: @state-danger-border; @panel-danger-heading-bg: @state-danger-bg; //== Thumbnails // //## //** Padding around the thumbnail image @thumbnail-padding: 4px; //** Thumbnail background color @thumbnail-bg: @body-bg; //** Thumbnail border color @thumbnail-border: #ddd; //** Thumbnail border radius @thumbnail-border-radius: @border-radius-base; //** Custom text color for thumbnail captions @thumbnail-caption-color: @text-color; //** Padding around the thumbnail caption @thumbnail-caption-padding: 9px; //== Wells // //## @well-bg: #f5f5f5; @well-border: darken(@well-bg, 7%); //== Badges // //## @badge-color: #fff; //** Linked badge text color on hover @badge-link-hover-color: #fff; @badge-bg: @gray-light; //** Badge text color in active nav link @badge-active-color: @link-color; //** Badge background color in active nav link @badge-active-bg: #fff; @badge-font-weight: bold; @badge-line-height: 1; @badge-border-radius: 10px; //== Breadcrumbs // //## @breadcrumb-padding-vertical: 8px; @breadcrumb-padding-horizontal: 15px; //** Breadcrumb background color @breadcrumb-bg: #f5f5f5; //** Breadcrumb text color @breadcrumb-color: #ccc; //** Text color of current page in the breadcrumb @breadcrumb-active-color: @gray-light; //** Textual separator for between breadcrumb elements @breadcrumb-separator: "/"; //== Carousel // //## @carousel-text-shadow: 0 1px 2px rgba(0,0,0,.6); @carousel-control-color: #fff; @carousel-control-width: 15%; @carousel-control-opacity: .5; @carousel-control-font-size: 20px; @carousel-indicator-active-bg: #fff; @carousel-indicator-border-color: #fff; @carousel-caption-color: #fff; //== Close // //## @close-font-weight: bold; @close-color: #000; @close-text-shadow: 0 1px 0 #fff; //== Code // //## @code-color: #c7254e; @code-bg: #f9f2f4; @kbd-color: #fff; @kbd-bg: #333; @pre-bg: #f5f5f5; @pre-color: @gray-dark; @pre-border-color: #ccc; @pre-scrollable-max-height: 340px; //== Type // //## //** Text muted color @text-muted: @gray-light; //** Abbreviations and acronyms border color @abbr-border-color: @gray-light; //** Headings small color @headings-small-color: @gray-light; //** Blockquote small color @blockquote-small-color: @gray-light; //** Blockquote border color @blockquote-border-color: @gray-lighter; //** Page header border color @page-header-border-color: @gray-lighter; //== Miscellaneous // //## //** Horizontal line color. @hr-border: @gray-lighter; //** Horizontal offset for forms and lists. @component-offset-horizontal: 180px; //== Container sizes // //## Define the maximum width of `.container` for different screen sizes. // Small screen / tablet @container-tablet: ((720px + @grid-gutter-width)); //** For `@screen-sm-min` and up. @container-sm: @container-tablet; // Medium screen / desktop @container-desktop: ((940px + @grid-gutter-width)); //** For `@screen-md-min` and up. @container-md: @container-desktop; // Large screen / wide desktop @container-large-desktop: ((1140px + @grid-gutter-width)); //** For `@screen-lg-min` and up. @container-lg: @container-large-desktop;
{ "pile_set_name": "Github" }
package client // import "github.com/docker/docker/client" import ( "bytes" "context" "encoding/json" "io/ioutil" "github.com/docker/docker/api/types" ) // PluginInspectWithRaw inspects an existing plugin func (cli *Client) PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error) { if name == "" { return nil, nil, objectNotFoundError{object: "plugin", id: name} } resp, err := cli.get(ctx, "/plugins/"+name+"/json", nil, nil) if err != nil { return nil, nil, wrapResponseError(err, resp, "plugin", name) } defer ensureReaderClosed(resp) body, err := ioutil.ReadAll(resp.body) if err != nil { return nil, nil, err } var p types.Plugin rdr := bytes.NewReader(body) err = json.NewDecoder(rdr).Decode(&p) return &p, body, err }
{ "pile_set_name": "Github" }