text
stringlengths
2
99.9k
meta
dict
<?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> <application> <default-render-kit-id> org.apache.myfaces.trinidad.core </default-render-kit-id> </application> <managed-bean> <managed-bean-name>tableValues</managed-bean-name> <managed-bean-class>de.vogella.jsf.trinidad.first.TableValues</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>myChartModel</managed-bean-name> <managed-bean-class>de.vogella.jsf.trinidad.first.MyChartModel</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>person</managed-bean-name> <managed-bean-class>de.vogella.jsf.trinidad.first.Person</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> </faces-config>
{ "pile_set_name": "Github" }
// Copyright 2015-2020 Swim 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 swim.io; import java.io.IOException; import java.net.ConnectException; import java.net.InetSocketAddress; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; import java.security.Principal; import java.security.cert.Certificate; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngineResult; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import swim.codec.Binary; import swim.codec.InputBuffer; import swim.codec.OutputBuffer; import swim.concurrent.Conts; class TlsSocket implements Transport, IpSocketContext { static final int CLIENT = 1 << 0; static final int SERVER = 1 << 1; static final int CONNECTING = 1 << 2; static final int CONNECTED = 1 << 3; static final int HANDSHAKING = 1 << 4; static final int HANDSHAKED = 1 << 5; static final int OPEN = 1 << 6; static final int CLOSING_INBOUND = 1 << 7; static final int CLOSING_OUTBOUND = 1 << 8; static final AtomicReferenceFieldUpdater<TlsSocket, FlowControl> FLOW_CONTROL = AtomicReferenceFieldUpdater.newUpdater(TlsSocket.class, FlowControl.class, "flowControl"); static final AtomicIntegerFieldUpdater<TlsSocket> STATUS = AtomicIntegerFieldUpdater.newUpdater(TlsSocket.class, "status"); final InetSocketAddress localAddress; final InetSocketAddress remoteAddress; final ByteBuffer readBuffer; final ByteBuffer writeBuffer; final ByteBuffer inputBuffer; final ByteBuffer outputBuffer; final InputBuffer reader; final OutputBuffer<?> writer; final SocketChannel channel; final SSLEngine sslEngine; final IpSettings ipSettings; TransportContext context; volatile IpSocket socket; volatile FlowControl flowControl; volatile int status; TlsSocket(InetSocketAddress localAddress, InetSocketAddress remoteAddress, SocketChannel channel, SSLEngine sslEngine, IpSettings ipSettings, boolean isClient) { if (sslEngine == null) { throw new NullPointerException(); } this.localAddress = localAddress; this.remoteAddress = remoteAddress; this.channel = channel; this.sslEngine = sslEngine; this.ipSettings = ipSettings; this.flowControl = FlowControl.WAIT; this.status = isClient ? CLIENT : SERVER; final SSLSession sslSession = this.sslEngine.getSession(); final TcpSettings tcpSettings = this.ipSettings.tcpSettings(); final int readBufferSize = Math.max(tcpSettings.readBufferSize(), sslSession.getApplicationBufferSize()); final int writeBufferSize = Math.max(tcpSettings.writeBufferSize(), sslSession.getPacketBufferSize()); this.readBuffer = ByteBuffer.allocate(readBufferSize); this.writeBuffer = ByteBuffer.allocate(writeBufferSize); ((Buffer) this.writeBuffer).position(this.writeBuffer.capacity()); this.inputBuffer = ByteBuffer.allocate(readBufferSize); this.outputBuffer = ByteBuffer.allocate(writeBufferSize); ((Buffer) this.outputBuffer).position(this.outputBuffer.capacity()); this.reader = Binary.inputBuffer(inputBuffer); this.writer = Binary.outputBuffer(outputBuffer); } @Override public TransportContext transportContext() { return this.context; } @Override public void setTransportContext(TransportContext context) { this.context = context; } @Override public SocketChannel channel() { return this.channel; } @Override public ByteBuffer readBuffer() { return this.readBuffer; } @Override public ByteBuffer writeBuffer() { return this.writeBuffer; } @Override public long idleTimeout() { return this.socket.idleTimeout(); } @Override public IpSettings ipSettings() { return this.ipSettings; } @Override public InputBuffer inputBuffer() { return this.reader; } @Override public OutputBuffer<?> outputBuffer() { return this.writer; } @Override public boolean isConnected() { return (this.status & CONNECTED) != 0; } @Override public boolean isClient() { return (this.status & CLIENT) != 0; } @Override public boolean isServer() { return (this.status & SERVER) != 0; } @Override public boolean isSecure() { return true; } @Override public String securityProtocol() { return this.sslEngine.getSession().getProtocol(); } @Override public String cipherSuite() { return this.sslEngine.getSession().getCipherSuite(); } @Override public InetSocketAddress localAddress() { return this.localAddress; } @Override public Principal localPrincipal() { return this.sslEngine.getSession().getLocalPrincipal(); } @Override public Collection<Certificate> localCertificates() { final Certificate[] certificates = this.sslEngine.getSession().getLocalCertificates(); if (certificates != null) { return Arrays.asList(certificates); } else { return Collections.emptyList(); } } @Override public InetSocketAddress remoteAddress() { return this.remoteAddress; } @Override public Principal remotePrincipal() { try { return this.sslEngine.getSession().getPeerPrincipal(); } catch (SSLException cause) { return null; } } @Override public Collection<Certificate> remoteCertificates() { try { final Certificate[] certificates = this.sslEngine.getSession().getPeerCertificates(); if (certificates != null) { return Arrays.asList(certificates); } } catch (SSLException cause) { // ignore } return Collections.emptyList(); } @Override public FlowControl flowControl() { return this.flowControl; } @Override public void flowControl(FlowControl flowControl) { FLOW_CONTROL.set(this, flowControl); if ((this.status & OPEN) != 0) { this.context.flowControl(flowControl); } } @Override public FlowControl flowControl(FlowModifier flowModifier) { FlowControl oldFlow; FlowControl newFlow; do { oldFlow = this.flowControl; newFlow = oldFlow.modify(flowModifier); if (!oldFlow.equals(newFlow)) { if (FLOW_CONTROL.compareAndSet(this, oldFlow, newFlow)) { break; } } else { break; } } while (true); if ((this.status & OPEN) != 0) { return this.context.flowControl(flowModifier); } else { return newFlow; } } @Override public void become(IpSocket newSocket) { final IpSocket oldSocket = this.socket; if (oldSocket != null) { oldSocket.willBecome(newSocket); } final int status = this.status; newSocket.setIpSocketContext(this); this.socket = newSocket; if ((status & CONNECTED) != 0) { newSocket.didConnect(); } else if ((status & CONNECTING) != 0) { newSocket.willConnect(); } if (oldSocket != null) { oldSocket.didBecome(newSocket); } } @Override public void close() { do { final int oldStatus = this.status; if ((oldStatus & OPEN) != 0) { final int newStatus = oldStatus & ~OPEN | CLOSING_OUTBOUND; if (STATUS.compareAndSet(this, oldStatus, newStatus)) { this.sslEngine.closeOutbound(); this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break; } } else { this.context.close(); break; } } while (true); } @Override public void doAccept() throws IOException { throw new UnsupportedOperationException(); } @Override public void doConnect() throws IOException { try { this.channel.finishConnect(); didConnect(); } catch (ConnectException cause) { didClose(); } catch (Throwable cause) { if (!Conts.isNonFatal(cause)) { throw cause; } didFail(cause); } } @Override public void doRead() { read: do { final SSLEngineResult result; try { result = this.sslEngine.unwrap(this.readBuffer, this.inputBuffer); } catch (SSLException cause) { this.socket.didFail(cause); this.context.close(); return; } catch (Throwable cause) { if (!Conts.isNonFatal(cause)) { throw cause; } this.socket.didFail(cause); this.context.close(); return; } final SSLEngineResult.Status sslStatus = result.getStatus(); SSLEngineResult.HandshakeStatus handshakeStatus; switch (sslStatus) { case OK: if (this.inputBuffer.position() > 0) { ((Buffer) this.inputBuffer).flip(); this.socket.doRead(); if (this.inputBuffer.hasRemaining()) { this.inputBuffer.compact(); } else { ((Buffer) this.inputBuffer).clear(); } } handshakeStatus = result.getHandshakeStatus(); handshake: do { switch (handshakeStatus) { case NEED_UNWRAP: this.context.flowControl(FlowModifier.ENABLE_READ); if (this.readBuffer.hasRemaining()) { continue read; } else { break read; } case NEED_WRAP: this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break read; case NEED_TASK: do { // Spin until task is actually available. final Runnable task = this.sslEngine.getDelegatedTask(); if (task != null) { task.run(); break; } else { handshakeStatus = this.sslEngine.getHandshakeStatus(); if (handshakeStatus != SSLEngineResult.HandshakeStatus.NEED_TASK) { break; } } } while (true); continue handshake; case FINISHED: handshakeAcknowledged(); break read; case NOT_HANDSHAKING: break read; default: throw new AssertionError(handshakeStatus); // unreachable } // unreachable } while (true); // unreachable case CLOSED: receivedClose(); break read; case BUFFER_UNDERFLOW: handshakeStatus = result.getHandshakeStatus(); switch (handshakeStatus) { case NEED_UNWRAP: this.context.flowControl(FlowModifier.ENABLE_READ); break read; case NEED_WRAP: this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break read; case NOT_HANDSHAKING: break read; default: throw new AssertionError(handshakeStatus); // unreachable } // unreachable case BUFFER_OVERFLOW: this.context.close(); break read; default: throw new AssertionError(sslStatus); // unreachable } // unreachable } while (true); } @Override public void doWrite() { if ((this.status & OPEN) != 0 && !this.outputBuffer.hasRemaining()) { ((Buffer) this.outputBuffer).clear(); this.socket.doWrite(); ((Buffer) this.outputBuffer).flip(); } final SSLEngineResult result; try { result = this.sslEngine.wrap(this.outputBuffer, this.writeBuffer); } catch (SSLException cause) { this.socket.didFail(cause); this.context.close(); return; } catch (Throwable cause) { if (!Conts.isNonFatal(cause)) { throw cause; } this.socket.didFail(cause); this.context.close(); return; } final SSLEngineResult.Status sslStatus = result.getStatus(); switch (sslStatus) { case OK: SSLEngineResult.HandshakeStatus handshakeStatus = result.getHandshakeStatus(); handshake: do { switch (handshakeStatus) { case NEED_UNWRAP: this.context.flowControl(FlowModifier.ENABLE_READ); break; case NEED_WRAP: this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break; case FINISHED: this.context.flowControl(FlowModifier.DISABLE_WRITE); handshakeFinished(); break; case NEED_TASK: do { // Spin until task is actually available. final Runnable task = this.sslEngine.getDelegatedTask(); if (task != null) { task.run(); break; } else { handshakeStatus = this.sslEngine.getHandshakeStatus(); if (handshakeStatus != SSLEngineResult.HandshakeStatus.NEED_TASK) { break; } } } while (true); continue handshake; case NOT_HANDSHAKING: break; default: throw new AssertionError(handshakeStatus); // unreachable } break; } while (true); break; case CLOSED: this.context.close(); break; case BUFFER_UNDERFLOW: this.context.close(); break; case BUFFER_OVERFLOW: this.context.close(); break; default: throw new AssertionError(sslStatus); // unreachable } } @Override public void didWrite() { final int status = this.status; if ((status & HANDSHAKING) != 0) { SSLEngineResult.HandshakeStatus handshakeStatus = this.sslEngine.getHandshakeStatus(); handshake: do { switch (handshakeStatus) { case NEED_UNWRAP: this.context.flowControl(FlowModifier.DISABLE_WRITE_ENABLE_READ); break; case NEED_WRAP: this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break; case NEED_TASK: do { // Spin until task is actually available. final Runnable task = this.sslEngine.getDelegatedTask(); if (task != null) { task.run(); break; } else { handshakeStatus = this.sslEngine.getHandshakeStatus(); if (handshakeStatus != SSLEngineResult.HandshakeStatus.NEED_TASK) { break; } } } while (true); continue handshake; case NOT_HANDSHAKING: break; default: throw new AssertionError(handshakeStatus); // unreachable } break; } while (true); } else if ((status & HANDSHAKED) != 0) { handshakeAcknowledged(); } else if ((status & OPEN) != 0) { this.socket.didWrite(); } } void handshakeFinished() { do { final int oldStatus = this.status; if ((oldStatus & (HANDSHAKING | HANDSHAKED)) != HANDSHAKED) { final int newStatus = oldStatus & ~HANDSHAKING | HANDSHAKED; if (STATUS.compareAndSet(this, oldStatus, newStatus)) { break; } } else { break; } } while (true); } void handshakeAcknowledged() { do { final int oldStatus = this.status; if ((oldStatus & (HANDSHAKING | HANDSHAKED)) != 0) { final int newStatus = oldStatus & ~(HANDSHAKING | HANDSHAKED) | OPEN; if (STATUS.compareAndSet(this, oldStatus, newStatus)) { this.socket.didSecure(); this.context.flowControl(this.flowControl); break; } } else { break; } } while (true); } void receivedClose() { do { final int oldStatus = this.status; if ((oldStatus & CLOSING_OUTBOUND) != 0) { final int newStatus = oldStatus & ~CLOSING_OUTBOUND; if (STATUS.compareAndSet(this, oldStatus, newStatus)) { this.context.close(); break; } } else if ((oldStatus & CLOSING_INBOUND) == 0) { final int newStatus = oldStatus & ~OPEN | CLOSING_INBOUND; if (STATUS.compareAndSet(this, oldStatus, newStatus)) { this.sslEngine.closeOutbound(); this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break; } } else { break; } } while (true); } void willConnect() { do { final int oldStatus = this.status; if ((oldStatus & CONNECTING) == 0) { final int newStatus = oldStatus | CONNECTING; if (STATUS.compareAndSet(this, oldStatus, newStatus)) { this.socket.willConnect(); break; } } else { break; } } while (true); } void didConnect() throws SSLException { do { final int oldStatus = this.status; if ((oldStatus & (CONNECTING | CONNECTED | HANDSHAKING)) != (CONNECTED | HANDSHAKING)) { final int newStatus = oldStatus & ~CONNECTING | (CONNECTED | HANDSHAKING); if (STATUS.compareAndSet(this, oldStatus, newStatus)) { if ((oldStatus & CONNECTED) != (newStatus & CONNECTED)) { this.socket.didConnect(); } if ((oldStatus & HANDSHAKING) != (newStatus & HANDSHAKING)) { this.socket.willSecure(); } this.sslEngine.beginHandshake(); final SSLEngineResult.HandshakeStatus handshakeStatus = this.sslEngine.getHandshakeStatus(); switch (handshakeStatus) { case NEED_UNWRAP: this.context.flowControl(FlowModifier.ENABLE_READ); break; case NEED_WRAP: this.context.flowControl(FlowModifier.ENABLE_READ_WRITE); break; default: throw new AssertionError(handshakeStatus); // unreachable } break; } } else { break; } } while (true); } @Override public void didClose() { do { final int oldStatus = this.status; if ((oldStatus & (CONNECTING | CONNECTED | HANDSHAKING | HANDSHAKED | OPEN | CLOSING_INBOUND | CLOSING_OUTBOUND)) != 0) { final int newStatus = oldStatus & ~(CONNECTING | CONNECTED | HANDSHAKING | HANDSHAKED | OPEN | CLOSING_INBOUND | CLOSING_OUTBOUND); if (STATUS.compareAndSet(this, oldStatus, newStatus)) { this.socket.didDisconnect(); break; } } else { break; } } while (true); } @Override public void didTimeout() { this.socket.didTimeout(); } @Override public void didFail(Throwable error) { Throwable failure = null; if (!(error instanceof IOException)) { try { this.socket.didFail(error); } catch (Throwable cause) { if (!Conts.isNonFatal(cause)) { throw cause; } failure = cause; } } this.context.close(); if (failure instanceof RuntimeException) { throw (RuntimeException) failure; } else if (failure instanceof Error) { throw (Error) failure; } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.io; import java.net.URI; import java.net.URL; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.util.List; import java.util.ArrayList; import java.security.AccessController; import java.security.SecureRandom; import java.nio.file.Path; import java.nio.file.FileSystems; import sun.security.action.GetPropertyAction; /** * An abstract representation of file and directory pathnames. * * <p> User interfaces and operating systems use system-dependent <em>pathname * strings</em> to name files and directories. This class presents an * abstract, system-independent view of hierarchical pathnames. An * <em>abstract pathname</em> has two components: * * <ol> * <li> An optional system-dependent <em>prefix</em> string, * such as a disk-drive specifier, <code>"/"</code>&nbsp;for the UNIX root * directory, or <code>"\\\\"</code>&nbsp;for a Microsoft Windows UNC pathname, and * <li> A sequence of zero or more string <em>names</em>. * </ol> * * The first name in an abstract pathname may be a directory name or, in the * case of Microsoft Windows UNC pathnames, a hostname. Each subsequent name * in an abstract pathname denotes a directory; the last name may denote * either a directory or a file. The <em>empty</em> abstract pathname has no * prefix and an empty name sequence. * * <p> The conversion of a pathname string to or from an abstract pathname is * inherently system-dependent. When an abstract pathname is converted into a * pathname string, each name is separated from the next by a single copy of * the default <em>separator character</em>. The default name-separator * character is defined by the system property <code>file.separator</code>, and * is made available in the public static fields <code>{@link * #separator}</code> and <code>{@link #separatorChar}</code> of this class. * When a pathname string is converted into an abstract pathname, the names * within it may be separated by the default name-separator character or by any * other name-separator character that is supported by the underlying system. * * <p> A pathname, whether abstract or in string form, may be either * <em>absolute</em> or <em>relative</em>. An absolute pathname is complete in * that no other information is required in order to locate the file that it * denotes. A relative pathname, in contrast, must be interpreted in terms of * information taken from some other pathname. By default the classes in the * <code>java.io</code> package always resolve relative pathnames against the * current user directory. This directory is named by the system property * <code>user.dir</code>, and is typically the directory in which the Java * virtual machine was invoked. * * <p> The <em>parent</em> of an abstract pathname may be obtained by invoking * the {@link #getParent} method of this class and consists of the pathname's * prefix and each name in the pathname's name sequence except for the last. * Each directory's absolute pathname is an ancestor of any <tt>File</tt> * object with an absolute abstract pathname which begins with the directory's * absolute pathname. For example, the directory denoted by the abstract * pathname <tt>"/usr"</tt> is an ancestor of the directory denoted by the * pathname <tt>"/usr/local/bin"</tt>. * * <p> The prefix concept is used to handle root directories on UNIX platforms, * and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms, * as follows: * * <ul> * * <li> For UNIX platforms, the prefix of an absolute pathname is always * <code>"/"</code>. Relative pathnames have no prefix. The abstract pathname * denoting the root directory has the prefix <code>"/"</code> and an empty * name sequence. * * <li> For Microsoft Windows platforms, the prefix of a pathname that contains a drive * specifier consists of the drive letter followed by <code>":"</code> and * possibly followed by <code>"\\"</code> if the pathname is absolute. The * prefix of a UNC pathname is <code>"\\\\"</code>; the hostname and the share * name are the first two names in the name sequence. A relative pathname that * does not specify a drive has no prefix. * * </ul> * * <p> Instances of this class may or may not denote an actual file-system * object such as a file or a directory. If it does denote such an object * then that object resides in a <i>partition</i>. A partition is an * operating system-specific portion of storage for a file system. A single * storage device (e.g. a physical disk-drive, flash memory, CD-ROM) may * contain multiple partitions. The object, if any, will reside on the * partition <a name="partName">named</a> by some ancestor of the absolute * form of this pathname. * * <p> A file system may implement restrictions to certain operations on the * actual file-system object, such as reading, writing, and executing. These * restrictions are collectively known as <i>access permissions</i>. The file * system may have multiple sets of access permissions on a single object. * For example, one set may apply to the object's <i>owner</i>, and another * may apply to all other users. The access permissions on an object may * cause some methods in this class to fail. * * <p> Instances of the <code>File</code> class are immutable; that is, once * created, the abstract pathname represented by a <code>File</code> object * will never change. * * <h4>Interoperability with {@code java.nio.file} package</h4> * * <p> The <a href="../../java/nio/file/package-summary.html">{@code java.nio.file}</a> * package defines interfaces and classes for the Java virtual machine to access * files, file attributes, and file systems. This API may be used to overcome * many of the limitations of the {@code java.io.File} class. * The {@link #toPath toPath} method may be used to obtain a {@link * Path} that uses the abstract path represented by a {@code File} object to * locate a file. The resulting {@code Path} may be used with the {@link * java.nio.file.Files} class to provide more efficient and extensive access to * additional file operations, file attributes, and I/O exceptions to help * diagnose errors when an operation on a file fails. * * @author unascribed * @since JDK1.0 */ public class File implements Serializable, Comparable<File> { /** * The FileSystem object representing the platform's local file system. */ static private FileSystem fs = FileSystem.getFileSystem(); /** * This abstract pathname's normalized pathname string. A normalized * pathname string uses the default name-separator character and does not * contain any duplicate or redundant separators. * * @serial */ private String path; /** * The length of this abstract pathname's prefix, or zero if it has no * prefix. */ private transient int prefixLength; /** * Returns the length of this abstract pathname's prefix. * For use by FileSystem classes. */ int getPrefixLength() { return prefixLength; } /** * The system-dependent default name-separator character. This field is * initialized to contain the first character of the value of the system * property <code>file.separator</code>. On UNIX systems the value of this * field is <code>'/'</code>; on Microsoft Windows systems it is <code>'\\'</code>. * * @see java.lang.System#getProperty(java.lang.String) */ public static final char separatorChar = fs.getSeparator(); /** * The system-dependent default name-separator character, represented as a * string for convenience. This string contains a single character, namely * <code>{@link #separatorChar}</code>. */ public static final String separator = "" + separatorChar; /** * The system-dependent path-separator character. This field is * initialized to contain the first character of the value of the system * property <code>path.separator</code>. This character is used to * separate filenames in a sequence of files given as a <em>path list</em>. * On UNIX systems, this character is <code>':'</code>; on Microsoft Windows systems it * is <code>';'</code>. * * @see java.lang.System#getProperty(java.lang.String) */ public static final char pathSeparatorChar = fs.getPathSeparator(); /** * The system-dependent path-separator character, represented as a string * for convenience. This string contains a single character, namely * <code>{@link #pathSeparatorChar}</code>. */ public static final String pathSeparator = "" + pathSeparatorChar; /* -- Constructors -- */ /** * Internal constructor for already-normalized pathname strings. */ private File(String pathname, int prefixLength) { this.path = pathname; this.prefixLength = prefixLength; } /** * Internal constructor for already-normalized pathname strings. * The parameter order is used to disambiguate this method from the * public(File, String) constructor. */ private File(String child, File parent) { assert parent.path != null; assert (!parent.path.equals("")); this.path = fs.resolve(parent.path, child); this.prefixLength = parent.prefixLength; } /** * Creates a new <code>File</code> instance by converting the given * pathname string into an abstract pathname. If the given string is * the empty string, then the result is the empty abstract pathname. * * @param pathname A pathname string * @throws NullPointerException * If the <code>pathname</code> argument is <code>null</code> */ public File(String pathname) { if (pathname == null) { throw new NullPointerException(); } this.path = fs.normalize(pathname); this.prefixLength = fs.prefixLength(this.path); } /* Note: The two-argument File constructors do not interpret an empty parent abstract pathname as the current user directory. An empty parent instead causes the child to be resolved against the system-dependent directory defined by the FileSystem.getDefaultParent method. On Unix this default is "/", while on Microsoft Windows it is "\\". This is required for compatibility with the original behavior of this class. */ /** * Creates a new <code>File</code> instance from a parent pathname string * and a child pathname string. * * <p> If <code>parent</code> is <code>null</code> then the new * <code>File</code> instance is created as if by invoking the * single-argument <code>File</code> constructor on the given * <code>child</code> pathname string. * * <p> Otherwise the <code>parent</code> pathname string is taken to denote * a directory, and the <code>child</code> pathname string is taken to * denote either a directory or a file. If the <code>child</code> pathname * string is absolute then it is converted into a relative pathname in a * system-dependent way. If <code>parent</code> is the empty string then * the new <code>File</code> instance is created by converting * <code>child</code> into an abstract pathname and resolving the result * against a system-dependent default directory. Otherwise each pathname * string is converted into an abstract pathname and the child abstract * pathname is resolved against the parent. * * @param parent The parent pathname string * @param child The child pathname string * @throws NullPointerException * If <code>child</code> is <code>null</code> */ public File(String parent, String child) { if (child == null) { throw new NullPointerException(); } if (parent != null) { if (parent.equals("")) { this.path = fs.resolve(fs.getDefaultParent(), fs.normalize(child)); } else { this.path = fs.resolve(fs.normalize(parent), fs.normalize(child)); } } else { this.path = fs.normalize(child); } this.prefixLength = fs.prefixLength(this.path); } /** * Creates a new <code>File</code> instance from a parent abstract * pathname and a child pathname string. * * <p> If <code>parent</code> is <code>null</code> then the new * <code>File</code> instance is created as if by invoking the * single-argument <code>File</code> constructor on the given * <code>child</code> pathname string. * * <p> Otherwise the <code>parent</code> abstract pathname is taken to * denote a directory, and the <code>child</code> pathname string is taken * to denote either a directory or a file. If the <code>child</code> * pathname string is absolute then it is converted into a relative * pathname in a system-dependent way. If <code>parent</code> is the empty * abstract pathname then the new <code>File</code> instance is created by * converting <code>child</code> into an abstract pathname and resolving * the result against a system-dependent default directory. Otherwise each * pathname string is converted into an abstract pathname and the child * abstract pathname is resolved against the parent. * * @param parent The parent abstract pathname * @param child The child pathname string * @throws NullPointerException * If <code>child</code> is <code>null</code> */ public File(File parent, String child) { if (child == null) { throw new NullPointerException(); } if (parent != null) { if (parent.path.equals("")) { this.path = fs.resolve(fs.getDefaultParent(), fs.normalize(child)); } else { this.path = fs.resolve(parent.path, fs.normalize(child)); } } else { this.path = fs.normalize(child); } this.prefixLength = fs.prefixLength(this.path); } /** * Creates a new <tt>File</tt> instance by converting the given * <tt>file:</tt> URI into an abstract pathname. * * <p> The exact form of a <tt>file:</tt> URI is system-dependent, hence * the transformation performed by this constructor is also * system-dependent. * * <p> For a given abstract pathname <i>f</i> it is guaranteed that * * <blockquote><tt> * new File(</tt><i>&nbsp;f</i><tt>.{@link #toURI() toURI}()).equals(</tt><i>&nbsp;f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}()) * </tt></blockquote> * * so long as the original abstract pathname, the URI, and the new abstract * pathname are all created in (possibly different invocations of) the same * Java virtual machine. This relationship typically does not hold, * however, when a <tt>file:</tt> URI that is created in a virtual machine * on one operating system is converted into an abstract pathname in a * virtual machine on a different operating system. * * @param uri * An absolute, hierarchical URI with a scheme equal to * <tt>"file"</tt>, a non-empty path component, and undefined * authority, query, and fragment components * * @throws NullPointerException * If <tt>uri</tt> is <tt>null</tt> * * @throws IllegalArgumentException * If the preconditions on the parameter do not hold * * @see #toURI() * @see java.net.URI * @since 1.4 */ public File(URI uri) { // Check our many preconditions if (!uri.isAbsolute()) throw new IllegalArgumentException("URI is not absolute"); if (uri.isOpaque()) throw new IllegalArgumentException("URI is not hierarchical"); String scheme = uri.getScheme(); if ((scheme == null) || !scheme.equalsIgnoreCase("file")) throw new IllegalArgumentException("URI scheme is not \"file\""); if (uri.getAuthority() != null) throw new IllegalArgumentException("URI has an authority component"); if (uri.getFragment() != null) throw new IllegalArgumentException("URI has a fragment component"); if (uri.getQuery() != null) throw new IllegalArgumentException("URI has a query component"); String p = uri.getPath(); if (p.equals("")) throw new IllegalArgumentException("URI path component is empty"); // Okay, now initialize p = fs.fromURIPath(p); if (File.separatorChar != '/') p = p.replace('/', File.separatorChar); this.path = fs.normalize(p); this.prefixLength = fs.prefixLength(this.path); } /* -- Path-component accessors -- */ /** * Returns the name of the file or directory denoted by this abstract * pathname. This is just the last name in the pathname's name * sequence. If the pathname's name sequence is empty, then the empty * string is returned. * * @return The name of the file or directory denoted by this abstract * pathname, or the empty string if this pathname's name sequence * is empty */ public String getName() { int index = path.lastIndexOf(separatorChar); if (index < prefixLength) return path.substring(prefixLength); return path.substring(index + 1); } /** * Returns the pathname string of this abstract pathname's parent, or * <code>null</code> if this pathname does not name a parent directory. * * <p> The <em>parent</em> of an abstract pathname consists of the * pathname's prefix, if any, and each name in the pathname's name * sequence except for the last. If the name sequence is empty then * the pathname does not name a parent directory. * * @return The pathname string of the parent directory named by this * abstract pathname, or <code>null</code> if this pathname * does not name a parent */ public String getParent() { int index = path.lastIndexOf(separatorChar); if (index < prefixLength) { if ((prefixLength > 0) && (path.length() > prefixLength)) return path.substring(0, prefixLength); return null; } return path.substring(0, index); } /** * Returns the abstract pathname of this abstract pathname's parent, * or <code>null</code> if this pathname does not name a parent * directory. * * <p> The <em>parent</em> of an abstract pathname consists of the * pathname's prefix, if any, and each name in the pathname's name * sequence except for the last. If the name sequence is empty then * the pathname does not name a parent directory. * * @return The abstract pathname of the parent directory named by this * abstract pathname, or <code>null</code> if this pathname * does not name a parent * * @since 1.2 */ public File getParentFile() { String p = this.getParent(); if (p == null) return null; return new File(p, this.prefixLength); } /** * Converts this abstract pathname into a pathname string. The resulting * string uses the {@link #separator default name-separator character} to * separate the names in the name sequence. * * @return The string form of this abstract pathname */ public String getPath() { return path; } /* -- Path operations -- */ /** * Tests whether this abstract pathname is absolute. The definition of * absolute pathname is system dependent. On UNIX systems, a pathname is * absolute if its prefix is <code>"/"</code>. On Microsoft Windows systems, a * pathname is absolute if its prefix is a drive specifier followed by * <code>"\\"</code>, or if its prefix is <code>"\\\\"</code>. * * @return <code>true</code> if this abstract pathname is absolute, * <code>false</code> otherwise */ public boolean isAbsolute() { return fs.isAbsolute(this); } /** * Returns the absolute pathname string of this abstract pathname. * * <p> If this abstract pathname is already absolute, then the pathname * string is simply returned as if by the <code>{@link #getPath}</code> * method. If this abstract pathname is the empty abstract pathname then * the pathname string of the current user directory, which is named by the * system property <code>user.dir</code>, is returned. Otherwise this * pathname is resolved in a system-dependent way. On UNIX systems, a * relative pathname is made absolute by resolving it against the current * user directory. On Microsoft Windows systems, a relative pathname is made absolute * by resolving it against the current directory of the drive named by the * pathname, if any; if not, it is resolved against the current user * directory. * * @return The absolute pathname string denoting the same file or * directory as this abstract pathname * * @throws SecurityException * If a required system property value cannot be accessed. * * @see java.io.File#isAbsolute() */ public String getAbsolutePath() { return fs.resolve(this); } /** * Returns the absolute form of this abstract pathname. Equivalent to * <code>new&nbsp;File(this.{@link #getAbsolutePath})</code>. * * @return The absolute abstract pathname denoting the same file or * directory as this abstract pathname * * @throws SecurityException * If a required system property value cannot be accessed. * * @since 1.2 */ public File getAbsoluteFile() { String absPath = getAbsolutePath(); return new File(absPath, fs.prefixLength(absPath)); } /** * Returns the canonical pathname string of this abstract pathname. * * <p> A canonical pathname is both absolute and unique. The precise * definition of canonical form is system-dependent. This method first * converts this pathname to absolute form if necessary, as if by invoking the * {@link #getAbsolutePath} method, and then maps it to its unique form in a * system-dependent way. This typically involves removing redundant names * such as <tt>"."</tt> and <tt>".."</tt> from the pathname, resolving * symbolic links (on UNIX platforms), and converting drive letters to a * standard case (on Microsoft Windows platforms). * * <p> Every pathname that denotes an existing file or directory has a * unique canonical form. Every pathname that denotes a nonexistent file * or directory also has a unique canonical form. The canonical form of * the pathname of a nonexistent file or directory may be different from * the canonical form of the same pathname after the file or directory is * created. Similarly, the canonical form of the pathname of an existing * file or directory may be different from the canonical form of the same * pathname after the file or directory is deleted. * * @return The canonical pathname string denoting the same file or * directory as this abstract pathname * * @throws IOException * If an I/O error occurs, which is possible because the * construction of the canonical pathname may require * filesystem queries * * @throws SecurityException * If a required system property value cannot be accessed, or * if a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead}</code> method denies * read access to the file * * @since JDK1.1 * @see Path#toRealPath */ public String getCanonicalPath() throws IOException { return fs.canonicalize(fs.resolve(this)); } /** * Returns the canonical form of this abstract pathname. Equivalent to * <code>new&nbsp;File(this.{@link #getCanonicalPath})</code>. * * @return The canonical pathname string denoting the same file or * directory as this abstract pathname * * @throws IOException * If an I/O error occurs, which is possible because the * construction of the canonical pathname may require * filesystem queries * * @throws SecurityException * If a required system property value cannot be accessed, or * if a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead}</code> method denies * read access to the file * * @since 1.2 * @see Path#toRealPath */ public File getCanonicalFile() throws IOException { String canonPath = getCanonicalPath(); return new File(canonPath, fs.prefixLength(canonPath)); } private static String slashify(String path, boolean isDirectory) { String p = path; if (File.separatorChar != '/') p = p.replace(File.separatorChar, '/'); if (!p.startsWith("/")) p = "/" + p; if (!p.endsWith("/") && isDirectory) p = p + "/"; return p; } /** * Converts this abstract pathname into a <code>file:</code> URL. The * exact form of the URL is system-dependent. If it can be determined that * the file denoted by this abstract pathname is a directory, then the * resulting URL will end with a slash. * * @return A URL object representing the equivalent file URL * * @throws MalformedURLException * If the path cannot be parsed as a URL * * @see #toURI() * @see java.net.URI * @see java.net.URI#toURL() * @see java.net.URL * @since 1.2 * * @deprecated This method does not automatically escape characters that * are illegal in URLs. It is recommended that new code convert an * abstract pathname into a URL by first converting it into a URI, via the * {@link #toURI() toURI} method, and then converting the URI into a URL * via the {@link java.net.URI#toURL() URI.toURL} method. */ @Deprecated public URL toURL() throws MalformedURLException { return new URL("file", "", slashify(getAbsolutePath(), isDirectory())); } /** * Constructs a <tt>file:</tt> URI that represents this abstract pathname. * * <p> The exact form of the URI is system-dependent. If it can be * determined that the file denoted by this abstract pathname is a * directory, then the resulting URI will end with a slash. * * <p> For a given abstract pathname <i>f</i>, it is guaranteed that * * <blockquote><tt> * new {@link #File(java.net.URI) File}(</tt><i>&nbsp;f</i><tt>.toURI()).equals(</tt><i>&nbsp;f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}()) * </tt></blockquote> * * so long as the original abstract pathname, the URI, and the new abstract * pathname are all created in (possibly different invocations of) the same * Java virtual machine. Due to the system-dependent nature of abstract * pathnames, however, this relationship typically does not hold when a * <tt>file:</tt> URI that is created in a virtual machine on one operating * system is converted into an abstract pathname in a virtual machine on a * different operating system. * * <p> Note that when this abstract pathname represents a UNC pathname then * all components of the UNC (including the server name component) are encoded * in the {@code URI} path. The authority component is undefined, meaning * that it is represented as {@code null}. The {@link Path} class defines the * {@link Path#toUri toUri} method to encode the server name in the authority * component of the resulting {@code URI}. The {@link #toPath toPath} method * may be used to obtain a {@code Path} representing this abstract pathname. * * @return An absolute, hierarchical URI with a scheme equal to * <tt>"file"</tt>, a path representing this abstract pathname, * and undefined authority, query, and fragment components * @throws SecurityException If a required system property value cannot * be accessed. * * @see #File(java.net.URI) * @see java.net.URI * @see java.net.URI#toURL() * @since 1.4 */ public URI toURI() { try { File f = getAbsoluteFile(); String sp = slashify(f.getPath(), f.isDirectory()); if (sp.startsWith("//")) sp = "//" + sp; return new URI("file", null, sp, null); } catch (URISyntaxException x) { throw new Error(x); // Can't happen } } /* -- Attribute accessors -- */ /** * Tests whether the application can read the file denoted by this * abstract pathname. * * @return <code>true</code> if and only if the file specified by this * abstract pathname exists <em>and</em> can be read by the * application; <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file */ public boolean canRead() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return fs.checkAccess(this, FileSystem.ACCESS_READ); } /** * Tests whether the application can modify the file denoted by this * abstract pathname. * * @return <code>true</code> if and only if the file system actually * contains a file denoted by this abstract pathname <em>and</em> * the application is allowed to write to the file; * <code>false</code> otherwise. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file */ public boolean canWrite() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.checkAccess(this, FileSystem.ACCESS_WRITE); } /** * Tests whether the file or directory denoted by this abstract pathname * exists. * * @return <code>true</code> if and only if the file or directory denoted * by this abstract pathname exists; <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file or directory */ public boolean exists() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return ((fs.getBooleanAttributes(this) & FileSystem.BA_EXISTS) != 0); } /** * Tests whether the file denoted by this abstract pathname is a * directory. * * <p> Where it is required to distinguish an I/O exception from the case * that the file is not a directory, or where several attributes of the * same file are required at the same time, then the {@link * java.nio.file.Files#readAttributes(Path,Class,LinkOption[]) * Files.readAttributes} method may be used. * * @return <code>true</code> if and only if the file denoted by this * abstract pathname exists <em>and</em> is a directory; * <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file */ public boolean isDirectory() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return ((fs.getBooleanAttributes(this) & FileSystem.BA_DIRECTORY) != 0); } /** * Tests whether the file denoted by this abstract pathname is a normal * file. A file is <em>normal</em> if it is not a directory and, in * addition, satisfies other system-dependent criteria. Any non-directory * file created by a Java application is guaranteed to be a normal file. * * <p> Where it is required to distinguish an I/O exception from the case * that the file is not a normal file, or where several attributes of the * same file are required at the same time, then the {@link * java.nio.file.Files#readAttributes(Path,Class,LinkOption[]) * Files.readAttributes} method may be used. * * @return <code>true</code> if and only if the file denoted by this * abstract pathname exists <em>and</em> is a normal file; * <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file */ public boolean isFile() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return ((fs.getBooleanAttributes(this) & FileSystem.BA_REGULAR) != 0); } /** * Tests whether the file named by this abstract pathname is a hidden * file. The exact definition of <em>hidden</em> is system-dependent. On * UNIX systems, a file is considered to be hidden if its name begins with * a period character (<code>'.'</code>). On Microsoft Windows systems, a file is * considered to be hidden if it has been marked as such in the filesystem. * * @return <code>true</code> if and only if the file denoted by this * abstract pathname is hidden according to the conventions of the * underlying platform * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file * * @since 1.2 */ public boolean isHidden() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return ((fs.getBooleanAttributes(this) & FileSystem.BA_HIDDEN) != 0); } /** * Returns the time that the file denoted by this abstract pathname was * last modified. * * <p> Where it is required to distinguish an I/O exception from the case * where {@code 0L} is returned, or where several attributes of the * same file are required at the same time, or where the time of last * access or the creation time are required, then the {@link * java.nio.file.Files#readAttributes(Path,Class,LinkOption[]) * Files.readAttributes} method may be used. * * @return A <code>long</code> value representing the time the file was * last modified, measured in milliseconds since the epoch * (00:00:00 GMT, January 1, 1970), or <code>0L</code> if the * file does not exist or if an I/O error occurs * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file */ public long lastModified() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return fs.getLastModifiedTime(this); } /** * Returns the length of the file denoted by this abstract pathname. * The return value is unspecified if this pathname denotes a directory. * * <p> Where it is required to distinguish an I/O exception from the case * that {@code 0L} is returned, or where several attributes of the same file * are required at the same time, then the {@link * java.nio.file.Files#readAttributes(Path,Class,LinkOption[]) * Files.readAttributes} method may be used. * * @return The length, in bytes, of the file denoted by this abstract * pathname, or <code>0L</code> if the file does not exist. Some * operating systems may return <code>0L</code> for pathnames * denoting system-dependent entities such as devices or pipes. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method denies read access to the file */ public long length() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return fs.getLength(this); } /* -- File operations -- */ /** * Atomically creates a new, empty file named by this abstract pathname if * and only if a file with this name does not yet exist. The check for the * existence of the file and the creation of the file if it does not exist * are a single operation that is atomic with respect to all other * filesystem activities that might affect the file. * <P> * Note: this method should <i>not</i> be used for file-locking, as * the resulting protocol cannot be made to work reliably. The * {@link java.nio.channels.FileLock FileLock} * facility should be used instead. * * @return <code>true</code> if the named file does not exist and was * successfully created; <code>false</code> if the named file * already exists * * @throws IOException * If an I/O error occurred * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file * * @since 1.2 */ public boolean createNewFile() throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) security.checkWrite(path); return fs.createFileExclusively(path); } /** * Deletes the file or directory denoted by this abstract pathname. If * this pathname denotes a directory, then the directory must be empty in * order to be deleted. * * <p> Note that the {@link java.nio.file.Files} class defines the {@link * java.nio.file.Files#delete(Path) delete} method to throw an {@link IOException} * when a file cannot be deleted. This is useful for error reporting and to * diagnose why a file cannot be deleted. * * @return <code>true</code> if and only if the file or directory is * successfully deleted; <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkDelete}</code> method denies * delete access to the file */ public boolean delete() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkDelete(path); } return fs.delete(this); } /** * Requests that the file or directory denoted by this abstract * pathname be deleted when the virtual machine terminates. * Files (or directories) are deleted in the reverse order that * they are registered. Invoking this method to delete a file or * directory that is already registered for deletion has no effect. * Deletion will be attempted only for normal termination of the * virtual machine, as defined by the Java Language Specification. * * <p> Once deletion has been requested, it is not possible to cancel the * request. This method should therefore be used with care. * * <P> * Note: this method should <i>not</i> be used for file-locking, as * the resulting protocol cannot be made to work reliably. The * {@link java.nio.channels.FileLock FileLock} * facility should be used instead. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkDelete}</code> method denies * delete access to the file * * @see #delete * * @since 1.2 */ public void deleteOnExit() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkDelete(path); } DeleteOnExitHook.add(path); } /** * Returns an array of strings naming the files and directories in the * directory denoted by this abstract pathname. * * <p> If this abstract pathname does not denote a directory, then this * method returns {@code null}. Otherwise an array of strings is * returned, one for each file or directory in the directory. Names * denoting the directory itself and the directory's parent directory are * not included in the result. Each string is a file name rather than a * complete path. * * <p> There is no guarantee that the name strings in the resulting array * will appear in any specific order; they are not, in particular, * guaranteed to appear in alphabetical order. * * <p> Note that the {@link java.nio.file.Files} class defines the {@link * java.nio.file.Files#newDirectoryStream(Path) newDirectoryStream} method to * open a directory and iterate over the names of the files in the directory. * This may use less resources when working with very large directories, and * may be more responsive when working with remote directories. * * @return An array of strings naming the files and directories in the * directory denoted by this abstract pathname. The array will be * empty if the directory is empty. Returns {@code null} if * this abstract pathname does not denote a directory, or if an * I/O error occurs. * * @throws SecurityException * If a security manager exists and its {@link * SecurityManager#checkRead(String)} method denies read access to * the directory */ public String[] list() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkRead(path); } return fs.list(this); } /** * Returns an array of strings naming the files and directories in the * directory denoted by this abstract pathname that satisfy the specified * filter. The behavior of this method is the same as that of the * {@link #list()} method, except that the strings in the returned array * must satisfy the filter. If the given {@code filter} is {@code null} * then all names are accepted. Otherwise, a name satisfies the filter if * and only if the value {@code true} results when the {@link * FilenameFilter#accept FilenameFilter.accept(File,&nbsp;String)} method * of the filter is invoked on this abstract pathname and the name of a * file or directory in the directory that it denotes. * * @param filter * A filename filter * * @return An array of strings naming the files and directories in the * directory denoted by this abstract pathname that were accepted * by the given {@code filter}. The array will be empty if the * directory is empty or if no names were accepted by the filter. * Returns {@code null} if this abstract pathname does not denote * a directory, or if an I/O error occurs. * * @throws SecurityException * If a security manager exists and its {@link * SecurityManager#checkRead(String)} method denies read access to * the directory * * @see java.nio.file.Files#newDirectoryStream(Path,String) */ public String[] list(FilenameFilter filter) { String names[] = list(); if ((names == null) || (filter == null)) { return names; } List<String> v = new ArrayList<>(); for (int i = 0 ; i < names.length ; i++) { if (filter.accept(this, names[i])) { v.add(names[i]); } } return v.toArray(new String[v.size()]); } /** * Returns an array of abstract pathnames denoting the files in the * directory denoted by this abstract pathname. * * <p> If this abstract pathname does not denote a directory, then this * method returns {@code null}. Otherwise an array of {@code File} objects * is returned, one for each file or directory in the directory. Pathnames * denoting the directory itself and the directory's parent directory are * not included in the result. Each resulting abstract pathname is * constructed from this abstract pathname using the {@link #File(File, * String) File(File,&nbsp;String)} constructor. Therefore if this * pathname is absolute then each resulting pathname is absolute; if this * pathname is relative then each resulting pathname will be relative to * the same directory. * * <p> There is no guarantee that the name strings in the resulting array * will appear in any specific order; they are not, in particular, * guaranteed to appear in alphabetical order. * * <p> Note that the {@link java.nio.file.Files} class defines the {@link * java.nio.file.Files#newDirectoryStream(Path) newDirectoryStream} method * to open a directory and iterate over the names of the files in the * directory. This may use less resources when working with very large * directories. * * @return An array of abstract pathnames denoting the files and * directories in the directory denoted by this abstract pathname. * The array will be empty if the directory is empty. Returns * {@code null} if this abstract pathname does not denote a * directory, or if an I/O error occurs. * * @throws SecurityException * If a security manager exists and its {@link * SecurityManager#checkRead(String)} method denies read access to * the directory * * @since 1.2 */ public File[] listFiles() { String[] ss = list(); if (ss == null) return null; int n = ss.length; File[] fs = new File[n]; for (int i = 0; i < n; i++) { fs[i] = new File(ss[i], this); } return fs; } /** * Returns an array of abstract pathnames denoting the files and * directories in the directory denoted by this abstract pathname that * satisfy the specified filter. The behavior of this method is the same * as that of the {@link #listFiles()} method, except that the pathnames in * the returned array must satisfy the filter. If the given {@code filter} * is {@code null} then all pathnames are accepted. Otherwise, a pathname * satisfies the filter if and only if the value {@code true} results when * the {@link FilenameFilter#accept * FilenameFilter.accept(File,&nbsp;String)} method of the filter is * invoked on this abstract pathname and the name of a file or directory in * the directory that it denotes. * * @param filter * A filename filter * * @return An array of abstract pathnames denoting the files and * directories in the directory denoted by this abstract pathname. * The array will be empty if the directory is empty. Returns * {@code null} if this abstract pathname does not denote a * directory, or if an I/O error occurs. * * @throws SecurityException * If a security manager exists and its {@link * SecurityManager#checkRead(String)} method denies read access to * the directory * * @since 1.2 * @see java.nio.file.Files#newDirectoryStream(Path,String) */ public File[] listFiles(FilenameFilter filter) { String ss[] = list(); if (ss == null) return null; ArrayList<File> files = new ArrayList<>(); for (String s : ss) if ((filter == null) || filter.accept(this, s)) files.add(new File(s, this)); return files.toArray(new File[files.size()]); } /** * Returns an array of abstract pathnames denoting the files and * directories in the directory denoted by this abstract pathname that * satisfy the specified filter. The behavior of this method is the same * as that of the {@link #listFiles()} method, except that the pathnames in * the returned array must satisfy the filter. If the given {@code filter} * is {@code null} then all pathnames are accepted. Otherwise, a pathname * satisfies the filter if and only if the value {@code true} results when * the {@link FileFilter#accept FileFilter.accept(File)} method of the * filter is invoked on the pathname. * * @param filter * A file filter * * @return An array of abstract pathnames denoting the files and * directories in the directory denoted by this abstract pathname. * The array will be empty if the directory is empty. Returns * {@code null} if this abstract pathname does not denote a * directory, or if an I/O error occurs. * * @throws SecurityException * If a security manager exists and its {@link * SecurityManager#checkRead(String)} method denies read access to * the directory * * @since 1.2 * @see java.nio.file.Files#newDirectoryStream(Path,java.nio.file.DirectoryStream.Filter) */ public File[] listFiles(FileFilter filter) { String ss[] = list(); if (ss == null) return null; ArrayList<File> files = new ArrayList<>(); for (String s : ss) { File f = new File(s, this); if ((filter == null) || filter.accept(f)) files.add(f); } return files.toArray(new File[files.size()]); } /** * Creates the directory named by this abstract pathname. * * @return <code>true</code> if and only if the directory was * created; <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method does not permit the named directory to be created */ public boolean mkdir() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.createDirectory(this); } /** * Creates the directory named by this abstract pathname, including any * necessary but nonexistent parent directories. Note that if this * operation fails it may have succeeded in creating some of the necessary * parent directories. * * @return <code>true</code> if and only if the directory was created, * along with all necessary parent directories; <code>false</code> * otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkRead(java.lang.String)}</code> * method does not permit verification of the existence of the * named directory and all necessary parent directories; or if * the <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method does not permit the named directory and all necessary * parent directories to be created */ public boolean mkdirs() { if (exists()) { return false; } if (mkdir()) { return true; } File canonFile = null; try { canonFile = getCanonicalFile(); } catch (IOException e) { return false; } File parent = canonFile.getParentFile(); return (parent != null && (parent.mkdirs() || parent.exists()) && canonFile.mkdir()); } /** * Renames the file denoted by this abstract pathname. * * <p> Many aspects of the behavior of this method are inherently * platform-dependent: The rename operation might not be able to move a * file from one filesystem to another, it might not be atomic, and it * might not succeed if a file with the destination abstract pathname * already exists. The return value should always be checked to make sure * that the rename operation was successful. * * <p> Note that the {@link java.nio.file.Files} class defines the {@link * java.nio.file.Files#move move} method to move or rename a file in a * platform independent manner. * * @param dest The new abstract pathname for the named file * * @return <code>true</code> if and only if the renaming succeeded; * <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to either the old or new pathnames * * @throws NullPointerException * If parameter <code>dest</code> is <code>null</code> */ public boolean renameTo(File dest) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); security.checkWrite(dest.path); } return fs.rename(this, dest); } /** * Sets the last-modified time of the file or directory named by this * abstract pathname. * * <p> All platforms support file-modification times to the nearest second, * but some provide more precision. The argument will be truncated to fit * the supported precision. If the operation succeeds and no intervening * operations on the file take place, then the next invocation of the * <code>{@link #lastModified}</code> method will return the (possibly * truncated) <code>time</code> argument that was passed to this method. * * @param time The new last-modified time, measured in milliseconds since * the epoch (00:00:00 GMT, January 1, 1970) * * @return <code>true</code> if and only if the operation succeeded; * <code>false</code> otherwise * * @throws IllegalArgumentException If the argument is negative * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the named file * * @since 1.2 */ public boolean setLastModified(long time) { if (time < 0) throw new IllegalArgumentException("Negative time"); SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.setLastModifiedTime(this, time); } /** * Marks the file or directory named by this abstract pathname so that * only read operations are allowed. After invoking this method the file * or directory is guaranteed not to change until it is either deleted or * marked to allow write access. Whether or not a read-only file or * directory may be deleted depends upon the underlying system. * * @return <code>true</code> if and only if the operation succeeded; * <code>false</code> otherwise * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the named file * * @since 1.2 */ public boolean setReadOnly() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.setReadOnly(this); } /** * Sets the owner's or everybody's write permission for this abstract * pathname. * * <p> The {@link java.nio.file.Files} class defines methods that operate on * file attributes including file permissions. This may be used when finer * manipulation of file permissions is required. * * @param writable * If <code>true</code>, sets the access permission to allow write * operations; if <code>false</code> to disallow write operations * * @param ownerOnly * If <code>true</code>, the write permission applies only to the * owner's write permission; otherwise, it applies to everybody. If * the underlying file system can not distinguish the owner's write * permission from that of others, then the permission will apply to * everybody, regardless of this value. * * @return <code>true</code> if and only if the operation succeeded. The * operation will fail if the user does not have permission to change * the access permissions of this abstract pathname. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the named file * * @since 1.6 */ public boolean setWritable(boolean writable, boolean ownerOnly) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.setPermission(this, FileSystem.ACCESS_WRITE, writable, ownerOnly); } /** * A convenience method to set the owner's write permission for this abstract * pathname. * * <p> An invocation of this method of the form <tt>file.setWritable(arg)</tt> * behaves in exactly the same way as the invocation * * <pre> * file.setWritable(arg, true) </pre> * * @param writable * If <code>true</code>, sets the access permission to allow write * operations; if <code>false</code> to disallow write operations * * @return <code>true</code> if and only if the operation succeeded. The * operation will fail if the user does not have permission to * change the access permissions of this abstract pathname. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file * * @since 1.6 */ public boolean setWritable(boolean writable) { return setWritable(writable, true); } /** * Sets the owner's or everybody's read permission for this abstract * pathname. * * <p> The {@link java.nio.file.Files} class defines methods that operate on * file attributes including file permissions. This may be used when finer * manipulation of file permissions is required. * * @param readable * If <code>true</code>, sets the access permission to allow read * operations; if <code>false</code> to disallow read operations * * @param ownerOnly * If <code>true</code>, the read permission applies only to the * owner's read permission; otherwise, it applies to everybody. If * the underlying file system can not distinguish the owner's read * permission from that of others, then the permission will apply to * everybody, regardless of this value. * * @return <code>true</code> if and only if the operation succeeded. The * operation will fail if the user does not have permission to * change the access permissions of this abstract pathname. If * <code>readable</code> is <code>false</code> and the underlying * file system does not implement a read permission, then the * operation will fail. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file * * @since 1.6 */ public boolean setReadable(boolean readable, boolean ownerOnly) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.setPermission(this, FileSystem.ACCESS_READ, readable, ownerOnly); } /** * A convenience method to set the owner's read permission for this abstract * pathname. * * <p>An invocation of this method of the form <tt>file.setReadable(arg)</tt> * behaves in exactly the same way as the invocation * * <pre> * file.setReadable(arg, true) </pre> * * @param readable * If <code>true</code>, sets the access permission to allow read * operations; if <code>false</code> to disallow read operations * * @return <code>true</code> if and only if the operation succeeded. The * operation will fail if the user does not have permission to * change the access permissions of this abstract pathname. If * <code>readable</code> is <code>false</code> and the underlying * file system does not implement a read permission, then the * operation will fail. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file * * @since 1.6 */ public boolean setReadable(boolean readable) { return setReadable(readable, true); } /** * Sets the owner's or everybody's execute permission for this abstract * pathname. * * <p> The {@link java.nio.file.Files} class defines methods that operate on * file attributes including file permissions. This may be used when finer * manipulation of file permissions is required. * * @param executable * If <code>true</code>, sets the access permission to allow execute * operations; if <code>false</code> to disallow execute operations * * @param ownerOnly * If <code>true</code>, the execute permission applies only to the * owner's execute permission; otherwise, it applies to everybody. * If the underlying file system can not distinguish the owner's * execute permission from that of others, then the permission will * apply to everybody, regardless of this value. * * @return <code>true</code> if and only if the operation succeeded. The * operation will fail if the user does not have permission to * change the access permissions of this abstract pathname. If * <code>executable</code> is <code>false</code> and the underlying * file system does not implement an execute permission, then the * operation will fail. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file * * @since 1.6 */ public boolean setExecutable(boolean executable, boolean ownerOnly) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.setPermission(this, FileSystem.ACCESS_EXECUTE, executable, ownerOnly); } /** * A convenience method to set the owner's execute permission for this abstract * pathname. * * <p>An invocation of this method of the form <tt>file.setExcutable(arg)</tt> * behaves in exactly the same way as the invocation * * <pre> * file.setExecutable(arg, true) </pre> * * @param executable * If <code>true</code>, sets the access permission to allow execute * operations; if <code>false</code> to disallow execute operations * * @return <code>true</code> if and only if the operation succeeded. The * operation will fail if the user does not have permission to * change the access permissions of this abstract pathname. If * <code>executable</code> is <code>false</code> and the underlying * file system does not implement an excute permission, then the * operation will fail. * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method denies write access to the file * * @since 1.6 */ public boolean setExecutable(boolean executable) { return setExecutable(executable, true); } /** * Tests whether the application can execute the file denoted by this * abstract pathname. * * @return <code>true</code> if and only if the abstract pathname exists * <em>and</em> the application is allowed to execute the file * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkExec(java.lang.String)}</code> * method denies execute access to the file * * @since 1.6 */ public boolean canExecute() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkExec(path); } return fs.checkAccess(this, FileSystem.ACCESS_EXECUTE); } /* -- Filesystem interface -- */ /** * List the available filesystem roots. * * <p> A particular Java platform may support zero or more * hierarchically-organized file systems. Each file system has a * {@code root} directory from which all other files in that file system * can be reached. Windows platforms, for example, have a root directory * for each active drive; UNIX platforms have a single root directory, * namely {@code "/"}. The set of available filesystem roots is affected * by various system-level operations such as the insertion or ejection of * removable media and the disconnecting or unmounting of physical or * virtual disk drives. * * <p> This method returns an array of {@code File} objects that denote the * root directories of the available filesystem roots. It is guaranteed * that the canonical pathname of any file physically present on the local * machine will begin with one of the roots returned by this method. * * <p> The canonical pathname of a file that resides on some other machine * and is accessed via a remote-filesystem protocol such as SMB or NFS may * or may not begin with one of the roots returned by this method. If the * pathname of a remote file is syntactically indistinguishable from the * pathname of a local file then it will begin with one of the roots * returned by this method. Thus, for example, {@code File} objects * denoting the root directories of the mapped network drives of a Windows * platform will be returned by this method, while {@code File} objects * containing UNC pathnames will not be returned by this method. * * <p> Unlike most methods in this class, this method does not throw * security exceptions. If a security manager exists and its {@link * SecurityManager#checkRead(String)} method denies read access to a * particular root directory, then that directory will not appear in the * result. * * @return An array of {@code File} objects denoting the available * filesystem roots, or {@code null} if the set of roots could not * be determined. The array will be empty if there are no * filesystem roots. * * @since 1.2 * @see java.nio.file.FileStore */ public static File[] listRoots() { return fs.listRoots(); } /* -- Disk usage -- */ /** * Returns the size of the partition <a href="#partName">named</a> by this * abstract pathname. * * @return The size, in bytes, of the partition or <tt>0L</tt> if this * abstract pathname does not name a partition * * @throws SecurityException * If a security manager has been installed and it denies * {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt> * or its {@link SecurityManager#checkRead(String)} method denies * read access to the file named by this abstract pathname * * @since 1.6 */ public long getTotalSpace() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new RuntimePermission("getFileSystemAttributes")); sm.checkRead(path); } return fs.getSpace(this, FileSystem.SPACE_TOTAL); } /** * Returns the number of unallocated bytes in the partition <a * href="#partName">named</a> by this abstract path name. * * <p> The returned number of unallocated bytes is a hint, but not * a guarantee, that it is possible to use most or any of these * bytes. The number of unallocated bytes is most likely to be * accurate immediately after this call. It is likely to be made * inaccurate by any external I/O operations including those made * on the system outside of this virtual machine. This method * makes no guarantee that write operations to this file system * will succeed. * * @return The number of unallocated bytes on the partition <tt>0L</tt> * if the abstract pathname does not name a partition. This * value will be less than or equal to the total file system size * returned by {@link #getTotalSpace}. * * @throws SecurityException * If a security manager has been installed and it denies * {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt> * or its {@link SecurityManager#checkRead(String)} method denies * read access to the file named by this abstract pathname * * @since 1.6 */ public long getFreeSpace() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new RuntimePermission("getFileSystemAttributes")); sm.checkRead(path); } return fs.getSpace(this, FileSystem.SPACE_FREE); } /** * Returns the number of bytes available to this virtual machine on the * partition <a href="#partName">named</a> by this abstract pathname. When * possible, this method checks for write permissions and other operating * system restrictions and will therefore usually provide a more accurate * estimate of how much new data can actually be written than {@link * #getFreeSpace}. * * <p> The returned number of available bytes is a hint, but not a * guarantee, that it is possible to use most or any of these bytes. The * number of unallocated bytes is most likely to be accurate immediately * after this call. It is likely to be made inaccurate by any external * I/O operations including those made on the system outside of this * virtual machine. This method makes no guarantee that write operations * to this file system will succeed. * * @return The number of available bytes on the partition or <tt>0L</tt> * if the abstract pathname does not name a partition. On * systems where this information is not available, this method * will be equivalent to a call to {@link #getFreeSpace}. * * @throws SecurityException * If a security manager has been installed and it denies * {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt> * or its {@link SecurityManager#checkRead(String)} method denies * read access to the file named by this abstract pathname * * @since 1.6 */ public long getUsableSpace() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new RuntimePermission("getFileSystemAttributes")); sm.checkRead(path); } return fs.getSpace(this, FileSystem.SPACE_USABLE); } /* -- Temporary files -- */ private static class TempDirectory { private TempDirectory() { } // temporary directory location private static final File tmpdir = new File(fs.normalize(AccessController .doPrivileged(new GetPropertyAction("java.io.tmpdir")))); static File location() { return tmpdir; } // file name generation private static final SecureRandom random = new SecureRandom(); static File generateFile(String prefix, String suffix, File dir) { long n = random.nextLong(); if (n == Long.MIN_VALUE) { n = 0; // corner case } else { n = Math.abs(n); } return new File(dir, prefix + Long.toString(n) + suffix); } } /** * <p> Creates a new empty file in the specified directory, using the * given prefix and suffix strings to generate its name. If this method * returns successfully then it is guaranteed that: * * <ol> * <li> The file denoted by the returned abstract pathname did not exist * before this method was invoked, and * <li> Neither this method nor any of its variants will return the same * abstract pathname again in the current invocation of the virtual * machine. * </ol> * * This method provides only part of a temporary-file facility. To arrange * for a file created by this method to be deleted automatically, use the * <code>{@link #deleteOnExit}</code> method. * * <p> The <code>prefix</code> argument must be at least three characters * long. It is recommended that the prefix be a short, meaningful string * such as <code>"hjb"</code> or <code>"mail"</code>. The * <code>suffix</code> argument may be <code>null</code>, in which case the * suffix <code>".tmp"</code> will be used. * * <p> To create the new file, the prefix and the suffix may first be * adjusted to fit the limitations of the underlying platform. If the * prefix is too long then it will be truncated, but its first three * characters will always be preserved. If the suffix is too long then it * too will be truncated, but if it begins with a period character * (<code>'.'</code>) then the period and the first three characters * following it will always be preserved. Once these adjustments have been * made the name of the new file will be generated by concatenating the * prefix, five or more internally-generated characters, and the suffix. * * <p> If the <code>directory</code> argument is <code>null</code> then the * system-dependent default temporary-file directory will be used. The * default temporary-file directory is specified by the system property * <code>java.io.tmpdir</code>. On UNIX systems the default value of this * property is typically <code>"/tmp"</code> or <code>"/var/tmp"</code>; on * Microsoft Windows systems it is typically <code>"C:\\WINNT\\TEMP"</code>. A different * value may be given to this system property when the Java virtual machine * is invoked, but programmatic changes to this property are not guaranteed * to have any effect upon the temporary directory used by this method. * * @param prefix The prefix string to be used in generating the file's * name; must be at least three characters long * * @param suffix The suffix string to be used in generating the file's * name; may be <code>null</code>, in which case the * suffix <code>".tmp"</code> will be used * * @param directory The directory in which the file is to be created, or * <code>null</code> if the default temporary-file * directory is to be used * * @return An abstract pathname denoting a newly-created empty file * * @throws IllegalArgumentException * If the <code>prefix</code> argument contains fewer than three * characters * * @throws IOException If a file could not be created * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method does not allow a file to be created * * @since 1.2 */ public static File createTempFile(String prefix, String suffix, File directory) throws IOException { if (prefix.length() < 3) throw new IllegalArgumentException("Prefix string too short"); if (suffix == null) suffix = ".tmp"; File tmpdir = (directory != null) ? directory : TempDirectory.location(); SecurityManager sm = System.getSecurityManager(); File f; do { f = TempDirectory.generateFile(prefix, suffix, tmpdir); if (sm != null) { try { sm.checkWrite(f.getPath()); } catch (SecurityException se) { // don't reveal temporary directory location if (directory == null) throw new SecurityException("Unable to create temporary file"); throw se; } } } while (!fs.createFileExclusively(f.getPath())); return f; } /** * Creates an empty file in the default temporary-file directory, using * the given prefix and suffix to generate its name. Invoking this method * is equivalent to invoking <code>{@link #createTempFile(java.lang.String, * java.lang.String, java.io.File) * createTempFile(prefix,&nbsp;suffix,&nbsp;null)}</code>. * * <p> The {@link * java.nio.file.Files#createTempFile(String,String,java.nio.file.attribute.FileAttribute[]) * Files.createTempFile} method provides an alternative method to create an * empty file in the temporary-file directory. Files created by that method * may have more restrictive access permissions to files created by this * method and so may be more suited to security-sensitive applications. * * @param prefix The prefix string to be used in generating the file's * name; must be at least three characters long * * @param suffix The suffix string to be used in generating the file's * name; may be <code>null</code>, in which case the * suffix <code>".tmp"</code> will be used * * @return An abstract pathname denoting a newly-created empty file * * @throws IllegalArgumentException * If the <code>prefix</code> argument contains fewer than three * characters * * @throws IOException If a file could not be created * * @throws SecurityException * If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> * method does not allow a file to be created * * @since 1.2 * @see java.nio.file.Files#createTempDirectory(String,FileAttribute[]) */ public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); } /* -- Basic infrastructure -- */ /** * Compares two abstract pathnames lexicographically. The ordering * defined by this method depends upon the underlying system. On UNIX * systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows * systems it is not. * * @param pathname The abstract pathname to be compared to this abstract * pathname * * @return Zero if the argument is equal to this abstract pathname, a * value less than zero if this abstract pathname is * lexicographically less than the argument, or a value greater * than zero if this abstract pathname is lexicographically * greater than the argument * * @since 1.2 */ public int compareTo(File pathname) { return fs.compare(this, pathname); } /** * Tests this abstract pathname for equality with the given object. * Returns <code>true</code> if and only if the argument is not * <code>null</code> and is an abstract pathname that denotes the same file * or directory as this abstract pathname. Whether or not two abstract * pathnames are equal depends upon the underlying system. On UNIX * systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows * systems it is not. * * @param obj The object to be compared with this abstract pathname * * @return <code>true</code> if and only if the objects are the same; * <code>false</code> otherwise */ public boolean equals(Object obj) { if ((obj != null) && (obj instanceof File)) { return compareTo((File)obj) == 0; } return false; } /** * Computes a hash code for this abstract pathname. Because equality of * abstract pathnames is inherently system-dependent, so is the computation * of their hash codes. On UNIX systems, the hash code of an abstract * pathname is equal to the exclusive <em>or</em> of the hash code * of its pathname string and the decimal value * <code>1234321</code>. On Microsoft Windows systems, the hash * code is equal to the exclusive <em>or</em> of the hash code of * its pathname string converted to lower case and the decimal * value <code>1234321</code>. Locale is not taken into account on * lowercasing the pathname string. * * @return A hash code for this abstract pathname */ public int hashCode() { return fs.hashCode(this); } /** * Returns the pathname string of this abstract pathname. This is just the * string returned by the <code>{@link #getPath}</code> method. * * @return The string form of this abstract pathname */ public String toString() { return getPath(); } /** * WriteObject is called to save this filename. * The separator character is saved also so it can be replaced * in case the path is reconstituted on a different host type. * <p> * @serialData Default fields followed by separator character. */ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException { s.defaultWriteObject(); s.writeChar(this.separatorChar); // Add the separator character } /** * readObject is called to restore this filename. * The original separator character is read. If it is different * than the separator character on this system, then the old separator * is replaced by the local separator. */ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = s.readFields(); String pathField = (String)fields.get("path", null); char sep = s.readChar(); // read the previous separator char if (sep != separatorChar) pathField = pathField.replace(sep, separatorChar); this.path = fs.normalize(pathField); this.prefixLength = fs.prefixLength(this.path); } /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = 301077366599181567L; // -- Integration with java.nio.file -- private volatile transient Path filePath; /** * Returns a {@link Path java.nio.file.Path} object constructed from the * this abstract path. The resulting {@code Path} is associated with the * {@link java.nio.file.FileSystems#getDefault default-filesystem}. * * <p> The first invocation of this method works as if invoking it were * equivalent to evaluating the expression: * <blockquote><pre> * {@link java.nio.file.FileSystems#getDefault FileSystems.getDefault}().{@link * java.nio.file.FileSystem#getPath getPath}(this.{@link #getPath getPath}()); * </pre></blockquote> * Subsequent invocations of this method return the same {@code Path}. * * <p> If this abstract pathname is the empty abstract pathname then this * method returns a {@code Path} that may be used to access the current * user directory. * * @return a {@code Path} constructed from this abstract path * * @throws java.nio.file.InvalidPathException * if a {@code Path} object cannot be constructed from the abstract * path (see {@link java.nio.file.FileSystem#getPath FileSystem.getPath}) * * @since 1.7 * @see Path#toFile */ public Path toPath() { Path result = filePath; if (result == null) { synchronized (this) { result = filePath; if (result == null) { result = FileSystems.getDefault().getPath(path); filePath = result; } } } return result; } }
{ "pile_set_name": "Github" }
16000: 16001: 16002: 16003: 16004: 16005: 16006: 16007: 16008: 16009: 1600A: 1600B: 1600C: 1600D: 1600E: 1600F: 16010: 16011: 16012: 16013: 16014: 16015: 16016: 16017: 16018: 16019: 1601A: 1601B: 1601C: 1601D: 1601E: 1601F: 16020: 16021: 16022: 16023: 16024: 16025: 16026: 16027: 16028: 16029: 1602A: 1602B: 1602C: 1602D: 1602E: 1602F: 16030: 16031: 16032: 16033: 16034: 16035: 16036: 16037: 16038: 16039: 1603A: 1603B: 1603C: 1603D: 1603E: 1603F: 16040: 16041: 16042: 16043: 16044: 16045: 16046: 16047: 16048: 16049: 1604A: 1604B: 1604C: 1604D: 1604E: 1604F: 16050: 16051: 16052: 16053: 16054: 16055: 16056: 16057: 16058: 16059: 1605A: 1605B: 1605C: 1605D: 1605E: 1605F: 16060: 16061: 16062: 16063: 16064: 16065: 16066: 16067: 16068: 16069: 1606A: 1606B: 1606C: 1606D: 1606E: 1606F: 16070: 16071: 16072: 16073: 16074: 16075: 16076: 16077: 16078: 16079: 1607A: 1607B: 1607C: 1607D: 1607E: 1607F: 16080: 16081: 16082: 16083: 16084: 16085: 16086: 16087: 16088: 16089: 1608A: 1608B: 1608C: 1608D: 1608E: 1608F: 16090: 16091: 16092: 16093: 16094: 16095: 16096: 16097: 16098: 16099: 1609A: 1609B: 1609C: 1609D: 1609E: 1609F: 160A0: 160A1: 160A2: 160A3: 160A4: 160A5: 160A6: 160A7: 160A8: 160A9: 160AA: 160AB: 160AC: 160AD: 160AE: 160AF: 160B0: 160B1: 160B2: 160B3: 160B4: 160B5: 160B6: 160B7: 160B8: 160B9: 160BA: 160BB: 160BC: 160BD: 160BE: 160BF: 160C0: 160C1: 160C2: 160C3: 160C4: 160C5: 160C6: 160C7: 160C8: 160C9: 160CA: 160CB: 160CC: 160CD: 160CE: 160CF: 160D0: 160D1: 160D2: 160D3: 160D4: 160D5: 160D6: 160D7: 160D8: 160D9: 160DA: 160DB: 160DC: 160DD: 160DE: 160DF: 160E0: 160E1: 160E2: 160E3: 160E4: 160E5: 160E6: 160E7: 160E8: 160E9: 160EA: 160EB: 160EC: 160ED: 160EE: 160EF: 160F0: 160F1: 160F2: 160F3: 160F4: 160F5: 160F6: 160F7: 160F8: 160F9: 160FA: 160FB: 160FC: 160FD: 160FE: 160FF:
{ "pile_set_name": "Github" }
package sanitize import ( "fmt" "net" "net/url" "strings" log "github.com/sirupsen/logrus" ) // URL returns a function that sanitizes a URL string. It lets underspecified // strings to be converted to usable URLs via some default arguments. func URL(defaultScheme string, defaultPort int, defaultPath string) func(string) string { if defaultScheme == "" { defaultScheme = "http://" } return func(s string) string { if s == "" { return s // can't do much here } if !strings.Contains(s, "://") { s = defaultScheme + s } u, err := url.Parse(s) if err != nil { log.Errorf("%q: %v", s, err) return s // oh well } if _, port, err := net.SplitHostPort(u.Host); err != nil && defaultPort > 0 { u.Host += fmt.Sprintf(":%d", defaultPort) } else if port == "443" { if u.Scheme == "ws" { u.Scheme = "wss" } else { u.Scheme = "https" } } if defaultPath != "" && u.Path != defaultPath { u.Path = defaultPath } return u.String() } }
{ "pile_set_name": "Github" }
# Note: Check https://gradle.org/release-checksums/ before updating wrapper or distribution distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionSha256Sum=abc10bcedb58806e8654210f96031db541bcd2d6fc3161e81cb0572d6a15e821 distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
{ "pile_set_name": "Github" }
drop table tt;
{ "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. // // The following only applies to changes made to this file as part of YugaByte development. // // Portions Copyright (c) YugaByte, 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 org.yb.client; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import com.google.protobuf.UnsafeByteOperations; import org.yb.annotations.InterfaceAudience; import org.yb.master.Master; import org.yb.util.Pair; import org.jboss.netty.buffer.ChannelBuffer; /** * Package-private RPC that can only go to a master. */ @InterfaceAudience.Private class GetTableLocationsRequest extends YRpc<Master.GetTableLocationsResponsePB> { private final byte[] startPartitionKey; private final byte[] endKey; private final String tableId; GetTableLocationsRequest(YBTable table, byte[] startPartitionKey, byte[] endPartitionKey, String tableId) { super(table); if (startPartitionKey != null && endPartitionKey != null && Bytes.memcmp(startPartitionKey, endPartitionKey) > 0) { throw new IllegalArgumentException( "The start partition key must be smaller or equal to the end partition key"); } this.startPartitionKey = startPartitionKey; this.endKey = endPartitionKey; this.tableId = tableId; } @Override String serviceName() { return MASTER_SERVICE_NAME; } @Override String method() { return "GetTableLocations"; } @Override Pair<Master.GetTableLocationsResponsePB, Object> deserialize( final CallResponse callResponse, String tsUUID) throws Exception { Master.GetTableLocationsResponsePB.Builder builder = Master.GetTableLocationsResponsePB .newBuilder(); readProtobuf(callResponse.getPBMessage(), builder); Master.GetTableLocationsResponsePB resp = builder.build(); return new Pair<Master.GetTableLocationsResponsePB, Object>( resp, builder.hasError() ? builder.getError() : null); } @Override ChannelBuffer serialize(Message header) { final Master.GetTableLocationsRequestPB.Builder builder = Master .GetTableLocationsRequestPB.newBuilder(); builder.setTable(Master.TableIdentifierPB.newBuilder(). setTableId(ByteString.copyFromUtf8(tableId))); if (startPartitionKey != null) { builder.setPartitionKeyStart(UnsafeByteOperations.unsafeWrap(startPartitionKey)); } if (endKey != null) { builder.setPartitionKeyEnd(UnsafeByteOperations.unsafeWrap(endKey)); } return toChannelBuffer(header, builder.build()); } }
{ "pile_set_name": "Github" }
// Copyright 2019 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package procfs import ( "bytes" "fmt" "io/ioutil" "strconv" "strings" "github.com/prometheus/procfs/internal/util" ) // Crypto holds info parsed from /proc/crypto. type Crypto struct { Alignmask *uint64 Async bool Blocksize *uint64 Chunksize *uint64 Ctxsize *uint64 Digestsize *uint64 Driver string Geniv string Internal string Ivsize *uint64 Maxauthsize *uint64 MaxKeysize *uint64 MinKeysize *uint64 Module string Name string Priority *int64 Refcnt *int64 Seedsize *uint64 Selftest string Type string Walksize *uint64 } // Crypto parses an crypto-file (/proc/crypto) and returns a slice of // structs containing the relevant info. More information available here: // https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html func (fs FS) Crypto() ([]Crypto, error) { data, err := ioutil.ReadFile(fs.proc.Path("crypto")) if err != nil { return nil, fmt.Errorf("error parsing crypto %s: %s", fs.proc.Path("crypto"), err) } crypto, err := parseCrypto(data) if err != nil { return nil, fmt.Errorf("error parsing crypto %s: %s", fs.proc.Path("crypto"), err) } return crypto, nil } func parseCrypto(cryptoData []byte) ([]Crypto, error) { crypto := []Crypto{} cryptoBlocks := bytes.Split(cryptoData, []byte("\n\n")) for _, block := range cryptoBlocks { var newCryptoElem Crypto lines := strings.Split(string(block), "\n") for _, line := range lines { if strings.TrimSpace(line) == "" || line[0] == ' ' { continue } fields := strings.Split(line, ":") key := strings.TrimSpace(fields[0]) value := strings.TrimSpace(fields[1]) vp := util.NewValueParser(value) switch strings.TrimSpace(key) { case "async": b, err := strconv.ParseBool(value) if err == nil { newCryptoElem.Async = b } case "blocksize": newCryptoElem.Blocksize = vp.PUInt64() case "chunksize": newCryptoElem.Chunksize = vp.PUInt64() case "digestsize": newCryptoElem.Digestsize = vp.PUInt64() case "driver": newCryptoElem.Driver = value case "geniv": newCryptoElem.Geniv = value case "internal": newCryptoElem.Internal = value case "ivsize": newCryptoElem.Ivsize = vp.PUInt64() case "maxauthsize": newCryptoElem.Maxauthsize = vp.PUInt64() case "max keysize": newCryptoElem.MaxKeysize = vp.PUInt64() case "min keysize": newCryptoElem.MinKeysize = vp.PUInt64() case "module": newCryptoElem.Module = value case "name": newCryptoElem.Name = value case "priority": newCryptoElem.Priority = vp.PInt64() case "refcnt": newCryptoElem.Refcnt = vp.PInt64() case "seedsize": newCryptoElem.Seedsize = vp.PUInt64() case "selftest": newCryptoElem.Selftest = value case "type": newCryptoElem.Type = value case "walksize": newCryptoElem.Walksize = vp.PUInt64() } } crypto = append(crypto, newCryptoElem) } return crypto, nil }
{ "pile_set_name": "Github" }
package configs // TODO Windows: This can ultimately be entirely factored out on Windows as // cgroups are a Unix-specific construct. type Cgroup struct { }
{ "pile_set_name": "Github" }
package org.uma.jmetal.experimental.componentbasedalgorithm.catalogue.solutionscreation.impl; import org.uma.jmetal.experimental.componentbasedalgorithm.catalogue.solutionscreation.SolutionsCreation; import org.uma.jmetal.problem.doubleproblem.DoubleProblem; import org.uma.jmetal.solution.doublesolution.DoubleSolution; import org.uma.jmetal.solution.doublesolution.impl.DefaultDoubleSolution; import org.uma.jmetal.util.bounds.Bounds; import org.uma.jmetal.util.pseudorandom.JMetalRandom; import java.util.ArrayList; import java.util.List; public class ScatterSearchSolutionsCreation implements SolutionsCreation<DoubleSolution> { private final int numberOfSolutionsToCreate; private final DoubleProblem problem; private final int numberOfSubRanges; protected int[] sumOfFrequencyValues; protected int[] sumOfReverseFrequencyValues; protected int[][] frequency; protected int[][] reverseFrequency; public ScatterSearchSolutionsCreation( DoubleProblem problem, int numberOfSolutionsToCreate, int numberOfSubRanges) { this.problem = problem; this.numberOfSolutionsToCreate = numberOfSolutionsToCreate; this.numberOfSubRanges = numberOfSubRanges; sumOfFrequencyValues = new int[problem.getNumberOfVariables()]; sumOfReverseFrequencyValues = new int[problem.getNumberOfVariables()]; frequency = new int[numberOfSubRanges][problem.getNumberOfVariables()]; reverseFrequency = new int[numberOfSubRanges][problem.getNumberOfVariables()]; } public List<DoubleSolution> create() { List<DoubleSolution> solutionList = new ArrayList<>(numberOfSolutionsToCreate); for (int i = 0; i < numberOfSolutionsToCreate; i++) { List<Double> variables = generateVariables(); DoubleSolution newSolution = new DefaultDoubleSolution(problem.getNumberOfObjectives(), problem.getBoundsForVariables()); for (int j = 0; j < problem.getNumberOfVariables(); j++) { newSolution.setVariable(j, variables.get(j)); } solutionList.add(newSolution); } return solutionList; } private List<Double> generateVariables() { List<Double> vars = new ArrayList<>(problem.getNumberOfVariables()); double value; int range; for (int i = 0; i < problem.getNumberOfVariables(); i++) { sumOfReverseFrequencyValues[i] = 0; for (int j = 0; j < numberOfSubRanges; j++) { reverseFrequency[j][i] = sumOfFrequencyValues[i] - frequency[j][i]; sumOfReverseFrequencyValues[i] += reverseFrequency[j][i]; } if (sumOfReverseFrequencyValues[i] == 0) { range = JMetalRandom.getInstance().nextInt(0, numberOfSubRanges - 1); } else { value = JMetalRandom.getInstance().nextInt(0, sumOfReverseFrequencyValues[i] - 1); range = 0; while (value > reverseFrequency[range][i]) { value -= reverseFrequency[range][i]; range++; } } frequency[range][i]++; sumOfFrequencyValues[i]++; Bounds<Double> bounds = problem.getBoundsForVariables().get(i); Double lowerBound = bounds.getLowerBound(); Double upperBound = bounds.getUpperBound(); double low = lowerBound + range * (upperBound - lowerBound) / numberOfSubRanges; double high = low + (upperBound - lowerBound) / numberOfSubRanges; vars.add(i, JMetalRandom.getInstance().nextDouble(low, high)); } return vars; } }
{ "pile_set_name": "Github" }
/* Copyright 2009-2020 David Hadka * * This file is part of the MOEA Framework. * * The MOEA Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * The MOEA Framework 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 the MOEA Framework. If not, see <http://www.gnu.org/licenses/>. */ package org.moeaframework.util.statistics; import java.util.ArrayList; import java.util.List; /** * Abstract class for interval ratio statistical tests. */ public abstract class IntervalRatioStatisticalTest implements StatisticalTest { /** * The number of groups being tested. */ protected final int numberOfGroups; /** * Collection of all observations added to this test. */ protected final List<Observation> data; /** * Constructs an interval ratio statistical test with the specified number * of groups. * * @param numberOfGroups the number of groups being tested */ public IntervalRatioStatisticalTest(int numberOfGroups) { super(); this.numberOfGroups = numberOfGroups; data = new ArrayList<Observation>(); } /** * Adds a new observation with the specified value and group. * * @param value the value of the new observation * @param group the group to which the new observation belongs */ protected void add(double value, int group) { if ((group < 0) || (group >= numberOfGroups)) { throw new IllegalArgumentException("invalid group"); } data.add(new Observation(value, group)); } /** * Adds several new observations to the specified group. * * @param values the values of the new observations * @param group the group to which the new observations belong */ protected void addAll(double[] values, int group) { for (double value : values) { add(value, group); } } /** * Organizes the observations by their group. * * @return a list containing the vectorized values observed for each group */ protected List<double[]> categorize() { int[] n = new int[numberOfGroups]; for (Observation observation : data) { n[observation.getGroup()]++; } List<double[]> groupedData = new ArrayList<double[]>(); for (int i = 0; i < numberOfGroups; i++) { groupedData.add(new double[n[i]]); } for (Observation observation : data) { int group = observation.getGroup(); n[group]--; groupedData.get(group)[n[group]] = observation.getValue(); } return groupedData; } /** * Returns the number of groups being tested. * * @return the number of groups being tested */ public int getNumberOfGroups() { return numberOfGroups; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="wpt_voicerec">음성 녹음</string> <string name="wpt_stillimage">사진</string> </resources>
{ "pile_set_name": "Github" }
using Microsoft.DataTransfer.Basics; using System; namespace Microsoft.DataTransfer.Sql { sealed class Errors : CommonErrors { private Errors() { } public static Exception ConnectionStringMissing() { return new ArgumentException(Resources.ConnectionStringMissing); } public static Exception QueryMissing() { return new ArgumentException(Resources.QueryMissing); } public static Exception AmbiguousQuery() { return new ArgumentException(Resources.AmbiguousQuery); } public static Exception CircularArcGeometryNotSupported() { return new NotSupportedException(Resources.CircularArcGeometryNotSupported); } public static Exception ErrorLoadingNativeBinaries(string assemblyName, int errorCode) { return new Exception(FormatMessage(Resources.ErrorLoadingNativeBinariesFormat, assemblyName, errorCode)); } } }
{ "pile_set_name": "Github" }
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\SalesRule\Model\ResourceModel\Report\Rule; /** * Rule report resource model with aggregation by updated at * * @author Magento Core Team <[email protected]> */ class Updatedat extends \Magento\SalesRule\Model\ResourceModel\Report\Rule\Createdat { /** * Resource Report Rule constructor * * @return void */ protected function _construct() { $this->_init('salesrule_coupon_aggregated_updated', 'id'); } /** * Aggregate Coupons data by order updated at * * @param mixed|null $from * @param mixed|null $to * @return $this */ public function aggregate($from = null, $to = null) { return $this->_aggregateByOrder('updated_at', $from, $to); } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2017-2019 Dremio 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. */ package com.dremio.exec.store.hive.exec; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Queue; import java.util.Set; import org.apache.arrow.vector.ValueVector; import org.apache.hadoop.fs.FSError; import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; import org.apache.hadoop.hive.serde.serdeConstants; import org.apache.hadoop.hive.serde2.AbstractSerDe; import org.apache.hadoop.hive.serde2.SerDeException; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter; import org.apache.hadoop.hive.serde2.objectinspector.StructField; import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; import org.apache.hadoop.io.Writable; import org.apache.hadoop.mapred.FileSplit; import org.apache.hadoop.mapred.InputSplit; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.RecordReader; import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.security.UserGroupInformation; import com.dremio.common.expression.SchemaPath; import com.dremio.exec.store.ScanFilter; import com.dremio.exec.store.SplitAndPartitionInfo; import com.dremio.exec.store.hive.exec.apache.HadoopFileSystemWrapper; import com.dremio.hive.proto.HiveReaderProto.HiveTableXattr; import com.dremio.sabot.exec.context.OperatorContext; import com.dremio.sabot.exec.context.OperatorStats; import com.google.common.collect.Lists; public class HiveTextReader extends HiveAbstractReader { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HiveTextReader.class); private Object key; private SkipRecordsInspector skipRecordsInspector; private RecordReader<Object, Object> reader; // Converter which converts data from partition schema to table schema. protected Converter partTblObjectInspectorConverter; public HiveTextReader(final HiveTableXattr tableAttr, final SplitAndPartitionInfo split, final List<SchemaPath> projectedColumns, final OperatorContext context, final JobConf jobConf, final AbstractSerDe tableSerDe, final StructObjectInspector tableOI, final AbstractSerDe partitionSerDe, final StructObjectInspector partitionOI, final ScanFilter filter, final Collection<List<String>> referencedTables, final UserGroupInformation readerUgi) { super(tableAttr, split, projectedColumns, context, jobConf, tableSerDe, tableOI, partitionSerDe, partitionOI, filter, referencedTables, readerUgi); } @Override public void internalInit(InputSplit inputSplit, JobConf jobConf, ValueVector[] vectors) throws IOException { try (OperatorStats.WaitRecorder recorder = OperatorStats.getWaitRecorder(this.context.getStats())) { reader = jobConf.getInputFormat().getRecordReader(inputSplit, jobConf, Reporter.NULL); } catch(FSError e) { throw HadoopFileSystemWrapper.propagateFSError(e); } if(logger.isTraceEnabled()) { logger.trace("hive reader created: {} for inputSplit {}", reader.getClass().getName(), inputSplit.toString()); } key = reader.createKey(); final FileSplit fileSplit = (FileSplit)inputSplit; skipRecordsInspector = new SkipRecordsInspector(fileSplit.getStart(), jobConf, reader); if (!partitionOI.equals(finalOI)) { // If the partition and table have different schemas, create a converter partTblObjectInspectorConverter = ObjectInspectorConverters.getConverter(partitionOI, finalOI); } } @Override public int populateData() throws IOException, SerDeException { final SkipRecordsInspector skipRecordsInspector = this.skipRecordsInspector; final RecordReader<Object, Object> reader = this.reader; final Converter partTblObjectInspectorConverter = this.partTblObjectInspectorConverter; final Object key = this.key; final int numRowsPerBatch = (int) this.numRowsPerBatch; final StructField[] selectedStructFieldRefs = this.selectedStructFieldRefs; final AbstractSerDe partitionSerDe = this.partitionSerDe; final StructObjectInspector finalOI = this.finalOI; final ObjectInspector[] selectedColumnObjInspectors = this.selectedColumnObjInspectors; final HiveFieldConverter[] selectedColumnFieldConverters = this.selectedColumnFieldConverters; final ValueVector[] vectors = this.vectors; skipRecordsInspector.reset(); Object value; int recordCount = 0; while (recordCount < numRowsPerBatch) { try (OperatorStats.WaitRecorder recorder = OperatorStats.getWaitRecorder(this.context.getStats())) { boolean hasNext = reader.next(key, value = skipRecordsInspector.getNextValue()); if (!hasNext) { break; } } catch(FSError e) { throw HadoopFileSystemWrapper.propagateFSError(e); } if (skipRecordsInspector.doSkipHeader(recordCount++)) { continue; } Object bufferedValue = skipRecordsInspector.bufferAdd(value); if (bufferedValue != null) { Object deSerializedValue = partitionSerDe.deserialize((Writable) bufferedValue); if (partTblObjectInspectorConverter != null) { deSerializedValue = partTblObjectInspectorConverter.convert(deSerializedValue); } for (int i = 0; i < selectedStructFieldRefs.length; i++) { Object hiveValue = finalOI.getStructFieldData(deSerializedValue, selectedStructFieldRefs[i]); if (hiveValue != null) { selectedColumnFieldConverters[i].setSafeValue(selectedColumnObjInspectors[i], hiveValue, vectors[i], skipRecordsInspector.getActualCount()); } } skipRecordsInspector.incrementActualCount(); } skipRecordsInspector.incrementTempCount(); } for (int i = 0; i < selectedStructFieldRefs.length; i++) { vectors[i].setValueCount(skipRecordsInspector.getActualCount()); } skipRecordsInspector.updateContinuance(); return skipRecordsInspector.getActualCount(); } /** * SkipRecordsInspector encapsulates logic to skip header and footer from * file. Logic is applicable only for predefined in constructor file formats. */ private static final class SkipRecordsInspector { private final Set<Object> fileFormats; private int headerCount; private int footerCount; private Queue<Object> footerBuffer; // indicates if we continue reading the same file private boolean continuance; private int holderIndex; private List<Object> valueHolder; private int actualCount; // actualCount without headerCount, used to determine holderIndex private int tempCount; protected SkipRecordsInspector(final long startOffsetOfSplit, final JobConf jobConf, RecordReader reader) { /* for file read in multiple splits, header will be skipped only by reader working on first split */ this.fileFormats = new HashSet<>(Arrays.asList(org.apache.hadoop.mapred.TextInputFormat.class.getName())); this.headerCount = startOffsetOfSplit == 0 ? retrievePositiveIntProperty(jobConf, serdeConstants.HEADER_COUNT, 0) : 0; /* todo: fix the skip footer problem with multiple splits */ this.footerCount = retrievePositiveIntProperty(jobConf, serdeConstants.FOOTER_COUNT, 0); logger.debug("skipRecordInspector: fileFormat {}, headerCount {}, footerCount {}", this.fileFormats, this.headerCount, this.footerCount); this.footerBuffer = Lists.newLinkedList(); this.continuance = false; this.holderIndex = -1; this.valueHolder = initializeValueHolder(reader, footerCount); this.actualCount = 0; this.tempCount = 0; } protected boolean doSkipHeader(int recordCount) { return !continuance && recordCount < headerCount; } protected void reset() { tempCount = holderIndex + 1; actualCount = 0; if (!continuance) { footerBuffer.clear(); } } protected Object bufferAdd(Object value) throws SerDeException { footerBuffer.add(value); if (footerBuffer.size() <= footerCount) { return null; } return footerBuffer.poll(); } protected Object getNextValue() { holderIndex = tempCount % getHolderSize(); return valueHolder.get(holderIndex); } private int getHolderSize() { return valueHolder.size(); } protected void updateContinuance() { this.continuance = actualCount != 0; } protected int incrementTempCount() { return ++tempCount; } protected int getActualCount() { return actualCount; } protected int incrementActualCount() { return ++actualCount; } /** * Retrieves positive numeric property from Properties object by name. * Return default value if 1. file format is absent in predefined file * formats list 2. property doesn't exist in table properties 3. property * value is negative otherwise casts value to int. * * @param jobConf * property holder * @param propertyName * name of the property * @param defaultValue * default value * @return property numeric value * @throws NumberFormatException * if property value is non-numeric */ protected int retrievePositiveIntProperty(JobConf jobConf, String propertyName, int defaultValue) { int propertyIntValue = defaultValue; if (!fileFormats.contains(jobConf.get(hive_metastoreConstants.FILE_INPUT_FORMAT))) { return propertyIntValue; } Object propertyObject = jobConf.get(propertyName); if (propertyObject != null) { try { propertyIntValue = Integer.valueOf((String) propertyObject); } catch (NumberFormatException e) { throw new NumberFormatException(String.format("Hive table property %s value '%s' is non-numeric", propertyName, propertyObject.toString())); } } return propertyIntValue < 0 ? defaultValue : propertyIntValue; } /** * Creates buffer of objects to be used as values, so these values can be * re-used. Objects number depends on number of lines to skip in the end of * the file plus one object. * * @param reader * RecordReader to return value object * @param skipFooterLines * number of lines to skip at the end of the file * @return list of objects to be used as values */ private List<Object> initializeValueHolder(RecordReader reader, int skipFooterLines) { List<Object> valueHolder = new ArrayList<>(skipFooterLines + 1); for (int i = 0; i <= skipFooterLines; i++) { valueHolder.add(reader.createValue()); } return valueHolder; } } @Override public void close() throws IOException { if (reader != null) { try (OperatorStats.WaitRecorder recorder = OperatorStats.getWaitRecorder(this.context.getStats())) { reader.close(); } catch(FSError e) { throw HadoopFileSystemWrapper.propagateFSError(e); } reader = null; } this.partTblObjectInspectorConverter = null; super.close(); } }
{ "pile_set_name": "Github" }
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/core/kernels/cwise_ops_common.h" namespace tensorflow { REGISTER5(BinaryOp, CPU, "Div", functor::div, float, Eigen::half, double, complex64, complex128); REGISTER4(BinaryOp, CPU, "Div", functor::safe_div, uint8, int16, int32, int64); #if GOOGLE_CUDA REGISTER6(BinaryOp, GPU, "Div", functor::div, float, Eigen::half, double, uint8, int16, int64); // A special GPU kernel for int32. // TODO(b/25387198): Also enable int32 in device memory. This kernel // registration requires all int32 inputs and outputs to be in host memory. REGISTER_KERNEL_BUILDER(Name("Div") .Device(DEVICE_GPU) .HostMemory("x") .HostMemory("y") .HostMemory("z") .TypeConstraint<int32>("T"), BinaryOp<CPUDevice, functor::safe_div<int32>>); #endif } // namespace tensorflow
{ "pile_set_name": "Github" }
.. toctree:: Introduction ----------- The following links describe a set of basic PCL tutorials. Please note that their source codes may already be provided as part of the PCL regular releases, so check there before you start copy & pasting the code. The list of tutorials below is automatically generated from reST files located in our git repository. .. note:: Before you start reading, please make sure that you go through the higher-level overview documentation at http://www.pointclouds.org/documentation/, under **Getting Started**. Thank you. As always, we would be happy to hear your comments and receive your contributions on any tutorial. .. _basic_usage: Basic Usage ----------- * :ref:`walkthrough` ====== ====== |mi_0| Title: **PCL Functionality Walkthrough** Author: *Razvan G. Mihalyi* Compatibility: > PCL 1.6 Takes the reader through all of the PCL modules and offers basic explanations on their functionalities. ====== ====== .. |mi_0| image:: images/pcl_logo.png :height: 75px * :ref:`basic_structures` ====== ====== |mi_1| Title: **Getting Started / Basic Structures** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 Presents the basic data structures in PCL and discusses their usage with a simple code example. ====== ====== .. |mi_1| image:: images/pcl_logo.png :height: 75px * :ref:`using_pcl_pcl_config` ====== ====== |mi_2| Title: **Using PCL in your own project** Author: *Nizar Sallem* Compatibility: > PCL 1.0 In this tutorial, we will learn how to link your own project to PCL using cmake. ====== ====== .. |mi_2| image:: images/pcl_logo.png :height: 75px * :ref:`compiling_pcl_posix` ======= ====== |mi_11| Title: **Compiling PCL from source on POSIX compliant systems** Author: *Victor Lamoine* Compatibility: > PCL 1.0 In this tutorial, we will explain how to compile PCL from sources on POSIX/Unix systems. ======= ====== .. |mi_11| image:: images/pcl_logo.png :height: 120px * :ref:`building_pcl` ====== ====== |mi_3| Title: **Explaining PCL's cmake options** Author: *Nizar Sallem* Compatibility: > PCL 1.0 In this tutorial, we will explain the basic PCL cmake options, and ways to tweak them to fit your project. ====== ====== .. |mi_3| image:: images/pcl_ccmake.png :height: 100px * :ref:`compiling_pcl_dependencies_windows` ====== ====== |mi_4| Title: **Compiling PCL's dependencies from source on Windows** Authors: *Alessio Placitelli* and *Mourad Boufarguine* Compatibility: > PCL 1.0 In this tutorial, we will explain how to compile PCL's 3rd party dependencies from source on Microsoft Windows. ====== ====== .. |mi_4| image:: images/windows_logo.png :height: 100px * :ref:`compiling_pcl_windows` ====== ====== |mi_5| Title: **Compiling PCL on Windows** Author: *Mourad Boufarguine* Compatibility: > PCL 1.0 In this tutorial, we will explain how to compile PCL on Microsoft Windows. ====== ====== .. |mi_5| image:: images/windows_logo.png :height: 100px * :ref:`compiling_pcl_macosx` ====== ====== |mi_6| Title: **Compiling PCL and its dependencies from MacPorts and source on Mac OS X** Author: *Justin Rosen* Compatibility: > PCL 1.0 This tutorial explains how to build the Point Cloud Library **from MacPorts and source** on Mac OS X platforms. ====== ====== .. |mi_6| image:: images/macosx_logo.png :height: 100px * :ref:`installing_homebrew` ====== ====== |mi_7| Title: **Installing on Mac OS X using Homebrew** Author: *Geoffrey Biggs* Compatibility: > PCL 1.2 This tutorial explains how to install the Point Cloud Library on Mac OS X using Homebrew. Both direct installation and compiling PCL from source are explained. ====== ====== .. |mi_7| image:: images/macosx_logo.png :height: 100px * :ref:`using_pcl_with_eclipse` ====== ====== |mi_8| Title: **Using Eclipse as your PCL editor** Author: *Koen Buys* Compatibility: PCL git master This tutorial shows you how to get your PCL as a project in Eclipse. ====== ====== .. |mi_8| image:: images/pcl_with_eclipse/eclipse.png :height: 100px * :ref:`generate_local_doc` ======= ====== |mi_11| Title: **Generate a local documentation for PCL** Author: *Victor Lamoine* Compatibility: PCL > 1.0 This tutorial shows you how to generate and use a local documentation for PCL. ======= ====== .. |mi_11| image:: images/pcl_logo.png :height: 75px * :ref:`matrix_transform` ======= ====== |mi_10| Title: **Using matrixes to transform a point cloud** Author: *Victor Lamoine* Compatibility: > PCL 1.5 This tutorial shows you how to transform a point cloud using a matrix. ======= ====== .. |mi_10| image:: images/matrix_transform/cube.png :height: 120px .. _advanced_usage: Advanced Usage -------------- * :ref:`adding_custom_ptype` ====== ====== |au_1| Title: **Adding your own custom PointT point type** Author: *Radu B. Rusu* Compatibility: > PCL 0.9, < PCL 2.0 This document explains what templated point types are in PCL, why do they exist, and how to create and use your own `PointT` point type. ====== ====== .. |au_1| image:: images/pcl_logo.png :height: 75px * :ref:`writing_new_classes` ====== ====== |au_2| Title: **Writing a new PCL class** Author: *Radu B. Rusu, Luca Penasa* Compatibility: > PCL 0.9, < PCL 2.0 This short guide is to serve as both a HowTo and a FAQ for writing new PCL classes, either from scratch, or by adapting old code. ====== ====== .. |au_2| image:: images/pcl_logo.png :height: 75px .. _features_tutorial: Features -------- * :ref:`how_3d_features_work` ====== ====== |fe_1| Title: **How 3D features work** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 This document presents a basic introduction to the 3D feature estimation methodologies in PCL. ====== ====== .. |fe_1| image:: images/good_features_small.jpg :height: 100px * :ref:`normal_estimation` ====== ====== |fe_2| Title: **Estimating Surface Normals in a PointCloud** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 This tutorial discusses the theoretical and implementation details of the surface normal estimation module in PCL. ====== ====== .. |fe_2| image:: images/normal_estimation.png :height: 100px * :ref:`normal_estimation_using_integral_images` ====== ====== |fe_3| Title: **Normal Estimation Using Integral Images** Author: *Stefan Holzer* Compatibility: > PCL 1.0 In this tutorial we will learn how to compute normals for an organized point cloud using integral images. ====== ====== .. |fe_3| image:: images/normal_estimation_ii.png :height: 100px * :ref:`pfh_estimation` ====== ====== |fe_4| Title: **Point Feature Histograms (PFH) descriptors** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 This tutorial introduces a family of 3D feature descriptors called PFH (Point Feature Histograms) and discusses their implementation details from PCL's perspective. ====== ====== .. |fe_4| image:: images/pfh_estimation.png :height: 100px * :ref:`fpfh_estimation` ====== ====== |fe_5| Title: **Fast Point Feature Histograms (FPFH) descriptors** Author: *Radu B. Rusu* Compatibility: > PCL 1.3 This tutorial introduces the FPFH (Fast Point Feature Histograms) 3D descriptor and discusses their implementation details from PCL's perspective. ====== ====== .. |fe_5| image:: images/fpfh_estimation.jpg :height: 100px * :ref:`vfh_estimation` ====== ====== |fe_6| Title: **Estimating VFH signatures for a set of points** Author: *Radu B. Rusu* Compatibility: > PCL 0.8 This document describes the Viewpoint Feature Histogram (VFH) descriptor, a novel representation for point clusters for the problem of Cluster (e.g., Object) Recognition and 6DOF Pose Estimation. ====== ====== .. |fe_6| image:: images/vfh_estimation.png :height: 100px * :ref:`narf_feature_extraction` ====== ====== |fe_7| Title: **How to extract NARF features from a range image** Author: *Bastian Steder* Compatibility: > 1.3 In this tutorial, we will learn how to extract NARF features from a range image. ====== ====== .. |fe_7| image:: images/narf_keypoint_extraction.png :height: 100px * :ref:`moment_of_inertia` ====== ====== |fe_8| Title: **Moment of inertia and eccentricity based descriptors** Author: *Sergey Ushakov* Compatibility: > PCL 1.7 In this tutorial we will learn how to compute moment of inertia and eccentricity of the cloud. In addition to this we will learn how to extract AABB and OBB. ====== ====== .. |fe_8| image:: images/moment_of_inertia.png :height: 100px * :ref:`rops_feature` ====== ====== |fe_9| Title: **RoPs (Rotational Projection Statistics) feature** Author: *Sergey Ushakov* Compatibility: > PCL 1.7 In this tutorial we will learn how to compute RoPS feature. ====== ====== .. |fe_9| image:: images/rops_feature.png :height: 100px * :ref:`gasd_estimation` ======= ====== |fe_10| Title: **Globally Aligned Spatial Distribution (GASD) descriptors** Author: *Joao Paulo Lima* Compatibility: >= PCL 1.9 This document describes the Globally Aligned Spatial Distribution (GASD) global descriptor to be used for efficient object recognition and pose estimation. ======= ====== .. |fe_10| image:: images/gasd_estimation.png :height: 100px .. _filtering_tutorial: Filtering --------- * :ref:`passthrough` ====== ====== |fi_1| Title: **Filtering a PointCloud using a PassThrough filter** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to remove points whose values fall inside/outside a user given interval along a specified dimension. ====== ====== .. |fi_1| image:: images/passthrough.png :height: 100px * :ref:`voxelgrid` ====== ====== |fi_2| Title: **Downsampling a PointCloud using a VoxelGrid filter** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to downsample (i.e., reduce the number of points) a Point Cloud. ====== ====== .. |fi_2| image:: images/voxel_grid.jpg :height: 100px * :ref:`statistical_outlier_removal` ====== ====== |fi_3| Title: **Removing sparse outliers using StatisticalOutlierRemoval** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to remove sparse outliers from noisy data, using StatisticalRemoval. ====== ====== .. |fi_3| image:: images/statistical_removal.jpg :height: 100px * :ref:`project_inliers` ====== ====== |fi_4| Title: **Projecting points using a parametric model** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to project points to a parametric model (i.e., plane). ====== ====== .. |fi_4| image:: images/project_inliers.png :height: 100px * :ref:`extract_indices` ====== ====== |fi_5| Title: **Extracting indices from a PointCloud** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to extract a set of indices given by a segmentation algorithm. ====== ====== .. |fi_5| image:: images/extract_indices.jpg :height: 100px * :ref:`remove_outliers` ====== ====== |fi_6| Title: **Removing outliers using a Conditional or RadiusOutlier removal** Author: *Gabe O'Leary* Compatibility: > PCL 1.0 In this tutorial, we will learn how to remove outliers from noisy data, using ConditionalRemoval, RadiusOutlierRemoval. ====== ====== .. |fi_6| image:: images/radius_outlier.png :height: 100px .. _i_o: I/O --- * :ref:`pcd_file_format` ====== ====== |i_o0| Title: **The PCD (Point Cloud Data) file format** Author: *Radu B. Rusu* Compatibility: > PCL 0.9 This document describes the PCD file format, and the way it is used inside PCL. ====== ====== .. |i_o0| image:: images/PCD_icon.png :height: 100px * :ref:`reading_pcd` ====== ====== |i_o1| Title: **Reading Point Cloud data from PCD files** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to read a Point Cloud from a PCD file. ====== ====== .. |i_o1| image:: images/read_pcd.jpg :height: 100px * :ref:`writing_pcd` ====== ====== |i_o2| Title: **Writing Point Cloud data to PCD files** Author: *Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to write a Point Cloud to a PCD file. ====== ====== .. |i_o2| image:: images/write_pcd.jpg :height: 100px * :ref:`concatenate_clouds` ====== ====== |i_o3| Title: **Concatenate the fields or points of two Point Clouds** Author: *Gabe O'Leary / Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial, we will learn how to concatenate both the fields and the point data of two Point Clouds. When concatenating fields, one PointClouds contains only *XYZ* data, and the other contains *Surface Normal* information. ====== ====== .. |i_o3| image:: images/concatenate_fields.jpg :height: 100px * :ref:`openni_grabber` ====== ====== |i_o4| Title: **Grabbing Point Clouds from an OpenNI camera** Author: *Nico Blodow* Compatibility: > PCL 1.0 In this tutorial, we will learn how to acquire point cloud data from an OpenNI camera. ====== ====== .. |i_o4| image:: images/openni_grabber.png :height: 100px * :ref:`hdl_grabber` ====== ====== |i_o5| Title: **Grabbing Point Clouds from a Velodyne High Definition LiDAR (HDL)** Author: *Keven Ring* Compatibility: >= PCL 1.7 In this tutorial, we will learn how to acquire point cloud data from a Velodyne HDL. ====== ====== .. |i_o5| image:: images/hdl_grabber.png :height: 100px * :ref:`dinast_grabber` ====== ====== |i_o6| Title: **Grabbing Point Clouds from Dinast Cameras** Author: *Marco A. Gutierrez* Compatibility: >= PCL 1.7 In this tutorial, we will learn how to acquire point cloud data from a Dinast camera. ====== ====== .. |i_o6| image:: images/dinast_cyclopes.png :height: 100px * :ref:`ensenso_cameras` ====== ====== |i_o7| Title: **Grabbing point clouds from Ensenso cameras** Author: *Victor Lamoine* Compatibility: >= PCL 1.8.0 In this tutorial, we will learn how to acquire point cloud data from an IDS-Imaging Ensenso camera. ====== ====== .. |i_o7| image:: images/ensenso/ids.png :height: 165px * :ref:`david_sdk` ====== ====== |i_o8| Title: **Grabbing point clouds / meshes from davidSDK scanners** Author: *Victor Lamoine* Compatibility: >= PCL 1.8.0 In this tutorial, we will learn how to acquire point cloud or mesh data from a davidSDK scanner. ====== ====== .. |i_o8| image:: images/davidsdk/david.png :height: 70px * :ref:`depth_sense_grabber` ====== ====== |i_o9| Title: **Grabbing point clouds from DepthSense cameras** Author: *Sergey Alexandrov* Compatibility: >= PCL 1.8.0 In this tutorial we will learn how to setup and use DepthSense cameras within PCL on both Linux and Windows platforms. ====== ====== .. |i_o9| image:: images/creative_camera.jpg :height: 70px .. _keypoints_tutorial: Keypoints --------- * :ref:`narf_keypoint_extraction` ====== ====== |kp_1| Title: **How to extract NARF keypoints from a range image** Author: *Bastian Steder* Compatibility: > 1.3 In this tutorial, we will learn how to extract NARF keypoints from a range image. ====== ====== .. |kp_1| image:: images/narf_keypoint_extraction.png :height: 100px .. _kdtree_tutorial: KdTree ------ * :ref:`kdtree_search` ====== ====== |kd_1| Title: **KdTree Search** Author: *Gabe O'Leary* Compatibility: > PCL 1.0 In this tutorial, we will learn how to search using the nearest neighbor method for k-d trees ====== ====== .. |kd_1| image:: images/kdtree_search.png :height: 100px .. _octree_tutorial: Octree ------ * :ref:`octree_compression` ====== ====== |oc_1| Title: **Point cloud compression** Author: *Julius Kammerl* Compatibility: > PCL 1.0 In this tutorial, we will learn how to compress a single point cloud and streams of point clouds. ====== ====== .. |oc_1| image:: images/compression_tutorial.png :height: 100px * :ref:`octree_search` ====== ====== |oc_2| Title: **Octrees for spatial partitioning and neighbor search** Author: *Julius Kammerl* Compatibility: > PCL 1.0 In this tutorial, we will learn how to use octrees for spatial partitioning and nearest neighbor search. ====== ====== .. |oc_2| image:: images/octree_img.png :height: 100px * :ref:`octree_change_detection` ====== ====== |oc_3| Title: **Spatial change detection on unorganized point cloud data** Author: *Julius Kammerl* Compatibility: > PCL 1.0 In this tutorial, we will learn how to use octrees for detecting spatial changes within point clouds. ====== ====== .. |oc_3| image:: images/changedetectionThumb.png :height: 100px .. _range_images: Range Images ------------ * :ref:`range_image_creation` ====== ====== |ri_1| Title: **Creating Range Images from Point Clouds** Author: *Bastian Steder* Compatibility: > PCL 1.0 This tutorial demonstrates how to create a range image from a point cloud and a given sensor position. ====== ====== .. |ri_1| image:: images/range_image_visualization.png :height: 100px * :ref:`range_image_border_extraction` ====== ====== |ri_2| Title: **Extracting borders from Range Images** Author: *Bastian Steder* Compatibility: > PCL 1.3 This tutorial demonstrates how to extract borders (traversals from foreground to background) from a range image. ====== ====== .. |ri_2| image:: images/range_image_border_points.png :height: 100px .. _recognition_tutorial: Recognition ----------- * :ref:`correspondence_grouping` ====== ====== |rc_1| Title: **The PCL Recognition API** Author: *Tommaso Cavallari, Federico Tombari* Compatibility: > PCL 1.6 This tutorial aims at explaining how to perform 3D Object Recognition based on the pcl_recognition module. ====== ====== .. |rc_1| image:: images/correspondence_grouping/correspondence_grouping.jpg :height: 100px * :ref:`implicit_shape_model` ====== ====== |rc_2| Title: **Implicit Shape Model** Author: *Sergey Ushakov* Compatibility: > PCL 1.7 In this tutorial we will learn how the Implicit Shape Model algorithm works and how to use it for finding objects centers. ====== ====== .. |rc_2| image:: images/implicit_shape_model.png :height: 100px * :ref:`global_hypothesis_verification` ====== ====== |rc_3| Title: **Hypothesis Verification for 3D Object Recognition** Author: *Daniele De Gregorio, Federico Tombari* Compatibility: > PCL 1.7 This tutorial aims at explaining how to do 3D object recognition in clutter by verifying model hypotheses in cluttered and heavily occluded 3D scenes. ====== ====== .. |rc_3| image:: images/global_hypothesis_verification/multiple.png :height: 100px .. _registration_tutorial: Registration ------------ * :ref:`registration_api` ====== ====== |re_1| Title: **The PCL Registration API** Author: *Dirk Holz, Radu B. Rusu, Jochen Sprickerhof* Compatibility: > PCL 1.5 In this document, we describe the point cloud registration API and its modules: the estimation and rejection of point correspondences, and the estimation of rigid transformations. ====== ====== .. |re_1| image:: images/registration/registration_api.png :height: 100px * :ref:`iterative_closest_point` ====== ====== |re_2| Title: **How to use iterative closest point algorithm** Author: *Gabe O'Leary* Compatibility: > PCL 1.0 This tutorial gives an example of how to use the iterative closest point algorithm to see if one PointCloud is just a rigid transformation of another PointCloud. ====== ====== .. |re_2| image:: images/iterative_closest_point.gif :height: 100px * :ref:`pairwise_incremental_registration` ====== ====== |re_3| Title: **How to incrementally register pairs of clouds** Author: *Raphael Favier* Compatibility: > PCL 1.4 This document demonstrates using the Iterative Closest Point algorithm in order to incrementally register a series of point clouds two by two. ====== ====== .. |re_3| image:: images/iterative_closest_point.gif :height: 100px * :ref:`interactive_icp` ====== ====== |re_7| Title: **Interactive ICP** Author: *Victor Lamoine* Compatibility: > PCL 1.5 This tutorial will teach you how to build an interactive ICP program ====== ====== .. |re_7| image:: images/interactive_icp/monkey.png :height: 120px * :ref:`normal_distributions_transform` ====== ====== |re_4| Title: **How to use the Normal Distributions Transform algorithm** Author: *Brian Okorn* Compatibility: > PCL 1.6 This document demonstrates using the Normal Distributions Transform algorithm to register two large point clouds. ====== ====== .. |re_4| image:: images/normal_distributions_transform.gif :height: 100px * :ref:`in_hand_scanner` ====== ====== |re_5| Title: **How to use the In-hand scanner for small objects** Author: *Martin Saelzle* Compatibility: >= PCL 1.7 This document shows how to use the In-hand scanner applications to obtain colored models of small objects with RGB-D cameras. ====== ====== .. |re_5| image:: images/ihs_lion_model.png :height: 100px * :ref:`alignment_prerejective` ====== ====== |re_6| Title: **Robust pose estimation of rigid objects** Author: *Anders Glent Buch* Compatibility: >= PCL 1.7 In this tutorial, we show how to find the alignment pose of a rigid object in a scene with clutter and occlusions. ====== ====== .. |re_6| image:: images/alignment_prerejective_1.png :height: 100px .. _sample_consensus: Sample Consensus ---------------- * :ref:`random_sample_consensus` ====== ====== |sc_1| Title: **How to use Random Sample Consensus model** Author: *Gabe O'Leary* Compatibility: > PCL 1.0 In this tutorial we learn how to use a RandomSampleConsensus with a plane model to obtain the cloud fitting to this model. ====== ====== .. |sc_1| image:: images/ransac_outliers_plane.png :height: 100px .. _segmentation_tutorial: Segmentation ------------ * :ref:`planar_segmentation` ====== ====== |se_1| Title: **Plane model segmentation** Author: *Radu B. Rusu* Compatibility: > PCL 1.3 In this tutorial, we will learn how to segment arbitrary plane models from a given point cloud dataset. ====== ====== .. |se_1| image:: images/planar_segmentation.jpg :height: 100px * :ref:`cylinder_segmentation` ====== ====== |se_2| Title: **Cylinder model segmentation** Author: *Radu B. Rusu* Compatibility: > PCL 1.3 In this tutorial, we will learn how to segment arbitrary cylindrical models from a given point cloud dataset. ====== ====== .. |se_2| image:: images/cylinder_segmentation.jpg :height: 100px * :ref:`cluster_extraction` ====== ====== |se_3| Title: **Euclidean Cluster Extraction** Author: *Serkan Tuerker* Compatibility: > PCL 1.3 In this tutorial we will learn how to extract Euclidean clusters with the ``pcl::EuclideanClusterExtraction`` class. ====== ====== .. |se_3| image:: images/cluster_extraction.jpg :height: 100px * :ref:`region_growing_segmentation` ====== ====== |se_4| Title: **Region Growing Segmentation** Author: *Sergey Ushakov* Compatibility: >= PCL 1.7 In this tutorial we will learn how to use region growing segmentation algorithm. ====== ====== .. |se_4| image:: images/region_growing_segmentation.jpg :height: 100px * :ref:`region_growing_rgb_segmentation` ====== ====== |se_5| Title: **Color-based Region Growing Segmentation** Author: *Sergey Ushakov* Compatibility: >= PCL 1.7 In this tutorial we will learn how to use color-based region growing segmentation algorithm. ====== ====== .. |se_5| image:: images/region_growing_rgb_segmentation.jpg :height: 100px * :ref:`min_cut_segmentation` ====== ====== |se_6| Title: **Min-Cut Based Segmentation** Author: *Sergey Ushakov* Compatibility: >= PCL 1.7 In this tutorial we will learn how to use min-cut based segmentation algorithm. ====== ====== .. |se_6| image:: images/min_cut_segmentation.jpg :height: 100px * :ref:`conditional_euclidean_clustering` ====== ====== |se_7| Title: **Conditional Euclidean Clustering** Author: *Frits Florentinus* Compatibility: >= PCL 1.7 This tutorial describes how to use the Conditional Euclidean Clustering class in PCL: A segmentation algorithm that clusters points based on Euclidean distance and a user-customizable condition that needs to hold. ====== ====== .. |se_7| image:: images/conditional_euclidean_clustering.jpg :height: 100px * :ref:`don_segmentation` ====== ====== |se_8| Title: **Difference of Normals Based Segmentation** Author: *Yani Ioannou* Compatibility: >= PCL 1.7 In this tutorial we will learn how to use the difference of normals feature for segmentation. ====== ====== .. |se_8| image:: images/don_segmentation.png :height: 100px * :ref:`supervoxel_clustering` ====== ====== |se_9| Title: **Supervoxel Clustering** Author: *Jeremie Papon* Compatibility: >= PCL 1.8 In this tutorial, we show to break a pointcloud into the mid-level supervoxel representation. ====== ====== .. |se_9| image:: images/supervoxel_clustering_small.png :height: 100px * :ref:`progressive_morphological_filtering` ======= ====== |se_10| Title: **Progressive Morphological Filtering** Author: *Brad Chambers* Compatibility: >= PCL 1.8 In this tutorial, we show how to segment a point cloud into ground and non-ground returns. ======= ====== .. |se_10| image:: images/progressive_morphological_filter.png :height: 100px * :ref:`model_outlier_removal` ======= ====== |se_11| Title: **Model outlier removal** Author: *Timo Häckel* Compatibility: >= PCL 1.7.2 This tutorial describes how to extract points from a point cloud using SAC models ======= ====== .. |se_11| image:: images/pcl_logo.png :height: 75px .. _surface_tutorial: Surface ------- * :ref:`moving_least_squares` ====== ====== |su_1| Title: **Smoothing and normal estimation based on polynomial reconstruction** Author: *Zoltan-Csaba Marton, Alexandru E. Ichim* Compatibility: > PCL 1.6 In this tutorial, we will learn how to construct and run a Moving Least Squares (MLS) algorithm to obtain smoothed XYZ coordinates and normals. ====== ====== .. |su_1| image:: images/resampling.jpg :height: 100px * :ref:`hull_2d` ====== ====== |su_2| Title: **Construct a concave or convex hull polygon for a plane model** Author: *Gabe O'Leary, Radu B. Rusu* Compatibility: > PCL 1.0 In this tutorial we will learn how to calculate a simple 2D concave or convex hull polygon for a set of points supported by a plane. ====== ====== .. |su_2| image:: images/convex_hull_2d.jpg :height: 100px * :ref:`greedy_triangulation` ====== ====== |su_3| Title: **Fast triangulation of unordered point clouds** Author: *Zoltan-Csaba Marton* Compatibility: > PCL 1.0 In this tutorial we will learn how to run a greedy triangulation algorithm on a PointCloud with normals to obtain a triangle mesh based on projections of the local neighborhood. ====== ====== .. |su_3| image:: images/greedy_triangulation.png :height: 100px * :ref:`bspline_fitting` ====== ====== |su_4| Title: **Fitting trimmed B-splines to unordered point clouds** Author: *Thomas Mörwald* Compatibility: > PCL 1.7 In this tutorial we will learn how to reconstruct a smooth surface from an unordered point-cloud by fitting trimmed B-splines. ====== ====== .. |su_4| image:: images/bspline_bunny.png :height: 100px .. _visualization_tutorial: Visualization ------------- * :ref:`cloud_viewer` ====== ====== |vi_1| Title: **Visualizing Point Clouds** Author: *Ethan Rublee* Compatibility: > PCL 1.0 This tutorial demonstrates how to use the pcl visualization tools. ====== ====== .. |vi_1| image:: images/cloud_viewer.jpg :height: 100px * :ref:`range_image_visualization` ====== ====== |vi_2| Title: **Visualizing Range Images** Author: *Bastian Steder* Compatibility: > PCL 1.3 This tutorial demonstrates how to use the pcl visualization tools for range images. ====== ====== .. |vi_2| image:: images/range_image_visualization.png :height: 100px * :ref:`pcl_visualizer` ====== ====== |vi_3| Title: **PCLVisualizer** Author: *Geoffrey Biggs* Compatibility: > PCL 1.3 This tutorial demonstrates how to use the PCLVisualizer class for powerful visualisation of point clouds and related data. ====== ====== .. |vi_3| image:: images/pcl_visualizer_viewports.png :height: 100px * :ref:`pcl_plotter` ====== ====== |vi_4| Title: **PCLPlotter** Author: *Kripasindhu Sarkar* Compatibility: > PCL 1.7 This tutorial demonstrates how to use the PCLPlotter class for powerful visualisation of plots, charts and histograms of raw data and explicit functions. ====== ====== .. |vi_4| image:: images/pcl_plotter_comprational.png :height: 100px * :ref:`visualization` ====== ====== |vi_5| Title: **PCL Visualization overview** Author: *Radu B. Rusu* Compatibility: >= PCL 1.0 This tutorial will give an overview on the usage of the PCL visualization tools. ====== ====== .. |vi_5| image:: images/visualization_small.png :height: 120px * :ref:`qt_visualizer` ====== ====== |vi_6| Title: **Create a PCL visualizer in Qt with cmake** Author: *Victor Lamoine* Compatibility: > PCL 1.5 This tutorial shows you how to create a PCL visualizer within a Qt application. ====== ====== .. |vi_6| image:: images/qt_visualizer/qt.png :height: 128px * :ref:`qt_colorize_cloud` ====== ====== |vi_7| Title: **Create a PCL visualizer in Qt to colorize clouds** Author: *Victor Lamoine* Compatibility: > PCL 1.5 This tutorial shows you how to color point clouds within a Qt application. ====== ====== .. |vi_7| image:: images/qt_visualizer/qt.png :height: 128px .. _applications_tutorial: Applications ------------ * :ref:`template_alignment` ====== ====== |ap_1| Title: **Aligning object templates to a point cloud** Author: *Michael Dixon* Compatibility: > PCL 1.3 This tutorial gives an example of how some of the tools covered in the previous tutorials can be combined to solve a higher level problem --- aligning a previously captured model of an object to some newly captured data. ====== ====== .. |ap_1| image:: images/template_alignment_1.jpg :height: 100px * :ref:`vfh_recognition` ====== ====== |ap_2| Title: **Cluster Recognition and 6DOF Pose Estimation using VFH descriptors** Author: *Radu B. Rusu* Compatibility: > PCL 0.8 In this tutorial we show how the Viewpoint Feature Histogram (VFH) descriptor can be used to recognize similar clusters in terms of their geometry. ====== ====== .. |ap_2| image:: images/vfh_recognition.jpg :height: 100px * :ref:`mobile_streaming` ====== ====== |ap_3| Title: **Point Cloud Streaming to Mobile Devices with Real-time Visualization** Author: *Pat Marion* Compatibility: > PCL 1.3 This tutorial describes how to send point cloud data over the network from a desktop server to a client running on a mobile device. ====== ====== .. |ap_3| image:: images/mobile_streaming_1.jpg :height: 100px * :ref:`ground_based_rgbd_people_detection` ====== ====== |ap_5| Title: **Detecting people on a ground plane with RGB-D data** Author: *Matteo Munaro* Compatibility: >= PCL 1.7 This tutorial presents a method for detecting people on a ground plane with RGB-D data. ====== ====== .. |ap_5| image:: images/ground_based_rgbd_people_detection/Index_photo.jpg :height: 120px .. _gpu: GPU --- * :ref:`gpu_install` ====== ====== |gp_1| Title: **GPU Installation** Author: *Koen Buys* Compatibility: PCL git master This tutorial explains how to configure PCL to use with a Nvidia GPU ====== ====== .. |gp_1| image:: images/PCD_icon.png :height: 100px * :ref:`using_kinfu_large_scale` ====== ====== |ap_4| Title: **Using Kinfu Large Scale to generate a textured mesh** Author: *Francisco Heredia and Raphael Favier* Compatibility: PCL git master This tutorial demonstrates how to use KinFu Large Scale to produce a mesh from a room, and apply texture information in post-processing for a more appealing visual result. ====== ====== .. |ap_4| image:: images/using_kinfu_large_scale.jpg :height: 100px * :ref:`gpu_people` ====== ====== |gp_2| Title: **People Detection** Author: *Koen Buys* Compatibility: PCL git master This tutorial presents a method for people and pose detection. ====== ====== .. |gp_2| image:: images/gpu/people/c2_100.jpg :height: 100px .. * :ref:`normal_estimation_integral_images` Surface normal estimation * Range Image * :ref:`range_image_visualization` How to visualize a range image * :ref:`range_image_creation` How to create a range image from a point cloud * :ref:`range_image_border_extraction` How to extract borders from range images * :ref:`narf_keypoint` How to extract NARF keypoints from a range image * :ref:`narf_descriptor` How to extract NARF descriptors from points in a range images * :ref:`octree_search` Octrees for spatial partitioning and neighbor search.
{ "pile_set_name": "Github" }
import logging from .base import BaseVisualizer LOG = logging.getLogger(__name__) class Occupancy(BaseVisualizer): show = False def __init__(self, *, field_names=None): super().__init__('occupancy') self.field_names = field_names def predicted(self, occupancy): if not self.show: return for f in self.indices: LOG.debug('%d (field name: %s)', f, self.field_names[f] if self.field_names else 'unknown') # occupancy maps are at a reduced scale wrt the processed image # pylint: disable=unsubscriptable-object reduced_image = self._processed_image[::occupancy.reduction, ::occupancy.reduction] with self.image_canvas(reduced_image) as ax: occ = occupancy.occupancy[f].copy() occ[occ > 0] = 1.0 ax.imshow(occ, alpha=0.7)
{ "pile_set_name": "Github" }
gcr.io/google_containers/conformance-arm:v1.14.10-beta.0
{ "pile_set_name": "Github" }
/* YUI 3.7.3 (build 5687) Copyright 2012 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('anim-easing', function (Y, NAME) { /* TERMS OF USE - EASING EQUATIONS Open source under the BSD License. Copyright 2001 Robert Penner All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * The easing module provides methods for customizing * how an animation behaves during each run. * @class Easing * @module anim * @submodule anim-easing */ var Easing = { /** * Uniform speed between points. * @for Easing * @method easeNone * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeNone: function (t, b, c, d) { return c*t/d + b; }, /** * Begins slowly and accelerates towards end. (quadratic) * @method easeIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeIn: function (t, b, c, d) { return c*(t/=d)*t + b; }, /** * Begins quickly and decelerates towards end. (quadratic) * @method easeOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeOut: function (t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, /** * Begins slowly and decelerates towards end. (quadratic) * @method easeBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeBoth: function (t, b, c, d) { if ((t/=d/2) < 1) { return c/2*t*t + b; } return -c/2 * ((--t)*(t-2) - 1) + b; }, /** * Begins slowly and accelerates towards end. (quartic) * @method easeInStrong * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeInStrong: function (t, b, c, d) { return c*(t/=d)*t*t*t + b; }, /** * Begins quickly and decelerates towards end. (quartic) * @method easeOutStrong * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeOutStrong: function (t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, /** * Begins slowly and decelerates towards end. (quartic) * @method easeBothStrong * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeBothStrong: function (t, b, c, d) { if ((t/=d/2) < 1) { return c/2*t*t*t*t + b; } return -c/2 * ((t-=2)*t*t*t - 2) + b; }, /** * Snap in elastic effect. * @method elasticIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} a Amplitude (optional) * @param {Number} p Period (optional) * @return {Number} The computed value for the current animation frame */ elasticIn: function (t, b, c, d, a, p) { var s; if (t === 0) { return b; } if ( (t /= d) === 1 ) { return b+c; } if (!p) { p = d* 0.3; } if (!a || a < Math.abs(c)) { a = c; s = p/4; } else { s = p/(2*Math.PI) * Math.asin (c/a); } return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, /** * Snap out elastic effect. * @method elasticOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} a Amplitude (optional) * @param {Number} p Period (optional) * @return {Number} The computed value for the current animation frame */ elasticOut: function (t, b, c, d, a, p) { var s; if (t === 0) { return b; } if ( (t /= d) === 1 ) { return b+c; } if (!p) { p=d * 0.3; } if (!a || a < Math.abs(c)) { a = c; s = p / 4; } else { s = p/(2*Math.PI) * Math.asin (c/a); } return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, /** * Snap both elastic effect. * @method elasticBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} a Amplitude (optional) * @param {Number} p Period (optional) * @return {Number} The computed value for the current animation frame */ elasticBoth: function (t, b, c, d, a, p) { var s; if (t === 0) { return b; } if ( (t /= d/2) === 2 ) { return b+c; } if (!p) { p = d*(0.3*1.5); } if ( !a || a < Math.abs(c) ) { a = c; s = p/4; } else { s = p/(2*Math.PI) * Math.asin (c/a); } if (t < 1) { return -0.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; } return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*0.5 + c + b; }, /** * Backtracks slightly, then reverses direction and moves to end. * @method backIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} s Overshoot (optional) * @return {Number} The computed value for the current animation frame */ backIn: function (t, b, c, d, s) { if (s === undefined) { s = 1.70158; } if (t === d) { t -= 0.001; } return c*(t/=d)*t*((s+1)*t - s) + b; }, /** * Overshoots end, then reverses and comes back to end. * @method backOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} s Overshoot (optional) * @return {Number} The computed value for the current animation frame */ backOut: function (t, b, c, d, s) { if (typeof s === 'undefined') { s = 1.70158; } return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, /** * Backtracks slightly, then reverses direction, overshoots end, * then reverses and comes back to end. * @method backBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} s Overshoot (optional) * @return {Number} The computed value for the current animation frame */ backBoth: function (t, b, c, d, s) { if (typeof s === 'undefined') { s = 1.70158; } if ((t /= d/2 ) < 1) { return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; } return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, /** * Bounce off of start. * @method bounceIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ bounceIn: function (t, b, c, d) { return c - Y.Easing.bounceOut(d-t, 0, c, d) + b; }, /** * Bounces off end. * @method bounceOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ bounceOut: function (t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + 0.75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + 0.9375) + b; } return c*(7.5625*(t-=(2.625/2.75))*t + 0.984375) + b; }, /** * Bounces off start and end. * @method bounceBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ bounceBoth: function (t, b, c, d) { if (t < d/2) { return Y.Easing.bounceIn(t * 2, 0, c, d) * 0.5 + b; } return Y.Easing.bounceOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b; } }; Y.Easing = Easing; }, '3.7.3', {"requires": ["anim-base"]});
{ "pile_set_name": "Github" }
/* * Copyright 2000-2009 JetBrains s.r.o. * * 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.intellij.util; import com.intellij.openapi.project.Project; import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.ParameterizedCachedValue; import com.intellij.psi.util.ParameterizedCachedValueProvider; import org.jetbrains.annotations.NotNull; public class ParameterizedCachedValueImpl<T,P> extends CachedValueBase<T> implements ParameterizedCachedValue<T,P> { @NotNull private final Project myProject; private final ParameterizedCachedValueProvider<T,P> myProvider; ParameterizedCachedValueImpl(@NotNull Project project, @NotNull ParameterizedCachedValueProvider<T, P> provider, boolean trackValue) { super(trackValue); myProject = project; myProvider = provider; } @Override public T getValue(P param) { return getValueWithLock(param); } @Override public boolean isFromMyProject(@NotNull Project project) { return myProject == project; } @Override @NotNull public ParameterizedCachedValueProvider<T,P> getValueProvider() { return myProvider; } @Override protected <X> CachedValueProvider.Result<T> doCompute(X param) { return myProvider.compute((P)param); } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2013 - 2014 Alexander "Evisceration" Martinz * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package org.namelessrom.devicecontrol.actions.cpu; import android.text.TextUtils; import org.namelessrom.devicecontrol.actions.ActionProcessor; import org.namelessrom.devicecontrol.actions.BaseAction; import org.namelessrom.devicecontrol.models.BootupConfig; import org.namelessrom.devicecontrol.models.DeviceConfig; import org.namelessrom.devicecontrol.modules.bootup.BootupItem; import org.namelessrom.devicecontrol.modules.cpu.CpuUtils; import org.namelessrom.devicecontrol.utils.Utils; import at.amartinz.execution.Command; import at.amartinz.execution.RootShell; import at.amartinz.hardware.cpu.CpuReader; public class CpuGovAction extends BaseAction { public static final String NAME = "cpu_governor"; public int id = -1; public String trigger = ""; public String value = ""; public boolean bootup = false; public CpuGovAction(final String value, final boolean bootup) { super(); this.value = value; this.bootup = bootup; } @Override public String getName() { return NAME; } @Override public String getCategory() { return ActionProcessor.CATEGORY_CPU; } @Override public String getTrigger() { return trigger; } @Override public String getValue() { return value; } @Override public boolean getBootup() { return bootup; } @Override protected void setupAction() { // TODO: what? } @Override public void triggerAction() { if (TextUtils.isEmpty(value)) { return; } final boolean lockGov = DeviceConfig.get().perfCpuGovLock; final int cpus = CpuReader.readAvailableCores(); final StringBuilder sb = new StringBuilder(cpus * 2); final BootupConfig configuration = BootupConfig.get(); String path; for (int i = 0; i < cpus; i++) { if (i != 0) { sb.append(CpuUtils.get().onlineCpu(i)); } path = CpuReader.getPathCoreGov(i); sb.append(Utils.getWriteCommand(path, value)); if (bootup) { configuration.addItem(new BootupItem(BootupConfig.CATEGORY_CPU, "cpu_gov" + i, path, value, true)); } if (lockGov) { sb.append(Utils.lockFile(path)); } } configuration.save(); RootShell.fireAndForget(new Command(sb.toString())); } }
{ "pile_set_name": "Github" }
{ "asset":{ "version":2 }, "materials":[ { "extensions":{ "KHR_techniques_webgl":{ "technique":"builtin/meshbasic.shader.json", "values":{ "diffuse":[ 1, 1, 1 ], "opacity":1, "map":"Library/UnityWhite.image.json", "uvTransform":[ 1, 0, 0, 0, 1, 0, 0, 0, 1 ] } }, "paper":{ "renderQueue":2000, "defines":[ "USE_MAP" ] } } } ], "extensionsRequired":[ "KHR_techniques_webgl", "paper" ], "extensionsUsed":[ "KHR_techniques_webgl", "paper" ], "version":4}
{ "pile_set_name": "Github" }
hqxSharp is a C# port of hqx, a fast, high-quality magnification filter designed for pixel art. Copyright (C) 2003 Maxim Stepin ([email protected]) Copyright (C) 2010 Cameron Zemek ([email protected]) Copyright (C) 2011, 2012 Tamme Schichler ([email protected]) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
{ "pile_set_name": "Github" }
// CMSDAS11DijetAnalyzer.cc // Description: A basic dijet analyzer for the CMSDAS 2011 // Author: John Paul Chou // Date: January 12, 2011 #ifndef __CMSDAS11_DIJET_ANALYZER_H__ #define __CMSDAS11_DIJET_ANALYZER_H__ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "DataFormats/JetReco/interface/CaloJetCollection.h" #include <string> class TH1D; class TH2D; class CMSDAS11DijetAnalyzer : public edm::EDAnalyzer { public: CMSDAS11DijetAnalyzer(const edm::ParameterSet&); void analyze(const edm::Event&, const edm::EventSetup&) override; ~CMSDAS11DijetAnalyzer() override {} void beginJob() override {} void endJob(void) override; static bool compare_JetPt(const reco::CaloJet& jet1, const reco::CaloJet& jet2) { return (jet1.pt() > jet2.pt()); } private: // Parameters edm::InputTag jetSrc; edm::InputTag vertexSrc; std::string jetCorrections; double innerDeltaEta; double outerDeltaEta; double JESbias; // Histograms to be filled TH1D* hVertexZ; TH1D* hJetCorrPt; TH1D* hJetRawPt; TH1D* hJetEta; TH1D* hJetPhi; TH1D* hJetEMF; TH1D* hRawDijetMass; TH1D* hCorDijetMass; TH1D* hCorDijetXsec; TH1D* hJet1Pt; TH1D* hJet1Eta; TH1D* hJet1Phi; TH1D* hJet1EMF; TH1D* hJet2Pt; TH1D* hJet2Eta; TH1D* hJet2Phi; TH1D* hJet2EMF; TH1D* hDijetDeltaPhi; TH1D* hDijetDeltaEta; TH1D* hInnerDijetMass; TH1D* hOuterDijetMass; }; #endif
{ "pile_set_name": "Github" }
{\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f35\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;} {\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);} {\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f169\fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};} {\f389\fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{ \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\pgptbl {\pgp \ipgp0\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid11540\rsid134188\rsid162815\rsid358149\rsid798820\rsid926541\rsid998216\rsid1049212\rsid1474125\rsid1603247\rsid1653933\rsid1837147\rsid1847480\rsid1998582\rsid2040385\rsid2124058\rsid2295186\rsid2518424 \rsid2631018\rsid2651046\rsid2780963\rsid2829515\rsid2848002\rsid2915979\rsid2952301\rsid3032300\rsid3237161\rsid3287233\rsid3413273\rsid3546859\rsid3605679\rsid3607806\rsid3812534\rsid3814506\rsid3818443\rsid4405890\rsid4465190\rsid4523966\rsid4534256 \rsid4600270\rsid4608923\rsid4678414\rsid4794674\rsid4929025\rsid5070509\rsid5329518\rsid5461907\rsid5593893\rsid5643265\rsid5852633\rsid5965968\rsid6033845\rsid6171738\rsid6176397\rsid6315211\rsid6498558\rsid6696205\rsid6978123\rsid7149107\rsid7209579 \rsid7233251\rsid7284736\rsid7344432\rsid7406059\rsid7614883\rsid7630464\rsid7668226\rsid8278977\rsid8390273\rsid8611656\rsid8726262\rsid8731371\rsid8742650\rsid8793479\rsid9178729\rsid9182936\rsid9192335\rsid9382210\rsid9402383\rsid9844676\rsid9859947 \rsid9989421\rsid10040446\rsid10046897\rsid10115046\rsid10244754\rsid10382465\rsid10447167\rsid10555986\rsid10643761\rsid10814467\rsid10830584\rsid10907754\rsid11097155\rsid11280724\rsid11298349\rsid11425658\rsid11761968\rsid11798280\rsid11865385 \rsid11878899\rsid12085275\rsid12144633\rsid12194446\rsid12258537\rsid12279847\rsid12388787\rsid12416993\rsid12535163\rsid12610134\rsid12810764\rsid12846530\rsid12932934\rsid12983364\rsid13057553\rsid13379065\rsid13466722\rsid13717153\rsid13990843 \rsid14115659\rsid14158007\rsid14185520\rsid14309678\rsid14370365\rsid14562311\rsid14574164\rsid14632284\rsid14633019\rsid14640739\rsid14839801\rsid15078718\rsid15166638\rsid15225859\rsid15231724\rsid15299559\rsid15602904\rsid15861443\rsid15998765 \rsid16344647\rsid16521390\rsid16655849\rsid16663712}{\*\generator Microsoft Word 11.0.5604;}{\info{\title 1111111111111}{\author yfyuan}{\operator yfyuan}{\creatim\yr2010\mo9\dy2\hr10\min10}{\revtim\yr2010\mo9\dy25\hr10\min25}{\version6}{\edmins2} {\nofpages1}{\nofwords33}{\nofchars194}{\*\company sinosoft}{\nofcharsws226}{\vern24689}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 \deftab420\ftnbj\aenddoc\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace156 \dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid \viewkind1\viewscale100\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot2952301\newtblstyruls\nogrowautofit {\*\fchars !),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 }{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} {\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14633019 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid14633019 \hich\af0\dbch\af13\loch\f0 RTF Sample , Author : yuans , contact : [email protected] , site : http://www.cnblogs.com/xdesigner }{\insrsid13990843 \hich\af0\dbch\af13\loch\f0 .}{\insrsid14633019 \par }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\insrsid14633019\charrsid14633019 \par }{\insrsid2952301 \hich\af0\dbch\af13\loch\f0 1111111111111}{\insrsid4678414 \par }{\insrsid2952301 \hich\af0\dbch\af13\loch\f0 2222222222222222222 \par }{\insrsid15078718 \hich\af0\dbch\af13\loch\f0 sssssssssssssss}{\field\fldedit\fldlock{\*\fldinst {\insrsid2952301 \hich\af0\dbch\af13\loch\f0 SHAPE \\* MERGEFORMAT }}{\fldrslt {\lang1024\langfe1024\noproof\insrsid13990843 {\shpgrp{\*\shpinst\shpleft0\shptop0\shpright5760\shpbottom3276\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplockanchor\shplid1026 {\sp{\sn groupLeft}{\sv 3456}}{\sp{\sn groupTop}{\sv 3517}}{\sp{\sn groupRight}{\sv 8468}}{\sp{\sn groupBottom}{\sv 6371}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLockAspectRatio}{\sv 1}}{\sp{\sn posh}{\sv 0}}{\sp{\sn posrelh}{\sv 3}} {\sp{\sn posv}{\sv 0}}{\sp{\sn posrelv}{\sv 3}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fAllowOverlap}{\sv 1}}{\sp{\sn fBehindDocument}{\sv 0}}{\sp{\sn dgmt}{\sv 0}} {\sp{\sn fPseudoInline}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLockPosition}{\sv 1}}{\sp{\sn fLockRotation}{\sv 1}}{\shp{\*\shpinst\shplid1027{\sp{\sn relLeft}{\sv 3456}} {\sp{\sn relTop}{\sv 3517}}{\sp{\sn relRight}{\sv 8468}}{\sp{\sn relBottom}{\sv 6371}}{\sp{\sn fRelFlipH}{\sv 0}}{\sp{\sn fRelFlipV}{\sv 0}}{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fLockText}{\sv 1}}{\sp{\sn cxk}{\sv 0}}{\sp{\sn fShadowOK}{\sv 1}} {\sp{\sn f3DOK}{\sv 1}}{\sp{\sn fLineOK}{\sv 1}}{\sp{\sn fFillOK}{\sv 1}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fNoFillHitTest}{\sv 1}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn fPreferRelativeResize}{\sv 0}}{\sp{\sn fLayoutInCell}{\sv 1}} {\sp{\sn fLayoutInCell}{\sv 1}}}}{\shp{\*\shpinst\shplid1028{\sp{\sn relLeft}{\sv 4083}}{\sp{\sn relTop}{\sv 3925}}{\sp{\sn relRight}{\sv 7528}}{\sp{\sn relBottom}{\sv 5556}}{\sp{\sn fRelFlipH}{\sv 0}} {\sp{\sn fRelFlipV}{\sv 0}}{\sp{\sn shapeType}{\sv 202}}{\sp{\sn lTxid}{\sv 65536}}{\sp{\sn hspNext}{\sv 1028}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}{\shptxt \pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid2952301 \hich\af0\dbch\af13\loch\f0 33333333333333 \par \hich\af0\dbch\af13\loch\f0 44444444444444444 \par }{\insrsid2124058\charrsid2952301 {\*\shppict{\pict{\*\picprop\shplid1026{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn pibFlags}{\sv 2}}{\sp{\sn fLine}{\sv 0}} {\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw1588\pich1588\picwgoal900\pichgoal900\pngblip\bliptag-1901007259{\*\blipuid 8eb0ee659cf5d6133551d1515ba5a98f} 89504e470d0a1a0a0000000d494844520000003c0000003c0802000000b59e4e25000000017352474200aece1ce900000422494441546843ed99df4b5a6118c7 8ffdb01fcb8c656e64a1cd9aa9b126a483661141d16c41d0eaaacbfe81c2cb2eeab28bb52e467711d4c5ba8806231b15356616314a63b6243233b0539192a426 4ae9de38235adb391edf738e4e765e9e2b7d9fe77cdfcf79de5fcfe144a35124d55a5aaa09bed1cb8a4ed45b4b49d21c8289383838c8c434f57abd23232354de 4a0cd11a8da6a4a484ca03eef9eeeeee9a4ca6e9e96997cb051f16b0c46b03030356ab95a003c45f46a351afd7d7d6d642f8deba2421a77373731b1b1b9b9a9a 381c0e1cec2488e672b952a9b4aeaeaea5a545201040e84e82e8ccccccb2b2b29a9a9afafafaaaaaaa94112d9148140a457575b54ea76b6e6e8e374f92401a48 4c4f4f07892197cb954aa556ab8d374f92203a180caeafaf83856f7b7bdbe974060281bcbcbc8c8c8c38f224f14b5e6f6faf4c262b2828e0f3f9402e584cb2b2 b2d2d27ee123b314c6d85c3a3a3ae0e60a1e3614450f0e0e1c0e07007cdbe7fafafaf8f818e05f5a5a22b5072798f45f1f170a852c164b5f5f1f180619d249c8 e9387217a7ebff2ada6ef7acac1ce2d9e626eaf787a8d3bd1b818689d8dfbf343ebe85274b26138c8eea2a2b8b087487c3e19d9d9dc9c9c9e1e161321391527a b8ddeee5e565ab750f45fd78b6bf7ff2f5ebcadede1e8db0e1453b1ce746e3fec78fdfecf6132e37faf87154a1c8d7688a3153a90462713a8f17bdb8082e2e7e 5f58f8b1b5754c579ec4b30ffdce6a6ccc3c31610e044260c12d2c44743ae4d5ab672a950aeb757676f6f9a67937369085056475d5565979fefe7dab5229a48e 1c9eb4c71374b92ecfcf9170985358c86f6dd5be78217bf2e421660a45f1ebd75ab9bc2c12e1f87c9c9393f0d1912f1cbea6ae98b61202d890d56af5dd8b198f c703874fb55afefcf923cce472414e0efc8bbd3b5a78d26498757529a7a6de60f6ee5d8b585c40c62b661f664517153d004b1e662067727232630a22d38159d1 641440f46145434083726149436183706249434083726149ff81cd643a7cfb760d3370c03a3df54391bdef440fe9abab2b9fcf07eea7b7e1b15f3e7ddad1eb17 311b1a32a1a8ef1f12edf178e6e6e6ee9ef441e57c7e7ede66b3d1a2f25e10f8635743833818f4db6fda95db1d3218d0a3a36d89e4570200cc168bc366bbccce 462a2a10a9145c0b9e0a04b9b48c81d21d1114b56667673f7cf0aeade11e948542a4bb3babbdfd25a8ede2294ee81d512814b6b5b595979713f003476d501705 85465a1863412891c6424c4d59bf7c71e2692a2ee6f5f4a844223e81e878491395a198f8e6c296c568cc38e643d1b3b930aff3b727b0a213053c066930d94199 9ee9168944c8d41d6f99c4fe365e5a5aca3441201a6cfb33333324aba644a23b3b3b4522517e7e3ed3a2b1f866b3d9603090414e243ade6f92b48c8daa685a443011845df298a0fab7982c6996340181944c8f9f95a3cb1f69b2a6c20000000049454e44ae426082}}}{\insrsid2952301\charrsid2952301 \par }}}}{\shp{\*\shpinst\shplid1029{\sp{\sn relLeft}{\sv 5022}}{\sp{\sn relTop}{\sv 5691}}{\sp{\sn relRight}{\sv 8311}}{\sp{\sn relBottom}{\sv 6370}}{\sp{\sn fRelFlipH}{\sv 0}} {\sp{\sn fRelFlipV}{\sv 0}}{\sp{\sn shapeType}{\sv 202}}{\sp{\sn lTxid}{\sv 131072}}{\sp{\sn hspNext}{\sv 1029}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}{\shptxt \pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid2952301 \hich\af0\dbch\af13\loch\f0 55555555555555 \par \hich\af0\dbch\af13\loch\f0 666666666666666666 \par }}}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8192\dpgroup\dpcount4\dpx0\dpy0\dpxsize5760\dpysize3276\dppolygon\dppolycount4\dpptx0\dppty0\dpptx0\dppty3276\dpptx5760\dppty3276\dpptx5760\dppty0\dpx0\dpy0\dpxsize5760\dpysize3276 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat0\dplinehollow\dptxbx\dptxlrtb{\dptxbxtext\pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid2952301 \hich\af0\dbch\af13\loch\f0 33333333333333 \par \hich\af0\dbch\af13\loch\f0 44444444444444444 \par }{\insrsid2124058\charrsid2952301 {\nonshppict{\pict\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw1588\pich1588\picwgoal900\pichgoal900\wmetafile8\bliptag-1901007259{\*\blipuid 8eb0ee659cf5d6133551d1515ba5a98f} 0100090000034e09000000002909000000000400000003010800050000000b0200000000050000000c023d003d00030000001e00040000000701040029090000 410b2000cc003c003c00000000003c003c0000000000280000003c0000003c000000010008000000000000000000000000000000000000000000000000000000 0000ffffff00fefefe00808080007f7f7f006f6f6f00b6b6b600d2d2d200ababab001b1b1b00d3d3d300c2c2c200747474003a3a3a007e7e7e007c7c7c004444 4400848484009f9f9f0081818100484848001313130089898900c0c0c000b5b5b500868686003f3f3f008e8e8e00e0e0e000dfdfdf00454545008f8f8f00e3e3 e300f3f3f300dedede00b4b4b400b7b7b700b2b2b200949494007676760054545400171717007171710027272700101010000f0f0f000c0c0c000a0a0a000707 070002020200e5e5e500c4c4c400a2a2a200979797007b7b7b0043434300f9f9f900cfcfcf0072727200ecdbdb00e0c2c200e5cccc00f8f3f300bc7b7b008c1a 1a00a0414100ead7d700ebebeb00bdbdbd00974e4e0080000000881e1e00ad989800dadada00eedddd00c8adad00876c6c007f2a2a007f0606007f1818008e2a 2a009a36360094313100831f1f007f0d0d007f1010007f535300af949400e6cfcf00bc7a7a008a1c1c00801111007f1919007f636300bcacac00eddddd00d8c8 c8008f7f7f007f3636007f020200861818009e404000e9d4d400b36767008e2c2c00bbaeae00f2f2f200cbcbcb00a05f5f0091252500e6cece009d3b3b00f0e3 e300c994940097303000a54e4e00f4eaea00ebd8d800faf6f600e0c3c300c58c8c00cd9c9c00f3e8e80099373700e3d6d600f8f8f800fbfbfb00b67575008624 2400998c8c008d4c4c00d2a7a700a75e5e00833a3a007f1616007f414100a7717100c7919100ba848400895353007f2323007f0808007f2d2d0099505000bf81 8100f0e2e200939393008016160087727200f5f5f5008f252500cdb8b800ededed00b2666600bf808000f0e4e400fcfcfc00f7f7f700cecece00d1d1d1007d7d 7d004b4b4b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202000000000000000000000000000000000000000000 0000000000000000000000000000000000000202020202020202020202020202020202020202022805a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 a0a0a0a0a0a0a0a0a0a0a0a0a10002020202020202020202020202020202020202020203060a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a 0a0a0a0a0a0a9f333a0002020202020202020202020202020202020202020203079c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c 9c9c9d9e3a00020202020202020202020202020202020202020202030a0202020202020202020202020202020202020202020202020202020202020202023839 3a00020202020202020202020202020202020202020202030a02020202020202020202020202020202020202020202020202020202020202020238393a000202 02020202020202020202020202020202020202030a02020202020202020202020202020202020202020202020202020202020202020238393a00020202020202 020202020202020202020202020202030a02020202020202020202020202020202020202020202020202020202020202020238393a0002020202020202020202 0202020202020202020202030a02020202020202020202020202020202020202020202020202020202020202020238393a000202020202020202020202020202 02020202020202030a02020202020202020202020202020202020202020202020202020202020202020238393a00020202020202020202020202020202020202 020202030a0202020202020202020202839999999999999999999a9b0202020202020202020238393a0002020202020202020202020202020202020202020203 0a020202020202020202951c8446464646464646464696979802020202020202020238393a00020202020202020202020202020202020202020202030a020202 0202020202021d928546464646464646464693940b02020202020202020238393a00020202020202020202020202020202020202020202030a02020202020202 02838485865587888989898a8b8c8d8e8f90910202020202020238393a00020202020202020202020202020202020202020202030a0202020202020202674646 4680810a0202024308824646466d6e0202020202020238393a00020202020202020202020202020202020202020202030a0202020202020202674646467b7c7d 0202027e6a7f4646466d6e0202020202020238393a00020202020202020202020202020202020202020202030a0202020202020202674646466f700202020202 0277787878797a0202020202020238393a00020202020202020202020202020202020202020202030a0202020202020202674646466f70020202020202020202 0202020202020202020238393a00020202020202020202020202020202020202020202030a0202020202020202674646466f7002020202020202020202020202 02020202020238393a00020202020202020202020202020202020202020202030a0202020202020202674646466f700202020202020202020202020202020202 020238393a00020202020202020202020202020202020202020202030a0202020202020202674646466f70020202020202020202020202020202020202023839 3a00020202020202020202020202020202020202020202030a0202020202020202674646466f700202020202020202020202020202020202020238393a000202 02020202020202020202020202020202020202030a0202020202020202674646466f700202020202020202020202020202020202020238393a00020202020202 020202020202020202020202020202030a0202020202020202674646466f700202020202020202020202020202020202020238393a0002020202020202020202 0202020202020202020202030a0202020202020202674646466f700202020202020202020202020202020202020238393a000202020202020202020202020202 02020202020202030a0202020202020202674646466f700202020202020202020202020202020202020238393a00020202020202020202020202020202020202 020202030a0202020202020202674646466f70020202020202747575755f760202020202020238393a0002020202020202020202020202020202020202020203 0a0202020202020202674646466f700202020202027172727273420202020202020238393a00020202020202020202020202020202020202020202030a020202 0202020202674646466869200202026a6b6c4646466d6e0202020202020238393a00020202020202020202020202020202020202020202030a02020202020202 02595a5b4e5c5d5e5f5f5f60616263546465660202020202020238393a00020202020202020202020202020202020202020202030a02020202020202024a4b4c 4d4e4f50515151525354555657583e0202020202020238393a00020202020202020202020202020202020202020202030a020202020202020202434445464646 46464646464647484902020202020202020238393a00020202020202020202020202020202020202020202030a02020202020202020202023f40404040404040 404041420202020202020202020238393a00020202020202020202020202020202020202020202030a02020202020202020202023b3c3c3c3c3c3c3c3c3c3d3e 0202020202020202020238393a00020202020202020202020202020202020202020202030a020202020202020202020202020202020202020202020202020202 02020202020238393a00020202020202020202020202020202020202020202030a02020202020202020202020202020202020202020202020202020202020202 020238393a00020202020202020202020202020202020202020202030a0202020202020202020202020202020202020202020202020202020202020202023839 3a00020202020202020202020202020202020202020202030a020202020202020202020202020202020202020202020202020232333435353535263637000202 02020202020202020202020202020202020202030a02020202020202020202020202020202020202020202020202020b2a2b2c2d2e2f30310000020202020202 020202020202020202020202020202030a02020202020202020202020202020202020202020202020202020b1908242526272829020202020202020202020202 0202020202020202020202030a02020202020202020202020202020202020202020202020202020b1f2021222313141502020202020202020202020202020202 02020202020202030a02020202020202020202020202020202020202020202020202020b1b1c1d18161e00020202020202020202020202020202020202020202 020202030a02020202020202020202020202020202020202020202020202020b161718191a020202020202020202020202020202020202020202020202020203 0a02020202020202020202020202020202020202020202020202020b11121314150202020202020202020202020202020202020202020202020202030a020202 02020202020202020202020202020202020202020202020b0e0f1000020202020202020202020202020202020202020202020202020202030a02020202020202 020202020202020202020202020202020202020b0c0d020202020202020202020202020202020202020202020202020202020203060707070707070707070707 07070707070707070707070707070708050902020202020202020202020202020202020202020202020202020202020304040404040404040404040404040404 04040404040404040404040405020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202040000002701ffff030000000000}}}{\insrsid2952301\charrsid2952301 \par }}\dpx721\dpy468\dpxsize3959\dpysize1872\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0\dptxbx\dptxlrtb{\dptxbxtext\pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid2952301 \hich\af0\dbch\af13\loch\f0 55555555555555 \par \hich\af0\dbch\af13\loch\f0 666666666666666666 \par }}\dpx1800\dpy2495\dpxsize3780\dpysize780\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0\dpendgroup\dpx0\dpy0\dpxsize0\dpysize0}}}}{\insrsid2124058 {\pict{\*\picprop\defshp\shplid1027{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLockRotation}{\sv 1}}{\sp{\sn fLockPosition}{\sv 1}} {\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fPseudoInline}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLockPosition}{\sv 1}}{\sp{\sn fLockRotation}{\sv 1}}}\picscalex80\picscaley77\piccropl0\piccropr0\piccropt-4206\piccropb4206 \picw12700\pich7430\picwgoal7200\pichgoal4212\wmetafile8\bliptag1051864620\blipupi299{\*\blipuid 3eb22e2cafc5ebb10e48adc548c6f225} 0100090000039800000003001c00000000000400000003010800050000000b0200000000050000000c02aa02b104040000002e0118001c000000fb02d4ff0000 0000000090010000008604000002cbcecce500000000000000000000000000000000000000000000000000000000040000002d0100001c000000fb02d4ff0000 000000009001000000000440001254696d6573204e657720526f6d616e0000000000000000000000000000000000040000002d01010004000000020101000400 00002d010100050000000902000000020d000000320a300000000100040000000000b004a902207a25001c000000fb021000070000000000bc02000000860102022253797374656d000000000000000000001800000002000000d070910be4040000040000002d010200030000000000}}}}\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3 \pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\insrsid15078718 \hich\af0\dbch\af13\loch\f0 vvvvvvvvv}{\insrsid2952301 \par }\pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid2952301 \hich\af0\dbch\af13\loch\f0 77777777777777 \par \hich\af0\dbch\af13\loch\f0 888888888888888 \par }{\insrsid3032300 \par }{\lang1024\langfe1024\noproof\insrsid13990843 {\shp{\*\shpinst\shpleft180\shptop78\shpright7380\shpbottom2886\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz1\shplockanchor\shplid1030 {\sp{\sn shapeType}{\sv 202}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn lTxid}{\sv 196608}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}{\shptxt \pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid3032300 \hich\af0\dbch\af13\loch\f0 99999999999 \par \hich\af0\dbch\af13\loch\f0 aaaaaaaaaaaaaaaaa \par \hich\af0\dbch\af13\loch\f0 bbbbbbbbbbbbbbbbbbbb \par }\pard \qc \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid13466722 {\insrsid2124058\charrsid3032300 {\*\shppict{\pict{\*\picprop\shplid1029{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}} {\sp{\sn fFlipV}{\sv 0}}{\sp{\sn pibFlags}{\sv 2}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn fLayoutInCell}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0 \picw1588\pich1588\picwgoal900\pichgoal900\pngblip\bliptag-730117993{\*\blipuid d47b4897ff2c49c1cdcc0eec2fc6b4ba}89504e470d0a1a0a0000000d494844520000003c0000003c0802000000b59e4e25000000017352474200aece1ce900000681494441546843ed597b4c9565183f 87ab288a1c3131ba6cccb68cb136732631276ae93fd6cc6aa3a954a3352e1a15c76e86338924c5a12169336f044bb392a8963a582465c34b8640e04cf206a568 5ea2ac38dff7f57bdee7fd3e4e8ccb7b82e33ac4b7477ccefbbde7fd9eeff7fe9edb7bec8661d87cedf2f33583c9de41a3afd7ae0d223d88740f08d815435e71 d97e5dd7b110e61b42d14cc5d00de818d1750d3a293445a3c93a149a8cff35718b6e8891e971b17113c6ffbbbdf1494eab225d545a9534674a276034828ce064 1435c3a6e11f14dd7011d0f4d1c5d8eb463b2b9aedbd0f4ba15cbc7469ceac7ba0244cbed353bc5591e65dee74f9fbd9200101f6e0203fc8d060bfe143fd2123 430322c248c63802a322822037df101c1d3904322e6a88a6e990a5190bb6bcbf1bb2e7cb83de32dad375bd3abf5ba40ffcd0066968bec68f0736acf0a035eea9 71a0887045ada5f572d2c3f7430ab7957e5abe1fa2be54b7464fce6b8424ad3bce6b8d1d3d9295f44d4d31d9f510f567b8cf04cb981ee75baf9ebb40725fc2d4 bc0ddb21a5bbf729aea9ca69c5e5aecfb46ea347ce47676141d6de9ff7a6df06e5ded8b0f2da2b5066161ecf9e190965c9dc9bd44d14ac1071dab0bdb26a2b94 2faabae043f5671b55d6ecd668662d68f0c294d15056ccbbf5a5925350dea86aadcf8a81323e2a44e5015caec321908148415814d67f527ee8972b6d50aeb6fd 76f9ca55281595958a460f2c7a308ad397d757b610e440979d2fe1c690c2e46828bf5e13f9c3ed9a342eb4bae604064e9ebdc0b91a0ee7d2689a4697c83b9afe d843d348316c32ef68c6e186168c2ccd7e4d11e95e3262c1e73f657cdc8c151f880e2d6ba2dd84f52b04dd8beb89e2ee17e6943e7fbbfb882842043d0cc96970 43bc059184a328946fbfa7472c7b3d47d1689fa4472f46cfbd7b14f063985971f73f7dc34496d4890e08e6c8bc035c3b04b509f006c02c8c31c12c150c92de69 db7afa18d0f3dc2847d083931c9803835871bf401efe78e004310717bf5259c591b6dfffa0adef8ad3b258d5f54766cf10f4a0c2d503937db4b1552d4d810447 5cbbdd965440b9bd4b472c5a44996858b01ffb1fe283744414ab66692a038b6ee780edd28c230de4d9b979b9fdec8839853bff6a3720eefb68717a4be22d1050 6857f545085e8df9ca4183082dfe425c06251911efa8976172f32d7586f864f4e8c511adb7d7346c2f8361b7062d472cdad7ea8e53d3e973076b9b7a75c4d9b3 28cb0898d55116162836b6cbf24b9c2989f84268887f779c9e1f13b6ee494a9641fef67697ecbbac0c6275623c827e8cc3083e7ed7489cce5fbbb29f39ed1914 5e9ead8a74d6ea7717a73c0a63460ceb8951eca97fb6cb03037817820371c0ec70ad3c02e0d9f95cbaada6f10c94b505ab149156357ac9caadced4f9583a7cb8 347acf5775fc54ec32376396e2426fd27dc164259719d3a6f2fbd4349e865250b85ad1689f8c1eaa48bf98bbd999b60078448c0894757d470527dd9fe32efb96 db018839c2b7e07fe2fb149e05731095981e6fadef6fa445374a8fc413e9644c58cc49010a780931cb20b298b92bca23169c8bd1490d154f42e1731c889577d4 bd7740d32333fb6d67da1300634c7810ef6fc537f57d74c4f8783a6703e4471bc81137be93afe888aa9c7ef6d5f59969c964b4239013186fab081a38b9a33489 2026bb12d04312976a68c96033c0f1b730934b2828b58dd4326fdabc46d1689fa487aad196bba05e37fdcf2cdc68842eab5e03ccecb5e473ba1d62f9a86861a4 835aebd07c4f7e1954a5477a568133ed296c62e4a8408e6b5f1f6ae823a727dc154fec320ca647d1b63707323d54914e7d794d667a0af018eb00d2c2118903ff 482508d5a693b96519996e64024229d251f749479448971417f433d2743a2b138138f1a7437f5328b3509a4086932d37fd0a23e6c8cc42e4967368449cf552ac 11f23fe95c54e991bc38cfb9309d1c11f4109e7ef8e8b13e3ae21db171ec88750de4883bb6af53a487aad18f3fb7d2f9f442e27478a0d55783c49c6598a6887a 1d2db768cdc0602b95c8dedb2caa38f6896fd9ea8e9d84b27347a1a2d1aa719a96ffcf5caa4653592ffc46641012e167c2a54c4fa26c226ff1d9001f1ec82acf f26339875720113f917a72c8a44a8f798b729c19cf00eb33cde7b92ba1e7f081b9082cbcd156352282218206bd122e2a484d0a99e7a854a30a4ecb338f5d1fac 1fc8f450453a316df98fa7a8bff0eaa588b4aad15eb5d5d3c5551dd1d375bd3a7fd068afc2ebb6f820d28348f780804fd2e36f92533e64b5e603400000000049454e44ae426082}}}{\insrsid3032300\charrsid3032300 \par }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\insrsid3032300 \hich\af0\dbch\af13\loch\f0 ccccccccccccccccccc \par \hich\af0\dbch\af13\loch\f0 dddddddddddddddddddd \par }}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8193\dptxbx\dptxlrtb{\dptxbxtext\pard\plain \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid3032300 \hich\af0\dbch\af13\loch\f0 99999999999 \par \hich\af0\dbch\af13\loch\f0 aaaaaaaaaaaaaaaaa \par \hich\af0\dbch\af13\loch\f0 bbbbbbbbbbbbbbbbbbbb \par }\pard \qc \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid13466722 {\insrsid2124058\charrsid3032300 {\nonshppict{\pict\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0 \picw1588\pich1588\picwgoal900\pichgoal900\wmetafile8\bliptag-730117993{\*\blipuid d47b4897ff2c49c1cdcc0eec2fc6b4ba}0100090000035e15000000003915000000000400000003010800050000000b0200000000050000000c023d003d00030000001e00040000000701040039150000 410b2000cc003c003c00000000003c003c0000000000280000003c0000003c0000000100180000000000302a000000000000000000000000000000000000ffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffff846b5a634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a 316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a316b4a39634a31ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff846b5affe7d6f7 ded6e7c6b5dec6b5e7c6b5debdade7c6b5debdade7c6addebdaddebdaddeb5a5debdaddeb5a5deb5a5deb59cdeb5a5d6b59cdeb59cd6ad9cdeb59cd6ad94dead 9cd6ad94d6ad94d6a594d6ad94d6a58cd6a594d6a58cd6a58ccea58c6b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8c735af7deceffded6dec6b5e7c6b5debdadde c6b5debdade7c6addebdaddebdaddebda5debdadd6b5a5deb5a5d6b5a5deb5a5d6b59cdeb59cd6ad9cdeb59cd6ad94d6ad94d6ad94d6ad94d6a58cd6ad94d6a5 8cd6a594cea58cd6a58cce9c8cd6a58c634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8c735affe7d6f7ded6fff7f7ffefeffff7efffefe7ffefe7ffefe7ffefe7ff e7deffefe7ffe7deffe7def7e7d6ffe7def7ded6ffe7d6f7deceffdecef7deceffdecef7d6c6ffdecef7d6c6f7d6c6f7cebdf7d6c6f7cebdf7cebdf7ceb5d6a5 94d6a58c6b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffff8c7363f7e7d6ffe7defff7effff7efffefeffff7efffefe7ffefe7ffefe7ffefe7ffe7deffe7def7e7d6ff e7def7ded6ffe7d6f7ded6ffded6f7decef7decef7d6cef7decef7d6c6f7d6c6f7d6bdf7d6c6efcebdf7cebdf7cebdf7cebdcea58cd6a58c634a31ffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffff8c7363ffe7deffe7d6fff7f7fff7effff7efffefefffefefffefe7ffefe7ffefdeffefe7ffe7deffefdeffe7deffe7def7ded6ffe7def7 ded6ffded6f7deceffdecef7d6ceffdecef7d6c6f7d6c6f7d6c6f7d6c6f7cebdf7d6c6f7cebdd6a594d6a58c6b5239ffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff947b63 f7e7d6ffe7defff7effff7f7fff7efd6c6bdd6c6b5d6c6bdd6bdb5d6c6b5cebdb5d6bdb5ceb5adcebdb5ceb5adceb5adc6b5a5ceb5a5c6ad9cc6b5a5bdad9cc6 ad9cbda59cc6ad9cbda594bda594bda594f7d6c6f7cebdf7cebdd6a58cd6a594634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff947b6bffefdeffe7defffffffff7f7 fffff7fff7effff7effff7effff7efffefe7fff7efffefe7ffefe7ffe7deffefe7ffe7deffe7deffe7d6ffe7d6ffded6ffded6f7deceffded6f7decef7decef7 d6c6ffd6cef7d6c6f7d6c6f7cebdd6ad94d6a5946b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff947b6bf7e7deffe7defff7f7fff7f7fff7effff7f7ffefeffff7ef ffefe7ffefe7ffefe7ffefe7ffe7deffefe7f7e7deffe7def7e7d6ffe7def7ded6ffe7d6f7deceffdecef7decef7decef7d6c6f7decef7d6c6f7d6c6f7cec6f7 d6c6d6a58cd6ad94634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffff947b6bffefe7ffe7defffffffff7f7fffffffff7f7fff7f7fff7effff7efffefeffff7efffefe7 ffefe7ffefe7ffefe7ffe7deffefe7ffe7deffe7def7e7d6ffe7d6f7ded6ffe7d6f7deceffdecef7deceffdecef7d6c6ffdecef7d6c6d6ad94d6ad946b5239ff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffff94846bffe7deffefe7fffff7fffffffff7f7d6c6bdd6c6b5d6c6bdd6bdb5d6c6b5cebdb5d6bdb5ceb5adcebdb5ceb5adceb5ad c6b5a5ceb5a5c6ad9cc6b5a5bdad9cc6ad9cbda59cc6ad9cbda594bda594bda594f7d6cef7d6c6f7d6c6d6ad94d6ad9c634a31ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ff947b6bffefe7ffefe7fffffffffff7ffffffd6c6bddecebdd6c6bdd6c6bdd6bdb5d6c6bdcebdb5d6bdb5cebdadcebdadceb5adcebdadc6b5a5ceb5a5c6ada5 c6ada5bdad9cc6ad9cbda59cbda59cbda594bda59cf7d6c6ffdecef7d6c6deb59cd6ad946b5239ffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c8473ffefe7ffefe7ffff fffffffffffff7fffffffff7f7fffff7fff7effff7f7ffefeffff7efffefe7fff7efffefe7ffefe7ffe7deffefe7f7e7deffe7def7e7d6ffe7def7ded6ffe7d6 f7deceffded6f7d6cef7decef7d6cef7d6ced6ad94d6ad9c634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c8473fff7efffefe7ffffffffffffffffffffffffffff fffffff7fffffffff7f7fff7f7fff7effff7effff7effff7efffefe7fff7efffefe7ffefe7ffe7deffefdeffe7deffe7def7e7d6ffe7d6f7ded6ffded6f7dece ffded6f7d6cedeb59cd6ad9c6b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c8473ffefe7ffefe7fffffffffffffffffffffffffff7f7fffffffff7f7fff7f7fff7 effff7efffefe7fff7efffefe7ffefe7ffefe7ffefe7f7e7deffefe7f7e7deffe7def7e7d6ffe7d6f7ded6ffe7d6f7deceffdecef7d6cef7deced6ad9cdeb59c 634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffff9c8473fff7efffefefffffffffffffffffffd6c6bddecebdd6c6bdd6c6bdd6bdb5d6c6bdcebdb5d6bdb5cebdadcebd adceb5adcebdadc6b5a5ceb5a5c6ada5c6ada5bdad9cc6ad9cbda59cbda59cbda594bda59cf7deceffe7d6f7decedeb5a5deb59c6b5239ffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffff9c8c7bffefeffff7effffffffffffffffffffffffffffffffffffffffff7fffff7fff7f7fffff7fff7effff7f7ffefeffff7efffefefffefefffef e7ffefe7ffe7deffefe7f7e7deffe7def7e7d6ffe7def7ded6ffded6f7ded6ffded6d6b59cdeb5a5634a31ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c8473fff7efff f7effffffffffffffffffffffffffffffffffffffffffffffff7fffffffff7f7fffff7fff7f7fff7f7ffefeffff7efffefe7ffefe7ffefe7ffefe7ffe7deffef e7ffe7deffe7deffe7deffe7def7ded6ffe7d6f7decedeb5a5deb5a56b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa58c7bfff7effff7efffffffffffffffffffff fffffffffffffffffffffffffffffffff7fffffffff7f7fffff7fff7effff7efffefeffff7efffefe7ffefefffefe7ffefe7ffe7deffefdef7e7deffe7def7e7 d6ffe7def7ded6ffded6deb5a5debda5634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa58c7bfffff7fff7f7ffffffffffffffffffd6c6bddecebdd6c6bdd6c6bdd6 bdb5d6c6bdcebdb5d6bdb5cebdadcebdadceb5adcebdadc6b5a5ceb5a5c6ada5c6ada5bdad9cc6ad9cbda59cbda59cbda594bda59cffe7d6ffe7def7ded6debd addebda56b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffa58c7bfff7effff7f7ffffffffffffffffffdecebdd6c6b5d6c6bdd6c6b5d6c6b5cebdb5d6bdb5cebdadce bdb5ceb5adceb5adc6b5a5ceb5a5c6ad9cc6b5a5bdad9cc6ad9cbda59cbda59cbda594bda59cb59c94ffe7def7e7d6ffe7d6d6b5a5debda5634a31ffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffa58c7bfffffffff7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f7fffff7ff f7f7fff7effff7effff7efffefe7fff7efffefe7ffefe7ffefe7ffefe7ffe7deffefdeffe7d6debdaddebda56b5239ffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffad9484 fff7f7fffff7ffffffde9463de945ace6b00ce6b00d66b00ce6300ce6b00ce6b00de9463fff7f7fffff7fffffffffff7fff7f7fff7f7fff7effff7f7ffefefff f7efffefe7ffefefffefe7ffefe7ffe7deffefdef7e7deffe7dedebdaddebdad634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa59484fffffffffff7ffffffde9463 e79c63ce6b00d66b08ce6b00d66b00ce6b00d66b08de9463fffff7fffff7fffffffffff7fffffffff7f7fffff7fff7effff7efffefeffff7efffefe7ffefe7ff efe7ffefe7ffe7deffefe7ffe7dee7c6addebdad6b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffad9484fffff7ffffffffffffde9463de945ad66b00e7b594efbd94 e7b594d67b39d67b31ce6b00efc6a5efc6a5efdedeceb5adc6b5a5ceb5a5c6ad9cc6b5a5bdad9cc6ad9cbda59cbda59cbda594bda59cb59c94ffefe7ffe7deff efdedebdaddebdad634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffad9484ffffffffffffffffffde945ae79c63ce6b00ffffffffffffffffffefc6a5efc6a5ce6b00 f7c6a5efc6a5fffffffffffffffffffffff7fffffffff7f7fffff7fff7effff7f7fff7effff7effff7effff7efffefe7ffefe7ffefdee7c6b5debdad6b5239ff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffad9c8cffffffffffffffffffde9463de945ace6b00ffffffffffffffffffefc6a5efc6a5d66b00efbda5efc6a5ffffffffffff fffff7fffffffff7f7fffff7fff7effff7f7fff7effff7efffefe7fff7efffefe7ffefe7ffefe7ffefe7debdade7c6b5634a31ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffde9463e79c63ce6b00d66b08ce6b00d66b00ce6b00d66b08de8c52fffff7fffff7fffffffffffffffffffffffffffffffffff7 fffffffff7f7fffff7fff7effff7effff7effff7efffefe7fff7efffefe7e7c6b5dec6b56b5239ffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefc6a5efbda5ce6b00efc6a5efc6a5ffff ffde9463de945ad66b00e7b594efbd94e7b594d67b39d67b31ce6b00ffffffffffffcebdb5ceb5adc6b5a5ceb5a5c6ad9cc6b5a5bdad9cc6ad9cbda59cbda59c bda594bda59cb59c94ffefefffefe7ffefe7dec6b5e7c6b5634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefc6a5efc6a5ce6b00f7c6a5efc6a5ffffffde945ae79c63ce6b00efbd 9cefbd94efbd9cd67b31d67b39ce6b00ffffffffffffd6c6b5ceb5a5cebdadc6b5a5c6b5a5c6ada5c6b5a5c6ad9cc6ad9cbda594c6ad9cbda594bda594ffefef fff7efffefe7e7c6b5dec6b56b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffefe7de8c52de8c52d66b00d68c4ade8c52ffffffde9463de945ace6b00ffffffffffffffffffe79c6bde9c 6bd66b00f7e7d6ffefdefffffffffffffffffffffffffffffffffffffffff7fffffffff7f7fffff7fff7effff7f7fff7effff7efffefefffefefe7c6b5e7c6bd 634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffefbd9cce6b00d66b08de8c52d66b00ce6b00ffefdede9463e79c63ce6b00d66b08ce6b00d66b00ce6b00d66b08de8c52ffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffff7fff7f7fffff7fff7effff7f7fff7efe7cebde7c6bd6b5239ffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7b594d6 6b00ce6300de8c52ce6b00d66b00f7e7d6de9463de945ad66b00ce6300ce6b00ce6b00d66b00ce6300de8c52ffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffff7fffffffff7f7fffff7fff7effff7effff7effff7efdec6b5e7cebd634a31ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffde8c4ace6b00d66b00ffe7ded66b08ce 6b00de8442ffe7deffefdef7deceffe7cef7deceffe7d6f7deceffe7ceffffffe7d6ceded6cecebdadceb5a5cebdadc6b5a5c6b5a5c6ada5c6b5a5c6ad9cc6ad 9cbda594fffffffffff7fffff7fff7effffff7fff7efe7cebde7cebd6b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7e7d6ffefdece6300e7ad7be7a57bffffffe7a57be7ad7bce6b00ffefdef7e7d6ff fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7ffffffceb5 adc6ad9cbda594b59c8ca58c7bad8c7b634a31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffefdeffe7ded66b00e7a57be7ad7bffffffe7ad7be7a57bd66b08ffe7deffefdeffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd6bdb5c6ad9cc6ad9cb59c8cad94 84a58c7b6b5239ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffe7ad84e7b58cce6b00f7d6c6f7d6bdfffffff7d6bdf7d6c6ce6300e7b58ce7ad84ffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c8c7ba58c7b634a316b4a39634a316b4a39634a316b4a39634a31ffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd66b00ce6b00 de7b39ffffffffffffd6c6b5ffffffffffffd67b39ce6b00d66b08ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffa59484a58c7bdecec6ceb5a5cebdadbda594735a426b5242cebdb5ffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffce6b00d66b00d67b31ffffffffffffd6c6bd ffffffffffffd67b31d66b00ce6300ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffa58c7ba58c7bd6c6bdceb5adc6b5a5bda5946b5242735a42c6b5adffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7d6f7deceffefdeffffffffffffc6ad9cffffffffffffffe7d6ffe7de ffefdeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffad9484a5 8c7befe7dedecebddecec67b634acec6bdcebdb5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6b5a5ffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa58c84ad9484f7efef8c73638c735ace c6bdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffc6ada5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffad9484ad9484fff7f78c73638c7b63cec6bdffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffc6b5a5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f7fffff7fff7f7fff7f7 fff7effff7efffefe7fff7efffefe7ffefe7ffefdeffefe7a59484ad9484948473d6cec6d6c6bdffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffceb5a5ceb5a5c6b5a5ceb5a5c6ada5c6b5a5c6ad9cc6b5a5c6ad9cc6ada5bdad9cc6ad9cbda59cbdad9cbda594bdad9cb5a594bda594b59c94b5a594b59c94 b5a594ad9c8cb59c8cad9c8cad9c8cad9484ded6ceffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffceb5a5c6b5a5ceb5a5c6ad a5c6b5a5c6ada5c6b5a5bdad9cc6ad9cbdad9cc6ad9cbda594bdad9cbda594bda59cb5a594b5a594b5a594b5a594b59c8cb59c94ad9c8cb59c8cad9c8cad9c8c ad9484ad9c8cd6cec6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff040000002701ffff030000000000}}}{ \insrsid3032300\charrsid3032300 \par }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\insrsid3032300 \hich\af0\dbch\af13\loch\f0 ccccccccccccccccccc \par \hich\af0\dbch\af13\loch\f0 dddddddddddddddddddd \par }}\dpx180\dpy78\dpxsize7200\dpysize2808\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}}{\insrsid3032300 \par \par }}
{ "pile_set_name": "Github" }
var Server = IgeClass.extend({ classId: 'Server', Server: true, init: function (options) { var self = this, i; this.obj = []; // Start the network server ige.addComponent(IgeNetIoComponent); ige.network.start(2000); // Start the game engine ige.start(function (success) { // Check if the engine started successfully if (success) { // Add the network stream component ige.network.addComponent(IgeStreamComponent) .stream.sendInterval(120) // Send a stream update once every 30 milliseconds .stream.start(); // Start the stream // Accept incoming connections ige.network.acceptConnections(true); // Create the scene self.scene1 = new IgeScene2d() .id('scene1'); // Create the main viewport self.vp1 = new IgeViewport() .id('vp1') .autoSize(true) .scene(self.scene1) .drawBounds(true) .drawBoundsData(true) .mount(ige); // Create 100 random tweening entities and add // mouse over and mouse out event listeners to // them based on the functions we defined above, // then add them to the scene! for (i = 0; i < 100; i++) { self.obj[i] = new RandomTweener() .id('fairy' + i) .depth(i) .width(100) .height(100) .translateTo(0, 0, 0) .streamMode(1) .mount(self.scene1); } } }); } }); if (typeof(module) !== 'undefined' && typeof(module.exports) !== 'undefined') { module.exports = Server; }
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Client.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Client.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
{ "pile_set_name": "Github" }
##### Signed by https://keybase.io/max ``` -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABAgAGBQJTybT5AAoJEJgKPw0B/gTfWngIAJ6drLOYdoRwBcWHDffww0i7 457YrD67xojdcV2a8kUWK+xHRZTI1FDctKdcwwAzVRstEYZ5xdJtdOkQ+9RO5L8T DAcx8nkc4NT8MYpnNnFmQEGqxF6N5Fw9IU2qN31iP69cWOdHtOhCJ0YXfQO2LGAQ yQMEQuGwC56iQKhkkcpijbNj+Cseiqple0oEZHLH9zIQSsBDMEPyuB2r+bClTDLk xPZ/59W0ncmgQ+28OLB5k4htnn+6MZPIY+ZWs/slSnnKlCI/NFJFG7uORRaHv8Jq Y8jzW/nS3JuLIHjH4xG/U2DhwCY7vKkg93W24sZtydxsc6tWCz0ovPQnm0GWilU= =Gk/G -----END PGP SIGNATURE----- ``` <!-- END SIGNATURES --> ### Begin signed statement #### Expect ``` size exec file contents ./ 109 .gitignore ec278daeb8f83cac2579d262b92ee6d7d872c4d1544e881ba515d8bcc05361ab 1487 CHANGELOG.md cc232ad3765b99333d9cdba90bb54f0de00e2f87845dfc6c809cbdd94866b92a 1483 LICENSE 333be7050513d91d9e77ca9acb4a91261721f0050209636076ed58676bfc643d 437 Makefile a031266cdf17cdf3236a0f641bf9eb2a882bf49b5e5aaac8686e4d02e5f0c4b5 106 README.md 0d5a7f840664005562cff3e2cee8d0d2e7468e24c4380169b6516ce318602f50 lib/ 15455 armor.js b1dc8663860bcb9c228d7e29ef6ebc7a18781094178fd6d4fd87d450a18c0a09 187 main.js c94977c724c76d803edbf6a08ddbc300a6aa930bf777fbd423eecca05f19fc54 814 userid.js 2d0fff34cdbfbe9ccc7c80cca2a5dac70328e813178a41777efa4b3b1bf63650 12760 util.js b6dd08e6eb21c7bc844cf861ad4b2719a9a9c2a48f8b11a64b560ea83c8d6b16 740 package.json 94b77f1cc55160ecdf89f6c6ce0d84fc81bb9cdfb61fcd0e710940b8862d9940 src/ 12767 armor.iced 1b6139fa13e3d3fd3e1a373c0724c0f680a362c081b0410f8ba956575176c4fb 103 main.iced 4f6935672c854424a9d7dc96d3e446d39528b76091b4d06e199c67c5511cd09e 843 userid.iced d73e0350adfdd2a397fe6971109122db2d2017e05aa4911b64fd729144c322ae 7630 util.iced b2267ec8b70da4d3309d2eaef2b2d45a8b0b291739b9150a3331fd019b52011d test/ files/ 1627 t1.iced 025f26ab9a72bc0c03ff9f39071f51d5fe08023cb5f38717082b587eea9bf5b9 4014 t2.iced 646fcca1ca1648260a94b9f6cb0ffe8baa734b928a58bb94896f1787bf685f52 2163 userid.iced 877fa6a2a5113ddc93a45408abc25ba2a206501c873279786fa7f7bd7e8c7c30 169 run.iced 70ef38fc04a9ee264e2317e5b4dcb00a69a996139e98b5d9e34d0ffa16609479 ``` #### Ignore ``` /SIGNED.md ``` #### Presets ``` git # ignore .git and anything as described by .gitignore files dropbox # ignore .dropbox-cache and other Dropbox-related files kb # ignore anything as described by .kbignore files ``` <!-- summarize version = 0.0.9 --> ### End signed statement <hr> #### Notes With keybase you can sign any directory's contents, whether it's a git repo, source code distribution, or a personal documents folder. It aims to replace the drudgery of: 1. comparing a zipped file to a detached statement 2. downloading a public key 3. confirming it is in fact the author's by reviewing public statements they've made, using it All in one simple command: ```bash keybase dir verify ``` There are lots of options, including assertions for automating your checks. For more info, check out https://keybase.io/docs/command_line/code_signing
{ "pile_set_name": "Github" }
# # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in compliance with the License. You # may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. # # Originally developed by Gregory Trubetskoy. # import sys from mod_python import apache def handler(req): options = req.get_options() ## Find the application callable app = None app_str = options['mod_python.wsgi.application'] if app_str: if '::' in app_str: mod_str, callable_str = app_str.split('::', 1) else: mod_str, callable_str = app_str, 'application' config = req.get_config() autoreload, log = True, False if "PythonAutoReload" in config: autoreload = config["PythonAutoReload"] == "1" if "PythonDebug" in config: log = config["PythonDebug"] == "1" module = apache.import_module(mod_str, autoreload=autoreload, log=log) try: app = module.__dict__[callable_str] except KeyError: pass if not app: req.log_error( 'WSGI handler: mod_python.wsgi.application (%s) not found, declining.' % repr(app_str), apache.APLOG_WARNING) return apache.DECLINED ## Build env env = req.build_wsgi_env() if env is None: # None means base_uri mismatch. The problem can be either # base_uri or Location, but because we couldn't be here if it # was Location, then it must be mod_python.wsgi.base_uri. base_uri = options.get('mod_python.wsgi.base_uri') req.log_error( "WSGI handler: req.uri (%s) does not start with mod_python.wsgi.base_uri (%s), declining." % (repr(req.uri), repr(base_uri)), apache.APLOG_WARNING) return apache.DECLINED ## Run the app response = None try: response = app(env, req.wsgi_start_response) [req.write(token) for token in response] finally: # call close() if there is one if type(response) not in (list, tuple): getattr(response, 'close', lambda: None)() return apache.OK
{ "pile_set_name": "Github" }
{ "Activate desktop notifications": { "other": "Activar notificacions d'escriptori" }, "Choose the plugin": { "other": "Seleccioneu el plugin" }, "Desktop Notifications": { "other": "Notificacions d'escriptori" }, "Display Workspaces Activity": { "other": "Display Workspaces Activity" }, "Display a new entry with all events happening on a user workspaces, and alerts. An SQL database must be setup for the FEED_DRIVER configuration.": { "other": "Mostrar una nova entrada amb tots els esdeveniments que succeeixen en un repositori d'usuari, i alertes. Una base de dades SQL ha de ser configurada per a la configuració de FEED_DRIVER." }, "Display workspaces activity to the users in the right-hand information panel": { "other": "Display workspaces activity to the users in the right-hand information panel" }, "Feed Instance": { "other": "Instància de feed" }, "Handle users watches and notifications": { "other": "Manipular vistes d'usuaris i notificacions" }, "Instance Params": { "other": "Paràmetres d'instància" }, "Notification Center": { "other": "Centre de notificacions" }, "User events and alerts": { "other": "Events i alertes d'usuari" } }
{ "pile_set_name": "Github" }
/// \file // Range v3 library // // Copyright Eric Niebler 2014 // // Use, modification and distribution is subject to 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) // // Project home: https://github.com/ericniebler/range-v3 // #ifndef RANGES_V3_ALGORITHM_MISMATCH_HPP #define RANGES_V3_ALGORITHM_MISMATCH_HPP #include <utility> #include <meta/meta.hpp> #include <range/v3/range_fwd.hpp> #include <range/v3/begin_end.hpp> #include <range/v3/range_concepts.hpp> #include <range/v3/range_traits.hpp> #include <range/v3/utility/iterator_concepts.hpp> #include <range/v3/utility/iterator_traits.hpp> #include <range/v3/utility/functional.hpp> #include <range/v3/utility/static_const.hpp> #include <range/v3/utility/tagged_pair.hpp> #include <range/v3/algorithm/tagspec.hpp> namespace ranges { inline namespace v3 { // TODO Would be nice to use WeaklyComparable here, but that uses Relation instead // of Predicate. Relation requires symmetry: is_valid(pred(a,b)) => is_valid(pred(b,a)) /// \ingroup group-concepts template<typename I1, typename I2, typename C = equal_to, typename P1 = ident, typename P2 = ident> using Mismatchable1 = meta::fast_and< InputIterator<I1>, WeakInputIterator<I2>, IndirectCallablePredicate<C, Projected<I1, P1>, Projected<I2, P2>>>; /// \ingroup group-concepts template<typename I1, typename I2, typename C = equal_to, typename P1 = ident, typename P2 = ident> using Mismatchable2 = meta::fast_and< InputIterator<I1>, InputIterator<I2>, IndirectCallablePredicate<C, Projected<I1, P1>, Projected<I2, P2>>>; /// \addtogroup group-algorithms /// @{ struct mismatch_fn { template<typename I1, typename S1, typename I2, typename C = equal_to, typename P1 = ident, typename P2 = ident, #ifdef RANGES_WORKAROUND_MSVC_SFINAE_CONSTEXPR CONCEPT_REQUIRES_(Mismatchable1<I1, I2, C, P1, P2>::value && IteratorRange<I1, S1>::value)> #else CONCEPT_REQUIRES_(Mismatchable1<I1, I2, C, P1, P2>() && IteratorRange<I1, S1>())> #endif tagged_pair<tag::in1(I1), tag::in2(I2)> operator()(I1 begin1, S1 end1, I2 begin2, C pred_ = C{}, P1 proj1_ = P1{}, P2 proj2_ = P2{}) const { auto &&pred = as_function(pred_); auto &&proj1 = as_function(proj1_); auto &&proj2 = as_function(proj2_); for(; begin1 != end1; ++begin1, ++begin2) if(!pred(proj1(*begin1), proj2(*begin2))) break; return {begin1, begin2}; } template<typename I1, typename S1, typename I2, typename S2, typename C = equal_to, typename P1 = ident, typename P2 = ident, #ifdef RANGES_WORKAROUND_MSVC_SFINAE_CONSTEXPR CONCEPT_REQUIRES_(Mismatchable2<I1, I2, C, P1, P2>::value && IteratorRange<I1, S1>::value && IteratorRange<I2, S2>::value)> #else CONCEPT_REQUIRES_(Mismatchable2<I1, I2, C, P1, P2>() && IteratorRange<I1, S1>() && IteratorRange<I2, S2>())> #endif tagged_pair<tag::in1(I1), tag::in2(I2)> operator()(I1 begin1, S1 end1, I2 begin2, S2 end2, C pred_ = C{}, P1 proj1_ = P1{}, P2 proj2_ = P2{}) const { auto &&pred = as_function(pred_); auto &&proj1 = as_function(proj1_); auto &&proj2 = as_function(proj2_); for(; begin1 != end1 && begin2 != end2; ++begin1, ++begin2) if(!pred(proj1(*begin1), proj2(*begin2))) break; return {begin1, begin2}; } template<typename Rng1, typename I2Ref, typename C = equal_to, typename P1 = ident, typename P2 = ident, typename I1 = range_iterator_t<Rng1>, typename I2 = uncvref_t<I2Ref>, // [*] See below #ifdef RANGES_WORKAROUND_MSVC_SFINAE_CONSTEXPR CONCEPT_REQUIRES_(InputRange<Rng1>::value && Iterator<I2>::value && Mismatchable1<I1, I2, C, P1, P2>::value)> #else CONCEPT_REQUIRES_(InputRange<Rng1>() && Iterator<I2>() && Mismatchable1<I1, I2, C, P1, P2>())> #endif tagged_pair<tag::in1(range_safe_iterator_t<Rng1>), tag::in2(I2)> operator()(Rng1 &&rng1, I2Ref &&begin2, C pred = C{}, P1 proj1 = P1{}, P2 proj2 = P2{}) const { return (*this)(begin(rng1), end(rng1), std::forward<I2>(begin2), std::move(pred), std::move(proj1), std::move(proj2)); } template<typename Rng1, typename Rng2, typename C = equal_to, typename P1 = ident, typename P2 = ident, typename I1 = range_iterator_t<Rng1>, typename I2 = range_iterator_t<Rng2>, #ifdef RANGES_WORKAROUND_MSVC_SFINAE_CONSTEXPR CONCEPT_REQUIRES_(InputRange<Rng1>::value && InputRange<Rng2>::value && Mismatchable2<I1, I2, C, P1, P2>::value)> #else CONCEPT_REQUIRES_(InputRange<Rng1>() && InputRange<Rng2>() && Mismatchable2<I1, I2, C, P1, P2>())> #endif tagged_pair<tag::in1(range_safe_iterator_t<Rng1>), tag::in2(range_safe_iterator_t<Rng2>)> operator()(Rng1 &&rng1, Rng2 &&rng2, C pred = C{}, P1 proj1 = P1{}, P2 proj2 = P2{}) const { return (*this)(begin(rng1), end(rng1), begin(rng2), end(rng2), std::move(pred), std::move(proj1), std::move(proj2)); } }; /// \sa `mismatch_fn` /// \ingroup group-algorithms namespace { constexpr auto&& mismatch = static_const<with_braced_init_args<mismatch_fn>>::value; } // [*] In this case, the 'begin2' iterator is taken by universal reference. Why? So // that we can properly distinguish this case: // int x[] = {1,2,3,4}; // int y[] = {1,2,3,4}; // mismatch(x, y); // Had 'begin2' been taken by value as is customary, this call could match as either // two ranges, or a range and an iterator, where the iterator is the array, decayed // to a pointer. Yuk! /// @} } // namespace v3 } // namespace ranges #endif // include guard
{ "pile_set_name": "Github" }
/* Copyright 2011 David Malcolm <[email protected]> Copyright 2011 Red Hat, Inc. This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <Python.h> /* Test that we can cope with nested structures with unknown value */ struct FooType { int field; }; struct BarType { struct FooType *ptr; }; int test_nested(struct BarType bar) { /* "bar" has an UnknownValue of type "struct BarType" "bar.ptr" inherits the fact that the value is unknown, but must have type "struct FooType*": the UnknownValue must be cast to the correct type. */ return bar.ptr->field; } /* PEP-7 Local variables: c-basic-offset: 4 indent-tabs-mode: nil End: */
{ "pile_set_name": "Github" }
CREATE TABLE ids ( id integer ); INSERT INTO ids VALUES (1); INSERT INTO ids VALUES (2); INSERT INTO ids VALUES (3); CREATE INDEX grnindex ON ids USING pgroonga (id pgroonga.int4_ops); SET enable_seqscan = off; SET enable_indexscan = off; SET enable_bitmapscan = on; SELECT id FROM ids WHERE id <= 2; DROP TABLE ids;
{ "pile_set_name": "Github" }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/policy/core/common/cloud/cloud_policy_client.h" #include "build/build_config.h" #include <utility> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" #include "base/guid.h" #include "base/logging.h" #include "base/stl_util.h" #include "components/policy/core/common/cloud/cloud_policy_util.h" #include "components/policy/core/common/cloud/device_management_service.h" #include "components/policy/core/common/cloud/signing_service.h" #include "google_apis/gaia/gaia_constants.h" #include "google_apis/gaia/gaia_urls.h" #include "net/url_request/url_request_context_getter.h" namespace em = enterprise_management; namespace policy { namespace { // Translates the DeviceRegisterResponse::DeviceMode |mode| to the enum used // internally to represent different device modes. DeviceMode TranslateProtobufDeviceMode( em::DeviceRegisterResponse::DeviceMode mode) { switch (mode) { case em::DeviceRegisterResponse::ENTERPRISE: return DEVICE_MODE_ENTERPRISE; case em::DeviceRegisterResponse::RETAIL: return DEVICE_MODE_LEGACY_RETAIL_MODE; case em::DeviceRegisterResponse::CHROME_AD: return DEVICE_MODE_ENTERPRISE_AD; } LOG(ERROR) << "Unknown enrollment mode in registration response: " << mode; return DEVICE_MODE_NOT_SET; } bool IsChromePolicy(const std::string& type) { return type == dm_protocol::kChromeDevicePolicyType || type == dm_protocol::kChromeUserPolicyType || type == dm_protocol::kChromeMachineLevelUserCloudPolicyType; } LicenseType TranslateLicenseType(em::LicenseType type) { switch (type.license_type()) { case em::LicenseType::UNDEFINED: LOG(ERROR) << "Unknown License type: " << type.license_type(); return LicenseType::UNKNOWN; case em::LicenseType::CDM_PERPETUAL: return LicenseType::PERPETUAL; case em::LicenseType::CDM_ANNUAL: return LicenseType::ANNUAL; case em::LicenseType::KIOSK: return LicenseType::KIOSK; } NOTREACHED(); return LicenseType::UNKNOWN; } void ExtractLicenseMap(const em::CheckDeviceLicenseResponse& license_response, CloudPolicyClient::LicenseMap& licenses) { for (int i = 0; i < license_response.license_availability_size(); i++) { const em::LicenseAvailability& license = license_response.license_availability(i); if (!license.has_license_type() || !license.has_available_licenses()) continue; auto license_type = TranslateLicenseType(license.license_type()); if (license_type == LicenseType::UNKNOWN) continue; bool duplicate = licenses .insert(std::make_pair(license_type, license.available_licenses())) .second; if (duplicate) { LOG(WARNING) << "Duplicate license type in response :" << static_cast<int>(license_type); } } } } // namespace CloudPolicyClient::Observer::~Observer() {} void CloudPolicyClient::Observer::OnRobotAuthCodesFetched( CloudPolicyClient* client) {} CloudPolicyClient::CloudPolicyClient( const std::string& machine_id, const std::string& machine_model, const std::string& brand_code, DeviceManagementService* service, scoped_refptr<net::URLRequestContextGetter> request_context, SigningService* signing_service, DeviceDMTokenCallback device_dm_token_callback) : machine_id_(machine_id), machine_model_(machine_model), brand_code_(brand_code), service_(service), // Can be null for unit tests. signing_service_(signing_service), device_dm_token_callback_(device_dm_token_callback), request_context_(request_context), weak_ptr_factory_(this) {} CloudPolicyClient::~CloudPolicyClient() { } void CloudPolicyClient::SetupRegistration( const std::string& dm_token, const std::string& client_id, const std::vector<std::string>& user_affiliation_ids) { DCHECK(!dm_token.empty()); DCHECK(!client_id.empty()); DCHECK(!is_registered()); dm_token_ = dm_token; client_id_ = client_id; request_jobs_.clear(); app_install_report_request_job_ = nullptr; policy_fetch_request_job_.reset(); responses_.clear(); if (device_dm_token_callback_) { device_dm_token_ = device_dm_token_callback_.Run(user_affiliation_ids); } NotifyRegistrationStateChanged(); } // Sets the client ID or generate a new one. A new one is intentionally // generated on each new registration request in order to preserve privacy. // Reusing IDs would mean the server could track clients by their registration // attempts. void CloudPolicyClient::SetClientId(const std::string& client_id) { client_id_ = client_id.empty() ? base::GenerateGUID() : client_id; } void CloudPolicyClient::Register(em::DeviceRegisterRequest::Type type, em::DeviceRegisterRequest::Flavor flavor, em::DeviceRegisterRequest::Lifetime lifetime, em::LicenseType::LicenseTypeEnum license_type, const std::string& auth_token, const std::string& client_id, const std::string& requisition, const std::string& current_state_key) { DCHECK(service_); DCHECK(!auth_token.empty()); DCHECK(!is_registered()); SetClientId(client_id); policy_fetch_request_job_.reset( service_->CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, GetRequestContext())); policy_fetch_request_job_->SetOAuthToken(auth_token); policy_fetch_request_job_->SetClientID(client_id_); em::DeviceRegisterRequest* request = policy_fetch_request_job_->GetRequest()->mutable_register_request(); if (!client_id.empty()) request->set_reregister(true); request->set_type(type); if (!machine_id_.empty()) request->set_machine_id(machine_id_); if (!machine_model_.empty()) request->set_machine_model(machine_model_); if (!brand_code_.empty()) request->set_brand_code(brand_code_); if (!requisition.empty()) request->set_requisition(requisition); if (!current_state_key.empty()) request->set_server_backed_state_key(current_state_key); request->set_flavor(flavor); if (license_type != em::LicenseType::UNDEFINED) request->mutable_license_type()->set_license_type(license_type); request->set_lifetime(lifetime); policy_fetch_request_job_->SetRetryCallback( base::Bind(&CloudPolicyClient::OnRetryRegister, weak_ptr_factory_.GetWeakPtr())); policy_fetch_request_job_->Start( base::Bind(&CloudPolicyClient::OnRegisterCompleted, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::RegisterWithCertificate( em::DeviceRegisterRequest::Type type, em::DeviceRegisterRequest::Flavor flavor, em::DeviceRegisterRequest::Lifetime lifetime, em::LicenseType::LicenseTypeEnum license_type, const std::string& pem_certificate_chain, const std::string& client_id, const std::string& requisition, const std::string& current_state_key) { DCHECK(signing_service_); DCHECK(service_); DCHECK(!is_registered()); SetClientId(client_id); em::CertificateBasedDeviceRegistrationData data; data.set_certificate_type(em::CertificateBasedDeviceRegistrationData:: ENTERPRISE_ENROLLMENT_CERTIFICATE); data.set_device_certificate(pem_certificate_chain); em::DeviceRegisterRequest* request = data.mutable_device_register_request(); if (!client_id.empty()) request->set_reregister(true); request->set_type(type); if (!machine_id_.empty()) request->set_machine_id(machine_id_); if (!machine_model_.empty()) request->set_machine_model(machine_model_); if (!brand_code_.empty()) request->set_brand_code(brand_code_); if (!requisition.empty()) request->set_requisition(requisition); if (!current_state_key.empty()) request->set_server_backed_state_key(current_state_key); request->set_flavor(flavor); if (license_type != em::LicenseType::UNDEFINED) request->mutable_license_type()->set_license_type(license_type); request->set_lifetime(lifetime); signing_service_->SignData(data.SerializeAsString(), base::Bind(&CloudPolicyClient::OnRegisterWithCertificateRequestSigned, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::RegisterWithToken(const std::string& token, const std::string& client_id) { DCHECK(service_); DCHECK(!token.empty()); DCHECK(!client_id.empty()); DCHECK(!is_registered()); SetClientId(client_id); policy_fetch_request_job_.reset(service_->CreateJob( DeviceManagementRequestJob::TYPE_TOKEN_ENROLLMENT, GetRequestContext())); policy_fetch_request_job_->SetEnrollmentToken(token); policy_fetch_request_job_->SetClientID(client_id_); enterprise_management::RegisterBrowserRequest* request = policy_fetch_request_job_->GetRequest() ->mutable_register_browser_request(); request->set_machine_name(GetMachineName()); request->set_os_platform(GetOSPlatform()); request->set_os_version(GetOSVersion()); policy_fetch_request_job_->SetRetryCallback(base::Bind( &CloudPolicyClient::OnRetryRegister, weak_ptr_factory_.GetWeakPtr())); policy_fetch_request_job_->Start( base::Bind(&CloudPolicyClient::OnRegisterCompleted, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::OnRegisterWithCertificateRequestSigned(bool success, em::SignedData signed_data) { if (!success) { const em::DeviceManagementResponse response; OnRegisterCompleted(DM_STATUS_CANNOT_SIGN_REQUEST, 0, response); return; } policy_fetch_request_job_.reset( service_->CreateJob( DeviceManagementRequestJob::TYPE_CERT_BASED_REGISTRATION, GetRequestContext())); policy_fetch_request_job_->SetClientID(client_id_); em::SignedData* signed_request = policy_fetch_request_job_->GetRequest()-> mutable_certificate_based_register_request()->mutable_signed_request(); signed_request->set_data(signed_data.data()); signed_request->set_signature(signed_data.signature()); signed_request->set_extra_data_bytes(signed_data.extra_data_bytes()); policy_fetch_request_job_->SetRetryCallback( base::Bind(&CloudPolicyClient::OnRetryRegister, weak_ptr_factory_.GetWeakPtr())); policy_fetch_request_job_->Start( base::Bind(&CloudPolicyClient::OnRegisterCompleted, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::SetInvalidationInfo(int64_t version, const std::string& payload) { invalidation_version_ = version; invalidation_payload_ = payload; } void CloudPolicyClient::FetchPolicy() { CHECK(is_registered()); CHECK(!types_to_fetch_.empty()); policy_fetch_request_job_.reset( service_->CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, GetRequestContext())); policy_fetch_request_job_->SetDMToken(dm_token_); policy_fetch_request_job_->SetClientID(client_id_); if (!public_key_version_valid_) policy_fetch_request_job_->SetCritical(true); em::DeviceManagementRequest* request = policy_fetch_request_job_->GetRequest(); // Build policy fetch requests. em::DevicePolicyRequest* policy_request = request->mutable_policy_request(); for (const auto& type_to_fetch : types_to_fetch_) { em::PolicyFetchRequest* fetch_request = policy_request->add_request(); fetch_request->set_policy_type(type_to_fetch.first); if (!type_to_fetch.second.empty()) fetch_request->set_settings_entity_id(type_to_fetch.second); // Request signed policy blobs to help prevent tampering on the client. fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); if (public_key_version_valid_) fetch_request->set_public_key_version(public_key_version_); fetch_request->set_verification_key_hash(kPolicyVerificationKeyHash); // These fields are included only in requests for chrome policy. if (IsChromePolicy(type_to_fetch.first)) { if (!device_dm_token_.empty()) fetch_request->set_device_dm_token(device_dm_token_); if (!last_policy_timestamp_.is_null()) fetch_request->set_timestamp(last_policy_timestamp_.ToJavaTime()); if (!invalidation_payload_.empty()) { fetch_request->set_invalidation_version(invalidation_version_); fetch_request->set_invalidation_payload(invalidation_payload_); } } } // Add device state keys. if (!state_keys_to_upload_.empty()) { em::DeviceStateKeyUpdateRequest* key_update_request = request->mutable_device_state_key_update_request(); for (std::vector<std::string>::const_iterator key( state_keys_to_upload_.begin()); key != state_keys_to_upload_.end(); ++key) { key_update_request->add_server_backed_state_key(*key); } } // Set the fetched invalidation version to the latest invalidation version // since it is now the invalidation version used for the latest fetch. fetched_invalidation_version_ = invalidation_version_; // Fire the job. policy_fetch_request_job_->Start( base::Bind(&CloudPolicyClient::OnPolicyFetchCompleted, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::FetchRobotAuthCodes(const std::string& auth_token) { CHECK(is_registered()); policy_fetch_request_job_.reset(service_->CreateJob( DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH, GetRequestContext())); policy_fetch_request_job_->SetOAuthToken(auth_token); policy_fetch_request_job_->SetDMToken(dm_token_); policy_fetch_request_job_->SetClientID(client_id_); em::DeviceServiceApiAccessRequest* request = policy_fetch_request_job_->GetRequest()-> mutable_service_api_access_request(); request->set_oauth2_client_id( GaiaUrls::GetInstance()->oauth2_chrome_client_id()); request->add_auth_scope(GaiaConstants::kAnyApiOAuth2Scope); request->set_device_type(em::DeviceServiceApiAccessRequest::CHROME_OS); policy_fetch_request_job_->Start( base::Bind(&CloudPolicyClient::OnFetchRobotAuthCodesCompleted, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::Unregister() { DCHECK(service_); policy_fetch_request_job_.reset( service_->CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, GetRequestContext())); policy_fetch_request_job_->SetDMToken(dm_token_); policy_fetch_request_job_->SetClientID(client_id_); policy_fetch_request_job_->GetRequest()->mutable_unregister_request(); policy_fetch_request_job_->Start( base::Bind(&CloudPolicyClient::OnUnregisterCompleted, weak_ptr_factory_.GetWeakPtr())); } void CloudPolicyClient::UploadEnterpriseMachineCertificate( const std::string& certificate_data, const CloudPolicyClient::StatusCallback& callback) { UploadCertificate(certificate_data, em::DeviceCertUploadRequest::ENTERPRISE_MACHINE_CERTIFICATE, callback); } void CloudPolicyClient::UploadEnterpriseEnrollmentCertificate( const std::string& certificate_data, const CloudPolicyClient::StatusCallback& callback) { UploadCertificate( certificate_data, em::DeviceCertUploadRequest::ENTERPRISE_ENROLLMENT_CERTIFICATE, callback); } void CloudPolicyClient::UploadEnterpriseEnrollmentId( const std::string& enrollment_id, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); std::unique_ptr<DeviceManagementRequestJob> request_job( service_->CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); em::DeviceManagementRequest* request = request_job->GetRequest(); em::DeviceCertUploadRequest* upload_request = request->mutable_cert_upload_request(); upload_request->set_enrollment_id(enrollment_id); const DeviceManagementRequestJob::Callback job_callback = base::BindRepeating( &CloudPolicyClient::OnCertificateUploadCompleted, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::UploadDeviceStatus( const em::DeviceStatusReportRequest* device_status, const em::SessionStatusReportRequest* session_status, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); // Should pass in at least one type of status. DCHECK(device_status || session_status); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_UPLOAD_STATUS, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); em::DeviceManagementRequest* request = request_job->GetRequest(); if (device_status) *request->mutable_device_status_report_request() = *device_status; if (session_status) *request->mutable_session_status_report_request() = *session_status; const DeviceManagementRequestJob::Callback job_callback = base::AdaptCallbackForRepeating(base::BindOnce( &CloudPolicyClient::OnReportUploadCompleted, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback)); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::UploadChromeDesktopReport( std::unique_ptr<em::ChromeDesktopReportRequest> chrome_desktop_report, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); DCHECK(chrome_desktop_report); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_CHROME_DESKTOP_REPORT, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); em::DeviceManagementRequest* request = request_job->GetRequest(); request->set_allocated_chrome_desktop_report_request( chrome_desktop_report.release()); const DeviceManagementRequestJob::Callback job_callback = base::Bind(&CloudPolicyClient::OnReportUploadCompleted, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::UploadAppInstallReport( const em::AppInstallReportRequest* app_install_report, const StatusCallback& callback) { CHECK(is_registered()); DCHECK(app_install_report); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); *request_job->GetRequest()->mutable_app_install_report_request() = *app_install_report; const DeviceManagementRequestJob::Callback job_callback = base::AdaptCallbackForRepeating(base::BindOnce( &CloudPolicyClient::OnReportUploadCompleted, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback)); CancelAppInstallReportUpload(); app_install_report_request_job_ = request_job.get(); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::CancelAppInstallReportUpload() { if (app_install_report_request_job_) { RemoveJob(app_install_report_request_job_); } } void CloudPolicyClient::FetchRemoteCommands( std::unique_ptr<RemoteCommandJob::UniqueIDType> last_command_id, const std::vector<em::RemoteCommandResult>& command_results, const RemoteCommandCallback& callback) { CHECK(is_registered()); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_REMOTE_COMMANDS, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); em::DeviceRemoteCommandRequest* const request = request_job->GetRequest()->mutable_remote_command_request(); if (last_command_id) request->set_last_command_unique_id(*last_command_id); for (const auto& command_result : command_results) *request->add_command_results() = command_result; const DeviceManagementRequestJob::Callback job_callback = base::Bind(&CloudPolicyClient::OnRemoteCommandsFetched, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::GetDeviceAttributeUpdatePermission( const std::string &auth_token, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); DCHECK(!auth_token.empty()); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_ATTRIBUTE_UPDATE_PERMISSION, GetRequestContext())); request_job->SetOAuthToken(auth_token); request_job->SetClientID(client_id_); request_job->GetRequest()-> mutable_device_attribute_update_permission_request(); const DeviceManagementRequestJob::Callback job_callback = base::Bind(&CloudPolicyClient::OnDeviceAttributeUpdatePermissionCompleted, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::UpdateDeviceAttributes( const std::string& auth_token, const std::string& asset_id, const std::string& location, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); DCHECK(!auth_token.empty()); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_ATTRIBUTE_UPDATE, GetRequestContext())); request_job->SetOAuthToken(auth_token); request_job->SetClientID(client_id_); em::DeviceAttributeUpdateRequest* request = request_job->GetRequest()->mutable_device_attribute_update_request(); request->set_asset_id(asset_id); request->set_location(location); const DeviceManagementRequestJob::Callback job_callback = base::Bind(&CloudPolicyClient::OnDeviceAttributeUpdated, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::RequestAvailableLicenses( const std::string& auth_token, const LicenseRequestCallback& callback) { DCHECK(!auth_token.empty()); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_REQUEST_LICENSE_TYPES, GetRequestContext())); request_job->SetOAuthToken(auth_token); request_job->GetRequest()->mutable_check_device_license_request(); const DeviceManagementRequestJob::Callback job_callback = base::Bind(&CloudPolicyClient::OnAvailableLicensesRequested, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::UpdateGcmId( const std::string& gcm_id, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( DeviceManagementRequestJob::TYPE_GCM_ID_UPDATE, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); em::GcmIdUpdateRequest* const request = request_job->GetRequest()->mutable_gcm_id_update_request(); request->set_gcm_id(gcm_id); const DeviceManagementRequestJob::Callback job_callback = base::Bind(&CloudPolicyClient::OnGcmIdUpdated, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::AddObserver(Observer* observer) { observers_.AddObserver(observer); } void CloudPolicyClient::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } void CloudPolicyClient::AddPolicyTypeToFetch( const std::string& policy_type, const std::string& settings_entity_id) { types_to_fetch_.insert(std::make_pair(policy_type, settings_entity_id)); } void CloudPolicyClient::RemovePolicyTypeToFetch( const std::string& policy_type, const std::string& settings_entity_id) { types_to_fetch_.erase(std::make_pair(policy_type, settings_entity_id)); } void CloudPolicyClient::SetStateKeysToUpload( const std::vector<std::string>& keys) { state_keys_to_upload_ = keys; } const em::PolicyFetchResponse* CloudPolicyClient::GetPolicyFor( const std::string& policy_type, const std::string& settings_entity_id) const { auto it = responses_.find(std::make_pair(policy_type, settings_entity_id)); return it == responses_.end() ? nullptr : it->second.get(); } scoped_refptr<net::URLRequestContextGetter> CloudPolicyClient::GetRequestContext() { return request_context_; } int CloudPolicyClient::GetActiveRequestCountForTest() const { return request_jobs_.size(); } void CloudPolicyClient::UploadCertificate( const std::string& certificate_data, em::DeviceCertUploadRequest::CertificateType certificate_type, const CloudPolicyClient::StatusCallback& callback) { CHECK(is_registered()); std::unique_ptr<DeviceManagementRequestJob> request_job( service_->CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, GetRequestContext())); request_job->SetDMToken(dm_token_); request_job->SetClientID(client_id_); em::DeviceManagementRequest* request = request_job->GetRequest(); em::DeviceCertUploadRequest* upload_request = request->mutable_cert_upload_request(); upload_request->set_device_certificate(certificate_data); upload_request->set_certificate_type(certificate_type); const DeviceManagementRequestJob::Callback job_callback = base::BindRepeating( &CloudPolicyClient::OnCertificateUploadCompleted, weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } void CloudPolicyClient::OnRetryRegister(DeviceManagementRequestJob* job) { DCHECK_EQ(policy_fetch_request_job_.get(), job); // If the initial request managed to get to the server but the response didn't // arrive at the client then retrying with the same client ID will fail. // Set the re-registration flag so that the server accepts it. // If the server hasn't seen the client ID before then it will also accept // the re-registration. job->GetRequest()->mutable_register_request()->set_reregister(true); } void CloudPolicyClient::OnRegisterCompleted( DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { if (status == DM_STATUS_SUCCESS && (!response.has_register_response() || !response.register_response().has_device_management_token())) { LOG(WARNING) << "Invalid registration response."; status = DM_STATUS_RESPONSE_DECODING_ERROR; } status_ = status; if (status == DM_STATUS_SUCCESS) { dm_token_ = response.register_response().device_management_token(); DVLOG(1) << "Client registration complete - DMToken = " << dm_token_; // Device mode is only relevant for device policy really, it's the // responsibility of the consumer of the field to check validity. device_mode_ = DEVICE_MODE_NOT_SET; if (response.register_response().has_enrollment_type()) { device_mode_ = TranslateProtobufDeviceMode( response.register_response().enrollment_type()); } if (device_dm_token_callback_) { std::vector<std::string> user_affiliation_ids( response.register_response().user_affiliation_ids().begin(), response.register_response().user_affiliation_ids().end()); device_dm_token_ = device_dm_token_callback_.Run(user_affiliation_ids); } NotifyRegistrationStateChanged(); } else { NotifyClientError(); } } void CloudPolicyClient::OnFetchRobotAuthCodesCompleted( DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { if (status == DM_STATUS_SUCCESS && (!response.has_service_api_access_response())) { LOG(WARNING) << "Invalid service api access response."; status = DM_STATUS_RESPONSE_DECODING_ERROR; } status_ = status; if (status == DM_STATUS_SUCCESS) { robot_api_auth_code_ = response.service_api_access_response().auth_code(); DVLOG(1) << "Device robot account auth code fetch complete - code = " << robot_api_auth_code_; NotifyRobotAuthCodesFetched(); } else { NotifyClientError(); } } void CloudPolicyClient::OnPolicyFetchCompleted( DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { if (status == DM_STATUS_SUCCESS) { if (!response.has_policy_response() || response.policy_response().response_size() == 0) { LOG(WARNING) << "Empty policy response."; status = DM_STATUS_RESPONSE_DECODING_ERROR; } } status_ = status; if (status == DM_STATUS_SUCCESS) { const em::DevicePolicyResponse& policy_response = response.policy_response(); responses_.clear(); for (int i = 0; i < policy_response.response_size(); ++i) { const em::PolicyFetchResponse& response = policy_response.response(i); em::PolicyData policy_data; if (!policy_data.ParseFromString(response.policy_data()) || !policy_data.IsInitialized() || !policy_data.has_policy_type()) { LOG(WARNING) << "Invalid PolicyData received, ignoring"; continue; } const std::string& type = policy_data.policy_type(); std::string entity_id; if (policy_data.has_settings_entity_id()) entity_id = policy_data.settings_entity_id(); std::pair<std::string, std::string> key(type, entity_id); if (base::ContainsKey(responses_, key)) { LOG(WARNING) << "Duplicate PolicyFetchResponse for type: " << type << ", entity: " << entity_id << ", ignoring"; continue; } responses_[key] = std::make_unique<em::PolicyFetchResponse>(response); } state_keys_to_upload_.clear(); NotifyPolicyFetched(); } else { NotifyClientError(); } } void CloudPolicyClient::OnUnregisterCompleted( DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { if (status == DM_STATUS_SUCCESS && !response.has_unregister_response()) { // Assume unregistration has succeeded either way. LOG(WARNING) << "Empty unregistration response."; } status_ = status; if (status == DM_STATUS_SUCCESS) { dm_token_.clear(); // Cancel all outstanding jobs. request_jobs_.clear(); app_install_report_request_job_ = nullptr; device_dm_token_.clear(); NotifyRegistrationStateChanged(); } else { NotifyClientError(); } } void CloudPolicyClient::OnCertificateUploadCompleted( const DeviceManagementRequestJob* job, const CloudPolicyClient::StatusCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { bool success = true; status_ = status; if (status != DM_STATUS_SUCCESS) { success = false; NotifyClientError(); } else if (!response.has_cert_upload_response()) { LOG(WARNING) << "Empty upload certificate response."; success = false; } callback.Run(success); // Must call RemoveJob() last, because it frees |callback|. RemoveJob(job); } void CloudPolicyClient::OnDeviceAttributeUpdatePermissionCompleted( const DeviceManagementRequestJob* job, const CloudPolicyClient::StatusCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { bool success = false; if (status == DM_STATUS_SUCCESS && !response.has_device_attribute_update_permission_response()) { LOG(WARNING) << "Invalid device attribute update permission response."; status = DM_STATUS_RESPONSE_DECODING_ERROR; } status_ = status; if (status == DM_STATUS_SUCCESS && response.device_attribute_update_permission_response().has_result() && response.device_attribute_update_permission_response().result() == em::DeviceAttributeUpdatePermissionResponse::ATTRIBUTE_UPDATE_ALLOWED) { success = true; } callback.Run(success); RemoveJob(job); } void CloudPolicyClient::OnDeviceAttributeUpdated( const DeviceManagementRequestJob* job, const CloudPolicyClient::StatusCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { bool success = false; if (status == DM_STATUS_SUCCESS && !response.has_device_attribute_update_response()) { LOG(WARNING) << "Invalid device attribute update response."; status = DM_STATUS_RESPONSE_DECODING_ERROR; } status_ = status; if (status == DM_STATUS_SUCCESS && response.device_attribute_update_response().has_result() && response.device_attribute_update_response().result() == em::DeviceAttributeUpdateResponse::ATTRIBUTE_UPDATE_SUCCESS) { success = true; } callback.Run(success); RemoveJob(job); } void CloudPolicyClient::OnAvailableLicensesRequested( const DeviceManagementRequestJob* job, const CloudPolicyClient::LicenseRequestCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { CloudPolicyClient::LicenseMap licenses; if (status != DM_STATUS_SUCCESS) { LOG(WARNING) << "Could not get available license types"; status_ = status; callback.Run(false /* success */, licenses); RemoveJob(job); return; } if (!response.has_check_device_license_response()) { LOG(WARNING) << "Invalid license request response."; status_ = DM_STATUS_RESPONSE_DECODING_ERROR; callback.Run(false /* success */, licenses); RemoveJob(job); return; } status_ = status; const em::CheckDeviceLicenseResponse& license_response = response.check_device_license_response(); if (license_response.has_license_selection_mode() && (license_response.license_selection_mode() == em::CheckDeviceLicenseResponse::USER_SELECTION)) { ExtractLicenseMap(license_response, licenses); } callback.Run(true /* success */, licenses); RemoveJob(job); } void CloudPolicyClient::RemoveJob(const DeviceManagementRequestJob* job) { if (app_install_report_request_job_ == job) { app_install_report_request_job_ = nullptr; } for (auto it = request_jobs_.begin(); it != request_jobs_.end(); ++it) { if (it->get() == job) { request_jobs_.erase(it); return; } } // This job was already deleted from our list, somehow. This shouldn't // happen since deleting the job should cancel the callback. NOTREACHED(); } void CloudPolicyClient::OnReportUploadCompleted( const DeviceManagementRequestJob* job, const CloudPolicyClient::StatusCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { status_ = status; if (status != DM_STATUS_SUCCESS) NotifyClientError(); callback.Run(status == DM_STATUS_SUCCESS); // Must call RemoveJob() last, because it frees |callback|. RemoveJob(job); } void CloudPolicyClient::OnRemoteCommandsFetched( const DeviceManagementRequestJob* job, const RemoteCommandCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { std::vector<em::RemoteCommand> commands; if (status == DM_STATUS_SUCCESS) { if (response.has_remote_command_response()) { for (const auto& command : response.remote_command_response().commands()) commands.push_back(command); } else { status = DM_STATUS_RESPONSE_DECODING_ERROR; } } callback.Run(status, commands); // Must call RemoveJob() last, because it frees |callback|. RemoveJob(job); } void CloudPolicyClient::OnGcmIdUpdated( const DeviceManagementRequestJob* job, const StatusCallback& callback, DeviceManagementStatus status, int net_error, const em::DeviceManagementResponse& response) { status_ = status; if (status != DM_STATUS_SUCCESS) NotifyClientError(); callback.Run(status == DM_STATUS_SUCCESS); RemoveJob(job); } void CloudPolicyClient::NotifyPolicyFetched() { for (auto& observer : observers_) observer.OnPolicyFetched(this); } void CloudPolicyClient::NotifyRegistrationStateChanged() { for (auto& observer : observers_) observer.OnRegistrationStateChanged(this); } void CloudPolicyClient::NotifyRobotAuthCodesFetched() { for (auto& observer : observers_) observer.OnRobotAuthCodesFetched(this); } void CloudPolicyClient::NotifyClientError() { for (auto& observer : observers_) observer.OnClientError(this); } } // namespace policy
{ "pile_set_name": "Github" }
// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks void donotwarn(); int (^IFP) (); int (^II) (int); int test1() { int (^PFR) (int) = 0; // OK PFR = II; // OK if (PFR == II) // OK donotwarn(); if (PFR == IFP) // OK donotwarn(); if (PFR == (int (^) (int))IFP) // OK donotwarn(); if (PFR == 0) // OK donotwarn(); if (PFR) // OK donotwarn(); if (!PFR) // OK donotwarn(); return PFR != IFP; // OK } int test2(double (^S)()) { double (^I)(int) = (void*) S; (void*)I = (void *)S; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}} void *pv = I; pv = S; I(1); return (void*)I == (void *)S; } int^ x; // expected-error {{block pointer to non-function type is invalid}} int^^ x1; // expected-error {{block pointer to non-function type is invalid}} expected-error {{block pointer to non-function type is invalid}} void test3() { char *^ y; // expected-error {{block pointer to non-function type is invalid}} } enum {NSBIRLazilyAllocated = 0}; int test4(int argc) { // rdar://6251437 ^{ switch (argc) { case NSBIRLazilyAllocated: // is an integer constant expression. default: break; } }(); return 0; } void bar(void*); // rdar://6257721 - reference to static/global is byref by default. static int test5g; void test5() { bar(^{ test5g = 1; }); } // rdar://6405429 - __func__ in a block refers to the containing function name. const char*test6() { return ^{ return __func__; } (); } // radr://6732116 - block comparisons void (^test7a)(); int test7(void (^p)()) { return test7a == p; } void test8() { somelabel: ^{ goto somelabel; }(); // expected-error {{use of undeclared label 'somelabel'}} } void test9() { goto somelabel; // expected-error {{use of undeclared label 'somelabel'}} ^{ somelabel: ; }(); } void test10(int i) { switch (i) { case 41: ; ^{ case 42: ; }(); // expected-error {{'case' statement not in switch statement}} } } void test11(int i) { switch (i) { case 41: ; ^{ break; }(); // expected-error {{'break' statement not in loop or switch statement}} } for (; i < 100; ++i) ^{ break; }(); // expected-error {{'break' statement not in loop or switch statement}} } void (^test12f)(void); void test12() { test12f = ^test12f; // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}} } // rdar://6808730 void *test13 = ^{ int X = 32; void *P = ^{ return X+4; // References outer block's "X", so outer block is constant. }; }; void test14() { int X = 32; static void *P = ^{ // expected-error {{initializer element is not a compile-time constant}} void *Q = ^{ // References test14's "X": outer block is non-constant. return X+4; }; }; } enum { LESS }; void foo(long (^comp)()) { // expected-note{{passing argument to parameter 'comp' here}} } void (^test15f)(void); void test15() { foo(^{ return LESS; }); // expected-error {{incompatible block pointer types passing 'int (^)(void)' to parameter of type 'long (^)()'}} } __block int test16i; // expected-error {{__block attribute not allowed, only allowed on local variables}} void test16(__block int i) { // expected-error {{__block attribute not allowed, only allowed on local variables}} int size = 5; extern __block double extern_var; // expected-error {{__block attribute not allowed, only allowed on local variables}} static __block char * pch; // expected-error {{__block attribute not allowed, only allowed on local variables}} __block int a[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}} __block int (*ap)[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}} } void f(); void test17() { void (^bp)(int); void (*rp)(int); void (^bp1)(); void *vp = bp; f(1 ? bp : vp); f(1 ? vp : bp); f(1 ? bp : bp1); (void)(bp > rp); // expected-error {{invalid operands}} (void)(bp > 0); // expected-error {{invalid operands}} (void)(bp > bp); // expected-error {{invalid operands}} (void)(bp > vp); // expected-error {{invalid operands}} f(1 ? bp : rp); // expected-error {{incompatible operand types ('void (^)(int)' and 'void (*)(int)')}} (void)(bp == 1); // expected-error {{invalid operands to binary expression}} (void)(bp == 0); (void)(1 == bp); // expected-error {{invalid operands to binary expression}} (void)(0 == bp); (void)(bp < 1); // expected-error {{invalid operands to binary expression}} (void)(bp < 0); // expected-error {{invalid operands to binary expression}} (void)(1 < bp); // expected-error {{invalid operands to binary expression}} (void)(0 < bp); // expected-error {{invalid operands to binary expression}} } void test18() { void (^const blockA)(void) = ^{ }; // expected-note {{variable 'blockA' declared const here}} blockA = ^{ }; // expected-error {{cannot assign to variable 'blockA' with const-qualified type 'void (^const)(void)}} } // rdar://7072507 int test19() { goto L0; // expected-error {{cannot jump}} __block int x; // expected-note {{jump bypasses setup of __block variable}} L0: x = 0; ^(){ ++x; }(); return x; } // radr://7438948 void test20() { int n = 7; int vla[n]; // expected-note {{declared here}} int (*vm)[n] = 0; // expected-note {{declared here}} vla[1] = 4341; ^{ (void)vla[1]; // expected-error {{cannot refer to declaration with a variably modified type inside block}} (void)(vm+1); // expected-error {{cannot refer to declaration with a variably modified type inside block}} }(); } // radr://7438948 void test21() { int a[7]; // expected-note {{declared here}} __block int b[10]; // expected-note {{declared here}} a[1] = 1; ^{ (void)a[1]; // expected-error {{cannot refer to declaration with an array type inside block}} (void)b[1]; // expected-error {{cannot refer to declaration with an array type inside block}} }(); } // rdar ://8218839 const char * (^func)(void) = ^{ return __func__; }; const char * (^function)(void) = ^{ return __FUNCTION__; }; const char * (^pretty)(void) = ^{ return __PRETTY_FUNCTION__; };
{ "pile_set_name": "Github" }
--- title: "invalid_compute_domain Class" ms.date: "11/04/2016" f1_keywords: ["invalid_compute_domain", "AMPRT/invalid_compute_domain", "AMPRT/Concurrency::invalid_compute_domain::invalid_compute_domain"] helpviewer_keywords: ["invalid_compute_domain class"] ms.assetid: ac7a7166-8bdb-4db1-8caf-ea129ab5117e --- # invalid_compute_domain Class The exception that's thrown when the runtime can't start a kernel by using the compute domain specified at the [parallel_for_each](concurrency-namespace-functions-amp.md#parallel_for_each) call site. ## Syntax ```cpp class invalid_compute_domain : public runtime_exception; ``` ## Members ### Public Constructors |Name|Description| |----------|-----------------| |[invalid_compute_domain Constructor](#ctor)|Initializes a new instance of the `invalid_compute_domain` class.| ## Inheritance Hierarchy `exception` `runtime_exception` `invalid_compute_domain` ## Requirements **Header:** amprt.h **Namespace:** Concurrency ## <a name="ctor"></a> invalid_compute_domain Initializes a new instance of the class. ## Syntax ```cpp explicit invalid_compute_domain( const char * _Message ) throw(); invalid_compute_domain() throw(); ``` ### Parameters *_Message*<br/> A description of the error. ### Return Value An instance of the `invalid_compute_domain` class ## See also [Concurrency Namespace (C++ AMP)](concurrency-namespace-cpp-amp.md)
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S15.8.2.18_A3; * @section: 15.8.2.18; * @assertion: If x is -0, Math.tan(x) is -0; * @description: Checking if Math.tan(-0) equals to -0; */ // CHECK#1 var x = -0; if (Math.tan(x) !== -0) { $ERROR("#1: 'var x=-0; Math.tan(x) !== -0'"); }
{ "pile_set_name": "Github" }
#!/bin/bash # If it has Build.PL use that, otherwise use Makefile.PL HOME=/tmp cpanm --installdeps . if [ -f Build.PL ]; then perl Build.PL perl ./Build perl ./Build test # Make sure this goes in site perl ./Build install --installdirs site elif [ -f Makefile.PL ]; then # Make sure this goes in site perl Makefile.PL INSTALLDIRS=site make make test make install else echo 'Unable to find Build.PL or Makefile.PL. You need to modify build.sh.' exit 1 fi
{ "pile_set_name": "Github" }
kaolin.conversions.voxelgridconversions ======================================== .. currentmodule:: kaolin.conversions.voxelgridconversions .. toctree:: :maxdepth: 2 .. autofunction:: voxelgrid_to_pointcloud .. autofunction:: voxelgrid_to_trianglemesh .. autofunction:: voxelgrid_to_quadmesh .. autofunction:: voxelgrid_to_sdf
{ "pile_set_name": "Github" }
/****************************************************************************** * Compilation: javac Insertion.java * Execution: java Insertion < input.txt * Dependencies: StdOut.java StdIn.java * Data files: https://algs4.cs.princeton.edu/21elementary/tiny.txt * https://algs4.cs.princeton.edu/21elementary/words3.txt * * Sorts a sequence of strings from standard input using insertion sort. * * % more tiny.txt * S O R T E X A M P L E * * % java Insertion < tiny.txt * A E E L M O P R S T X [ one string per line ] * * % more words3.txt * bed bug dad yes zoo ... all bad yet * * % java Insertion < words3.txt * all bad bed bug dad ... yes yet zoo [ one string per line ] * ******************************************************************************/ package edu.princeton.cs.algs4; import java.util.Comparator; /** * The {@code Insertion} class provides static methods for sorting an * array using insertion sort. * <p> * This implementation makes ~ 1/2 n^2 compares and exchanges in * the worst case, so it is not suitable for sorting large arbitrary arrays. * More precisely, the number of exchanges is exactly equal to the number * of inversions. So, for example, it sorts a partially-sorted array * in linear time. * <p> * The sorting algorithm is stable and uses O(1) extra memory. * <p> * See <a href="https://algs4.cs.princeton.edu/21elementary/InsertionPedantic.java.html">InsertionPedantic.java</a> * for a version that eliminates the compiler warning. * <p> * For additional documentation, see <a href="https://algs4.cs.princeton.edu/21elementary">Section 2.1</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class Insertion { // This class should not be instantiated. private Insertion() { } /** * Rearranges the array in ascending order, using the natural order. * @param a the array to be sorted */ public static void sort(Comparable[] a) { int n = a.length; for (int i = 0; i < n; i++) { for (int j = i; j > 0 && less(a[j], a[j-1]); j--) { exch(a, j, j-1); } assert isSorted(a, 0, i); } assert isSorted(a); } /** * Rearranges the subarray a[lo..hi) in ascending order, using the natural order. * @param a the array to be sorted * @param lo left endpoint (inclusive) * @param hi right endpoint (exclusive) */ public static void sort(Comparable[] a, int lo, int hi) { for (int i = lo; i < hi; i++) { for (int j = i; j > lo && less(a[j], a[j-1]); j--) { exch(a, j, j-1); } } assert isSorted(a, lo, hi); } /** * Rearranges the array in ascending order, using a comparator. * @param a the array * @param comparator the comparator specifying the order */ public static void sort(Object[] a, Comparator comparator) { int n = a.length; for (int i = 0; i < n; i++) { for (int j = i; j > 0 && less(a[j], a[j-1], comparator); j--) { exch(a, j, j-1); } assert isSorted(a, 0, i, comparator); } assert isSorted(a, comparator); } /** * Rearranges the subarray a[lo..hi) in ascending order, using a comparator. * @param a the array * @param lo left endpoint (inclusive) * @param hi right endpoint (exclusive) * @param comparator the comparator specifying the order */ public static void sort(Object[] a, int lo, int hi, Comparator comparator) { for (int i = lo; i < hi; i++) { for (int j = i; j > lo && less(a[j], a[j-1], comparator); j--) { exch(a, j, j-1); } } assert isSorted(a, lo, hi, comparator); } // return a permutation that gives the elements in a[] in ascending order // do not change the original array a[] /** * Returns a permutation that gives the elements in the array in ascending order. * @param a the array * @return a permutation {@code p[]} such that {@code a[p[0]]}, {@code a[p[1]]}, * ..., {@code a[p[n-1]]} are in ascending order */ public static int[] indexSort(Comparable[] a) { int n = a.length; int[] index = new int[n]; for (int i = 0; i < n; i++) index[i] = i; for (int i = 0; i < n; i++) for (int j = i; j > 0 && less(a[index[j]], a[index[j-1]]); j--) exch(index, j, j-1); return index; } /*************************************************************************** * Helper sorting functions. ***************************************************************************/ // is v < w ? private static boolean less(Comparable v, Comparable w) { return v.compareTo(w) < 0; } // is v < w ? private static boolean less(Object v, Object w, Comparator comparator) { return comparator.compare(v, w) < 0; } // exchange a[i] and a[j] private static void exch(Object[] a, int i, int j) { Object swap = a[i]; a[i] = a[j]; a[j] = swap; } // exchange a[i] and a[j] (for indirect sort) private static void exch(int[] a, int i, int j) { int swap = a[i]; a[i] = a[j]; a[j] = swap; } /*************************************************************************** * Check if array is sorted - useful for debugging. ***************************************************************************/ private static boolean isSorted(Comparable[] a) { return isSorted(a, 0, a.length); } // is the array a[lo..hi) sorted private static boolean isSorted(Comparable[] a, int lo, int hi) { for (int i = lo+1; i < hi; i++) if (less(a[i], a[i-1])) return false; return true; } private static boolean isSorted(Object[] a, Comparator comparator) { return isSorted(a, 0, a.length, comparator); } // is the array a[lo..hi) sorted private static boolean isSorted(Object[] a, int lo, int hi, Comparator comparator) { for (int i = lo+1; i < hi; i++) if (less(a[i], a[i-1], comparator)) return false; return true; } // print array to standard output private static void show(Comparable[] a) { for (int i = 0; i < a.length; i++) { StdOut.println(a[i]); } } /** * Reads in a sequence of strings from standard input; insertion sorts them; * and prints them to standard output in ascending order. * * @param args the command-line arguments */ public static void main(String[] args) { String[] a = StdIn.readAllStrings(); Insertion.sort(a); show(a); } } /****************************************************************************** * Copyright 2002-2016, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar 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. * * algs4.jar 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 algs4.jar. If not, see http://www.gnu.org/licenses. ******************************************************************************/
{ "pile_set_name": "Github" }
.model BC560A PNP(IS=1.02f XTI=3 EG=1.11 VAF=74.76 BF=175.1 ISE=10.26f + NE=1.641 IKF=88.84m Nk=.4971 Xtb=1.5 Br=4.329 Isc=71.92f + Nc=1.401 Ikr=9.634 Rc=1.071 Cjc=9.81p Mjc=.332 Vjc=.4865 Fc=.5 + Cje=30p Mje=.3333 Vje=.5 Tr=10n Tf=822.7p Itf=3.991 Xtf=174.7 + Vtf=10) * MFG=PHILIPS pid=bc560a case=TO92 * 11-02-18 hjr
{ "pile_set_name": "Github" }
/* * Copyright 2016 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef SMU9_H #define SMU9_H #pragma pack(push, 1) #define ENABLE_DEBUG_FEATURES /* Feature Control Defines */ #define FEATURE_DPM_PREFETCHER_BIT 0 #define FEATURE_DPM_GFXCLK_BIT 1 #define FEATURE_DPM_UCLK_BIT 2 #define FEATURE_DPM_SOCCLK_BIT 3 #define FEATURE_DPM_UVD_BIT 4 #define FEATURE_DPM_VCE_BIT 5 #define FEATURE_ULV_BIT 6 #define FEATURE_DPM_MP0CLK_BIT 7 #define FEATURE_DPM_LINK_BIT 8 #define FEATURE_DPM_DCEFCLK_BIT 9 #define FEATURE_AVFS_BIT 10 #define FEATURE_DS_GFXCLK_BIT 11 #define FEATURE_DS_SOCCLK_BIT 12 #define FEATURE_DS_LCLK_BIT 13 #define FEATURE_PPT_BIT 14 #define FEATURE_TDC_BIT 15 #define FEATURE_THERMAL_BIT 16 #define FEATURE_GFX_PER_CU_CG_BIT 17 #define FEATURE_RM_BIT 18 #define FEATURE_DS_DCEFCLK_BIT 19 #define FEATURE_ACDC_BIT 20 #define FEATURE_VR0HOT_BIT 21 #define FEATURE_VR1HOT_BIT 22 #define FEATURE_FW_CTF_BIT 23 #define FEATURE_LED_DISPLAY_BIT 24 #define FEATURE_FAN_CONTROL_BIT 25 #define FEATURE_FAST_PPT_BIT 26 #define FEATURE_GFX_EDC_BIT 27 #define FEATURE_ACG_BIT 28 #define FEATURE_SPARE_29_BIT 29 #define FEATURE_SPARE_30_BIT 30 #define FEATURE_SPARE_31_BIT 31 #define NUM_FEATURES 32 #define FFEATURE_DPM_PREFETCHER_MASK (1 << FEATURE_DPM_PREFETCHER_BIT ) #define FFEATURE_DPM_GFXCLK_MASK (1 << FEATURE_DPM_GFXCLK_BIT ) #define FFEATURE_DPM_UCLK_MASK (1 << FEATURE_DPM_UCLK_BIT ) #define FFEATURE_DPM_SOCCLK_MASK (1 << FEATURE_DPM_SOCCLK_BIT ) #define FFEATURE_DPM_UVD_MASK (1 << FEATURE_DPM_UVD_BIT ) #define FFEATURE_DPM_VCE_MASK (1 << FEATURE_DPM_VCE_BIT ) #define FFEATURE_ULV_MASK (1 << FEATURE_ULV_BIT ) #define FFEATURE_DPM_MP0CLK_MASK (1 << FEATURE_DPM_MP0CLK_BIT ) #define FFEATURE_DPM_LINK_MASK (1 << FEATURE_DPM_LINK_BIT ) #define FFEATURE_DPM_DCEFCLK_MASK (1 << FEATURE_DPM_DCEFCLK_BIT ) #define FFEATURE_AVFS_MASK (1 << FEATURE_AVFS_BIT ) #define FFEATURE_DS_GFXCLK_MASK (1 << FEATURE_DS_GFXCLK_BIT ) #define FFEATURE_DS_SOCCLK_MASK (1 << FEATURE_DS_SOCCLK_BIT ) #define FFEATURE_DS_LCLK_MASK (1 << FEATURE_DS_LCLK_BIT ) #define FFEATURE_PPT_MASK (1 << FEATURE_PPT_BIT ) #define FFEATURE_TDC_MASK (1 << FEATURE_TDC_BIT ) #define FFEATURE_THERMAL_MASK (1 << FEATURE_THERMAL_BIT ) #define FFEATURE_GFX_PER_CU_CG_MASK (1 << FEATURE_GFX_PER_CU_CG_BIT ) #define FFEATURE_RM_MASK (1 << FEATURE_RM_BIT ) #define FFEATURE_DS_DCEFCLK_MASK (1 << FEATURE_DS_DCEFCLK_BIT ) #define FFEATURE_ACDC_MASK (1 << FEATURE_ACDC_BIT ) #define FFEATURE_VR0HOT_MASK (1 << FEATURE_VR0HOT_BIT ) #define FFEATURE_VR1HOT_MASK (1 << FEATURE_VR1HOT_BIT ) #define FFEATURE_FW_CTF_MASK (1 << FEATURE_FW_CTF_BIT ) #define FFEATURE_LED_DISPLAY_MASK (1 << FEATURE_LED_DISPLAY_BIT ) #define FFEATURE_FAN_CONTROL_MASK (1 << FEATURE_FAN_CONTROL_BIT ) #define FEATURE_FAST_PPT_MASK (1 << FAST_PPT_BIT ) #define FEATURE_GFX_EDC_MASK (1 << FEATURE_GFX_EDC_BIT ) #define FEATURE_ACG_MASK (1 << FEATURE_ACG_BIT ) #define FFEATURE_SPARE_29_MASK (1 << FEATURE_SPARE_29_BIT ) #define FFEATURE_SPARE_30_MASK (1 << FEATURE_SPARE_30_BIT ) #define FFEATURE_SPARE_31_MASK (1 << FEATURE_SPARE_31_BIT ) /* Workload types */ #define WORKLOAD_VR_BIT 0 #define WORKLOAD_FRTC_BIT 1 #define WORKLOAD_VIDEO_BIT 2 #define WORKLOAD_COMPUTE_BIT 3 #define NUM_WORKLOADS 4 /* ULV Client Masks */ #define ULV_CLIENT_RLC_MASK 0x00000001 #define ULV_CLIENT_UVD_MASK 0x00000002 #define ULV_CLIENT_VCE_MASK 0x00000004 #define ULV_CLIENT_SDMA0_MASK 0x00000008 #define ULV_CLIENT_SDMA1_MASK 0x00000010 #define ULV_CLIENT_JPEG_MASK 0x00000020 #define ULV_CLIENT_GFXCLK_DPM_MASK 0x00000040 #define ULV_CLIENT_UVD_DPM_MASK 0x00000080 #define ULV_CLIENT_VCE_DPM_MASK 0x00000100 #define ULV_CLIENT_MP0CLK_DPM_MASK 0x00000200 #define ULV_CLIENT_UCLK_DPM_MASK 0x00000400 #define ULV_CLIENT_SOCCLK_DPM_MASK 0x00000800 #define ULV_CLIENT_DCEFCLK_DPM_MASK 0x00001000 typedef struct { /* MP1_EXT_SCRATCH0 */ uint32_t CurrLevel_GFXCLK : 4; uint32_t CurrLevel_UVD : 4; uint32_t CurrLevel_VCE : 4; uint32_t CurrLevel_LCLK : 4; uint32_t CurrLevel_MP0CLK : 4; uint32_t CurrLevel_UCLK : 4; uint32_t CurrLevel_SOCCLK : 4; uint32_t CurrLevel_DCEFCLK : 4; /* MP1_EXT_SCRATCH1 */ uint32_t TargLevel_GFXCLK : 4; uint32_t TargLevel_UVD : 4; uint32_t TargLevel_VCE : 4; uint32_t TargLevel_LCLK : 4; uint32_t TargLevel_MP0CLK : 4; uint32_t TargLevel_UCLK : 4; uint32_t TargLevel_SOCCLK : 4; uint32_t TargLevel_DCEFCLK : 4; /* MP1_EXT_SCRATCH2-7 */ uint32_t Reserved[6]; } FwStatus_t; #pragma pack(pop) #endif
{ "pile_set_name": "Github" }
--- name: Feature Proposal about: Propose your idea for TML --- <!-- Please keep in mind that the tModLoader software is built by the community. By submitting your proposal you agree that it may become part of tModLoader as a whole, or partially. The development time it takes for your proposal may vary, the TML Team can give no expected time when your proposal will be addressed or implemented. The TML Team reserves their right to take ideas from your proposal but are not required to necessarily accept your proposal. --> ### Description <!-- Describe your proposal briefly. --> ### What does this proposal attempt to solve or improve? <!-- Describe how your ideas are beneficial for the tModLoader software. --> ### Which (other) solutions should be considered? <!-- Are there alternatives to your proposal? Please list them here. -->
{ "pile_set_name": "Github" }
package org.oasis_open.docs.ws_sx.ws_trust._200512; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_secext_1_0.UsernameTokenType; /** * <p>Java class for DelegateToType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="DelegateToType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DelegateToType", propOrder = { "usernameToken" }) public class DelegateToType { @XmlElement(name = "UsernameToken", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", required = true) protected UsernameTokenType usernameToken; /** * Gets the value of the usernameToken property. * * @return * possible object is * {@link UsernameTokenType } * */ public UsernameTokenType getUsernameToken() { return usernameToken; } /** * Sets the value of the usernameToken property. * * @param value * allowed object is * {@link UsernameTokenType } * */ public void setUsernameToken(UsernameTokenType value) { this.usernameToken = value; } }
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright 2018-2020 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. *******************************************************************************/ /// @example rnn_training_f32.cpp /// @copybrief rnn_training_f32_cpp /// /// @page rnn_training_f32_cpp RNN f32 training example /// This C++ API example demonstrates how to build GNMT model training. /// /// @include rnn_training_f32.cpp #include <cstring> #include <math.h> #include <numeric> #include <utility> #include "example_utils.hpp" using namespace mkldnn; // User input is: // N0 sequences of length T0 const int N0 = 1 + rand() % 31; // N1 sequences of length T1 const int N1 = 1 + rand() % 31; // Assume T0 > T1 const int T0 = 31 + 1 + rand() % 31; const int T1 = 1 + rand() % 31; // Memory required to hold it: N0 * T0 + N1 * T1 // However it is possible to have these coming // as padded chunks in larger memory: // e.g. (N0 + N1) * T0 // We don't need to compact the data before processing, // we can address the chunks via sub-memory and // process the data via two RNN primitives: // of time lengths T1 and T0 - T1. // The leftmost primitive will process N0 + N1 subsequences of length T1 // The rightmost primitive will process remaining N0 subsequences // of T0 - T1 length const int leftmost_batch = N0 + N1; const int rightmost_batch = N0; const int leftmost_seq_length = T1; const int rightmost_seq_length = T0 - T1; // Number of channels const int common_feature_size = 64; // RNN primitive characteristics const int common_n_layers = 1; const int lstm_n_gates = 4; void simple_net(engine::kind engine_kind) { using tag = memory::format_tag; using dt = memory::data_type; auto eng = engine(engine_kind, 0); stream s(eng); bool is_training = true; auto fwd_inf_train = is_training ? prop_kind::forward_training : prop_kind::forward_inference; std::vector<primitive> fwd_net; std::vector<primitive> bwd_net; // Input tensor holds two batches with different sequence lengths. // Shorter sequences are padded memory::dims net_src_dims = { T0, // time, maximum sequence length N0 + N1, // n, total batch size common_feature_size // c, common number of channels }; // Two RNN primitives for different sequence lengths, // one unidirectional layer, LSTM-based memory::dims leftmost_src_layer_dims = { leftmost_seq_length, // time leftmost_batch, // n common_feature_size // c }; memory::dims rightmost_src_layer_dims = { rightmost_seq_length, // time rightmost_batch, // n common_feature_size // c }; memory::dims common_weights_layer_dims = { common_n_layers, // layers 1, // directions common_feature_size, // input feature size lstm_n_gates, // gates number common_feature_size // output feature size }; memory::dims common_weights_iter_dims = { common_n_layers, // layers 1, // directions common_feature_size, // input feature size lstm_n_gates, // gates number common_feature_size // output feature size }; memory::dims common_bias_dims = { common_n_layers, // layers 1, // directions lstm_n_gates, // gates number common_feature_size // output feature size }; memory::dims leftmost_dst_layer_dims = { leftmost_seq_length, // time leftmost_batch, // n common_feature_size // c }; memory::dims rightmost_dst_layer_dims = { rightmost_seq_length, // time rightmost_batch, // n common_feature_size // c }; // leftmost primitive passes its states to the next RNN iteration // so it needs dst_iter parameter. // // rightmost primitive will consume these as src_iter and will access the // memory via a sub-memory because it will have different batch dimension. // We have arranged our primitives so that // leftmost_batch >= rightmost_batch, and so the rightmost data will fit // into the memory allocated for the leftmost. memory::dims leftmost_dst_iter_dims = { common_n_layers, // layers 1, // directions leftmost_batch, // n common_feature_size // c }; memory::dims leftmost_dst_iter_c_dims = { common_n_layers, // layers 1, // directions leftmost_batch, // n common_feature_size // c }; memory::dims rightmost_src_iter_dims = { common_n_layers, // layers 1, // directions rightmost_batch, // n common_feature_size // c }; memory::dims rightmost_src_iter_c_dims = { common_n_layers, // layers 1, // directions rightmost_batch, // n common_feature_size // c }; // multiplication of tensor dimensions auto tz_volume = [=](memory::dims tz_dims) { return std::accumulate(tz_dims.begin(), tz_dims.end(), (memory::dim)1, std::multiplies<memory::dim>()); }; // Create auxillary f32 memory descriptor // based on user- supplied dimensions and layout. auto formatted_md = [=](const memory::dims &dimensions, memory::format_tag layout) { return memory::desc {{dimensions}, dt::f32, layout}; }; // Create auxillary generic f32 memory descriptor // based on supplied dimensions, with format_tag::any. auto generic_md = [=](const memory::dims &dimensions) { return formatted_md(dimensions, tag::any); }; // // I/O memory, coming from user // // Net input std::vector<float> net_src(tz_volume(net_src_dims), 1.0f); // NOTE: in this example we study input sequences with variable batch // dimension, which get processed by two separate RNN primitives, thus // the destination memory for the two will have different shapes: batch // is the second dimension currently: see format_tag::tnc. // We are not copying the output to some common user provided memory as we // suggest that the user should rather keep the two output memories separate // throughout the whole topology and only reorder to something else as // needed. // So there's no common net_dst, but there are two destinations instead: // leftmost_dst_layer_memory // rightmost_dst_layer_memory // Memory for the user allocated memory // Suppose user data is in tnc format. auto net_src_memory = mkldnn::memory({{net_src_dims}, dt::f32, tag::tnc}, eng); write_to_mkldnn_memory(net_src.data(), net_src_memory); // src_layer memory of the leftmost and rightmost RNN primitives // are accessed through the respective sub-memories in larger memory. // View primitives compute the strides to accommodate for padding. auto user_leftmost_src_layer_md = net_src_memory.get_desc().submemory_desc( leftmost_src_layer_dims, {0, 0, 0}); // t, n, c offsets auto user_rightmost_src_layer_md = net_src_memory.get_desc().submemory_desc(rightmost_src_layer_dims, {leftmost_seq_length, 0, 0}); // t, n, c offsets auto leftmost_src_layer_memory = net_src_memory; auto rightmost_src_layer_memory = net_src_memory; // Other user provided memory arrays, descriptors and primitives with the // data layouts chosen by user. We'll have to reorder if RNN // primitive prefers it in a different format. std::vector<float> user_common_weights_layer( tz_volume(common_weights_layer_dims), 1.0f); auto user_common_weights_layer_memory = mkldnn::memory( {common_weights_layer_dims, dt::f32, tag::ldigo}, eng); write_to_mkldnn_memory( user_common_weights_layer.data(), user_common_weights_layer_memory); std::vector<float> user_common_weights_iter( tz_volume(common_weights_iter_dims), 1.0f); auto user_common_weights_iter_memory = mkldnn::memory( {{common_weights_iter_dims}, dt::f32, tag::ldigo}, eng); write_to_mkldnn_memory( user_common_weights_layer.data(), user_common_weights_iter_memory); std::vector<float> user_common_bias(tz_volume(common_bias_dims), 1.0f); auto user_common_bias_memory = mkldnn::memory({{common_bias_dims}, dt::f32, tag::ldgo}, eng); write_to_mkldnn_memory(user_common_bias.data(), user_common_bias_memory); std::vector<float> user_leftmost_dst_layer( tz_volume(leftmost_dst_layer_dims), 1.0f); auto user_leftmost_dst_layer_memory = mkldnn::memory( {{leftmost_dst_layer_dims}, dt::f32, tag::tnc}, eng); write_to_mkldnn_memory( user_leftmost_dst_layer.data(), user_leftmost_dst_layer_memory); std::vector<float> user_rightmost_dst_layer( tz_volume(rightmost_dst_layer_dims), 1.0f); auto user_rightmost_dst_layer_memory = mkldnn::memory( {{rightmost_dst_layer_dims}, dt::f32, tag::tnc}, eng); write_to_mkldnn_memory( user_rightmost_dst_layer.data(), user_rightmost_dst_layer_memory); // Describe layer, forward pass, leftmost primitive. // There are no primitives to the left from here, // so src_iter_desc needs to be zero memory desc lstm_forward::desc leftmost_layer_desc(fwd_inf_train, // aprop_kind rnn_direction::unidirectional_left2right, // direction user_leftmost_src_layer_md, // src_layer_desc memory::desc(), // src_iter_desc memory::desc(), // src_iter_c_desc generic_md(common_weights_layer_dims), // weights_layer_desc generic_md(common_weights_iter_dims), // weights_iter_desc generic_md(common_bias_dims), // bias_desc formatted_md(leftmost_dst_layer_dims, tag::tnc), // dst_layer_desc generic_md(leftmost_dst_iter_dims), // dst_iter_desc generic_md(leftmost_dst_iter_c_dims) // dst_iter_c_desc ); // Describe primitive auto leftmost_prim_desc = mkldnn::lstm_forward::primitive_desc(leftmost_layer_desc, eng); // // Need to connect leftmost and rightmost via "iter" parameters. // We allocate memory here based on the shapes provided by RNN primitive. // auto leftmost_dst_iter_memory = mkldnn::memory(leftmost_prim_desc.dst_iter_desc(), eng); auto leftmost_dst_iter_c_memory = mkldnn::memory(leftmost_prim_desc.dst_iter_c_desc(), eng); // rightmost src_iter will be a sub-memory of dst_iter of leftmost auto rightmost_src_iter_md = leftmost_dst_iter_memory.get_desc().submemory_desc( rightmost_src_iter_dims, {0, 0, 0, 0}); // l, d, n, c offsets auto rightmost_src_iter_memory = leftmost_dst_iter_memory; auto rightmost_src_iter_c_md = leftmost_dst_iter_c_memory.get_desc().submemory_desc( rightmost_src_iter_c_dims, {0, 0, 0, 0}); // l, d, n, c offsets auto rightmost_src_iter_c_memory = leftmost_dst_iter_c_memory; // Now rightmost primitive // There are no primitives to the right from here, // so dst_iter_desc is explicit zero memory desc lstm_forward::desc rightmost_layer_desc(fwd_inf_train, // aprop_kind rnn_direction::unidirectional_left2right, // direction user_rightmost_src_layer_md, // src_layer_desc rightmost_src_iter_md, // src_iter_desc rightmost_src_iter_c_md, // src_iter_c_desc generic_md(common_weights_layer_dims), // weights_layer_desc generic_md(common_weights_iter_dims), // weights_iter_desc generic_md(common_bias_dims), // bias_desc formatted_md(rightmost_dst_layer_dims, tag::tnc), // dst_layer_desc memory::desc(), // dst_iter_desc memory::desc() // dst_iter_c_desc ); auto rightmost_prim_desc = lstm_forward::primitive_desc(rightmost_layer_desc, eng); // // Weights and biases, layer memory // Same layout should work across the layer, no reorders // needed between leftmost and rigthmost, only reordering // user memory to the RNN-friendly shapes. // auto common_weights_layer_memory = user_common_weights_layer_memory; if (leftmost_prim_desc.weights_layer_desc() != common_weights_layer_memory.get_desc()) { common_weights_layer_memory = mkldnn::memory(leftmost_prim_desc.weights_layer_desc(), eng); reorder(user_common_weights_layer_memory, common_weights_layer_memory) .execute(s, user_common_weights_layer_memory, common_weights_layer_memory); } auto common_weights_iter_memory = user_common_weights_iter_memory; if (leftmost_prim_desc.weights_iter_desc() != common_weights_iter_memory.get_desc()) { common_weights_iter_memory = mkldnn::memory(leftmost_prim_desc.weights_iter_desc(), eng); reorder(user_common_weights_iter_memory, common_weights_iter_memory) .execute(s, user_common_weights_iter_memory, common_weights_iter_memory); } auto common_bias_memory = user_common_bias_memory; if (leftmost_prim_desc.bias_desc() != common_bias_memory.get_desc()) { common_bias_memory = mkldnn::memory(leftmost_prim_desc.bias_desc(), eng); reorder(user_common_bias_memory, common_bias_memory) .execute(s, user_common_bias_memory, common_bias_memory); } // // Destination layer memory // auto leftmost_dst_layer_memory = user_leftmost_dst_layer_memory; if (leftmost_prim_desc.dst_layer_desc() != leftmost_dst_layer_memory.get_desc()) { leftmost_dst_layer_memory = mkldnn::memory(leftmost_prim_desc.dst_layer_desc(), eng); reorder(user_leftmost_dst_layer_memory, leftmost_dst_layer_memory) .execute(s, user_leftmost_dst_layer_memory, leftmost_dst_layer_memory); } auto rightmost_dst_layer_memory = user_rightmost_dst_layer_memory; if (rightmost_prim_desc.dst_layer_desc() != rightmost_dst_layer_memory.get_desc()) { rightmost_dst_layer_memory = mkldnn::memory(rightmost_prim_desc.dst_layer_desc(), eng); reorder(user_rightmost_dst_layer_memory, rightmost_dst_layer_memory) .execute(s, user_rightmost_dst_layer_memory, rightmost_dst_layer_memory); } // We also create workspace memory based on the information from // the workspace_primitive_desc(). This is needed for internal // communication between forward and backward primitives during // training. auto create_ws = [=](mkldnn::lstm_forward::primitive_desc &pd) { return mkldnn::memory(pd.workspace_desc(), eng); }; auto leftmost_workspace_memory = create_ws(leftmost_prim_desc); auto rightmost_workspace_memory = create_ws(rightmost_prim_desc); // Construct the RNN primitive objects lstm_forward leftmost_layer(leftmost_prim_desc); leftmost_layer.execute(s, {{MKLDNN_ARG_SRC_LAYER, leftmost_src_layer_memory}, {MKLDNN_ARG_WEIGHTS_LAYER, common_weights_layer_memory}, {MKLDNN_ARG_WEIGHTS_ITER, common_weights_iter_memory}, {MKLDNN_ARG_BIAS, common_bias_memory}, {MKLDNN_ARG_DST_LAYER, leftmost_dst_layer_memory}, {MKLDNN_ARG_DST_ITER, leftmost_dst_iter_memory}, {MKLDNN_ARG_DST_ITER_C, leftmost_dst_iter_c_memory}, {MKLDNN_ARG_WORKSPACE, leftmost_workspace_memory}}); lstm_forward rightmost_layer(rightmost_prim_desc); rightmost_layer.execute(s, {{MKLDNN_ARG_SRC_LAYER, rightmost_src_layer_memory}, {MKLDNN_ARG_SRC_ITER, rightmost_src_iter_memory}, {MKLDNN_ARG_SRC_ITER_C, rightmost_src_iter_c_memory}, {MKLDNN_ARG_WEIGHTS_LAYER, common_weights_layer_memory}, {MKLDNN_ARG_WEIGHTS_ITER, common_weights_iter_memory}, {MKLDNN_ARG_BIAS, common_bias_memory}, {MKLDNN_ARG_DST_LAYER, rightmost_dst_layer_memory}, {MKLDNN_ARG_WORKSPACE, rightmost_workspace_memory}}); // No backward pass for inference if (!is_training) return; // // Backward primitives will reuse memory from forward // and allocate/describe specifics here. Only relevant for training. // // User-provided memory for backward by data output std::vector<float> net_diff_src(tz_volume(net_src_dims), 1.0f); auto net_diff_src_memory = mkldnn::memory(formatted_md(net_src_dims, tag::tnc), eng); write_to_mkldnn_memory(net_diff_src.data(), net_diff_src_memory); // diff_src follows the same layout we have for net_src auto user_leftmost_diff_src_layer_md = net_diff_src_memory.get_desc().submemory_desc( leftmost_src_layer_dims, {0, 0, 0}); // t, n, c offsets auto user_rightmost_diff_src_layer_md = net_diff_src_memory.get_desc().submemory_desc( rightmost_src_layer_dims, {leftmost_seq_length, 0, 0}); // t, n, c offsets auto leftmost_diff_src_layer_memory = net_diff_src_memory; auto rightmost_diff_src_layer_memory = net_diff_src_memory; // User-provided memory for backpropagation by weights std::vector<float> user_common_diff_weights_layer( tz_volume(common_weights_layer_dims), 1.0f); auto user_common_diff_weights_layer_memory = mkldnn::memory( formatted_md(common_weights_layer_dims, tag::ldigo), eng); write_to_mkldnn_memory(user_common_diff_weights_layer.data(), user_common_diff_weights_layer_memory); std::vector<float> user_common_diff_bias(tz_volume(common_bias_dims), 1.0f); auto user_common_diff_bias_memory = mkldnn::memory(formatted_md(common_bias_dims, tag::ldgo), eng); write_to_mkldnn_memory( user_common_diff_bias.data(), user_common_diff_bias_memory); // User-provided input to the backward primitive. // To be updated by the user after forward pass using some cost function. memory::dims net_diff_dst_dims = { T0, // time N0 + N1, // n common_feature_size // c }; // Suppose user data is in tnc format. std::vector<float> net_diff_dst(tz_volume(net_diff_dst_dims), 1.0f); auto net_diff_dst_memory = mkldnn::memory(formatted_md(net_diff_dst_dims, tag::tnc), eng); write_to_mkldnn_memory(net_diff_dst.data(), net_diff_dst_memory); // diff_dst_layer memory of the leftmost and rightmost RNN primitives // are accessed through the respective sub-memory in larger memory. // View primitives compute the strides to accommodate for padding. auto user_leftmost_diff_dst_layer_md = net_diff_dst_memory.get_desc().submemory_desc( leftmost_dst_layer_dims, {0, 0, 0}); // t, n, c offsets auto user_rightmost_diff_dst_layer_md = net_diff_dst_memory.get_desc().submemory_desc( rightmost_dst_layer_dims, {leftmost_seq_length, 0, 0}); // t, n, c offsets auto leftmost_diff_dst_layer_memory = net_diff_dst_memory; auto rightmost_diff_dst_layer_memory = net_diff_dst_memory; // Backward leftmost primitive descriptor lstm_backward::desc leftmost_layer_bwd_desc( prop_kind::backward, // aprop_kind rnn_direction::unidirectional_left2right, // direction user_leftmost_src_layer_md, // src_layer_desc memory::desc(), // src_iter_desc memory::desc(), // src_iter_c_desc generic_md(common_weights_layer_dims), // weights_layer_desc generic_md(common_weights_iter_dims), // weights_iter_desc generic_md(common_bias_dims), // bias_desc formatted_md(leftmost_dst_layer_dims, tag::tnc), // dst_layer_desc generic_md(leftmost_dst_iter_dims), // dst_iter_desc generic_md(leftmost_dst_iter_c_dims), // dst_iter_c_desc user_leftmost_diff_src_layer_md, // diff_src_layer_desc memory::desc(), // diff_src_iter_desc memory::desc(), // diff_src_iter_c_desc generic_md(common_weights_layer_dims), // diff_weights_layer_desc generic_md(common_weights_iter_dims), // diff_weights_iter_desc generic_md(common_bias_dims), // diff_bias_desc user_leftmost_diff_dst_layer_md, // diff_dst_layer_desc generic_md(leftmost_dst_iter_dims), // diff_dst_iter_desc generic_md(leftmost_dst_iter_c_dims) // diff_dst_iter_c_desc ); auto leftmost_bwd_prim_desc = lstm_backward::primitive_desc( leftmost_layer_bwd_desc, eng, leftmost_prim_desc); // As the batch dimensions are different between leftmost and rightmost // we need to use a sub-memory. rightmost needs less memory, so it will // be a sub-memory of leftmost. auto leftmost_diff_dst_iter_memory = mkldnn::memory(leftmost_bwd_prim_desc.diff_dst_iter_desc(), eng); auto leftmost_diff_dst_iter_c_memory = mkldnn::memory( leftmost_bwd_prim_desc.diff_dst_iter_c_desc(), eng); auto rightmost_diff_src_iter_md = leftmost_diff_dst_iter_memory.get_desc().submemory_desc( rightmost_src_iter_dims, {0, 0, 0, 0}); // l, d, n, c offsets auto rightmost_diff_src_iter_memory = leftmost_diff_dst_iter_memory; auto rightmost_diff_src_iter_c_md = leftmost_diff_dst_iter_c_memory.get_desc().submemory_desc( rightmost_src_iter_c_dims, {0, 0, 0, 0}); // l, d, n, c offsets auto rightmost_diff_src_iter_c_memory = leftmost_diff_dst_iter_c_memory; // Backward rightmost primitive descriptor lstm_backward::desc rightmost_layer_bwd_desc( prop_kind::backward, // aprop_kind rnn_direction::unidirectional_left2right, // direction user_rightmost_src_layer_md, // src_layer_desc generic_md(rightmost_src_iter_dims), // src_iter_desc generic_md(rightmost_src_iter_c_dims), // src_iter_c_desc generic_md(common_weights_layer_dims), // weights_layer_desc generic_md(common_weights_iter_dims), // weights_iter_desc generic_md(common_bias_dims), // bias_desc formatted_md(rightmost_dst_layer_dims, tag::tnc), // dst_layer_desc memory::desc(), // dst_iter_desc memory::desc(), // dst_iter_c_desc user_rightmost_diff_src_layer_md, // diff_src_layer_desc rightmost_diff_src_iter_md, // diff_src_iter_desc rightmost_diff_src_iter_c_md, // diff_src_iter_c_desc generic_md(common_weights_layer_dims), // diff_weights_layer_desc generic_md(common_weights_iter_dims), // diff_weights_iter_desc generic_md(common_bias_dims), // diff_bias_desc user_rightmost_diff_dst_layer_md, // diff_dst_layer_desc memory::desc(), // diff_dst_iter_desc memory::desc() // diff_dst_iter_c_desc ); auto rightmost_bwd_prim_desc = lstm_backward::primitive_desc( rightmost_layer_bwd_desc, eng, rightmost_prim_desc); // // Memory for backward pass // // src layer uses the same memory as forward auto leftmost_src_layer_bwd_memory = leftmost_src_layer_memory; auto rightmost_src_layer_bwd_memory = rightmost_src_layer_memory; // Memory for weights and biases for backward pass // Try to use the same memory between forward and backward, but // sometimes reorders are needed. auto common_weights_layer_bwd_memory = common_weights_layer_memory; if (leftmost_bwd_prim_desc.weights_layer_desc() != leftmost_prim_desc.weights_layer_desc()) { common_weights_layer_bwd_memory = memory(leftmost_bwd_prim_desc.weights_layer_desc(), eng); reorder(common_weights_layer_memory, common_weights_layer_bwd_memory) .execute(s, common_weights_layer_memory, common_weights_layer_bwd_memory); } auto common_weights_iter_bwd_memory = common_weights_iter_memory; if (leftmost_bwd_prim_desc.weights_iter_desc() != leftmost_prim_desc.weights_iter_desc()) { common_weights_iter_bwd_memory = memory(leftmost_bwd_prim_desc.weights_iter_desc(), eng); reorder(common_weights_iter_memory, common_weights_iter_bwd_memory) .execute(s, common_weights_iter_memory, common_weights_iter_bwd_memory); } auto common_bias_bwd_memory = common_bias_memory; if (leftmost_bwd_prim_desc.bias_desc() != common_bias_memory.get_desc()) { common_bias_bwd_memory = mkldnn::memory(leftmost_bwd_prim_desc.bias_desc(), eng); reorder(common_bias_memory, common_bias_bwd_memory) .execute(s, common_bias_memory, common_bias_bwd_memory); } // diff_weights and biases auto common_diff_weights_layer_memory = user_common_diff_weights_layer_memory; auto reorder_common_diff_weights_layer = false; if (leftmost_bwd_prim_desc.diff_weights_layer_desc() != common_diff_weights_layer_memory.get_desc()) { common_diff_weights_layer_memory = mkldnn::memory( leftmost_bwd_prim_desc.diff_weights_layer_desc(), eng); reorder_common_diff_weights_layer = true; } auto common_diff_bias_memory = user_common_diff_bias_memory; auto reorder_common_diff_bias = false; if (leftmost_bwd_prim_desc.diff_bias_desc() != common_diff_bias_memory.get_desc()) { common_diff_bias_memory = mkldnn::memory(leftmost_bwd_prim_desc.diff_bias_desc(), eng); reorder_common_diff_bias = true; } // dst_layer memory for backward pass auto leftmost_dst_layer_bwd_memory = leftmost_dst_layer_memory; if (leftmost_bwd_prim_desc.dst_layer_desc() != leftmost_dst_layer_bwd_memory.get_desc()) { leftmost_dst_layer_bwd_memory = mkldnn::memory(leftmost_bwd_prim_desc.dst_layer_desc(), eng); reorder(leftmost_dst_layer_memory, leftmost_dst_layer_bwd_memory) .execute(s, leftmost_dst_layer_memory, leftmost_dst_layer_bwd_memory); } auto rightmost_dst_layer_bwd_memory = rightmost_dst_layer_memory; if (rightmost_bwd_prim_desc.dst_layer_desc() != rightmost_dst_layer_bwd_memory.get_desc()) { rightmost_dst_layer_bwd_memory = mkldnn::memory(rightmost_bwd_prim_desc.dst_layer_desc(), eng); reorder(rightmost_dst_layer_memory, rightmost_dst_layer_bwd_memory) .execute(s, rightmost_dst_layer_memory, rightmost_dst_layer_bwd_memory); } // Similar to forward, the backward primitives are connected // via "iter" parameters. auto common_diff_weights_iter_memory = mkldnn::memory( leftmost_bwd_prim_desc.diff_weights_iter_desc(), eng); auto leftmost_dst_iter_bwd_memory = leftmost_dst_iter_memory; if (leftmost_bwd_prim_desc.dst_iter_desc() != leftmost_dst_iter_bwd_memory.get_desc()) { leftmost_dst_iter_bwd_memory = mkldnn::memory(leftmost_bwd_prim_desc.dst_iter_desc(), eng); reorder(leftmost_dst_iter_memory, leftmost_dst_iter_bwd_memory) .execute(s, leftmost_dst_iter_memory, leftmost_dst_iter_bwd_memory); } auto leftmost_dst_iter_c_bwd_memory = leftmost_dst_iter_c_memory; if (leftmost_bwd_prim_desc.dst_iter_c_desc() != leftmost_dst_iter_c_bwd_memory.get_desc()) { leftmost_dst_iter_c_bwd_memory = mkldnn::memory(leftmost_bwd_prim_desc.dst_iter_c_desc(), eng); reorder(leftmost_dst_iter_c_memory, leftmost_dst_iter_c_bwd_memory) .execute(s, leftmost_dst_iter_c_memory, leftmost_dst_iter_c_bwd_memory); } // Construct the RNN primitive objects for backward lstm_backward rightmost_layer_bwd(rightmost_bwd_prim_desc); rightmost_layer_bwd.execute(s, {{MKLDNN_ARG_SRC_LAYER, rightmost_src_layer_bwd_memory}, {MKLDNN_ARG_SRC_ITER, rightmost_src_iter_memory}, {MKLDNN_ARG_SRC_ITER_C, rightmost_src_iter_c_memory}, {MKLDNN_ARG_WEIGHTS_LAYER, common_weights_layer_bwd_memory}, {MKLDNN_ARG_WEIGHTS_ITER, common_weights_iter_bwd_memory}, {MKLDNN_ARG_BIAS, common_bias_bwd_memory}, {MKLDNN_ARG_DST_LAYER, rightmost_dst_layer_bwd_memory}, {MKLDNN_ARG_DIFF_SRC_LAYER, rightmost_diff_src_layer_memory}, {MKLDNN_ARG_DIFF_SRC_ITER, rightmost_diff_src_iter_memory}, {MKLDNN_ARG_DIFF_SRC_ITER_C, rightmost_diff_src_iter_c_memory}, {MKLDNN_ARG_DIFF_WEIGHTS_LAYER, common_diff_weights_layer_memory}, {MKLDNN_ARG_DIFF_WEIGHTS_ITER, common_diff_weights_iter_memory}, {MKLDNN_ARG_DIFF_BIAS, common_diff_bias_memory}, {MKLDNN_ARG_DIFF_DST_LAYER, rightmost_diff_dst_layer_memory}, {MKLDNN_ARG_WORKSPACE, rightmost_workspace_memory}}); lstm_backward leftmost_layer_bwd(leftmost_bwd_prim_desc); leftmost_layer_bwd.execute(s, {{MKLDNN_ARG_SRC_LAYER, leftmost_src_layer_bwd_memory}, {MKLDNN_ARG_WEIGHTS_LAYER, common_weights_layer_bwd_memory}, {MKLDNN_ARG_WEIGHTS_ITER, common_weights_iter_bwd_memory}, {MKLDNN_ARG_BIAS, common_bias_bwd_memory}, {MKLDNN_ARG_DST_LAYER, leftmost_dst_layer_bwd_memory}, {MKLDNN_ARG_DST_ITER, leftmost_dst_iter_bwd_memory}, {MKLDNN_ARG_DST_ITER_C, leftmost_dst_iter_c_bwd_memory}, {MKLDNN_ARG_DIFF_SRC_LAYER, leftmost_diff_src_layer_memory}, {MKLDNN_ARG_DIFF_WEIGHTS_LAYER, common_diff_weights_layer_memory}, {MKLDNN_ARG_DIFF_WEIGHTS_ITER, common_diff_weights_iter_memory}, {MKLDNN_ARG_DIFF_BIAS, common_diff_bias_memory}, {MKLDNN_ARG_DIFF_DST_LAYER, leftmost_diff_dst_layer_memory}, {MKLDNN_ARG_DIFF_DST_ITER, leftmost_diff_dst_iter_memory}, {MKLDNN_ARG_DIFF_DST_ITER_C, leftmost_diff_dst_iter_c_memory}, {MKLDNN_ARG_WORKSPACE, leftmost_workspace_memory}}); if (reorder_common_diff_weights_layer) { reorder(common_diff_weights_layer_memory, user_common_diff_weights_layer_memory) .execute(s, common_diff_weights_layer_memory, user_common_diff_weights_layer_memory); } if (reorder_common_diff_bias) { reorder(common_diff_bias_memory, user_common_diff_bias_memory) .execute(s, common_diff_bias_memory, user_common_diff_bias_memory); } // // User updates weights and bias using diffs // s.wait(); } int main(int argc, char **argv) { try { simple_net(parse_engine_kind(argc, argv)); std::cout << "Simple Net example passes!\n"; } catch (error &e) { std::cerr << "status: " << e.status << std::endl; std::cerr << "message: " << e.message << std::endl; return 1; } return 0; }
{ "pile_set_name": "Github" }
//===-- LICM.cpp - Loop Invariant Code Motion Pass ------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This pass performs loop invariant code motion, attempting to remove as much // code from the body of a loop as possible. It does this by either hoisting // code into the preheader block, or by sinking code to the exit blocks if it is // safe. This pass also promotes must-aliased memory locations in the loop to // live in registers, thus hoisting and sinking "invariant" loads and stores. // // This pass uses alias analysis for two purposes: // // 1. Moving loop invariant loads and calls out of loops. If we can determine // that a load or call inside of a loop never aliases anything stored to, // we can hoist it or sink it like any other instruction. // 2. Scalar Promotion of Memory - If there is a store instruction inside of // the loop, we try to move the store to happen AFTER the loop instead of // inside of the loop. This can only happen if a few conditions are true: // A. The pointer stored through is loop invariant // B. There are no stores or loads in the loop which _may_ alias the // pointer. There are no calls in the loop which mod/ref the pointer. // If these conditions are true, we can promote the loads and stores in the // loop of the pointer to use a temporary alloca'd variable. We then use // the SSAUpdater to construct the appropriate SSA form for the value. // //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/LICM.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/CaptureTracking.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/Loads.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/LoopPassManager.h" #include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/PredIteratorCache.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/LoopUtils.h" #include "llvm/Transforms/Utils/SSAUpdater.h" #include <algorithm> #include <utility> using namespace llvm; #define DEBUG_TYPE "licm" STATISTIC(NumSunk, "Number of instructions sunk out of loop"); STATISTIC(NumHoisted, "Number of instructions hoisted out of loop"); STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk"); STATISTIC(NumMovedCalls, "Number of call insts hoisted or sunk"); STATISTIC(NumPromoted, "Number of memory locations promoted to registers"); static cl::opt<bool> DisablePromotion("disable-licm-promotion", cl::Hidden, cl::desc("Disable memory promotion in LICM pass")); static bool inSubLoop(BasicBlock *BB, Loop *CurLoop, LoopInfo *LI); static bool isNotUsedInLoop(const Instruction &I, const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo); static bool hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo); static bool sink(Instruction &I, const LoopInfo *LI, const DominatorTree *DT, const Loop *CurLoop, AliasSetTracker *CurAST, const LoopSafetyInfo *SafetyInfo); static bool isSafeToExecuteUnconditionally(const Instruction &Inst, const DominatorTree *DT, const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo, const Instruction *CtxI = nullptr); static bool pointerInvalidatedByLoop(Value *V, uint64_t Size, const AAMDNodes &AAInfo, AliasSetTracker *CurAST); static Instruction * CloneInstructionInExitBlock(Instruction &I, BasicBlock &ExitBlock, PHINode &PN, const LoopInfo *LI, const LoopSafetyInfo *SafetyInfo); static bool canSinkOrHoistInst(Instruction &I, AliasAnalysis *AA, DominatorTree *DT, TargetLibraryInfo *TLI, Loop *CurLoop, AliasSetTracker *CurAST, LoopSafetyInfo *SafetyInfo); namespace { struct LoopInvariantCodeMotion { bool runOnLoop(Loop *L, AliasAnalysis *AA, LoopInfo *LI, DominatorTree *DT, TargetLibraryInfo *TLI, ScalarEvolution *SE, bool DeleteAST); DenseMap<Loop *, AliasSetTracker *> &getLoopToAliasSetMap() { return LoopToAliasSetMap; } private: DenseMap<Loop *, AliasSetTracker *> LoopToAliasSetMap; AliasSetTracker *collectAliasInfoForLoop(Loop *L, LoopInfo *LI, AliasAnalysis *AA); }; struct LegacyLICMPass : public LoopPass { static char ID; // Pass identification, replacement for typeid LegacyLICMPass() : LoopPass(ID) { initializeLegacyLICMPassPass(*PassRegistry::getPassRegistry()); } bool runOnLoop(Loop *L, LPPassManager &LPM) override { if (skipLoop(L)) return false; auto *SE = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>(); return LICM.runOnLoop(L, &getAnalysis<AAResultsWrapperPass>().getAAResults(), &getAnalysis<LoopInfoWrapperPass>().getLoopInfo(), &getAnalysis<DominatorTreeWrapperPass>().getDomTree(), &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(), SE ? &SE->getSE() : nullptr, false); } /// This transformation requires natural loop information & requires that /// loop preheaders be inserted into the CFG... /// void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesCFG(); AU.addRequired<TargetLibraryInfoWrapperPass>(); getLoopAnalysisUsage(AU); } using llvm::Pass::doFinalization; bool doFinalization() override { assert(LICM.getLoopToAliasSetMap().empty() && "Didn't free loop alias sets"); return false; } private: LoopInvariantCodeMotion LICM; /// cloneBasicBlockAnalysis - Simple Analysis hook. Clone alias set info. void cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To, Loop *L) override; /// deleteAnalysisValue - Simple Analysis hook. Delete value V from alias /// set. void deleteAnalysisValue(Value *V, Loop *L) override; /// Simple Analysis hook. Delete loop L from alias set map. void deleteAnalysisLoop(Loop *L) override; }; } PreservedAnalyses LICMPass::run(Loop &L, AnalysisManager<Loop> &AM) { const auto &FAM = AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager(); Function *F = L.getHeader()->getParent(); auto *AA = FAM.getCachedResult<AAManager>(*F); auto *LI = FAM.getCachedResult<LoopAnalysis>(*F); auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(*F); auto *TLI = FAM.getCachedResult<TargetLibraryAnalysis>(*F); auto *SE = FAM.getCachedResult<ScalarEvolutionAnalysis>(*F); assert((AA && LI && DT && TLI && SE) && "Analyses for LICM not available"); LoopInvariantCodeMotion LICM; if (!LICM.runOnLoop(&L, AA, LI, DT, TLI, SE, true)) return PreservedAnalyses::all(); // FIXME: There is no setPreservesCFG in the new PM. When that becomes // available, it should be used here. return getLoopPassPreservedAnalyses(); } char LegacyLICMPass::ID = 0; INITIALIZE_PASS_BEGIN(LegacyLICMPass, "licm", "Loop Invariant Code Motion", false, false) INITIALIZE_PASS_DEPENDENCY(LoopPass) INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) INITIALIZE_PASS_END(LegacyLICMPass, "licm", "Loop Invariant Code Motion", false, false) Pass *llvm::createLICMPass() { return new LegacyLICMPass(); } /// Hoist expressions out of the specified loop. Note, alias info for inner /// loop is not preserved so it is not a good idea to run LICM multiple /// times on one loop. /// We should delete AST for inner loops in the new pass manager to avoid /// memory leak. /// bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA, LoopInfo *LI, DominatorTree *DT, TargetLibraryInfo *TLI, ScalarEvolution *SE, bool DeleteAST) { bool Changed = false; assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form."); AliasSetTracker *CurAST = collectAliasInfoForLoop(L, LI, AA); // Get the preheader block to move instructions into... BasicBlock *Preheader = L->getLoopPreheader(); // Compute loop safety information. LoopSafetyInfo SafetyInfo; computeLoopSafetyInfo(&SafetyInfo, L); // We want to visit all of the instructions in this loop... that are not parts // of our subloops (they have already had their invariants hoisted out of // their loop, into this loop, so there is no need to process the BODIES of // the subloops). // // Traverse the body of the loop in depth first order on the dominator tree so // that we are guaranteed to see definitions before we see uses. This allows // us to sink instructions in one pass, without iteration. After sinking // instructions, we perform another pass to hoist them out of the loop. // if (L->hasDedicatedExits()) Changed |= sinkRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, L, CurAST, &SafetyInfo); if (Preheader) Changed |= hoistRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, L, CurAST, &SafetyInfo); // Now that all loop invariants have been removed from the loop, promote any // memory references to scalars that we can. if (!DisablePromotion && (Preheader || L->hasDedicatedExits())) { SmallVector<BasicBlock *, 8> ExitBlocks; SmallVector<Instruction *, 8> InsertPts; PredIteratorCache PIC; // Loop over all of the alias sets in the tracker object. for (AliasSet &AS : *CurAST) Changed |= promoteLoopAccessesToScalars( AS, ExitBlocks, InsertPts, PIC, LI, DT, TLI, L, CurAST, &SafetyInfo); // Once we have promoted values across the loop body we have to recursively // reform LCSSA as any nested loop may now have values defined within the // loop used in the outer loop. // FIXME: This is really heavy handed. It would be a bit better to use an // SSAUpdater strategy during promotion that was LCSSA aware and reformed // it as it went. if (Changed) { formLCSSARecursively(*L, *DT, LI, SE); } } // Check that neither this loop nor its parent have had LCSSA broken. LICM is // specifically moving instructions across the loop boundary and so it is // especially in need of sanity checking here. assert(L->isLCSSAForm(*DT) && "Loop not left in LCSSA form after LICM!"); assert((!L->getParentLoop() || L->getParentLoop()->isLCSSAForm(*DT)) && "Parent loop not left in LCSSA form after LICM!"); // If this loop is nested inside of another one, save the alias information // for when we process the outer loop. if (L->getParentLoop() && !DeleteAST) LoopToAliasSetMap[L] = CurAST; else delete CurAST; if (Changed && SE) SE->forgetLoopDispositions(L); return Changed; } /// Walk the specified region of the CFG (defined by all blocks dominated by /// the specified block, and that are in the current loop) in reverse depth /// first order w.r.t the DominatorTree. This allows us to visit uses before /// definitions, allowing us to sink a loop body in one pass without iteration. /// bool llvm::sinkRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI, DominatorTree *DT, TargetLibraryInfo *TLI, Loop *CurLoop, AliasSetTracker *CurAST, LoopSafetyInfo *SafetyInfo) { // Verify inputs. assert(N != nullptr && AA != nullptr && LI != nullptr && DT != nullptr && CurLoop != nullptr && CurAST != nullptr && SafetyInfo != nullptr && "Unexpected input to sinkRegion"); BasicBlock *BB = N->getBlock(); // If this subregion is not in the top level loop at all, exit. if (!CurLoop->contains(BB)) return false; // We are processing blocks in reverse dfo, so process children first. bool Changed = false; const std::vector<DomTreeNode *> &Children = N->getChildren(); for (DomTreeNode *Child : Children) Changed |= sinkRegion(Child, AA, LI, DT, TLI, CurLoop, CurAST, SafetyInfo); // Only need to process the contents of this block if it is not part of a // subloop (which would already have been processed). if (inSubLoop(BB, CurLoop, LI)) return Changed; for (BasicBlock::iterator II = BB->end(); II != BB->begin();) { Instruction &I = *--II; // If the instruction is dead, we would try to sink it because it isn't used // in the loop, instead, just delete it. if (isInstructionTriviallyDead(&I, TLI)) { DEBUG(dbgs() << "LICM deleting dead inst: " << I << '\n'); ++II; CurAST->deleteValue(&I); I.eraseFromParent(); Changed = true; continue; } // Check to see if we can sink this instruction to the exit blocks // of the loop. We can do this if the all users of the instruction are // outside of the loop. In this case, it doesn't even matter if the // operands of the instruction are loop invariant. // if (isNotUsedInLoop(I, CurLoop, SafetyInfo) && canSinkOrHoistInst(I, AA, DT, TLI, CurLoop, CurAST, SafetyInfo)) { ++II; Changed |= sink(I, LI, DT, CurLoop, CurAST, SafetyInfo); } } return Changed; } /// Walk the specified region of the CFG (defined by all blocks dominated by /// the specified block, and that are in the current loop) in depth first /// order w.r.t the DominatorTree. This allows us to visit definitions before /// uses, allowing us to hoist a loop body in one pass without iteration. /// bool llvm::hoistRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI, DominatorTree *DT, TargetLibraryInfo *TLI, Loop *CurLoop, AliasSetTracker *CurAST, LoopSafetyInfo *SafetyInfo) { // Verify inputs. assert(N != nullptr && AA != nullptr && LI != nullptr && DT != nullptr && CurLoop != nullptr && CurAST != nullptr && SafetyInfo != nullptr && "Unexpected input to hoistRegion"); BasicBlock *BB = N->getBlock(); // If this subregion is not in the top level loop at all, exit. if (!CurLoop->contains(BB)) return false; // Only need to process the contents of this block if it is not part of a // subloop (which would already have been processed). bool Changed = false; if (!inSubLoop(BB, CurLoop, LI)) for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) { Instruction &I = *II++; // Try constant folding this instruction. If all the operands are // constants, it is technically hoistable, but it would be better to just // fold it. if (Constant *C = ConstantFoldInstruction( &I, I.getModule()->getDataLayout(), TLI)) { DEBUG(dbgs() << "LICM folding inst: " << I << " --> " << *C << '\n'); CurAST->copyValue(&I, C); I.replaceAllUsesWith(C); if (isInstructionTriviallyDead(&I, TLI)) { CurAST->deleteValue(&I); I.eraseFromParent(); } continue; } // Try hoisting the instruction out to the preheader. We can only do this // if all of the operands of the instruction are loop invariant and if it // is safe to hoist the instruction. // if (CurLoop->hasLoopInvariantOperands(&I) && canSinkOrHoistInst(I, AA, DT, TLI, CurLoop, CurAST, SafetyInfo) && isSafeToExecuteUnconditionally( I, DT, CurLoop, SafetyInfo, CurLoop->getLoopPreheader()->getTerminator())) Changed |= hoist(I, DT, CurLoop, SafetyInfo); } const std::vector<DomTreeNode *> &Children = N->getChildren(); for (DomTreeNode *Child : Children) Changed |= hoistRegion(Child, AA, LI, DT, TLI, CurLoop, CurAST, SafetyInfo); return Changed; } /// Computes loop safety information, checks loop body & header /// for the possibility of may throw exception. /// void llvm::computeLoopSafetyInfo(LoopSafetyInfo *SafetyInfo, Loop *CurLoop) { assert(CurLoop != nullptr && "CurLoop cant be null"); BasicBlock *Header = CurLoop->getHeader(); // Setting default safety values. SafetyInfo->MayThrow = false; SafetyInfo->HeaderMayThrow = false; // Iterate over header and compute safety info. for (BasicBlock::iterator I = Header->begin(), E = Header->end(); (I != E) && !SafetyInfo->HeaderMayThrow; ++I) SafetyInfo->HeaderMayThrow |= !isGuaranteedToTransferExecutionToSuccessor(&*I); SafetyInfo->MayThrow = SafetyInfo->HeaderMayThrow; // Iterate over loop instructions and compute safety info. for (Loop::block_iterator BB = CurLoop->block_begin(), BBE = CurLoop->block_end(); (BB != BBE) && !SafetyInfo->MayThrow; ++BB) for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); (I != E) && !SafetyInfo->MayThrow; ++I) SafetyInfo->MayThrow |= !isGuaranteedToTransferExecutionToSuccessor(&*I); // Compute funclet colors if we might sink/hoist in a function with a funclet // personality routine. Function *Fn = CurLoop->getHeader()->getParent(); if (Fn->hasPersonalityFn()) if (Constant *PersonalityFn = Fn->getPersonalityFn()) if (isFuncletEHPersonality(classifyEHPersonality(PersonalityFn))) SafetyInfo->BlockColors = colorEHFunclets(*Fn); } /// canSinkOrHoistInst - Return true if the hoister and sinker can handle this /// instruction. /// bool canSinkOrHoistInst(Instruction &I, AliasAnalysis *AA, DominatorTree *DT, TargetLibraryInfo *TLI, Loop *CurLoop, AliasSetTracker *CurAST, LoopSafetyInfo *SafetyInfo) { // Loads have extra constraints we have to verify before we can hoist them. if (LoadInst *LI = dyn_cast<LoadInst>(&I)) { if (!LI->isUnordered()) return false; // Don't hoist volatile/atomic loads! // Loads from constant memory are always safe to move, even if they end up // in the same alias set as something that ends up being modified. if (AA->pointsToConstantMemory(LI->getOperand(0))) return true; if (LI->getMetadata(LLVMContext::MD_invariant_load)) return true; // Don't hoist loads which have may-aliased stores in loop. uint64_t Size = 0; if (LI->getType()->isSized()) Size = I.getModule()->getDataLayout().getTypeStoreSize(LI->getType()); AAMDNodes AAInfo; LI->getAAMetadata(AAInfo); return !pointerInvalidatedByLoop(LI->getOperand(0), Size, AAInfo, CurAST); } else if (CallInst *CI = dyn_cast<CallInst>(&I)) { // Don't sink or hoist dbg info; it's legal, but not useful. if (isa<DbgInfoIntrinsic>(I)) return false; // Don't sink calls which can throw. if (CI->mayThrow()) return false; // Handle simple cases by querying alias analysis. FunctionModRefBehavior Behavior = AA->getModRefBehavior(CI); if (Behavior == FMRB_DoesNotAccessMemory) return true; if (AliasAnalysis::onlyReadsMemory(Behavior)) { // A readonly argmemonly function only reads from memory pointed to by // it's arguments with arbitrary offsets. If we can prove there are no // writes to this memory in the loop, we can hoist or sink. if (AliasAnalysis::onlyAccessesArgPointees(Behavior)) { for (Value *Op : CI->arg_operands()) if (Op->getType()->isPointerTy() && pointerInvalidatedByLoop(Op, MemoryLocation::UnknownSize, AAMDNodes(), CurAST)) return false; return true; } // If this call only reads from memory and there are no writes to memory // in the loop, we can hoist or sink the call as appropriate. bool FoundMod = false; for (AliasSet &AS : *CurAST) { if (!AS.isForwardingAliasSet() && AS.isMod()) { FoundMod = true; break; } } if (!FoundMod) return true; } // FIXME: This should use mod/ref information to see if we can hoist or // sink the call. return false; } // Only these instructions are hoistable/sinkable. if (!isa<BinaryOperator>(I) && !isa<CastInst>(I) && !isa<SelectInst>(I) && !isa<GetElementPtrInst>(I) && !isa<CmpInst>(I) && !isa<InsertElementInst>(I) && !isa<ExtractElementInst>(I) && !isa<ShuffleVectorInst>(I) && !isa<ExtractValueInst>(I) && !isa<InsertValueInst>(I)) return false; // TODO: Plumb the context instruction through to make hoisting and sinking // more powerful. Hoisting of loads already works due to the special casing // above. return isSafeToExecuteUnconditionally(I, DT, CurLoop, SafetyInfo, nullptr); } /// Returns true if a PHINode is a trivially replaceable with an /// Instruction. /// This is true when all incoming values are that instruction. /// This pattern occurs most often with LCSSA PHI nodes. /// static bool isTriviallyReplacablePHI(const PHINode &PN, const Instruction &I) { for (const Value *IncValue : PN.incoming_values()) if (IncValue != &I) return false; return true; } /// Return true if the only users of this instruction are outside of /// the loop. If this is true, we can sink the instruction to the exit /// blocks of the loop. /// static bool isNotUsedInLoop(const Instruction &I, const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo) { const auto &BlockColors = SafetyInfo->BlockColors; for (const User *U : I.users()) { const Instruction *UI = cast<Instruction>(U); if (const PHINode *PN = dyn_cast<PHINode>(UI)) { const BasicBlock *BB = PN->getParent(); // We cannot sink uses in catchswitches. if (isa<CatchSwitchInst>(BB->getTerminator())) return false; // We need to sink a callsite to a unique funclet. Avoid sinking if the // phi use is too muddled. if (isa<CallInst>(I)) if (!BlockColors.empty() && BlockColors.find(const_cast<BasicBlock *>(BB))->second.size() != 1) return false; // A PHI node where all of the incoming values are this instruction are // special -- they can just be RAUW'ed with the instruction and thus // don't require a use in the predecessor. This is a particular important // special case because it is the pattern found in LCSSA form. if (isTriviallyReplacablePHI(*PN, I)) { if (CurLoop->contains(PN)) return false; else continue; } // Otherwise, PHI node uses occur in predecessor blocks if the incoming // values. Check for such a use being inside the loop. for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (PN->getIncomingValue(i) == &I) if (CurLoop->contains(PN->getIncomingBlock(i))) return false; continue; } if (CurLoop->contains(UI)) return false; } return true; } static Instruction * CloneInstructionInExitBlock(Instruction &I, BasicBlock &ExitBlock, PHINode &PN, const LoopInfo *LI, const LoopSafetyInfo *SafetyInfo) { Instruction *New; if (auto *CI = dyn_cast<CallInst>(&I)) { const auto &BlockColors = SafetyInfo->BlockColors; // Sinking call-sites need to be handled differently from other // instructions. The cloned call-site needs a funclet bundle operand // appropriate for it's location in the CFG. SmallVector<OperandBundleDef, 1> OpBundles; for (unsigned BundleIdx = 0, BundleEnd = CI->getNumOperandBundles(); BundleIdx != BundleEnd; ++BundleIdx) { OperandBundleUse Bundle = CI->getOperandBundleAt(BundleIdx); if (Bundle.getTagID() == LLVMContext::OB_funclet) continue; OpBundles.emplace_back(Bundle); } if (!BlockColors.empty()) { const ColorVector &CV = BlockColors.find(&ExitBlock)->second; assert(CV.size() == 1 && "non-unique color for exit block!"); BasicBlock *BBColor = CV.front(); Instruction *EHPad = BBColor->getFirstNonPHI(); if (EHPad->isEHPad()) OpBundles.emplace_back("funclet", EHPad); } New = CallInst::Create(CI, OpBundles); } else { New = I.clone(); } ExitBlock.getInstList().insert(ExitBlock.getFirstInsertionPt(), New); if (!I.getName().empty()) New->setName(I.getName() + ".le"); // Build LCSSA PHI nodes for any in-loop operands. Note that this is // particularly cheap because we can rip off the PHI node that we're // replacing for the number and blocks of the predecessors. // OPT: If this shows up in a profile, we can instead finish sinking all // invariant instructions, and then walk their operands to re-establish // LCSSA. That will eliminate creating PHI nodes just to nuke them when // sinking bottom-up. for (User::op_iterator OI = New->op_begin(), OE = New->op_end(); OI != OE; ++OI) if (Instruction *OInst = dyn_cast<Instruction>(*OI)) if (Loop *OLoop = LI->getLoopFor(OInst->getParent())) if (!OLoop->contains(&PN)) { PHINode *OpPN = PHINode::Create(OInst->getType(), PN.getNumIncomingValues(), OInst->getName() + ".lcssa", &ExitBlock.front()); for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) OpPN->addIncoming(OInst, PN.getIncomingBlock(i)); *OI = OpPN; } return New; } /// When an instruction is found to only be used outside of the loop, this /// function moves it to the exit blocks and patches up SSA form as needed. /// This method is guaranteed to remove the original instruction from its /// position, and may either delete it or move it to outside of the loop. /// static bool sink(Instruction &I, const LoopInfo *LI, const DominatorTree *DT, const Loop *CurLoop, AliasSetTracker *CurAST, const LoopSafetyInfo *SafetyInfo) { DEBUG(dbgs() << "LICM sinking instruction: " << I << "\n"); bool Changed = false; if (isa<LoadInst>(I)) ++NumMovedLoads; else if (isa<CallInst>(I)) ++NumMovedCalls; ++NumSunk; Changed = true; #ifndef NDEBUG SmallVector<BasicBlock *, 32> ExitBlocks; CurLoop->getUniqueExitBlocks(ExitBlocks); SmallPtrSet<BasicBlock *, 32> ExitBlockSet(ExitBlocks.begin(), ExitBlocks.end()); #endif // Clones of this instruction. Don't create more than one per exit block! SmallDenseMap<BasicBlock *, Instruction *, 32> SunkCopies; // If this instruction is only used outside of the loop, then all users are // PHI nodes in exit blocks due to LCSSA form. Just RAUW them with clones of // the instruction. while (!I.use_empty()) { Value::user_iterator UI = I.user_begin(); auto *User = cast<Instruction>(*UI); if (!DT->isReachableFromEntry(User->getParent())) { User->replaceUsesOfWith(&I, UndefValue::get(I.getType())); continue; } // The user must be a PHI node. PHINode *PN = cast<PHINode>(User); // Surprisingly, instructions can be used outside of loops without any // exits. This can only happen in PHI nodes if the incoming block is // unreachable. Use &U = UI.getUse(); BasicBlock *BB = PN->getIncomingBlock(U); if (!DT->isReachableFromEntry(BB)) { U = UndefValue::get(I.getType()); continue; } BasicBlock *ExitBlock = PN->getParent(); assert(ExitBlockSet.count(ExitBlock) && "The LCSSA PHI is not in an exit block!"); Instruction *New; auto It = SunkCopies.find(ExitBlock); if (It != SunkCopies.end()) New = It->second; else New = SunkCopies[ExitBlock] = CloneInstructionInExitBlock(I, *ExitBlock, *PN, LI, SafetyInfo); PN->replaceAllUsesWith(New); PN->eraseFromParent(); } CurAST->deleteValue(&I); I.eraseFromParent(); return Changed; } /// When an instruction is found to only use loop invariant operands that /// is safe to hoist, this instruction is called to do the dirty work. /// static bool hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo) { auto *Preheader = CurLoop->getLoopPreheader(); DEBUG(dbgs() << "LICM hoisting to " << Preheader->getName() << ": " << I << "\n"); // Metadata can be dependent on conditions we are hoisting above. // Conservatively strip all metadata on the instruction unless we were // guaranteed to execute I if we entered the loop, in which case the metadata // is valid in the loop preheader. if (I.hasMetadataOtherThanDebugLoc() && // The check on hasMetadataOtherThanDebugLoc is to prevent us from burning // time in isGuaranteedToExecute if we don't actually have anything to // drop. It is a compile time optimization, not required for correctness. !isGuaranteedToExecute(I, DT, CurLoop, SafetyInfo)) I.dropUnknownNonDebugMetadata(); // Move the new node to the Preheader, before its terminator. I.moveBefore(Preheader->getTerminator()); if (isa<LoadInst>(I)) ++NumMovedLoads; else if (isa<CallInst>(I)) ++NumMovedCalls; ++NumHoisted; return true; } /// Only sink or hoist an instruction if it is not a trapping instruction, /// or if the instruction is known not to trap when moved to the preheader. /// or if it is a trapping instruction and is guaranteed to execute. static bool isSafeToExecuteUnconditionally(const Instruction &Inst, const DominatorTree *DT, const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo, const Instruction *CtxI) { if (isSafeToSpeculativelyExecute(&Inst, CtxI, DT)) return true; return isGuaranteedToExecute(Inst, DT, CurLoop, SafetyInfo); } namespace { class LoopPromoter : public LoadAndStorePromoter { Value *SomePtr; // Designated pointer to store to. SmallPtrSetImpl<Value *> &PointerMustAliases; SmallVectorImpl<BasicBlock *> &LoopExitBlocks; SmallVectorImpl<Instruction *> &LoopInsertPts; PredIteratorCache &PredCache; AliasSetTracker &AST; LoopInfo &LI; DebugLoc DL; int Alignment; AAMDNodes AATags; Value *maybeInsertLCSSAPHI(Value *V, BasicBlock *BB) const { if (Instruction *I = dyn_cast<Instruction>(V)) if (Loop *L = LI.getLoopFor(I->getParent())) if (!L->contains(BB)) { // We need to create an LCSSA PHI node for the incoming value and // store that. PHINode *PN = PHINode::Create(I->getType(), PredCache.size(BB), I->getName() + ".lcssa", &BB->front()); for (BasicBlock *Pred : PredCache.get(BB)) PN->addIncoming(I, Pred); return PN; } return V; } public: LoopPromoter(Value *SP, ArrayRef<const Instruction *> Insts, SSAUpdater &S, SmallPtrSetImpl<Value *> &PMA, SmallVectorImpl<BasicBlock *> &LEB, SmallVectorImpl<Instruction *> &LIP, PredIteratorCache &PIC, AliasSetTracker &ast, LoopInfo &li, DebugLoc dl, int alignment, const AAMDNodes &AATags) : LoadAndStorePromoter(Insts, S), SomePtr(SP), PointerMustAliases(PMA), LoopExitBlocks(LEB), LoopInsertPts(LIP), PredCache(PIC), AST(ast), LI(li), DL(std::move(dl)), Alignment(alignment), AATags(AATags) {} bool isInstInList(Instruction *I, const SmallVectorImpl<Instruction *> &) const override { Value *Ptr; if (LoadInst *LI = dyn_cast<LoadInst>(I)) Ptr = LI->getOperand(0); else Ptr = cast<StoreInst>(I)->getPointerOperand(); return PointerMustAliases.count(Ptr); } void doExtraRewritesBeforeFinalDeletion() const override { // Insert stores after in the loop exit blocks. Each exit block gets a // store of the live-out values that feed them. Since we've already told // the SSA updater about the defs in the loop and the preheader // definition, it is all set and we can start using it. for (unsigned i = 0, e = LoopExitBlocks.size(); i != e; ++i) { BasicBlock *ExitBlock = LoopExitBlocks[i]; Value *LiveInValue = SSA.GetValueInMiddleOfBlock(ExitBlock); LiveInValue = maybeInsertLCSSAPHI(LiveInValue, ExitBlock); Value *Ptr = maybeInsertLCSSAPHI(SomePtr, ExitBlock); Instruction *InsertPos = LoopInsertPts[i]; StoreInst *NewSI = new StoreInst(LiveInValue, Ptr, InsertPos); NewSI->setAlignment(Alignment); NewSI->setDebugLoc(DL); if (AATags) NewSI->setAAMetadata(AATags); } } void replaceLoadWithValue(LoadInst *LI, Value *V) const override { // Update alias analysis. AST.copyValue(LI, V); } void instructionDeleted(Instruction *I) const override { AST.deleteValue(I); } }; } // end anon namespace /// Try to promote memory values to scalars by sinking stores out of the /// loop and moving loads to before the loop. We do this by looping over /// the stores in the loop, looking for stores to Must pointers which are /// loop invariant. /// bool llvm::promoteLoopAccessesToScalars( AliasSet &AS, SmallVectorImpl<BasicBlock *> &ExitBlocks, SmallVectorImpl<Instruction *> &InsertPts, PredIteratorCache &PIC, LoopInfo *LI, DominatorTree *DT, const TargetLibraryInfo *TLI, Loop *CurLoop, AliasSetTracker *CurAST, LoopSafetyInfo *SafetyInfo) { // Verify inputs. assert(LI != nullptr && DT != nullptr && CurLoop != nullptr && CurAST != nullptr && SafetyInfo != nullptr && "Unexpected Input to promoteLoopAccessesToScalars"); // We can promote this alias set if it has a store, if it is a "Must" alias // set, if the pointer is loop invariant, and if we are not eliminating any // volatile loads or stores. if (AS.isForwardingAliasSet() || !AS.isMod() || !AS.isMustAlias() || AS.isVolatile() || !CurLoop->isLoopInvariant(AS.begin()->getValue())) return false; assert(!AS.empty() && "Must alias set should have at least one pointer element in it!"); Value *SomePtr = AS.begin()->getValue(); BasicBlock *Preheader = CurLoop->getLoopPreheader(); // It isn't safe to promote a load/store from the loop if the load/store is // conditional. For example, turning: // // for () { if (c) *P += 1; } // // into: // // tmp = *P; for () { if (c) tmp +=1; } *P = tmp; // // is not safe, because *P may only be valid to access if 'c' is true. // // The safety property divides into two parts: // 1) The memory may not be dereferenceable on entry to the loop. In this // case, we can't insert the required load in the preheader. // 2) The memory model does not allow us to insert a store along any dynamic // path which did not originally have one. // // It is safe to promote P if all uses are direct load/stores and if at // least one is guaranteed to be executed. bool GuaranteedToExecute = false; // It is also safe to promote P if we can prove that speculating a load into // the preheader is safe (i.e. proving dereferenceability on all // paths through the loop), and that the memory can be proven thread local // (so that the memory model requirement doesn't apply.) We first establish // the former, and then run a capture analysis below to establish the later. // We can use any access within the alias set to prove dereferenceability // since they're all must alias. bool CanSpeculateLoad = false; SmallVector<Instruction *, 64> LoopUses; SmallPtrSet<Value *, 4> PointerMustAliases; // We start with an alignment of one and try to find instructions that allow // us to prove better alignment. unsigned Alignment = 1; AAMDNodes AATags; bool HasDedicatedExits = CurLoop->hasDedicatedExits(); // Don't sink stores from loops without dedicated block exits. Exits // containing indirect branches are not transformed by loop simplify, // make sure we catch that. An additional load may be generated in the // preheader for SSA updater, so also avoid sinking when no preheader // is available. if (!HasDedicatedExits || !Preheader) return false; const DataLayout &MDL = Preheader->getModule()->getDataLayout(); if (SafetyInfo->MayThrow) { // If a loop can throw, we have to insert a store along each unwind edge. // That said, we can't actually make the unwind edge explicit. Therefore, // we have to prove that the store is dead along the unwind edge. // // Currently, this code just special-cases alloca instructions. if (!isa<AllocaInst>(GetUnderlyingObject(SomePtr, MDL))) return false; } // Check that all of the pointers in the alias set have the same type. We // cannot (yet) promote a memory location that is loaded and stored in // different sizes. While we are at it, collect alignment and AA info. bool Changed = false; for (const auto &ASI : AS) { Value *ASIV = ASI.getValue(); PointerMustAliases.insert(ASIV); // Check that all of the pointers in the alias set have the same type. We // cannot (yet) promote a memory location that is loaded and stored in // different sizes. if (SomePtr->getType() != ASIV->getType()) return Changed; for (User *U : ASIV->users()) { // Ignore instructions that are outside the loop. Instruction *UI = dyn_cast<Instruction>(U); if (!UI || !CurLoop->contains(UI)) continue; // If there is an non-load/store instruction in the loop, we can't promote // it. if (const LoadInst *Load = dyn_cast<LoadInst>(UI)) { assert(!Load->isVolatile() && "AST broken"); if (!Load->isSimple()) return Changed; if (!GuaranteedToExecute && !CanSpeculateLoad) CanSpeculateLoad = isSafeToExecuteUnconditionally( *Load, DT, CurLoop, SafetyInfo, Preheader->getTerminator()); } else if (const StoreInst *Store = dyn_cast<StoreInst>(UI)) { // Stores *of* the pointer are not interesting, only stores *to* the // pointer. if (UI->getOperand(1) != ASIV) continue; assert(!Store->isVolatile() && "AST broken"); if (!Store->isSimple()) return Changed; // Note that we only check GuaranteedToExecute inside the store case // so that we do not introduce stores where they did not exist before // (which would break the LLVM concurrency model). // If the alignment of this instruction allows us to specify a more // restrictive (and performant) alignment and if we are sure this // instruction will be executed, update the alignment. // Larger is better, with the exception of 0 being the best alignment. unsigned InstAlignment = Store->getAlignment(); if ((InstAlignment > Alignment || InstAlignment == 0) && Alignment != 0) { if (isGuaranteedToExecute(*UI, DT, CurLoop, SafetyInfo)) { GuaranteedToExecute = true; Alignment = InstAlignment; } } else if (!GuaranteedToExecute) { GuaranteedToExecute = isGuaranteedToExecute(*UI, DT, CurLoop, SafetyInfo); } if (!GuaranteedToExecute && !CanSpeculateLoad) { CanSpeculateLoad = isDereferenceableAndAlignedPointer( Store->getPointerOperand(), Store->getAlignment(), MDL, Preheader->getTerminator(), DT); } } else return Changed; // Not a load or store. // Merge the AA tags. if (LoopUses.empty()) { // On the first load/store, just take its AA tags. UI->getAAMetadata(AATags); } else if (AATags) { UI->getAAMetadata(AATags, /* Merge = */ true); } LoopUses.push_back(UI); } } // Check legality per comment above. Otherwise, we can't promote. bool PromotionIsLegal = GuaranteedToExecute; if (!PromotionIsLegal && CanSpeculateLoad) { // If this is a thread local location, then we can insert stores along // paths which originally didn't have them without violating the memory // model. Value *Object = GetUnderlyingObject(SomePtr, MDL); PromotionIsLegal = isAllocLikeFn(Object, TLI) && !PointerMayBeCaptured(Object, true, true); } if (!PromotionIsLegal) return Changed; // Figure out the loop exits and their insertion points, if this is the // first promotion. if (ExitBlocks.empty()) { CurLoop->getUniqueExitBlocks(ExitBlocks); InsertPts.clear(); InsertPts.reserve(ExitBlocks.size()); for (BasicBlock *ExitBlock : ExitBlocks) InsertPts.push_back(&*ExitBlock->getFirstInsertionPt()); } // Can't insert into a catchswitch. for (BasicBlock *ExitBlock : ExitBlocks) if (isa<CatchSwitchInst>(ExitBlock->getTerminator())) return Changed; // Otherwise, this is safe to promote, lets do it! DEBUG(dbgs() << "LICM: Promoting value stored to in loop: " << *SomePtr << '\n'); Changed = true; ++NumPromoted; // Grab a debug location for the inserted loads/stores; given that the // inserted loads/stores have little relation to the original loads/stores, // this code just arbitrarily picks a location from one, since any debug // location is better than none. DebugLoc DL = LoopUses[0]->getDebugLoc(); // We use the SSAUpdater interface to insert phi nodes as required. SmallVector<PHINode *, 16> NewPHIs; SSAUpdater SSA(&NewPHIs); LoopPromoter Promoter(SomePtr, LoopUses, SSA, PointerMustAliases, ExitBlocks, InsertPts, PIC, *CurAST, *LI, DL, Alignment, AATags); // Set up the preheader to have a definition of the value. It is the live-out // value from the preheader that uses in the loop will use. LoadInst *PreheaderLoad = new LoadInst( SomePtr, SomePtr->getName() + ".promoted", Preheader->getTerminator()); PreheaderLoad->setAlignment(Alignment); PreheaderLoad->setDebugLoc(DL); if (AATags) PreheaderLoad->setAAMetadata(AATags); SSA.AddAvailableValue(Preheader, PreheaderLoad); // Rewrite all the loads in the loop and remember all the definitions from // stores in the loop. Promoter.run(LoopUses); // If the SSAUpdater didn't use the load in the preheader, just zap it now. if (PreheaderLoad->use_empty()) PreheaderLoad->eraseFromParent(); return Changed; } /// Returns an owning pointer to an alias set which incorporates aliasing info /// from L and all subloops of L. /// FIXME: In new pass manager, there is no helper functions to handle loop /// analysis such as cloneBasicBlockAnalysis. So the AST needs to be recompute /// from scratch for every loop. Hook up with the helper functions when /// available in the new pass manager to avoid redundant computation. AliasSetTracker * LoopInvariantCodeMotion::collectAliasInfoForLoop(Loop *L, LoopInfo *LI, AliasAnalysis *AA) { AliasSetTracker *CurAST = nullptr; SmallVector<Loop *, 4> RecomputeLoops; for (Loop *InnerL : L->getSubLoops()) { auto MapI = LoopToAliasSetMap.find(InnerL); // If the AST for this inner loop is missing it may have been merged into // some other loop's AST and then that loop unrolled, and so we need to // recompute it. if (MapI == LoopToAliasSetMap.end()) { RecomputeLoops.push_back(InnerL); continue; } AliasSetTracker *InnerAST = MapI->second; if (CurAST != nullptr) { // What if InnerLoop was modified by other passes ? CurAST->add(*InnerAST); // Once we've incorporated the inner loop's AST into ours, we don't need // the subloop's anymore. delete InnerAST; } else { CurAST = InnerAST; } LoopToAliasSetMap.erase(MapI); } if (CurAST == nullptr) CurAST = new AliasSetTracker(*AA); auto mergeLoop = [&](Loop *L) { // Loop over the body of this loop, looking for calls, invokes, and stores. // Because subloops have already been incorporated into AST, we skip blocks // in subloops. for (BasicBlock *BB : L->blocks()) if (LI->getLoopFor(BB) == L) // Ignore blocks in subloops. CurAST->add(*BB); // Incorporate the specified basic block }; // Add everything from the sub loops that are no longer directly available. for (Loop *InnerL : RecomputeLoops) mergeLoop(InnerL); // And merge in this loop. mergeLoop(L); return CurAST; } /// Simple analysis hook. Clone alias set info. /// void LegacyLICMPass::cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To, Loop *L) { AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L); if (!AST) return; AST->copyValue(From, To); } /// Simple Analysis hook. Delete value V from alias set /// void LegacyLICMPass::deleteAnalysisValue(Value *V, Loop *L) { AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L); if (!AST) return; AST->deleteValue(V); } /// Simple Analysis hook. Delete value L from alias set map. /// void LegacyLICMPass::deleteAnalysisLoop(Loop *L) { AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L); if (!AST) return; delete AST; LICM.getLoopToAliasSetMap().erase(L); } /// Return true if the body of this loop may store into the memory /// location pointed to by V. /// static bool pointerInvalidatedByLoop(Value *V, uint64_t Size, const AAMDNodes &AAInfo, AliasSetTracker *CurAST) { // Check to see if any of the basic blocks in CurLoop invalidate *V. return CurAST->getAliasSetForPointer(V, Size, AAInfo).isMod(); } /// Little predicate that returns true if the specified basic block is in /// a subloop of the current one, not the current one itself. /// static bool inSubLoop(BasicBlock *BB, Loop *CurLoop, LoopInfo *LI) { assert(CurLoop->contains(BB) && "Only valid if BB is IN the loop"); return LI->getLoopFor(BB) != CurLoop; }
{ "pile_set_name": "Github" }
actions previous | nextIndex | nextIndex := (self selectionIndex + classes size - 2 \\ classes size) + 1. self selected: (classes at: nextIndex)
{ "pile_set_name": "Github" }
/* * In-kernel transcendent memory (generic implementation) * * Copyright (c) 2009-2011, Dan Magenheimer, Oracle Corp. * * The primary purpose of Transcedent Memory ("tmem") is to map object-oriented * "handles" (triples containing a pool id, and object id, and an index), to * pages in a page-accessible memory (PAM). Tmem references the PAM pages via * an abstract "pampd" (PAM page-descriptor), which can be operated on by a * set of functions (pamops). Each pampd contains some representation of * PAGE_SIZE bytes worth of data. Tmem must support potentially millions of * pages and must be able to insert, find, and delete these pages at a * potential frequency of thousands per second concurrently across many CPUs, * (and, if used with KVM, across many vcpus across many guests). * Tmem is tracked with a hierarchy of data structures, organized by * the elements in a handle-tuple: pool_id, object_id, and page index. * One or more "clients" (e.g. guests) each provide one or more tmem_pools. * Each pool, contains a hash table of rb_trees of tmem_objs. Each * tmem_obj contains a radix-tree-like tree of pointers, with intermediate * nodes called tmem_objnodes. Each leaf pointer in this tree points to * a pampd, which is accessible only through a small set of callbacks * registered by the PAM implementation (see tmem_register_pamops). Tmem * does all memory allocation via a set of callbacks registered by the tmem * host implementation (e.g. see tmem_register_hostops). */ #include <linux/list.h> #include <linux/spinlock.h> #include <linux/atomic.h> #include <linux/delay.h> #include "tmem.h" /* data structure sentinels used for debugging... see tmem.h */ #define POOL_SENTINEL 0x87658765 #define OBJ_SENTINEL 0x12345678 #define OBJNODE_SENTINEL 0xfedcba09 /* * A tmem host implementation must use this function to register callbacks * for memory allocation. */ static struct tmem_hostops tmem_hostops; static void tmem_objnode_tree_init(void); void tmem_register_hostops(struct tmem_hostops *m) { tmem_objnode_tree_init(); tmem_hostops = *m; } /* * A tmem host implementation must use this function to register * callbacks for a page-accessible memory (PAM) implementation */ static struct tmem_pamops tmem_pamops; void tmem_register_pamops(struct tmem_pamops *m) { tmem_pamops = *m; } /* * Oid's are potentially very sparse and tmem_objs may have an indeterminately * short life, being added and deleted at a relatively high frequency. * So an rb_tree is an ideal data structure to manage tmem_objs. But because * of the potentially huge number of tmem_objs, each pool manages a hashtable * of rb_trees to reduce search, insert, delete, and rebalancing time. * Each hashbucket also has a lock to manage concurrent access. * * The following routines manage tmem_objs. When any tmem_obj is accessed, * the hashbucket lock must be held. */ /* searches for object==oid in pool, returns locked object if found */ static struct tmem_obj *tmem_obj_find(struct tmem_hashbucket *hb, struct tmem_oid *oidp) { struct rb_node *rbnode; struct tmem_obj *obj; rbnode = hb->obj_rb_root.rb_node; while (rbnode) { BUG_ON(RB_EMPTY_NODE(rbnode)); obj = rb_entry(rbnode, struct tmem_obj, rb_tree_node); switch (tmem_oid_compare(oidp, &obj->oid)) { case 0: /* equal */ goto out; case -1: rbnode = rbnode->rb_left; break; case 1: rbnode = rbnode->rb_right; break; } } obj = NULL; out: return obj; } static void tmem_pampd_destroy_all_in_obj(struct tmem_obj *); /* free an object that has no more pampds in it */ static void tmem_obj_free(struct tmem_obj *obj, struct tmem_hashbucket *hb) { struct tmem_pool *pool; BUG_ON(obj == NULL); ASSERT_SENTINEL(obj, OBJ); BUG_ON(obj->pampd_count > 0); pool = obj->pool; BUG_ON(pool == NULL); if (obj->objnode_tree_root != NULL) /* may be "stump" with no leaves */ tmem_pampd_destroy_all_in_obj(obj); BUG_ON(obj->objnode_tree_root != NULL); BUG_ON((long)obj->objnode_count != 0); atomic_dec(&pool->obj_count); BUG_ON(atomic_read(&pool->obj_count) < 0); INVERT_SENTINEL(obj, OBJ); obj->pool = NULL; tmem_oid_set_invalid(&obj->oid); rb_erase(&obj->rb_tree_node, &hb->obj_rb_root); } /* * initialize, and insert an tmem_object_root (called only if find failed) */ static void tmem_obj_init(struct tmem_obj *obj, struct tmem_hashbucket *hb, struct tmem_pool *pool, struct tmem_oid *oidp) { struct rb_root *root = &hb->obj_rb_root; struct rb_node **new = &(root->rb_node), *parent = NULL; struct tmem_obj *this; BUG_ON(pool == NULL); atomic_inc(&pool->obj_count); obj->objnode_tree_height = 0; obj->objnode_tree_root = NULL; obj->pool = pool; obj->oid = *oidp; obj->objnode_count = 0; obj->pampd_count = 0; (*tmem_pamops.new_obj)(obj); SET_SENTINEL(obj, OBJ); while (*new) { BUG_ON(RB_EMPTY_NODE(*new)); this = rb_entry(*new, struct tmem_obj, rb_tree_node); parent = *new; switch (tmem_oid_compare(oidp, &this->oid)) { case 0: BUG(); /* already present; should never happen! */ break; case -1: new = &(*new)->rb_left; break; case 1: new = &(*new)->rb_right; break; } } rb_link_node(&obj->rb_tree_node, parent, new); rb_insert_color(&obj->rb_tree_node, root); } /* * Tmem is managed as a set of tmem_pools with certain attributes, such as * "ephemeral" vs "persistent". These attributes apply to all tmem_objs * and all pampds that belong to a tmem_pool. A tmem_pool is created * or deleted relatively rarely (for example, when a filesystem is * mounted or unmounted. */ /* flush all data from a pool and, optionally, free it */ static void tmem_pool_flush(struct tmem_pool *pool, bool destroy) { struct rb_node *rbnode; struct tmem_obj *obj; struct tmem_hashbucket *hb = &pool->hashbucket[0]; int i; BUG_ON(pool == NULL); for (i = 0; i < TMEM_HASH_BUCKETS; i++, hb++) { spin_lock(&hb->lock); rbnode = rb_first(&hb->obj_rb_root); while (rbnode != NULL) { obj = rb_entry(rbnode, struct tmem_obj, rb_tree_node); rbnode = rb_next(rbnode); tmem_pampd_destroy_all_in_obj(obj); tmem_obj_free(obj, hb); (*tmem_hostops.obj_free)(obj, pool); } spin_unlock(&hb->lock); } if (destroy) list_del(&pool->pool_list); } /* * A tmem_obj contains a radix-tree-like tree in which the intermediate * nodes are called tmem_objnodes. (The kernel lib/radix-tree.c implementation * is very specialized and tuned for specific uses and is not particularly * suited for use from this code, though some code from the core algorithms has * been reused, thus the copyright notices below). Each tmem_objnode contains * a set of pointers which point to either a set of intermediate tmem_objnodes * or a set of of pampds. * * Portions Copyright (C) 2001 Momchil Velikov * Portions Copyright (C) 2001 Christoph Hellwig * Portions Copyright (C) 2005 SGI, Christoph Lameter <[email protected]> */ struct tmem_objnode_tree_path { struct tmem_objnode *objnode; int offset; }; /* objnode height_to_maxindex translation */ static unsigned long tmem_objnode_tree_h2max[OBJNODE_TREE_MAX_PATH + 1]; static void tmem_objnode_tree_init(void) { unsigned int ht, tmp; for (ht = 0; ht < ARRAY_SIZE(tmem_objnode_tree_h2max); ht++) { tmp = ht * OBJNODE_TREE_MAP_SHIFT; if (tmp >= OBJNODE_TREE_INDEX_BITS) tmem_objnode_tree_h2max[ht] = ~0UL; else tmem_objnode_tree_h2max[ht] = (~0UL >> (OBJNODE_TREE_INDEX_BITS - tmp - 1)) >> 1; } } static struct tmem_objnode *tmem_objnode_alloc(struct tmem_obj *obj) { struct tmem_objnode *objnode; ASSERT_SENTINEL(obj, OBJ); BUG_ON(obj->pool == NULL); ASSERT_SENTINEL(obj->pool, POOL); objnode = (*tmem_hostops.objnode_alloc)(obj->pool); if (unlikely(objnode == NULL)) goto out; objnode->obj = obj; SET_SENTINEL(objnode, OBJNODE); memset(&objnode->slots, 0, sizeof(objnode->slots)); objnode->slots_in_use = 0; obj->objnode_count++; out: return objnode; } static void tmem_objnode_free(struct tmem_objnode *objnode) { struct tmem_pool *pool; int i; BUG_ON(objnode == NULL); for (i = 0; i < OBJNODE_TREE_MAP_SIZE; i++) BUG_ON(objnode->slots[i] != NULL); ASSERT_SENTINEL(objnode, OBJNODE); INVERT_SENTINEL(objnode, OBJNODE); BUG_ON(objnode->obj == NULL); ASSERT_SENTINEL(objnode->obj, OBJ); pool = objnode->obj->pool; BUG_ON(pool == NULL); ASSERT_SENTINEL(pool, POOL); objnode->obj->objnode_count--; objnode->obj = NULL; (*tmem_hostops.objnode_free)(objnode, pool); } /* * lookup index in object and return associated pampd (or NULL if not found) */ static void **__tmem_pampd_lookup_in_obj(struct tmem_obj *obj, uint32_t index) { unsigned int height, shift; struct tmem_objnode **slot = NULL; BUG_ON(obj == NULL); ASSERT_SENTINEL(obj, OBJ); BUG_ON(obj->pool == NULL); ASSERT_SENTINEL(obj->pool, POOL); height = obj->objnode_tree_height; if (index > tmem_objnode_tree_h2max[obj->objnode_tree_height]) goto out; if (height == 0 && obj->objnode_tree_root) { slot = &obj->objnode_tree_root; goto out; } shift = (height-1) * OBJNODE_TREE_MAP_SHIFT; slot = &obj->objnode_tree_root; while (height > 0) { if (*slot == NULL) goto out; slot = (struct tmem_objnode **) ((*slot)->slots + ((index >> shift) & OBJNODE_TREE_MAP_MASK)); shift -= OBJNODE_TREE_MAP_SHIFT; height--; } out: return slot != NULL ? (void **)slot : NULL; } static void *tmem_pampd_lookup_in_obj(struct tmem_obj *obj, uint32_t index) { struct tmem_objnode **slot; slot = (struct tmem_objnode **)__tmem_pampd_lookup_in_obj(obj, index); return slot != NULL ? *slot : NULL; } static void *tmem_pampd_replace_in_obj(struct tmem_obj *obj, uint32_t index, void *new_pampd, bool no_free) { struct tmem_objnode **slot; void *ret = NULL; slot = (struct tmem_objnode **)__tmem_pampd_lookup_in_obj(obj, index); if ((slot != NULL) && (*slot != NULL)) { void *old_pampd = *(void **)slot; *(void **)slot = new_pampd; if (!no_free) (*tmem_pamops.free)(old_pampd, obj->pool, NULL, 0, false); ret = new_pampd; } return ret; } static int tmem_pampd_add_to_obj(struct tmem_obj *obj, uint32_t index, void *pampd) { int ret = 0; struct tmem_objnode *objnode = NULL, *newnode, *slot; unsigned int height, shift; int offset = 0; /* if necessary, extend the tree to be higher */ if (index > tmem_objnode_tree_h2max[obj->objnode_tree_height]) { height = obj->objnode_tree_height + 1; if (index > tmem_objnode_tree_h2max[height]) while (index > tmem_objnode_tree_h2max[height]) height++; if (obj->objnode_tree_root == NULL) { obj->objnode_tree_height = height; goto insert; } do { newnode = tmem_objnode_alloc(obj); if (!newnode) { ret = -ENOMEM; goto out; } newnode->slots[0] = obj->objnode_tree_root; newnode->slots_in_use = 1; obj->objnode_tree_root = newnode; obj->objnode_tree_height++; } while (height > obj->objnode_tree_height); } insert: slot = obj->objnode_tree_root; height = obj->objnode_tree_height; shift = (height-1) * OBJNODE_TREE_MAP_SHIFT; while (height > 0) { if (slot == NULL) { /* add a child objnode. */ slot = tmem_objnode_alloc(obj); if (!slot) { ret = -ENOMEM; goto out; } if (objnode) { objnode->slots[offset] = slot; objnode->slots_in_use++; } else obj->objnode_tree_root = slot; } /* go down a level */ offset = (index >> shift) & OBJNODE_TREE_MAP_MASK; objnode = slot; slot = objnode->slots[offset]; shift -= OBJNODE_TREE_MAP_SHIFT; height--; } BUG_ON(slot != NULL); if (objnode) { objnode->slots_in_use++; objnode->slots[offset] = pampd; } else obj->objnode_tree_root = pampd; obj->pampd_count++; out: return ret; } static void *tmem_pampd_delete_from_obj(struct tmem_obj *obj, uint32_t index) { struct tmem_objnode_tree_path path[OBJNODE_TREE_MAX_PATH + 1]; struct tmem_objnode_tree_path *pathp = path; struct tmem_objnode *slot = NULL; unsigned int height, shift; int offset; BUG_ON(obj == NULL); ASSERT_SENTINEL(obj, OBJ); BUG_ON(obj->pool == NULL); ASSERT_SENTINEL(obj->pool, POOL); height = obj->objnode_tree_height; if (index > tmem_objnode_tree_h2max[height]) goto out; slot = obj->objnode_tree_root; if (height == 0 && obj->objnode_tree_root) { obj->objnode_tree_root = NULL; goto out; } shift = (height - 1) * OBJNODE_TREE_MAP_SHIFT; pathp->objnode = NULL; do { if (slot == NULL) goto out; pathp++; offset = (index >> shift) & OBJNODE_TREE_MAP_MASK; pathp->offset = offset; pathp->objnode = slot; slot = slot->slots[offset]; shift -= OBJNODE_TREE_MAP_SHIFT; height--; } while (height > 0); if (slot == NULL) goto out; while (pathp->objnode) { pathp->objnode->slots[pathp->offset] = NULL; pathp->objnode->slots_in_use--; if (pathp->objnode->slots_in_use) { if (pathp->objnode == obj->objnode_tree_root) { while (obj->objnode_tree_height > 0 && obj->objnode_tree_root->slots_in_use == 1 && obj->objnode_tree_root->slots[0]) { struct tmem_objnode *to_free = obj->objnode_tree_root; obj->objnode_tree_root = to_free->slots[0]; obj->objnode_tree_height--; to_free->slots[0] = NULL; to_free->slots_in_use = 0; tmem_objnode_free(to_free); } } goto out; } tmem_objnode_free(pathp->objnode); /* 0 slots used, free it */ pathp--; } obj->objnode_tree_height = 0; obj->objnode_tree_root = NULL; out: if (slot != NULL) obj->pampd_count--; BUG_ON(obj->pampd_count < 0); return slot; } /* recursively walk the objnode_tree destroying pampds and objnodes */ static void tmem_objnode_node_destroy(struct tmem_obj *obj, struct tmem_objnode *objnode, unsigned int ht) { int i; if (ht == 0) return; for (i = 0; i < OBJNODE_TREE_MAP_SIZE; i++) { if (objnode->slots[i]) { if (ht == 1) { obj->pampd_count--; (*tmem_pamops.free)(objnode->slots[i], obj->pool, NULL, 0, true); objnode->slots[i] = NULL; continue; } tmem_objnode_node_destroy(obj, objnode->slots[i], ht-1); tmem_objnode_free(objnode->slots[i]); objnode->slots[i] = NULL; } } } static void tmem_pampd_destroy_all_in_obj(struct tmem_obj *obj) { if (obj->objnode_tree_root == NULL) return; if (obj->objnode_tree_height == 0) { obj->pampd_count--; (*tmem_pamops.free)(obj->objnode_tree_root, obj->pool, NULL, 0, true); } else { tmem_objnode_node_destroy(obj, obj->objnode_tree_root, obj->objnode_tree_height); tmem_objnode_free(obj->objnode_tree_root); obj->objnode_tree_height = 0; } obj->objnode_tree_root = NULL; (*tmem_pamops.free_obj)(obj->pool, obj); } /* * Tmem is operated on by a set of well-defined actions: * "put", "get", "flush", "flush_object", "new pool" and "destroy pool". * (The tmem ABI allows for subpages and exchanges but these operations * are not included in this implementation.) * * These "tmem core" operations are implemented in the following functions. */ /* * "Put" a page, e.g. copy a page from the kernel into newly allocated * PAM space (if such space is available). Tmem_put is complicated by * a corner case: What if a page with matching handle already exists in * tmem? To guarantee coherency, one of two actions is necessary: Either * the data for the page must be overwritten, or the page must be * "flushed" so that the data is not accessible to a subsequent "get". * Since these "duplicate puts" are relatively rare, this implementation * always flushes for simplicity. */ int tmem_put(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index, char *data, size_t size, bool raw, int ephemeral) { struct tmem_obj *obj = NULL, *objfound = NULL, *objnew = NULL; void *pampd = NULL, *pampd_del = NULL; int ret = -ENOMEM; struct tmem_hashbucket *hb; hb = &pool->hashbucket[tmem_oid_hash(oidp)]; spin_lock(&hb->lock); obj = objfound = tmem_obj_find(hb, oidp); if (obj != NULL) { pampd = tmem_pampd_lookup_in_obj(objfound, index); if (pampd != NULL) { /* if found, is a dup put, flush the old one */ pampd_del = tmem_pampd_delete_from_obj(obj, index); BUG_ON(pampd_del != pampd); (*tmem_pamops.free)(pampd, pool, oidp, index, true); if (obj->pampd_count == 0) { objnew = obj; objfound = NULL; } pampd = NULL; } } else { obj = objnew = (*tmem_hostops.obj_alloc)(pool); if (unlikely(obj == NULL)) { ret = -ENOMEM; goto out; } tmem_obj_init(obj, hb, pool, oidp); } BUG_ON(obj == NULL); BUG_ON(((objnew != obj) && (objfound != obj)) || (objnew == objfound)); pampd = (*tmem_pamops.create)(data, size, raw, ephemeral, obj->pool, &obj->oid, index); if (unlikely(pampd == NULL)) goto free; ret = tmem_pampd_add_to_obj(obj, index, pampd); if (unlikely(ret == -ENOMEM)) /* may have partially built objnode tree ("stump") */ goto delete_and_free; goto out; delete_and_free: (void)tmem_pampd_delete_from_obj(obj, index); free: if (pampd) (*tmem_pamops.free)(pampd, pool, NULL, 0, true); if (objnew) { tmem_obj_free(objnew, hb); (*tmem_hostops.obj_free)(objnew, pool); } out: spin_unlock(&hb->lock); return ret; } void *tmem_localify_get_pampd(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index, struct tmem_obj **ret_obj, void **saved_hb) { struct tmem_hashbucket *hb; struct tmem_obj *obj = NULL; void *pampd = NULL; hb = &pool->hashbucket[tmem_oid_hash(oidp)]; spin_lock(&hb->lock); obj = tmem_obj_find(hb, oidp); if (likely(obj != NULL)) pampd = tmem_pampd_lookup_in_obj(obj, index); *ret_obj = obj; *saved_hb = (void *)hb; /* note, hashbucket remains locked */ return pampd; } void tmem_localify_finish(struct tmem_obj *obj, uint32_t index, void *pampd, void *saved_hb, bool delete) { struct tmem_hashbucket *hb = (struct tmem_hashbucket *)saved_hb; BUG_ON(!spin_is_locked(&hb->lock)); if (pampd != NULL) { BUG_ON(obj == NULL); (void)tmem_pampd_replace_in_obj(obj, index, pampd, 1); } else if (delete) { BUG_ON(obj == NULL); (void)tmem_pampd_delete_from_obj(obj, index); } spin_unlock(&hb->lock); } static int tmem_repatriate(void **ppampd, struct tmem_hashbucket *hb, struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index, bool free, char *data) { void *old_pampd = *ppampd, *new_pampd = NULL; bool intransit = false; int ret = 0; if (!is_ephemeral(pool)) new_pampd = (*tmem_pamops.repatriate_preload)( old_pampd, pool, oidp, index, &intransit); if (intransit) ret = -EAGAIN; else if (new_pampd != NULL) *ppampd = new_pampd; /* must release the hb->lock else repatriate can't sleep */ spin_unlock(&hb->lock); if (!intransit) ret = (*tmem_pamops.repatriate)(old_pampd, new_pampd, pool, oidp, index, free, data); return ret; } /* * "Get" a page, e.g. if one can be found, copy the tmem page with the * matching handle from PAM space to the kernel. By tmem definition, * when a "get" is successful on an ephemeral page, the page is "flushed", * and when a "get" is successful on a persistent page, the page is retained * in tmem. Note that to preserve * coherency, "get" can never be skipped if tmem contains the data. * That is, if a get is done with a certain handle and fails, any * subsequent "get" must also fail (unless of course there is a * "put" done with the same handle). */ int tmem_get(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index, char *data, size_t *size, bool raw, int get_and_free) { struct tmem_obj *obj; void *pampd; bool ephemeral = is_ephemeral(pool); int ret = -1; struct tmem_hashbucket *hb; bool free = (get_and_free == 1) || ((get_and_free == 0) && ephemeral); bool lock_held = 0; void **ppampd; again: hb = &pool->hashbucket[tmem_oid_hash(oidp)]; spin_lock(&hb->lock); lock_held = 1; obj = tmem_obj_find(hb, oidp); if (obj == NULL) goto out; ppampd = __tmem_pampd_lookup_in_obj(obj, index); if (ppampd == NULL) goto out; if (tmem_pamops.is_remote(*ppampd)) { ret = tmem_repatriate(ppampd, hb, pool, oidp, index, free, data); lock_held = 0; /* note hb->lock has been unlocked */ if (ret == -EAGAIN) { /* rare I think, but should cond_resched()??? */ usleep_range(10, 1000); goto again; } else if (ret != 0) { if (ret != -ENOENT) pr_err("UNTESTED case in tmem_get, ret=%d\n", ret); ret = -1; goto out; } goto out; } if (free) pampd = tmem_pampd_delete_from_obj(obj, index); else pampd = tmem_pampd_lookup_in_obj(obj, index); if (pampd == NULL) goto out; if (free) { if (obj->pampd_count == 0) { tmem_obj_free(obj, hb); (*tmem_hostops.obj_free)(obj, pool); obj = NULL; } } if (free) ret = (*tmem_pamops.get_data_and_free)( data, size, raw, pampd, pool, oidp, index); else ret = (*tmem_pamops.get_data)( data, size, raw, pampd, pool, oidp, index); if (ret < 0) goto out; ret = 0; out: if (lock_held) spin_unlock(&hb->lock); return ret; } /* * If a page in tmem matches the handle, "flush" this page from tmem such * that any subsequent "get" does not succeed (unless, of course, there * was another "put" with the same handle). */ int tmem_flush_page(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index) { struct tmem_obj *obj; void *pampd; int ret = -1; struct tmem_hashbucket *hb; hb = &pool->hashbucket[tmem_oid_hash(oidp)]; spin_lock(&hb->lock); obj = tmem_obj_find(hb, oidp); if (obj == NULL) goto out; pampd = tmem_pampd_delete_from_obj(obj, index); if (pampd == NULL) goto out; (*tmem_pamops.free)(pampd, pool, oidp, index, true); if (obj->pampd_count == 0) { tmem_obj_free(obj, hb); (*tmem_hostops.obj_free)(obj, pool); } ret = 0; out: spin_unlock(&hb->lock); return ret; } /* * If a page in tmem matches the handle, replace the page so that any * subsequent "get" gets the new page. Returns the new page if * there was a page to replace, else returns NULL. */ int tmem_replace(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index, void *new_pampd) { struct tmem_obj *obj; int ret = -1; struct tmem_hashbucket *hb; hb = &pool->hashbucket[tmem_oid_hash(oidp)]; spin_lock(&hb->lock); obj = tmem_obj_find(hb, oidp); if (obj == NULL) goto out; new_pampd = tmem_pampd_replace_in_obj(obj, index, new_pampd, 0); ret = (*tmem_pamops.replace_in_obj)(new_pampd, obj); out: spin_unlock(&hb->lock); return ret; } /* * "Flush" all pages in tmem matching this oid. */ int tmem_flush_object(struct tmem_pool *pool, struct tmem_oid *oidp) { struct tmem_obj *obj; struct tmem_hashbucket *hb; int ret = -1; hb = &pool->hashbucket[tmem_oid_hash(oidp)]; spin_lock(&hb->lock); obj = tmem_obj_find(hb, oidp); if (obj == NULL) goto out; tmem_pampd_destroy_all_in_obj(obj); tmem_obj_free(obj, hb); (*tmem_hostops.obj_free)(obj, pool); ret = 0; out: spin_unlock(&hb->lock); return ret; } /* * "Flush" all pages (and tmem_objs) from this tmem_pool and disable * all subsequent access to this tmem_pool. */ int tmem_destroy_pool(struct tmem_pool *pool) { int ret = -1; if (pool == NULL) goto out; tmem_pool_flush(pool, 1); ret = 0; out: return ret; } static LIST_HEAD(tmem_global_pool_list); /* * Create a new tmem_pool with the provided flag and return * a pool id provided by the tmem host implementation. */ void tmem_new_pool(struct tmem_pool *pool, uint32_t flags) { int persistent = flags & TMEM_POOL_PERSIST; int shared = flags & TMEM_POOL_SHARED; struct tmem_hashbucket *hb = &pool->hashbucket[0]; int i; for (i = 0; i < TMEM_HASH_BUCKETS; i++, hb++) { hb->obj_rb_root = RB_ROOT; spin_lock_init(&hb->lock); } INIT_LIST_HEAD(&pool->pool_list); atomic_set(&pool->obj_count, 0); SET_SENTINEL(pool, POOL); list_add_tail(&pool->pool_list, &tmem_global_pool_list); pool->persistent = persistent; pool->shared = shared; }
{ "pile_set_name": "Github" }
{ "name": "jquery.spritely", "filename": "jquery.spritely.min.js", "version": "0.6.1", "description": "Create dynamic characters and background animations.", "homepage": "http://www.spritely.net", "keywords": [ "spritely", "ui", "jquery" ], "maintainers": [ { "name": "Artlogic", "web": "http://www.artlogic.net" } ], "repositories": [ { "type": "git", "url": "https://github.com/artlogicmedia/spritely.git" } ] }
{ "pile_set_name": "Github" }
@using System.Web.Http @using System.Web.Http.Description @using RockBands.Services.Areas.HelpPage.Models @using RockBands.Services.Areas.HelpPage.ModelDescriptions @model HelpPageApiModel @{ ApiDescription description = Model.ApiDescription; } <h1>@description.HttpMethod.Method @description.RelativePath</h1> <div> <p>@description.Documentation</p> <h2>Request Information</h2> <h3>URI Parameters</h3> @Html.DisplayFor(m => m.UriParameters, "Parameters") <h3>Body Parameters</h3> <p>@Model.RequestDocumentation</p> @if (Model.RequestModelDescription != null) { @Html.DisplayFor(m => m.RequestModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.RequestModelDescription }) if (Model.RequestBodyParameters != null) { @Html.DisplayFor(m => m.RequestBodyParameters, "Parameters") } } else { <p>None.</p> } @if (Model.SampleRequests.Count > 0) { <h3>Request Formats</h3> @Html.DisplayFor(m => m.SampleRequests, "Samples") } <h2>Response Information</h2> <h3>Resource Description</h3> <p>@description.ResponseDescription.Documentation</p> @if (Model.ResourceDescription != null) { @Html.DisplayFor(m => m.ResourceDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.ResourceDescription }) if (Model.ResourceProperties != null) { @Html.DisplayFor(m => m.ResourceProperties, "Parameters") } } else { <p>None.</p> } @if (Model.SampleResponses.Count > 0) { <h3>Response Formats</h3> @Html.DisplayFor(m => m.SampleResponses, "Samples") } </div>
{ "pile_set_name": "Github" }
import { defineMessages } from 'react-intl' export default defineMessages({ hello: { id: 'a.hello', defaultMessage: 'hello' }, helloZ: { id: 'z.hello', defaultMessage: 'hello' }, helloC: { id: 'c.hello', defaultMessage: 'hello' }, world: { id: 'a.world', defaultMessage: 'world' } })
{ "pile_set_name": "Github" }
package com.telenav.osv.ui.fragment; import android.support.annotation.AnimRes; import android.support.annotation.AnimatorRes; import android.support.v4.app.Fragment; import android.view.View; import com.telenav.osv.R; /** * Created by kalmanb on 8/9/17. */ public abstract class OSVFragment extends Fragment { public void cancelAction() { } public boolean onBackPressed() { return false; } public View getSharedElement() { return null; } public String getSharedElementTransitionName() { return null; } public @AnimatorRes @AnimRes int getEnterAnimation() { return R.anim.slide_up_add; } public @AnimatorRes @AnimRes int getExitAnimation() { return R.anim.slide_down_remove; } }
{ "pile_set_name": "Github" }
/* match.S -- x86 assembly version of the zlib longest_match() function. * Optimized for the Intel 686 chips (PPro and later). * * Copyright (C) 1998, 2007 Brian Raiter <[email protected]> * * This software is provided 'as-is', without any express or implied * warranty. In no event will the author be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #ifndef NO_UNDERLINE #define match_init _match_init #define longest_match _longest_match #endif #define MAX_MATCH (258) #define MIN_MATCH (3) #define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) #define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) /* stack frame offsets */ #define chainlenwmask 0 /* high word: current chain len */ /* low word: s->wmask */ #define window 4 /* local copy of s->window */ #define windowbestlen 8 /* s->window + bestlen */ #define scanstart 16 /* first two bytes of string */ #define scanend 12 /* last two bytes of string */ #define scanalign 20 /* dword-misalignment of string */ #define nicematch 24 /* a good enough match size */ #define bestlen 28 /* size of best match so far */ #define scan 32 /* ptr to string wanting match */ #define LocalVarsSize (36) /* saved ebx 36 */ /* saved edi 40 */ /* saved esi 44 */ /* saved ebp 48 */ /* return address 52 */ #define deflatestate 56 /* the function arguments */ #define curmatch 60 /* All the +zlib1222add offsets are due to the addition of fields * in zlib in the deflate_state structure since the asm code was first written * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). */ #define zlib1222add (8) #define dsWSize (36+zlib1222add) #define dsWMask (44+zlib1222add) #define dsWindow (48+zlib1222add) #define dsPrev (56+zlib1222add) #define dsMatchLen (88+zlib1222add) #define dsPrevMatch (92+zlib1222add) #define dsStrStart (100+zlib1222add) #define dsMatchStart (104+zlib1222add) #define dsLookahead (108+zlib1222add) #define dsPrevLen (112+zlib1222add) #define dsMaxChainLen (116+zlib1222add) #define dsGoodMatch (132+zlib1222add) #define dsNiceMatch (136+zlib1222add) .file "match.S" .globl match_init, longest_match .text /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ .cfi_sections .debug_frame longest_match: .cfi_startproc /* Save registers that the compiler may be using, and adjust %esp to */ /* make room for our stack frame. */ pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset ebp, -8 pushl %edi .cfi_def_cfa_offset 12 pushl %esi .cfi_def_cfa_offset 16 pushl %ebx .cfi_def_cfa_offset 20 subl $LocalVarsSize, %esp .cfi_def_cfa_offset LocalVarsSize+20 /* Retrieve the function arguments. %ecx will hold cur_match */ /* throughout the entire function. %edx will hold the pointer to the */ /* deflate_state structure during the function's setup (before */ /* entering the main loop). */ movl deflatestate(%esp), %edx movl curmatch(%esp), %ecx /* uInt wmask = s->w_mask; */ /* unsigned chain_length = s->max_chain_length; */ /* if (s->prev_length >= s->good_match) { */ /* chain_length >>= 2; */ /* } */ movl dsPrevLen(%edx), %eax movl dsGoodMatch(%edx), %ebx cmpl %ebx, %eax movl dsWMask(%edx), %eax movl dsMaxChainLen(%edx), %ebx jl LastMatchGood shrl $2, %ebx LastMatchGood: /* chainlen is decremented once beforehand so that the function can */ /* use the sign flag instead of the zero flag for the exit test. */ /* It is then shifted into the high word, to make room for the wmask */ /* value, which it will always accompany. */ decl %ebx shll $16, %ebx orl %eax, %ebx movl %ebx, chainlenwmask(%esp) /* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ movl dsNiceMatch(%edx), %eax movl dsLookahead(%edx), %ebx cmpl %eax, %ebx jl LookaheadLess movl %eax, %ebx LookaheadLess: movl %ebx, nicematch(%esp) /* register Bytef *scan = s->window + s->strstart; */ movl dsWindow(%edx), %esi movl %esi, window(%esp) movl dsStrStart(%edx), %ebp lea (%esi,%ebp), %edi movl %edi, scan(%esp) /* Determine how many bytes the scan ptr is off from being */ /* dword-aligned. */ movl %edi, %eax negl %eax andl $3, %eax movl %eax, scanalign(%esp) /* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ /* s->strstart - (IPos)MAX_DIST(s) : NIL; */ movl dsWSize(%edx), %eax subl $MIN_LOOKAHEAD, %eax subl %eax, %ebp jg LimitPositive xorl %ebp, %ebp LimitPositive: /* int best_len = s->prev_length; */ movl dsPrevLen(%edx), %eax movl %eax, bestlen(%esp) /* Store the sum of s->window + best_len in %esi locally, and in %esi. */ addl %eax, %esi movl %esi, windowbestlen(%esp) /* register ush scan_start = *(ushf*)scan; */ /* register ush scan_end = *(ushf*)(scan+best_len-1); */ /* Posf *prev = s->prev; */ movzwl (%edi), %ebx movl %ebx, scanstart(%esp) movzwl -1(%edi,%eax), %ebx movl %ebx, scanend(%esp) movl dsPrev(%edx), %edi /* Jump into the main loop. */ movl chainlenwmask(%esp), %edx jmp LoopEntry .balign 16 /* do { * match = s->window + cur_match; * if (*(ushf*)(match+best_len-1) != scan_end || * *(ushf*)match != scan_start) continue; * [...] * } while ((cur_match = prev[cur_match & wmask]) > limit * && --chain_length != 0); * * Here is the inner loop of the function. The function will spend the * majority of its time in this loop, and majority of that time will * be spent in the first ten instructions. * * Within this loop: * %ebx = scanend * %ecx = curmatch * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) * %esi = windowbestlen - i.e., (window + bestlen) * %edi = prev * %ebp = limit */ LookupLoop: andl %edx, %ecx movzwl (%edi,%ecx,2), %ecx cmpl %ebp, %ecx jbe LeaveNow subl $0x00010000, %edx js LeaveNow LoopEntry: movzwl -1(%esi,%ecx), %eax cmpl %ebx, %eax jnz LookupLoop movl window(%esp), %eax movzwl (%eax,%ecx), %eax cmpl scanstart(%esp), %eax jnz LookupLoop /* Store the current value of chainlen. */ movl %edx, chainlenwmask(%esp) /* Point %edi to the string under scrutiny, and %esi to the string we */ /* are hoping to match it up with. In actuality, %esi and %edi are */ /* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ /* initialized to -(MAX_MATCH_8 - scanalign). */ movl window(%esp), %esi movl scan(%esp), %edi addl %ecx, %esi movl scanalign(%esp), %eax movl $(-MAX_MATCH_8), %edx lea MAX_MATCH_8(%edi,%eax), %edi lea MAX_MATCH_8(%esi,%eax), %esi /* Test the strings for equality, 8 bytes at a time. At the end, * adjust %edx so that it is offset to the exact byte that mismatched. * * We already know at this point that the first three bytes of the * strings match each other, and they can be safely passed over before * starting the compare loop. So what this code does is skip over 0-3 * bytes, as much as necessary in order to dword-align the %edi * pointer. (%esi will still be misaligned three times out of four.) * * It should be confessed that this loop usually does not represent * much of the total running time. Replacing it with a more * straightforward "rep cmpsb" would not drastically degrade * performance. */ LoopCmps: movl (%esi,%edx), %eax xorl (%edi,%edx), %eax jnz LeaveLoopCmps movl 4(%esi,%edx), %eax xorl 4(%edi,%edx), %eax jnz LeaveLoopCmps4 addl $8, %edx jnz LoopCmps jmp LenMaximum LeaveLoopCmps4: addl $4, %edx LeaveLoopCmps: testl $0x0000FFFF, %eax jnz LenLower addl $2, %edx shrl $16, %eax LenLower: subb $1, %al adcl $0, %edx /* Calculate the length of the match. If it is longer than MAX_MATCH, */ /* then automatically accept it as the best possible match and leave. */ lea (%edi,%edx), %eax movl scan(%esp), %edi subl %edi, %eax cmpl $MAX_MATCH, %eax jge LenMaximum /* If the length of the match is not longer than the best match we */ /* have so far, then forget it and return to the lookup loop. */ movl deflatestate(%esp), %edx movl bestlen(%esp), %ebx cmpl %ebx, %eax jg LongerMatch movl windowbestlen(%esp), %esi movl dsPrev(%edx), %edi movl scanend(%esp), %ebx movl chainlenwmask(%esp), %edx jmp LookupLoop /* s->match_start = cur_match; */ /* best_len = len; */ /* if (len >= nice_match) break; */ /* scan_end = *(ushf*)(scan+best_len-1); */ LongerMatch: movl nicematch(%esp), %ebx movl %eax, bestlen(%esp) movl %ecx, dsMatchStart(%edx) cmpl %ebx, %eax jge LeaveNow movl window(%esp), %esi addl %eax, %esi movl %esi, windowbestlen(%esp) movzwl -1(%edi,%eax), %ebx movl dsPrev(%edx), %edi movl %ebx, scanend(%esp) movl chainlenwmask(%esp), %edx jmp LookupLoop /* Accept the current string, with the maximum possible length. */ LenMaximum: movl deflatestate(%esp), %edx movl $MAX_MATCH, bestlen(%esp) movl %ecx, dsMatchStart(%edx) /* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ /* return s->lookahead; */ LeaveNow: movl deflatestate(%esp), %edx movl bestlen(%esp), %ebx movl dsLookahead(%edx), %eax cmpl %eax, %ebx jg LookaheadRet movl %ebx, %eax LookaheadRet: /* Restore the stack and return from whence we came. */ addl $LocalVarsSize, %esp .cfi_def_cfa_offset 20 popl %ebx .cfi_def_cfa_offset 16 popl %esi .cfi_def_cfa_offset 12 popl %edi .cfi_def_cfa_offset 8 popl %ebp .cfi_def_cfa_offset 4 .cfi_endproc match_init: ret
{ "pile_set_name": "Github" }
/******************************************************************************* * * Copyright 2012 Impetus Infotech. * * * * 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.impetus.kundera.loader; import java.util.Map; import com.impetus.kundera.client.Client; import com.impetus.kundera.configure.schema.api.SchemaManager; /** * Interface for client factory. * * @author vivek.mishra * */ public interface ClientFactory { /** * Load. * * @param persistenceUnit * the persistence units */ void load(String persistenceUnit, Map<String, Object> puProperties); /** * Instantiate and returns client instance * * @return client instance. */ Client getClientInstance(); /** * return the instance of schema manager * * @return schemaManager interface. */ SchemaManager getSchemaManager(Map<String, Object> puProperties); }
{ "pile_set_name": "Github" }
<?php namespace Tests\Unit\Http\Middleware\Api\Application; use Tests\Unit\Http\Middleware\MiddlewareTestCase; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser; class AuthenticateUserTest extends MiddlewareTestCase { /** * Test that no user defined results in an access denied exception. */ public function testNoUserDefined() { $this->expectException(AccessDeniedHttpException::class); $this->setRequestUserModel(null); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } /** * Test that a non-admin user results an an exception. */ public function testNonAdminUser() { $this->expectException(AccessDeniedHttpException::class); $this->generateRequestUserModel(['root_admin' => false]); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } /** * Test that an admin user continues though the middleware. */ public function testAdminUser() { $this->generateRequestUserModel(['root_admin' => true]); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } /** * Return an instance of the middleware for testing. * * @return \Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser */ private function getMiddleware(): AuthenticateApplicationUser { return new AuthenticateApplicationUser; } }
{ "pile_set_name": "Github" }
#include <cln/number.h> #include <cln/io.h> #include <cln/integer.h> #include <cln/float.h> #include <cln/float_io.h> #include <cln/real.h> #include <cln/real_io.h> #include <cln/complex.h> #include <cln/complex_io.h> #include <cstdlib> #include <cstring> #include <cln/timing.h> using namespace std; using namespace cln; int main (int argc, char * argv[]) { int digits = 100; int repetitions = 1; while (argc >= 3) { if (!strcmp(argv[1],"-r")) { repetitions = atoi(argv[2]); argc -= 2; argv += 2; continue; } if (!strcmp(argv[1],"-n")) { digits = atoi(argv[2]); argc -= 2; argv += 2; continue; } break; } if (argc < 1) exit(1); cerr << "Number of digits: " << digits << endl; cerr << "Number of repetitions (except for pi,euler,e): " << repetitions << endl; float_format_t prec = float_format(digits); cl_F x1 = sqrt(cl_float(2,prec)); cl_F x2 = sqrt(cl_float(3,prec)); cl_F x3 = The(cl_F)(log(cl_float(2,prec))); cerr << "multiplication" << endl; { cl_F r = x1*x2; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = x1*x2; } } cout << r << endl << endl; } cerr << "sqrt" << endl; { cl_F r = sqrt(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = sqrt(x3); } } cout << r << endl << endl; } cerr << "pi" << endl; { cl_F r; { CL_TIMING; r = pi(prec); } cout << r << endl << endl; } cerr << "eulerconst" << endl; { cl_F r; { CL_TIMING; r = eulerconst(prec); } cout << r << endl << endl; } cerr << "e" << endl; { cl_F r; { CL_TIMING; r = exp1(prec); } cout << r << endl << endl; } cerr << "exp" << endl; { cl_F r = exp(-x1); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = exp(-x1); } } cout << r << endl << endl; } cerr << "log" << endl; { cl_N r = log(x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = log(x2); } } cout << r << endl << endl; } cerr << "sin" << endl; { cl_R r = sin(5*x1); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = sin(5*x1); } } cout << r << endl << endl; } cerr << "cos" << endl; { cl_R r = cos(5*x1); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = cos(5*x1); } } cout << r << endl << endl; } cerr << "asin" << endl; { cl_N r = asin(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = asin(x3); } } cout << r << endl << endl; } cerr << "acos" << endl; { cl_N r = acos(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = acos(x3); } } cout << r << endl << endl; } cerr << "atan" << endl; { cl_F r = atan(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = atan(x3); } } cout << r << endl << endl; } cerr << "sinh" << endl; { cl_F r = sinh(x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = sinh(x2); } } cout << r << endl << endl; } cerr << "cosh" << endl; { cl_F r = cosh(x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = cosh(x2); } } cout << r << endl << endl; } cerr << "asinh" << endl; { cl_N r = asinh(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = asinh(x3); } } cout << r << endl << endl; } cerr << "acosh" << endl; { cl_N r = acosh(1+x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = acosh(1+x3); } } cout << r << endl << endl; } cerr << "atanh" << endl; { cl_N r = atanh(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { r = atanh(x3); } } cout << r << endl << endl; } }
{ "pile_set_name": "Github" }
#include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static integer c__1 = 1; /* Subroutine */ int zung2r_(integer *m, integer *n, integer *k, doublecomplex *a, integer *lda, doublecomplex *tau, doublecomplex * work, integer *info) { /* System generated locals */ integer a_dim1, a_offset, i__1, i__2, i__3; doublecomplex z__1; /* Local variables */ integer i__, j, l; extern /* Subroutine */ int zscal_(integer *, doublecomplex *, doublecomplex *, integer *), zlarf_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *), xerbla_(char *, integer *); /* -- LAPACK routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZUNG2R generates an m by n complex matrix Q with orthonormal columns, */ /* which is defined as the first n columns of a product of k elementary */ /* reflectors of order m */ /* Q = H(1) H(2) . . . H(k) */ /* as returned by ZGEQRF. */ /* Arguments */ /* ========= */ /* M (input) INTEGER */ /* The number of rows of the matrix Q. M >= 0. */ /* N (input) INTEGER */ /* The number of columns of the matrix Q. M >= N >= 0. */ /* K (input) INTEGER */ /* The number of elementary reflectors whose product defines the */ /* matrix Q. N >= K >= 0. */ /* A (input/output) COMPLEX*16 array, dimension (LDA,N) */ /* On entry, the i-th column must contain the vector which */ /* defines the elementary reflector H(i), for i = 1,2,...,k, as */ /* returned by ZGEQRF in the first k columns of its array */ /* argument A. */ /* On exit, the m by n matrix Q. */ /* LDA (input) INTEGER */ /* The first dimension of the array A. LDA >= max(1,M). */ /* TAU (input) COMPLEX*16 array, dimension (K) */ /* TAU(i) must contain the scalar factor of the elementary */ /* reflector H(i), as returned by ZGEQRF. */ /* WORK (workspace) COMPLEX*16 array, dimension (N) */ /* INFO (output) INTEGER */ /* = 0: successful exit */ /* < 0: if INFO = -i, the i-th argument has an illegal value */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Executable Statements .. */ /* Test the input arguments */ /* Parameter adjustments */ a_dim1 = *lda; a_offset = 1 + a_dim1; a -= a_offset; --tau; --work; /* Function Body */ *info = 0; if (*m < 0) { *info = -1; } else if (*n < 0 || *n > *m) { *info = -2; } else if (*k < 0 || *k > *n) { *info = -3; } else if (*lda < max(1,*m)) { *info = -5; } if (*info != 0) { i__1 = -(*info); xerbla_("ZUNG2R", &i__1); return 0; } /* Quick return if possible */ if (*n <= 0) { return 0; } /* Initialise columns k+1:n to columns of the unit matrix */ i__1 = *n; for (j = *k + 1; j <= i__1; ++j) { i__2 = *m; for (l = 1; l <= i__2; ++l) { i__3 = l + j * a_dim1; a[i__3].r = 0., a[i__3].i = 0.; /* L10: */ } i__2 = j + j * a_dim1; a[i__2].r = 1., a[i__2].i = 0.; /* L20: */ } for (i__ = *k; i__ >= 1; --i__) { /* Apply H(i) to A(i:m,i:n) from the left */ if (i__ < *n) { i__1 = i__ + i__ * a_dim1; a[i__1].r = 1., a[i__1].i = 0.; i__1 = *m - i__ + 1; i__2 = *n - i__; zlarf_("Left", &i__1, &i__2, &a[i__ + i__ * a_dim1], &c__1, &tau[ i__], &a[i__ + (i__ + 1) * a_dim1], lda, &work[1]); } if (i__ < *m) { i__1 = *m - i__; i__2 = i__; z__1.r = -tau[i__2].r, z__1.i = -tau[i__2].i; zscal_(&i__1, &z__1, &a[i__ + 1 + i__ * a_dim1], &c__1); } i__1 = i__ + i__ * a_dim1; i__2 = i__; z__1.r = 1. - tau[i__2].r, z__1.i = 0. - tau[i__2].i; a[i__1].r = z__1.r, a[i__1].i = z__1.i; /* Set A(1:i-1,i) to zero */ i__1 = i__ - 1; for (l = 1; l <= i__1; ++l) { i__2 = l + i__ * a_dim1; a[i__2].r = 0., a[i__2].i = 0.; /* L30: */ } /* L40: */ } return 0; /* End of ZUNG2R */ } /* zung2r_ */
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // <array> // template <class T, size_t N> void swap(array<T,N>& x, array<T,N>& y); #include <array> #include <cassert> // std::array is explicitly allowed to be initialized with A a = { init-list };. // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" int main() { { typedef double T; typedef std::array<T, 3> C; C c1 = {1, 2, 3.5}; C c2 = {4, 5, 6.5}; swap(c1, c2); assert(c1.size() == 3); assert(c1[0] == 4); assert(c1[1] == 5); assert(c1[2] == 6.5); assert(c2.size() == 3); assert(c2[0] == 1); assert(c2[1] == 2); assert(c2[2] == 3.5); } { typedef double T; typedef std::array<T, 0> C; C c1 = {}; C c2 = {}; swap(c1, c2); assert(c1.size() == 0); assert(c2.size() == 0); } }
{ "pile_set_name": "Github" }
// // MKOverlayPathView.h // MapKit // // Copyright (c) 2010-2014, Apple Inc. All rights reserved. // #import <UIKit/UIKit.h> #import <MapKit/MKOverlayView.h> #import <MapKit/MKFoundation.h> // Prefer MKOverlayPathRenderer MK_CLASS_AVAILABLE(NA, 4_0) __TVOS_PROHIBITED __WATCHOS_PROHIBITED @interface MKOverlayPathView : MKOverlayView @property (strong) UIColor *fillColor NS_DEPRECATED_IOS(4_0, 7_0); @property (strong) UIColor *strokeColor NS_DEPRECATED_IOS(4_0, 7_0); @property CGFloat lineWidth NS_DEPRECATED_IOS(4_0, 7_0); // defaults to 0, which is MKRoadWidthAtZoomScale(currentZoomScale) @property CGLineJoin lineJoin NS_DEPRECATED_IOS(4_0, 7_0); // defaults to kCGLineJoinRound @property CGLineCap lineCap NS_DEPRECATED_IOS(4_0, 7_0); // defaults to kCGLineCapRound @property CGFloat miterLimit NS_DEPRECATED_IOS(4_0, 7_0); // defaults to 10 @property CGFloat lineDashPhase NS_DEPRECATED_IOS(4_0, 7_0); // defaults to 0 @property (copy) NSArray *lineDashPattern NS_DEPRECATED_IOS(4_0, 7_0); // an array of NSNumbers, defaults to nil // subclassers should override this to create a path and then set it on // themselves with self.path = newPath; - (void)createPath NS_DEPRECATED_IOS(4_0, 7_0); // returns cached path or calls createPath if path has not yet been created @property CGPathRef path NS_DEPRECATED_IOS(4_0, 7_0); // path will be retained - (void)invalidatePath NS_DEPRECATED_IOS(4_0, 7_0); // subclassers may override these - (void)applyStrokePropertiesToContext:(CGContextRef)context atZoomScale:(MKZoomScale)zoomScale NS_DEPRECATED_IOS(4_0, 7_0); - (void)applyFillPropertiesToContext:(CGContextRef)context atZoomScale:(MKZoomScale)zoomScale NS_DEPRECATED_IOS(4_0, 7_0); - (void)strokePath:(CGPathRef)path inContext:(CGContextRef)context NS_DEPRECATED_IOS(4_0, 7_0); - (void)fillPath:(CGPathRef)path inContext:(CGContextRef)context NS_DEPRECATED_IOS(4_0, 7_0); @end
{ "pile_set_name": "Github" }
--- layout: default --- <article class="post-container post-container--single" itemscope itemtype="http://schema.org/BlogPosting"> <header class="post-header"> <div class="post-meta"> <time datetime="{{page.date | date: date_to_xmlschema}}" itemprop="datePublished" class="post-meta__date date">{{page.date | date: "%F"}}</time> &#8226; <span class="post-meta__tags tags">{{page.tags}}</span> </div> <h1 class="post-title">{{ page.title }}</h1> </header> <section class="post"> {{ content }} </section> </article>
{ "pile_set_name": "Github" }
(module Wifi_Module_ESP8266_WRL-13678 (layer F.Cu) (tedit 5A047D93) (fp_text reference REF** (at 3.98 -18.36 180) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))) ) (fp_text value Wifi_Module_ESP8266_WRL-13678 (at 3.25 5.56 180) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))) ) (fp_line (start -3.04 -17.28) (end 10.66 -17.28) (layer F.CrtYd) (width 0.05)) (fp_text user %R (at 3.8 -7.52 180) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))) ) (fp_line (start 10.66 4.32) (end 10.66 -17.28) (layer F.CrtYd) (width 0.05)) (fp_line (start -3.04 4.32) (end -3.04 -17.28) (layer F.CrtYd) (width 0.05)) (fp_line (start -3.04 4.32) (end 10.66 4.32) (layer F.CrtYd) (width 0.05)) (fp_line (start 10.51 4.17) (end 10.51 3.67) (layer F.SilkS) (width 0.1)) (fp_line (start 10.51 4.17) (end 10.01 4.17) (layer F.SilkS) (width 0.1)) (fp_line (start -2.89 4.17) (end -2.89 3.67) (layer F.SilkS) (width 0.1)) (fp_line (start -2.89 4.17) (end -2.39 4.17) (layer F.SilkS) (width 0.1)) (fp_line (start 10.51 -17.13) (end 10.51 -16.63) (layer F.SilkS) (width 0.1)) (fp_line (start 10.51 -17.13) (end 10.01 -17.13) (layer F.SilkS) (width 0.1)) (fp_line (start -2.89 -17.13) (end -2.89 -16.63) (layer F.SilkS) (width 0.1)) (fp_line (start -2.89 -17.13) (end -2.39 -17.13) (layer F.SilkS) (width 0.1)) (fp_line (start 10.41 4.07) (end 10.41 -17.03) (layer F.Fab) (width 0.1)) (fp_line (start 10.41 -17.03) (end -2.79 -17.03) (layer F.Fab) (width 0.1)) (fp_line (start 10.41 4.07) (end -2.79 4.07) (layer F.Fab) (width 0.1)) (fp_line (start -2.79 4.07) (end -2.79 -17.03) (layer F.Fab) (width 0.1)) (pad 8 thru_hole circle (at 7.62 2.54 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 7 thru_hole circle (at 7.62 0 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 6 thru_hole circle (at 5.08 2.54 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 5 thru_hole circle (at 5.08 0 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 4 thru_hole circle (at 2.54 2.54 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 3 thru_hole circle (at 2.54 0 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 2 thru_hole circle (at 0 2.54 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) (pad 1 thru_hole rect (at 0 0 180) (size 2 2) (drill 1) (layers *.Cu *.Mask)) )
{ "pile_set_name": "Github" }
/* * * the c# vvvv math library * * */ using System; using System.Runtime.InteropServices; using System.Runtime.Serialization; namespace VVVV.Utils.VMath { /// <summary> /// 4x4 transform matrix struct with operators, much faster then matrix classes /// </summary> [DataContract] [StructLayout(LayoutKind.Sequential)] public struct Matrix4x4 : IEquatable<Matrix4x4> { #region data fields /// <summary> /// The 1. data element of 1. row /// </summary> public double m11; /// <summary> /// The 2. data element of 1. row /// </summary> public double m12; /// <summary> /// The 3. data element of 1. row /// </summary> public double m13; /// <summary> /// The 4. data element of 1. row /// </summary> public double m14; /// <summary> /// The 1. data element of 2. row /// </summary> public double m21; /// <summary> /// The 2. data element of 2. row /// </summary> public double m22; /// <summary> /// The 3. data element of 2. row /// </summary> public double m23; /// <summary> /// The 4. data element of 2. row /// </summary> public double m24; /// <summary> /// The 1. data element of 3. row /// </summary> public double m31; /// <summary> /// The 2. data element of 3. row /// </summary> public double m32; /// <summary> /// The 3. data element of 3. row /// </summary> public double m33; /// <summary> /// The 4. data element of 3. row /// </summary> public double m34; /// <summary> /// The 1. data element of 4. row /// </summary> public double m41; /// <summary> /// The 2. data element of 4. row /// </summary> public double m42; /// <summary> /// The 3. data element of 4. row /// </summary> public double m43; /// <summary> /// The 4. data element of 4. row /// </summary> public double m44; [DataMember] public double[] Values { get { double[] l = { m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 }; return l; } set { m11 = value[0]; m12 = value[1]; m13 = value[2]; m14 = value[3]; m21 = value[4]; m22 = value[5]; m23 = value[6]; m24 = value[7]; m31 = value[8]; m32 = value[9]; m33 = value[10]; m34 = value[11]; m41 = value[12]; m42 = value[13]; m43 = value[14]; m44 = value[15]; } } #endregion data fields #region constructors /// <summary> /// Copy constructor for the 4x4 matrix struct /// </summary> /// <param name="A">Matrix to be copied</param> public Matrix4x4 (Matrix4x4 A) { m11 = A.m11; m12 = A.m12; m13 = A.m13; m14 = A.m14; m21 = A.m21; m22 = A.m22; m23 = A.m23; m24 = A.m24; m31 = A.m31; m32 = A.m32; m33 = A.m33; m34 = A.m34; m41 = A.m41; m42 = A.m42; m43 = A.m43; m44 = A.m44; } /// <summary> /// Contructor for a 4x4 matrix from four 4d-vectors, the vectors are treated as rows /// </summary> /// <param name="v1">1. row</param> /// <param name="v2">2. row</param> /// <param name="v3">3. row</param> /// <param name="v4">4. row</param> public Matrix4x4 (Vector4D v1, Vector4D v2, Vector4D v3, Vector4D v4) { m11 = v1.x; m12 = v1.y; m13 = v1.z; m14 = v1.w; m21 = v2.x; m22 = v2.y; m23 = v2.z; m24 = v2.w; m31 = v3.x; m32 = v3.y; m33 = v3.z; m34 = v3.w; m41 = v4.x; m42 = v4.y; m43 = v4.z; m44 = v4.w; } /// <summary> /// Contructor for a 4x4 matrix from four 4d-vectors, the vectors are treated as rows or columns depending on the boolean parameter /// </summary> /// <param name="v1"></param> /// <param name="v2"></param> /// <param name="v3"></param> /// <param name="v4"></param> /// <param name="columns">if true, the vectors are treated as columns, else as rows</param> public Matrix4x4 (Vector4D v1, Vector4D v2, Vector4D v3, Vector4D v4, bool columns) { if (columns) { m11 = v1.x; m12 = v2.x; m13 = v3.x; m14 = v4.x; m21 = v1.y; m22 = v2.y; m23 = v3.y; m24 = v4.y; m31 = v1.z; m32 = v2.z; m33 = v3.z; m34 = v4.z; m41 = v1.w; m42 = v2.w; m43 = v3.w; m44 = v4.w; } else { m11 = v1.x; m12 = v1.y; m13 = v1.z; m14 = v1.w; m21 = v2.x; m22 = v2.y; m23 = v2.z; m24 = v2.w; m31 = v3.x; m32 = v3.y; m33 = v3.z; m34 = v3.w; m41 = v4.x; m42 = v4.y; m43 = v4.z; m44 = v4.w; } } /// <summary> /// Contructor for a 4x4 matrix from 16 float values, order is row major /// </summary> /// <param name="m11"></param> /// <param name="m12"></param> /// <param name="m13"></param> /// <param name="m14"></param> /// <param name="m21"></param> /// <param name="m22"></param> /// <param name="m23"></param> /// <param name="m24"></param> /// <param name="m31"></param> /// <param name="m32"></param> /// <param name="m33"></param> /// <param name="m34"></param> /// <param name="m41"></param> /// <param name="m42"></param> /// <param name="m43"></param> /// <param name="m44"></param> public Matrix4x4 (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44) { this.m11 = m11; this.m12 = m12; this.m13 = m13; this.m14 = m14; this.m21 = m21; this.m22 = m22; this.m23 = m23; this.m24 = m24; this.m31 = m31; this.m32 = m32; this.m33 = m33; this.m34 = m34; this.m41 = m41; this.m42 = m42; this.m43 = m43; this.m44 = m44; } /// <summary> /// Contructor for a 4x4 matrix from a Vector4D v, given by the matrix representation of Quaternions into a Matrix4x4 /// ( see http://en.wikipedia.org/wiki/Quaternion#Matrix_representations ) /// </summary> /// <param name="v"></param> public Matrix4x4(Vector4D v) { m11 = v.x; m12 = -v.y; m13 = -v.z; m14 = -v.w; m21 = v.y; m22 = v.x; m23 = v.w; m24 = -v.z; m31 = v.z; m32 = -v.w; m33 = v.x; m34 = v.y; m41 = v.w; m42 = v.z; m43 = -v.y; m44 = v.x; } #endregion constructors #region properties/indexer //rows /// <summary> /// Get/Set the 1. row as 4d-vector /// </summary> public Vector4D row1 { get { return new Vector4D(m11, m12, m13, m14); } set { m11 = value.x; m12 = value.y; m13 = value.z; m14 = value.w; } } /// <summary> /// Get/Set the 2. row as 4d-vector /// </summary> public Vector4D row2 { get { return new Vector4D(m21, m22, m23, m24); } set { m21 = value.x; m22 = value.y; m23 = value.z; m24 = value.w; } } /// <summary> /// Get/Set the 3. row as 4d-vector /// </summary> public Vector4D row3 { get { return new Vector4D(m31, m32, m33, m34); } set { m31 = value.x; m32 = value.y; m33 = value.z; m34 = value.w; } } /// <summary> /// Get/Set the 4. row as 4d-vector /// </summary> public Vector4D row4 { get { return new Vector4D(m41, m42, m43, m44); } set { m41 = value.x; m42 = value.y; m43 = value.z; m44 = value.w; } } //columns /// <summary> /// Get/Set the 1. column as 4d-vector /// </summary> public Vector4D col1 { get { return new Vector4D(m11, m21, m31, m41); } set { m11 = value.x; m21 = value.y; m31 = value.z; m41 = value.w; } } /// <summary> /// Get/Set the 2. column as 4d-vector /// </summary> public Vector4D col2 { get { return new Vector4D(m12, m22, m32, m42); } set { m12 = value.x; m22 = value.y; m32 = value.z; m42 = value.w; } } /// <summary> /// Get/Set the 3. column as 4d-vector /// </summary> public Vector4D col3 { get { return new Vector4D(m13, m23, m33, m43); } set { m13 = value.x; m23 = value.y; m33 = value.z; m43 = value.w; } } /// <summary> /// Get/Set the 4. column as 4d-vector /// </summary> public Vector4D col4 { get { return new Vector4D(m14, m24, m34, m44); } set { m14 = value.x; m24 = value.y; m34 = value.z; m44 = value.w; } } //indexer /// <summary> /// Unsafe but very fast indexer for 4x4 matrix, [0..15] /// </summary> unsafe public double this[int i] { get { fixed (Matrix4x4* p = &this) { return ((double*)p)[i]; } } set { fixed (Matrix4x4* p = &this) { ((double*)p)[i] = value; } } } /// <summary> /// Unsafe but very fast 2-d indexer for 4x4 matrix, [0..3, 0..3] /// </summary> unsafe public double this[int i, int j] { get { fixed (Matrix4x4* p = &this) { return ((double*)p)[i*4+j]; } } set { fixed (Matrix4x4* p = &this) { ((double*)p)[i*4+j] = value; } } } #endregion properties/indexer #region unary operators /// <summary> /// + matrix, makes no changes to a matrix /// </summary> /// <param name="A"></param> /// <returns>Input matrix A unchanged</returns> public static Matrix4x4 operator +(Matrix4x4 A) { return A; } /// <summary> /// - matrix, flips the sign off all matrix components /// </summary> /// <param name="A"></param> /// <returns>New matrix with all components of A negatived</returns> public static Matrix4x4 operator -(Matrix4x4 A) { return new Matrix4x4(-A.m11, -A.m12, -A.m13, -A.m14, -A.m21, -A.m22, -A.m23, -A.m24, -A.m31, -A.m32, -A.m33, -A.m34, -A.m41, -A.m42, -A.m43, -A.m44); } /// <summary> /// ! matrix, calculates the inverse of the matrix /// /// optimized 4x4 matrix inversion using cramer's rule, found in the game engine http://www.ogre3d.org /// takes about 1,8ns to execute on intel core2 duo 2Ghz, the intel reference /// implementation (not assembly optimized) was about 2,2ns. /// http://www.intel.com/design/pentiumiii/sml/24504301.pdf /// </summary> /// <param name="A"></param> /// <returns>Inverse matrix</returns> public static Matrix4x4 operator !(Matrix4x4 A) { double a11 = A.m11, a12 = A.m12, a13 = A.m13, a14 = A.m14; double a21 = A.m21, a22 = A.m22, a23 = A.m23, a24 = A.m24; double a31 = A.m31, a32 = A.m32, a33 = A.m33, a34 = A.m34; double a41 = A.m41, a42 = A.m42, a43 = A.m43, a44 = A.m44; double term1 = a31 * a42 - a32 * a41; double term2 = a31 * a43 - a33 * a41; double term3 = a31 * a44 - a34 * a41; double term4 = a32 * a43 - a33 * a42; double term5 = a32 * a44 - a34 * a42; double term6 = a33 * a44 - a34 * a43; double subterm1 = + (term6 * a22 - term5 * a23 + term4 * a24); double subterm2 = - (term6 * a21 - term3 * a23 + term2 * a24); double subterm3 = + (term5 * a21 - term3 * a22 + term1 * a24); double subterm4 = - (term4 * a21 - term2 * a22 + term1 * a23); double invDet = 1 / (subterm1 * a11 + subterm2 * a12 + subterm3 * a13 + subterm4 * a14); double ret11 = subterm1 * invDet; double ret21 = subterm2 * invDet; double ret31 = subterm3 * invDet; double ret41 = subterm4 * invDet; double ret12 = - (term6 * a12 - term5 * a13 + term4 * a14) * invDet; double ret22 = + (term6 * a11 - term3 * a13 + term2 * a14) * invDet; double ret32 = - (term5 * a11 - term3 * a12 + term1 * a14) * invDet; double ret42 = + (term4 * a11 - term2 * a12 + term1 * a13) * invDet; term1 = a21 * a42 - a22 * a41; term2 = a21 * a43 - a23 * a41; term3 = a21 * a44 - a24 * a41; term4 = a22 * a43 - a23 * a42; term5 = a22 * a44 - a24 * a42; term6 = a23 * a44 - a24 * a43; double ret13 = + (term6 * a12 - term5 * a13 + term4 * a14) * invDet; double ret23 = - (term6 * a11 - term3 * a13 + term2 * a14) * invDet; double ret33 = + (term5 * a11 - term3 * a12 + term1 * a14) * invDet; double ret43 = - (term4 * a11 - term2 * a12 + term1 * a13) * invDet; term1 = a32 * a21 - a31 * a22; term2 = a33 * a21 - a31 * a23; term3 = a34 * a21 - a31 * a24; term4 = a33 * a22 - a32 * a23; term5 = a34 * a22 - a32 * a24; term6 = a34 * a23 - a33 * a24; double ret14 = - (term6 * a12 - term5 * a13 + term4 * a14) * invDet; double ret24 = + (term6 * a11 - term3 * a13 + term2 * a14) * invDet; double ret34 = - (term5 * a11 - term3 * a12 + term1 * a14) * invDet; double ret44 = + (term4 * a11 - term2 * a12 + term1 * a13) * invDet; return new Matrix4x4(ret11, ret12, ret13, ret14, ret21, ret22, ret23, ret24, ret31, ret32, ret33, ret34, ret41, ret42, ret43, ret44); } /// <summary> /// ~ matrix, calculates the determinant of the matrix /// </summary> /// <param name="A"></param> /// <returns>Determinat of the matrix</returns> public static double operator ~(Matrix4x4 A) { double m00 = A.m11, m01 = A.m12, m02 = A.m13, m03 = A.m14; double m10 = A.m21, m11 = A.m22, m12 = A.m23, m13 = A.m24; double m20 = A.m31, m21 = A.m32, m22 = A.m33, m23 = A.m34; double m30 = A.m41, m31 = A.m42, m32 = A.m33, m33 = A.m44; return m03 * m12 * m21 * m30-m02 * m13 * m21 * m30-m03 * m11 * m22 * m30+m01 * m13 * m22 * m30+ m02 * m11 * m23 * m30-m01 * m12 * m23 * m30-m03 * m12 * m20 * m31+m02 * m13 * m20 * m31+ m03 * m10 * m22 * m31-m00 * m13 * m22 * m31-m02 * m10 * m23 * m31+m00 * m12 * m23 * m31+ m03 * m11 * m20 * m32-m01 * m13 * m20 * m32-m03 * m10 * m21 * m32+m00 * m13 * m21 * m32+ m01 * m10 * m23 * m32-m00 * m11 * m23 * m32-m02 * m11 * m20 * m33+m01 * m12 * m20 * m33+ m02 * m10 * m21 * m33-m00 * m12 * m21 * m33-m01 * m10 * m22 * m33+m00 * m11 * m22 * m33; } #endregion unary operators #region binary operators /// <summary> /// matrix + matrix, adds the values of two matrices component wise /// </summary> /// <param name="A"></param> /// <param name="B"></param> /// <returns>New matrix with the pair wise sum of the components of A and B</returns> public static Matrix4x4 operator +(Matrix4x4 A, Matrix4x4 B) { return new Matrix4x4(A.m11 + B.m11, A.m12 + B.m12, A.m13 + B.m13, A.m14 + B.m14, A.m21 + B.m21, A.m22 + B.m22, A.m23 + B.m23, A.m24 + B.m24, A.m31 + B.m31, A.m32 + B.m32, A.m33 + B.m33, A.m34 + B.m34, A.m41 + B.m41, A.m42 + B.m42, A.m43 + B.m43, A.m44 + B.m44); } /// <summary> /// matrix + value, adds a value to all matrix components /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>New matrix with b added to all components of A</returns> public static Matrix4x4 operator +(Matrix4x4 A, double b) { return new Matrix4x4(A.m11 + b, A.m12 + b, A.m13 + b, A.m14 + b, A.m21 + b, A.m22 + b, A.m23 + b, A.m24 + b, A.m31 + b, A.m32 + b, A.m33 + b, A.m34 + b, A.m41 + b, A.m42 + b, A.m43 + b, A.m44 + b); } /// <summary> /// value + matrix, adds a value to all matrix components /// </summary> /// <param name="a"></param> /// <param name="B"></param> /// <returns>New matrix with b added to all components of A</returns> public static Matrix4x4 operator +(double a, Matrix4x4 B) { return new Matrix4x4(a + B.m11, a + B.m12, a + B.m13, a + B.m14, a + B.m21, a + B.m22, a + B.m23, a + B.m24, a + B.m31, a + B.m32, a + B.m33, a + B.m34, a + B.m41, a + B.m42, a + B.m43, a + B.m44); } /// <summary> /// matrix - matrix, subtracts the components of B from the components of A /// </summary> /// <param name="A"></param> /// <param name="B"></param> /// <returns>New matrix with the pair wise difference of the components of A and B</returns> public static Matrix4x4 operator -(Matrix4x4 A, Matrix4x4 B) { return new Matrix4x4(A.m11 - B.m11, A.m12 - B.m12, A.m13 - B.m13, A.m14 - B.m14, A.m21 - B.m21, A.m22 - B.m22, A.m23 - B.m23, A.m24 - B.m24, A.m31 - B.m31, A.m32 - B.m32, A.m33 - B.m33, A.m34 - B.m34, A.m41 - B.m41, A.m42 - B.m42, A.m43 - B.m43, A.m44 - B.m44); } /// <summary> /// matrix - value, subtracts a value from all matrix components /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>New matrix with b subtracted from all components of A</returns> public static Matrix4x4 operator -(Matrix4x4 A, double b) { return new Matrix4x4(A.m11 - b, A.m12 - b, A.m13 - b, A.m14 - b, A.m21 - b, A.m22 - b, A.m23 - b, A.m24 - b, A.m31 - b, A.m32 - b, A.m33 - b, A.m34 - b, A.m41 - b, A.m42 - b, A.m43 - b, A.m44 - b); } /// <summary> /// value - matrix, subtracts all matrix components from a value /// </summary> /// <param name="a"></param> /// <param name="B"></param> /// <returns>New matrix with all components of A subtracted from b</returns> public static Matrix4x4 operator -(double a, Matrix4x4 B) { return new Matrix4x4(a - B.m11, a - B.m12, a - B.m13, a - B.m14, a - B.m21, a - B.m22, a - B.m23, a - B.m24, a - B.m31, a - B.m32, a - B.m33, a - B.m34, a - B.m41, a - B.m42, a - B.m43, a - B.m44); } /// <summary> /// matrix * matrix, performs a matrix multiplication /// </summary> /// <param name="A"></param> /// <param name="B"></param> /// <returns>Matrix product of A and B</returns> public static Matrix4x4 operator *(Matrix4x4 A, Matrix4x4 B) { return new Matrix4x4(B.m11 * A.m11 + B.m21 * A.m12 + B.m31 * A.m13 + B.m41 * A.m14, B.m12 * A.m11 + B.m22 * A.m12 + B.m32 * A.m13 + B.m42 * A.m14, B.m13 * A.m11 + B.m23 * A.m12 + B.m33 * A.m13 + B.m43 * A.m14, B.m14 * A.m11 + B.m24 * A.m12 + B.m34 * A.m13 + B.m44 * A.m14, B.m11 * A.m21 + B.m21 * A.m22 + B.m31 * A.m23 + B.m41 * A.m24, B.m12 * A.m21 + B.m22 * A.m22 + B.m32 * A.m23 + B.m42 * A.m24, B.m13 * A.m21 + B.m23 * A.m22 + B.m33 * A.m23 + B.m43 * A.m24, B.m14 * A.m21 + B.m24 * A.m22 + B.m34 * A.m23 + B.m44 * A.m24, B.m11 * A.m31 + B.m21 * A.m32 + B.m31 * A.m33 + B.m41 * A.m34, B.m12 * A.m31 + B.m22 * A.m32 + B.m32 * A.m33 + B.m42 * A.m34, B.m13 * A.m31 + B.m23 * A.m32 + B.m33 * A.m33 + B.m43 * A.m34, B.m14 * A.m31 + B.m24 * A.m32 + B.m34 * A.m33 + B.m44 * A.m34, B.m11 * A.m41 + B.m21 * A.m42 + B.m31 * A.m43 + B.m41 * A.m44, B.m12 * A.m41 + B.m22 * A.m42 + B.m32 * A.m43 + B.m42 * A.m44, B.m13 * A.m41 + B.m23 * A.m42 + B.m33 * A.m43 + B.m43 * A.m44, B.m14 * A.m41 + B.m24 * A.m42 + B.m34 * A.m43 + B.m44 * A.m44); } /// <summary> /// matrix * 4d vector, applies a matrix transform to a 4d-vector /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>Vector b transformed by matrix A</returns> public static Vector4D operator *(Matrix4x4 A, Vector4D b) { return new Vector4D(A.m11 * b.x + A.m21 * b.y + A.m31 * b.z + A.m41 * b.w, A.m12 * b.x + A.m22 * b.y + A.m32 * b.z + A.m42 * b.w, A.m13 * b.x + A.m23 * b.y + A.m33 * b.z + A.m43 * b.w, A.m14 * b.x + A.m24 * b.y + A.m34 * b.z + A.m44 * b.w); } /// <summary> /// matrix * 3d vector, applies a matrix transform to a 3d-vector, (x, y, z, 1) and divides by w /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>Vector b transformed by matrix A</returns> public static Vector3D operator *(Matrix4x4 A, Vector3D b) { double wFactor = 1/(A.m14 * b.x + A.m24 * b.y + A.m34 * b.z + A.m44); return new Vector3D((A.m11 * b.x + A.m21 * b.y + A.m31 * b.z + A.m41) * wFactor, (A.m12 * b.x + A.m22 * b.y + A.m32 * b.z + A.m42) * wFactor, (A.m13 * b.x + A.m23 * b.y + A.m33 * b.z + A.m43) * wFactor); } /// <summary> /// matrix * 2d vector, applies a matrix transform to a 2d-vector, (x, y, 0, 1) /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>Vector b transformed by matrix A</returns> public static Vector3D operator *(Matrix4x4 A, Vector2D b) { double wFactor = 1/(A.m14 * b.x + A.m24 * b.y + A.m44); return new Vector3D((A.m11 * b.x + A.m21 * b.y + A.m41) * wFactor, (A.m12 * b.x + A.m22 * b.y + A.m42) * wFactor, (A.m13 * b.x + A.m23 * b.y + A.m43) * wFactor); } /// <summary> /// matrix * value, multiplies all matrix components with a value /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>New matrix with all components of A multiplied by b</returns> public static Matrix4x4 operator *(Matrix4x4 A, double b) { return new Matrix4x4(A.m11 * b, A.m12 * b, A.m13 * b, A.m14 * b, A.m21 * b, A.m22 * b, A.m23 * b, A.m24 * b, A.m31 * b, A.m32 * b, A.m33 * b, A.m34 * b, A.m41 * b, A.m42 * b, A.m43 * b, A.m44 * b); } /// <summary> /// value * matrix, multiplies all matrix components with a value /// </summary> /// <param name="a"></param> /// <param name="B"></param> /// <returns>New matrix with all components of B multiplied by a</returns> public static Matrix4x4 operator *(double a, Matrix4x4 B) { return new Matrix4x4(a * B.m11, a * B.m12, a * B.m13, a * B.m14, a * B.m21, a * B.m22, a * B.m23, a * B.m24, a * B.m31, a * B.m32, a * B.m33, a * B.m34, a * B.m41, a * B.m42, a * B.m43, a * B.m44); } /// <summary> /// matrix / value, divides all matrix components with a value /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns>New matrix with all components of A divided by b</returns> public static Matrix4x4 operator /(Matrix4x4 A, double b) { double rez = 1/b; return new Matrix4x4(A.m11 * rez, A.m12 * rez, A.m13 * rez, A.m14 * rez, A.m21 * rez, A.m22 * rez, A.m23 * rez, A.m24 * rez, A.m31 * rez, A.m32 * rez, A.m33 * rez, A.m34 * rez, A.m41 * rez, A.m42 * rez, A.m43 * rez, A.m44 * rez); } /// <summary> /// value / matrix, divides a value by all matrix components /// </summary> /// <param name="a"></param> /// <param name="B"></param> /// <returns>New matrix with a divided by all components of B</returns> public static Matrix4x4 operator /(double a, Matrix4x4 B) { return new Matrix4x4(a / B.m11, a / B.m12, a / B.m13, a / B.m14, a / B.m21, a / B.m22, a / B.m23, a / B.m24, a / B.m31, a / B.m32, a / B.m33, a / B.m34, a / B.m41, a / B.m42, a / B.m43, a / B.m44); } public static bool operator ==(Matrix4x4 lhs, Matrix4x4 rhs) { return lhs.Equals(rhs); } public static bool operator !=(Matrix4x4 lhs, Matrix4x4 rhs) { return !(lhs == rhs); } #endregion binary operators #region methods /// <summary> /// Transpose thi 4x4 matrix /// </summary> /// <returns>Transpose of this matrix</returns> public Matrix4x4 Transpose() { return new Matrix4x4(m11, m21, m31, m41, m12, m22, m32, m42, m13, m23, m33, m43, m14, m24, m34, m44); } public override string ToString() { string row1 = m11.ToString("f4") + " " + m12.ToString("f4") + " " + m13.ToString("f4") + " " + m14.ToString("f4"); string row2 = m21.ToString("f4") + " " + m22.ToString("f4") + " " + m23.ToString("f4") + " " + m24.ToString("f4"); string row3 = m31.ToString("f4") + " " + m32.ToString("f4") + " " + m33.ToString("f4") + " " + m34.ToString("f4"); string row4 = m41.ToString("f4") + " " + m42.ToString("f4") + " " + m43.ToString("f4") + " " + m44.ToString("f4"); return "\n" + row1 + "\n" + row2 + "\n" + row3 + "\n" + row4; } #endregion methods #region Equals and GetHashCode implementation public override bool Equals(object obj) { return (obj is Matrix4x4) && Equals((Matrix4x4)obj); } public bool Equals(Matrix4x4 other) { return this.m11 == other.m11 && this.m12 == other.m12 && this.m13 == other.m13 && this.m14 == other.m14 && this.m21 == other.m21 && this.m22 == other.m22 && this.m23 == other.m23 && this.m24 == other.m24 && this.m31 == other.m31 && this.m32 == other.m32 && this.m33 == other.m33 && this.m34 == other.m34 && this.m41 == other.m41 && this.m42 == other.m42 && this.m43 == other.m43 && this.m44 == other.m44; } public override int GetHashCode() { int hashCode = 0; unchecked { hashCode += 1000000007 * m11.GetHashCode(); hashCode += 1000000009 * m12.GetHashCode(); hashCode += 1000000021 * m13.GetHashCode(); hashCode += 1000000033 * m14.GetHashCode(); hashCode += 1000000087 * m21.GetHashCode(); hashCode += 1000000093 * m22.GetHashCode(); hashCode += 1000000097 * m23.GetHashCode(); hashCode += 1000000103 * m24.GetHashCode(); hashCode += 1000000123 * m31.GetHashCode(); hashCode += 1000000181 * m32.GetHashCode(); hashCode += 1000000207 * m33.GetHashCode(); hashCode += 1000000223 * m34.GetHashCode(); hashCode += 1000000241 * m41.GetHashCode(); hashCode += 1000000271 * m42.GetHashCode(); hashCode += 1000000289 * m43.GetHashCode(); hashCode += 1000000297 * m44.GetHashCode(); } return hashCode; } #endregion Equals and GetHashCode implementation } }
{ "pile_set_name": "Github" }
defmodule Examples.GlobalCounter do use Component.Strategy.Global, initial_state: 0, show_code: false, state_name: :tally one_way increment(n) do tally + n end # fetch two_way get_count() do tally end # update and fetch two_way update_and_return(n) do set_state_and_return(tally + n) end # fetch and update two_way return_current_and_update(n) do set_state(tally + n) do tally end end end Process.whereis(ExUnit.Server) || ExUnit.start defmodule UseGlobal do use ExUnit.Case alias Examples.GlobalCounter, as: GC test "sanity check" do GC.create assert GC.get_count == 0 GC.increment 7 assert GC.get_count == 7 GC.destroy end test "passing initial state" do GC.create(10) assert GC.get_count == 10 GC.increment 7 assert GC.get_count == 17 GC.destroy end test "update and return" do GC.create(2) assert GC.update_and_return(5) == 7 assert GC.get_count() == 7 GC.destroy end test "return current and update" do GC.create(2) assert GC.return_current_and_update(5) == 2 assert GC.get_count() == 7 GC.destroy end end
{ "pile_set_name": "Github" }
/* * ************************************************************************* * JumpToTimeDIalog.java * ************************************************************************** * Copyright © 2015 VLC authors and VideoLAN * Author: Geoffrey Métais * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * *************************************************************************** */ package org.videolan.vlc.gui.dialogs import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ObsoleteCoroutinesApi import org.videolan.vlc.R @ObsoleteCoroutinesApi @ExperimentalCoroutinesApi class JumpToTimeDialog : PickTimeFragment() { override fun executeAction() { if (playbackService == null) return val hours = if (hours != "") java.lang.Long.parseLong(hours) * HOURS_IN_MICROS else 0L val minutes = if (minutes != "") java.lang.Long.parseLong(minutes) * MINUTES_IN_MICROS else 0L val seconds = if (seconds != "") java.lang.Long.parseLong(seconds) * SECONDS_IN_MICROS else 0L playbackService.time = (hours + minutes + seconds) / 1000L //Time in ms dismiss() } override fun getTitle(): Int { return R.string.jump_to_time } companion object { fun newInstance(): JumpToTimeDialog { return JumpToTimeDialog() } } }
{ "pile_set_name": "Github" }
bad blocks in files
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: bb92a3a903a76864390a9ca5a2e77bd0 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
CodeMirror.defineMode('tiki', function(config) { function inBlock(style, terminator, returnTokenizer) { return function(stream, state) { while (!stream.eol()) { if (stream.match(terminator)) { state.tokenize = inText; break; } stream.next(); } if (returnTokenizer) state.tokenize = returnTokenizer; return style; }; } function inLine(style) { return function(stream, state) { while(!stream.eol()) { stream.next(); } state.tokenize = inText; return style; }; } function inText(stream, state) { function chain(parser) { state.tokenize = parser; return parser(stream, state); } var sol = stream.sol(); var ch = stream.next(); //non start of line switch (ch) { //switch is generally much faster than if, so it is used here case "{": //plugin stream.eat("/"); stream.eatSpace(); var tagName = ""; var c; while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; state.tokenize = inPlugin; return "tag"; break; case "_": //bold if (stream.eat("_")) { return chain(inBlock("strong", "__", inText)); } break; case "'": //italics if (stream.eat("'")) { // Italic text return chain(inBlock("em", "''", inText)); } break; case "(":// Wiki Link if (stream.eat("(")) { return chain(inBlock("variable-2", "))", inText)); } break; case "[":// Weblink return chain(inBlock("variable-3", "]", inText)); break; case "|": //table if (stream.eat("|")) { return chain(inBlock("comment", "||")); } break; case "-": if (stream.eat("=")) {//titleBar return chain(inBlock("header string", "=-", inText)); } else if (stream.eat("-")) {//deleted return chain(inBlock("error tw-deleted", "--", inText)); } break; case "=": //underline if (stream.match("==")) { return chain(inBlock("tw-underline", "===", inText)); } break; case ":": if (stream.eat(":")) { return chain(inBlock("comment", "::")); } break; case "^": //box return chain(inBlock("tw-box", "^")); break; case "~": //np if (stream.match("np~")) { return chain(inBlock("meta", "~/np~")); } break; } //start of line types if (sol) { switch (ch) { case "!": //header at start of line if (stream.match('!!!!!')) { return chain(inLine("header string")); } else if (stream.match('!!!!')) { return chain(inLine("header string")); } else if (stream.match('!!!')) { return chain(inLine("header string")); } else if (stream.match('!!')) { return chain(inLine("header string")); } else { return chain(inLine("header string")); } break; case "*": //unordered list line item, or <li /> at start of line case "#": //ordered list line item, or <li /> at start of line case "+": //ordered list line item, or <li /> at start of line return chain(inLine("tw-listitem bracket")); break; } } //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki return null; } var indentUnit = config.indentUnit; // Return variables for tokenizers var pluginName, type; function inPlugin(stream, state) { var ch = stream.next(); var peek = stream.peek(); if (ch == "}") { state.tokenize = inText; //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin return "tag"; } else if (ch == "(" || ch == ")") { return "bracket"; } else if (ch == "=") { type = "equals"; if (peek == ">") { ch = stream.next(); peek = stream.peek(); } //here we detect values directly after equal character with no quotes if (!/[\'\"]/.test(peek)) { state.tokenize = inAttributeNoQuote(); } //end detect values return "operator"; } else if (/[\'\"]/.test(ch)) { state.tokenize = inAttribute(ch); return state.tokenize(stream, state); } else { stream.eatWhile(/[^\s\u00a0=\"\'\/?]/); return "keyword"; } } function inAttribute(quote) { return function(stream, state) { while (!stream.eol()) { if (stream.next() == quote) { state.tokenize = inPlugin; break; } } return "string"; }; } function inAttributeNoQuote() { return function(stream, state) { while (!stream.eol()) { var ch = stream.next(); var peek = stream.peek(); if (ch == " " || ch == "," || /[ )}]/.test(peek)) { state.tokenize = inPlugin; break; } } return "string"; }; } var curState, setStyle; function pass() { for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); } function cont() { pass.apply(null, arguments); return true; } function pushContext(pluginName, startOfLine) { var noIndent = curState.context && curState.context.noIndent; curState.context = { prev: curState.context, pluginName: pluginName, indent: curState.indented, startOfLine: startOfLine, noIndent: noIndent }; } function popContext() { if (curState.context) curState.context = curState.context.prev; } function element(type) { if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));} else if (type == "closePlugin") { var err = false; if (curState.context) { err = curState.context.pluginName != pluginName; popContext(); } else { err = true; } if (err) setStyle = "error"; return cont(endcloseplugin(err)); } else if (type == "string") { if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata"); if (curState.tokenize == inText) popContext(); return cont(); } else return cont(); } function endplugin(startOfLine) { return function(type) { if ( type == "selfclosePlugin" || type == "endPlugin" ) return cont(); if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();} return cont(); }; } function endcloseplugin(err) { return function(type) { if (err) setStyle = "error"; if (type == "endPlugin") return cont(); return pass(); }; } function attributes(type) { if (type == "keyword") {setStyle = "attribute"; return cont(attributes);} if (type == "equals") return cont(attvalue, attributes); return pass(); } function attvalue(type) { if (type == "keyword") {setStyle = "string"; return cont();} if (type == "string") return cont(attvaluemaybe); return pass(); } function attvaluemaybe(type) { if (type == "string") return cont(attvaluemaybe); else return pass(); } return { startState: function() { return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null}; }, token: function(stream, state) { if (stream.sol()) { state.startOfLine = true; state.indented = stream.indentation(); } if (stream.eatSpace()) return null; setStyle = type = pluginName = null; var style = state.tokenize(stream, state); if ((style || type) && style != "comment") { curState = state; while (true) { var comb = state.cc.pop() || element; if (comb(type || style)) break; } } state.startOfLine = false; return setStyle || style; }, indent: function(state, textAfter) { var context = state.context; if (context && context.noIndent) return 0; if (context && /^{\//.test(textAfter)) context = context.prev; while (context && !context.startOfLine) context = context.prev; if (context) return context.indent + indentUnit; else return 0; }, electricChars: "/" }; }); //I figure, why not CodeMirror.defineMIME("text/tiki", "tiki");
{ "pile_set_name": "Github" }
# # Copyright 2006-2017 ICEsoft Technologies Canada Corp. # # 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. # ##### ### This MessageBundle contains English text for ICEpdf View and Pilot RI's ## # ## Window toolbar Title viewer.window.title.default = ICEpdf \u700f\u89bd\u7a0b\u5f0f viewer.window.title.open.default = ICEpdf \u700f\u89bd\u7a0b\u5f0f - [{0}] #status bar viewer.statusbar.currentPage = {0} / {1} \u9801 ## Top Page Control Toolbar viewer.toolbar.hideToolBar.label = \u96b1\u85cf\u5de5\u5177\u5217 viewer.toolbar.showToolBar.label = \u986f\u793a\u5de5\u5177\u5217 viewer.toolbar.showUtilityPane.label = \u986f\u793a\u516c\u7528\u7a0b\u5f0f\u9762\u677f viewer.toolbar.hideUtilityPane.label = \u96b1\u85cf\u516c\u7528\u7a0b\u5f0f\u9762\u677f viewer.toolbar.open.label = viewer.toolbar.open.tooltip = \u958b\u555f\u6587\u4ef6 viewer.toolbar.saveAs.label = \u53e6\u5b58\u65b0\u6a94 viewer.toolbar.saveAs.tooltip = \u53e6\u5b58\u65b0\u6a94\u3002.. viewer.toolbar.print.label = \u5217\u5370 viewer.toolbar.print.tooltip = \u5217\u5370\u6587\u4ef6 viewer.toolbar.search.label = \u641c\u5c0b viewer.toolbar.search.tooltip = \u641c\u5c0b\u6587\u4ef6 viewer.toolbar.utilityPane.label = \u516c\u7528\u7a0b\u5f0f\u9762\u677f viewer.toolbar.utilityPane.tooltip = \u986f\u793a/\u96b1\u85cf\u516c\u7528\u7a0b\u5f0f\u9762\u677f viewer.toolbar.navigation.label = viewer.toolbar.navigation.pages.tooltip = \u9801\u6578 viewer.toolbar.navigation.pages.firstPage.label = viewer.toolbar.navigation.current.tooltip = \u76ee\u524d\u9801\u78bc viewer.toolbar.navigation.current.firstPage.label = viewer.toolbar.navigation.firstPage.label = viewer.toolbar.navigation.firstPage.tooltip = \u7b2c\u4e00\u9801 viewer.toolbar.navigation.previousPage.label = viewer.toolbar.navigation.previousPage.tooltip = \u4e0a\u4e00\u9801 viewer.toolbar.navigation.nextPage.label = viewer.toolbar.navigation.nextPage.tooltip = \u4e0b\u4e00\u9801 viewer.toolbar.navigation.lastPage.label = viewer.toolbar.navigation.lastPage.tooltip = \u6700\u5f8c\u4e00\u9801 viewer.toolbar.pageIndicator = (\u5171 {0} \u9801) viewer.toolbar.zoom.label = viewer.toolbar.zoom.tooltip = \u7e2e\u653e viewer.toolbar.zoom.out.label = viewer.toolbar.zoom.out.tooltip = \u7e2e\u5c0f viewer.toolbar.zoom.in.label = viewer.toolbar.zoom.in.tooltip = \u653e\u5927 viewer.toolbar.pageFit.actualsize.label = viewer.toolbar.pageFit.actualsize.tooltip = \u5be6\u969b\u5927\u5c0f viewer.toolbar.pageFit.fitWindow.label = viewer.toolbar.pageFit.fitWindow.tooltip = \u7e2e\u653e\u5230\u8996\u7a97\u5927\u5c0f viewer.toolbar.pageFit.fitWidth.label = viewer.toolbar.pageFit.fitWidth.tooltip = \u7e2e\u653e\u5230\u7b26\u5408\u5bec\u5ea6 viewer.toolbar.rotation.left.label = viewer.toolbar.rotation.left.tooltip = \u5411\u5de6\u65cb\u8f49 viewer.toolbar.rotation.right.label = viewer.toolbar.rotation.right.tooltip = \u5411\u53f3\u65cb\u8f49 viewer.toolbar.tool.pan.label = viewer.toolbar.tool.pan.tooltip = \u6587\u5b57\u9078\u53d6\u5de5\u5177 viewer.toolbar.tool.text.label = viewer.toolbar.tool.text.tooltip = \u6587\u5b57\u9078\u53d6\u5de5\u5177 viewer.toolbar.tool.select.label = viewer.toolbar.tool.select.tooltip = \u9078\u53d6\u5de5\u5177 viewer.toolbar.tool.link.label = viewer.toolbar.tool.link.tooltip = \u9023\u7d50\u8a3b\u89e3\u5de5\u5177 viewer.toolbar.tool.zoomIn.label = viewer.toolbar.tool.zoomIn.tooltip = \u653e\u5927\u5de5\u5177 viewer.toolbar.tool.zoomOut.label = viewer.toolbar.tool.zoomOut.tooltip = \u7e2e\u5c0f\u5de5\u5177 viewer.toolbar.pageFit.fontEngine.label = viewer.toolbar.pageFit.fontEngine.tooltip = \u555f\u7528/\u505c\u7528\u5b57\u578b\u5f15\u64ce ## Bottom Page View Control Toolbar viewer.toolbar.pageView.nonContinuous.singlePage.label = viewer.toolbar.pageView.nonContinuous.singlePage.tooltip = \u55ae\u9801\u4e0d\u9023\u7e8c\u700f\u89bd viewer.toolbar.pageView.nonContinuous.facingPage.label = viewer.toolbar.pageView.nonContinuous.facingPage.tooltip = \u5c0d\u958b\u4e0d\u9023\u7e8c\u700f\u89bd viewer.toolbar.pageView.continuous.singlePage.label = viewer.toolbar.pageView.continuous.singlePage.tooltip = \u55ae\u9801\u9023\u7e8c\u700f\u89bd viewer.toolbar.pageView.continuous.facingPage.label = viewer.toolbar.pageView.continuous.facingPage.tooltip = \u5c0d\u958b\u9023\u7e8c\u700f\u89bd ## File Menu and submenu items viewer.menu.file.label = \u6a94\u6848 viewer.menu.file.mnemonic = F viewer.menu.open.label = \u958b\u555f viewer.menu.open.file.label = \u6a94\u6848\u3002.. viewer.menu.open.URL.label = \u7db2\u5740\u3002.. viewer.menu.close.label = \u95dc\u9589 viewer.menu.saveAs.label = \u53e6\u5b58\u65b0\u6a94\u3002.. viewer.menu.exportText.label = \u532f\u51fa\u6587\u5b57\u3002.. viewer.menu.documentProperties.label=\u6587\u4ef6\u8cc7\u8a0a\u3002.. viewer.menu.documentPermission.label = \u6587\u4ef6\u6b0a\u9650\u3002.. viewer.menu.documentInformation.label = \u6587\u4ef6\u8cc7\u8a0a\u3002.. viewer.menu.printSetup.label = \u5217\u5370\u8a2d\u5b9a\u3002.. viewer.menu.print.label = \u5217\u5370\u3002.. viewer.menu.exit.label = \u96e2\u958b ## View Menu and submenu items viewer.menu.edit.label = \u7de8\u8f2f viewer.menu.edit.mnemonic = E viewer.menu.edit.undo.label = \u5fa9\u539f viewer.menu.edit.redo.label = \u91cd\u8907 viewer.menu.edit.copy.label = \u8907\u88fd viewer.menu.edit.delete.label = \u522a\u9664 viewer.menu.edit.selectAll.label = \u5168\u9078 viewer.menu.edit.deselectAll.label = \u53d6\u6d88\u5168\u9078 ## View Menu and submenu items viewer.menu.view.label = \u6aa2\u8996 viewer.menu.view.mnemonic = V viewer.menu.view.actualSize.label = \u5be6\u969b\u5927\u5c0f viewer.menu.view.fitInWindow.label = \u7e2e\u653e\u5230\u8996\u7a97\u5927\u5c0f viewer.menu.view.fitWidth.label = \u7e2e\u653e\u5230\u7b26\u5408\u5bec\u5ea6 viewer.menu.view.zoomIn.label = \u653e\u5927 viewer.menu.view.zoomOut.label = \u7e2e\u5c0f viewer.menu.view.rotateLeft.label = \u5411\u5de6\u65cb\u8f49 viewer.menu.view.rotateRight.label = \u5411\u53f3\u65cb\u8f49 viewer.menu.view.hideToolBar.label = \u96b1\u85cf\u5de5\u5177\u5217 viewer.menu.view.showToolBar.label = \u986f\u793a\u5de5\u5177\u5217 viewer.menu.view.showUtilityPane.label = \u986f\u793a\u516c\u7528\u7a0b\u5f0f\u9762\u677f viewer.menu.view.hideUtilityPane.label = \u96b1\u85cf\u516c\u7528\u7a0b\u5f0f\u9762\u677f ## Document Menu and submenu items viewer.menu.document.label = \u6587\u4ef6 viewer.menu.document.mnemonic = D viewer.menu.document.firstPage.label = \u7b2c\u4e00\u9801 viewer.menu.document.previousPage.label = \u4e0a\u4e00\u9801 viewer.menu.document.nextPage.label = \u4e0b\u4e00\u9801 viewer.menu.document.lastPage.label = \u6700\u5f8c\u4e00\u9801 viewer.menu.document.search.label = \u641c\u5c0b\u3002.. viewer.menu.document.gotToPage.label = \u524d\u5f80\u6307\u5b9a\u9801\u3002.. ## Window Menu and submenu items viewer.menu.window.label = \u8996\u7a97 viewer.menu.window.mnemonic = W viewer.menu.window.minAll.label = \u5168\u90e8\u7e2e\u5230\u6700\u5c0f viewer.menu.window.minAll.mnemonic = M viewer.menu.window.frontAll.label = \u5168\u90e8\u63d0\u5230\u6700\u4e0a\u5c64 viewer.menu.window.frontAll.mnemonic = B viewer.menu.window.1.label = 1 viewer.menu.window.1.mnemonic = 1 viewer.menu.window.2.label = 2 viewer.menu.window.2.mnemonic = 2 viewer.menu.window.3.label = 3 viewer.menu.window.3.mnemonic = 3 viewer.menu.window.4.label = 4 viewer.menu.window.4.mnemonic = 4 viewer.menu.window.5.label = 5 viewer.menu.window.5.mnemonic = 5 viewer.menu.window.6.label = 6 viewer.menu.window.6.mnemonic = 6 viewer.menu.window.7.label = 7 viewer.menu.window.7.mnemonic = 7 viewer.menu.window.8.label = 8 viewer.menu.window.8.mnemonic = 8 viewer.menu.window.9.label = 9 viewer.menu.window.9.mnemonic = 9 ## Add as many entries as you want, to viewer.menu.window.X.label and mnemonic ## where X is an incrementing integer. The mnemonic should be one unique ## character found within the label ## Help Menu and submenu items viewer.menu.help.label = \u8aaa\u660e viewer.menu.help.mnemonic = H viewer.menu.help.about.label = \u95dc\u65bc ICEpdf \u700f\u89bd\u7a0b\u5f0f\u3002.. ## General error dialog viewer.dialog.error.exception.title = ICEsoft ICEpdf\uff1a\u4f8b\u5916 viewer.dialog.error.exception.msg = \ \u57f7\u884c\u6307\u4ee4\u6642\u51fa\u73fe\u932f\u8aa4\uff0c\u56e0\u70ba\u6709\u4ee5\u4e0b\u4f8b\u5916\n\ {0}. ## Open File Dialog viewer.dialog.openFile.title = \u958b\u555f\u820a\u6a94 viewer.dialog.openFile.error.title = ICEsoft ICEpdf\uff1a\u958b\u555f\u820a\u6a94\u932f\u8aa4 viewer.dialog.openFile.error.msg = \ ICEpdf \u7121\u6cd5\u958b\u555f\u4f4d\u65bc {0} \u7684\u6307\u5b9a\u6a94\u6848\n\ \u6a94\u6848\u53ef\u80fd\u6bc0\u640d\u6216\u8005\u662f\u4e0d\u652f\u63f4\u7684\u6a94\u6848\u985e\u578b\u3002 viewer.dialog.openDocument.pdfException.title = ICEsoft ICEpdf\uff1aPDF \u4f8b\u5916 viewer.dialog.openDocument.pdfException.msg = \ ICEpdf \u7121\u6cd5\u958b\u555f\u6307\u5b9a\u7684\u6a94\u6848 {0}\n\ \u6a94\u6848\u53ef\u80fd\u6bc0\u640d\u6216\u8005\u662f\u4e0d\u652f\u63f4\u7684\u6a94\u6848\u985e\u578b\u3002 viewer.dialog.openDocument.pdfSecurityException.title = ICEsoft ICEpdf\uff1aPDF \u5b89\u5168\u6027\u4f8b\u5916 viewer.dialog.openDocument.pdfSecurityException.msg = \ ICEpdf \u7121\u6cd5\u958b\u555f\u4f4d\u65bc {0} \u7684\u52a0\u5bc6\u6a94\u6848\n\ \u9019\u53ef\u80fd\u662f\u5bc6\u78bc\u932f\u8aa4\u6216\u7f3a\u5c11 JCE Security Provider \u4e4b\u6545\u3002\n\n\ \u8a73\u60c5\u8acb\u53c3\u8003\u300aICEpdf Developer's Guide\u300b\u3002 viewer.dialog.openDocument.exception.title = ICEsoft ICEpdf\uff1a\u4f8b\u5916 viewer.dialog.openDocument.exception.msg = \ ICEpdf \u7121\u6cd5\u958b\u555f\u4f4d\u65bc {0} \u7684\u6307\u5b9a\u6a94\u6848\n\ \u6a94\u6848\u53ef\u80fd\u6bc0\u640d\u6216\u8005\u662f\u4e0d\u652f\u63f4\u7684\u6a94\u6848\u985e\u578b\u3002 viewer.dialog.openURL.exception.title = ICEsoft ICEpdf\uff1a\u7db2\u5740\u4f8b\u5916 viewer.dialog.openURL.exception.msg = \ ICEpdf \u7121\u6cd5\u958b\u555f\u6307\u5b9a\u7684\u6a94\u6848\u3002 {0} \n\ \u7db2\u5740\u662f\uff1a {1} ## General error dialog viewer.dialog.information.copyAll.title = ICEsoft ICEpdf\uff1a\u8cc7\u8a0a viewer.dialog.information.copyAll.msg = \ \u6b64\u6587\u4ef6\u8d85\u904e {0} \u9801\uff0c\u8acb\u4f7f\u7528\n\ \u300c\u532f\u51fa\u6587\u5b57\u3002..\u300d\u64f7\u53d6\u6587\u4ef6\u4e2d\u7684\u6587\u5b57\u3002 ## Open URL Dialog viewer.dialog.security.title = \u6587\u4ef6\u5b89\u5168\u6027 viewer.dialog.security.msg = \u672c PDF \u5df2\u7d93\u53d7\u5230\u4fdd\u8b77 viewer.dialog.security.password.label = \u5bc6\u78bc\uff1a viewer.dialog.security.okButton.label = \u78ba\u5b9a viewer.dialog.security.okButton.mnemonic = O viewer.dialog.security.cancelButton.label = \u53d6\u6d88 viewer.dialog.security.cancelButton.mnemonic = C ## Open URL Dialog viewer.dialog.openURL.title = \u958b\u555f\u7db2\u5740 ### Save a Copy Dialog viewer.dialog.saveAs.title = \u53e6\u5b58\u65b0\u6a94 viewer.dialog.saveAs.extensionError.title = ICEsoft ICEpdf\uff1a\u5132\u5b58\u932f\u8aa4 viewer.dialog.saveAs.extensionError.msg = \ \u7121\u6cd5\u5c07 ICEpdf \u5132\u5b58\u6210 {0}\uff0c\u56e0\u70ba\u4e26\u975e\u652f\u63f4\u7684\u6a94\u6848\u985e\u578b\u3002 viewer.dialog.saveAs.noExtensionError.title = ICEsoft ICEpdf\uff1a\u5132\u5b58\u932f\u8aa4 viewer.dialog.saveAs.noExtensionError.msg = \u8acb\u6307\u5b9a\u526f\u6a94\u540d\u3002 ## Export Text Dialog viewer.dialog.exportText.title = \u532f\u51fa\u6587\u4ef6\u4e2d\u7684\u6587\u5b57 viewer.dialog.exportText.progress.msg = \u6b63\u5728\u64f7\u53d6 PDF \u6587\u5b57 viewer.dialog.exportText.noExtensionError.title = ICEsoft ICEpdf\uff1a\u5132\u5b58\u932f\u8aa4 viewer.dialog.exportText.noExtensionError.msg = \u8acb\u6307\u5b9a\u526f\u6a94\u540d\u3002 # Text extraction output file viewer.exportText.fileStamp.msg = ICEsoft ICEpdf Viewer, (c) ICEsoft Technologies, Inc. viewer.exportText.pageStamp.msg = <!----- Page {0} Text ----> # Completed x out of y page(s). viewer.exportText.fileStamp.progress.msg = \ \u5df2\u5b8c\u6210 {0}/{1}\u3002 viewer.exportText.fileStamp.progress.oneFile.msg = {2} \u9801 viewer.exportText.fileStamp.progress.moreFile.msg = {2} \u9801 # Printing Progress bar viewer.dialog.printing.status.progress.msg = \u7b2c {0} / {1} \u9801 viewer.dialog.printing.status.start.msg = \u6b63\u5c07\u9801\u9762\u9032\u884c\u591a\u5de5\u7de9\u885d\u8655\u7406\u4ee5\u9001\u5165\u5370\u8868\u6a5f ## Document Permissions Dialog viewer.dialog.documentPermissions.title = \u6587\u4ef6\u6b0a\u9650 viewer.dialog.documentPermissions.securityMethod.label = \u5b89\u5168\u65b9\u6cd5\uff1a viewer.dialog.documentPermissions.userPassword.label = \u4f7f\u7528\u8005\u5bc6\u78bc\uff1a viewer.dialog.documentPermissions.ownerPassword.label = \u6240\u6709\u4eba\u5bc6\u78bc\uff1a viewer.dialog.documentPermissions.printing.label = \u6b63\u5728\u5217\u5370\uff1a viewer.dialog.documentPermissions.changing.label = \u6b63\u5728\u66f4\u6539\u6587\u4ef6\uff1a viewer.dialog.documentPermissions.copyExtraction.label = \u8907\u88fd\u6216\u64f7\u53d6\u5167\u5bb9\uff1a viewer.dialog.documentPermissions.comments.label = \u6b63\u5728\u7de8\u5beb\u8a3b\u89e3\u548c\u8868\u55ae\u6b04\u4f4d\uff1a viewer.dialog.documentPermissions.formFillingIn.label = \u586b\u5beb\u8868\u55ae\u6b04\u4f4d\u6216\u7c3d\u540d\uff1a viewer.dialog.documentPermissions.accessibility.label = \u555f\u7528\u5167\u5bb9\u5b58\u53d6\u529f\u80fd\uff1a viewer.dialog.documentPermissions.assembly.label = \u6587\u4ef6\u7d44\u5408\uff1a viewer.dialog.documentPermissions.encryptionLevel.label = \u52a0\u5bc6\u7b49\u7d1a\uff1a viewer.dialog.documentPermissions.securityLevel = {0} \u4f4d\u5143 v{1} R {2} viewer.dialog.documentPermissions.none = \u7121 viewer.dialog.documentPermissions.no = \u5426 viewer.dialog.documentPermissions.yes = \u662f viewer.dialog.documentPermissions.allowed = \u5141\u8a31 viewer.dialog.documentPermissions.notAllowed = \u4e0d\u5141\u8a31 viewer.dialog.documentPermissions.fullyAllowed = \u5b8c\u5168\u5141\u8a31 viewer.dialog.documentPermissions.standardSecurity = Adobe Acrobat \u6a19\u6e96\u5b89\u5168\u6027 viewer.dialog.documentPermissions.partial = \u90e8\u4efd (\u4f4e\u54c1\u8cea) ## Document Information Dialog viewer.dialog.documentInformation.title = \u6587\u4ef6\u8cc7\u8a0a viewer.dialog.documentInformation.title.label = \u6a19\u984c\uff1a viewer.dialog.documentInformation.subject.label = \u4e3b\u65e8\uff1a viewer.dialog.documentInformation.author.label = \u4f5c\u8005\uff1a viewer.dialog.documentInformation.keywords.label = \u95dc\u9375\u5b57\uff1a viewer.dialog.documentInformation.creator.label = \u5efa\u7acb\u8005\uff1a viewer.dialog.documentInformation.producer.label = \u88fd\u4f5c\u8005\uff1a viewer.dialog.documentInformation.created.label = \u5efa\u7acb\u65e5\u671f\uff1a viewer.dialog.documentInformation.modified.label = \u4fee\u6539\u65e5\u671f\uff1a viewer.dialog.documentInformation.notAvailable = \u7121 ## Go to Page Dialog viewer.dialog.goToPage.title = \u524d\u5f80\u6307\u5b9a\u9801\u3002.. viewer.dialog.goToPage.description.label = \u9801\u78bc ## About Dialog viewer.dialog.about.title = \u95dc\u65bc ICEpdf \u700f\u89bd\u7a0b\u5f0f viewer.dialog.about.pageNumber.label = \n\ \n\ \u8acb\u81f3 ICEpdf \u7db2\u7ad9\u4e86\u89e3\u6700\u65b0\u6d88\u606f\uff1a\n\ http://www.icepdf.org/ \n\ \n\ ## Utility Pane Bookmarks Tab viewer.utilityPane.bookmarks.tab.title = \u66f8\u7c64 ## Utility Pane Annotation Link Tab viewer.utilityPane.link.tab.title = \u8a3b\u89e3 viewer.utilityPane.link.appearanceTitle = \u5916\u89c0 viewer.utilityPane.link.linkType = \u9023\u7d50\u985e\u578b\uff1a viewer.utilityPane.annotation.link.highlightType = \u9192\u76ee\u63d0\u793a\u6a23\u5f0f\uff1a viewer.utilityPane.link.lineThickness = \u7dda\u689d\u7c97\u7d30\uff1a viewer.utilityPane.link.lineStyle = \u7dda\u689d\u6a23\u5f0f\uff1a viewer.utilityPane.link.colorChooserTitle = \u8a3b\u89e3\u984f\u8272 viewer.utilityPane.link.colorLabel = \u984f\u8272\uff1a ## annotation action pane and dialogs. viewer.utilityPane.action.selectionTitle = \u52d5\u4f5c viewer.utilityPane.action.addAction = \u65b0\u589e viewer.utilityPane.action.editAction = \u7de8\u8f2f viewer.utilityPane.action.removeAction = \u79fb\u9664 viewer.utilityPane.action.type.destination.label = \u76ee\u7684\u5730 viewer.utilityPane.action.type.uriAction.label = URI \u52d5\u4f5c viewer.utilityPane.action.type.goToAction.label = GoTo \u52d5\u4f5c viewer.utilityPane.action.dialog.new.title = \u65b0\u589e\u52d5\u4f5c viewer.utilityPane.action.dialog.new.msgs = \u52d5\u4f5c\u985e\u578b\uff1a viewer.utilityPane.action.dialog.delete.title = \u78ba\u5b9a\u522a\u9664 viewer.utilityPane.action.dialog.delete.msgs = \u60a8\u78ba\u5b9a\u8981\u522a\u9664\u9019\u500b\u52d5\u4f5c\u55ce\uff1f ## uri action dialog test viewer.utilityPane.action.dialog.uri.title = URI \u52d5\u4f5c\u7279\u6027 viewer.utilityPane.action.dialog.uri.msgs = URI\uff1a ## GoTo action dialog text viewer.utilityPane.action.dialog.goto.title = GoTo \u52d5\u4f5c\u7279\u6027 viewer.utilityPane.action.dialog.goto.page.label = \u9801\u78bc\uff1a viewer.utilityPane.action.dialog.goto.type.label = \u985e\u578b viewer.utilityPane.action.dialog.goto.type.xyz.label = \u7d55\u5c0d viewer.utilityPane.action.dialog.goto.type.fit.label = \u7b26\u5408\u9801\u9762\u5927\u5c0f viewer.utilityPane.action.dialog.goto.type.fith.label = \u7b26\u5408\u4e0a\u65b9\u5bec\u5ea6 viewer.utilityPane.action.dialog.goto.type.fitv.label = \u7b26\u5408\u5de6\u908a\u5bec\u5ea6 viewer.utilityPane.action.dialog.goto.type.fitr.label = \u7b26\u5408\u7e2e\u653e\u5340\u57df viewer.utilityPane.action.dialog.goto.type.fitb.label = \u7b26\u5408\u9801\u9762\u908a\u754c viewer.utilityPane.action.dialog.goto.type.fitbh.label = \u7b26\u5408\u4e0a\u908a\u754c viewer.utilityPane.action.dialog.goto.type.fitbv.label = \u7b26\u5408\u5de6\u908a\u754c viewer.utilityPane.action.dialog.goto.right.label = \u53f3\uff1a viewer.utilityPane.action.dialog.goto.left.label = \u5de6\uff1a viewer.utilityPane.action.dialog.goto.top.label = \u4e0a\uff1a viewer.utilityPane.action.dialog.goto.bottom.label = \u4e0b\uff1a viewer.utilityPane.action.dialog.goto.zoom.label = \u7e2e\u653e\uff1a viewer.utilityPane.action.dialog.goto.unassigned.label = \u4e0d\u662f\u6578\u503c viewer.utilityPane.action.dialog.goto.current.label = \u76ee\u524d\u756b\u9762\uff1a viewer.utilityPane.action.dialog.goto.current = \u8a2d\u5b9a\u4f4d\u7f6e viewer.utilityPane.action.dialog.goto.name.label = \u540d\u7a31\uff1a viewer.utilityPane.action.dialog.goto.browse = \u700f\u89bd\u3002.. viewer.utilityPane.action.dialog.goto.explicitDestination.title = \u5df2\u542b\u76ee\u7684\u5730 viewer.utilityPane.action.dialog.goto.nameDestination.title = \u5177\u540d\u76ee\u7684\u5730 # Destination Named Tree viewer.utilityPane.action.dialog.goto.nameTree.title = \u6587\u4ef6\u540d\u7a31\u6a39\u72c0\u986f\u793a viewer.utilityPane.action.dialog.goto.nameTree.root.label = \u6a94\u540d\u6a39\u72c0\u986f\u793a viewer.utilityPane.action.dialog.goto.nameTree.branch.label = {0} \u81f3 {1} ## Utility Pane Search Tab viewer.utilityPane.search.tab.title = \u641c\u5c0b viewer.utilityPane.search.searchText.label = \u641c\u5c0b\u6587\u5b57\uff1a viewer.utilityPane.search.results.label = \u7d50\u679c\uff1a viewer.utilityPane.search.searchButton.label = \u641c\u5c0b viewer.utilityPane.search.clearSearchButton.label = \u6e05\u9664 viewer.utilityPane.search.caseSenstiveCheckbox.label = \u5340\u5206\u5927\u5c0f\u5beb viewer.utilityPane.search.wholeWordCheckbox.label = \u50c5\u5b8c\u6574\u55ae\u5b57 viewer.utilityPane.search.cumlitiveCheckbox.label = \u7d2f\u7a4d viewer.utilityPane.search.showPagesCheckbox.label = \u986f\u793a\u9801\u9762 viewer.utilityPane.search.stopButton.label = \u505c\u6b62 viewer.utilityPane.search.searching.msg = \u641c\u5c0b\u3002.. # Searching x out of y page(s) viewer.utilityPane.search.searching1.msg = \ \u6b63\u5728\u641c\u5c0b {0}/{1} viewer.utilityPane.search.searching1.oneFile.msg = {2} \u9801 viewer.utilityPane.search.searching1.moreFile.msg = {2} \u9801 # Page x (y result(s)) viewer.utilityPane.search.result.msg = \u7b2c {0} ({1}) \u9801 viewer.utilityPane.search.result.oneFile.msg = {2} \u500b\u7d50\u679c viewer.utilityPane.search.result.moreFile.msg = {2} \u500b\u7d50\u679c # Searched x page(s) (y matches) viewer.utilityPane.search.progress.msg = \ \u5df2\u7d93\u641c\u5c0b {0} {1} ({2}) viewer.utilityPane.search.progress.onePage.msg = \u9801 viewer.utilityPane.search.progress.morePage.msg = \u9801 viewer.utilityPane.search.progress.oneMatch.msg = {2} \u7b46\u7b26\u5408\u9805\u76ee viewer.utilityPane.search.progress.moreMatch.msg = {2} \u7b46\u7b26\u5408\u9805\u76ee ## Common Button Labels viewer.button.ok.label = \u78ba\u5b9a viewer.button.ok.mnemonic = O viewer.button.cancel.label = \u53d6\u6d88 viewer.button.cancel.mnemonic = C ## Pilot Specific Mesages pilot.title = ICEbrowser\uff1aICEpdf Pilot \u932f\u8aa4 pilot.loading.msg =\u6b63\u5728\u958b\u555f\u6587\u4ef6 {0}\u3002.. pilot.display.msg = \u6b63\u5728\u986f\u793a {0} pilot.loading.error.msg = PDF Pilot\uff1a \u7121\u6cd5\u8f09\u5165 {0}\u3002 pilot.error.classLoading = \u627e\u4e0d\u5230\u5fc5\u8981\u7684 {0} \u985e\u5225\u3002 \u5fc5\u8981\u7a0b\u5f0f\u5eab \\u300cicepdf. \ icepdf.jar\u300d\u53ef\u80fd\u4e0d\u5728\u985e\u5225\u8def\u5f91\u4e0a\uff1a\u5df2\u505c\u7528 PDF Pilot\u3002"; ### # General Error Messages # Command Line Errors viewer.commandLin.error = \ \u7528\u6cd5\uff1a java org.icepdf.ri.viewer\u3002Main [-loadfile <value>] [-loadurl <value>] # Launcher errors viewer.launcher.URLError.dialog.title =ICEsoft ICEpdf viewer.launcher.URLError.dialog.message = ICEpdf \u7121\u6cd5\u958b\u555f\u6307\u5b9a\u7684\u6a94\u6848\u3002 {0} \u7db2\u5740\u662f\uff1a {1}. viewer.launcher.lookAndFeel.error.message = \u6b64\u5e73\u53f0\u4e0d\u63d0\u4f9b\u6307\u5b9a\u7684\u5916\u89c0 ({0})\u3002 # Pilot Loading Errors ### parser error dialogs parse.title = \u7279\u6027\u5256\u6790\u932f\u8aa4 parse.integer = \u8b66\u544a\uff1a {0} \u4e0d\u662f\u6b63\u78ba\u6574\u6578\u3002 parse.float = \u8b66\u544a\uff1a {0} \u4e0d\u662f\u6b63\u78ba\u7684\u55ae\u7cbe\u5ea6\u6d6e\u9ede\u6578\u3002 parse.double = \u8b66\u544a\uff1a {0} \u4e0d\u662f\u6b63\u78ba\u96d9\u500d\u7cbe\u5ea6\u6578\u503c\u3002 parse.choice = \u8b66\u544a\uff1a {0} \u4e0d\u662f\u6709\u6548\u9078\u9805\u3002 parse.laf = \u8b66\u544a\uff1a \u4e0d\u652f\u63f4 {0} \u5916\u89c0\u3002 ### Properties Manager Errors manager.properties.title = ICEpdf \u7279\u6027\u7ba1\u7406\u54e1 fontManager.properties.title = ICEpdf \u5b57\u578b\u7ba1\u7406\u54e1 manager.properties.createNewDirectory = \ \u5982\u679c\u8981\u5efa\u7acb {0} \u76ee\u9304\uff0c\n\ \u8b93 ICEpdf \u700f\u89bd\u7a0b\u5f0f\u5c07\u66f4\u6539\u5167\u5bb9\u5132\u5b58\u5230\u8a2d\u5b9a\u4e2d\uff0c\u8acb\u6309\u4e00\u4e0b [\u662f]\u3002\n\n\ \u5982\u679c\u6309\u4e00\u4e0b [\u5426]\uff0c\u5247\u60a8\u66f4\u6539\u7684 ICEpdf \u700f\u89bd\u7a0b\u5f0f\u8a2d\u5b9a\u5167\u5bb9\uff0c\n\ \u90fd\u6703\u5728\u7d50\u675f\u61c9\u7528\u7a0b\u5f0f\u5f8c\u5168\u90e8\u6d88\u5931\u3002 \n\n manager.properties.failedCreation = \ \u7121\u6cd5\u5efa\u7acb ICEpdf \u700f\u89bd\u7a0b\u5f0f\u7684\u4f7f\u7528\u8005\u8cc7\u6599\u5132\u5b58\u76ee\u9304\uff1a\n\ {0}\n\ ICEpdf \u700f\u89bd\u7a0b\u5f0f\u7121\u6cd5\u5c07\u66f4\u6539\u5167\u5bb9\u5132\u5b58\u5230\u9810\u8a2d\u8a2d\u5b9a\u4e2d\u3002 manager.properties.session.nolock = \ \u5efa\u7acb\u9396\u5b9a\u6a94\u6848\u6642\u51fa\u73fe\u932f\u8aa4\uff1a\n\ {0}\n manager.properties.session.readError = \ \u8f09\u5165\u7279\u6027\u6a94\u6848\u6642\u51fa\u73fe\u932f\u8aa4\uff1a \n\ {0} manager.properties.deleted = \u7279\u6027\u6a94\u6848\u5df2\u7d93\u906d\u5230\u522a\u9664\n\ ({0})\n\ \u662f\u5426\u91cd\u65b0\u5efa\u7acb\uff1f manager.properties.modified = \u7279\u6027\u6a94\u6848\u5df2\u7d93\u5728\u4e0a\u6b21\u66f4\u65b0\u5f8c\u6709\u6240\u4fee\u6539\n\ ({0,date,long})\n\ \u60a8\u8981\u5c07\u6a94\u6848\u7684\u66f4\u6539\u5167\u5bb9\u5408\u4f75\u5230\u76ee\u524d\u7279\u6027\u55ce\uff1f manager.properties.saveError = \u7121\u6cd5\u5132\u5b58\u7279\u6027\u6a94\u6848\u3002\n\ \u51fa\u73fe\u4ee5\u4e0b\u932f\u8aa4\uff1a\n\ {0} manager.properties.lafError =\ \u4e0d\u652f\u63f4\u9810\u8a2d\u7279\u6027\u63d0\u4f9b\u7684 {0} \u5916\u89c0\u3002\n\ \u4f7f\u7528\u7cfb\u7d71\u9810\u8a2d\u503c\u3002 manager.properties.brokenProperty = \u9810\u8a2d\u7279\u6027 {0} \u503c\u4e0d\u5168\uff1a {1} manager.properties.missingProperty = \u7f3a\u5c11\u9810\u8a2d\u7279\u6027 {0} \u503c\uff1a {1}
{ "pile_set_name": "Github" }
From c1e0259445f32516785a6cb6e82e7cb401b6df37 Mon Sep 17 00:00:00 2001 From: Jonathan Riddell <[email protected]> Date: Fri, 19 Jun 2020 16:44:47 +0100 Subject: [PATCH] use local cmake modules first, fixes build failure --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 602129b..4550621 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(krename) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) # search packages used by KDE find_package(ECM 0.0.11 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(ECMInstallIcons) @@ -28,8 +28,8 @@ find_package(KF5 REQUIRED COMPONENTS XmlGui ) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake/modules) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules + ${CMAKE_MODULE_PATH}) add_definitions( -DQT_DEPRECATED_WARNINGS -- GitLab
{ "pile_set_name": "Github" }
# Gradle 构建语言 Gradle 是以 Groovy 语言为基础, 基于DSL (领域特定语言) 语法的自动化构建工具,但是它增加了一些额外的特性,这使得Gradle更加的容易去阐释构建. 一个构建脚本能够包含任何Groovy语言的元素 ( Any language element except for statement labels ), 每个构建脚本都使用UTF-8编码.
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-110543543-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <title>quspin.tools.lanczos._FTLM &#8212; QuSpin 0.3.4 documentation</title> <link rel="stylesheet" href="../../../../static/classic.css" type="text/css" /> <link rel="stylesheet" href="../../../../static/pygments.css" type="text/css" /> <script id="documentation_options" data-url_root="../../../../" src="../../../../static/documentation_options.js"></script> <script src="../../../../static/jquery.js"></script> <script src="../../../../static/underscore.js"></script> <script src="../../../../static/doctools.js"></script> <script src="../../../../static/language_data.js"></script> <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="index" title="Index" href="../../../../genindex.html" /> <link rel="search" title="Search" href="../../../../search.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="nav-item nav-item-0"><a href="../../../../index.html">QuSpin 0.3.4 documentation</a> &#187;</li> <li class="nav-item nav-item-1"><a href="../../../index.html" accesskey="U">Module code</a> &#187;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <h1>Source code for quspin.tools.lanczos._FTLM</h1><div class="highlight"><pre> <span></span><span class="kn">from</span> <span class="nn">scipy.linalg</span> <span class="kn">import</span> <span class="n">eigh_tridiagonal</span> <span class="kn">from</span> <span class="nn">six</span> <span class="kn">import</span> <span class="n">iteritems</span> <span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">_np</span> <span class="kn">from</span> <span class="nn">._lanczos_utils</span> <span class="kn">import</span> <span class="n">_get_first_lv</span> <span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;FTLM_static_iteration&quot;</span><span class="p">]</span> <div class="viewcode-block" id="FTLM_static_iteration"><a class="viewcode-back" href="../../../../generated/quspin.tools.lanczos.FTLM_static_iteration.html#quspin.tools.lanczos.FTLM_static_iteration">[docs]</a><span class="k">def</span> <span class="nf">FTLM_static_iteration</span><span class="p">(</span><span class="n">O_dict</span><span class="p">,</span><span class="n">E</span><span class="p">,</span><span class="n">V</span><span class="p">,</span><span class="n">Q_T</span><span class="p">,</span><span class="n">beta</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Calculate iteration for Finite-Temperature Lanczos method.</span> <span class="sd"> Here we give a brief overview of this method based on `arXiv:1111.5931 &lt;https://arxiv.org/abs/1111.5931&gt;`_. </span> <span class="sd"> One would naively think that it would require full diagonalization to calculate thermodynamic expectation values </span> <span class="sd"> for a quantum system as one has to fully diagonalize the Hamiltonian to evaluate:</span> <span class="sd"> .. math::</span> <span class="sd"> \\langle O\\rangle_\\beta = \\frac{1}{Z}Tr\\left(e^{-\\beta H}O\\right)</span> <span class="sd"> </span> <span class="sd"> with the partition function defined as: :math:`Z=Tr\\left(e^{-\\beta H}\\right)`. The idea behind the </span> <span class="sd"> Finite-Temperature Lanczos Method (FTLM) is to use quantum typicality as well as Krylov subspaces to </span> <span class="sd"> simplify this calculation. Typicality states that the trace of an operator can be approximated as an average </span> <span class="sd"> of that same operator with random vectors in the Hilbert-space sampled with the Harr measure. As a corollary, it </span> <span class="sd"> is known that the fluctuations of this average for any finite sample set will converge to 0 as the size of </span> <span class="sd"> the Hilbert space increases. Mathematically this is expressed as:</span> <span class="sd"> .. math::</span> <span class="sd"> \\frac{1}{\\dim\\mathcal{H}}Tr\\left(e^{-\\beta H}O\\right)\\approx \\frac{1}{N_r}\\sum_r\\langle r| e^{-\\beta H}O |r\\rangle</span> <span class="sd"> where :math:`|r\\rangle` is a random state from the Harr measure of hilbert space :math:`\\mathcal{H}` if the </span> <span class="sd"> Hamiltonian. An issue can occur when the temperature goes to zero as the overlap :math:`\\langle r| e^{-\\beta H}O |r\\rangle` will </span> <span class="sd"> be quite small for most states :math:`|r\\rangle`. Hence, this will require more random realizations to converge. Therefore, </span> <span class="sd"> this method is really only useful at high temperatures. Next, the idea is to use Lanczos to approximate the matrix exponential. </span> <span class="sd"> The eigenstates from the lanczos basis can effectively be inserted as an identity operator:</span> <span class="sd"> .. math::</span> <span class="sd"> \\frac{1}{\\dim\\mathcal{H}}Tr\\left(e^{-\\beta H}O\\right)\\approx \\frac{1}{N_r}\\sum_r\\langle r|e^{-\\beta H}O|r\\rangle\\approx \\frac{1}{N_r}\\sum_r\\sum_{i=1}^m e^{-\\beta\\epsilon^{(r)}_i}\\langle r|\\psi^{(r)}_i\\rangle\\langle\\psi^{(r)}_i|O|r\\rangle = \\frac{1}{N_r}\\sum_r \\langle O\\rangle_r \\equiv \\overline{\\langle O\\rangle_r}</span> <span class="sd"> Now going back to the thermal expecation value, we can use the expression above to calculate :math:`\\frac{1}{Z}Tr\\left(e^{-\\beta H}O\\right)` </span> <span class="sd"> by noting that the partition function is simply the expecation value of the identity operator: :math:`Z=Tr\\left(e^{-\\beta H}I\\right)` and hence </span> <span class="sd"> the thermal expecation value is approximated by:</span> <span class="sd"> .. math::</span> <span class="sd"> \\langle O\\rangle_\\beta \\approx \\frac{\\overline{\\langle O\\rangle_r}}{\\overline{\\langle I\\rangle_r}}</span> <span class="sd"> The idea behind this function is to generate the the expecation value :math:`\\langle O\\rangle_r` and :math:`\\langle I\\rangle_r`</span> <span class="sd"> for a lanczos basis generated from an initial state :math:`|r\\rangle`. Therefore if the user would like to calculate the thermal expecation value all one </span> <span class="sd"> has to do call this function for each lanczos basis generated from a random state :math:`|r\\rangle`. </span> <span class="sd"> Notes</span> <span class="sd"> -----</span> <span class="sd"> * The amount of memory used by this function scales like: :math:`nN_{op}` with :math:`n` being the size of the full Hilbert space and :math:`N_{op}` is the number of input operators. </span> <span class="sd"> * FTLM does not converge very well at low temperatures, see function for low-temperature lanczos iterations. </span> <span class="sd"> * One has to be careful as typicality only applies to the trace operation over the entire Hilbert space. Using symmetries is possible, however it requires the user to keep track of the weights in the different sectors.</span> <span class="sd"> Parameters</span> <span class="sd"> -----------</span> <span class="sd"> O_dict : dictionary of Python Objects</span> <span class="sd"> These Objects must have a &#39;dot&#39; method that calculates a matrix vector product on a numpy.ndarray[:], the effective shape of these objects should be (n,n). </span> <span class="sd"> E : array_like, (m,)</span> <span class="sd"> Eigenvalues for the Krylov projection of some operator.</span> <span class="sd"> V : array_like, (m,m)</span> <span class="sd"> Eigenvectors for the Krylov projection of some operator.</span> <span class="sd"> Q_T : iterator over rows of Q_T</span> <span class="sd"> generator or ndarray that contains the lanczos basis associated with E, and V. </span> <span class="sd"> beta : scalar/array_like, any shape</span> <span class="sd"> Inverse temperature values to evaluate.</span> <span class="sd"> Returns</span> <span class="sd"> --------</span> <span class="sd"> Result_dict: dictionary</span> <span class="sd"> A dictionary storying the results for a single iteration of the FTLM. The results are stored in numpy.ndarrays </span> <span class="sd"> that have the same shape as `beta`. The keys of `Result_dict` are the same as the keys in `O_dict` and the values </span> <span class="sd"> associated with the given key in `Result_dict` are the expectation values for the operator in `O_dict` with the same key.</span> <span class="sd"> I_expt: numpy.ndarray, same shape as `beta`</span> <span class="sd"> The expecation value of the identity operator for each beta. </span> <span class="sd"> Examples</span> <span class="sd"> --------</span> <span class="sd"> &gt;&gt;&gt; beta = numpy.linspace(0,10,101)</span> <span class="sd"> &gt;&gt;&gt; E, V, Q_T = lanczos_full(H,v0,20)</span> <span class="sd"> &gt;&gt;&gt; Res,Id = FTLM_static_iteration(Obs_dict,E,V,Q_T,beta=beta)</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="n">nv</span> <span class="o">=</span> <span class="n">E</span><span class="o">.</span><span class="n">size</span> <span class="n">p</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">exp</span><span class="p">(</span><span class="o">-</span><span class="n">_np</span><span class="o">.</span><span class="n">outer</span><span class="p">(</span><span class="n">_np</span><span class="o">.</span><span class="n">atleast_1d</span><span class="p">(</span><span class="n">beta</span><span class="p">),</span><span class="n">E</span><span class="p">))</span> <span class="n">c</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">&quot;j,aj,...j-&gt;a...&quot;</span><span class="p">,</span><span class="n">V</span><span class="p">[</span><span class="mi">0</span><span class="p">,:],</span><span class="n">V</span><span class="p">,</span><span class="n">p</span><span class="p">)</span> <span class="n">r</span><span class="p">,</span><span class="n">Q_T</span> <span class="o">=</span> <span class="n">_get_first_lv</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">Q_T</span><span class="p">))</span> <span class="n">results_dict</span> <span class="o">=</span> <span class="p">{}</span> <span class="n">Ar_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">key</span><span class="p">:</span><span class="n">A</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span><span class="p">,</span><span class="n">A</span> <span class="ow">in</span> <span class="n">iteritems</span><span class="p">(</span><span class="n">O_dict</span><span class="p">)}</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">lv</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">Q_T</span><span class="p">):</span> <span class="c1"># nv matvecs</span> <span class="k">for</span> <span class="n">key</span><span class="p">,</span><span class="n">A</span> <span class="ow">in</span> <span class="n">iteritems</span><span class="p">(</span><span class="n">O_dict</span><span class="p">):</span> <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">results_dict</span><span class="p">:</span> <span class="n">results_dict</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">+=</span> <span class="n">_np</span><span class="o">.</span><span class="n">squeeze</span><span class="p">(</span><span class="n">c</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="o">...</span><span class="p">]</span> <span class="o">*</span> <span class="n">_np</span><span class="o">.</span><span class="n">vdot</span><span class="p">(</span><span class="n">lv</span><span class="p">,</span><span class="n">Ar_dict</span><span class="p">[</span><span class="n">key</span><span class="p">]))</span> <span class="k">else</span><span class="p">:</span> <span class="n">results_dict</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">squeeze</span><span class="p">(</span><span class="n">c</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="o">...</span><span class="p">]</span> <span class="o">*</span> <span class="n">_np</span><span class="o">.</span><span class="n">vdot</span><span class="p">(</span><span class="n">lv</span><span class="p">,</span><span class="n">Ar_dict</span><span class="p">[</span><span class="n">key</span><span class="p">]))</span> <span class="k">return</span> <span class="n">results_dict</span><span class="p">,</span><span class="n">_np</span><span class="o">.</span><span class="n">squeeze</span><span class="p">(</span><span class="n">c</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="o">...</span><span class="p">])</span></div> <span class="k">def</span> <span class="nf">_FTLM_dynamic_iteration</span><span class="p">(</span><span class="n">A_dagger</span><span class="p">,</span><span class="n">E_l</span><span class="p">,</span><span class="n">V_l</span><span class="p">,</span><span class="n">Q_iter_l</span><span class="p">,</span><span class="n">E_r</span><span class="p">,</span><span class="n">V_r</span><span class="p">,</span><span class="n">Q_iter_r</span><span class="p">,</span><span class="n">beta</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span> <span class="n">nv</span> <span class="o">=</span> <span class="n">E_r</span><span class="o">.</span><span class="n">size</span> <span class="n">p</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">exp</span><span class="p">(</span><span class="o">-</span><span class="n">_np</span><span class="o">.</span><span class="n">outer</span><span class="p">(</span><span class="n">E_l</span><span class="p">,</span><span class="n">_np</span><span class="o">.</span><span class="n">atleast_1d</span><span class="p">(</span><span class="n">beta</span><span class="p">)))</span> <span class="n">c</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">&quot;i,j,i...-&gt;ij...&quot;</span><span class="p">,</span><span class="n">V_l</span><span class="p">[</span><span class="mi">0</span><span class="p">,:],</span><span class="n">V_r</span><span class="p">[</span><span class="mi">0</span><span class="p">,:],</span><span class="n">p</span><span class="p">)</span> <span class="n">A_me</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">lv_r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">Q_iter_l</span><span class="p">):</span> <span class="n">lv_col</span> <span class="o">=</span> <span class="nb">iter</span><span class="p">(</span><span class="n">Q_iter_r</span><span class="p">)</span> <span class="k">for</span> <span class="n">j</span><span class="p">,</span><span class="n">lv_c</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">lv_col</span><span class="p">):</span> <span class="n">me</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">vdot</span><span class="p">(</span><span class="n">lv_r</span><span class="p">,</span><span class="n">A_dagger</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">lv_c</span><span class="p">))</span> <span class="k">if</span> <span class="n">A_me</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">A_me</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="n">nv</span><span class="p">,</span><span class="n">nv</span><span class="p">),</span><span class="n">dtype</span><span class="o">=</span><span class="n">me</span><span class="o">.</span><span class="n">dtype</span><span class="p">)</span> <span class="n">A_me</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">me</span> <span class="n">A_me_diag</span> <span class="o">=</span> <span class="n">V_l</span><span class="o">.</span><span class="n">T</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">A_me</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">V_r</span><span class="p">))</span> <span class="n">result</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">&quot;ij,ij...-&gt;ij...&quot;</span><span class="p">,</span><span class="n">A_me_diag</span><span class="p">,</span><span class="n">c</span><span class="p">)</span> <span class="n">omegas</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">subtract</span><span class="o">.</span><span class="n">outer</span><span class="p">(</span><span class="n">E_l</span><span class="p">,</span><span class="n">E_r</span><span class="p">)</span> <span class="n">Id</span> <span class="o">=</span> <span class="n">_np</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">&quot;j,j...-&gt;...&quot;</span><span class="p">,</span><span class="n">V</span><span class="p">[</span><span class="mi">0</span><span class="p">,:]</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span><span class="n">p</span><span class="p">)</span> <span class="k">return</span> <span class="n">result</span><span class="p">,</span><span class="n">omegas</span><span class="p">,</span><span class="n">Id</span> </pre></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../../../../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" /> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../../../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="nav-item nav-item-0"><a href="../../../../index.html">QuSpin 0.3.4 documentation</a> &#187;</li> <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li> </ul> </div> <div class="footer" role="contentinfo"> &#169; Copyright 2016, Phillip Weinberg and Marin Bukov. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.4.0. </div> </body> </html>
{ "pile_set_name": "Github" }
// +k8s:deepcopy-gen=package,register // +k8s:conversion-gen=github.com/openshift/origin/pkg/route/apis/route // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true // +groupName=route.openshift.io // Package v1 is the v1 version of the API. package v1
{ "pile_set_name": "Github" }
(module SolderWire-1.5sqmm_1x04_P7.8mm_D1.7mm_OD3.9mm_Relief (layer F.Cu) (tedit 5EB70B45) (descr "Soldered wire connection with feed through strain relief, for 4 times 1.5 mm² wires, reinforced insulation, conductor diameter 1.7mm, outer diameter 3.9mm, size source Multi-Contact FLEXI-xV 1.5 (https://ec.staubli.com/AcroFiles/Catalogues/TM_Cab-Main-11014119_(en)_hi.pdf), bend radius 3 times outer diameter, generated with kicad-footprint-generator") (tags "connector wire 1.5sqmm strain-relief") (attr virtual) (fp_text reference REF** (at 11.7 -3.15) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))) ) (fp_text value SolderWire-1.5sqmm_1x04_P7.8mm_D1.7mm_OD3.9mm_Relief (at 11.7 26.8) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))) ) (fp_circle (center 0 0) (end 1.95 0) (layer F.Fab) (width 0.1)) (fp_circle (center 0 23.4) (end 1.95 23.4) (layer F.Fab) (width 0.1)) (fp_circle (center 7.8 0) (end 9.75 0) (layer F.Fab) (width 0.1)) (fp_circle (center 7.8 23.4) (end 9.75 23.4) (layer F.Fab) (width 0.1)) (fp_circle (center 15.6 0) (end 17.55 0) (layer F.Fab) (width 0.1)) (fp_circle (center 15.6 23.4) (end 17.55 23.4) (layer F.Fab) (width 0.1)) (fp_circle (center 23.4 0) (end 25.35 0) (layer F.Fab) (width 0.1)) (fp_circle (center 23.4 23.4) (end 25.35 23.4) (layer F.Fab) (width 0.1)) (fp_line (start -1.95 0) (end -1.95 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 1.95 0) (end 1.95 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 2.06 2.21) (end 2.06 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start -2.06 2.21) (end -2.06 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start -2.7 -2.45) (end -2.7 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start -2.7 26.1) (end 2.7 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 2.7 26.1) (end 2.7 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 2.7 -2.45) (end -2.7 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start -2.7 20.7) (end -2.7 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start -2.7 26.1) (end 2.7 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 2.7 26.1) (end 2.7 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 2.7 20.7) (end -2.7 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 5.85 0) (end 5.85 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 9.75 0) (end 9.75 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 9.86 2.21) (end 9.86 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start 5.74 2.21) (end 5.74 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start 5.1 -2.45) (end 5.1 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 5.1 26.1) (end 10.5 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 10.5 26.1) (end 10.5 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 10.5 -2.45) (end 5.1 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 5.1 20.7) (end 5.1 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 5.1 26.1) (end 10.5 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 10.5 26.1) (end 10.5 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 10.5 20.7) (end 5.1 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 13.65 0) (end 13.65 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 17.55 0) (end 17.55 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 17.66 2.21) (end 17.66 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start 13.54 2.21) (end 13.54 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start 12.9 -2.45) (end 12.9 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 12.9 26.1) (end 18.3 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 18.3 26.1) (end 18.3 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 18.3 -2.45) (end 12.9 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 12.9 20.7) (end 12.9 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 12.9 26.1) (end 18.3 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 18.3 26.1) (end 18.3 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 18.3 20.7) (end 12.9 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 21.45 0) (end 21.45 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 25.35 0) (end 25.35 23.4) (layer F.Fab) (width 0.1)) (fp_line (start 25.46 2.21) (end 25.46 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start 21.34 2.21) (end 21.34 21.34) (layer F.SilkS) (width 0.12)) (fp_line (start 20.7 -2.45) (end 20.7 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 20.7 26.1) (end 26.1 26.1) (layer F.CrtYd) (width 0.05)) (fp_line (start 26.1 26.1) (end 26.1 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 26.1 -2.45) (end 20.7 -2.45) (layer F.CrtYd) (width 0.05)) (fp_line (start 20.7 20.7) (end 20.7 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 20.7 26.1) (end 26.1 26.1) (layer B.CrtYd) (width 0.05)) (fp_line (start 26.1 26.1) (end 26.1 20.7) (layer B.CrtYd) (width 0.05)) (fp_line (start 26.1 20.7) (end 20.7 20.7) (layer B.CrtYd) (width 0.05)) (pad 1 thru_hole roundrect (at 0 0) (size 3.9 3.9) (drill 2.1) (layers *.Cu *.Mask) (roundrect_rratio 0.064103)) (pad 2 thru_hole circle (at 7.8 0) (size 3.9 3.9) (drill 2.1) (layers *.Cu *.Mask)) (pad 3 thru_hole circle (at 15.6 0) (size 3.9 3.9) (drill 2.1) (layers *.Cu *.Mask)) (pad 4 thru_hole circle (at 23.4 0) (size 3.9 3.9) (drill 2.1) (layers *.Cu *.Mask)) (pad "" np_thru_hole circle (at 0 23.4) (size 4.4 4.4) (drill 4.4) (layers *.Cu *.Mask)) (pad "" np_thru_hole circle (at 7.8 23.4) (size 4.4 4.4) (drill 4.4) (layers *.Cu *.Mask)) (pad "" np_thru_hole circle (at 15.6 23.4) (size 4.4 4.4) (drill 4.4) (layers *.Cu *.Mask)) (pad "" np_thru_hole circle (at 23.4 23.4) (size 4.4 4.4) (drill 4.4) (layers *.Cu *.Mask)) (fp_text user %R (at 11.7 11.7 90) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))) ) (model ${KISYS3DMOD}/Connector_Wire.3dshapes/SolderWire-1.5sqmm_1x04_P7.8mm_D1.7mm_OD3.9mm_Relief.wrl (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) ) )
{ "pile_set_name": "Github" }
using System; namespace ScaffoldSample { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }
{ "pile_set_name": "Github" }
// Copyright 2015 go-dockerclient 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 docker import ( "encoding/json" "errors" "net/http" "golang.org/x/net/context" ) var ( // ErrNoSuchVolume is the error returned when the volume does not exist. ErrNoSuchVolume = errors.New("no such volume") // ErrVolumeInUse is the error returned when the volume requested to be removed is still in use. ErrVolumeInUse = errors.New("volume in use and cannot be removed") ) // Volume represents a volume. // // See https://goo.gl/FZA4BK for more details. type Volume struct { Name string `json:"Name" yaml:"Name" toml:"Name"` Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"` Mountpoint string `json:"Mountpoint,omitempty" yaml:"Mountpoint,omitempty" toml:"Mountpoint,omitempty"` Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"` } // ListVolumesOptions specify parameters to the ListVolumes function. // // See https://goo.gl/FZA4BK for more details. type ListVolumesOptions struct { Filters map[string][]string Context context.Context } // ListVolumes returns a list of available volumes in the server. // // See https://goo.gl/FZA4BK for more details. func (c *Client) ListVolumes(opts ListVolumesOptions) ([]Volume, error) { resp, err := c.do("GET", "/volumes?"+queryString(opts), doOptions{ context: opts.Context, }) if err != nil { return nil, err } defer resp.Body.Close() m := make(map[string]interface{}) if err = json.NewDecoder(resp.Body).Decode(&m); err != nil { return nil, err } var volumes []Volume volumesJSON, ok := m["Volumes"] if !ok { return volumes, nil } data, err := json.Marshal(volumesJSON) if err != nil { return nil, err } if err := json.Unmarshal(data, &volumes); err != nil { return nil, err } return volumes, nil } // CreateVolumeOptions specify parameters to the CreateVolume function. // // See https://goo.gl/pBUbZ9 for more details. type CreateVolumeOptions struct { Name string Driver string DriverOpts map[string]string Context context.Context `json:"-"` Labels map[string]string } // CreateVolume creates a volume on the server. // // See https://goo.gl/pBUbZ9 for more details. func (c *Client) CreateVolume(opts CreateVolumeOptions) (*Volume, error) { resp, err := c.do("POST", "/volumes/create", doOptions{ data: opts, context: opts.Context, }) if err != nil { return nil, err } defer resp.Body.Close() var volume Volume if err := json.NewDecoder(resp.Body).Decode(&volume); err != nil { return nil, err } return &volume, nil } // InspectVolume returns a volume by its name. // // See https://goo.gl/0g9A6i for more details. func (c *Client) InspectVolume(name string) (*Volume, error) { resp, err := c.do("GET", "/volumes/"+name, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, ErrNoSuchVolume } return nil, err } defer resp.Body.Close() var volume Volume if err := json.NewDecoder(resp.Body).Decode(&volume); err != nil { return nil, err } return &volume, nil } // RemoveVolume removes a volume by its name. // // See https://goo.gl/79GNQz for more details. func (c *Client) RemoveVolume(name string) error { resp, err := c.do("DELETE", "/volumes/"+name, doOptions{}) if err != nil { if e, ok := err.(*Error); ok { if e.Status == http.StatusNotFound { return ErrNoSuchVolume } if e.Status == http.StatusConflict { return ErrVolumeInUse } } return nil } defer resp.Body.Close() return nil } // PruneVolumesOptions specify parameters to the PruneVolumes function. // // See https://goo.gl/pFN1Hj for more details. type PruneVolumesOptions struct { Filters map[string][]string Context context.Context } // PruneVolumesResults specify results from the PruneVolumes function. // // See https://goo.gl/pFN1Hj for more details. type PruneVolumesResults struct { VolumesDeleted []string SpaceReclaimed int64 } // PruneVolumes deletes volumes which are unused. // // See https://goo.gl/pFN1Hj for more details. func (c *Client) PruneVolumes(opts PruneVolumesOptions) (*PruneVolumesResults, error) { path := "/volumes/prune?" + queryString(opts) resp, err := c.do("POST", path, doOptions{context: opts.Context}) if err != nil { return nil, err } defer resp.Body.Close() var results PruneVolumesResults if err := json.NewDecoder(resp.Body).Decode(&results); err != nil { return nil, err } return &results, nil }
{ "pile_set_name": "Github" }
6800: İdeografi gardenya CJK : zi1 : Zhi 6801: 6802: Ideograph bir yaprak dökmeyen ağaç CJK : mui4 : Mei 6803: Ideograph meşe tipi; kararlı CJK : lai6 : lì 6804: İdeografi şan, şeref; güzelleşmek, başarılı CJK : wing4 : Rong 6805: İdeograf çiti; çit; ızgara CJK : caak3 saan1 saan3 : zha 6806: 6807: İdeografi işareti, sembol, etiket, işaret; CJK ağacının dibine oturmak : biu1 : Biao 6808: İdeograf deposu; lokali, han CJK : zaan6 : Zhan 6809: İdeograf tarağı; Ayıklamak; dışarı çıkar, CJK elimininate : zit1 : Zhi 680A: İdeograf kafesi, kalemi; barlar seti CJK : lung4 : uzun 680B: CJK evi destekleyen ana kirişler : dung3 dung6 : Dong 680C: İdeografi destekleyici blok; sumak, yenidünya CJK : lou4 : lu 680D: İdeografi çok; bir etiket; CJK işareti ile kazınmış bambu kayma : sang1 : Sheng 680E: İdeograf kestane yapraklı meşe; meşe ağacı : lik1 : lì 680F: İdeografi korkuluk, korkuluk; hayvan pan CJK : laan4 : Lan 6810: 6811: İdeograf ağacı; bitki; kurmak, CJK'yi kurmak : syu6 : Shu 6812: Ideograph cross bar CJK : ceon4 seon1 seon2 : Xun 6813: Ideograph wooden peg, post veya çubuk CJK : saan1 : Shuan 6814: Ideograph oymak, CJK oymak : KAI3 : Qi 6815: 6816: İdeograf levrek; tünek; CJK kal : cai1 : Qi 6817: İdeograf kestane ağacı, kestane; soyadı CJK : leot6 : lì 6818: Ideograph meyve ağacı CJK : ji4 : Yi 6819: 681A: 681B: Güney Çin'de yetişen bir meyve olan lichee ideografı CJK : lai6 : lì 681C: 681D: CJK’yı ölçmek için yapıcının çerçevesini ideografla : kut3 : gua 681E: İdeografi yayını, periyodik; CJK'yı yayınla : hon1 hon2 : Kan 681F: İdeograf kenevir hurma CJK : bing1 : BEN 6820: 6821: İdeografi okulu; askeri saha subayı CJK : gaau3 haau6 : Xiao 6822: Ideograph selvi, sedir CJK : baak3 : bǎi 6823: 6824: 6825: 6826: 6827: 6828: 6829: Meşe ideografı türleri; memnun ol, memnun ol CJK : heoi2 : xǔ 682A: Ağaçlar için Ideograph numerary takviyesi; kök CJK : zyu1 : Zhu 682B: İdeograf Çit CJK : zin3 : Jian 682C: 682D: Ideograph king-post CJK : ji4 : ŞéR 682E: 682F: 6830: Bambu Sal CJK'nın İdeografı : FA 6831: İdeograf büyük kazık, kazık; direk, direk CJK : gung2 : gǒng 6832: İdeograf mangrov CJK : haau2 : kǎo 6833: Bir sepet ideografı : lou5 : lǎo 6834: Ideograph sandal ağacı CJK : zin1 : Zhan 6835: Ideograph Çit CJK : lai6 : Yalan 6836: 6837: İdeograf şekli, şekli, deseni, tarzı CJK : joeng6 : Yang 6838: İdeograf çekirdeği, çekirdek, çekirdek, ceviz; atom CJK : hat6 wat6 : hé 6839: İdeografi kökü, taban (d on); vakıf CJK : gan1 : GEN 683A: 683B: İdeograf ağacı CJK : cik1 sik1 : Shi 683C: İdeografi deseni, standart, biçim; stil CJK : gaak3 : gé 683D: Ideograf yetiştirmek, bitki yetiştirmek; CJK bitkilerine bakım yapmak için : zoi1 : Zai 683E: Ağacın ideograf adı; korniş CJK bir parçası : lyun4 : Luan 683F: 6840: İdeograf tavuk yumurtası; antik imparator CJK : git6 : Jie 6841: Ideograph CJT kirişlerinin kirişleri : haang4 hang4 hong4 hong6 : Heng 6842: Ideograph cassia veya tarçınlı CJK : gwai3 : GUI 6843: İdeograf şeftali; evlilik; soyadı CJK : tou4 : Tao 6844: Hindistan cevizi hurması CJK'sı : gwong1 gwong3 : Guang 6845: CJK gemi direkleri : ngai4 wai4 : Wei 6846: İdeografi çerçevesi; çerçevesi; kapı çerçevesi : hong1 kwaang1 : Kuang 6847: 6848: İdeografi masası, tezgah; yasal dava CJK : ngon3 on3 : bir 6849: İdeograf okaliptüs CJK : on1 on3 : bir 684A: 684B: İdeograf ağacı CJK : ji4 : Yi 684C: İdeograf masası, çalışma masası, CJK standı : coek3 zoek3 : Zhuo 684D: 684E: İdeograf alıcıları, zincirleri ve kelepçeleri CJK : zat6 : Zhi 684F: 6850: İdeograf adı çeşitli ağaçlara uygulandı : tung4 : Çin gizli derneği 6851: Ideograph dut ağacı; soyadı CJK : Song1 : şarkı söyledi 6852: 6853: İdeograf ağacın çeşitliliği; soyadı CJK : wun4 : Huan 6854: Ideograph Chinese bellflower; İyi süpürüldü; mısır saplarının iç lifleri CJK : aat1 gat1 : Jú 6855: Ideograph tallow ağacı CJK : kau5 : Jiu 6856: 6857: 6858: 6859: 685A: Ideograf basını, sıkın; CJK zorla : zǎn 685B: Ideografı gerçek, hank, CJK sallamak 685C: Ideograf kiraz, kiraz çiçeği CJK : jıng1 : Ying 685D: Deo U + 67A1 ideograf çeşidi, CJK ölçüm kutusu : git6 : Jie 685E: 685F: Bir çapraz parçanın, kelepçenin, çerçevenin, kapı cıvatasını ideografla; raf CJK : Zhan 6860: CJK ağacının çatal dalını ideografla : ngaa4 : Ya 6861: Ideograph bükülmüş veya bükülmüş odun parçası CJK : naau4 : Rao 6862: İdeografi Sertağaç; destekler : zing1 : Zhen 6863: İdeografi rafı; çerçeve, travers CJK : dong2 dong3 : dang 6864: Ideograf kızılağaç CJK : kei1 : Qi 6865: İdeograf köprüsü; kiriş, travers CJK : kiu4 : Qiao 6866: İdeograf türü huş CJK : waa6 : Hua 6867: Ideograph Chinese selvi, Çinli ardıç CJK : kui2 : GUI 6868: Ideograph kürek, kürek CJK : zoeng2 : jiǎng 6869: Ideograph hissesi, yayın; mesele, madde CJK : zong1 : Zhuang 686A: Ideograph efsanevi dev ağaç CJK : Xun 686B: Ideograph at kestanesi CJK : số 1 : SUO 686C: Ideograph armut ve diğer ağaçlar CJK : Sha 686D: İdeografi saçakları; İki sütun arasındaki boşluk : san4 : Zhen 686E: İdeografi bardağı, bardak : bui1 : bei 686F: İdeografi tablosu CJK : ting1 : çınlama 6870: 6871: 6872: 6873: 6874: İdeografi Sal; davul çubuğu; sırt direği CJK : fu1 : FU 6875: 6876: İdeograf kovası, kova, küvet; fıçı, fıçı CJK : tung2 : tǒng 6877: İdeograf çırpıcı; malus toringo CJK : gok3 : Jue 6878: 6879: Ideograph palm CJK : long4 : Láng 687A: 687B: 687C: Vernik ağacını ideografla; cila, vernik, boya CJK : cat1 : Qi 687D: 687E: 687F: İdeograf direği; Çubuk; kulüp; birim CJK olarak kutup : gon1 gon2 gon3 : gǎn 6880: 6881: İdeograf köprüsü; kiriş; kirişleri; soyadı CJK : loeng4 : Liang 6882: İdeografi acorn kupası : kau4 : Qiu 6883: Bir kulübü ideografi; bir sap; düz CJK : ting5 : tǐng 6884: Yumuşak bir odun ideografisi; CJK yakacak odun : jau5 : yǒu 6885: İdeograf erikleri; erik; soyadı CJK : mui4 : Mei 6886: Ideograph Watchman'ın çıngırağı CJK : bong1 : patlama 6887: 6888: 6889: 688A: İdeografi sıkar; CJK'yi çıkart : di 688B: 688C: 688D: İdeograf ağacı adı CJK : ZAO 688E: İdeograf Orak Kolu, Şube CJK : AO 688F: İdeografi kelepçeleri, kelepçeleri, hakemleri CJK : guk1 : gu 6890: İdeograf Çit CJK : bai6 : Bi 6891: 6892: 6893: Ideograph catalpa ovata CJK : zi2 : zǐ 6894: İdeografi gardenya CJK : zi1 : Zhi 6895: 6896: Palmiye ağacı CJK'sı ideografı : bui3 : bei 6897: Çiçeğin ideografı, CJK bitkisi dalı : gang2 gwaang2 : Geng 6898: İdeograf bambu tüpü, tahta dübel; CJK musluğu : gaan2 : jiǎn 6899: 689A: 689B: 689C: İdeografi çubuk CJK : gaap3 : Jia 689D: İdeografi maddesi, koşul; dize, şerit CJK : tiu4 tiu5 : Tiao 689E: 689F: Bir baykuşun ideografisi; Böylece, kötü bir şey CJK : hiu1 : Xiao 68A0: CJK saçaklardaki kirişleri destekleyen küçük bir kirişin ideografını CJK : leoi5 : lǚ 68A1: Kurban etini taşımak için ideograf tepsisi : FUN2 : Hun 68A2: İdeograf, dal gibi uzun bir şeyin ucunu gösterdi; dümen CJK : saau1 : Shao 68A3: 68A4: 68A5: 68A6: İdeograf Rüyası; vizyon; arzulu CJK : mung6 : Meng 68A7: İdeograf Çin parasoltree, Sterculia platanifolia CJK : NG4 : Wu 68A8: İdeograf armut; opera; kes, CJK'yi kes : lei4 : Li 68A9: Bir toprağı, toprağı taşıyan bir sepeti ideografi : lei4 lei5 : Li 68AA: 68AB: 68AC: 68AD: İdeograf dokumacının mekik; CJK’ya gidip : số 1 : SUO 68AE: Ideograph kar ayakkabıları CJK : guk6 : JU 68AF: İdeografi merdiveni, basamaklar, merdivenler; yalın CJK : tai1 : Ti 68B0: İdeografi silahları; uygular, enstrümanlar CJK : haai6 : Xie 68B1: İdeografi kapıları; kapı aynası CJK : kwan2 : kǔn 68B2: İdeograf joist; baston, kulüp; krallık sonrası CJK : zyut3 : Zhuo 68B3: İdeograf tarağı; CJK fırçası : số 1 : Shu 68B4: İdeograf uzun CJK : CIN1 : Chan 68B5: İdeograf Budist, Sanskritçe CJK : faan4 faan6 : fan 68B6: Ideograph kürek, şaft CJK : mei5 : Wei 68B7: 68B8: 68B9: Areca somunlarını ideografi; tembul fındık CJK : ban1 : çöp Kutusu 68BA: 68BB: Dalları Budist mezarlarına yerleştirilen bir ağacı ideografla CJK : fo 68BC: Ahşap ideograf bloğu; ahmak; aptal CJK : ila 4'ü : Tao 68BD: 68BE: 68BF: 68C0: İdeografi kontrolü; CJK'yi incelemek : glm2 : jiǎn 68C1: İdeograf joist; kamış CJK : zyut3 : Zhuo 68C2: İdeografi oyulmuş veya desenli pencere eşikleri CJK : ling4 : Ling 68C3: Armut ideografı CJK : lei4 : Li 68C4: Ideograf CJK'yi reddet, terk et, at : hei3 : Qi 68C5: İdeografi kolu, kolu, topuzu; otorite CJK : beng3 : bǐng 68C6: Ideograph kafur ağacı CJK : lun 68C7: 68C8: 68C9: İdeograf pamuk; pamuklu yastıklı CJK : min4 : Mian 68CA: İdeograf satranç; satranç CJK benzeri herhangi bir oyun : kei4 : Qi 68CB: İdeograf satranç; satranç CJK benzeri herhangi bir oyun : kei4 : Qi 68CC: 68CD: İdeografi çubuğu, sopa; alçak herif CJK : gwan3 : tabanca 68CE: 68CF: 68D0: Porsuk CJK türleri : fei2 : Fei 68D1: İdeografi Sal CJK : paai4 : Pai 68D2: İdeografi çubuğu, kulüp, truncheon; CJK'yi vurdu : paang5 : patlama 68D3: İdeografi vuruldu, CJK'ya saldırdı : bui4 paang5 : patlama 68D4: 68D5: İdeografi kenevir avuç; palmiye ağacı CJK : zung1 : Zong 68D6: Ideograph door stop, kapı sıkışması; dokunma; bir pervane, CJK sonrası : caam4 caam5 caan5 caang4 : Cheng 68D7: İdeograf tarih ağacı; tarihler, hünnaplar; soyadı CJK : zou2 : zǎo 68D8: İdeograf hünnap ağacı; dikenler, crakklar CJK : gik1 : ji 68D9: İdeografi tıkalı; parmakları birbirine çekmek; CJK yönlendirmek : lai6 : lì 68DA: İdeograf çadırı, tente; kabini; CJK döken : paang4 : Peng 68DB: 68DC: İdeografi dalı, çatal; tepsi CJK : jyu3 : yù 68DD: 68DE: 68DF: CJK evini destekleyen ana kirişleri ideografla : dung3 dung6 : Dong 68E0: İdeografi yengeç elma ağacı; yabani erik CJK : tong4 : Táng 68E1: 68E2: Bir jeleğin felloe veya jantının ideografı : mong1 : wǎng 68E3: Ideograph kerria japonica bitki, kiraz CJK : dai6 : di 68E4: 68E5: Bir korkuluk ideografı; bir çit kapalı bir yer CJK : fan 68E6: 68E7: İdeograf deposu; lokali, han CJK : zaan2 zaan6 : Zhan 68E8: İdeografi taksitli veya tahta geçişi CJK : kai2 : qǐ 68E9: 68EA: İdeograf ağacı CJK : yǎn 68EB: Sarı çiçekleri ile ideograf dikenli çalı; bir çeşit meşe CJK : wik6 : yù 68EC: İdeografi kabı CJK : hyun1 : Quan 68ED: 68EE: İdeograf ormanı; bereketli bitki örtüsü CJK : sam1 : You are 68EF: Ideograph hünnap ağacı CJK : nim1 nim6 : ren 68F0: 68F1: İdeografi kare ahşap; açı, kenar CJK : ling4 : Leng 68F2: İdeograf levrek; tünek; CJK kal : cai1 : Qi 68F3: Çatıda destek veren küçük sütunların ideografı : zyut3 : Zhuo 68F4: 68F5: Ağaçlar için ideograf numarası : fo1 fo2 po1 : ke 68F6: 68F7: 68F8: İdeograf soyadı CJK : zau1 : Zou 68F9: İdeografi kürek; tekne CJK : zaau6 zoek3 : Zhao 68FA: İdeograf tabut CJK : gun1 : Guan 68FB: Ideograph CJK parfümünden çıkan odun : FAN1 : bataklık 68FC: Bir evin çatısında Ideograph kirişler karıştı, CJK bozuk : FAN4 : bataklık 68FD: 68FE: 68FF:
{ "pile_set_name": "Github" }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/glue/model/GetCatalogImportStatusRequest.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Glue::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; GetCatalogImportStatusRequest::GetCatalogImportStatusRequest() : m_catalogIdHasBeenSet(false) { } Aws::String GetCatalogImportStatusRequest::SerializePayload() const { JsonValue payload; if(m_catalogIdHasBeenSet) { payload.WithString("CatalogId", m_catalogId); } return payload.View().WriteReadable(); } Aws::Http::HeaderValueCollection GetCatalogImportStatusRequest::GetRequestSpecificHeaders() const { Aws::Http::HeaderValueCollection headers; headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSGlue.GetCatalogImportStatus")); return headers; }
{ "pile_set_name": "Github" }
#include "statemanager.h" #include "snapshot.h" /* State Manager Class that records snapshot data for rewinding mostly based on SSNES's rewind code by Themaister */ static inline size_t nearest_pow2_size(size_t v) { size_t orig = v; v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; #if SIZE_MAX >= 0xffff v |= v >> 8; #endif #if SIZE_MAX >= 0xffffffff v |= v >> 16; #endif #if SIZE_MAX >= 0xffffffffffffffff v |= v >> 32; #endif v++; size_t next = v; size_t prev = v >> 1; if ((next - orig) < (orig - prev)) return next; else return prev; } void StateManager::deallocate() { if(buffer) { delete [] buffer; buffer = NULL; } if(tmp_state) { delete [] tmp_state; tmp_state = NULL; } if(in_state) { delete [] in_state; in_state = NULL; } } StateManager::StateManager() { buffer = NULL; tmp_state = NULL; in_state = NULL; init_done = false; } StateManager::~StateManager() { deallocate(); } bool StateManager::init(size_t buffer_size) { init_done = false; deallocate(); real_state_size = S9xFreezeSize(); state_size = real_state_size / sizeof(uint32_t); // Works in multiple of 4. // We need 4-byte aligned state_size to avoid having to enforce this with unneeded memcpy's! if(real_state_size % sizeof(uint32_t)) state_size ++; if (buffer_size <= real_state_size) // Need a sufficient buffer size. return false; top_ptr = 1; buf_size = nearest_pow2_size(buffer_size) / sizeof(uint64_t); // Works in multiple of 8. buf_size_mask = buf_size - 1; if (!(buffer = new uint64_t[buf_size])) return false; if (!(tmp_state = new uint32_t[state_size])) return false; if (!(in_state = new uint32_t[state_size])) return false; memset(tmp_state,0,state_size * sizeof(uint32_t)); memset(in_state,0,state_size * sizeof(uint32_t)); init_done = true; return true; } int StateManager::pop() { if(!init_done) return 0; if (first_pop) { first_pop = false; return S9xUnfreezeGameMem((uint8 *)tmp_state,real_state_size); } top_ptr = (top_ptr - 1) & buf_size_mask; if (top_ptr == bottom_ptr) // Our stack is completely empty... :v { top_ptr = (top_ptr + 1) & buf_size_mask; return 0; } while (buffer[top_ptr]) { // Apply the xor patch. uint32_t addr = buffer[top_ptr] >> 32; uint32_t xor_ = buffer[top_ptr] & 0xFFFFFFFFU; tmp_state[addr] ^= xor_; top_ptr = (top_ptr - 1) & buf_size_mask; } if (top_ptr == bottom_ptr) // Our stack is completely empty... :v { top_ptr = (top_ptr + 1) & buf_size_mask; } return S9xUnfreezeGameMem((uint8 *)tmp_state,real_state_size); } void StateManager::reassign_bottom() { bottom_ptr = (top_ptr + 1) & buf_size_mask; while (buffer[bottom_ptr]) // Skip ahead until we find the first 0 (boundary for state delta). bottom_ptr = (bottom_ptr + 1) & buf_size_mask; } void StateManager::generate_delta(const void *data) { bool crossed = false; const uint32_t *old_state = tmp_state; const uint32_t *new_state = (const uint32_t*)data; buffer[top_ptr++] = 0; // For each separate delta, we have a 0 value sentinel in between. top_ptr &= buf_size_mask; // Check if top_ptr and bottom_ptr crossed each other, which means we need to delete old cruft. if (top_ptr == bottom_ptr) crossed = true; for (uint64_t i = 0; i < state_size; i++) { uint64_t xor_ = old_state[i] ^ new_state[i]; // If the data differs (xor != 0), we push that xor on the stack with index and xor. // This can be reversed by reapplying the xor. // This, if states don't really differ much, we'll save lots of space :) // Hopefully this will work really well with save states. if (xor_) { buffer[top_ptr] = (i << 32) | xor_; top_ptr = (top_ptr + 1) & buf_size_mask; if (top_ptr == bottom_ptr) crossed = true; } } if (crossed) reassign_bottom(); } bool StateManager::push() { if(!init_done) return false; if(!S9xFreezeGameMem((uint8 *)in_state,real_state_size)) return false; generate_delta(in_state); uint32 *tmp = tmp_state; tmp_state = in_state; in_state = tmp; first_pop = true; return true; }
{ "pile_set_name": "Github" }
# # MOST I2C configuration # config HDM_I2C tristate "I2C HDM" depends on I2C ---help--- Say Y here if you want to connect via I2C to network tranceiver. To compile this driver as a module, choose M here: the module will be called hdm_i2c.
{ "pile_set_name": "Github" }
// We are defining types and submodules, so we can use a namespace // rather than a module at the top level namespace OrderTaking.Common open System // =============================== // Simple types and constrained types related to the OrderTaking domain. // // E.g. Single case discriminated unions (aka wrappers), enums, etc // =============================== /// Constrained to be 50 chars or less, not null type String50 = private String50 of string /// An email address type EmailAddress = private EmailAddress of string /// A zip code type ZipCode = private ZipCode of string /// An Id for Orders. Constrained to be a non-empty string < 10 chars type OrderId = private OrderId of string /// An Id for OrderLines. Constrained to be a non-empty string < 10 chars type OrderLineId = private OrderLineId of string /// The codes for Widgets start with a "W" and then four digits type WidgetCode = private WidgetCode of string /// The codes for Gizmos start with a "G" and then three digits. type GizmoCode = private GizmoCode of string /// A ProductCode is either a Widget or a Gizmo type ProductCode = | Widget of WidgetCode | Gizmo of GizmoCode /// Constrained to be a integer between 1 and 1000 type UnitQuantity = private UnitQuantity of int /// Constrained to be a decimal between 0.05 and 100.00 type KilogramQuantity = private KilogramQuantity of decimal /// A Quantity is either a Unit or a Kilogram type OrderQuantity = | Unit of UnitQuantity | Kilogram of KilogramQuantity /// Constrained to be a decimal between 0.0 and 1000.00 type Price = private Price of decimal /// Constrained to be a decimal between 0.0 and 10000.00 type BillingAmount = private BillingAmount of decimal /// Represents a PDF attachment type PdfAttachment = { Name : string Bytes: byte[] } // =============================== // Reusable constructors and getters for constrained types // =============================== /// Useful functions for constrained types module ConstrainedType = /// Create a constrained string using the constructor provided /// Return Error if input is null, empty, or length > maxLen let createString fieldName ctor maxLen str = if String.IsNullOrEmpty(str) then let msg = sprintf "%s must not be null or empty" fieldName Error msg elif str.Length > maxLen then let msg = sprintf "%s must not be more than %i chars" fieldName maxLen Error msg else Ok (ctor str) /// Create a optional constrained string using the constructor provided /// Return None if input is null, empty. /// Return error if length > maxLen /// Return Some if the input is valid let createStringOption fieldName ctor maxLen str = if String.IsNullOrEmpty(str) then Ok None elif str.Length > maxLen then let msg = sprintf "%s must not be more than %i chars" fieldName maxLen Error msg else Ok (ctor str |> Some) /// Create a constrained integer using the constructor provided /// Return Error if input is less than minVal or more than maxVal let createInt fieldName ctor minVal maxVal i = if i < minVal then let msg = sprintf "%s: Must not be less than %i" fieldName minVal Error msg elif i > maxVal then let msg = sprintf "%s: Must not be greater than %i" fieldName maxVal Error msg else Ok (ctor i) /// Create a constrained decimal using the constructor provided /// Return Error if input is less than minVal or more than maxVal let createDecimal fieldName ctor minVal maxVal i = if i < minVal then let msg = sprintf "%s: Must not be less than %M" fieldName minVal Error msg elif i > maxVal then let msg = sprintf "%s: Must not be greater than %M" fieldName maxVal Error msg else Ok (ctor i) /// Create a constrained string using the constructor provided /// Return Error if input is null. empty, or does not match the regex pattern let createLike fieldName ctor pattern str = if String.IsNullOrEmpty(str) then let msg = sprintf "%s: Must not be null or empty" fieldName Error msg elif System.Text.RegularExpressions.Regex.IsMatch(str,pattern) then Ok (ctor str) else let msg = sprintf "%s: '%s' must match the pattern '%s'" fieldName str pattern Error msg // F# VERSION DIFFERENCE // Modules with the same name as a non-generic type will cause an error in versions of F# before v4.1 (VS2017) // so change the module definition to include a [<CompilationRepresentation>] attribute like this: (* [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] module String50 = *) module String50 = /// Return the value inside a String50 let value (String50 str) = str /// Create an String50 from a string /// Return Error if input is null, empty, or length > 50 let create fieldName str = ConstrainedType.createString fieldName String50 50 str /// Create an String50 from a string /// Return None if input is null, empty. /// Return error if length > maxLen /// Return Some if the input is valid let createOption fieldName str = ConstrainedType.createStringOption fieldName String50 50 str module EmailAddress = /// Return the string value inside an EmailAddress let value (EmailAddress str) = str /// Create an EmailAddress from a string /// Return Error if input is null, empty, or doesn't have an "@" in it let create fieldName str = let pattern = ".+@.+" // anything separated by an "@" ConstrainedType.createLike fieldName EmailAddress pattern str module ZipCode = /// Return the string value inside a ZipCode let value (ZipCode str) = str /// Create a ZipCode from a string /// Return Error if input is null, empty, or doesn't have 5 digits let create fieldName str = let pattern = "\d{5}" ConstrainedType.createLike fieldName ZipCode pattern str module OrderId = /// Return the string value inside an OrderId let value (OrderId str) = str /// Create an OrderId from a string /// Return Error if input is null, empty, or length > 50 let create fieldName str = ConstrainedType.createString fieldName OrderId 50 str module OrderLineId = /// Return the string value inside an OrderLineId let value (OrderLineId str) = str /// Create an OrderLineId from a string /// Return Error if input is null, empty, or length > 50 let create fieldName str = ConstrainedType.createString fieldName OrderLineId 50 str module WidgetCode = /// Return the string value inside a WidgetCode let value (WidgetCode code) = code /// Create an WidgetCode from a string /// Return Error if input is null. empty, or not matching pattern let create fieldName code = // The codes for Widgets start with a "W" and then four digits let pattern = "W\d{4}" ConstrainedType.createLike fieldName WidgetCode pattern code module GizmoCode = /// Return the string value inside a GizmoCode let value (GizmoCode code) = code /// Create an GizmoCode from a string /// Return Error if input is null, empty, or not matching pattern let create fieldName code = // The codes for Gizmos start with a "G" and then three digits. let pattern = "G\d{3}" ConstrainedType.createLike fieldName GizmoCode pattern code module ProductCode = /// Return the string value inside a ProductCode let value productCode = match productCode with | Widget (WidgetCode wc) -> wc | Gizmo (GizmoCode gc) -> gc /// Create an ProductCode from a string /// Return Error if input is null, empty, or not matching pattern let create fieldName code = if String.IsNullOrEmpty(code) then let msg = sprintf "%s: Must not be null or empty" fieldName Error msg else if code.StartsWith("W") then WidgetCode.create fieldName code |> Result.map Widget else if code.StartsWith("G") then GizmoCode.create fieldName code |> Result.map Gizmo else let msg = sprintf "%s: Format not recognized '%s'" fieldName code Error msg module UnitQuantity = /// Return the value inside a UnitQuantity let value (UnitQuantity v) = v /// Create a UnitQuantity from a int /// Return Error if input is not an integer between 1 and 1000 let create fieldName v = ConstrainedType.createInt fieldName UnitQuantity 1 1000 v module KilogramQuantity = /// Return the value inside a KilogramQuantity let value (KilogramQuantity v) = v /// Create a KilogramQuantity from a decimal. /// Return Error if input is not a decimal between 0.05 and 100.00 let create fieldName v = ConstrainedType.createDecimal fieldName KilogramQuantity 0.5M 100M v module OrderQuantity = /// Return the value inside a OrderQuantity let value qty = match qty with | Unit uq -> uq |> UnitQuantity.value |> decimal | Kilogram kq -> kq |> KilogramQuantity.value /// Create a OrderQuantity from a productCode and quantity let create fieldName productCode quantity = match productCode with | Widget _ -> UnitQuantity.create fieldName (int quantity) // convert float to int |> Result.map OrderQuantity.Unit // lift to OrderQuantity type | Gizmo _ -> KilogramQuantity.create fieldName quantity |> Result.map OrderQuantity.Kilogram // lift to OrderQuantity type module Price = /// Return the value inside a Price let value (Price v) = v /// Create a Price from a decimal. /// Return Error if input is not a decimal between 0.0 and 1000.00 let create v = ConstrainedType.createDecimal "Price" Price 0.0M 1000M v /// Create a Price from a decimal. /// Throw an exception if out of bounds. This should only be used if you know the value is valid. let unsafeCreate v = create v |> function | Ok price -> price | Error err -> failwithf "Not expecting Price to be out of bounds: %s" err /// Multiply a Price by a decimal qty. /// Return Error if new price is out of bounds. let multiply qty (Price p) = create (qty * p) module BillingAmount = /// Return the value inside a BillingAmount let value (BillingAmount v) = v /// Create a BillingAmount from a decimal. /// Return Error if input is not a decimal between 0.0 and 10000.00 let create v = ConstrainedType.createDecimal "BillingAmount" BillingAmount 0.0M 10000M v /// Sum a list of prices to make a billing amount /// Return Error if total is out of bounds let sumPrices prices = let total = prices |> List.map Price.value |> List.sum create total
{ "pile_set_name": "Github" }
// // PPDataCollector.h // PayPalDataCollector // // Copyright © 2015 PayPal, Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "PPRMOCMagnesResult.h" /** Used to collect risk data via the PayPal data collector */ @interface PPDataCollector : NSObject /** Returns a client metadata ID. @note This returns a raw client metadata ID, which is not the correct format for device data when creating a transaction. Instead, it is recommended to use `collectPayPalDeviceData`. @param pairingID a pairing ID to associate with this clientMetadataID must be 10-32 chars long or null @return a client metadata ID to send as a header */ + (nonnull NSString *)clientMetadataID:(nullable NSString *)pairingID; /** Returns a client metadata ID. @note This returns a raw client metadata ID, which is not the correct format for device data when creating a transaction. Instead, it is recommended to use `collectPayPalDeviceData`. @return a client metadata ID to send as a header */ + (nonnull NSString *)clientMetadataID DEPRECATED_MSG_ATTRIBUTE("Use [PPDataCollector collectPayPalDeviceData] to generate a device data string."); /** Collects device data for PayPal. This should be used when the user is paying with PayPal or Venmo only. @return a deviceData string that should be passed into server-side calls, such as `Transaction.sale`, for PayPal transactions. This JSON serialized string contains a PayPal fraud ID. */ + (nonnull NSString *)collectPayPalDeviceData; /** For internal use only, returns an object with device data and clientMetadataID. @param clientMetadataID a pairing ID to associate with this clientMetadataID must be 10-32 chars long or null @return a nonnull Result with the device data */ + (nonnull PPRMOCMagnesSDKResult *)collectPayPalDeviceInfoWithClientMetadataID:(nullable NSString *)clientMetadataID; @end
{ "pile_set_name": "Github" }
# 高效的修改std::map元素的键值 在`std::map`数据结构中,键-值通常都对应存在,而且键通常是唯一并排序过的,而且键值一旦设定那么就不允许用户再进行修改。为了阻止用户修改键,键的类型声明使用了`const`。 这种限制是非常明智的,其可以保证用户很难在使用`std::map`的时候出错。不过,如果我们真的需要修改`map`的键值该怎么办呢? C++17之前,因为对应的键已经存在,我们不得不将整个键-值对从树中移除,然后再插入。这种方法的确定很明显,其需要分配出一些不必要的内存,感觉上也会对性能有一定的影响。 从C++17起,我们无需重新分配内存,就可以删除和重新插入map键值对。下面的内容中将会展示如何操作。 ## How to do it... 我们使用`std::map`类型一个实现应用,用于确定车手在虚拟比赛中的排位。当车手在比赛中完成超越,那么我们将使用C++17的新方法改变其键值。 1. 包含必要的头文件和声明使用的命名空间。 ```c++ #include <iostream> #include <map> using namespace std; ``` 2. 我们会在修改map的时候打印之前和之后结果,所以这里先实现了一个辅助函数。 ```c++ template <typename M> void print(const M &m) { cout << "Race placement:\n"; for (const auto &[placement, driver] : m) { cout << placement << ": " << driver << '\n'; } } ``` 3. 主函数中,我们实例化并初始化一个`map`,其键为整型,表示是当前的排位;值为字符型,表示驾驶员的姓名。我们在这里先打印一下这个`map`,因为我们会在下一步对其进行修改。 ```c++ int main() { map<int, string> race_placement { {1, "Mario"}, {2, "Luigi"}, {3, "Bowser"}, {4, "Peach"}, {5, "Yoshi"}, {6, "Koopa"}, {7, "Toad"}, {8, "Donkey Kong Jr."} }; print(race_placement); ``` 4. 让我来看下排位赛的某一圈的情况,Bowser因为赛车事故排在最后,Donkey Kong Jr. 从最后一名超到第三位。例子中首先要从`map`中提取节点,因为这是唯一能修改键值的方法。`extract`函数是C++17新加的特性。其可以从`map`中删除元素,并没有内存重分配的副作用。看下这里是怎么用的吧。 ```c++ { auto a(race_placement.extract(3)); auto b(race_placement.extract(8)); ``` 5. 现在我们要交换Bowser和Donkey Kong Jr.的键。键通常都是无法修改的,不过我们可以通过`extract`方法来修改元素的键。 ```c++ swap(a.key(), b.key()); ``` 6. `std::map`的`insert`函数在C++17中有一个新的重载版本,其接受已经提取出来的节点,就是为了在插入他们时,不会分配不必要的内存。 ```c++ race_placement.insert(move(a)); race_placement.insert(move(b)); } ``` 7. 最后,我们打印一下目前的排位。 ```c++ print(race_placement); } ``` 8. 编译并运行可以得到如下输出。我们可以看到初始的排位和最后的排位。 ```c++ $ ./mapnode_key_modification Race placement: 1: Mario 2: Luigi 3: Bowser 4: Peach 5: Yoshi 6: Koopa 7: Toad 8: Donkey Kong Jr. Race placement: 1: Mario 2: Luigi 3: Donkey Kong Jr. 4: Peach 5: Yoshi 6: Koopa 7: Toad 8: Bowser ``` ## How it works... 在C++17中,`std::map`有一个新成员函数`extract`。其有两种形式: ```c++ node_type extract(const_iterator position); node_type extract(const key_type& x) ``` 在例子中,我们使用了第二个,能接受一个键值,然后找到这个键值,并提取对应的`map`节点。第一个函数接受一个迭代器,提取的速度会更快,应为给定了迭代器就不需要在查找。 当使用第二种方式去提取一个不存在的节点时,会返回一个空`node_type`实例。`empty()`成员函数会返回一个布尔值,用来表明`node_type`实例是否为空。以任何方式访问一个空的实例都会产生未定义行为。 提取节点之后,我们要使用`key()`函数获取要修改的键,这个函数会返回一个非常量的键。 需要注意的是,要将节点重新插会到`map`时,我们需要在`insert`中移动他们。因为`extract`可避免不必要的拷贝和内存分配。还有一点就是,移动一个`node_type`时,其不会让容器的任何值发生移动。 ## There's more... 使用`extract`方法提取的`map`节点实际上非常通用。我们可以从一个`map`实例中提取出来节点,然后插入到另一个`map`中,甚至可以插入到`multimap`实例中。这种方式在`unordered_map`和`unordered_multimap`实例中也适用。同样在`set/multiset`和`unordered_set/unordered_multiset`也适用。 为了在不同`map`或`set`结构中移动元素,键、值和分配器的类型都必须相同。需要注意的是,不能将`map`中的节点移动到`unordered_map`中,或是将`set`中的元素移动到`unordered_set`中。
{ "pile_set_name": "Github" }
{ "id": "35290835", "url": "https:\/\/collection.cooperhewitt.org\/types\/35290835\/", "name": "Skippet and cover", "count_objects": "2", "supersedes": "0", "superseded_by": "0" }
{ "pile_set_name": "Github" }
polygon 1 1.542000E+01 4.967938E+01 1.542006E+01 4.967936E+01 1.542010E+01 4.967936E+01 1.542014E+01 4.967935E+01 1.542027E+01 4.967950E+01 1.542032E+01 4.967951E+01 1.542036E+01 4.967948E+01 1.542040E+01 4.967950E+01 1.542046E+01 4.967945E+01 1.542055E+01 4.967941E+01 1.542074E+01 4.967938E+01 1.542072E+01 4.967931E+01 1.542084E+01 4.967928E+01 1.542091E+01 4.967927E+01 1.542090E+01 4.967918E+01 1.542094E+01 4.967912E+01 1.542115E+01 4.967908E+01 1.542120E+01 4.967914E+01 1.542129E+01 4.967911E+01 1.542136E+01 4.967905E+01 1.542134E+01 4.967900E+01 1.542135E+01 4.967889E+01 1.542152E+01 4.967887E+01 1.542158E+01 4.967878E+01 1.542161E+01 4.967852E+01 1.542170E+01 4.967852E+01 1.542183E+01 4.967840E+01 1.542187E+01 4.967830E+01 1.542198E+01 4.967831E+01 1.542209E+01 4.967824E+01 1.542222E+01 4.967822E+01 1.542235E+01 4.967812E+01 1.542240E+01 4.967805E+01 1.542255E+01 4.967804E+01 1.542261E+01 4.967801E+01 1.542267E+01 4.967810E+01 1.542275E+01 4.967810E+01 1.542277E+01 4.967804E+01 1.542294E+01 4.967809E+01 1.542301E+01 4.967803E+01 1.542299E+01 4.967793E+01 1.542305E+01 4.967789E+01 1.542299E+01 4.967783E+01 1.542313E+01 4.967775E+01 1.542319E+01 4.967779E+01 1.542339E+01 4.967773E+01 1.542342E+01 4.967758E+01 1.542358E+01 4.967752E+01 1.542354E+01 4.967746E+01 1.542363E+01 4.967747E+01 1.542371E+01 4.967747E+01 1.542381E+01 4.967732E+01 1.542388E+01 4.967727E+01 1.542396E+01 4.967721E+01 1.542406E+01 4.967715E+01 1.542446E+01 4.967706E+01 1.542463E+01 4.967708E+01 1.542476E+01 4.967712E+01 1.542453E+01 4.967741E+01 1.542447E+01 4.967749E+01 1.542477E+01 4.967755E+01 1.542525E+01 4.967746E+01 1.542569E+01 4.967743E+01 1.542598E+01 4.967741E+01 1.542620E+01 4.967741E+01 1.542631E+01 4.967747E+01 1.542639E+01 4.967747E+01 1.542654E+01 4.967750E+01 1.542698E+01 4.967742E+01 1.542714E+01 4.967751E+01 1.542724E+01 4.967752E+01 1.542733E+01 4.967759E+01 1.542750E+01 4.967756E+01 1.542769E+01 4.967776E+01 1.542772E+01 4.967784E+01 1.542785E+01 4.967792E+01 1.542784E+01 4.967795E+01 1.542776E+01 4.967803E+01 1.542782E+01 4.967813E+01 1.542791E+01 4.967817E+01 1.542808E+01 4.967814E+01 1.542814E+01 4.967823E+01 1.542814E+01 4.967830E+01 1.542820E+01 4.967835E+01 1.542832E+01 4.967835E+01 1.542841E+01 4.967831E+01 1.542859E+01 4.967829E+01 1.542866E+01 4.967835E+01 1.542865E+01 4.967841E+01 1.542871E+01 4.967842E+01 1.542870E+01 4.967853E+01 1.542884E+01 4.967868E+01 1.542899E+01 4.967870E+01 1.542922E+01 4.967866E+01 1.542928E+01 4.967865E+01 1.542950E+01 4.967862E+01 1.542969E+01 4.967870E+01 1.542977E+01 4.967879E+01 1.542992E+01 4.967880E+01 1.543012E+01 4.967876E+01 1.543014E+01 4.967881E+01 1.543033E+01 4.967874E+01 1.543067E+01 4.967875E+01 1.543082E+01 4.967878E+01 1.543118E+01 4.967891E+01 1.543134E+01 4.967891E+01 1.543155E+01 4.967904E+01 1.543166E+01 4.967919E+01 1.543157E+01 4.967927E+01 1.543176E+01 4.967937E+01 1.543166E+01 4.967945E+01 1.543174E+01 4.967952E+01 1.543187E+01 4.967959E+01 1.543185E+01 4.967964E+01 1.543203E+01 4.967970E+01 1.543215E+01 4.967970E+01 1.543242E+01 4.967999E+01 1.543267E+01 4.967993E+01 1.543289E+01 4.967995E+01 1.543294E+01 4.968000E+01 1.543328E+01 4.967999E+01 1.543346E+01 4.967990E+01 1.543360E+01 4.967981E+01 1.543393E+01 4.967954E+01 1.543409E+01 4.967941E+01 1.543418E+01 4.967932E+01 1.543440E+01 4.967908E+01 1.543458E+01 4.967889E+01 1.543472E+01 4.967875E+01 1.543486E+01 4.967867E+01 1.543494E+01 4.967842E+01 1.543493E+01 4.967832E+01 1.543473E+01 4.967798E+01 1.543465E+01 4.967776E+01 1.543456E+01 4.967749E+01 1.543459E+01 4.967748E+01 1.543451E+01 4.967734E+01 1.543494E+01 4.967716E+01 1.543525E+01 4.967709E+01 1.543541E+01 4.967706E+01 1.543578E+01 4.967700E+01 1.543628E+01 4.967692E+01 1.543654E+01 4.967703E+01 1.543714E+01 4.967720E+01 1.543737E+01 4.967742E+01 1.543788E+01 4.967724E+01 1.543808E+01 4.967713E+01 1.543818E+01 4.967709E+01 1.543832E+01 4.967701E+01 1.543837E+01 4.967696E+01 1.543849E+01 4.967680E+01 1.543906E+01 4.967666E+01 1.543929E+01 4.967666E+01 1.543925E+01 4.967681E+01 1.543941E+01 4.967709E+01 1.543993E+01 4.967757E+01 1.543992E+01 4.967797E+01 1.544008E+01 4.967815E+01 1.544022E+01 4.967825E+01 1.544083E+01 4.967838E+01 1.544113E+01 4.967853E+01 1.544141E+01 4.967861E+01 1.544183E+01 4.967846E+01 1.544221E+01 4.967841E+01 1.544259E+01 4.967843E+01 1.544312E+01 4.967842E+01 1.544344E+01 4.967839E+01 1.544364E+01 4.967831E+01 1.544400E+01 4.967843E+01 1.544432E+01 4.967853E+01 1.544448E+01 4.967868E+01 1.544494E+01 4.967835E+01 1.544504E+01 4.967822E+01 1.544508E+01 4.967817E+01 1.544524E+01 4.967806E+01 1.544600E+01 4.967774E+01 1.544620E+01 4.967774E+01 1.544648E+01 4.967770E+01 1.544659E+01 4.967764E+01 1.544675E+01 4.967750E+01 1.544695E+01 4.967740E+01 1.544799E+01 4.967739E+01 1.544832E+01 4.967723E+01 1.544879E+01 4.967692E+01 1.544897E+01 4.967680E+01 1.544902E+01 4.967702E+01 1.544903E+01 4.967715E+01 1.544900E+01 4.967736E+01 1.544894E+01 4.967763E+01 1.544888E+01 4.967787E+01 1.544882E+01 4.967824E+01 1.544877E+01 4.967855E+01 1.544870E+01 4.967879E+01 1.544859E+01 4.967925E+01 1.544856E+01 4.967963E+01 1.544853E+01 4.968005E+01 1.544850E+01 4.968038E+01 1.544849E+01 4.968073E+01 1.544839E+01 4.968100E+01 1.544835E+01 4.968119E+01 1.544824E+01 4.968172E+01 1.544817E+01 4.968211E+01 1.544818E+01 4.968233E+01 1.544819E+01 4.968265E+01 1.544807E+01 4.968281E+01 1.544772E+01 4.968330E+01 1.544747E+01 4.968365E+01 1.544734E+01 4.968400E+01 1.544721E+01 4.968435E+01 1.544735E+01 4.968500E+01 1.544686E+01 4.968591E+01 1.544663E+01 4.968624E+01 1.544635E+01 4.968663E+01 1.544603E+01 4.968706E+01 1.544570E+01 4.968750E+01 1.544579E+01 4.968765E+01 1.544594E+01 4.968793E+01 1.544623E+01 4.968848E+01 1.544626E+01 4.968863E+01 1.544632E+01 4.968896E+01 1.544640E+01 4.968939E+01 1.544634E+01 4.968961E+01 1.544623E+01 4.968997E+01 1.544618E+01 4.969016E+01 1.544615E+01 4.969022E+01 1.544372E+01 4.969183E+01 1.544355E+01 4.969191E+01 1.544299E+01 4.969219E+01 1.544293E+01 4.969260E+01 1.544286E+01 4.969293E+01 1.544278E+01 4.969327E+01 1.544273E+01 4.969347E+01 1.544269E+01 4.969362E+01 1.544250E+01 4.969412E+01 1.544243E+01 4.969431E+01 1.544234E+01 4.969467E+01 1.544178E+01 4.969526E+01 1.544157E+01 4.969546E+01 1.544153E+01 4.969550E+01 1.544121E+01 4.969505E+01 1.544102E+01 4.969497E+01 1.544038E+01 4.969514E+01 1.544029E+01 4.969524E+01 1.544005E+01 4.969530E+01 1.543945E+01 4.969551E+01 1.543938E+01 4.969545E+01 1.543877E+01 4.969520E+01 1.543788E+01 4.969505E+01 1.543732E+01 4.969503E+01 1.543698E+01 4.969505E+01 1.543655E+01 4.969502E+01 1.543604E+01 4.969500E+01 1.543600E+01 4.969501E+01 1.543566E+01 4.969515E+01 1.543562E+01 4.969517E+01 1.543545E+01 4.969508E+01 1.543525E+01 4.969504E+01 1.543507E+01 4.969494E+01 1.543454E+01 4.969492E+01 1.543384E+01 4.969463E+01 1.543351E+01 4.969444E+01 1.543336E+01 4.969428E+01 1.543278E+01 4.969421E+01 1.543240E+01 4.969410E+01 1.543208E+01 4.969398E+01 1.543207E+01 4.969372E+01 1.543176E+01 4.969347E+01 1.543150E+01 4.969318E+01 1.543127E+01 4.969308E+01 1.543096E+01 4.969289E+01 1.543068E+01 4.969242E+01 1.543071E+01 4.969243E+01 1.543056E+01 4.969227E+01 1.543056E+01 4.969226E+01 1.543059E+01 4.969227E+01 1.543062E+01 4.969227E+01 1.543083E+01 4.969244E+01 1.543067E+01 4.969223E+01 1.543047E+01 4.969189E+01 1.543043E+01 4.969178E+01 1.543029E+01 4.969168E+01 1.542978E+01 4.969152E+01 1.542979E+01 4.969149E+01 1.542977E+01 4.969146E+01 1.542920E+01 4.969128E+01 1.542915E+01 4.969121E+01 1.542911E+01 4.969122E+01 1.542900E+01 4.969123E+01 1.542900E+01 4.969120E+01 1.542893E+01 4.969120E+01 1.542890E+01 4.969120E+01 1.542886E+01 4.969121E+01 1.542889E+01 4.969122E+01 1.542866E+01 4.969126E+01 1.542877E+01 4.969101E+01 1.542844E+01 4.969092E+01 1.542804E+01 4.969096E+01 1.542786E+01 4.969088E+01 1.542769E+01 4.969094E+01 1.542756E+01 4.969081E+01 1.542707E+01 4.969022E+01 1.542654E+01 4.969036E+01 1.542625E+01 4.969030E+01 1.542605E+01 4.969027E+01 1.542604E+01 4.969026E+01 1.542573E+01 4.968992E+01 1.542603E+01 4.968980E+01 1.542571E+01 4.968945E+01 1.542566E+01 4.968950E+01 1.542540E+01 4.968980E+01 1.542534E+01 4.968989E+01 1.542530E+01 4.968994E+01 1.542521E+01 4.969008E+01 1.542531E+01 4.969019E+01 1.542539E+01 4.969031E+01 1.542533E+01 4.969031E+01 1.542520E+01 4.969019E+01 1.542510E+01 4.969027E+01 1.542501E+01 4.969033E+01 1.542471E+01 4.969025E+01 1.542428E+01 4.969004E+01 1.542411E+01 4.969011E+01 1.542381E+01 4.968973E+01 1.542367E+01 4.968958E+01 1.542343E+01 4.968937E+01 1.542317E+01 4.968905E+01 1.542299E+01 4.968881E+01 1.542286E+01 4.968847E+01 1.542276E+01 4.968809E+01 1.542261E+01 4.968751E+01 1.542204E+01 4.968762E+01 1.542178E+01 4.968759E+01 1.542181E+01 4.968724E+01 1.542190E+01 4.968713E+01 1.542185E+01 4.968685E+01 1.542172E+01 4.968660E+01 1.542134E+01 4.968628E+01 1.542127E+01 4.968630E+01 1.542106E+01 4.968615E+01 1.542090E+01 4.968567E+01 1.542077E+01 4.968525E+01 1.542066E+01 4.968479E+01 1.542057E+01 4.968459E+01 1.542044E+01 4.968436E+01 1.542026E+01 4.968423E+01 1.542010E+01 4.968416E+01 1.542000E+01 4.968412E+01 1.541972E+01 4.968394E+01 1.541955E+01 4.968377E+01 1.541956E+01 4.968328E+01 1.541956E+01 4.968302E+01 1.541951E+01 4.968295E+01 1.541965E+01 4.968267E+01 1.541967E+01 4.968229E+01 1.541964E+01 4.968223E+01 1.541957E+01 4.968205E+01 1.541948E+01 4.968187E+01 1.541947E+01 4.968181E+01 1.541949E+01 4.968160E+01 1.541949E+01 4.968136E+01 1.541946E+01 4.968119E+01 1.541941E+01 4.968113E+01 1.541927E+01 4.968103E+01 1.541909E+01 4.968088E+01 1.541903E+01 4.968062E+01 1.541940E+01 4.968041E+01 1.541961E+01 4.968025E+01 1.541967E+01 4.968021E+01 1.541980E+01 4.968010E+01 1.541983E+01 4.968001E+01 1.541987E+01 4.967989E+01 1.541989E+01 4.967977E+01 1.542005E+01 4.967952E+01 1.542000E+01 4.967938E+01 END END
{ "pile_set_name": "Github" }
/* This file is part of the WebKit open source project. This file has been generated by generate-bindings.pl. DO NOT MODIFY! This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #pragma once #include "JSDOMWrapper.h" #include "JSEventTarget.h" namespace WebCore { class WorkletGlobalScope; class JSWorkletGlobalScope : public JSEventTarget { public: using Base = JSEventTarget; using DOMWrapped = WorkletGlobalScope; static JSWorkletGlobalScope* create(JSC::VM& vm, JSC::Structure* structure, Ref<WorkletGlobalScope>&& impl, JSC::JSProxy* proxy) { JSWorkletGlobalScope* ptr = new (NotNull, JSC::allocateCell<JSWorkletGlobalScope>(vm.heap)) JSWorkletGlobalScope(vm, structure, WTFMove(impl)); ptr->finishCreation(vm, proxy); return ptr; } static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); static WorkletGlobalScope* toWrapped(JSC::VM&, JSC::JSValue); DECLARE_INFO; static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), info(), JSC::NonArray); } static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); template<typename, JSC::SubspaceAccess mode> static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; return subspaceForImpl(vm); } static JSC::IsoSubspace* subspaceForImpl(JSC::VM& vm); static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); WorkletGlobalScope& wrapped() const { return static_cast<WorkletGlobalScope&>(Base::wrapped()); } protected: JSWorkletGlobalScope(JSC::VM&, JSC::Structure*, Ref<WorkletGlobalScope>&&); void finishCreation(JSC::VM&, JSC::JSProxy*); }; JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, WorkletGlobalScope&); inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, WorkletGlobalScope* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<WorkletGlobalScope>&&); inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<WorkletGlobalScope>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } class JSWorkletGlobalScopePrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; static JSWorkletGlobalScopePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) { JSWorkletGlobalScopePrototype* ptr = new (NotNull, JSC::allocateCell<JSWorkletGlobalScopePrototype>(vm.heap)) JSWorkletGlobalScopePrototype(vm, globalObject, structure); ptr->finishCreation(vm); return ptr; } DECLARE_INFO; template<typename CellType, JSC::SubspaceAccess> static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) { STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSWorkletGlobalScopePrototype, Base); return &vm.plainObjectSpace; } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); } private: JSWorkletGlobalScopePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(vm, structure) { } void finishCreation(JSC::VM&); }; STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSWorkletGlobalScopePrototype, JSWorkletGlobalScopePrototype::Base); template<> struct JSDOMWrapperConverterTraits<WorkletGlobalScope> { using WrapperClass = JSWorkletGlobalScope; using ToWrappedReturnType = WorkletGlobalScope*; }; } // namespace WebCore
{ "pile_set_name": "Github" }
/**************************************************************************** Copyright Echo Digital Audio Corporation (c) 1998 - 2004 All rights reserved www.echoaudio.com This file is part of Echo Digital Audio's generic driver library. Echo Digital Audio's generic driver library 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ************************************************************************* Translation from C++ and adaptation for use in ALSA-Driver were made by Giuliano Pochini <[email protected]> ****************************************************************************/ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe, int gain); static int update_vmixer_level(struct echoaudio *chip); static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) { int err; if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO)) return -ENODEV; if ((err = init_dsp_comm_page(chip))) { dev_err(chip->card->dev, "init_hw - could not initialize DSP comm page\n"); return err; } chip->device_id = device_id; chip->subdevice_id = subdevice_id; chip->bad_board = true; chip->dsp_code_to_load = FW_INDIGO_DSP; /* Since this card has no ASIC, mark it as loaded so everything works OK */ chip->asic_loaded = true; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; if ((err = load_firmware(chip)) < 0) return err; chip->bad_board = false; return err; } static int set_mixer_defaults(struct echoaudio *chip) { return init_line_levels(chip); } static u32 detect_input_clocks(const struct echoaudio *chip) { return ECHO_CLOCK_BIT_INTERNAL; } /* The Indigo has no ASIC. Just do nothing */ static int load_asic(struct echoaudio *chip) { return 0; } static int set_sample_rate(struct echoaudio *chip, u32 rate) { u32 control_reg; switch (rate) { case 96000: control_reg = MIA_96000; break; case 88200: control_reg = MIA_88200; break; case 48000: control_reg = MIA_48000; break; case 44100: control_reg = MIA_44100; break; case 32000: control_reg = MIA_32000; break; default: dev_err(chip->card->dev, "set_sample_rate: %d invalid!\n", rate); return -EINVAL; } /* Set the control register if it has changed */ if (control_reg != le32_to_cpu(chip->comm_page->control_register)) { if (wait_handshake(chip)) return -EIO; chip->comm_page->sample_rate = cpu_to_le32(rate); /* ignored by the DSP */ chip->comm_page->control_register = cpu_to_le32(control_reg); chip->sample_rate = rate; clear_handshake(chip); return send_vector(chip, DSP_VC_UPDATE_CLOCKS); } return 0; } /* This function routes the sound from a virtual channel to a real output */ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe, int gain) { int index; if (snd_BUG_ON(pipe >= num_pipes_out(chip) || output >= num_busses_out(chip))) return -EINVAL; if (wait_handshake(chip)) return -EIO; chip->vmixer_gain[output][pipe] = gain; index = output * num_pipes_out(chip) + pipe; chip->comm_page->vmixer[index] = gain; dev_dbg(chip->card->dev, "set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain); return 0; } /* Tell the DSP to read and update virtual mixer levels in comm page. */ static int update_vmixer_level(struct echoaudio *chip) { if (wait_handshake(chip)) return -EIO; clear_handshake(chip); return send_vector(chip, DSP_VC_SET_VMIXER_GAIN); }
{ "pile_set_name": "Github" }
+++ title = "windows_hotfix resource" draft = false platform = "windows" [menu] [menu.inspec] title = "windows_hotfix" identifier = "inspec/resources/os/windows_hotfix.md windows_hotfix resource" parent = "inspec/resources/os" +++ [\[edit on GitHub\]](https://github.com/inspec/inspec/blob/master/www/content/inspec/resources/windows_hotfix.md) Use the `windows_hotfix` Chef InSpec audit resource to test if the hotfix has been installed on a Windows system. ## Availability ### Installation This resource is distributed along with Chef InSpec itself. You can use it automatically. ### Version This resource first became available in v1.39.1 of InSpec. ## Syntax A `windows_hotfix` resource block declares a hotfix to validate: describe windows_hotfix('name') do it { should be_installed } end where - `('name')` must specify the name of a hotfix, such as `'KB4012213'` - `be_installed` is a valid matcher for this resource ## Examples The following examples show how to use this Chef InSpec audit resource. ### Test if KB4012213 is installed describe windows_hotfix('KB4012213') do it { should be_installed } end ### Test that a hotfix is not installed describe windows_hotfix('KB9999999') do it { should_not be_installed } end ## Matchers For a full list of available matchers, please visit our [matchers page](/inspec/matchers/). ### be_installed The `be_installed` matcher tests if the named hotfix is installed on the system: it { should be_installed }
{ "pile_set_name": "Github" }
# Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//third_party/protobuf/proto_library.gni") assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") component("attestation") { output_name = "chromeos_dbus_attestation" defines = [ "IS_CHROMEOS_DBUS_ATTESTATION_IMPL" ] deps = [ ":attestation_proto", "//base", "//dbus", ] sources = [ "attestation_client.cc", "attestation_client.h", "fake_attestation_client.cc", "fake_attestation_client.h", ] } proto_library("attestation_proto") { sources = [ "//third_party/cros_system_api/dbus/attestation/attestation_ca.proto", "//third_party/cros_system_api/dbus/attestation/interface.proto", "//third_party/cros_system_api/dbus/attestation/keystore.proto", ] proto_out_dir = "chromeos/dbus/attestation" }
{ "pile_set_name": "Github" }
// ==UserScript== // @name Mouse Gestures command file (with Wheel Gesture and Rocker Gesture) // @namespace http://space.geocities.yahoo.co.jp/gl/alice0775 // @description Commands for Lightweight customizable mouse gestures. Add Reload and Edit commands menu // @include main // @charset UTF-8 // @author Alice0775 // @compatibility 69 // @version 2019/05/21 08:30 fix 69.0a1 Bug 1551320 - Replace all createElement calls in XUL documents with createXULElement // @version 2019/01/21 01:00 reloadAllTabs to reloadTabs // @version 2018/09/30 03:00 add dispatchEvent command( dispatch event to content from chrome) // @version 2018/09/29 19:00 support zoomIn/Out/Reset for pdf.js // @version 2018/09/29 01:00 add commands list (commands popop, toggle style) // @version 2018/09/29 00:00 fix commands list (missing arguments webSearchPopup) // @version 2018/09/29 00:00 add commands list ("Closed Tabs Popup" and "Session History Popup") // @version 2018/09/28 23:20 fix, reload commands should be for all browser // @version 2018/09/28 22:50 fix bug forgot to overwrite // @version 2018/09/28 22:50 fix bug // @version 2018/09/28 22:00 // ==/UserScript== // @note MouseGestures2_e10s.uc.jsより後で読み込むようにしておく // @note このファイルで定義されたコマンドでMouseGestures2_e10s.uc.jsの定義を上書きします // @note This overwrites the command in the MouseGestures2_e10s.uc.js file // @note Linux and Mac are not supported. ucjsMouseGestures_menues = { defCommands: function() { // == config == // This overwrites the command in the MouseGestures2_e10s.uc.js file // These are the mouse gesture mappings. Customize this as you like. // Gesture Sequence, UDRL: right-click then move to up down right left // Wheel Gestures, W+ : right-click then wheel turn down , W- : left-click then wheel turn up // Rocker Gestures, L<R : right-click then left-click , L>R : left-click then right-click // Any Gesture Sequence, *hogehoge : Gesture Sequence following that any faesture // ucjsMouseGestures._lastX, ucjsMouseGestures._lastY : start coordinates // ucjsMouseGestures._linkURLs ,ucjsMouseGestures._linkdocURLs : link url hover, ownerDocument url // ucjsMouseGestures._selLinkURLs ,ucjsMouseGestures._selLinkdocURLs: link url in selected, ownerDocument url // ucjsMouseGestures._docURL : ownerDocument url // ucjsMouseGestures._linkURL ,ucjsMouseGestures._linkTXT : ownerDocument url : link url, ownerDocument url // ucjsMouseGestures._imgSRC _imgTYPE _imgDISP: src mime/type contentdisposition // ucjsMouseGestures._mediaSRC : media src // ucjsMouseGestures._selectedTXT : selected text // ucjsMouseGestures._version : browser major version try { ucjsMouseGestures.commands = [ ['L', '戻る', function(){ document.getElementById("Browser:Back").doCommand(); } ], ['R', '進む', function(){ document.getElementById("Browser:Forward").doCommand(); } ], ['', 'タブの履歴をポップアップ', function(){ ucjsMouseGestures_helper.sessionHistoryPopup(); } ], ['RULD', 'ひとつ上の階層へ移動', function(){ ucjsMouseGestures_helper.goUpperLevel(); } ], ['ULDR', '数値を増やして移動', function(){ ucjsMouseGestures_helper.goNumericURL(+1); } ], ['DLUR', '数値を減らして移動', function(){ ucjsMouseGestures_helper.goNumericURL(-1); } ], ['UD', 'リロード', function(){ document.getElementById("Browser:Reload").doCommand(); } ], ['UDU', 'リロード(キャッシュ無視)', function(){ document.getElementById("Browser:ReloadSkipCache").doCommand(); } ], ['', 'すべてタブをリロード', function(){ typeof gBrowser.reloadTabs == "function" ? gBrowser.reloadTabs(gBrowser.visibleTabs) : gBrowser.reloadAllTabs(); } ], ['', 'テキストリンクを新しいタブに開く', function(){ ucjsMouseGestures_helper.openURLsInSelection(); } ], ['*RDL', '選択範囲のリンクをすべてタブに開く', function(){ ucjsMouseGestures_helper.openSelectedLinksInTabs(); } ], ['*RUL', '通過したリンクをすべてタブに開く', function(){ ucjsMouseGestures_helper.openHoverLinksInTabs(); } ], ['', '選択したリンクを保存', function(){ ucjsMouseGestures_helper.saveHoverLinks(); } ], ['', '通過したリンクを保存', function(){ ucjsMouseGestures_helper.saveHoverLinks(); } ], ['', 'コピー', function(){ ucjsMouseGestures_helper.copyText(ucjsMouseGestures.selectedTXT); } ], ['', '通過したリンクをコピー', function(){ ucjsMouseGestures_helper.copyHoverLinks(); } ], ['', '選択したリンクをコピー', function(){ ucjsMouseGestures_helper.copySelectedLinks(); } ], ['UL', '前のタブ', function(){ gBrowser.tabContainer.advanceSelectedTab(-1, true); } ], ['UR', '次のタブ', function(){ gBrowser.tabContainer.advanceSelectedTab(+1, true); } ], ['', '新しいタブを開く', function(){ document.getElementById("cmd_newNavigatorTab").doCommand(); } ], ['', 'タブをピン留めトグル', function(){ var tab = gBrowser.selectedTab; tab.pinned ? gBrowser.unpinTab(tab) : gBrowser.pinTab(tab); } ], ['', 'タブを複製', function(){ var orgTab = gBrowser.selectedTab; var newTab = gBrowser.duplicateTab(orgTab); gBrowser.moveTabTo(newTab, orgTab._tPos + 1); } ], ['LD', 'タブを閉じる', function(){ document.getElementById("cmd_close").doCommand(); } ], ['', '左側のタブをすべて閉じる', function(){ ucjsMouseGestures_helper.closeMultipleTabs("left"); } ], ['', '右側のタブをすべて閉じる', function(){ ucjsMouseGestures_helper.closeMultipleTabs("right"); } ], ['', '他のタブをすべて閉じる', function(){ gBrowser.removeAllTabsBut(gBrowser.selectedTab); } ], ['DRU', '閉じたタブを元に戻す', function(){ document.getElementById("History:UndoCloseTab").doCommand(); } ], ['', '閉じたタブのリストをポップアップ', function(){ ucjsMouseGestures_helper.closedTabsPopup(); } ], ['', '最小化', function(){ window.minimize(); } ], ['', '最大化/元のサイズ', function(){ window.windowState == 1 ? window.restore() : window.maximize(); } ], ['LDRU', 'フルスクリーン', function(){ document.getElementById("View:FullScreen").doCommand(); } ], ['RU', '上端へスクロール', function(){ goDoCommand("cmd_scrollTop"); } ], ['RD', '下端へスクロール', function(){ goDoCommand("cmd_scrollBottom"); } ], ['U', '上へスクロール', function(){ goDoCommand("cmd_scrollPageUp"); } ], ['D', '下へスクロール', function(){ goDoCommand("cmd_scrollPageDown"); } ], ['W-', 'ズームイン', function(){ ucjsMouseGestures_helper.zoomIn(); } ], ['W+', 'ズームアウト', function(){ ucjsMouseGestures_helper.zoomOut(); } ], ['L<R', 'ズームリセット', function(){ ucjsMouseGestures_helper.zoomReset(); } ], ['DL', 'ページ内検索バー', function(){ if (ucjsMouseGestures._version <= "60") { if (gBrowser.getFindBar()) { gFindBar.hidden? gFindBar.onFindCommand(): gFindBar.close(); } else { gLazyFindCommand("onFindCommand"); } } else { // 61+ gBrowser.getFindBar().then(findbar => { findbar.hidden? findbar.onFindCommand(): findbar.close(); }); } } ], ['', '選択テキストで検索', function(){ BrowserSearch.loadSearchFromContext(ucjsMouseGestures._selectedTXT, Services.scriptSecurityManager.createNullPrincipal({})); } ], ['DRD', '選択テキストで検索(検索エンジンポップアップ)', function(){ ucjsMouseGestures_helper.webSearchPopup(ucjsMouseGestures._selectedTXT || ucjsMouseGestures._linkTXT); } ], ['DR', '選択テキストを検索バーにコピー', function(){ if (BrowserSearch.searchBar) BrowserSearch.searchBar.value = ucjsMouseGestures._selectedTXT || ucjsMouseGestures._linkTXT; } ], ['', 'CSS切り替え', function(){ var styleDisabled = gPageStyleMenu._getStyleSheetInfo(gBrowser.selectedBrowser).authorStyleDisabled; if (styleDisabled) gPageStyleMenu.switchStyleSheet(""); else gPageStyleMenu.disableStyle(); } ], ['UDUD', 'ジェスチャーコマンドをポップアップ', function(){ ucjsMouseGestures_helper.commandsPopop(); } ], ['', '再起動', function(){ ucjsMouseGestures_helper.restart(); } ], ['', 'ブックマークサイドバー', function(){ SidebarUI.toggle("viewBookmarksSidebar"); } ], ['', '履歴サイドバー', function(){ SidebarUI.toggle("viewHistorySidebar"); } ], ['', 'ブラウザーコンソール', function(){ ucjsMouseGestures_helper.openBrowserConsole(); } ], ['', 'weAutopagerizeのトグル', function(){ ucjsMouseGestures_helper.dispatchEvent( { target: "document", type: "AutoPagerizeToggleRequest" } ); } ], ]; // == /config == } catch(ex) { Services.console.logMessage(ex); } }, // == config == editor: "C:\\Program Files\\hidemaru\\hidemaru.exe", // editor: "/usr/bin/gedit", // == /config == load: function() { this.defCommands(); if (document.getElementById("ucjsMouseGestures_menues")) return; this.createMenu(); }, createMenu: function() { let ref = document.getElementById("menu_preferences"); let menu = document.createXULElement("menu"); menu.setAttribute("id", "ucjsMouseGestures_menues"); menu.setAttribute("label", "ucjsMouseGestures"); ref.parentNode.insertBefore(menu, ref); let menupopup = document.createXULElement("menupopup"); menu.appendChild(menupopup); let menuitem = document.createXULElement("menuitem"); menupopup.appendChild(menuitem); menuitem.setAttribute("id", "ucjsMouseGestures_menuepopup"); menuitem.setAttribute("label", "Reload commands"); menuitem.setAttribute("oncommand", "ucjsMouseGestures_menues.reloadCommands();"); menuitem = document.createXULElement("menuitem"); menupopup.appendChild(menuitem); menuitem.setAttribute("id", "ucjsMouseGestures_menues_launchEditor"); menuitem.setAttribute("label", "Edit commands"); menuitem.setAttribute("oncommand", "ucjsMouseGestures_menues.launchEditor();"); }, launchEditor: function() { var editor = this.editor; var UI = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].createInstance(Components.interfaces.nsIScriptableUnicodeConverter); var platform = window.navigator.platform.toLowerCase(); if(platform.indexOf('win') > -1){ UI.charset = 'Shift_JIS'; }else{ UI.charset = 'UTF-8'; } var path = Services.io.getProtocolHandler("file"). QueryInterface(Components.interfaces.nsIFileProtocolHandler). getFileFromURLSpec(this.getThisFileUrl()).path path = UI.ConvertFromUnicode(path); var appfile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsIFile); appfile.initWithPath(editor); var process = Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess); process.init(appfile); process.run(false, [path], 1, {}); }, getThisFileUrl: function() { return Error().fileName.split(' -> ').pop().split('?')[0]; }, reloadCommands: function() { let url = this.getThisFileUrl(); let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); let fileProtocolHandler = Services.io.getProtocolHandler("file"). QueryInterface(Ci.nsIFileProtocolHandler); let path = fileProtocolHandler.getFileFromURLSpec(url).path; file.initWithPath(path); let enumerator = Services.wm.getEnumerator("navigator:browser"); while (enumerator.hasMoreElements()) { let win = enumerator.getNext(); Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader) .loadSubScript(url + "?" + this.getLastModifiedTime(file), win, "utf-8"); } }, getLastModifiedTime: function(aFile) { Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService) .logStringMessage(aFile.lastModifiedTime); return aFile.lastModifiedTime; } } if (typeof ucjsMouseGestures != "undefined") ucjsMouseGestures_menues.load();
{ "pile_set_name": "Github" }
{ This file is part of Synopse framework. Synopse framework. Copyright (C) 2020 Arnaud Bouchez Synopse Informatique - http://synopse.info Scripting support for mORMot Copyright (C) 2020 Pavel Mashlyakovsky pavel.mash at gmail.com *** BEGIN LICENSE BLOCK ***** Version: MPL 1.1/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Pavel Mashlyakovsky. Portions created by the Initial Developer are Copyright (C) 2020 the Initial Developer. All Rights Reserved. Contributor(s): - Arnaud Bouchez Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. ***** END LICENSE BLOCK ***** Version 1.18 - initial release. Use SpiderMonkey 1.8.5 - defines some global conditionals used by SynSMAPI.pas and SynSM.pas } {$DEFINE IS_LITTLE_ENDIAN} //TODO add processor architecture check here or remove define and corresponding code below if FPC only for x32/64? {$DEFINE JS_THREADSAFE} // we MUST compile mozjs with JS_THREADSAFE directive {.$DEFINE SM_DEBUG} // for debuging SynSM {$DEFINE CONSIDER_TIME_IN_Z} // let serve all date-time as in GMT0 (UTC) timezone {.$DEFINE WITHASSERT} // ensure *TO_JSVAL() macros will check explicitly for the target type {$DEFINE CORE_MODULES_IN_RES} // core_modules is compiled into resources {$ifndef FPC} {$IFDEF CONDITIONALEXPRESSIONS} {$if CompilerVersion = 24.0} // see http://synopse.info/forum/viewtopic.php?pid=12598#p12598 {$define FIXBUGXE3} {$ifend} {$ELSE} Error: SyNode requires Delphi 7 of higher {$ENDIF} {$endif} {$IFNDEF SM52} {$DEFINE SM45} {$ENDIF}
{ "pile_set_name": "Github" }
do './hints/linux.pl' or die $@;
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pdfbox.cos; import java.io.ByteArrayOutputStream; import java.util.HashMap; import java.util.Map; /** * The "PDFDocEncoding" encoding. Note that this is *not* a Type 1 font encoding, it is used only * within PDF "text strings". */ final class PDFDocEncoding { private static final char REPLACEMENT_CHARACTER = '\uFFFD'; private static final int[] CODE_TO_UNI; private static final Map<Character, Integer> UNI_TO_CODE; static { CODE_TO_UNI = new int[256]; UNI_TO_CODE = new HashMap<>(256); // initialize with basically ISO-8859-1 for (int i = 0; i < 256; i++) { // skip entries not in Unicode column if (i > 0x17 && i < 0x20) { continue; } if (i > 0x7E && i < 0xA1) { continue; } if (i == 0xAD) { continue; } set(i, (char)i); } // then do all deviations (based on the table in ISO 32000-1:2008) // block 1 set(0x18, '\u02D8'); // BREVE set(0x19, '\u02C7'); // CARON set(0x1A, '\u02C6'); // MODIFIER LETTER CIRCUMFLEX ACCENT set(0x1B, '\u02D9'); // DOT ABOVE set(0x1C, '\u02DD'); // DOUBLE ACUTE ACCENT set(0x1D, '\u02DB'); // OGONEK set(0x1E, '\u02DA'); // RING ABOVE set(0x1F, '\u02DC'); // SMALL TILDE // block 2 set(0x7F, REPLACEMENT_CHARACTER); // undefined set(0x80, '\u2022'); // BULLET set(0x81, '\u2020'); // DAGGER set(0x82, '\u2021'); // DOUBLE DAGGER set(0x83, '\u2026'); // HORIZONTAL ELLIPSIS set(0x84, '\u2014'); // EM DASH set(0x85, '\u2013'); // EN DASH set(0x86, '\u0192'); // LATIN SMALL LETTER SCRIPT F set(0x87, '\u2044'); // FRACTION SLASH (solidus) set(0x88, '\u2039'); // SINGLE LEFT-POINTING ANGLE QUOTATION MARK set(0x89, '\u203A'); // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK set(0x8A, '\u2212'); // MINUS SIGN set(0x8B, '\u2030'); // PER MILLE SIGN set(0x8C, '\u201E'); // DOUBLE LOW-9 QUOTATION MARK (quotedblbase) set(0x8D, '\u201C'); // LEFT DOUBLE QUOTATION MARK (quotedblleft) set(0x8E, '\u201D'); // RIGHT DOUBLE QUOTATION MARK (quotedblright) set(0x8F, '\u2018'); // LEFT SINGLE QUOTATION MARK (quoteleft) set(0x90, '\u2019'); // RIGHT SINGLE QUOTATION MARK (quoteright) set(0x91, '\u201A'); // SINGLE LOW-9 QUOTATION MARK (quotesinglbase) set(0x92, '\u2122'); // TRADE MARK SIGN set(0x93, '\uFB01'); // LATIN SMALL LIGATURE FI set(0x94, '\uFB02'); // LATIN SMALL LIGATURE FL set(0x95, '\u0141'); // LATIN CAPITAL LETTER L WITH STROKE set(0x96, '\u0152'); // LATIN CAPITAL LIGATURE OE set(0x97, '\u0160'); // LATIN CAPITAL LETTER S WITH CARON set(0x98, '\u0178'); // LATIN CAPITAL LETTER Y WITH DIAERESIS set(0x99, '\u017D'); // LATIN CAPITAL LETTER Z WITH CARON set(0x9A, '\u0131'); // LATIN SMALL LETTER DOTLESS I set(0x9B, '\u0142'); // LATIN SMALL LETTER L WITH STROKE set(0x9C, '\u0153'); // LATIN SMALL LIGATURE OE set(0x9D, '\u0161'); // LATIN SMALL LETTER S WITH CARON set(0x9E, '\u017E'); // LATIN SMALL LETTER Z WITH CARON set(0x9F, REPLACEMENT_CHARACTER); // undefined set(0xA0, '\u20AC'); // EURO SIGN // end of deviations } private PDFDocEncoding() { } private static void set(int code, char unicode) { CODE_TO_UNI[code] = unicode; UNI_TO_CODE.put(unicode, code); } /** * Returns the string representation of the given PDFDocEncoded bytes. */ public static String toString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (byte b : bytes) { if ((b & 0xff) >= CODE_TO_UNI.length) { sb.append('?'); } else { sb.append((char)CODE_TO_UNI[b & 0xff]); } } return sb.toString(); } /** * Returns the given string encoded with PDFDocEncoding. */ public static byte[] getBytes(String text) { ByteArrayOutputStream out = new ByteArrayOutputStream(); for (char c : text.toCharArray()) { Integer code = UNI_TO_CODE.get(c); if (code == null) { out.write(0); } else { out.write(code); } } return out.toByteArray(); } /** * Returns true if the given character is available in PDFDocEncoding. * * @param character UTF-16 character */ public static boolean containsChar(char character) { return UNI_TO_CODE.containsKey(character); } }
{ "pile_set_name": "Github" }
# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat)](https://travis-ci.org/jonschlinkert/isobject) Returns true if the value is an object and not an array or null. ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install isobject --save ``` Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor. ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install isobject ``` Install with [bower](http://bower.io/) ```sh $ bower install isobject ``` ## Usage ```js var isObject = require('isobject'); ``` **True** All of the following return `true`: ```js isObject({}); isObject(Object.create({})); isObject(Object.create(Object.prototype)); isObject(Object.create(null)); isObject({}); isObject(new Foo); isObject(/foo/); ``` **False** All of the following return `false`: ```js isObject(); isObject(function () {}); isObject(1); isObject([]); isObject(undefined); isObject(null); ``` ## Related projects You might also be interested in these projects: [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) * [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow) * [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object) * [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of) ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/isobject/issues/new). ## Building docs Generate readme and API documentation with [verb](https://github.com/verbose/verb): ```sh $ npm install verb && npm run docs ``` Or, if [verb](https://github.com/verbose/verb) is installed globally: ```sh $ verb ``` ## Running tests Install dev dependencies: ```sh $ npm install -d && npm test ``` ## Author **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). Released under the [MIT license](https://github.com/jonschlinkert/isobject/blob/master/LICENSE). *** _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 25, 2016._
{ "pile_set_name": "Github" }
module Mocha # :nodoc: class ExpectationList def initialize @expectations = [] end def add(expectation) @expectations.unshift(expectation) expectation end def matches_method?(method_name) @expectations.any? { |expectation| expectation.matches_method?(method_name) } end def match(method_name, *arguments) matching_expectations(method_name, *arguments).first end def match_allowing_invocation(method_name, *arguments) matching_expectations(method_name, *arguments).detect { |e| e.invocations_allowed? } end def verified?(assertion_counter = nil) @expectations.all? { |expectation| expectation.verified?(assertion_counter) } end def to_a @expectations end def to_set @expectations.to_set end def length @expectations.length end private def matching_expectations(method_name, *arguments) @expectations.select { |e| e.match?(method_name, *arguments) } end end end
{ "pile_set_name": "Github" }
const rowWeights = require('.') test('Test 1', () => { expect(rowWeights([80])).toEqual([80, 0]) }) test('Test 2', () => { expect(rowWeights([100, 50])).toEqual([100, 50]) }) test('Test 3', () => { expect(rowWeights([50, 60, 70, 80])).toEqual([120, 140]) }) test('Test 4', () => { expect(rowWeights([13, 27, 49])).toEqual([62, 27]) }) test('Test 5', () => { expect(rowWeights([70, 58, 75, 34, 91])).toEqual([236, 92]) }) test('Test 6', () => { expect(rowWeights([29, 83, 67, 53, 19, 28, 96])).toEqual([211, 164]) }) test('Test 7', () => { expect(rowWeights([0])).toEqual([0, 0]) }) test('Test 8', () => { expect(rowWeights([100, 51, 50, 100])).toEqual([150, 151]) }) test('Test 9', () => { expect(rowWeights([39, 84, 74, 18, 59, 72, 35, 61])).toEqual([207, 235]) }) test('Test 10', () => { expect(rowWeights([0, 1, 0])).toEqual([0, 1]) })
{ "pile_set_name": "Github" }
/* Base16 Atelier Plateau Light - Theme */ /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ /* Atelier-Plateau Comment */ .hljs-comment, .hljs-quote { color: #655d5d; } /* Atelier-Plateau Red */ .hljs-variable, .hljs-template-variable, .hljs-attribute, .hljs-tag, .hljs-name, .hljs-regexp, .hljs-link, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #ca4949; } /* Atelier-Plateau Orange */ .hljs-number, .hljs-meta, .hljs-built_in, .hljs-builtin-name, .hljs-literal, .hljs-type, .hljs-params { color: #b45a3c; } /* Atelier-Plateau Green */ .hljs-string, .hljs-symbol, .hljs-bullet { color: #4b8b8b; } /* Atelier-Plateau Blue */ .hljs-title, .hljs-section { color: #7272ca; } /* Atelier-Plateau Purple */ .hljs-keyword, .hljs-selector-tag { color: #8464c4; } .hljs-deletion, .hljs-addition { color: #1b1818; display: inline-block; width: 100%; } .hljs-deletion { background-color: #ca4949; } .hljs-addition { background-color: #4b8b8b; } .hljs { display: block; overflow-x: auto; background: #f4ecec; color: #585050; padding: 0.5em; } .hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: bold; }
{ "pile_set_name": "Github" }
<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> <!-- ##Style: common --> <!-- ****************************************************************** --> <!-- ***************** FORCED ARTIFICIAL ITALIC / BOLD **************** --> <!-- ****************************************************************** --> <!-- "Unforced" artificial/italic already included in /etc/fonts/conf.d/ rules --> <!-- Force artificial italic instead of the font's default italic --> <!-- In rare cases this is more visually appealing --> <!-- Set the flag --> <!-- !!!! Somehow this breaks Qt unfortunately !!!! --> <match target="pattern"> <test target="font" name="family"> <string>FONT NAME HERE</string> </test> <!-- match requests for non-roman face --> <test name="slant" compare="not_eq"> <const>roman</const> </test> <!-- remember that this should be slanted --> <edit name="fake_slant" mode="assign"> <bool>true</bool> </edit> <!--- change to match a roman face instead --> <edit name="slant" mode="assign"> <const>roman</const> </edit> </match> <!-- Force flagged fonts to have artificial oblique --> <match target="font"> <!-- check to see if the font is roman --> <test name="slant"> <const>roman</const> </test> <!-- look for fonts which were marked for fake obliquing --> <test name="fake_slant"> <bool>true</bool> </test> <!-- multiply the matrix to slant the font --> <edit name="matrix" mode="assign"> <times> <name>matrix</name> <matrix> <double>1.0</double> <double>0.2</double> <double>0</double> <double>1</double> </matrix> </times> </edit> <!-- pretend the font is oblique now --> <edit name="slant" mode="assign"> <const>oblique</const> </edit> </match> <!-- Force fake bold instead of the font's default bold --> <!-- In rare cases this is more visually appealing --> <!-- !!!! Somehow this breaks Qt unfortunately !!!! --> <!-- Set the flag --> <match target="pattern"> <test name="family"> <string>YOUR FONT HERE</string> </test> <!-- match requests for bold face --> <test name="weight" compare="more"> <const>medium</const> </test> <!-- remember that this should be bolded --> <edit name="fake_bold" mode="assign"> <bool>true</bool> </edit> <!--- change to match a medium weight instead --> <edit name="weight" mode="assign"> <const>medium</const> </edit> </match> <!-- Force flagged fonts to have artificial bold --> <match target="font"> <!-- look for fonts which were marked for fake bolding --> <test name="fake_bold"> <bool>true</bool> </test> <!-- Set the embolden flag --> <edit name="embolden" mode="assign"> <bool>true</bool> </edit> <!-- pretend the font is bold now --> <edit name="weight" mode="assign"> <const>bold</const> </edit> </match> </fontconfig>
{ "pile_set_name": "Github" }
{ "expr": "$formatNumber(123.9, \"9999\")", "dataset": null, "bindings": {}, "result": "0124" }
{ "pile_set_name": "Github" }