text
stringlengths 2
100k
| meta
dict |
---|---|
//
// MCSDemoFishEyeItem.h
// FishEyeDemo
//
// Created by Bartosz Ciechanowski on 8/30/13.
// Copyright (c) 2013 Macoscope. All rights reserved.
//
#import "MCSFishEyeViewItem.h"
@interface MCSDemoFishEyeItem : MCSFishEyeViewItem
@property (nonatomic, strong, readonly) UIView *backgroundView;
@property (nonatomic, strong, readonly) UILabel *label;
@end
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: Apache-2.0 -->
<!-- Copyright Contributors to the ODPi Egeria project. -->
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>open-metadata-docker</artifactId>
<groupId>org.odpi.egeria</groupId>
<version>2.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<scm>
<connection>scm:git:git://github.com/odpi/egeria.git</connection>
<developerConnection>scm:git:ssh://github.com/odpi/egeria.git</developerConnection>
<url>http://github.com/odpi/egeria/tree/master</url>
</scm>
<name>Docker build-time images</name>
<description>
Build images for Docker runtime images
</description>
<artifactId>open-metadata-docker-build</artifactId>
<packaging>pom</packaging>
<modules>
<module>apache</module>
</modules>
</project>
|
{
"pile_set_name": "Github"
}
|
/*
* JBoss, Home of Professional Open Source.
* Copyright (c) 2011, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.ejb3.component.pool;
import org.jboss.as.ee.component.Component;
import org.jboss.as.ee.component.ComponentInstance;
import org.jboss.as.ejb3.pool.Pool;
/**
* @author <a href="mailto:[email protected]">Carlo de Wolf</a>
*/
public interface PooledComponent<I extends ComponentInstance> extends Component {
Pool<I> getPool();
String getPoolName();
}
|
{
"pile_set_name": "Github"
}
|
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# for py2/py3 compatibility
from __future__ import print_function
print("""
1
v8-foozzie source: name/to/a/file.js
2
v8-foozzie source: name/to/file.js
weird other error
^
3
not unknown
""")
|
{
"pile_set_name": "Github"
}
|
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
import * as Stories from './examples';
<Meta title="Components|Button" />
# Button
A basic button component. Supports a minimal level of customization. You can
build your own custom button using `TouchableOpacity` or `TouchableHighlight`.
## Props
| Name | Type | Default |
| ------------------------- | --------- | ------- |
| accessibilityLabel | ?string | |
| color | ?string | '#2196F3' |
| disabled | ?boolean | false |
| onPress | ?Function | |
| testID | ?string | |
| title | ?string | |
### color
Customize the background color of the button.
<Preview withSource='none'>
<Story name="color">
<Stories.color />
</Story>
</Preview>
### disabled
Prevent all interactions with the button.
<Preview withSource='none'>
<Story name="disabled">
<Stories.disabled />
</Story>
</Preview>
### onPress
Called when the button is pressed by a pointer or keyboard.
<Preview withSource='none'>
<Story name="onPress">
<Stories.onPress /></Story>
</Preview>
### title
Text to display inside the button.
```js
<Button title="Text content" />
```
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/v25/common"
"net/http"
)
// GetBootVolumeAttachmentRequest wrapper for the GetBootVolumeAttachment operation
type GetBootVolumeAttachmentRequest struct {
// The OCID of the boot volume attachment.
BootVolumeAttachmentId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeAttachmentId"`
// Unique Oracle-assigned identifier for the request.
// If you need to contact Oracle about a particular request, please provide the request ID.
OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request GetBootVolumeAttachmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request GetBootVolumeAttachmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request GetBootVolumeAttachmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// GetBootVolumeAttachmentResponse wrapper for the GetBootVolumeAttachment operation
type GetBootVolumeAttachmentResponse struct {
// The underlying http response
RawResponse *http.Response
// The BootVolumeAttachment instance
BootVolumeAttachment `presentIn:"body"`
// For optimistic concurrency control. See `if-match`.
Etag *string `presentIn:"header" name:"etag"`
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}
func (response GetBootVolumeAttachmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response GetBootVolumeAttachmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2010-2020 Redgate Software Ltd
*
* 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.flywaydb.core.internal.database.postgresql;
import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.internal.jdbc.JdbcTemplate;
import org.flywaydb.core.internal.jdbc.Result;
import org.flywaydb.core.internal.jdbc.Results;
import org.flywaydb.core.internal.sqlscript.Delimiter;
import org.flywaydb.core.internal.sqlscript.ParsedSqlStatement;
import org.flywaydb.core.internal.sqlscript.SqlScriptExecutor;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
/**
* A PostgreSQL COPY FROM STDIN statement.
*/
public class PostgreSQLCopyParsedStatement extends ParsedSqlStatement {
/**
* Delimiter of COPY statements.
*/
private static final Delimiter COPY_DELIMITER = new Delimiter("\\.", true
);
private final String copyData;
/**
* Creates a new PostgreSQL COPY ... FROM STDIN statement.
*/
public PostgreSQLCopyParsedStatement(int pos, int line, int col, String sql, String copyData) {
super(pos, line, col, sql, COPY_DELIMITER, true
);
this.copyData = copyData;
}
@Override
public Results execute(JdbcTemplate jdbcTemplate
) {
// #2355: Use reflection to ensure this works in cases where the PostgreSQL driver classes were loaded in a
// child URLClassLoader instead of the system classloader.
Object baseConnection;
Object copyManager;
Method copyManagerCopyInMethod;
try {
Connection connection = jdbcTemplate.getConnection();
ClassLoader classLoader = connection.getClass().getClassLoader();
Class<?> baseConnectionClass = classLoader.loadClass("org.postgresql.core.BaseConnection");
baseConnection = connection.unwrap(baseConnectionClass);
Class<?> copyManagerClass = classLoader.loadClass("org.postgresql.copy.CopyManager");
Constructor<?> copyManagerConstructor = copyManagerClass.getConstructor(baseConnectionClass);
copyManagerCopyInMethod = copyManagerClass.getMethod("copyIn", String.class, Reader.class);
copyManager = copyManagerConstructor.newInstance(baseConnection);
} catch (Exception e) {
throw new FlywayException("Unable to find PostgreSQL CopyManager class", e);
}
Results results = new Results();
try {
try {
Long updateCount = (Long) copyManagerCopyInMethod.invoke(copyManager, getSql(), new StringReader(copyData));
results.addResult(new Result(updateCount, null, null, getSql()));
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SQLException("Unable to execute COPY operation", e);
}
} catch (SQLException e) {
jdbcTemplate.extractErrors(results, e);
}
return results;
}
}
|
{
"pile_set_name": "Github"
}
|
/** @file
Pei Core Reset System Support
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "PeiMain.h"
/**
Core version of the Reset System
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@retval EFI_NOT_AVAILABLE_YET PPI not available yet.
@retval EFI_DEVICE_ERROR Did not reset system.
Otherwise, resets the system.
**/
EFI_STATUS
EFIAPI
PeiResetSystem (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
EFI_STATUS Status;
EFI_PEI_RESET_PPI *ResetPpi;
//
// Attempt to use newer ResetSystem2(). If this returns, then ResetSystem2()
// is not available.
//
PeiResetSystem2 (EfiResetCold, EFI_SUCCESS, 0, NULL);
//
// Look for PEI Reset System PPI
//
Status = PeiServicesLocatePpi (
&gEfiPeiResetPpiGuid,
0,
NULL,
(VOID **)&ResetPpi
);
if (!EFI_ERROR (Status)) {
return ResetPpi->ResetSystem (PeiServices);
}
//
// Report Status Code that Reset PPI is not available.
//
REPORT_STATUS_CODE (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
(EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)
);
//
// No reset PPIs are available yet.
//
return EFI_NOT_AVAILABLE_YET;
}
/**
Resets the entire platform.
@param[in] ResetType The type of reset to perform.
@param[in] ResetStatus The status code for the reset.
@param[in] DataSize The size, in bytes, of ResetData.
@param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
the data buffer starts with a Null-terminated string, optionally
followed by additional binary data. The string is a description
that the caller may use to further indicate the reason for the
system reset. ResetData is only valid if ResetStatus is something
other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
where a minimum amount of ResetData is always required.
**/
VOID
EFIAPI
PeiResetSystem2 (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,
IN UINTN DataSize,
IN VOID *ResetData OPTIONAL
)
{
EFI_STATUS Status;
EFI_PEI_RESET2_PPI *Reset2Ppi;
//
// Look for PEI Reset System 2 PPI
//
Status = PeiServicesLocatePpi (
&gEfiPeiReset2PpiGuid,
0,
NULL,
(VOID **)&Reset2Ppi
);
if (!EFI_ERROR (Status)) {
Reset2Ppi->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
return;
}
//
// Report Status Code that Reset2 PPI is not available.
//
REPORT_STATUS_CODE (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
(EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)
);
}
|
{
"pile_set_name": "Github"
}
|
#ifndef BOOST_THREAD_THREAD_COMMON_HPP
#define BOOST_THREAD_THREAD_COMMON_HPP
// 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)
// (C) Copyright 2007-2010 Anthony Williams
// (C) Copyright 2011-2012 Vicente J. Botet Escriba
#include <boost/thread/detail/config.hpp>
#include <boost/predef/platform.h>
#include <boost/thread/exceptions.hpp>
#ifndef BOOST_NO_IOSTREAM
#include <ostream>
#endif
#include <boost/thread/detail/move.hpp>
#include <boost/thread/mutex.hpp>
#if defined BOOST_THREAD_USES_DATETIME
#include <boost/thread/xtime.hpp>
#endif
#include <boost/thread/detail/thread_heap_alloc.hpp>
#include <boost/thread/detail/make_tuple_indices.hpp>
#include <boost/thread/detail/invoke.hpp>
#include <boost/thread/detail/is_convertible.hpp>
#include <boost/assert.hpp>
#include <list>
#include <algorithm>
#include <boost/core/ref.hpp>
#include <boost/cstdint.hpp>
#include <boost/bind.hpp>
#include <stdlib.h>
#include <memory>
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/io/ios_state.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/decay.hpp>
#include <boost/functional/hash.hpp>
#include <boost/thread/detail/platform_time.hpp>
#ifdef BOOST_THREAD_USES_CHRONO
#include <boost/chrono/system_clocks.hpp>
#include <boost/chrono/ceil.hpp>
#endif
#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
#include <tuple>
#endif
#include <boost/config/abi_prefix.hpp>
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4251)
#endif
namespace boost
{
namespace detail
{
#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
template<typename F, class ...ArgTypes>
class thread_data:
public detail::thread_data_base
{
public:
BOOST_THREAD_NO_COPYABLE(thread_data)
thread_data(BOOST_THREAD_RV_REF(F) f_, BOOST_THREAD_RV_REF(ArgTypes)... args_):
fp(boost::forward<F>(f_), boost::forward<ArgTypes>(args_)...)
{}
template <std::size_t ...Indices>
void run2(tuple_indices<Indices...>)
{
detail::invoke(std::move(std::get<0>(fp)), std::move(std::get<Indices>(fp))...);
}
void run()
{
typedef typename make_tuple_indices<std::tuple_size<std::tuple<F, ArgTypes...> >::value, 1>::type index_type;
run2(index_type());
}
private:
std::tuple<typename decay<F>::type, typename decay<ArgTypes>::type...> fp;
};
#else // defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
template<typename F>
class thread_data:
public detail::thread_data_base
{
public:
BOOST_THREAD_NO_COPYABLE(thread_data)
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
thread_data(BOOST_THREAD_RV_REF(F) f_):
f(boost::forward<F>(f_))
{}
// This overloading must be removed if we want the packaged_task's tests to pass.
// thread_data(F& f_):
// f(f_)
// {}
#else
thread_data(BOOST_THREAD_RV_REF(F) f_):
f(f_)
{}
thread_data(F f_):
f(f_)
{}
#endif
//thread_data() {}
void run()
{
f();
}
private:
F f;
};
template<typename F>
class thread_data<boost::reference_wrapper<F> >:
public detail::thread_data_base
{
private:
F& f;
public:
BOOST_THREAD_NO_COPYABLE(thread_data)
thread_data(boost::reference_wrapper<F> f_):
f(f_)
{}
void run()
{
f();
}
};
template<typename F>
class thread_data<const boost::reference_wrapper<F> >:
public detail::thread_data_base
{
private:
F& f;
public:
BOOST_THREAD_NO_COPYABLE(thread_data)
thread_data(const boost::reference_wrapper<F> f_):
f(f_)
{}
void run()
{
f();
}
};
#endif
}
class BOOST_THREAD_DECL thread
{
public:
typedef thread_attributes attributes;
BOOST_THREAD_MOVABLE_ONLY(thread)
protected:
struct dummy;
void release_handle();
detail::thread_data_ptr thread_info;
protected:
bool start_thread_noexcept();
bool start_thread_noexcept(const attributes& attr);
void start_thread()
{
if (!start_thread_noexcept())
{
boost::throw_exception(thread_resource_error());
}
}
void start_thread(const attributes& attr)
{
if (!start_thread_noexcept(attr))
{
boost::throw_exception(thread_resource_error());
}
}
explicit thread(detail::thread_data_ptr data);
detail::thread_data_ptr get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const;
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
template<typename F, class ...ArgTypes>
static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_RV_REF(ArgTypes)... args)
{
return detail::thread_data_ptr(detail::heap_new<
detail::thread_data<typename boost::remove_reference<F>::type, ArgTypes...>
>(
boost::forward<F>(f), boost::forward<ArgTypes>(args)...
)
);
}
#else
template<typename F>
static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f)
{
return detail::thread_data_ptr(detail::heap_new<detail::thread_data<typename boost::remove_reference<F>::type> >(
boost::forward<F>(f)));
}
#endif
static inline detail::thread_data_ptr make_thread_info(void (*f)())
{
return detail::thread_data_ptr(detail::heap_new<detail::thread_data<void(*)()> >(
boost::forward<void(*)()>(f)));
}
#else
template<typename F>
static inline detail::thread_data_ptr make_thread_info(F f
, typename disable_if_c<
//boost::thread_detail::is_convertible<F&,BOOST_THREAD_RV_REF(F)>::value ||
is_same<typename decay<F>::type, thread>::value,
dummy* >::type=0
)
{
return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(f));
}
template<typename F>
static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f)
{
return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(f));
}
#endif
public:
#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF.
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
thread(const volatile thread&);
#endif
#endif
thread() BOOST_NOEXCEPT;
~thread()
{
#if defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
if (joinable()) {
std::terminate();
}
#else
detach();
#endif
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <
class F
>
explicit thread(BOOST_THREAD_RV_REF(F) f
//, typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0
):
thread_info(make_thread_info(thread_detail::decay_copy(boost::forward<F>(f))))
{
start_thread();
}
template <
class F
>
thread(attributes const& attrs, BOOST_THREAD_RV_REF(F) f):
thread_info(make_thread_info(thread_detail::decay_copy(boost::forward<F>(f))))
{
start_thread(attrs);
}
#else
#ifdef BOOST_NO_SFINAE
template <class F>
explicit thread(F f):
thread_info(make_thread_info(f))
{
start_thread();
}
template <class F>
thread(attributes const& attrs, F f):
thread_info(make_thread_info(f))
{
start_thread(attrs);
}
#else
template <class F>
explicit thread(F f
, typename disable_if_c<
boost::thread_detail::is_rv<F>::value // todo as a thread_detail::is_rv
//boost::thread_detail::is_convertible<F&,BOOST_THREAD_RV_REF(F)>::value
//|| is_same<typename decay<F>::type, thread>::value
, dummy* >::type=0
):
thread_info(make_thread_info(f))
{
start_thread();
}
template <class F>
thread(attributes const& attrs, F f
, typename disable_if<boost::thread_detail::is_rv<F>, dummy* >::type=0
//, typename disable_if<boost::thread_detail::is_convertible<F&,BOOST_THREAD_RV_REF(F) >, dummy* >::type=0
):
thread_info(make_thread_info(f))
{
start_thread(attrs);
}
#endif
template <class F>
explicit thread(BOOST_THREAD_RV_REF(F) f
, typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0
):
#ifdef BOOST_THREAD_USES_MOVE
thread_info(make_thread_info(boost::move<F>(f))) // todo : Add forward
#else
thread_info(make_thread_info(f)) // todo : Add forward
#endif
{
start_thread();
}
template <class F>
thread(attributes const& attrs, BOOST_THREAD_RV_REF(F) f):
#ifdef BOOST_THREAD_USES_MOVE
thread_info(make_thread_info(boost::move<F>(f))) // todo : Add forward
#else
thread_info(make_thread_info(f)) // todo : Add forward
#endif
{
start_thread(attrs);
}
#endif
thread(BOOST_THREAD_RV_REF(thread) x) BOOST_NOEXCEPT
{
thread_info=BOOST_THREAD_RV(x).thread_info;
BOOST_THREAD_RV(x).thread_info.reset();
}
#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF.
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
thread& operator=(thread x)
{
swap(x);
return *this;
}
#endif
#endif
thread& operator=(BOOST_THREAD_RV_REF(thread) other) BOOST_NOEXCEPT
{
#if defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
if (joinable()) std::terminate();
#else
detach();
#endif
thread_info=BOOST_THREAD_RV(other).thread_info;
BOOST_THREAD_RV(other).thread_info.reset();
return *this;
}
#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
template <class F, class Arg, class ...Args>
thread(F&& f, Arg&& arg, Args&&... args) :
thread_info(make_thread_info(
thread_detail::decay_copy(boost::forward<F>(f)),
thread_detail::decay_copy(boost::forward<Arg>(arg)),
thread_detail::decay_copy(boost::forward<Args>(args))...)
)
{
start_thread();
}
template <class F, class Arg, class ...Args>
thread(attributes const& attrs, F&& f, Arg&& arg, Args&&... args) :
thread_info(make_thread_info(
thread_detail::decay_copy(boost::forward<F>(f)),
thread_detail::decay_copy(boost::forward<Arg>(arg)),
thread_detail::decay_copy(boost::forward<Args>(args))...)
)
{
start_thread(attrs);
}
#else
template <class F,class A1>
thread(F f,A1 a1,typename disable_if<boost::thread_detail::is_convertible<F&,thread_attributes >, dummy* >::type=0):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1)))
{
start_thread();
}
template <class F,class A1,class A2>
thread(F f,A1 a1,A2 a2):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2)))
{
start_thread();
}
template <class F,class A1,class A2,class A3>
thread(F f,A1 a1,A2 a2,A3 a3):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3)))
{
start_thread();
}
template <class F,class A1,class A2,class A3,class A4>
thread(F f,A1 a1,A2 a2,A3 a3,A4 a4):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4)))
{
start_thread();
}
template <class F,class A1,class A2,class A3,class A4,class A5>
thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5)))
{
start_thread();
}
template <class F,class A1,class A2,class A3,class A4,class A5,class A6>
thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6)))
{
start_thread();
}
template <class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7>
thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6,a7)))
{
start_thread();
}
template <class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7,class A8>
thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6,a7,a8)))
{
start_thread();
}
template <class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7,class A8,class A9>
thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6,a7,a8,a9)))
{
start_thread();
}
#endif
void swap(thread& x) BOOST_NOEXCEPT
{
thread_info.swap(x.thread_info);
}
class id;
id get_id() const BOOST_NOEXCEPT;
bool joinable() const BOOST_NOEXCEPT;
private:
bool join_noexcept();
bool do_try_join_until_noexcept(detail::internal_platform_timepoint const &timeout, bool& res);
bool do_try_join_until(detail::internal_platform_timepoint const &timeout);
public:
void join();
#ifdef BOOST_THREAD_USES_CHRONO
template <class Duration>
bool try_join_until(const chrono::time_point<detail::internal_chrono_clock, Duration>& t)
{
return do_try_join_until(boost::detail::internal_platform_timepoint(t));
}
template <class Clock, class Duration>
bool try_join_until(const chrono::time_point<Clock, Duration>& t)
{
typedef typename common_type<Duration, typename Clock::duration>::type common_duration;
common_duration d(t - Clock::now());
d = (std::min)(d, common_duration(chrono::milliseconds(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS)));
while ( ! try_join_until(detail::internal_chrono_clock::now() + d) )
{
d = t - Clock::now();
if ( d <= common_duration::zero() ) return false; // timeout occurred
d = (std::min)(d, common_duration(chrono::milliseconds(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS)));
}
return true;
}
template <class Rep, class Period>
bool try_join_for(const chrono::duration<Rep, Period>& rel_time)
{
return try_join_until(chrono::steady_clock::now() + rel_time);
}
#endif
#if defined BOOST_THREAD_USES_DATETIME
bool timed_join(const system_time& abs_time)
{
const detail::real_platform_timepoint ts(abs_time);
#if defined BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
detail::platform_duration d(ts - detail::real_platform_clock::now());
d = (std::min)(d, detail::platform_milliseconds(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS));
while ( ! do_try_join_until(detail::internal_platform_clock::now() + d) )
{
d = ts - detail::real_platform_clock::now();
if ( d <= detail::platform_duration::zero() ) return false; // timeout occurred
d = (std::min)(d, detail::platform_milliseconds(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS));
}
return true;
#else
return do_try_join_until(ts);
#endif
}
template<typename TimeDuration>
bool timed_join(TimeDuration const& rel_time)
{
detail::platform_duration d(rel_time);
#if defined(BOOST_THREAD_HAS_MONO_CLOCK) && !defined(BOOST_THREAD_INTERNAL_CLOCK_IS_MONO)
const detail::mono_platform_timepoint ts(detail::mono_platform_clock::now() + d);
d = (std::min)(d, detail::platform_milliseconds(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS));
while ( ! do_try_join_until(detail::internal_platform_clock::now() + d) )
{
d = ts - detail::mono_platform_clock::now();
if ( d <= detail::platform_duration::zero() ) return false; // timeout occurred
d = (std::min)(d, detail::platform_milliseconds(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS));
}
return true;
#else
return do_try_join_until(detail::internal_platform_clock::now() + d);
#endif
}
#endif
void detach();
static unsigned hardware_concurrency() BOOST_NOEXCEPT;
static unsigned physical_concurrency() BOOST_NOEXCEPT;
#define BOOST_THREAD_DEFINES_THREAD_NATIVE_HANDLE
typedef detail::thread_data_base::native_handle_type native_handle_type;
native_handle_type native_handle();
#if defined BOOST_THREAD_PROVIDES_THREAD_EQ
// Use thread::id when comparisions are needed
// backwards compatibility
bool operator==(const thread& other) const;
bool operator!=(const thread& other) const;
#endif
#if defined BOOST_THREAD_USES_DATETIME
static inline void yield() BOOST_NOEXCEPT
{
this_thread::yield();
}
static inline void sleep(const system_time& xt)
{
this_thread::sleep(xt);
}
#endif
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
// extensions
void interrupt();
bool interruption_requested() const BOOST_NOEXCEPT;
#endif
};
inline void swap(thread& lhs,thread& rhs) BOOST_NOEXCEPT
{
return lhs.swap(rhs);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
inline thread&& move(thread& t) BOOST_NOEXCEPT
{
return static_cast<thread&&>(t);
}
#endif
BOOST_THREAD_DCL_MOVABLE(thread)
namespace this_thread
{
#ifdef BOOST_THREAD_PLATFORM_PTHREAD
thread::id get_id() BOOST_NOEXCEPT;
#else
thread::id BOOST_THREAD_DECL get_id() BOOST_NOEXCEPT;
#endif
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
void BOOST_THREAD_DECL interruption_point();
bool BOOST_THREAD_DECL interruption_enabled() BOOST_NOEXCEPT;
bool BOOST_THREAD_DECL interruption_requested() BOOST_NOEXCEPT;
#endif
#if defined BOOST_THREAD_USES_DATETIME
inline BOOST_SYMBOL_VISIBLE void sleep(::boost::xtime const& abs_time)
{
sleep(system_time(abs_time));
}
#endif
}
class BOOST_SYMBOL_VISIBLE thread::id
{
private:
friend inline
std::size_t
hash_value(const thread::id &v)
{
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
return hash_value(v.thread_data);
#else
return hash_value(v.thread_data.get());
#endif
}
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
#if defined(BOOST_THREAD_PLATFORM_WIN32)
typedef unsigned int data;
#else
typedef thread::native_handle_type data;
#endif
#else
typedef detail::thread_data_ptr data;
#endif
data thread_data;
id(data thread_data_):
thread_data(thread_data_)
{}
friend class thread;
friend id BOOST_THREAD_DECL this_thread::get_id() BOOST_NOEXCEPT;
public:
id() BOOST_NOEXCEPT:
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
thread_data(0)
#else
thread_data()
#endif
{}
id(const id& other) BOOST_NOEXCEPT :
thread_data(other.thread_data)
{}
bool operator==(const id& y) const BOOST_NOEXCEPT
{
return thread_data==y.thread_data;
}
bool operator!=(const id& y) const BOOST_NOEXCEPT
{
return thread_data!=y.thread_data;
}
bool operator<(const id& y) const BOOST_NOEXCEPT
{
return thread_data<y.thread_data;
}
bool operator>(const id& y) const BOOST_NOEXCEPT
{
return y.thread_data<thread_data;
}
bool operator<=(const id& y) const BOOST_NOEXCEPT
{
return !(y.thread_data<thread_data);
}
bool operator>=(const id& y) const BOOST_NOEXCEPT
{
return !(thread_data<y.thread_data);
}
#ifndef BOOST_NO_IOSTREAM
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
template<class charT, class traits>
friend BOOST_SYMBOL_VISIBLE
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const id& x)
{
if(x.thread_data)
{
io::ios_flags_saver ifs( os );
return os<< std::hex << x.thread_data;
}
else
{
return os<<"{Not-any-thread}";
}
}
#else
template<class charT, class traits>
BOOST_SYMBOL_VISIBLE
std::basic_ostream<charT, traits>&
print(std::basic_ostream<charT, traits>& os) const
{
if(thread_data)
{
io::ios_flags_saver ifs( os );
return os<< std::hex << thread_data;
}
else
{
return os<<"{Not-any-thread}";
}
}
#endif
#endif
};
#ifdef BOOST_THREAD_PLATFORM_PTHREAD
inline thread::id thread::get_id() const BOOST_NOEXCEPT
{
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
return const_cast<thread*>(this)->native_handle();
#else
detail::thread_data_ptr const local_thread_info=(get_thread_info)();
return (local_thread_info? id(local_thread_info) : id());
#endif
}
namespace this_thread
{
inline thread::id get_id() BOOST_NOEXCEPT
{
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
return pthread_self();
#else
boost::detail::thread_data_base* const thread_info=get_or_make_current_thread_data();
return (thread_info?thread::id(thread_info->shared_from_this()):thread::id());
#endif
}
}
#endif
inline void thread::join() {
if (this_thread::get_id() == get_id())
boost::throw_exception(thread_resource_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost thread: trying joining itself"));
BOOST_THREAD_VERIFY_PRECONDITION( join_noexcept(),
thread_resource_error(static_cast<int>(system::errc::invalid_argument), "boost thread: thread not joinable")
);
}
inline bool thread::do_try_join_until(detail::internal_platform_timepoint const &timeout)
{
if (this_thread::get_id() == get_id())
boost::throw_exception(thread_resource_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost thread: trying joining itself"));
bool res;
if (do_try_join_until_noexcept(timeout, res))
{
return res;
}
else
{
BOOST_THREAD_THROW_ELSE_RETURN(
(thread_resource_error(static_cast<int>(system::errc::invalid_argument), "boost thread: thread not joinable")),
false
);
}
}
#if !defined(BOOST_NO_IOSTREAM) && defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template<class charT, class traits>
BOOST_SYMBOL_VISIBLE
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const thread::id& x)
{
return x.print(os);
}
#endif
#if defined BOOST_THREAD_PROVIDES_THREAD_EQ
inline bool thread::operator==(const thread& other) const
{
return get_id()==other.get_id();
}
inline bool thread::operator!=(const thread& other) const
{
return get_id()!=other.get_id();
}
#endif
namespace detail
{
struct thread_exit_function_base
{
virtual ~thread_exit_function_base()
{}
virtual void operator()()=0;
};
template<typename F>
struct thread_exit_function:
thread_exit_function_base
{
F f;
thread_exit_function(F f_):
f(f_)
{}
void operator()()
{
f();
}
};
void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*);
//#ifndef BOOST_NO_EXCEPTIONS
struct shared_state_base;
#if defined(BOOST_THREAD_PLATFORM_WIN32)
inline void make_ready_at_thread_exit(shared_ptr<shared_state_base> as)
{
detail::thread_data_base* const current_thread_data(detail::get_current_thread_data());
if(current_thread_data)
{
current_thread_data->make_ready_at_thread_exit(as);
}
}
#else
void BOOST_THREAD_DECL make_ready_at_thread_exit(shared_ptr<shared_state_base> as);
#endif
//#endif
}
namespace this_thread
{
template<typename F>
void at_thread_exit(F f)
{
detail::thread_exit_function_base* const thread_exit_func=detail::heap_new<detail::thread_exit_function<F> >(f);
detail::add_thread_exit_function(thread_exit_func);
}
}
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#include <boost/config/abi_suffix.hpp>
#endif
|
{
"pile_set_name": "Github"
}
|
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1
import (
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer.
MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer
// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer.
ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer.
func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer {
return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer.
func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer {
return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
|
{
"pile_set_name": "Github"
}
|
# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
pkgname=byepass
pkgver=209.a41a650
pkgrel=1
pkgdesc='Automates password cracking tasks using optimized dictionaries and mangling rules.'
arch=('any')
groups=('blackarch' 'blackarch-automation' 'blackarch-cracker')
url='https://github.com/webpwnized/byepass'
license=('custom:unknown')
depends=('john' 'python' 'python-argparse' 'unzip')
makedepends=('git')
source=("git+https://github.com/webpwnized/$pkgname.git")
sha512sums=('SKIP')
pkgver() {
cd $pkgname
echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
prepare() {
cd $pkgname
cd passwords/
./unpackage-passwords.sh
cd ..
sed -ri '1 i\\#\!\/usr\/bin\/python' "$pkgname.py" passtime.py
gawk -i inplace -v johnpath="$(which john)" \
'{ gsub(/^JTR_EXECUTABLE_FILE_PATH.*/, "JTR_EXECUTABLE_FILE_PATH = \""\
johnpath "\"") ; print }' config.py
gawk -i inplace '{ gsub(/^JTR_POT_FILE_PATH.*/, "JTR_POT_FILE_PATH = \""\
ENVIRON["HOME"] "/.john/john.pot\"") ; print }' config.py
gawk -i inplace '{ gsub(/^# End of john/, "# Byepass rules\n.include \
\"/usr/share/byepass/rules/byepass.conf\"\n.include \
\"/usr/share/byepass/rules/OneRuleToRuleThemAll.rule\"\n.include \
\"/usr/share/byepass/rules/Best126.rule\"\n\n" $0) ; print }' config.py
}
package() {
cd $pkgname
install -dm 755 "$pkgdir/usr/bin"
install -dm 755 "$pkgdir/usr/share/$pkgname"
install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" *.md *.txt
rm -r *.md *.txt scripts/
cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname"
cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python3 $pkgname.py "\$@"
EOF
cat > "$pkgdir/usr/bin/passtime" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python3 passtime.py "\$@"
EOF
chmod +x "$pkgdir/usr/bin/$pkgname"
chmod +x "$pkgdir/usr/bin/passtime"
}
|
{
"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.
## Log4j 1.2 file that configures logging for Fluo processes
## Define a console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Target=System.out
log4j.appender.console.Threshold=ALL
log4j.appender.console.layout.ConversionPattern=%d{ISO8601} [%-8c{2}] %-5p: %m%n
log4j.appender.console.layout=org.apache.log4j.PatternLayout
## Constrain some particularly spammy loggers
log4j.logger.org.apache.zookeeper=ERROR
log4j.logger.org.apache.curator=ERROR
## Append most logs to console
log4j.rootLogger=INFO, console
|
{
"pile_set_name": "Github"
}
|
/*****************************************************************************
*
* 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/>.
*
*
*****************************************************************************/
#include "common.h"
#include "utils_cmd.h"
#include "utils_base.h"
#include "tap.h"
#define COMMAND_LINE 1024
#define UNSET 65530
char *
get_command (char *const *line)
{
char *cmd;
int i = 0;
asprintf (&cmd, " %s", line[i++]);
while (line[i] != NULL) {
asprintf (&cmd, "%s %s", cmd, line[i]);
i++;
}
return cmd;
}
int
main (int argc, char **argv)
{
char **command_line = malloc (sizeof (char *) * COMMAND_LINE);
char *command = NULL;
char *perl;
output chld_out, chld_err;
int c;
int result = UNSET;
plan_tests(51);
diag ("Running plain echo command, set one");
/* ensure everything is empty before we begin */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
ok (result == UNSET, "(initialised) Checking exit code is reset");
command_line[0] = strdup ("/bin/echo");
command_line[1] = strdup ("this");
command_line[2] = strdup ("is");
command_line[3] = strdup ("test");
command_line[4] = strdup ("one");
command = get_command (command_line);
result = cmd_run_array (command_line, &chld_out, &chld_err, 0);
ok (chld_out.lines == 1,
"(array) Check for expected number of stdout lines");
ok (chld_err.lines == 0,
"(array) Check for expected number of stderr lines");
ok (strcmp (chld_out.line[0], "this is test one") == 0,
"(array) Check for expected stdout output");
ok (result == 0, "(array) Checking exit code");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
ok (result == UNSET, "(initialised) Checking exit code is reset");
result = cmd_run (command, &chld_out, &chld_err, 0);
ok (chld_out.lines == 1,
"(string) Check for expected number of stdout lines");
ok (chld_err.lines == 0,
"(string) Check for expected number of stderr lines");
ok (strcmp (chld_out.line[0], "this is test one") == 0,
"(string) Check for expected stdout output");
ok (result == 0, "(string) Checking exit code");
diag ("Running plain echo command, set two");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
ok (result == UNSET, "(initialised) Checking exit code is reset");
command_line[0] = strdup ("/bin/echo");
command_line[1] = strdup ("this is test two");
command_line[2] = NULL;
command_line[3] = NULL;
command_line[4] = NULL;
result = cmd_run_array (command_line, &chld_out, &chld_err, 0);
ok (chld_out.lines == 1,
"(array) Check for expected number of stdout lines");
ok (chld_err.lines == 0,
"(array) Check for expected number of stderr lines");
ok (strcmp (chld_out.line[0], "this is test two") == 0,
"(array) Check for expected stdout output");
ok (result == 0, "(array) Checking exit code");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
ok (result == UNSET, "(initialised) Checking exit code is reset");
result = cmd_run (command, &chld_out, &chld_err, 0);
ok (chld_out.lines == 1,
"(string) Check for expected number of stdout lines");
ok (chld_err.lines == 0,
"(string) Check for expected number of stderr lines");
ok (strcmp (chld_out.line[0], "this is test one") == 0,
"(string) Check for expected stdout output");
ok (result == 0, "(string) Checking exit code");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
ok (result == UNSET, "(initialised) Checking exit code is reset");
/* Pass linefeeds via parameters through - those should be evaluated by echo to give multi line output */
command_line[0] = strdup("/bin/echo");
command_line[1] = strdup("this is a test via echo\nline two\nit's line 3");
command_line[2] = strdup("and (note space between '3' and 'and') $$ will not get evaluated");
result = cmd_run_array (command_line, &chld_out, &chld_err, 0);
ok (chld_out.lines == 3,
"(array) Check for expected number of stdout lines");
ok (chld_err.lines == 0,
"(array) Check for expected number of stderr lines");
ok (strcmp (chld_out.line[0], "this is a test via echo") == 0,
"(array) Check line 1 for expected stdout output");
ok (strcmp (chld_out.line[1], "line two") == 0,
"(array) Check line 2 for expected stdout output");
ok (strcmp (chld_out.line[2], "it's line 3 and (note space between '3' and 'and') $$ will not get evaluated") == 0,
"(array) Check line 3 for expected stdout output");
ok (result == 0, "(array) Checking exit code");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
ok (result == UNSET, "(initialised) Checking exit code is reset");
command = (char *)malloc(COMMAND_LINE);
strcpy(command, "/bin/echo3456 non-existant command");
result = cmd_run (command, &chld_out, &chld_err, 0);
ok (chld_out.lines == 0,
"Non existant command, so no output");
ok (chld_err.lines == 0,
"No stderr either");
ok (result == 3, "Get return code 3 (?) for non-existant command");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
command = (char *)malloc(COMMAND_LINE);
strcpy(command, "/bin/sh non-existant-file");
result = cmd_run (command, &chld_out, &chld_err, 0);
ok (chld_out.lines == 0,
"/bin/sh returns no stdout when file is missing...");
ok (chld_err.lines == 1,
"...but does give an error line");
ok (strstr(chld_err.line[0],"non-existant-file") != NULL, "And missing filename is in error message");
ok (result != 0, "Get non-zero return code from /bin/sh");
/* ensure everything is empty again */
result = UNSET;
command = (char *)malloc(COMMAND_LINE);
strcpy(command, "/bin/sh -c 'exit 7'");
result = cmd_run (command, NULL, NULL, 0);
ok (result == 7, "Get return code 7 from /bin/sh");
/* ensure everything is empty again */
memset (&chld_out, 0, sizeof (output));
memset (&chld_err, 0, sizeof (output));
result = UNSET;
command = (char *)malloc(COMMAND_LINE);
strcpy(command, "/bin/non-existant-command");
result = cmd_run (command, &chld_out, &chld_err, 0);
ok (chld_out.lines == 0,
"/bin/non-existant-command returns no stdout...");
ok (chld_err.lines == 0,
"...and no stderr output either");
ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist");
return exit_status ();
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="pages_2.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
createResults();
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2015 Intel Corporation
*/
#include <stdint.h>
#include <inttypes.h>
#include <getopt.h>
#include <rte_eal.h>
#include <rte_ethdev.h>
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
#define NUM_MBUFS 8191
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
static const char usage[] =
"%s EAL_ARGS -- [-t]\n";
static const struct rte_eth_conf port_conf_default = {
.rxmode = {
.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
},
};
static struct {
uint64_t total_cycles;
uint64_t total_queue_cycles;
uint64_t total_pkts;
} latency_numbers;
int hw_timestamping;
#define TICKS_PER_CYCLE_SHIFT 16
static uint64_t ticks_per_cycle_mult;
static uint16_t
add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts,
uint16_t max_pkts __rte_unused, void *_ __rte_unused)
{
unsigned i;
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
pkts[i]->udata64 = now;
return nb_pkts;
}
static uint16_t
calc_latency(uint16_t port, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts, void *_ __rte_unused)
{
uint64_t cycles = 0;
uint64_t queue_ticks = 0;
uint64_t now = rte_rdtsc();
uint64_t ticks;
unsigned i;
if (hw_timestamping)
rte_eth_read_clock(port, &ticks);
for (i = 0; i < nb_pkts; i++) {
cycles += now - pkts[i]->udata64;
if (hw_timestamping)
queue_ticks += ticks - pkts[i]->timestamp;
}
latency_numbers.total_cycles += cycles;
if (hw_timestamping)
latency_numbers.total_queue_cycles += (queue_ticks
* ticks_per_cycle_mult) >> TICKS_PER_CYCLE_SHIFT;
latency_numbers.total_pkts += nb_pkts;
if (latency_numbers.total_pkts > (100 * 1000 * 1000ULL)) {
printf("Latency = %"PRIu64" cycles\n",
latency_numbers.total_cycles / latency_numbers.total_pkts);
if (hw_timestamping) {
printf("Latency from HW = %"PRIu64" cycles\n",
latency_numbers.total_queue_cycles
/ latency_numbers.total_pkts);
}
latency_numbers.total_cycles = 0;
latency_numbers.total_queue_cycles = 0;
latency_numbers.total_pkts = 0;
}
return nb_pkts;
}
/*
* Initialises a given port using global settings and with the rx buffers
* coming from the mbuf_pool passed as parameter
*/
static inline int
port_init(uint16_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1;
uint16_t nb_rxd = RX_RING_SIZE;
uint16_t nb_txd = TX_RING_SIZE;
int retval;
uint16_t q;
struct rte_eth_dev_info dev_info;
struct rte_eth_rxconf rxconf;
struct rte_eth_txconf txconf;
if (!rte_eth_dev_is_valid_port(port))
return -1;
retval = rte_eth_dev_info_get(port, &dev_info);
if (retval != 0) {
printf("Error during getting device (port %u) info: %s\n",
port, strerror(-retval));
return retval;
}
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
if (hw_timestamping) {
if (!(dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)) {
printf("\nERROR: Port %u does not support hardware timestamping\n"
, port);
return -1;
}
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
}
retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
if (retval != 0)
return retval;
retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
if (retval != 0)
return retval;
rxconf = dev_info.default_rxconf;
for (q = 0; q < rx_rings; q++) {
retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port), &rxconf, mbuf_pool);
if (retval < 0)
return retval;
}
txconf = dev_info.default_txconf;
txconf.offloads = port_conf.txmode.offloads;
for (q = 0; q < tx_rings; q++) {
retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port), &txconf);
if (retval < 0)
return retval;
}
retval = rte_eth_dev_start(port);
if (retval < 0)
return retval;
if (hw_timestamping && ticks_per_cycle_mult == 0) {
uint64_t cycles_base = rte_rdtsc();
uint64_t ticks_base;
retval = rte_eth_read_clock(port, &ticks_base);
if (retval != 0)
return retval;
rte_delay_ms(100);
uint64_t cycles = rte_rdtsc();
uint64_t ticks;
rte_eth_read_clock(port, &ticks);
uint64_t c_freq = cycles - cycles_base;
uint64_t t_freq = ticks - ticks_base;
double freq_mult = (double)c_freq / t_freq;
printf("TSC Freq ~= %" PRIu64
"\nHW Freq ~= %" PRIu64
"\nRatio : %f\n",
c_freq * 10, t_freq * 10, freq_mult);
/* TSC will be faster than internal ticks so freq_mult is > 0
* We convert the multiplication to an integer shift & mult
*/
ticks_per_cycle_mult = (1 << TICKS_PER_CYCLE_SHIFT) / freq_mult;
}
struct rte_ether_addr addr;
retval = rte_eth_macaddr_get(port, &addr);
if (retval < 0) {
printf("Failed to get MAC address on port %u: %s\n",
port, rte_strerror(-retval));
return retval;
}
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
(unsigned)port,
addr.addr_bytes[0], addr.addr_bytes[1],
addr.addr_bytes[2], addr.addr_bytes[3],
addr.addr_bytes[4], addr.addr_bytes[5]);
retval = rte_eth_promiscuous_enable(port);
if (retval != 0)
return retval;
rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
rte_eth_add_tx_callback(port, 0, calc_latency, NULL);
return 0;
}
/*
* Main thread that does the work, reading from INPUT_PORT
* and writing to OUTPUT_PORT
*/
static __rte_noreturn void
lcore_main(void)
{
uint16_t port;
RTE_ETH_FOREACH_DEV(port)
if (rte_eth_dev_socket_id(port) > 0 &&
rte_eth_dev_socket_id(port) !=
(int)rte_socket_id())
printf("WARNING, port %u is on remote NUMA node to "
"polling thread.\n\tPerformance will "
"not be optimal.\n", port);
printf("\nCore %u forwarding packets. [Ctrl+C to quit]\n",
rte_lcore_id());
for (;;) {
RTE_ETH_FOREACH_DEV(port) {
struct rte_mbuf *bufs[BURST_SIZE];
const uint16_t nb_rx = rte_eth_rx_burst(port, 0,
bufs, BURST_SIZE);
if (unlikely(nb_rx == 0))
continue;
const uint16_t nb_tx = rte_eth_tx_burst(port ^ 1, 0,
bufs, nb_rx);
if (unlikely(nb_tx < nb_rx)) {
uint16_t buf;
for (buf = nb_tx; buf < nb_rx; buf++)
rte_pktmbuf_free(bufs[buf]);
}
}
}
}
/* Main function, does initialisation and calls the per-lcore functions */
int
main(int argc, char *argv[])
{
struct rte_mempool *mbuf_pool;
uint16_t nb_ports;
uint16_t portid;
struct option lgopts[] = {
{ NULL, 0, 0, 0 }
};
int opt, option_index;
/* init EAL */
int ret = rte_eal_init(argc, argv);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");
argc -= ret;
argv += ret;
while ((opt = getopt_long(argc, argv, "t", lgopts, &option_index))
!= EOF)
switch (opt) {
case 't':
hw_timestamping = 1;
break;
default:
printf(usage, argv[0]);
return -1;
}
optind = 1; /* reset getopt lib */
nb_ports = rte_eth_dev_count_avail();
if (nb_ports < 2 || (nb_ports & 1))
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
/* initialize all ports */
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8"\n",
portid);
if (rte_lcore_count() > 1)
printf("\nWARNING: Too much enabled lcores - "
"App uses only 1 lcore\n");
/* call lcore_main on master core only */
lcore_main();
return 0;
}
|
{
"pile_set_name": "Github"
}
|
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Draggable - Visual feedback</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
#draggable, #draggable2, #draggable3, #set div { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
#draggable, #draggable2, #draggable3 { margin-bottom:20px; }
#set { clear:both; float:left; width: 368px; height: 120px; }
p { clear:both; margin:0; padding:1em 0; }
</style>
<script type="text/javascript">
$(function() {
$("#draggable").draggable({ helper: 'original' });
$("#draggable2").draggable({ opacity: 0.7, helper: 'clone' });
$("#draggable3").draggable({
cursor: 'move',
cursorAt: { top: -12, left: -20 },
helper: function(event) {
return $('<div class="ui-widget-header">I\'m a custom helper</div>');
}
});
$("#set div").draggable({ stack: { group: '#set div', min: 1 } });
});
</script>
</head>
<body>
<div class="demo">
<h3 class="docs">With helpers:</h3>
<div id="draggable" class="ui-widget-content">
<p>Original</p>
</div>
<div id="draggable2" class="ui-widget-content">
<p>Semi-transparent clone</p>
</div>
<div id="draggable3" class="ui-widget-content">
<p>Custom helper (in combination with cursorAt)</p>
</div>
<h3 class="docs">Stacked:</h3>
<div id="set">
<div class="ui-widget-content">
<p>We are draggables..</p>
</div>
<div class="ui-widget-content">
<p>..whose z-indexes are controlled automatically..</p>
</div>
<div class="ui-widget-content">
<p>..with the stack option.</p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Provide feedback to users as they drag an object in the form of a helper. The <code>helper</code> option accepts the values 'original' (the draggable object moves with the cursor), 'clone' (a duplicate of the draggable moves with the cursor), or a function that returns a DOM element (that element is shown near the cursor during drag). Control the helper's transparency with the <code>opacity</code> option.</p>
<p>To clarify which draggable is in play, bring the draggable in motion to front. Use the <code>zIndex</code> option to set a higher z-index for the helper, if in play, or use the <code>stack</code> option to ensure that the last item dragged will appear on top of others in the same group on drag stop.</p>
</div><!-- End demo-description -->
</body>
</html>
|
{
"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.
*/
#ifndef _COUPONLIST_INTERNAL_HPP_
#define _COUPONLIST_INTERNAL_HPP_
#include "CouponList.hpp"
#include "CubicInterpolation.hpp"
#include "HllUtil.hpp"
#include <algorithm>
#include <cmath>
namespace datasketches {
template<typename A>
CouponList<A>::CouponList(const int lgConfigK, const target_hll_type tgtHllType, const hll_mode mode)
: HllSketchImpl<A>(lgConfigK, tgtHllType, mode, false) {
if (mode == hll_mode::LIST) {
lgCouponArrInts = HllUtil<A>::LG_INIT_LIST_SIZE;
} else { // mode == SET
lgCouponArrInts = HllUtil<A>::LG_INIT_SET_SIZE;
}
oooFlag = false;
const int arrayLen = 1 << lgCouponArrInts;
typedef typename std::allocator_traits<A>::template rebind_alloc<int> intAlloc;
couponIntArr = intAlloc().allocate(arrayLen);
std::fill(couponIntArr, couponIntArr + arrayLen, 0);
couponCount = 0;
}
template<typename A>
CouponList<A>::CouponList(const CouponList& that)
: HllSketchImpl<A>(that.lgConfigK, that.tgtHllType, that.mode, false),
lgCouponArrInts(that.lgCouponArrInts),
couponCount(that.couponCount),
oooFlag(that.oooFlag) {
const int numItems = 1 << lgCouponArrInts;
typedef typename std::allocator_traits<A>::template rebind_alloc<int> intAlloc;
couponIntArr = intAlloc().allocate(numItems);
std::copy(that.couponIntArr, that.couponIntArr + numItems, couponIntArr);
}
template<typename A>
CouponList<A>::CouponList(const CouponList& that, const target_hll_type tgtHllType)
: HllSketchImpl<A>(that.lgConfigK, tgtHllType, that.mode, false),
lgCouponArrInts(that.lgCouponArrInts),
couponCount(that.couponCount),
oooFlag(that.oooFlag) {
const int numItems = 1 << lgCouponArrInts;
typedef typename std::allocator_traits<A>::template rebind_alloc<int> intAlloc;
couponIntArr = intAlloc().allocate(numItems);
std::copy(that.couponIntArr, that.couponIntArr + numItems, couponIntArr);
}
template<typename A>
CouponList<A>::~CouponList() {
typedef typename std::allocator_traits<A>::template rebind_alloc<int> intAlloc;
intAlloc().deallocate(couponIntArr, 1 << lgCouponArrInts);
}
template<typename A>
std::function<void(HllSketchImpl<A>*)> CouponList<A>::get_deleter() const {
return [](HllSketchImpl<A>* ptr) {
CouponList<A>* cl = static_cast<CouponList<A>*>(ptr);
cl->~CouponList();
clAlloc().deallocate(cl, 1);
};
}
template<typename A>
CouponList<A>* CouponList<A>::copy() const {
return new (clAlloc().allocate(1)) CouponList<A>(*this);
}
template<typename A>
CouponList<A>* CouponList<A>::copyAs(target_hll_type tgtHllType) const {
return new (clAlloc().allocate(1)) CouponList<A>(*this, tgtHllType);
}
template<typename A>
CouponList<A>* CouponList<A>::newList(const void* bytes, size_t len) {
if (len < HllUtil<A>::LIST_INT_ARR_START) {
throw std::out_of_range("Input data length insufficient to hold CouponHashSet");
}
const uint8_t* data = static_cast<const uint8_t*>(bytes);
if (data[HllUtil<A>::PREAMBLE_INTS_BYTE] != HllUtil<A>::LIST_PREINTS) {
throw std::invalid_argument("Incorrect number of preInts in input stream");
}
if (data[HllUtil<A>::SER_VER_BYTE] != HllUtil<A>::SER_VER) {
throw std::invalid_argument("Wrong ser ver in input stream");
}
if (data[HllUtil<A>::FAMILY_BYTE] != HllUtil<A>::FAMILY_ID) {
throw std::invalid_argument("Input stream is not an HLL sketch");
}
hll_mode mode = HllSketchImpl<A>::extractCurMode(data[HllUtil<A>::MODE_BYTE]);
if (mode != LIST) {
throw std::invalid_argument("Calling set construtor with non-list mode data");
}
target_hll_type tgtHllType = HllSketchImpl<A>::extractTgtHllType(data[HllUtil<A>::MODE_BYTE]);
const int lgK = data[HllUtil<A>::LG_K_BYTE];
const bool compact = ((data[HllUtil<A>::FLAGS_BYTE] & HllUtil<A>::COMPACT_FLAG_MASK) ? true : false);
const bool oooFlag = ((data[HllUtil<A>::FLAGS_BYTE] & HllUtil<A>::OUT_OF_ORDER_FLAG_MASK) ? true : false);
const bool emptyFlag = ((data[HllUtil<A>::FLAGS_BYTE] & HllUtil<A>::EMPTY_FLAG_MASK) ? true : false);
const int couponCount = data[HllUtil<A>::LIST_COUNT_BYTE];
const int couponsInArray = (compact ? couponCount : (1 << HllUtil<A>::computeLgArrInts(LIST, couponCount, lgK)));
const size_t expectedLength = HllUtil<A>::LIST_INT_ARR_START + (couponsInArray * sizeof(int));
if (len < expectedLength) {
throw std::out_of_range("Byte array too short for sketch. Expected " + std::to_string(expectedLength)
+ ", found: " + std::to_string(len));
}
CouponList<A>* sketch = new (clAlloc().allocate(1)) CouponList<A>(lgK, tgtHllType, mode);
sketch->couponCount = couponCount;
sketch->putOutOfOrderFlag(oooFlag); // should always be false for LIST
if (!emptyFlag) {
// only need to read valid coupons, unlike in stream case
std::memcpy(sketch->couponIntArr, data + HllUtil<A>::LIST_INT_ARR_START, couponCount * sizeof(int));
}
return sketch;
}
template<typename A>
CouponList<A>* CouponList<A>::newList(std::istream& is) {
uint8_t listHeader[8];
is.read((char*)listHeader, 8 * sizeof(uint8_t));
if (listHeader[HllUtil<A>::PREAMBLE_INTS_BYTE] != HllUtil<A>::LIST_PREINTS) {
throw std::invalid_argument("Incorrect number of preInts in input stream");
}
if (listHeader[HllUtil<A>::SER_VER_BYTE] != HllUtil<A>::SER_VER) {
throw std::invalid_argument("Wrong ser ver in input stream");
}
if (listHeader[HllUtil<A>::FAMILY_BYTE] != HllUtil<A>::FAMILY_ID) {
throw std::invalid_argument("Input stream is not an HLL sketch");
}
hll_mode mode = HllSketchImpl<A>::extractCurMode(listHeader[HllUtil<A>::MODE_BYTE]);
if (mode != LIST) {
throw std::invalid_argument("Calling list construtor with non-list mode data");
}
const target_hll_type tgtHllType = HllSketchImpl<A>::extractTgtHllType(listHeader[HllUtil<A>::MODE_BYTE]);
const int lgK = (int) listHeader[HllUtil<A>::LG_K_BYTE];
const bool compact = ((listHeader[HllUtil<A>::FLAGS_BYTE] & HllUtil<A>::COMPACT_FLAG_MASK) ? true : false);
const bool oooFlag = ((listHeader[HllUtil<A>::FLAGS_BYTE] & HllUtil<A>::OUT_OF_ORDER_FLAG_MASK) ? true : false);
const bool emptyFlag = ((listHeader[HllUtil<A>::FLAGS_BYTE] & HllUtil<A>::EMPTY_FLAG_MASK) ? true : false);
CouponList<A>* sketch = new (clAlloc().allocate(1)) CouponList<A>(lgK, tgtHllType, mode);
typedef std::unique_ptr<CouponList<A>, std::function<void(HllSketchImpl<A>*)>> coupon_list_ptr;
coupon_list_ptr ptr(sketch, sketch->get_deleter());
const int couponCount = listHeader[HllUtil<A>::LIST_COUNT_BYTE];
sketch->couponCount = couponCount;
sketch->putOutOfOrderFlag(oooFlag); // should always be false for LIST
if (!emptyFlag) {
// For stream processing, need to read entire number written to stream so read
// pointer ends up set correctly.
// If not compact, still need to read empty items even though in order.
const int numToRead = (compact ? couponCount : (1 << sketch->lgCouponArrInts));
is.read((char*)sketch->couponIntArr, numToRead * sizeof(int));
}
if (!is.good())
throw std::runtime_error("error reading from std::istream");
return ptr.release();
}
template<typename A>
vector_u8<A> CouponList<A>::serialize(bool compact, unsigned header_size_bytes) const {
const size_t sketchSizeBytes = (compact ? getCompactSerializationBytes() : getUpdatableSerializationBytes()) + header_size_bytes;
vector_u8<A> byteArr(sketchSizeBytes);
uint8_t* bytes = byteArr.data() + header_size_bytes;
bytes[HllUtil<A>::PREAMBLE_INTS_BYTE] = static_cast<uint8_t>(getPreInts());
bytes[HllUtil<A>::SER_VER_BYTE] = static_cast<uint8_t>(HllUtil<A>::SER_VER);
bytes[HllUtil<A>::FAMILY_BYTE] = static_cast<uint8_t>(HllUtil<A>::FAMILY_ID);
bytes[HllUtil<A>::LG_K_BYTE] = static_cast<uint8_t>(this->lgConfigK);
bytes[HllUtil<A>::LG_ARR_BYTE] = static_cast<uint8_t>(lgCouponArrInts);
bytes[HllUtil<A>::FLAGS_BYTE] = this->makeFlagsByte(compact);
bytes[HllUtil<A>::LIST_COUNT_BYTE] = static_cast<uint8_t>(this->mode == LIST ? couponCount : 0);
bytes[HllUtil<A>::MODE_BYTE] = this->makeModeByte();
if (this->mode == SET) {
std::memcpy(bytes + HllUtil<A>::HASH_SET_COUNT_INT, &couponCount, sizeof(couponCount));
}
// coupons
// isCompact() is always false for now
const int sw = (isCompact() ? 2 : 0) | (compact ? 1 : 0);
switch (sw) {
case 0: { // src updatable, dst updatable
std::memcpy(bytes + getMemDataStart(), getCouponIntArr(), (1 << lgCouponArrInts) * sizeof(int));
break;
}
case 1: { // src updatable, dst compact
bytes += getMemDataStart(); // reusing pointer for incremental writes
for (uint32_t coupon: *this) {
std::memcpy(bytes, &coupon, sizeof(coupon));
bytes += sizeof(coupon);
}
break;
}
default:
throw std::runtime_error("Impossible condition when serializing");
}
return byteArr;
}
template<typename A>
void CouponList<A>::serialize(std::ostream& os, const bool compact) const {
// header
const uint8_t preInts(getPreInts());
os.write((char*)&preInts, sizeof(preInts));
const uint8_t serialVersion(HllUtil<A>::SER_VER);
os.write((char*)&serialVersion, sizeof(serialVersion));
const uint8_t familyId(HllUtil<A>::FAMILY_ID);
os.write((char*)&familyId, sizeof(familyId));
const uint8_t lgKByte((uint8_t) this->lgConfigK);
os.write((char*)&lgKByte, sizeof(lgKByte));
const uint8_t lgArrIntsByte((uint8_t) lgCouponArrInts);
os.write((char*)&lgArrIntsByte, sizeof(lgArrIntsByte));
const uint8_t flagsByte(this->makeFlagsByte(compact));
os.write((char*)&flagsByte, sizeof(flagsByte));
if (this->mode == LIST) {
const uint8_t listCount((uint8_t) couponCount);
os.write((char*)&listCount, sizeof(listCount));
} else { // mode == SET
const uint8_t unused(0);
os.write((char*)&unused, sizeof(unused));
}
const uint8_t modeByte(this->makeModeByte());
os.write((char*)&modeByte, sizeof(modeByte));
if (this->mode == SET) {
// writing as int, already stored as int
os.write((char*)&couponCount, sizeof(couponCount));
}
// coupons
// isCompact() is always false for now
const int sw = (isCompact() ? 2 : 0) | (compact ? 1 : 0);
switch (sw) {
case 0: { // src updatable, dst updatable
os.write((char*)getCouponIntArr(), (1 << lgCouponArrInts) * sizeof(int));
break;
}
case 1: { // src updatable, dst compact
for (uint32_t coupon: *this) {
os.write((char*)&coupon, sizeof(coupon));
}
break;
}
default:
throw std::runtime_error("Impossible condition when serializing");
}
return;
}
template<typename A>
HllSketchImpl<A>* CouponList<A>::couponUpdate(int coupon) {
const int len = 1 << lgCouponArrInts;
for (int i = 0; i < len; ++i) { // search for empty slot
const int couponAtIdx = couponIntArr[i];
if (couponAtIdx == HllUtil<A>::EMPTY) {
couponIntArr[i] = coupon; // the actual update
++couponCount;
if (couponCount >= len) { // array full
if (this->lgConfigK < 8) {
return promoteHeapListOrSetToHll(*this);
}
return promoteHeapListToSet(*this);
}
return this;
}
// cell not empty
if (couponAtIdx == coupon) {
return this; // duplicate
}
// cell not empty and not a duplicate, continue
}
throw std::runtime_error("Array invalid: no empties and no duplicates");
}
template<typename A>
double CouponList<A>::getCompositeEstimate() const { return getEstimate(); }
template<typename A>
double CouponList<A>::getEstimate() const {
const int couponCount = getCouponCount();
const double est = CubicInterpolation<A>::usingXAndYTables(couponCount);
return fmax(est, couponCount);
}
template<typename A>
double CouponList<A>::getLowerBound(const int numStdDev) const {
HllUtil<A>::checkNumStdDev(numStdDev);
const int couponCount = getCouponCount();
const double est = CubicInterpolation<A>::usingXAndYTables(couponCount);
const double tmp = est / (1.0 + (numStdDev * HllUtil<A>::COUPON_RSE));
return fmax(tmp, couponCount);
}
template<typename A>
double CouponList<A>::getUpperBound(const int numStdDev) const {
HllUtil<A>::checkNumStdDev(numStdDev);
const int couponCount = getCouponCount();
const double est = CubicInterpolation<A>::usingXAndYTables(couponCount);
const double tmp = est / (1.0 - (numStdDev * HllUtil<A>::COUPON_RSE));
return fmax(tmp, couponCount);
}
template<typename A>
bool CouponList<A>::isEmpty() const { return getCouponCount() == 0; }
template<typename A>
int CouponList<A>::getUpdatableSerializationBytes() const {
return getMemDataStart() + (4 << getLgCouponArrInts());
}
template<typename A>
int CouponList<A>::getCouponCount() const {
return couponCount;
}
template<typename A>
int CouponList<A>::getCompactSerializationBytes() const {
return getMemDataStart() + (couponCount << 2);
}
template<typename A>
int CouponList<A>::getMemDataStart() const {
return HllUtil<A>::LIST_INT_ARR_START;
}
template<typename A>
int CouponList<A>::getPreInts() const {
return HllUtil<A>::LIST_PREINTS;
}
template<typename A>
bool CouponList<A>::isCompact() const { return false; }
template<typename A>
bool CouponList<A>::isOutOfOrderFlag() const { return oooFlag; }
template<typename A>
void CouponList<A>::putOutOfOrderFlag(bool oooFlag) {
this->oooFlag = oooFlag;
}
template<typename A>
int CouponList<A>::getLgCouponArrInts() const {
return lgCouponArrInts;
}
template<typename A>
int* CouponList<A>::getCouponIntArr() const {
return couponIntArr;
}
template<typename A>
HllSketchImpl<A>* CouponList<A>::promoteHeapListToSet(CouponList& list) {
return HllSketchImplFactory<A>::promoteListToSet(list);
}
template<typename A>
HllSketchImpl<A>* CouponList<A>::promoteHeapListOrSetToHll(CouponList& src) {
return HllSketchImplFactory<A>::promoteListOrSetToHll(src);
}
template<typename A>
coupon_iterator<A> CouponList<A>::begin(bool all) const {
return coupon_iterator<A>(couponIntArr, 1 << lgCouponArrInts, 0, all);
}
template<typename A>
coupon_iterator<A> CouponList<A>::end() const {
return coupon_iterator<A>(couponIntArr, 1 << lgCouponArrInts, 1 << lgCouponArrInts, false);
}
}
#endif // _COUPONLIST_INTERNAL_HPP_
|
{
"pile_set_name": "Github"
}
|
//
// MJRefreshGifHeader.h
// MJRefreshExample
//
// Created by MJ Lee on 15/4/24.
// Copyright (c) 2015年 小码哥. All rights reserved.
//
#import "MJRefreshStateHeader.h"
@interface MJRefreshGifHeader : MJRefreshStateHeader
/** 设置state状态下的动画图片images 动画持续时间duration*/
- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;
- (void)setImages:(NSArray *)images forState:(MJRefreshState)state;
@end
|
{
"pile_set_name": "Github"
}
|
define("ace/snippets/sql",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="snippet tbl\n create table ${1:table} (\n ${2:columns}\n );\nsnippet col\n ${1:name} ${2:type} ${3:default ''} ${4:not null}\nsnippet ccol\n ${1:name} varchar2(${2:size}) ${3:default ''} ${4:not null}\nsnippet ncol\n ${1:name} number ${3:default 0} ${4:not null}\nsnippet dcol\n ${1:name} date ${3:default sysdate} ${4:not null}\nsnippet ind\n create index ${3:$1_$2} on ${1:table}(${2:column});\nsnippet uind\n create unique index ${1:name} on ${2:table}(${3:column});\nsnippet tblcom\n comment on table ${1:table} is '${2:comment}';\nsnippet colcom\n comment on column ${1:table}.${2:column} is '${3:comment}';\nsnippet addcol\n alter table ${1:table} add (${2:column} ${3:type});\nsnippet seq\n create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${4:1};\nsnippet s*\n select * from ${1:table}\n",t.scope="sql"}); (function() {
window.require(["ace/snippets/sql"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
|
{
"pile_set_name": "Github"
}
|
#include <linux/kernel.h>
#include <linux/ide.h>
char *ide_media_string(ide_drive_t *drive)
{
switch (drive->media) {
case ide_disk:
return "disk";
case ide_cdrom:
return "cdrom";
case ide_tape:
return "tape";
case ide_floppy:
return "floppy";
case ide_optical:
return "optical";
default:
return "UNKNOWN";
}
}
static ssize_t media_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
return sprintf(buf, "%s\n", ide_media_string(drive));
}
static DEVICE_ATTR_RO(media);
static ssize_t drivename_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
return sprintf(buf, "%s\n", drive->name);
}
static DEVICE_ATTR_RO(drivename);
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
return sprintf(buf, "ide:m-%s\n", ide_media_string(drive));
}
static DEVICE_ATTR_RO(modalias);
static ssize_t model_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]);
}
static DEVICE_ATTR_RO(model);
static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]);
}
static DEVICE_ATTR_RO(firmware);
static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]);
}
static DEVICE_ATTR(serial, 0400, serial_show, NULL);
static DEVICE_ATTR(unload_heads, 0644, ide_park_show, ide_park_store);
static struct attribute *ide_attrs[] = {
&dev_attr_media.attr,
&dev_attr_drivename.attr,
&dev_attr_modalias.attr,
&dev_attr_model.attr,
&dev_attr_firmware.attr,
&dev_attr_serial.attr,
&dev_attr_unload_heads.attr,
NULL,
};
static const struct attribute_group ide_attr_group = {
.attrs = ide_attrs,
};
const struct attribute_group *ide_dev_groups[] = {
&ide_attr_group,
NULL,
};
static ssize_t store_delete_devices(struct device *portdev,
struct device_attribute *attr,
const char *buf, size_t n)
{
ide_hwif_t *hwif = dev_get_drvdata(portdev);
if (strncmp(buf, "1", n))
return -EINVAL;
ide_port_unregister_devices(hwif);
return n;
};
static DEVICE_ATTR(delete_devices, S_IWUSR, NULL, store_delete_devices);
static ssize_t store_scan(struct device *portdev,
struct device_attribute *attr,
const char *buf, size_t n)
{
ide_hwif_t *hwif = dev_get_drvdata(portdev);
if (strncmp(buf, "1", n))
return -EINVAL;
ide_port_unregister_devices(hwif);
ide_port_scan(hwif);
return n;
};
static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan);
static struct device_attribute *ide_port_attrs[] = {
&dev_attr_delete_devices,
&dev_attr_scan,
NULL
};
int ide_sysfs_register_port(ide_hwif_t *hwif)
{
int i, uninitialized_var(rc);
for (i = 0; ide_port_attrs[i]; i++) {
rc = device_create_file(hwif->portdev, ide_port_attrs[i]);
if (rc)
break;
}
return rc;
}
|
{
"pile_set_name": "Github"
}
|
--TEST--
"length" filter
--TEMPLATE--
{{ array|length }}
{{ string|length }}
{{ number|length }}
{{ to_string_able|length }}
{{ countable|length }}
{{ iterator_aggregate|length }}
{{ null|length }}
{{ magic|length }}
{{ non_countable|length }}
{{ simple_xml_element|length }}
{{ iterator|length }}
--DATA--
return [
'array' => [1, 4],
'string' => 'foo',
'number' => 1000,
'to_string_able' => new ToStringStub('foobar'),
'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */
'iterator_aggregate' => new IteratorAggregateStub(['a', 'b', 'c']), /* also asserts we do *not* call __toString() */
'null' => null,
'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */
'non_countable' => new \StdClass(),
'simple_xml_element' => new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><doc><elem/><elem/></doc>'),
'iterator' => new \SimpleIteratorForTesting()
]
--EXPECT--
2
3
4
6
42
3
0
1
1
2
7
|
{
"pile_set_name": "Github"
}
|
/*
Licensed to Diennea S.r.l. under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. Diennea S.r.l. 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 herddb.core;
import static herddb.core.TestUtils.execute;
import static herddb.core.TestUtils.scan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import herddb.file.FileDataStorageManager;
import herddb.mem.MemoryCommitLogManager;
import herddb.mem.MemoryDataStorageManager;
import herddb.mem.MemoryMetadataStorageManager;
import herddb.model.DataScanner;
import herddb.model.StatementEvaluationContext;
import herddb.model.StatementExecutionException;
import herddb.model.TableDoesNotExistException;
import herddb.model.TransactionContext;
import herddb.model.commands.CreateTableSpaceStatement;
import java.nio.file.Path;
import java.util.Collections;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
* Tests on table creation
*
* @author enrico.olivelli
*/
public class TruncateTableSQLTest {
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@Test
public void truncateTableNoTransaction() throws Exception {
String nodeId = "localhost";
try (DBManager manager = new DBManager("localhost", new MemoryMetadataStorageManager(), new MemoryDataStorageManager(), new MemoryCommitLogManager(), null, null)) {
manager.start();
CreateTableSpaceStatement st1 = new CreateTableSpaceStatement("tblspace1", Collections.singleton(nodeId), nodeId, 1, 0, 0);
manager.executeStatement(st1, StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
manager.waitForTablespace("tblspace1", 10000);
execute(manager, "CREATE TABLE tblspace1.tsql (k1 string primary key,n1 int,s1 string)", Collections.emptyList());
execute(manager, "CREATE BRIN INDEX test1 ON tblspace1.tsql (k1)", Collections.emptyList());
execute(manager, "CREATE HASH INDEX test2 ON tblspace1.tsql (k1)", Collections.emptyList());
execute(manager, "INSERT INTO tblspace1.tsql (k1) values('a')", Collections.emptyList(), TransactionContext.NO_TRANSACTION);
try (DataScanner scan = scan(manager, "SELECT * FROM tblspace1.tsql ", Collections.emptyList())) {
assertEquals(1, scan.consume().size());
} catch (TableDoesNotExistException ok) {
}
execute(manager, "TRUNCATE TABLE tblspace1.tsql", Collections.emptyList());
try (DataScanner scan = scan(manager, "SELECT * FROM tblspace1.tsql ", Collections.emptyList())) {
assertEquals(0, scan.consume().size());
} catch (TableDoesNotExistException ok) {
}
}
}
@Test
public void truncateTableTransactionTest() throws Exception {
String nodeId = "localhost";
try (DBManager manager = new DBManager("localhost", new MemoryMetadataStorageManager(), new MemoryDataStorageManager(), new MemoryCommitLogManager(), null, null)) {
manager.start();
CreateTableSpaceStatement st1 = new CreateTableSpaceStatement("tblspace1", Collections.singleton(nodeId), nodeId, 1, 0, 0);
manager.executeStatement(st1, StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
manager.waitForTablespace("tblspace1", 10000);
execute(manager, "CREATE TABLE tblspace1.tsql (k1 string primary key,n1 int,s1 string)", Collections.emptyList());
execute(manager, "CREATE BRIN INDEX test1 ON tblspace1.tsql (k1)", Collections.emptyList());
execute(manager, "CREATE HASH INDEX test2 ON tblspace1.tsql (k1)", Collections.emptyList());
long tx1 = TestUtils.beginTransaction(manager, "tblspace1");
try {
// forbidden, transactions not allowed
execute(manager, "truncate TABLE tblspace1.tsql", Collections.emptyList(), new TransactionContext(tx1));
fail();
} catch (StatementExecutionException ok) {
assertEquals("TRUNCATE TABLE cannot be executed within the context of a Transaction", ok.getMessage());
}
long txId = execute(manager, "INSERT INTO tblspace1.tsql (k1) values('a')",
Collections.emptyList(), TransactionContext.AUTOTRANSACTION_TRANSACTION).transactionId;
try (DataScanner scan = scan(manager, "SELECT * FROM tblspace1.tsql ", Collections.emptyList(), new TransactionContext(txId))) {
assertEquals(1, scan.consume().size());
}
try {
// forbidden, a transaction is running on table
execute(manager, "TRUNCATE TABLE tblspace1.tsql", Collections.emptyList(), TransactionContext.NO_TRANSACTION);
fail();
} catch (StatementExecutionException ok) {
assertEquals("TRUNCATE TABLE cannot be executed table tblspace1.tsql: at least one transaction is pending on it",
ok.getCause().getMessage());
}
TestUtils.commitTransaction(manager, "tblspace1", txId);
execute(manager, "TRUNCATE TABLE tblspace1.tsql", Collections.emptyList(), TransactionContext.NO_TRANSACTION);
try (DataScanner scan = scan(manager, "SELECT * FROM tblspace1.tsql ", Collections.emptyList())) {
assertEquals(0, scan.consume().size());
}
}
}
@Test
public void truncateTableFileDataStore() throws Exception {
String nodeId = "localhost";
Path dataPath = folder.newFolder("data").toPath();
try (DBManager manager = new DBManager("localhost", new MemoryMetadataStorageManager(),
new FileDataStorageManager(dataPath), new MemoryCommitLogManager(), null, null)) {
manager.start();
CreateTableSpaceStatement st1 =
new CreateTableSpaceStatement("tblspace1", Collections.singleton(nodeId), nodeId, 1, 0, 0);
manager.executeStatement(
st1, StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
manager.waitForTablespace("tblspace1", 10000);
execute(manager, "CREATE TABLE tblspace1.tsql (k1 string primary key,n1 int not nul,s1 string)", Collections.emptyList());
execute(manager, "CREATE INDEX test1 ON tblspace1.tsql (n1)", Collections.emptyList());
execute(manager, "INSERT INTO tblspace1.tsql (k1,n1) values('a',1)", Collections.emptyList());
try (DataScanner scan = scan(manager, "SELECT * FROM tblspace1.tsql ", Collections.emptyList())) {
assertEquals(1, scan.consume().size());
} catch (TableDoesNotExistException ok) {}
// truncate, table name non case sensitive
execute(manager, "TRUNCATE TABLE tblspace1.Tsql", Collections.emptyList());
try (DataScanner scan = scan(manager, "SELECT * FROM tblspace1.tsql ", Collections.emptyList())) {
assertEquals(0, scan.consume().size());
} catch (TableDoesNotExistException ok) {}
}
}
}
|
{
"pile_set_name": "Github"
}
|
#include <iwp/message_buffer.hpp>
#include <iwp/session.hpp>
#include <crypto/crypto.hpp>
namespace llarp
{
namespace iwp
{
OutboundMessage::OutboundMessage(uint64_t msgid,
ILinkSession::Message_t msg,
llarp_time_t now,
ILinkSession::CompletionHandler handler)
: m_Data{std::move(msg)}
, m_MsgID{msgid}
, m_Completed{handler}
, m_LastFlush{now}
, m_StartedAt{now}
{
const llarp_buffer_t buf(m_Data);
CryptoManager::instance()->shorthash(m_Digest, buf);
}
ILinkSession::Packet_t
OutboundMessage::XMIT() const
{
size_t extra = std::min(m_Data.size(), FragmentSize);
auto xmit = CreatePacket(Command::eXMIT, 10 + 32 + extra, 0, 0);
htobe16buf(xmit.data() + CommandOverhead + PacketOverhead, m_Data.size());
htobe64buf(xmit.data() + 2 + CommandOverhead + PacketOverhead, m_MsgID);
std::copy_n(m_Digest.begin(), m_Digest.size(),
xmit.data() + 10 + CommandOverhead + PacketOverhead);
std::copy_n(m_Data.data(), extra,
xmit.data() + 10 + CommandOverhead + PacketOverhead + 32);
return xmit;
}
void
OutboundMessage::Completed()
{
if(m_Completed)
{
m_Completed(ILinkSession::DeliveryStatus::eDeliverySuccess);
}
m_Completed = nullptr;
}
bool
OutboundMessage::ShouldFlush(llarp_time_t now) const
{
return now - m_LastFlush >= TXFlushInterval;
}
void
OutboundMessage::Ack(byte_t bitmask)
{
m_Acks = std::bitset< 8 >(bitmask);
}
void
OutboundMessage::FlushUnAcked(
std::function< void(ILinkSession::Packet_t) > sendpkt, llarp_time_t now)
{
/// overhead for a data packet in plaintext
static constexpr size_t Overhead = 10;
uint16_t idx = 0;
const auto datasz = m_Data.size();
while(idx < datasz)
{
if(not m_Acks[idx / FragmentSize])
{
const size_t fragsz =
idx + FragmentSize < datasz ? FragmentSize : datasz - idx;
auto frag = CreatePacket(Command::eDATA, fragsz + Overhead, 0, 0);
htobe16buf(frag.data() + 2 + PacketOverhead, idx);
htobe64buf(frag.data() + 4 + PacketOverhead, m_MsgID);
std::copy(m_Data.begin() + idx, m_Data.begin() + idx + fragsz,
frag.data() + PacketOverhead + Overhead + 2);
sendpkt(std::move(frag));
}
idx += FragmentSize;
}
m_LastFlush = now;
}
bool
OutboundMessage::IsTransmitted() const
{
const auto sz = m_Data.size();
for(uint16_t idx = 0; idx < sz; idx += FragmentSize)
{
if(not m_Acks.test(idx / FragmentSize))
return false;
}
return true;
}
bool
OutboundMessage::IsTimedOut(const llarp_time_t now) const
{
// TODO: make configurable by outbound message deliverer
return now > m_StartedAt && now - m_StartedAt > DeliveryTimeout;
}
void
OutboundMessage::InformTimeout()
{
if(m_Completed)
{
m_Completed(ILinkSession::DeliveryStatus::eDeliveryDropped);
}
m_Completed = nullptr;
}
InboundMessage::InboundMessage(uint64_t msgid, uint16_t sz, ShortHash h,
llarp_time_t now)
: m_Data(size_t{sz})
, m_Digset{std::move(h)}
, m_MsgID(msgid)
, m_LastActiveAt{now}
{
}
void
InboundMessage::HandleData(uint16_t idx, const llarp_buffer_t &buf,
llarp_time_t now)
{
if(idx + buf.sz > m_Data.size())
{
LogWarn("invalid fragment offset ", idx);
return;
}
byte_t *dst = m_Data.data() + idx;
std::copy_n(buf.base, buf.sz, dst);
m_Acks.set(idx / FragmentSize);
LogDebug("got fragment ", idx / FragmentSize);
m_LastActiveAt = now;
}
ILinkSession::Packet_t
InboundMessage::ACKS() const
{
auto acks = CreatePacket(Command::eACKS, 9);
htobe64buf(acks.data() + CommandOverhead + PacketOverhead, m_MsgID);
acks[PacketOverhead + 10] = AcksBitmask();
return acks;
}
byte_t
InboundMessage::AcksBitmask() const
{
return byte_t{(byte_t)m_Acks.to_ulong()};
}
bool
InboundMessage::IsCompleted() const
{
const auto sz = m_Data.size();
for(size_t idx = 0; idx < sz; idx += FragmentSize)
{
if(not m_Acks.test(idx / FragmentSize))
return false;
}
return true;
}
bool
InboundMessage::ShouldSendACKS(llarp_time_t now) const
{
return now > m_LastACKSent + ACKResendInterval;
}
bool
InboundMessage::IsTimedOut(const llarp_time_t now) const
{
return now > m_LastActiveAt && now - m_LastActiveAt > DeliveryTimeout;
}
void
InboundMessage::SendACKS(
std::function< void(ILinkSession::Packet_t) > sendpkt, llarp_time_t now)
{
sendpkt(ACKS());
m_LastACKSent = now;
}
bool
InboundMessage::Verify() const
{
ShortHash gotten;
const llarp_buffer_t buf(m_Data);
CryptoManager::instance()->shorthash(gotten, buf);
return gotten == m_Digset;
}
} // namespace iwp
} // namespace llarp
|
{
"pile_set_name": "Github"
}
|
<?php
// Copyright 2004-present Facebook. All Rights Reserved.
abstract class BistroDataFetcher extends BistroLoadableByName {
const NUMBER_OF_JOBS_UNKNOWN = 'an unknown number of';
protected $hostPorts;
protected $hostPortSource;
protected $instanceHealthChecker;
protected $prefs;
private $numAllJobs; // So that the user knows if they are seeing all jobs
private $numFilteredJobs; // How many matched the filter?
private $jobIDs; // Used for a sanity check.
public static function newFrom(
BistroHostPortSource $hp_source, BistroJobListPrefs $prefs) {
$fetcher_name = $prefs->get(BistroJobListPrefs::PREF_FETCHER);
/* HH_FIXME[4105] Type extra args (to be sent through to constructor) */
return parent::baseNewFrom($fetcher_name, __CLASS__, $hp_source, $prefs);
}
// You should never construct this class directly.
//
// Needs to be public because PHP5 will not otherwise let this class's
// base (BistroLoadableByName) call this constructor via newv().
public function __construct(
BistroHostPortSource $hp_source, BistroJobListPrefs $prefs) {
$this->prefs = $prefs;
$this->hostPortSource = $hp_source;
$this->hostPorts = $this->hostPortSource->parse();
$this->instanceHealthChecker =
new BistroInstanceHealthChecker($this->prefs);
}
//
// These can only be called after loadJobIDs():
//
// Returns populated BistroJobs
abstract public function loadJobs();
// For duplicate shard detection. TODO: rename to loadLevelToNodes
abstract public function loadNodeNames();
// Returns a job-independent BistroInstanceErrors object.
abstract public function loadErrors();
// Fetcher-specific helper for loadJobIDs(). Note that if you fetch all
// data for all jobs in this function, you will reduce latency of the "get
// all" query, but will also eliminate most perf benefits of paging.
abstract protected function fetchAllJobIDs();
/**
* Get job IDs to render on this request. Can be called in two ways:
*
* 1) [Only when PREF_JOBS is not set]
*
* The argument $job_ids is empty, and we must load all available job
* IDs (modulo the pager). However, it may save latency for your
* fetcher to also get summary data for all jobs (and memoize it),
* since the common case is currently to show all jobs, rather than to
* page through jobs.
*
* 2) $job_ids is non-empty -- this puts the fetcher in a state where
* it will only fetch data for the requested jobs.
*/
public function loadJobIDs(
array $job_ids,
BistroPagerView $pager,
/* string */ $job_id_regex) {
if ($this->jobIDs !== null) {
if ($this->jobIDs !== $job_ids) {
throw new Exception(
'Already called load() with job IDs '.
print_r($this->jobIDs, 1).' but now requesting job IDs '.
print_r($job_ids, 1));
}
return $this->jobIDs;
}
// If the user had specified the job IDs upfront, we won't fetch the
// whole list.
if ($job_ids) {
// TODO: We should ask Bistro for the total # of jobs as part of the
// loadJobs request, and feed that integer into a ConsensusFinder.
$this->setNumAllJobs(BistroDataFetcher::NUMBER_OF_JOBS_UNKNOWN);
} else {
// NOT TO DO: If this were to take offset & N = $pager->getPageSize()
// + 1, and fetch all job data for just those jobs, then we wouldn't
// overfetch when paging. However, if the job lists don't line up
// perfectly across instances, we'll have major consensus issues, and
// no clear way to present this well in the UI.
//
// TODO: A more salient optimization for the paged case is just to do
// two roundtrips: (1) to fetch all job IDs, page them, then (2) fetch
// data just for the paged IDs. This increases the chance of
// connection failure, and the latency of the non-paged case, so we
// don't do it yet.
//
// Possible microoptimization for two roundtrips: fetch up to N IDs
// starting from offset from each hostport, discard the Nth element
// from each, merge the lists, and fetch job info for the union (even
// if it's larger than the pager). Display more than the pager asked
// for.
$job_ids = $this->fetchAllJobIDs();
$this->setNumAllJobs(count($job_ids));
}
$filtered_ids = array();
foreach ($job_ids as $job_id) {
// PHP requires delimiters; using curly braces avoids the need for
// escaping.
if (preg_match('{'.$job_id_regex.'}', $job_id)) {
$filtered_ids[] = $job_id;
}
}
$this->setNumFilteredJobs(count($filtered_ids));
asort($filtered_ids);
$this->jobIDs =
$pager->sliceResults(array_slice($filtered_ids, $pager->getOffset()));
return $this->jobIDs;
}
protected function getJobIDs() {
if ($this->jobIDs === null) {
throw new Exception('must loadJobIDs before getJobIDs');
}
return $this->jobIDs;
}
// Tell the user that the job summary bar may not reflect all known jobs.
public function getNumAllJobs() {
if ($this->numAllJobs === null) {
throw new Exception('must loadJobIDs before getNumAllJobs');
}
return $this->numAllJobs;
}
private function setNumAllJobs($num) {
if ($this->numAllJobs !== null) {
throw new Exception('numAllJobs already set to '.$this->numAllJobs);
}
$this->numAllJobs = $num;
}
// Tell the user how many jobs were filtered out.
public function getNumFilteredJobs() {
if ($this->numFilteredJobs === null) {
throw new Exception('must loadJobIDs before getNumFilteredJobs');
}
return $this->numFilteredJobs;
}
private function setNumFilteredJobs($num) {
if ($this->numFilteredJobs !== null) {
throw new Exception(
'numFilteredJobs already set to '.$this->numFilteredJobs);
}
$this->numFilteredJobs = $num;
}
}
|
{
"pile_set_name": "Github"
}
|
namespace UnityEngine.PostProcessing
{
public sealed class MinAttribute : PropertyAttribute
{
public readonly float min;
public MinAttribute(float min)
{
this.min = min;
}
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* @file lwipopts.h
* @author Ambroz Bizjak <[email protected]>
*
* @section LICENSE
*
* 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 author nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LWIP_CUSTOM_LWIPOPTS_H
#define LWIP_CUSTOM_LWIPOPTS_H
#define NO_SYS 1
#define MEM_ALIGNMENT 4
#define LWIP_ARP 0
#define ARP_QUEUEING 0
#define IP_FORWARD 0
#define LWIP_ICMP 1
#define LWIP_RAW 0
#define LWIP_DHCP 0
#define LWIP_AUTOIP 0
#define LWIP_SNMP 0
#define LWIP_IGMP 0
#define LWIP_DNS 0
#define LWIP_UDP 0
#define LWIP_UDPLITE 0
#define LWIP_TCP 1
#define LWIP_CALLBACK_API 1
#define LWIP_NETIF_API 0
#define LWIP_NETIF_LOOPBACK 0
#define LWIP_HAVE_LOOPIF 0
#define LWIP_HAVE_SLIPIF 0
#define LWIP_NETCONN 0
#define LWIP_SOCKET 0
#define PPP_SUPPORT 0
#define LWIP_IPV6 1
#define LWIP_IPV6_MLD 0
#define LWIP_IPV6_AUTOCONFIG 0
#define MEMP_NUM_TCP_PCB_LISTEN 16
#define MEMP_NUM_TCP_PCB 1024
#define TCP_MSS 1460
#define TCP_SND_BUF 16384
#define TCP_SND_QUEUELEN (4 * (TCP_SND_BUF)/(TCP_MSS))
#define MEM_LIBC_MALLOC 1
#define MEMP_MEM_MALLOC 1
#endif
|
{
"pile_set_name": "Github"
}
|
@model Pitstop.ViewModels.WorkshopManagementDetailsViewModel
@{
ViewData["Title"] = "Planning Details";
}
<h3 id="PageTitle">Workshop Management - details</h3>
<table class="table">
<tbody>
<tr>
<td width="150">Date :</td>
<td><b>@Model.Date.ToString("dd-MM-yyyy")</b></td>
</tr>
<tr>
<td width="150">Status :</td>
<td id="JobStatus"><b>@Model.MaintenanceJob.Status</b></td>
</tr>
<tr>
<td width="150">Start time :</td>
<td><b>@Model.MaintenanceJob.StartTime.ToString("HH:mm")</b></td>
</tr>
<tr>
<td width="150">End time :</td>
<td><b>@Model.MaintenanceJob.EndTime.ToString("HH:mm")</b></td>
</tr>
<tr>
<td width="150">Description :</td>
<td><b>@Model.MaintenanceJob.Description</b></td>
</tr>
<tr>
<td width="150">Vehicle :</td>
<td><b><a href='@(Url.Action("Details", "VehicleManagement", new { licenseNumber = Model.MaintenanceJob.Vehicle.LicenseNumber }))'>@Model.MaintenanceJob.Vehicle.Brand @Model.MaintenanceJob.Vehicle.Type [@Model.MaintenanceJob.Vehicle.LicenseNumber]</a></b></td>
</tr>
<tr>
<td width="150">Owner :</td>
<td><b><a href='@(Url.Action("Details", "CustomerManagement", new { id = Model.MaintenanceJob.Customer.CustomerId }))'>@Model.MaintenanceJob.Customer.Name [@Model.MaintenanceJob.Customer.TelephoneNumber]</a></b></td>
</tr>
@if (Model.MaintenanceJob.Status != "Planned")
{
<tr>
<td width="150">Actual Start time :</td>
<td><b>@Model.MaintenanceJob.ActualStartTime</b></td>
</tr>
<tr>
<td width="150">Actual End time :</td>
<td><b>@Model.MaintenanceJob.ActualEndTime</b></td>
</tr>
<tr>
<td width="150">Mechanic notes :</td>
<td><b>@Model.MaintenanceJob.Notes</b></td>
</tr>
}
</tbody>
</table>
<span><a id="BackButton" asp-action="Index" asp-controller="WorkshopManagement" asp-route-planningDate="@Model.Date.ToString("yyyy-MM-dd")" class="btn btn-default">Back</a></span>
@if (Model.MaintenanceJob.Status != "Completed" )
{
<span><a id="CompleteButton" asp-action="Finish" asp-controller="WorkshopManagement" asp-route-planningDate="@Model.Date.ToString("yyyy-MM-dd")" asp-route-jobId="@Model.MaintenanceJob.Id" class="btn btn-default">Complete</a></span>
}
|
{
"pile_set_name": "Github"
}
|
<?php
namespace ComposerRequireCheckerTest\DefinedSymbolsLocator;
use ArrayObject;
use ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromASTRoots;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Trait_;
use PHPUnit\Framework\TestCase;
/**
* @covers \ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromASTRoots
*/
final class LocateDefinedSymbolsFromASTRootsTest extends TestCase
{
/** @var LocateDefinedSymbolsFromASTRoots */
private $locator;
protected function setUp(): void
{
parent::setUp();
$this->locator = new LocateDefinedSymbolsFromASTRoots();
}
public function testNoRoots(): void
{
$symbols = $this->locate([]);
$this->assertCount(0, $symbols);
}
public function testBasicLocateClass(): void
{
$roots = [
new Class_('MyClassA'), new Class_('MyClassB'),
new Class_('MyClassC'),
];
$symbols = $this->locate([$roots]);
$this->assertIsArray($symbols);
$this->assertCount(3, $symbols);
$this->assertContains('MyClassA', $symbols);
$this->assertContains('MyClassB', $symbols);
$this->assertContains('MyClassC', $symbols);
}
public function testBasicLocateFunctions(): void
{
$roots = [
new Function_('myFunctionA'),
new Class_('myFunctionB'),
];
$symbols = $this->locate([$roots]);
$this->assertIsArray($symbols);
$this->assertCount(2, $symbols);
$this->assertContains('myFunctionA', $symbols);
$this->assertContains('myFunctionB', $symbols);
}
public function testBasicLocateTrait(): void
{
$roots = [
new Trait_('MyTraitA'), new Trait_('MyTraitB'),
new Trait_('MyTraitC'),
];
$symbols = $this->locate([$roots]);
$this->assertIsArray($symbols);
$this->assertCount(3, $symbols);
$this->assertContains('MyTraitA', $symbols);
$this->assertContains('MyTraitB', $symbols);
$this->assertContains('MyTraitC', $symbols);
}
public function testBasicLocateAnonymous(): void
{
$roots = [
new Class_(null),
];
$symbols = $this->locate([$roots]);
$this->assertIsArray($symbols);
$this->assertCount(0, $symbols);
}
public function testBasicLocateDefineCalls(): void
{
$roots = [
new FuncCall(new Name('define'), [
new Arg(new String_('CONST_NAME')),
new Arg(new String_('CONST_VALUE')),
])
];
$symbols = $this->locate([$roots]);
$this->assertIsArray($symbols);
$this->assertCount(1, $symbols);
}
public function testBasicDoNotLocateNamespacedDefineCalls(): void
{
$roots = [
new FuncCall(new Name('define', ['namespacedName' => new Name\FullyQualified('Foo\define')]), [
new Arg(new String_('NO_CONST')),
new Arg(new String_('NO_SOMETHING')),
])
];
$symbols = $this->locate([$roots]);
$this->assertIsArray($symbols);
$this->assertCount(0, $symbols);
}
private function locate(array $roots): array
{
return ($this->locator)(new ArrayObject($roots));
}
}
|
{
"pile_set_name": "Github"
}
|
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <[email protected]>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ITERATOR_TRANSFORM_ITERATOR_HPP
#define BOOST_COMPUTE_ITERATOR_TRANSFORM_ITERATOR_HPP
#include <cstddef>
#include <iterator>
#include <boost/config.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/compute/functional.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/is_buffer_iterator.hpp>
#include <boost/compute/detail/read_write_single_value.hpp>
#include <boost/compute/iterator/detail/get_base_iterator_buffer.hpp>
#include <boost/compute/type_traits/is_device_iterator.hpp>
#include <boost/compute/type_traits/result_of.hpp>
namespace boost {
namespace compute {
// forward declaration for transform_iterator
template<class InputIterator, class UnaryFunction>
class transform_iterator;
namespace detail {
// meta-function returning the value_type for a transform_iterator
template<class InputIterator, class UnaryFunction>
struct make_transform_iterator_value_type
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
typedef typename boost::compute::result_of<UnaryFunction(value_type)>::type type;
};
// helper class which defines the iterator_adaptor super-class
// type for transform_iterator
template<class InputIterator, class UnaryFunction>
class transform_iterator_base
{
public:
typedef ::boost::iterator_adaptor<
::boost::compute::transform_iterator<InputIterator, UnaryFunction>,
InputIterator,
typename make_transform_iterator_value_type<InputIterator, UnaryFunction>::type,
typename std::iterator_traits<InputIterator>::iterator_category,
typename make_transform_iterator_value_type<InputIterator, UnaryFunction>::type
> type;
};
template<class InputIterator, class UnaryFunction, class IndexExpr>
struct transform_iterator_index_expr
{
typedef typename
make_transform_iterator_value_type<
InputIterator,
UnaryFunction
>::type result_type;
transform_iterator_index_expr(const InputIterator &input_iter,
const UnaryFunction &transform_expr,
const IndexExpr &index_expr)
: m_input_iter(input_iter),
m_transform_expr(transform_expr),
m_index_expr(index_expr)
{
}
InputIterator m_input_iter;
UnaryFunction m_transform_expr;
IndexExpr m_index_expr;
};
template<class InputIterator, class UnaryFunction, class IndexExpr>
inline meta_kernel& operator<<(meta_kernel &kernel,
const transform_iterator_index_expr<InputIterator,
UnaryFunction,
IndexExpr> &expr)
{
return kernel << expr.m_transform_expr(expr.m_input_iter[expr.m_index_expr]);
}
} // end detail namespace
/// \class transform_iterator
/// \brief A transform iterator adaptor.
///
/// The transform_iterator adaptor applies a unary function to each element
/// produced from the underlying iterator when dereferenced.
///
/// For example, to copy from an input range to an output range while taking
/// the absolute value of each element:
///
/// \snippet test/test_transform_iterator.cpp copy_abs
///
/// \see buffer_iterator, make_transform_iterator()
template<class InputIterator, class UnaryFunction>
class transform_iterator :
public detail::transform_iterator_base<InputIterator, UnaryFunction>::type
{
public:
typedef typename
detail::transform_iterator_base<InputIterator,
UnaryFunction>::type super_type;
typedef typename super_type::value_type value_type;
typedef typename super_type::reference reference;
typedef typename super_type::base_type base_type;
typedef typename super_type::difference_type difference_type;
typedef UnaryFunction unary_function;
transform_iterator(InputIterator iterator, UnaryFunction transform)
: super_type(iterator),
m_transform(transform)
{
}
transform_iterator(const transform_iterator<InputIterator,
UnaryFunction> &other)
: super_type(other.base()),
m_transform(other.m_transform)
{
}
transform_iterator<InputIterator, UnaryFunction>&
operator=(const transform_iterator<InputIterator,
UnaryFunction> &other)
{
if(this != &other){
super_type::operator=(other);
m_transform = other.m_transform;
}
return *this;
}
~transform_iterator()
{
}
size_t get_index() const
{
return super_type::base().get_index();
}
const buffer& get_buffer() const
{
return detail::get_base_iterator_buffer(*this);
}
template<class IndexExpression>
detail::transform_iterator_index_expr<InputIterator, UnaryFunction, IndexExpression>
operator[](const IndexExpression &expr) const
{
return detail::transform_iterator_index_expr<InputIterator,
UnaryFunction,
IndexExpression>(super_type::base(),
m_transform,
expr);
}
private:
friend class ::boost::iterator_core_access;
reference dereference() const
{
const context &context = super_type::base().get_buffer().get_context();
command_queue queue(context, context.get_device());
detail::meta_kernel k("read");
size_t output_arg = k.add_arg<value_type *>(memory_object::global_memory, "output");
k << "*output = " << m_transform(super_type::base()[k.lit(0)]) << ";";
kernel kernel = k.compile(context);
buffer output_buffer(context, sizeof(value_type));
kernel.set_arg(output_arg, output_buffer);
queue.enqueue_task(kernel);
return detail::read_single_value<value_type>(output_buffer, queue);
}
private:
UnaryFunction m_transform;
};
/// Returns a transform_iterator for \p iterator with \p transform.
///
/// \param iterator the underlying iterator
/// \param transform the unary transform function
///
/// \return a \c transform_iterator for \p iterator with \p transform
///
/// For example, to create an iterator which returns the square-root of each
/// value in a \c vector<int>:
/// \code
/// auto sqrt_iterator = make_transform_iterator(vec.begin(), sqrt<int>());
/// \endcode
template<class InputIterator, class UnaryFunction>
inline transform_iterator<InputIterator, UnaryFunction>
make_transform_iterator(InputIterator iterator, UnaryFunction transform)
{
return transform_iterator<InputIterator,
UnaryFunction>(iterator, transform);
}
/// \internal_ (is_device_iterator specialization for transform_iterator)
template<class InputIterator, class UnaryFunction>
struct is_device_iterator<
transform_iterator<InputIterator, UnaryFunction> > : boost::true_type {};
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ITERATOR_TRANSFORM_ITERATOR_HPP
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-core-parent</artifactId>
<version>13.0.0.Beta7-SNAPSHOT</version>
</parent>
<artifactId>wildfly-logging</artifactId>
<name>WildFly: Logging Subsystem</name>
<properties>
<surefire.argLine>${surefire.system.args}</surefire.argLine>
<jboss.modules.dir>${project.build.directory}${file.separator}modules</jboss.modules.dir>
<test.class.path>${project.build.testOutputDirectory}</test.class.path>
</properties>
<build>
<testResources>
<!-- Process default resources -->
<testResource>
<directory>src/test/resources</directory>
<targetPath>${project.build.testOutputDirectory}</targetPath>
</testResource>
<!-- Process modules for a fake modular environment, this is used for custom-handler's, custom-formatter's
and filters.
-->
<testResource>
<directory>src/test/modules</directory>
<filtering>true</filtering>
<targetPath>${jboss.modules.dir}</targetPath>
</testResource>
</testResources>
<plugins>
<!-- this is only needed on windows -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-javaagent:${org.jboss.byteman:byteman:jar}=port:${byteman.port},address:${byteman.host},boot:${org.jboss.byteman:byteman:jar} ${surefire.argLine}</argLine>
<systemPropertyVariables>
<!-- Configure a module directory as custom-handler's, custom-formatter's and filters require
a module to be used
-->
<jboss.modules.dir>${jboss.modules.dir}</jboss.modules.dir>
<module.path>${jboss.modules.dir}</module.path>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<jboss.server.log.dir>${project.build.directory}${file.separator}logs</jboss.server.log.dir>
<jboss.server.config.dir>${project.build.directory}${file.separator}config</jboss.server.config.dir>
<org.jboss.byteman.contrib.bmunit.agent.inhibit>true</org.jboss.byteman.contrib.bmunit.agent.inhibit>
<org.jboss.byteman.debug>true</org.jboss.byteman.debug>
<org.jboss.byteman.contrib.bmunit.agent.host>${byteman.host}</org.jboss.byteman.contrib.bmunit.agent.host>
<org.jboss.byteman.contrib.bmunit.agent.port>${byteman.port}</org.jboss.byteman.contrib.bmunit.agent.port>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-dmr</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.modules</groupId>
<artifactId>jboss-modules</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>staxmapper</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-controller</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-network</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-server</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>log4j-jboss-logmanager</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.msc</groupId>
<artifactId>jboss-msc</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.stdio</groupId>
<artifactId>jboss-stdio</artifactId>
</dependency>
<!-- Required for the json-formatter -->
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
</dependency>
<!-- Test dependencies -->
<!-- Would be brought in transitively by wildfly-controller normally. Required for ParseUtils -->
<dependency>
<groupId>org.projectodd.vdx</groupId>
<artifactId>vdx-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-submit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-install</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-bmunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-controller-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-subsystem-test</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- profile is the same name as the test IPv6 profile for consistency and in case the profile is enabled via
the profile name rather than the system property. -->
<profile>
<id>ts.ipv6</id>
<activation>
<property>
<name>ipv6</name>
</property>
</activation>
<properties>
<byteman.host>::1</byteman.host>
</properties>
</profile>
<profile>
<id>ibm-jdk</id>
<activation>
<property>
<name>java.vendor</name>
<value>IBM Corporation</value>
</property>
</activation>
<properties>
<surefire.argLine>-Xbootclasspath/a:${org.jboss.logmanager:jboss-logmanager} -Djava.util.logging.manager=org.jboss.logmanager.LogManager ${surefire.system.args}</surefire.argLine>
</properties>
</profile>
<profile>
<id>openj9</id>
<activation>
<property>
<name>java.vendor</name>
<value>Eclipse OpenJ9</value>
</property>
</activation>
<properties>
<surefire.argLine>-Xbootclasspath/a:${org.jboss.logmanager:jboss-logmanager} -Djava.util.logging.manager=org.jboss.logmanager.LogManager ${surefire.system.args}</surefire.argLine>
</properties>
</profile>
</profiles>
</project>
|
{
"pile_set_name": "Github"
}
|
# Generated by Chef.
---
host: <%= @host %>
port: <%= @port %>
<%- if node[:vayacondios][:organization] %>
organization: <%= node[:vayacondios][:organization] %>
<% end %>
|
{
"pile_set_name": "Github"
}
|
using System;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using Microsoft.Extensions.Options;
using Orleans.Configuration;
using System.Threading;
namespace Orleans.Runtime
{
internal class FatalErrorHandler : IFatalErrorHandler
{
private readonly ILogger<FatalErrorHandler> log;
private readonly ClusterMembershipOptions clusterMembershipOptions;
public FatalErrorHandler(
ILogger<FatalErrorHandler> log,
IOptions<ClusterMembershipOptions> clusterMembershipOptions)
{
this.log = log;
this.clusterMembershipOptions = clusterMembershipOptions.Value;
}
public bool IsUnexpected(Exception exception)
{
return !(exception is ThreadAbortException);
}
public void OnFatalException(object sender, string context, Exception exception)
{
if (exception != null)
{
this.log.LogError(
(int)ErrorCode.Logger_ProcessCrashing,
exception,
"Fatal error from {Sender}. Context: {Context}. Exception: {Exception}",
sender,
context,
exception);
}
else
{
this.log.LogError(
(int)ErrorCode.Logger_ProcessCrashing,
"Fatal error from {Sender}. Context: {Context}",
sender,
context);
}
if (!this.clusterMembershipOptions.IsRunningAsUnitTest)
{
var msg = $"FATAL EXCEPTION from {sender?.ToString() ?? "null"}. Context: {context ?? "null"}. "
+ $"Exception: {(exception != null ? LogFormatter.PrintException(exception) : "null")}.\n"
+ $"Current stack: {Environment.StackTrace}";
Console.Error.WriteLine(msg);
// Allow some time for loggers to flush.
Thread.Sleep(2000);
if (Debugger.IsAttached) Debugger.Break();
Environment.FailFast(msg, exception);
}
else
{
this.log.LogWarning(
$"{nameof(ClusterMembershipOptions)}.{nameof(ClusterMembershipOptions.IsRunningAsUnitTest)} is set."
+ " The process will not be terminated.");
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
//
// SQNavigationController.h
//
// Created by Doubles_Z on 15/9/5.
// Copyright (c) 2015年 Doubles_Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SQNavigationController : UINavigationController
@end
|
{
"pile_set_name": "Github"
}
|
#
# (C) Copyright 2000-2006
# Wolfgang Denk, DENX Software Engineering, [email protected].
#
# SPDX-License-Identifier: GPL-2.0+
#
obj-y = ar405.o flash.o ../common/misc.o
|
{
"pile_set_name": "Github"
}
|
{
"images" : [
{
"idiom" : "universal",
"filename" : "pw.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
|
{
"pile_set_name": "Github"
}
|
import java.util.HashMap;
import java.util.Map;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
// https://leetcode-cn.com/problems/group-anagrams/
class L0049_Group_Anagrams {
public List<List<String>> groupAnagrams(String[] strs) {
Map<String, List<String>> map = new HashMap<>();
for (String s : strs) {
// sort by letter
char[] array = s.toCharArray();
Arrays.sort(array);
String sortString = String.valueOf(array);
if (map.containsKey(sortString)) {
map.get(sortString).add(s);
} else {
List<String> list = new ArrayList<>();
list.add(s);
map.put(sortString, list);
}
}
return new ArrayList<>(map.values());
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* (C) 2001 Clemson University and The University of Chicago
* (C) 2011 Omnibond Systems
*
* Changes by Acxiom Corporation to implement generic service_operation()
* function, Copyright Acxiom Corporation, 2005.
*
* See COPYING in top-level directory.
*/
/*
* In-kernel waitqueue operations.
*/
#include "protocol.h"
#include "orangefs-kernel.h"
#include "orangefs-bufmap.h"
static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, long, bool);
static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *);
/*
* What we do in this function is to walk the list of operations that are
* present in the request queue and mark them as purged.
* NOTE: This is called from the device close after client-core has
* guaranteed that no new operations could appear on the list since the
* client-core is anyway going to exit.
*/
void purge_waiting_ops(void)
{
struct orangefs_kernel_op_s *op;
spin_lock(&orangefs_request_list_lock);
list_for_each_entry(op, &orangefs_request_list, list) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"pvfs2-client-core: purging op tag %llu %s\n",
llu(op->tag),
get_opname_string(op));
set_op_state_purged(op);
gossip_debug(GOSSIP_DEV_DEBUG,
"%s: op:%s: op_state:%d: process:%s:\n",
__func__,
get_opname_string(op),
op->op_state,
current->comm);
}
spin_unlock(&orangefs_request_list_lock);
}
/*
* submits a ORANGEFS operation and waits for it to complete
*
* Note op->downcall.status will contain the status of the operation (in
* errno format), whether provided by pvfs2-client or a result of failure to
* service the operation. If the caller wishes to distinguish, then
* op->state can be checked to see if it was serviced or not.
*
* Returns contents of op->downcall.status for convenience
*/
int service_operation(struct orangefs_kernel_op_s *op,
const char *op_name,
int flags)
{
long timeout = MAX_SCHEDULE_TIMEOUT;
int ret = 0;
DEFINE_WAIT(wait_entry);
op->upcall.tgid = current->tgid;
op->upcall.pid = current->pid;
retry_servicing:
op->downcall.status = 0;
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: %s op:%p: process:%s: pid:%d:\n",
__func__,
op_name,
op,
current->comm,
current->pid);
/*
* If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
* acquiring the request_mutex because we're servicing a
* high priority remount operation and the request_mutex is
* already taken.
*/
if (!(flags & ORANGEFS_OP_NO_MUTEX)) {
if (flags & ORANGEFS_OP_INTERRUPTIBLE)
ret = mutex_lock_interruptible(&orangefs_request_mutex);
else
ret = mutex_lock_killable(&orangefs_request_mutex);
/*
* check to see if we were interrupted while waiting for
* mutex
*/
if (ret < 0) {
op->downcall.status = ret;
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: service_operation interrupted.\n",
__func__);
return ret;
}
}
/* queue up the operation */
spin_lock(&orangefs_request_list_lock);
spin_lock(&op->lock);
set_op_state_waiting(op);
gossip_debug(GOSSIP_DEV_DEBUG,
"%s: op:%s: op_state:%d: process:%s:\n",
__func__,
get_opname_string(op),
op->op_state,
current->comm);
/* add high priority remount op to the front of the line. */
if (flags & ORANGEFS_OP_PRIORITY)
list_add(&op->list, &orangefs_request_list);
else
list_add_tail(&op->list, &orangefs_request_list);
spin_unlock(&op->lock);
wake_up_interruptible(&orangefs_request_list_waitq);
if (!__is_daemon_in_service()) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s:client core is NOT in service.\n",
__func__);
timeout = op_timeout_secs * HZ;
}
spin_unlock(&orangefs_request_list_lock);
if (!(flags & ORANGEFS_OP_NO_MUTEX))
mutex_unlock(&orangefs_request_mutex);
ret = wait_for_matching_downcall(op, timeout,
flags & ORANGEFS_OP_INTERRUPTIBLE);
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: wait_for_matching_downcall returned %d for %p\n",
__func__,
ret,
op);
/* got matching downcall; make sure status is in errno format */
if (!ret) {
spin_unlock(&op->lock);
op->downcall.status =
orangefs_normalize_to_errno(op->downcall.status);
ret = op->downcall.status;
goto out;
}
/* failed to get matching downcall */
if (ret == -ETIMEDOUT) {
gossip_err("%s: %s -- wait timed out; aborting attempt.\n",
__func__,
op_name);
}
/*
* remove a waiting op from the request list or
* remove an in-progress op from the in-progress list.
*/
orangefs_clean_up_interrupted_operation(op);
op->downcall.status = ret;
/* retry if operation has not been serviced and if requested */
if (ret == -EAGAIN) {
op->attempts++;
timeout = op_timeout_secs * HZ;
gossip_debug(GOSSIP_WAIT_DEBUG,
"orangefs: tag %llu (%s)"
" -- operation to be retried (%d attempt)\n",
llu(op->tag),
op_name,
op->attempts);
/*
* io ops (ops that use the shared memory buffer) have
* to be returned to their caller for a retry. Other ops
* can just be recycled here.
*/
if (!op->uses_shared_memory)
goto retry_servicing;
}
out:
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: %s returning: %d for %p.\n",
__func__,
op_name,
ret,
op);
return ret;
}
/* This can get called on an I/O op if it had a bad service_operation. */
bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
{
u64 tag = op->tag;
if (!op_state_in_progress(op))
return false;
op->slot_to_free = op->upcall.req.io.buf_index;
memset(&op->upcall, 0, sizeof(op->upcall));
memset(&op->downcall, 0, sizeof(op->downcall));
op->upcall.type = ORANGEFS_VFS_OP_CANCEL;
op->upcall.req.cancel.op_tag = tag;
op->downcall.type = ORANGEFS_VFS_OP_INVALID;
op->downcall.status = -1;
orangefs_new_tag(op);
spin_lock(&orangefs_request_list_lock);
/* orangefs_request_list_lock is enough of a barrier here */
if (!__is_daemon_in_service()) {
spin_unlock(&orangefs_request_list_lock);
return false;
}
spin_lock(&op->lock);
set_op_state_waiting(op);
gossip_debug(GOSSIP_DEV_DEBUG,
"%s: op:%s: op_state:%d: process:%s:\n",
__func__,
get_opname_string(op),
op->op_state,
current->comm);
list_add(&op->list, &orangefs_request_list);
spin_unlock(&op->lock);
spin_unlock(&orangefs_request_list_lock);
gossip_debug(GOSSIP_WAIT_DEBUG,
"Attempting ORANGEFS operation cancellation of tag %llu\n",
llu(tag));
return true;
}
/*
* Change an op to the "given up" state and remove it from its list.
*/
static void
orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
{
/*
* handle interrupted cases depending on what state we were in when
* the interruption is detected.
*
* Called with op->lock held.
*/
/*
* List manipulation code elsewhere will ignore ops that
* have been given up upon.
*/
op->op_state |= OP_VFS_STATE_GIVEN_UP;
if (list_empty(&op->list)) {
/* caught copying to/from daemon */
BUG_ON(op_state_serviced(op));
spin_unlock(&op->lock);
wait_for_completion(&op->waitq);
} else if (op_state_waiting(op)) {
/*
* upcall hasn't been read; remove op from upcall request
* list.
*/
spin_unlock(&op->lock);
spin_lock(&orangefs_request_list_lock);
list_del_init(&op->list);
spin_unlock(&orangefs_request_list_lock);
gossip_debug(GOSSIP_WAIT_DEBUG,
"Interrupted: Removed op %p from request_list\n",
op);
} else if (op_state_in_progress(op)) {
/* op must be removed from the in progress htable */
spin_unlock(&op->lock);
spin_lock(&orangefs_htable_ops_in_progress_lock);
list_del_init(&op->list);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
gossip_debug(GOSSIP_WAIT_DEBUG,
"Interrupted: Removed op %p"
" from htable_ops_in_progress\n",
op);
} else {
spin_unlock(&op->lock);
gossip_err("interrupted operation is in a weird state 0x%x\n",
op->op_state);
}
reinit_completion(&op->waitq);
}
/*
* Sleeps on waitqueue waiting for matching downcall.
* If client-core finishes servicing, then we are good to go.
* else if client-core exits, we get woken up here, and retry with a timeout
*
* When this call returns to the caller, the specified op will no
* longer be in either the in_progress hash table or on the request list.
*
* Returns 0 on success and -errno on failure
* Errors are:
* EAGAIN in case we want the caller to requeue and try again..
* EINTR/EIO/ETIMEDOUT indicating we are done trying to service this
* operation since client-core seems to be exiting too often
* or if we were interrupted.
*
* Returns with op->lock taken.
*/
static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
long timeout,
bool interruptible)
{
long n;
/*
* There's a "schedule_timeout" inside of these wait
* primitives, during which the op is out of the hands of the
* user process that needs something done and is being
* manipulated by the client-core process.
*/
if (interruptible)
n = wait_for_completion_interruptible_timeout(&op->waitq,
timeout);
else
n = wait_for_completion_killable_timeout(&op->waitq, timeout);
spin_lock(&op->lock);
if (op_state_serviced(op))
return 0;
if (unlikely(n < 0)) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: operation interrupted, tag %llu, %p\n",
__func__,
llu(op->tag),
op);
return -EINTR;
}
if (op_state_purged(op)) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: operation purged, tag %llu, %p, %d\n",
__func__,
llu(op->tag),
op,
op->attempts);
return (op->attempts < ORANGEFS_PURGE_RETRY_COUNT) ?
-EAGAIN :
-EIO;
}
/* must have timed out, then... */
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: operation timed out, tag %llu, %p, %d)\n",
__func__,
llu(op->tag),
op,
op->attempts);
return -ETIMEDOUT;
}
|
{
"pile_set_name": "Github"
}
|
// Code generated by go-swagger; DO NOT EDIT.
package pet
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// FindPetsByTagsHandlerFunc turns a function with the right signature into a find pets by tags handler
type FindPetsByTagsHandlerFunc func(FindPetsByTagsParams, interface{}) middleware.Responder
// Handle executing the request and returning a response
func (fn FindPetsByTagsHandlerFunc) Handle(params FindPetsByTagsParams, principal interface{}) middleware.Responder {
return fn(params, principal)
}
// FindPetsByTagsHandler interface for that can handle valid find pets by tags params
type FindPetsByTagsHandler interface {
Handle(FindPetsByTagsParams, interface{}) middleware.Responder
}
// NewFindPetsByTags creates a new http.Handler for the find pets by tags operation
func NewFindPetsByTags(ctx *middleware.Context, handler FindPetsByTagsHandler) *FindPetsByTags {
return &FindPetsByTags{Context: ctx, Handler: handler}
}
/*FindPetsByTags swagger:route GET /pets/findByTags pet findPetsByTags
Finds Pets by tags
Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*/
type FindPetsByTags struct {
Context *middleware.Context
Handler FindPetsByTagsHandler
}
func (o *FindPetsByTags) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
r = rCtx
}
var Params = NewFindPetsByTagsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
r = aCtx
}
var principal interface{}
if uprinc != nil {
principal = uprinc
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
|
{
"pile_set_name": "Github"
}
|
export class NewGroupModel {
// 是否弹出分组页面
private _visible: boolean;
// 分组名称
private _name: string;
public get name(): string {
return this._name;
}
public set name(v: string) {
this._name = v;
}
public get visible(): boolean {
return this._visible;
}
public set visible(v: boolean) {
this._visible = v;
}
constructor() {
this.initData();
}
public initData(): void {
this.visible = false;
this.name = "";
}
}
|
{
"pile_set_name": "Github"
}
|
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = [
"fields_test.go",
"selector_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"fields.go",
"requirements.go",
"selector.go",
],
tags = ["automanaged"],
deps = ["//vendor/k8s.io/apimachinery/pkg/selection:go_default_library"],
)
|
{
"pile_set_name": "Github"
}
|
/* iCheck plugin Minimal skin, purple
----------------------------------- */
.icheckbox_minimal-purple,
.iradio_minimal-purple {
display: inline-block;
*display: inline;
vertical-align: middle;
margin: 0;
padding: 0;
width: 18px;
height: 18px;
background: url(purple.png) no-repeat;
border: none;
cursor: pointer;
}
.icheckbox_minimal-purple {
background-position: 0 0;
}
.icheckbox_minimal-purple.hover {
background-position: -20px 0;
}
.icheckbox_minimal-purple.checked {
background-position: -40px 0;
}
.icheckbox_minimal-purple.disabled {
background-position: -60px 0;
cursor: default;
}
.icheckbox_minimal-purple.checked.disabled {
background-position: -80px 0;
}
.iradio_minimal-purple {
background-position: -100px 0;
}
.iradio_minimal-purple.hover {
background-position: -120px 0;
}
.iradio_minimal-purple.checked {
background-position: -140px 0;
}
.iradio_minimal-purple.disabled {
background-position: -160px 0;
cursor: default;
}
.iradio_minimal-purple.checked.disabled {
background-position: -180px 0;
}
/* HiDPI support */
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
.icheckbox_minimal-purple,
.iradio_minimal-purple {
background-image: url([email protected]);
-webkit-background-size: 200px 20px;
background-size: 200px 20px;
}
}
|
{
"pile_set_name": "Github"
}
|
# SOME DESCRIPTIVE TITLE.
# Copyright (C) Kovid Goyal
# This file is distributed under the same license as the calibre package.
#
# Translators:
# Andreas Dreyer Hysing, 2016
# Kurt-Håkon Eilertsen <[email protected]>, 2014
msgid ""
msgstr ""
"Project-Id-Version: calibre\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-25 09:23+0530\n"
"PO-Revision-Date: 2017-09-20 05:42+0000\n"
"Last-Translator: Kovid Goyal <[email protected]>\n"
"Language-Team: Norwegian Bokmål (http://www.transifex.com/calibre/calibre/language/nb/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nb\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../../home/kovid/work/calibre/manual/diff.rst:4
msgid "Comparing e-books"
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:6
msgid ""
"calibre includes an integrated e-book comparison tool that can be used to "
"see what has changed inside an e-book after editing or converting it. It can"
" compare books in the EPUB and AZW3 formats."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:10
msgid ""
"To use it, either open the e-book in the tool for :ref:`edit` and then click"
" :guilabel:`File->Compare to other book` or use the :ref:`book_details` "
"panel. If you do a conversion from EPUB to EPUB, the original EPUB file will"
" be saved as ORIGINAL_EPUB. Simply right click on the ORIGINAL_EPUB entry in"
" the Book details panel and choose :guilabel:`Compare to EPUB format`."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:16
msgid ""
"The comparison tool that opens will look like the screenshot below. It shows"
" you the differences in text, styles and images in the chosen books."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:25
msgid "Understanding the comparison view"
msgstr "Forstå sammenligningsvisning"
#: ../../home/kovid/work/calibre/manual/diff.rst:27
msgid ""
"As can be seen in the screenshot above, the comparison view shows the "
"differences between the two books side by side. Only the differences, with a"
" few lines of context around them are shown. This makes it easy to see at a "
"glance only what was changed inside a large document like a book."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:32
msgid ""
"Added text is shown with a green background, removed text with a red "
"background and changed text with a blue background."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:35
msgid ""
"The line numbers of all changed text are show at the sides, making it easy "
"to go to a particular change in the editor. When you open the comparison "
"tool from within the editor, you can also double click on a line in the "
"right panel to go to that line in the editor automatically."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:40
msgid ""
"One useful technique when comparing books is to tell the comparison tool to "
"beautify the text and style files before calculating differences. This can "
"often result in cleaner and easier to follow differences. To do this, click "
"the :guilabel:`Options` button in the bottom right and choose "
":guilabel:`Beautify files before comparing`. Note that beautifying can "
"sometimes have undesired effects, as it can cause invalid markup to be "
"altered to make it valid. You can also change the number of lines of context"
" shown around differences via the :guilabel:`Options` button."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:49
msgid ""
"You can search for any text in the differences via the Search bar at the "
"bottom. You will need to specify which panel to search, the :guilabel:`Left`"
" or the :guilabel:`Right`."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:54
msgid "Launching the comparison tool"
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:56
msgid ""
"The comparison tool is most useful when you have two versions of the same "
"book and you want to see what is different between them. To that end, there "
"are several ways to launch the tool."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:61
msgid "Comparing two e-book files"
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:63
msgid ""
"Open the first file in the :ref:`edit` tool. Now click "
":guilabel:`File->Compare to another book` and choose the second file (it "
"must be in the same format as the first). The comparison view will open with"
" the file being edited on the right and the second file on the left."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:69
msgid "Comparing the ORIGINAL_FMT to FMT"
msgstr "Sammenlign ORIGINAL_FMT til FMT"
#: ../../home/kovid/work/calibre/manual/diff.rst:71
msgid ""
"When you do a conversion in calibre from a FMT to itself, the original file "
"is saved as ORIGINAL_FMT. You can see what was changed by the conversion, by"
" right clicking on the ORIGINAL_FMT entry in the :ref:`book_details` panel "
"in the main calibre window and selecting :guilabel:`Compare to FMT`. The "
"comparison view will open with ORIGINAL_FMT on the left and FMT on the "
"right."
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:78
msgid "Comparing a checkpoint to the current state of the book while editing"
msgstr ""
#: ../../home/kovid/work/calibre/manual/diff.rst:80
msgid ""
"The :ref:`edit` tool has a very useful feature, called :ref:`checkpoints`. "
"This allows you to save the current state of the book as a named "
"*checkpoint*, to which you can revert if you do not like the changes you "
"have made since creating the checkpoint. Checkpoints are also created "
"automatically when you perform various automated actions in the editor. You "
"can see the list of checkpoints by going to :guilabel:`View->Checkpoints` "
"and then use the :guilabel:`Compare` button to compare the book at the "
"selected checkpoint with the current state. The comparison tool will show "
"the checkpoint on the left and the current state on the right."
msgstr ""
|
{
"pile_set_name": "Github"
}
|
#include <cstdio>
#include <iostream>
#include <algorithm>
int main(){
const long mult = 100; //Something greater than 50;
int n(0), k(0); scanf("%d %d\n", &n, &k);
int *array = new int[n];
int solved(0), penalty(0);
for(int p = 0; p < n; p++){
scanf("%d %d\n", &solved, &penalty);
array[p] = mult * solved - penalty;
}
std::sort(array, array + n);
int seekScore(array[n - k]), result(0);
for(int p = 0; p < n; p++){if(array[p] == seekScore){++result;}}
printf("%d\n", result);
return 0;
}
|
{
"pile_set_name": "Github"
}
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* NCI based Driver for STMicroelectronics NFC Chip
*
* Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
*/
#include <linux/module.h>
#include <linux/nfc.h>
#include <net/nfc/nci.h>
#include <net/nfc/nci_core.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include "st-nci.h"
#define DRIVER_DESC "NCI NFC driver for ST_NCI"
#define ST_NCI1_X_PROPRIETARY_ISO15693 0x83
static int st_nci_init(struct nci_dev *ndev)
{
struct nci_mode_set_cmd cmd;
cmd.cmd_type = ST_NCI_SET_NFC_MODE;
cmd.mode = 1;
return nci_prop_cmd(ndev, ST_NCI_CORE_PROP,
sizeof(struct nci_mode_set_cmd), (__u8 *)&cmd);
}
static int st_nci_open(struct nci_dev *ndev)
{
struct st_nci_info *info = nci_get_drvdata(ndev);
int r;
if (test_and_set_bit(ST_NCI_RUNNING, &info->flags))
return 0;
r = ndlc_open(info->ndlc);
if (r)
clear_bit(ST_NCI_RUNNING, &info->flags);
return r;
}
static int st_nci_close(struct nci_dev *ndev)
{
struct st_nci_info *info = nci_get_drvdata(ndev);
if (!test_bit(ST_NCI_RUNNING, &info->flags))
return 0;
ndlc_close(info->ndlc);
clear_bit(ST_NCI_RUNNING, &info->flags);
return 0;
}
static int st_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
{
struct st_nci_info *info = nci_get_drvdata(ndev);
skb->dev = (void *)ndev;
if (!test_bit(ST_NCI_RUNNING, &info->flags))
return -EBUSY;
return ndlc_send(info->ndlc, skb);
}
static __u32 st_nci_get_rfprotocol(struct nci_dev *ndev,
__u8 rf_protocol)
{
return rf_protocol == ST_NCI1_X_PROPRIETARY_ISO15693 ?
NFC_PROTO_ISO15693_MASK : 0;
}
static int st_nci_prop_rsp_packet(struct nci_dev *ndev,
struct sk_buff *skb)
{
__u8 status = skb->data[0];
nci_req_complete(ndev, status);
return 0;
}
static struct nci_driver_ops st_nci_prop_ops[] = {
{
.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY,
ST_NCI_CORE_PROP),
.rsp = st_nci_prop_rsp_packet,
},
};
static struct nci_ops st_nci_ops = {
.init = st_nci_init,
.open = st_nci_open,
.close = st_nci_close,
.send = st_nci_send,
.get_rfprotocol = st_nci_get_rfprotocol,
.discover_se = st_nci_discover_se,
.enable_se = st_nci_enable_se,
.disable_se = st_nci_disable_se,
.se_io = st_nci_se_io,
.hci_load_session = st_nci_hci_load_session,
.hci_event_received = st_nci_hci_event_received,
.hci_cmd_received = st_nci_hci_cmd_received,
.prop_ops = st_nci_prop_ops,
.n_prop_ops = ARRAY_SIZE(st_nci_prop_ops),
};
int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
int phy_tailroom, struct st_nci_se_status *se_status)
{
struct st_nci_info *info;
int r;
u32 protocols;
info = devm_kzalloc(ndlc->dev,
sizeof(struct st_nci_info), GFP_KERNEL);
if (!info)
return -ENOMEM;
protocols = NFC_PROTO_JEWEL_MASK
| NFC_PROTO_MIFARE_MASK
| NFC_PROTO_FELICA_MASK
| NFC_PROTO_ISO14443_MASK
| NFC_PROTO_ISO14443_B_MASK
| NFC_PROTO_ISO15693_MASK
| NFC_PROTO_NFC_DEP_MASK;
ndlc->ndev = nci_allocate_device(&st_nci_ops, protocols,
phy_headroom, phy_tailroom);
if (!ndlc->ndev) {
pr_err("Cannot allocate nfc ndev\n");
return -ENOMEM;
}
info->ndlc = ndlc;
nci_set_drvdata(ndlc->ndev, info);
r = st_nci_vendor_cmds_init(ndlc->ndev);
if (r) {
pr_err("Cannot register proprietary vendor cmds\n");
goto err_reg_dev;
}
r = nci_register_device(ndlc->ndev);
if (r) {
pr_err("Cannot register nfc device to nci core\n");
goto err_reg_dev;
}
return st_nci_se_init(ndlc->ndev, se_status);
err_reg_dev:
nci_free_device(ndlc->ndev);
return r;
}
EXPORT_SYMBOL_GPL(st_nci_probe);
void st_nci_remove(struct nci_dev *ndev)
{
struct st_nci_info *info = nci_get_drvdata(ndev);
ndlc_close(info->ndlc);
nci_unregister_device(ndev);
nci_free_device(ndev);
}
EXPORT_SYMBOL_GPL(st_nci_remove);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(DRIVER_DESC);
|
{
"pile_set_name": "Github"
}
|
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "shift_2HL.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "[email protected]"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2020 jPOS Software SRL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.jpos.rc;
import java.util.HashMap;
import java.util.Map;
public enum CMF implements IRC {
// Approved
APPROVED (0, true),
HONOR_WITH_ID (1, true),
APPROVED_PARTIAL (2, true),
APPROVED_VIP (3, true),
APPROVED_UPDATE_TRACK3 (4, true),
APPROVED_ISSUER_SPECIFIED_ACCOUNT (5, true),
APPROVED_PARTIAL_ISSUER_SPECIFIED_ACCOUNT (6, true),
APPROVED_FEES_DISPUTED(8, true),
APPROVED_WITH_OVERDRAFT(9, true),
APPROVED_CUSTOMER_REACTIVATED(10, true),
APPROVED_TERMINAL_UNABLE_TO_PROCESS_ONLINE(11),
APPROVED_OFFLINE (12),
APPROVED_OFFLINE_REFERRAL (13),
// Denied Authorization
DO_NOT_HONOUR(1000),
EXPIRED (1001),
SUSPECTED_FRAUD(1002),
CONTACT_ACQUIRER(1003),
RESTRICTED_CARD(1004),
CONTACT_ACQUIRER_SECURITY(1005),
MAX_PIN_TRIES_EXCEEDED(1006),
REFER_TO_ISSUER(1007),
REFER_TO_ISSUER_SPECIAL(1008),
INVALID_CARD_ACCEPTOR(1009),
INVALID_AMOUNT(1010),
INVALID_CARD_NUMBER(1011),
PIN_DATA_REQUIRED(1012),
UNACCEPTABLE_FEE(1013),
NO_ACCCOUNT_TYPE(1014),
UNSUPPORTED_FUNCTION(1015),
NOT_SUFFICIENT_FUNDS(1016),
INCORRECT_PIN(1017),
NO_CARD_RECORD(1018),
NOT_PERMITTED_TO_CARDHOLDER(1019),
NOT_PERMITTED_TO_TERMINAL(1020),
EXCEEDS_WITHDRAWAL_AMOUNT_LIMIT(1021),
SECURITY_VIOLATION(1022),
EXCEEDS_WITHDRAWAL_FREQUENCY_LIMIT(1023),
LAW_VIOLATION(1024),
CARD_NOT_EFFECTIVE(1025),
INVALID_PINBLOCK(1026),
PIN_LENGTH_ERROR(1027),
PIN_KEY_SYNC_ERROR(1028),
SUSPECTED_COUNTERFEIT_CARD(1029),
UNACCEPTED_CURRENCY(1030),
DECLINED_FEES_DISPUTED(1031),
LOST_OR_STOLEN_CARD(1032),
AUTHORIZATION_LIFECYCLE_UNACCEPTABLE(1033),
AUTHORIZATION_LIFECYCLE_EXPIRED(1034),
CLOSED_ACCOUNT(1035),
CLOSED_SAVINGS_ACCOUNT(1036),
CLOSED_CREDIT_ACCOUNT(1037),
CLOSED_ACCOUNT_TYPE(1038),
CLOSED_CHEQUE_ACCOUNT(1039),
BAD_DEBT(1040),
FROM_ACCOUNT_BAD_STATUS(1041),
TO_ACCOUNT_BAD_STATUS(1042),
CHEQUE_ALREADY_POSTED(1043),
INFORMATION_NOT_ON_FILE(1044),
CARD_VERIFICATION_DATA_FAILED(1045),
AMOUNT_NOT_FOUND(1046),
PIN_CHANGE_REQUIRED(1047),
NEW_PIN_INVALID(1048),
BANK_NOT_FOUND(1049),
BANK_NOT_EFFECTIVE(1050),
CUSTOMER_VENDOR_NOT_FOUND(1051),
CUSTOMER_VENDOR_NOT_EFFECTIVE(1052),
CUSTOMER_VENDOR_ACCOUNT_INVALID(1053),
VENDOR_NOT_FOUND(1054),
VENDOR_NOT_EFFECTIVE(1055),
VENDOR_DATA_INVALID(1056),
PAYMENT_DATE_INVALID(1057),
PERSONAL_ID_NOT_FOUND(1058),
SCHEDULED_TRANSACTION_EXISTS(1059),
ABORTED_AT_TERMINAL(1060),
UNSUPPORTED_TRANSACTION(1061),
CASHBACK_NOT_ALLOWED(1062),
CASHBACK_AMOUNT_EXCEEDED(1063),
DECLINED_PROCESSED_OFFLINE(1064),
DECLINED_UNABLE_TO_PROCESS(1065),
DECLINED_PROCESSED_OFFLINE_REFERRAL(1066),
ID_NUMBER_INVALID(1068),
DRIVER_NUMBER_INVALID(1069),
VID_INVALID(1070),
CERTIFICATE_EXPIRED(1071),
MISSING_FIELD(1802),
EXTRA_FIELD(1803),
INVALID_CARD(1804),
CARD_NOT_ACTIVE(1806),
CARD_NOT_CONFIGURED(1808),
SYSTEM_ERROR_DB(1811),
SYSTEM_ERROR_TXN(1812),
INVALID_FIELD(1830),
MISCONFIGURED_ENDPOINT(1831),
INVALID_REQUEST(1832),
HOST_UNREACHABLE(1833),
// Denied Financial
FINANCIAL_DO_NOT_HONOUR (2000),
FINANCIAL_EXPIRED (2001),
FINANCIAL_SUSPECTED_FRAUD(2002),
FINANCIAL_CONTACT_ACQUIRER(2003),
FINANCIAL_RESTRICTED_CARD(2004),
FINANCIAL_CONTACT_ACQUIRER_SECURITY(2005),
FINANCIAL_MAX_PIN_TRIES_EXCEEDED(2006),
SPECIAL_CONDITIONA(2007),
LOST_CARD(2008),
STOLEN_CARD(2009),
SUSPECTED_COUNTERFELT_CARD(2010),
MAX_DAILY_WITHDRAWAL(2011),
MAX_DAILY_AMOUNT(2012),
// File action
SUCCESSFUL(3000, true),
NOT_SUPPORTED_BY_RECEIVER(3001),
UNABLE_TO_LOCATE_RECORD(3002),
UPDATED_RECORD(3003),
FIELD_EDIT_ERROR(3004),
FILE_LOCKED_OUT(3005),
NOT_SUCCESSFUL(3006),
FORMAT_ERROR(3007),
DUPLICATE(3008),
UNKNOWN_FILE(3009),
INVALID_CARD_OR_CARDHOLDER_NUMBER(3010),
// Reversals
REVERSAL_ACCEPTED(4000, true),
// Reconciliation
RECONCILED_IN_BALANCE(5000, true),
RECONCILED_OUT_OF_BALANCE(5001),
AMOUNT_NOT_RECONCILED_TOTALS_PROVIDED(5002),
TOTALS_NOT_AVAILABLE(5003),
NOT_RECONCILED_TOTALS_PROVIDED(5004),
// Administrative messages
ADMIN_MESSAGE_ACCEPTED(6000, true),
// Fee collection
FEE_COLLECTION_ACCEPTED (7000, true),
// Network Management
NET_ACCEPTED (8000, true),
NET_RETRY(8001),
// Misc
ADVICE_ACK_NO_FINANCIAL(9000, true),
ADVICE_ACCEPTED(9001, true),
MESSAGE_ERROR(9100),
INVALID_TRANSACTION(9102),
RETRY_TRANSACTION(9103),
ACQUIRER_NOT_SUPPORTED(9105),
CUTOVER_IN_PROCESS(9106),
ISSUER_NOT_AVAILABLE(9107),
ROUTING_ERROR(9108),
SYSTEM_ERROR(9109),
ISSUER_SIGNED_OFF(9110),
ISSUER_TIMEOUT(9111),
ISSUER_UNAVAILABLE(9112),
DUPLICATE_TRANSMISSION(9113),
ORIGINAL_NOT_FOUND(9114),
RECONCILIATION_ERROR(9115),
MAC_INCORRECT(9116),
MAC_KEY_SYNC_ERROR(9117),
ZMK_NOT_AVAILABLE(9118),
CRYPTO_ERROR(9119),
HSM_ERROR_RETRY(9120),
HSM_ERROR (9121),
OUT_OF_SEQUENCE(9122),
REQUEST_IN_PROGRESS(9123),
INVALID_SECURITY_CODE(9124),
DATABASE_ERROR(9125),
CUSTOMER_VENDOR_FORMAT_ERROR(9128),
RECURRING_DATA_ERROR(9132),
UPDATE_NOT_ALLOWED(9133),
AGREEMENT_VIOLATION(9350),
GENERAL_DECLINE(9999),
// jPOS specific result codes
JPOS(10000),
INTERNAL_ERROR(19999,false,true),
// User specific result codes
USER(90000);
int irc;
String ircStr;
boolean success;
boolean inhibit;
private static Map<Integer,IRC> lookupInt = new HashMap<>();
private static Map<String,IRC> lookupStr = new HashMap<>();
static {
// This section executes after all the enum instances have been constructed
for (IRC irc : values()) {
lookupInt.put(irc.irc(), irc);
lookupStr.put(irc.ircString(), irc);
}
}
CMF(int irc) {
this (irc, false, false);
}
CMF(int irc, boolean success) {
this(irc, success, false);
}
CMF(int irc, boolean success, boolean inhibit) {
this.irc = irc;
this.ircStr = String.format("%04d", irc);
this.success = success;
this.inhibit = inhibit;
}
@Override
public int irc() {
return irc;
}
@Override
public String ircString() {
return ircStr;
}
@Override
public boolean success() {
return success;
}
@Override
public boolean inhibit() {
return inhibit;
}
public static IRC valueOf(int i) {
return lookupInt.get(i);
}
/**
* Returns the {@code CMF} instance that has the given String as its jPOS-CMF Result Code
* (usually transmitted in DE-39).
*
* @param irc a String representing a jPOS-CMF Result Code
* @return the corresponding CMF instance or {@code null}
*/
public static CMF fromIsoString(String irc) {
return (irc == null) ? null : (CMF)lookupStr.get(irc.trim());
}
}
|
{
"pile_set_name": "Github"
}
|
insert into restaurant (name, city, state, zip_code, version) values('Subway', 'Plymouth', 'WI', '53073', 1);
insert into restaurant (name, city, state, zip_code, version) values('Boston Market', 'Gaithersburg', 'MD', '20877', 1);
insert into restaurant (name, city, state, zip_code, version) values('Subway Subs', 'Santa Teresa', 'NM', '88008', 1);
insert into restaurant (name, city, state, zip_code, version) values('Arby''s Roast Beef Restaurant', 'Klamath Falls', 'OR', '97603', 1);
insert into restaurant (name, city, state, zip_code, version) values('Bellefleur Winery & Restaurant', 'Carlsbad', 'CA', '92008', 1);
insert into restaurant (name, city, state, zip_code, version) values('Huddle House', 'Calhoun', 'GA', '30701', 1);
insert into restaurant (name, city, state, zip_code, version) values('John Browne''s Pub & Eatery', 'Indianapolis', 'IN', '46235', 1);
insert into restaurant (name, city, state, zip_code, version) values('Ling''s Express', 'Milwaukee', 'WI', '53217', 1);
insert into restaurant (name, city, state, zip_code, version) values('Chubys''s', 'Odell', 'OR', '97044', 1);
insert into restaurant (name, city, state, zip_code, version) values('Bojangles', 'Columbia', 'SC', '29203', 1);
insert into restaurant (name, city, state, zip_code, version) values('NPC International', 'Memphis', 'TN', '38134', 1);
insert into restaurant (name, city, state, zip_code, version) values('Pancake Cafe', 'Naperville', 'IL', '60540', 1);
insert into restaurant (name, city, state, zip_code, version) values('Hong & Kong Restaurant', 'Chelmsford', 'MA', '01824', 1);
insert into restaurant (name, city, state, zip_code, version) values('The Chicken Cooperative', 'Ketchum', 'OK', '74349', 1);
insert into restaurant (name, city, state, zip_code, version) values('Subway', 'Lonoke', 'AR', '72086', 1);
insert into restaurant (name, city, state, zip_code, version) values('Domino''s Pizza', 'Loveland', 'CO', '80537', 1);
insert into restaurant (name, city, state, zip_code, version) values('Carl''s Jr', 'Peoria', 'IL', '61615', 1);
insert into restaurant (name, city, state, zip_code, version) values('El Toro Bar & Grill', 'Shawnee', 'KS', '66216', 1);
insert into restaurant (name, city, state, zip_code, version) values('Subway Sandwiches & Salads', 'New Orleans', 'LA', '70123', 1);
insert into restaurant (name, city, state, zip_code, version) values('Subway', 'Decatur', 'GA', '30030', 1);
insert into restaurant (name, city, state, zip_code, version) values('Arby''s', 'Indianapolis', 'IN', '46268', 1);
insert into restaurant (name, city, state, zip_code, version) values('China King', 'Cedar Rapids', 'IA', '52404', 1);
insert into restaurant (name, city, state, zip_code, version) values('Subway Sandwiches & Salads', 'Knoxville', 'TN', '37924', 1);
insert into restaurant (name, city, state, zip_code, version) values('Luciano Italian Restaurant', 'Oakton', 'VA', '22124', 1);
insert into restaurant (name, city, state, zip_code, version) values('Fruition', 'Portland', 'OR', '97210', 1);
insert into restaurant (name, city, state, zip_code, version) values('Blough''s Delicatessen', 'Davidsville', 'PA', '15928', 1);
insert into restaurant (name, city, state, zip_code, version) values('Hardee''s of Murfreesboro No 4', 'Murfreesboro', 'TN', '37128', 1);
insert into restaurant (name, city, state, zip_code, version) values('Dairy Queen restaurant ', 'Carter Lake', 'IA', '51510', 1);
insert into restaurant (name, city, state, zip_code, version) values('Imperial Wok Chinese Restaurant', 'Shreveport', 'LA', '71118', 1);
insert into restaurant (name, city, state, zip_code, version) values('Hardee''s', 'Waldorf', 'MD', '20601', 1);
insert into restaurant (name, city, state, zip_code, version) values('Cinnabon', 'Gainesville', 'FL', '32605', 1);
insert into restaurant (name, city, state, zip_code, version) values('Angle Inn Restaurant', 'Rockford', 'IL', '61103', 1);
insert into restaurant (name, city, state, zip_code, version) values('Casey''s Carry Out Pizza', 'Thomson', 'IL', '61285', 1);
insert into restaurant (name, city, state, zip_code, version) values('Sonic Drive In', 'Salt Lake City', 'UT', '84118', 1);
insert into restaurant (name, city, state, zip_code, version) values('Mcdonald''s restaurant ', 'Racine', 'WI', '53406', 1);
insert into restaurant (name, city, state, zip_code, version) values('Huhot Mongolian Grill', 'Omaha', 'NE', '68154', 1);
insert into restaurant (name, city, state, zip_code, version) values('Giovanni''s Pizzeria', 'Las Vegas', 'NV', '89123', 1);
insert into restaurant (name, city, state, zip_code, version) values('Bangkok Royal', 'Waco', 'TX', '76706', 1);
insert into restaurant (name, city, state, zip_code, version) values('Golden Coin Bake Shop & Restaurant', 'Waipahu', 'HI', '96797', 1);
insert into restaurant (name, city, state, zip_code, version) values('Cristaudo''s Grand Avenue', 'Carbondale', 'IL', '62901', 1);
insert into restaurant (name, city, state, zip_code, version) values('O''Charley''s Restaurant', 'Independence', 'MO', '64057', 1);
insert into restaurant (name, city, state, zip_code, version) values('A1 Ocean Cafe', 'San Francisco', 'CA', '94104', 1);
insert into restaurant (name, city, state, zip_code, version) values('Alberto''s Mexican Food', 'Corona', 'CA', '92880', 1);
insert into restaurant (name, city, state, zip_code, version) values('Beach Dog Computer Center', 'Hilo', 'HI', '96720', 1);
insert into restaurant (name, city, state, zip_code, version) values('Burger King', 'Houston', 'TX', '77070', 1);
insert into restaurant (name, city, state, zip_code, version) values('Fox River Brew Pub', 'Oshkosh', 'WI', '54901', 1);
insert into restaurant (name, city, state, zip_code, version) values('Buffas Delicatessen', 'New York', 'NY', '10012', 1);
insert into restaurant (name, city, state, zip_code, version) values('Maria''s Mexican Bistro Inc', 'Brooklyn', 'NY', '11215', 1);
insert into restaurant (name, city, state, zip_code, version) values('Sue''s Restaurant', 'Providence', 'RI', '02903', 1);
insert into restaurant (name, city, state, zip_code, version) values('Dairy Queen Brazier', 'Cameron', 'MO', '64429', 1);
|
{
"pile_set_name": "Github"
}
|
// SPDX-License-Identifier: GPL-2.0+
//
// AMD ALSA SoC PCM Driver
//
//Copyright 2016 Advanced Micro Devices, Inc.
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include "acp3x.h"
#define DRV_NAME "acp3x_rv_i2s_dma"
static const struct snd_pcm_hardware acp3x_pcm_hardware_playback = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 2,
.channels_max = 8,
.rates = SNDRV_PCM_RATE_8000_96000,
.rate_min = 8000,
.rate_max = 96000,
.buffer_bytes_max = PLAYBACK_MAX_NUM_PERIODS * PLAYBACK_MAX_PERIOD_SIZE,
.period_bytes_min = PLAYBACK_MIN_PERIOD_SIZE,
.period_bytes_max = PLAYBACK_MAX_PERIOD_SIZE,
.periods_min = PLAYBACK_MIN_NUM_PERIODS,
.periods_max = PLAYBACK_MAX_NUM_PERIODS,
};
static const struct snd_pcm_hardware acp3x_pcm_hardware_capture = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_48000,
.rate_min = 8000,
.rate_max = 48000,
.buffer_bytes_max = CAPTURE_MAX_NUM_PERIODS * CAPTURE_MAX_PERIOD_SIZE,
.period_bytes_min = CAPTURE_MIN_PERIOD_SIZE,
.period_bytes_max = CAPTURE_MAX_PERIOD_SIZE,
.periods_min = CAPTURE_MIN_NUM_PERIODS,
.periods_max = CAPTURE_MAX_NUM_PERIODS,
};
static irqreturn_t i2s_irq_handler(int irq, void *dev_id)
{
struct i2s_dev_data *rv_i2s_data;
u16 play_flag, cap_flag;
u32 val;
rv_i2s_data = dev_id;
if (!rv_i2s_data)
return IRQ_NONE;
play_flag = 0;
cap_flag = 0;
val = rv_readl(rv_i2s_data->acp3x_base + mmACP_EXTERNAL_INTR_STAT);
if ((val & BIT(BT_TX_THRESHOLD)) && rv_i2s_data->play_stream) {
rv_writel(BIT(BT_TX_THRESHOLD), rv_i2s_data->acp3x_base +
mmACP_EXTERNAL_INTR_STAT);
snd_pcm_period_elapsed(rv_i2s_data->play_stream);
play_flag = 1;
}
if ((val & BIT(I2S_TX_THRESHOLD)) &&
rv_i2s_data->i2ssp_play_stream) {
rv_writel(BIT(I2S_TX_THRESHOLD),
rv_i2s_data->acp3x_base + mmACP_EXTERNAL_INTR_STAT);
snd_pcm_period_elapsed(rv_i2s_data->i2ssp_play_stream);
play_flag = 1;
}
if ((val & BIT(BT_RX_THRESHOLD)) && rv_i2s_data->capture_stream) {
rv_writel(BIT(BT_RX_THRESHOLD), rv_i2s_data->acp3x_base +
mmACP_EXTERNAL_INTR_STAT);
snd_pcm_period_elapsed(rv_i2s_data->capture_stream);
cap_flag = 1;
}
if ((val & BIT(I2S_RX_THRESHOLD)) &&
rv_i2s_data->i2ssp_capture_stream) {
rv_writel(BIT(I2S_RX_THRESHOLD),
rv_i2s_data->acp3x_base + mmACP_EXTERNAL_INTR_STAT);
snd_pcm_period_elapsed(rv_i2s_data->i2ssp_capture_stream);
cap_flag = 1;
}
if (play_flag | cap_flag)
return IRQ_HANDLED;
else
return IRQ_NONE;
}
static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
{
u16 page_idx;
u32 low, high, val, acp_fifo_addr, reg_fifo_addr;
u32 reg_dma_size, reg_fifo_size;
dma_addr_t addr;
addr = rtd->dma_addr;
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
val = ACP_SRAM_BT_PB_PTE_OFFSET;
break;
case I2S_SP_INSTANCE:
default:
val = ACP_SRAM_SP_PB_PTE_OFFSET;
}
} else {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
val = ACP_SRAM_BT_CP_PTE_OFFSET;
break;
case I2S_SP_INSTANCE:
default:
val = ACP_SRAM_SP_CP_PTE_OFFSET;
}
}
/* Group Enable */
rv_writel(ACP_SRAM_PTE_OFFSET | BIT(31), rtd->acp3x_base +
mmACPAXI2AXI_ATU_BASE_ADDR_GRP_1);
rv_writel(PAGE_SIZE_4K_ENABLE, rtd->acp3x_base +
mmACPAXI2AXI_ATU_PAGE_SIZE_GRP_1);
for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) {
/* Load the low address of page int ACP SRAM through SRBM */
low = lower_32_bits(addr);
high = upper_32_bits(addr);
rv_writel(low, rtd->acp3x_base + mmACP_SCRATCH_REG_0 + val);
high |= BIT(31);
rv_writel(high, rtd->acp3x_base + mmACP_SCRATCH_REG_0 + val
+ 4);
/* Move to next physically contiguos page */
val += 8;
addr += PAGE_SIZE;
}
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_dma_size = mmACP_BT_TX_DMA_SIZE;
acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
BT_PB_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_BT_TX_FIFOADDR;
reg_fifo_size = mmACP_BT_TX_FIFOSIZE;
rv_writel(I2S_BT_TX_MEM_WINDOW_START,
rtd->acp3x_base + mmACP_BT_TX_RINGBUFADDR);
break;
case I2S_SP_INSTANCE:
default:
reg_dma_size = mmACP_I2S_TX_DMA_SIZE;
acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
SP_PB_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_I2S_TX_FIFOADDR;
reg_fifo_size = mmACP_I2S_TX_FIFOSIZE;
rv_writel(I2S_SP_TX_MEM_WINDOW_START,
rtd->acp3x_base + mmACP_I2S_TX_RINGBUFADDR);
}
} else {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_dma_size = mmACP_BT_RX_DMA_SIZE;
acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
BT_CAPT_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_BT_RX_FIFOADDR;
reg_fifo_size = mmACP_BT_RX_FIFOSIZE;
rv_writel(I2S_BT_RX_MEM_WINDOW_START,
rtd->acp3x_base + mmACP_BT_RX_RINGBUFADDR);
break;
case I2S_SP_INSTANCE:
default:
reg_dma_size = mmACP_I2S_RX_DMA_SIZE;
acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
SP_CAPT_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_I2S_RX_FIFOADDR;
reg_fifo_size = mmACP_I2S_RX_FIFOSIZE;
rv_writel(I2S_SP_RX_MEM_WINDOW_START,
rtd->acp3x_base + mmACP_I2S_RX_RINGBUFADDR);
}
}
rv_writel(DMA_SIZE, rtd->acp3x_base + reg_dma_size);
rv_writel(acp_fifo_addr, rtd->acp3x_base + reg_fifo_addr);
rv_writel(FIFO_SIZE, rtd->acp3x_base + reg_fifo_size);
rv_writel(BIT(I2S_RX_THRESHOLD) | BIT(BT_RX_THRESHOLD)
| BIT(I2S_TX_THRESHOLD) | BIT(BT_TX_THRESHOLD),
rtd->acp3x_base + mmACP_EXTERNAL_INTR_CNTL);
}
static int acp3x_dma_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime;
struct snd_soc_pcm_runtime *prtd;
struct i2s_dev_data *adata;
struct i2s_stream_instance *i2s_data;
int ret;
runtime = substream->runtime;
prtd = asoc_substream_to_rtd(substream);
component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
adata = dev_get_drvdata(component->dev);
i2s_data = kzalloc(sizeof(*i2s_data), GFP_KERNEL);
if (!i2s_data)
return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
runtime->hw = acp3x_pcm_hardware_playback;
else
runtime->hw = acp3x_pcm_hardware_capture;
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (ret < 0) {
dev_err(component->dev, "set integer constraint failed\n");
kfree(i2s_data);
return ret;
}
if (!adata->play_stream && !adata->capture_stream &&
!adata->i2ssp_play_stream && !adata->i2ssp_capture_stream)
rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
i2s_data->acp3x_base = adata->acp3x_base;
runtime->private_data = i2s_data;
return ret;
}
static int acp3x_dma_hw_params(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct i2s_stream_instance *rtd;
struct snd_soc_pcm_runtime *prtd;
struct snd_soc_card *card;
struct acp3x_platform_info *pinfo;
struct i2s_dev_data *adata;
u64 size;
prtd = asoc_substream_to_rtd(substream);
card = prtd->card;
pinfo = snd_soc_card_get_drvdata(card);
adata = dev_get_drvdata(component->dev);
rtd = substream->runtime->private_data;
if (!rtd)
return -EINVAL;
if (pinfo) {
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
rtd->i2s_instance = pinfo->play_i2s_instance;
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
adata->play_stream = substream;
break;
case I2S_SP_INSTANCE:
default:
adata->i2ssp_play_stream = substream;
}
} else {
rtd->i2s_instance = pinfo->cap_i2s_instance;
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
adata->capture_stream = substream;
break;
case I2S_SP_INSTANCE:
default:
adata->i2ssp_capture_stream = substream;
}
}
} else {
pr_err("pinfo failed\n");
}
size = params_buffer_bytes(params);
rtd->dma_addr = substream->dma_buffer.addr;
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
config_acp3x_dma(rtd, substream->stream);
return 0;
}
static snd_pcm_uframes_t acp3x_dma_pointer(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct i2s_stream_instance *rtd;
u32 pos;
u32 buffersize;
u64 bytescount;
rtd = substream->runtime->private_data;
buffersize = frames_to_bytes(substream->runtime,
substream->runtime->buffer_size);
bytescount = acp_get_byte_count(rtd, substream->stream);
if (bytescount > rtd->bytescount)
bytescount -= rtd->bytescount;
pos = do_div(bytescount, buffersize);
return bytes_to_frames(substream->runtime, pos);
}
static int acp3x_dma_new(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd)
{
struct device *parent = component->dev->parent;
snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV,
parent, MIN_BUFFER, MAX_BUFFER);
return 0;
}
static int acp3x_dma_mmap(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct vm_area_struct *vma)
{
return snd_pcm_lib_default_mmap(substream, vma);
}
static int acp3x_dma_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *prtd;
struct i2s_dev_data *adata;
struct i2s_stream_instance *ins;
prtd = asoc_substream_to_rtd(substream);
component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
adata = dev_get_drvdata(component->dev);
ins = substream->runtime->private_data;
if (!ins)
return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
switch (ins->i2s_instance) {
case I2S_BT_INSTANCE:
adata->play_stream = NULL;
break;
case I2S_SP_INSTANCE:
default:
adata->i2ssp_play_stream = NULL;
}
} else {
switch (ins->i2s_instance) {
case I2S_BT_INSTANCE:
adata->capture_stream = NULL;
break;
case I2S_SP_INSTANCE:
default:
adata->i2ssp_capture_stream = NULL;
}
}
/* Disable ACP irq, when the current stream is being closed and
* another stream is also not active.
*/
if (!adata->play_stream && !adata->capture_stream &&
!adata->i2ssp_play_stream && !adata->i2ssp_capture_stream)
rv_writel(0, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
return 0;
}
static const struct snd_soc_component_driver acp3x_i2s_component = {
.name = DRV_NAME,
.open = acp3x_dma_open,
.close = acp3x_dma_close,
.hw_params = acp3x_dma_hw_params,
.pointer = acp3x_dma_pointer,
.mmap = acp3x_dma_mmap,
.pcm_construct = acp3x_dma_new,
};
static int acp3x_audio_probe(struct platform_device *pdev)
{
struct resource *res;
struct i2s_dev_data *adata;
unsigned int irqflags;
int status;
if (!pdev->dev.platform_data) {
dev_err(&pdev->dev, "platform_data not retrieved\n");
return -ENODEV;
}
irqflags = *((unsigned int *)(pdev->dev.platform_data));
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n");
return -ENODEV;
}
adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL);
if (!adata)
return -ENOMEM;
adata->acp3x_base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!adata->acp3x_base)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n");
return -ENODEV;
}
adata->i2s_irq = res->start;
dev_set_drvdata(&pdev->dev, adata);
status = devm_snd_soc_register_component(&pdev->dev,
&acp3x_i2s_component,
NULL, 0);
if (status) {
dev_err(&pdev->dev, "Fail to register acp i2s component\n");
return -ENODEV;
}
status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
irqflags, "ACP3x_I2S_IRQ", adata);
if (status) {
dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
return -ENODEV;
}
pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_enable(&pdev->dev);
pm_runtime_allow(&pdev->dev);
return 0;
}
static int acp3x_audio_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
return 0;
}
static int acp3x_resume(struct device *dev)
{
struct i2s_dev_data *adata;
u32 val, reg_val, frmt_val;
reg_val = 0;
frmt_val = 0;
adata = dev_get_drvdata(dev);
if (adata->play_stream && adata->play_stream->runtime) {
struct i2s_stream_instance *rtd =
adata->play_stream->runtime->private_data;
config_acp3x_dma(rtd, SNDRV_PCM_STREAM_PLAYBACK);
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_val = mmACP_BTTDM_ITER;
frmt_val = mmACP_BTTDM_TXFRMT;
break;
case I2S_SP_INSTANCE:
default:
reg_val = mmACP_I2STDM_ITER;
frmt_val = mmACP_I2STDM_TXFRMT;
}
rv_writel((rtd->xfer_resolution << 3),
rtd->acp3x_base + reg_val);
}
if (adata->capture_stream && adata->capture_stream->runtime) {
struct i2s_stream_instance *rtd =
adata->capture_stream->runtime->private_data;
config_acp3x_dma(rtd, SNDRV_PCM_STREAM_CAPTURE);
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_val = mmACP_BTTDM_IRER;
frmt_val = mmACP_BTTDM_RXFRMT;
break;
case I2S_SP_INSTANCE:
default:
reg_val = mmACP_I2STDM_IRER;
frmt_val = mmACP_I2STDM_RXFRMT;
}
rv_writel((rtd->xfer_resolution << 3),
rtd->acp3x_base + reg_val);
}
if (adata->tdm_mode == TDM_ENABLE) {
rv_writel(adata->tdm_fmt, adata->acp3x_base + frmt_val);
val = rv_readl(adata->acp3x_base + reg_val);
rv_writel(val | 0x2, adata->acp3x_base + reg_val);
}
rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
return 0;
}
static int acp3x_pcm_runtime_suspend(struct device *dev)
{
struct i2s_dev_data *adata;
adata = dev_get_drvdata(dev);
rv_writel(0, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
return 0;
}
static int acp3x_pcm_runtime_resume(struct device *dev)
{
struct i2s_dev_data *adata;
adata = dev_get_drvdata(dev);
rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
return 0;
}
static const struct dev_pm_ops acp3x_pm_ops = {
.runtime_suspend = acp3x_pcm_runtime_suspend,
.runtime_resume = acp3x_pcm_runtime_resume,
.resume = acp3x_resume,
};
static struct platform_driver acp3x_dma_driver = {
.probe = acp3x_audio_probe,
.remove = acp3x_audio_remove,
.driver = {
.name = "acp3x_rv_i2s_dma",
.pm = &acp3x_pm_ops,
},
};
module_platform_driver(acp3x_dma_driver);
MODULE_AUTHOR("[email protected]");
MODULE_AUTHOR("[email protected]");
MODULE_AUTHOR("[email protected]");
MODULE_DESCRIPTION("AMD ACP 3.x PCM Driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:"DRV_NAME);
|
{
"pile_set_name": "Github"
}
|
# bosh-deployment
* [Create an environment](https://bosh.io/docs/init.html)
* [On Local machine (BOSH Lite)](https://bosh.io/docs/bosh-lite.html)
* [On AWS](https://bosh.io/docs/init-aws.html)
* [On Azure](https://bosh.io/docs/init-azure.html)
* [On OpenStack](https://bosh.io/docs/init-openstack.html)
* [On vSphere](https://bosh.io/docs/init-vsphere.html)
* [On vCloud](https://bosh.io/docs/init-vcloud.html)
* [On SoftLayer](https://bosh.io/docs/init-softlayer.html)
* [On Google Compute Platform](https://bosh.io/docs/init-google.html)
* Access your BOSH director
* Through a VPN
* [`bosh create-env`, OpenVPN option](https://github.com/dpb587/openvpn-bosh-release)
* Through a jumpbox
* [`bosh create-env` option](https://github.com/cloudfoundry/jumpbox-deployment)
* [Expose Director on a Public IP](https://bosh.io/docs/init-external-ip.html) (not recommended)
* [CLI v2](https://bosh.io/docs/cli-v2.html)
* [`create-env` Dependencies](https://bosh.io/docs/cli-v2-install/#additional-dependencies)
* [Differences between CLI v2 vs v1](https://bosh.io/docs/cli-v2-diff.html)
* [Global Flags](https://bosh.io/docs/cli-global-flags.html)
* [Environments](https://bosh.io/docs/cli-envs.html)
* [Operations files](https://bosh.io/docs/cli-ops-files.html)
* [Variable Interpolation](https://bosh.io/docs/cli-int.html)
* [Tunneling](https://bosh.io/docs/cli-tunnel.html)
## Ops files
- `bosh.yml`: Base manifest that is meant to be used with different CPI configurations
- `[aws|azure|docker|gcp|openstack|softlayer|vcloud|vsphere|virtualbox]/cpi.yml`: CPI configuration
- `[aws|azure|docker|gcp|openstack|softlayer|vcloud|vsphere|virtualbox]/cloud-config.yml`: Simple cloud configs
- `jumpbox-user.yml`: Adds user `jumpbox` for SSH-ing into the Director (see [Jumpbox User](docs/jumpbox-user.md))
- `uaa.yml`: Deploys UAA and enables UAA user management in the Director
- `credhub.yml`: Deploys CredHub and enables CredHub integration in the Director
- `bosh-lite.yml`: Configures Director to use Garden CPI within the Director VM (see [BOSH Lite](docs/bosh-lite-on-vbox.md))
- `syslog.yml`: Configures syslog to forward logs to some destination
- `local-dns.yml`: Enables Director DNS beta functionality
- `misc/config-server.yml`: Deploys config-server (see `credhub.yml`)
- `misc/proxy.yml`: Configure HTTP proxy for Director and CPI
- `runtime-configs/syslog.yml`: Runtime config to enable syslog forwarding
See [tests/run-checks.sh](tests/run-checks.sh) for example usage of different ops files.
## Security Groups
Please ensure you have security groups setup correctly. i.e:
```
Type Protocol Port Range Source Purpose
SSH TCP 22 <IP you run bosh CLI from> SSH (if Registry is used)
Custom TCP Rule TCP 6868 <IP you run bosh CLI from> Agent for bootstrapping
Custom TCP Rule TCP 25555 <IP you run bosh CLI from> Director API
Custom TCP Rule TCP 8443 <IP you run bosh CLI from> UAA API (if UAA is used)
Custom TCP Rule TCP 8844 <IP you run bosh CLI from> CredHub API (if CredHub is used)
SSH TCP 22 <((internal_cidr))> BOSH SSH (optional)
Custom TCP Rule TCP 4222 <((internal_cidr))> NATS
Custom TCP Rule TCP 25250 <((internal_cidr))> Blobstore
Custom TCP Rule TCP 25777 <((internal_cidr))> Registry if enabled
```
|
{
"pile_set_name": "Github"
}
|
/* Copyright_License {
XCSoar Glide Computer - http://www.xcsoar.org/
Copyright (C) 2000-2016 The XCSoar Project
A detailed list of copyright holders can be found in the file "AUTHORS".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
*/
#include "Thread/Thread.hpp"
#include "Event/Notify.hpp"
#include "Event/Globals.hpp"
#include "Screen/Init.hpp"
#include "TestUtil.hpp"
#ifdef ANDROID
#include "Event/Android/Loop.hpp"
#include "Event/Shared/Event.hpp"
#elif defined(USE_POLL_EVENT)
#include "Event/Shared/Event.hpp"
#include "Event/Poll/Loop.hpp"
#include "Screen/TopWindow.hpp"
#elif defined(ENABLE_SDL)
#include "Event/SDL/Event.hpp"
#include "Event/SDL/Loop.hpp"
#else
#include "Event/Windows/Event.hpp"
#include "Event/Windows/Loop.hpp"
#endif
#ifdef USE_FB
#include "Hardware/RotateDisplay.hpp"
bool
Display::Rotate(DisplayOrientation orientation)
{
return false;
}
#endif
#ifndef KOBO
#if defined(USE_EGL) || defined(USE_GLX)
/* avoid TopWindow.cpp from being linked, as it brings some heavy
dependencies */
void TopWindow::Refresh() noexcept {}
#endif
#ifdef USE_POLL_EVENT
bool TopWindow::OnEvent(const Event &event) { return false; }
#endif
#endif
static bool quit;
class TestThread final : public Thread {
Notify ¬ify;
public:
TestThread(Notify &_notify):notify(_notify) {}
protected:
void Run() noexcept override {
notify.SendNotification();
}
};
int main(int argc, char **argv)
{
plan_tests(1);
ScreenGlobalInit screen;
EventLoop loop(*event_queue);
Event event;
Notify notify{[]{ quit = true; }};
TestThread thread(notify);
thread.Start();
while (!quit && loop.Get(event))
loop.Dispatch(event);
ok1(quit);
thread.Join();
return exit_status();
}
|
{
"pile_set_name": "Github"
}
|
{
"_args": [
[
"[email protected]",
"/Users/leonard.gonsalves/aws/Flask-Scaffold/app/templates/static"
]
],
"_development": true,
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=",
"_location": "/dns-txt",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "dns-txt",
"escapedName": "dns-txt",
"rawSpec": "2.0.2",
"saveSpec": null,
"fetchSpec": "2.0.2"
},
"_requiredBy": [
"/bonjour"
],
"_resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz",
"_spec": "2.0.2",
"_where": "/Users/leonard.gonsalves/aws/Flask-Scaffold/app/templates/static",
"author": {
"name": "Thomas Watson Steen",
"email": "[email protected]",
"url": "https://twitter.com/wa7son"
},
"bugs": {
"url": "https://github.com/watson/dns-txt/issues"
},
"coordinates": [
55.6465696,
12.5491067
],
"dependencies": {
"buffer-indexof": "^1.0.0"
},
"description": "Encode/decode DNS-SD TXT record RDATA fields",
"devDependencies": {
"standard": "^5.3.1",
"tape": "^4.2.2"
},
"homepage": "https://github.com/watson/dns-txt",
"keywords": [
"rfc6763",
"6763",
"rfc6762",
"6762",
"dns",
"mdns",
"multicast",
"txt",
"rdata",
"dns-sd",
"encode",
"decode",
"parse",
"encoder",
"decoder",
"parser",
"service",
"discovery"
],
"license": "MIT",
"main": "index.js",
"name": "dns-txt",
"repository": {
"type": "git",
"url": "git+https://github.com/watson/dns-txt.git"
},
"scripts": {
"test": "standard && tape test.js"
},
"version": "2.0.2"
}
|
{
"pile_set_name": "Github"
}
|
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
var RUN_WITH_ALL_ARGUMENT_ENTRIES = false;
var kOnManyArgumentsRemove = 5;
function makeArguments() {
var result = [ ];
result.push(17);
result.push(-31);
result.push(new Array(100));
result.push(new Array(100003));
result.push(Number.MIN_VALUE);
result.push("whoops");
result.push("x");
result.push({"x": 1, "y": 2});
var slowCaseObj = {"a": 3, "b": 4, "c": 5};
delete slowCaseObj.c;
result.push(slowCaseObj);
result.push(function () { return 8; });
return result;
}
var kArgObjects = makeArguments().length;
function makeFunction(name, argc) {
var args = [];
for (var i = 0; i < argc; i++)
args.push("x" + i);
var argsStr = args.join(", ");
return new Function(args.join(", "), "return %" + name + "(" + argsStr + ");");
}
function testArgumentCount(name, argc) {
for (var i = 0; i < 10; i++) {
var func = null;
try {
func = makeFunction(name, i);
} catch (e) {
if (e != "SyntaxError: Illegal access") throw e;
}
if (func === null && i == argc) {
throw "unexpected exception";
}
var args = [ ];
for (var j = 0; j < i; j++)
args.push(0);
try {
func.apply(void 0, args);
} catch (e) {
// we don't care what happens as long as we don't crash
}
}
}
function testArgumentTypes(name, argc) {
var type = 0;
var hasMore = true;
var func = makeFunction(name, argc);
while (hasMore) {
var argPool = makeArguments();
// When we have 5 or more arguments we lower the amount of tests cases
// by randomly removing kOnManyArgumentsRemove entries
var numArguments = RUN_WITH_ALL_ARGUMENT_ENTRIES ?
kArgObjects : kArgObjects-kOnManyArgumentsRemove;
if (argc >= 5 && !RUN_WITH_ALL_ARGUMENT_ENTRIES) {
for (var i = 0; i < kOnManyArgumentsRemove; i++) {
var rand = Math.floor(Math.random() * (kArgObjects - i));
argPool.splice(rand,1);
}
}
var current = type;
var hasMore = false;
var argList = [ ];
for (var i = 0; i < argc; i++) {
var index = current % numArguments;
current = (current / numArguments) << 0;
if (index != (numArguments - 1))
hasMore = true;
argList.push(argPool[index]);
}
try {
func.apply(void 0, argList);
} catch (e) {
// we don't care what happens as long as we don't crash
}
type++;
}
}
var knownProblems = {
"Abort": true,
// Avoid calling the concat operation, because weird lengths
// may lead to out-of-memory. Ditto for StringBuilderJoin.
"StringBuilderConcat": true,
"StringBuilderJoin": true,
// These functions use pseudo-stack-pointers and are not robust
// to unexpected integer values.
"DebugEvaluate": true,
// These functions do nontrivial error checking in recursive calls,
// which means that we have to propagate errors back.
"SetFunctionBreakPoint": true,
"SetScriptBreakPoint": true,
"PrepareStep": true,
// Too slow.
"DebugReferencedBy": true,
// Calling disable/enable access checks may interfere with the
// the rest of the tests.
"DisableAccessChecks": true,
"EnableAccessChecks": true,
// These functions should not be callable as runtime functions.
"NewFunctionContext": true,
"NewArgumentsFast": true,
"NewStrictArgumentsFast": true,
"PushWithContext": true,
"PushCatchContext": true,
"PushBlockContext": true,
"LazyCompile": true,
"LazyRecompile": true,
"ParallelRecompile": true,
"NotifyDeoptimized": true,
"NotifyOSR": true,
"CreateObjectLiteralBoilerplate": true,
"CloneLiteralBoilerplate": true,
"CloneShallowLiteralBoilerplate": true,
"CreateArrayLiteralBoilerplate": true,
"IS_VAR": true,
"ResolvePossiblyDirectEval": true,
"Log": true,
"DeclareGlobals": true,
"PromoteScheduledException": true,
"DeleteHandleScopeExtensions": true,
// Vararg with minimum number > 0.
"Call": true,
// Requires integer arguments to be non-negative.
"Apply": true,
// That can only be invoked on Array.prototype.
"FinishArrayPrototypeSetup": true,
"_SwapElements": true,
// Performance critical functions which cannot afford type checks.
"_IsNativeOrStrictMode": true,
"_CallFunction": true,
// Tries to allocate based on argument, and (correctly) throws
// out-of-memory if the request is too large. In practice, the
// size will be the number of captures of a RegExp.
"RegExpConstructResult": true,
"_RegExpConstructResult": true,
// This functions perform some checks compile time (they require one of their
// arguments to be a compile time smi).
"_DateField": true,
"_GetFromCache": true,
// This function expects its first argument to be a non-smi.
"_IsStringWrapperSafeForDefaultValueOf" : true,
// Only applicable to strings.
"_HasCachedArrayIndex": true,
"_GetCachedArrayIndex": true
};
var currentlyUncallable = {
// We need to find a way to test this without breaking the system.
"SystemBreak": true
};
function testNatives() {
var allNatives = %ListNatives();
var start = 0;
var stop = (allNatives.length >> 2);
for (var i = start; i < stop; i++) {
var nativeInfo = allNatives[i];
var name = nativeInfo[0];
if (name in knownProblems || name in currentlyUncallable)
continue;
print(name);
var argc = nativeInfo[1];
testArgumentCount(name, argc);
testArgumentTypes(name, argc);
}
}
testNatives();
|
{
"pile_set_name": "Github"
}
|
using System;
using System.Net;
using System.Net.Sockets;
using NetCoreServer;
using NDesk.Options;
namespace TcpEchoServer
{
class EchoSession : TcpSession
{
public EchoSession(TcpServer server) : base(server) {}
protected override void OnReceived(byte[] buffer, long offset, long size)
{
// Resend the message back to the client
SendAsync(buffer, offset, size);
}
protected override void OnError(SocketError error)
{
Console.WriteLine($"Session caught an error with code {error}");
}
}
class EchoServer : TcpServer
{
public EchoServer(IPAddress address, int port) : base(address, port) {}
protected override TcpSession CreateSession() { return new EchoSession(this); }
protected override void OnError(SocketError error)
{
Console.WriteLine($"Server caught an error with code {error}");
}
}
class Program
{
static void Main(string[] args)
{
bool help = false;
int port = 1111;
var options = new OptionSet()
{
{ "h|?|help", v => help = v != null },
{ "p|port=", v => port = int.Parse(v) }
};
try
{
options.Parse(args);
}
catch (OptionException e)
{
Console.Write("Command line error: ");
Console.WriteLine(e.Message);
Console.WriteLine("Try `--help' to get usage information.");
return;
}
if (help)
{
Console.WriteLine("Usage:");
options.WriteOptionDescriptions(Console.Out);
return;
}
Console.WriteLine($"Server port: {port}");
Console.WriteLine();
// Create a new echo server
var server = new EchoServer(IPAddress.Any, port);
// server.OptionNoDelay = true;
server.OptionReuseAddress = true;
// Start the server
Console.Write("Server starting...");
server.Start();
Console.WriteLine("Done!");
Console.WriteLine("Press Enter to stop the server or '!' to restart the server...");
// Perform text input
for (;;)
{
string line = Console.ReadLine();
if (string.IsNullOrEmpty(line))
break;
// Restart the server
if (line == "!")
{
Console.Write("Server restarting...");
server.Restart();
Console.WriteLine("Done!");
}
}
// Stop the server
Console.Write("Server stopping...");
server.Stop();
Console.WriteLine("Done!");
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2008-2017 Dolittle. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
using System;
using System.Linq.Expressions;
using Bifrost.Extensions;
using Microsoft.WindowsAzure.Storage.Table;
namespace Bifrost.Events.Azure.Tables
{
/// <summary>
/// Represents helper methods for working with property conversion related to Azure Tables and entities
/// </summary>
/// <typeparam name="TTarget">Target object <see cref="Type"/></typeparam>
public class PropertiesFor<TTarget>
{
/// <summary>
/// Get a value from a <see cref="DynamicTableEntity"/> by giving the target objects property.
/// From the expression given it will find the expected type and also the name of the property to
/// look for in the entity from Azure Tables
/// </summary>
/// <typeparam name="TProperty"><see cref="Type"/> of property type - inferred</typeparam>
/// <param name="entity"><see cref="DynamicTableEntity">Entity</see> to get from</param>
/// <param name="property">Property expression</param>
/// <returns>Value of the property from the <see cref="DynamicTableEntity">entity</see></returns>
public static TProperty GetValue<TProperty>(DynamicTableEntity entity, Expression<Func<TTarget, TProperty>> property)
{
var propertyInfo = property.GetPropertyInfo();
return (TProperty)PropertyHelper.GetValue(entity, propertyInfo);
}
/// <summary>
/// Get propertyname from a property expression
/// </summary>
/// <param name="property">Property expression</param>
/// <returns>Name of the property</returns>
public static string GetPropertyName(Expression<Func<TTarget, object>> property)
{
var propertyInfo = property.GetPropertyInfo();
return propertyInfo.Name;
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*****************************************************************
|
| Neptune - Logging Support
|
| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
| All rights reserved.
|
| Redistribution and use in source and binary forms, with or without
| modification, are permitted provided that the following conditions are met:
| * Redistributions of source code must retain the above copyright
| notice, this list of conditions and the following disclaimer.
| * Redistributions in binary form must reproduce the above copyright
| notice, this list of conditions and the following disclaimer in the
| documentation and/or other materials provided with the distribution.
| * Neither the name of Axiomatic Systems 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 AXIOMATIC SYSTEMS ''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 AXIOMATIC SYSTEMS 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.
|
****************************************************************/
/** @file
* Header file for logging
*/
#ifndef _NPT_LOGGING_H_
#define _NPT_LOGGING_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "NptConfig.h"
#include "NptTypes.h"
#include "NptTime.h"
#include "NptStrings.h"
#include "NptList.h"
#include "NptStreams.h"
#include "NptThreads.h"
#include "NptHttp.h"
/*----------------------------------------------------------------------
| class references
+---------------------------------------------------------------------*/
class NPT_LogManager;
/*----------------------------------------------------------------------
| types
+---------------------------------------------------------------------*/
class NPT_LogRecord {
public:
const char* m_LoggerName;
int m_Level;
const char* m_Message;
NPT_TimeStamp m_TimeStamp;
const char* m_SourceFile;
unsigned int m_SourceLine;
const char* m_SourceFunction;
unsigned long m_ThreadId;
};
class NPT_LogHandler {
public:
typedef void(*CustomHandlerExternalFunction)(const NPT_LogRecord* record);
// class methods
static NPT_Result SetCustomHandlerFunction(CustomHandlerExternalFunction function);
static NPT_Result Create(const char* logger_name,
const char* handler_name,
NPT_LogHandler*& handler);
// methods
virtual ~NPT_LogHandler() {}
virtual void Log(const NPT_LogRecord& record) = 0;
virtual NPT_String ToString() { return ""; }
};
class NPT_Logger {
public:
// methods
NPT_Logger(const char* name, NPT_LogManager& manager);
~NPT_Logger();
void Log(int level,
const char* source_file,
unsigned int source_line,
const char* source_function,
const char* msg,
...);
NPT_Result AddHandler(NPT_LogHandler* handler, bool transfer_ownership = true);
NPT_Result DeleteHandlers();
NPT_Result SetParent(NPT_Logger* parent);
const NPT_String& GetName() const { return m_Name; }
int GetLevel() const { return m_Level; }
bool GetForwardToParent() const { return m_ForwardToParent; }
NPT_List<NPT_LogHandler*>& GetHandlers() { return m_Handlers; }
private:
// members
NPT_LogManager& m_Manager;
NPT_String m_Name;
int m_Level;
bool m_LevelIsInherited;
bool m_ForwardToParent;
NPT_Logger* m_Parent;
NPT_List<NPT_LogHandler*> m_Handlers;
NPT_List<NPT_LogHandler*> m_ExternalHandlers;
// friends
friend class NPT_LogManager;
};
typedef struct {
NPT_Logger* logger;
const char* name;
} NPT_LoggerReference;
class NPT_Log {
public:
// class methods
static int GetLogLevel(const char* name);
static const char* GetLogLevelName(int level);
static const char* GetLogLevelAnsiColor(int level);
static void FormatRecordToStream(const NPT_LogRecord& record,
NPT_OutputStream& stream,
bool use_colors,
NPT_Flags format_filter);
};
class NPT_LogConfigEntry {
public:
NPT_LogConfigEntry(const char* key, const char* value) :
m_Key(key), m_Value(value) {}
NPT_String m_Key;
NPT_String m_Value;
};
class NPT_LogManager {
public:
// class methods
static NPT_LogManager& GetDefault();
static bool ConfigValueIsBooleanTrue(NPT_String& value);
static bool ConfigValueIsBooleanFalse(NPT_String& value);
static NPT_Logger* GetLogger(const char* name);
// methods
NPT_LogManager();
~NPT_LogManager();
NPT_Result Configure(const char* config_sources = NULL);
NPT_String* GetConfigValue(const char* prefix, const char* suffix);
NPT_List<NPT_Logger*>& GetLoggers() { return m_Loggers; }
NPT_List<NPT_LogConfigEntry>& GetConfig() { return m_Config; }
void SetEnabled(bool enabled) { m_Enabled = enabled; }
bool IsEnabled() { return m_Enabled; }
void Lock();
void Unlock();
private:
// methods
NPT_Result SetConfigValue(const char* key, const char* value);
NPT_Result ParseConfig(const char* config, NPT_Size config_size);
NPT_Result ParseConfigSource(NPT_String& source);
NPT_Result ParseConfigFile(const char* filename);
bool HaveLoggerConfig(const char* name);
NPT_Logger* FindLogger(const char* name);
NPT_Result ConfigureLogger(NPT_Logger* logger);
// members
NPT_Mutex m_Lock;
NPT_Thread::ThreadId m_LockOwner;
bool m_Enabled;
bool m_Configured;
NPT_List<NPT_LogConfigEntry> m_Config;
NPT_List<NPT_Logger*> m_Loggers;
NPT_Logger* m_Root;
};
const unsigned short NPT_HTTP_LOGGER_CONFIGURATOR_DEFAULT_PORT = 6378;
class NPT_HttpLoggerConfigurator : NPT_HttpRequestHandler, public NPT_Thread {
public:
// constructor and destructor
NPT_HttpLoggerConfigurator(NPT_UInt16 port = NPT_HTTP_LOGGER_CONFIGURATOR_DEFAULT_PORT,
bool detached = true);
virtual ~NPT_HttpLoggerConfigurator();
// NPT_Runnable (NPT_Thread) methods
virtual void Run();
private:
// NPT_HttpRequestHandler methods
virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
const NPT_HttpRequestContext& context,
NPT_HttpResponse& response);
// members
NPT_HttpServer* m_Server;
};
NPT_Result NPT_GetSystemLogConfig(NPT_String& config);
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define NPT_LOG_LEVEL_FATAL 700
#define NPT_LOG_LEVEL_SEVERE 600
#define NPT_LOG_LEVEL_WARNING 500
#define NPT_LOG_LEVEL_INFO 400
#define NPT_LOG_LEVEL_FINE 300
#define NPT_LOG_LEVEL_FINER 200
#define NPT_LOG_LEVEL_FINEST 100
#define NPT_LOG_LEVEL_OFF 32767
#define NPT_LOG_LEVEL_ALL 0
/*----------------------------------------------------------------------
| macros
+---------------------------------------------------------------------*/
#define NPT_LOG_GET_LOGGER(_logger) \
if ((_logger).logger == NULL) { \
(_logger).logger = NPT_LogManager::GetLogger((_logger).name); \
}
#if defined(NPT_CONFIG_ENABLE_LOGGING)
//TODO: volatile makes tons of errors for me
//#define NPT_DEFINE_LOGGER(_logger, _name) static volatile NPT_LoggerReference _logger = { NULL, (_name) };
#define NPT_DEFINE_LOGGER(_logger, _name) static NPT_LoggerReference _logger = { NULL, (_name) };
#define NPT_LOG_X(_logger, _level, _argsx) \
do { \
NPT_LOG_GET_LOGGER((_logger)) \
if ((_logger).logger && (_level) >= (_logger).logger->GetLevel()) { \
(_logger).logger->Log _argsx; \
} \
} while(0)
#define NPT_CHECK_LL(_logger, _level, _result) do { \
NPT_Result _x = (_result); \
if (_x != NPT_SUCCESS) { \
NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"NPT_CHECK failed, result=%d (%s) [%s]", _x, NPT_ResultText(_x), #_result)); \
return _x; \
} \
} while(0)
#define NPT_CHECK_LABEL_LL(_logger, _level, _result, _label) do { \
NPT_Result _x = (_result); \
if (_x != NPT_SUCCESS) { \
NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"NPT_CHECK failed, result=%d (%s) [%s]", _x, NPT_ResultText(_x), #_result)); \
goto _label; \
} \
} while(0)
#define NPT_CHECK_POINTER_LL(_logger, _level, _p) do { \
if ((_p) == NULL) { \
NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"@@@ NULL pointer parameter")); \
return NPT_ERROR_INVALID_PARAMETERS; \
} \
} while(0)
#define NPT_CHECK_POINTER_LABEL_LL(_logger, _level, _p, _label) do { \
if ((_p) == NULL) { \
NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"@@@ NULL pointer parameter")); \
goto _label; \
} \
} while(0)
#else /* NPT_CONFIG_ENABLE_LOGGING */
#define NPT_DEFINE_LOGGER(_logger, _name)
#define NPT_LOG_X(_logger, _level, _argsx)
#define NPT_CHECK_LL(_logger, _level, _result) NPT_CHECK(_result)
#define NPT_CHECK_LABEL_LL(_logger, _level, _result, _label) NPT_CHECK_LABEL((_result), _label)
#define NPT_CHECK_POINTER_LL(_logger, _level, _p) NPT_CHECK_POINTER((_p))
#define NPT_CHECK_POINTER_LABEL_LL(_logger, _level, _p, _label) NPT_CHECK_POINTER_LABEL((_p), _label)
#endif /* NPT_CONFIG_ENABLE_LOGGING */
#define NPT_SET_LOCAL_LOGGER(_name) NPT_DEFINE_LOGGER(_NPT_LocalLogger, (_name))
#define NPT_CHECK_L(_level, _result) NPT_CHECK_LL(_NPT_LocalLogger, (_level), (_result))
#define NPT_CHECK_LABEL_L(_level, _result, _label) NPT_CHECK_LABEL_LL(_NPT_LocalLogger, (_level), NULL, (_result), _label)
/* NOTE: the following are machine-generated, do not edit */
#define NPT_LOG_LL(_logger,_level,_msg) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg)))
#define NPT_LOG(_level,_msg) NPT_LOG_LL((_NPT_LocalLogger),(_level),(_msg))
#define NPT_LOG_L(_logger,_level,_msg) NPT_LOG_LL((_logger),(_level),(_msg))
#define NPT_LOG_LL1(_logger,_level,_msg,_arg1) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1)))
#define NPT_LOG_1(_level,_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),(_level),(_msg),(_arg1))
#define NPT_LOG_L1(_logger,_level,_msg,_arg1) NPT_LOG_LL1((_logger),(_level),(_msg),(_arg1))
#define NPT_LOG_LL2(_logger,_level,_msg,_arg1,_arg2) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2)))
#define NPT_LOG_2(_level,_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2))
#define NPT_LOG_L2(_logger,_level,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),(_level),(_msg),(_arg1),(_arg2))
#define NPT_LOG_LL3(_logger,_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3)))
#define NPT_LOG_3(_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_L3(_logger,_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_LL4(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4)))
#define NPT_LOG_4(_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_L4(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_LL5(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5)))
#define NPT_LOG_5(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_L5(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_LL6(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6)))
#define NPT_LOG_6(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_L6(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_LL7(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7)))
#define NPT_LOG_7(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_L7(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_LL8(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8)))
#define NPT_LOG_8(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_L8(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_LL9(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9)))
#define NPT_LOG_9(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_L9(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FATAL(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg))
#define NPT_LOG_FATAL_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FATAL,(_msg))
#define NPT_LOG_FATAL_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1))
#define NPT_LOG_FATAL_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1))
#define NPT_LOG_FATAL_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FATAL_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FATAL_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FATAL_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FATAL_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FATAL_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FATAL_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FATAL_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FATAL_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FATAL_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FATAL_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FATAL_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FATAL_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FATAL_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FATAL_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FATAL_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_SEVERE(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg))
#define NPT_LOG_SEVERE_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_msg))
#define NPT_LOG_SEVERE_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1))
#define NPT_LOG_SEVERE_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1))
#define NPT_LOG_SEVERE_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2))
#define NPT_LOG_SEVERE_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2))
#define NPT_LOG_SEVERE_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_SEVERE_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_SEVERE_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_SEVERE_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_SEVERE_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_SEVERE_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_SEVERE_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_SEVERE_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_SEVERE_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_SEVERE_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_SEVERE_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_SEVERE_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_SEVERE_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_SEVERE_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_WARNING(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg))
#define NPT_LOG_WARNING_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_WARNING,(_msg))
#define NPT_LOG_WARNING_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1))
#define NPT_LOG_WARNING_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1))
#define NPT_LOG_WARNING_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2))
#define NPT_LOG_WARNING_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2))
#define NPT_LOG_WARNING_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_WARNING_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_WARNING_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_WARNING_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_WARNING_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_WARNING_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_WARNING_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_WARNING_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_WARNING_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_WARNING_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_WARNING_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_WARNING_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_WARNING_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_WARNING_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_INFO(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg))
#define NPT_LOG_INFO_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_INFO,(_msg))
#define NPT_LOG_INFO_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1))
#define NPT_LOG_INFO_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1))
#define NPT_LOG_INFO_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2))
#define NPT_LOG_INFO_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2))
#define NPT_LOG_INFO_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_INFO_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_INFO_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_INFO_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_INFO_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_INFO_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_INFO_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_INFO_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_INFO_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_INFO_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_INFO_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_INFO_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_INFO_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_INFO_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FINE(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg))
#define NPT_LOG_FINE_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINE,(_msg))
#define NPT_LOG_FINE_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1))
#define NPT_LOG_FINE_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1))
#define NPT_LOG_FINE_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FINE_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FINE_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FINE_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FINE_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FINE_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FINE_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FINE_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FINE_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FINE_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FINE_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FINE_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FINE_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FINE_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FINE_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FINE_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FINER(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg))
#define NPT_LOG_FINER_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINER,(_msg))
#define NPT_LOG_FINER_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1))
#define NPT_LOG_FINER_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1))
#define NPT_LOG_FINER_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FINER_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FINER_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FINER_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FINER_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FINER_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FINER_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FINER_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FINER_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FINER_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FINER_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FINER_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FINER_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FINER_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FINER_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FINER_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FINEST(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg))
#define NPT_LOG_FINEST_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINEST,(_msg))
#define NPT_LOG_FINEST_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1))
#define NPT_LOG_FINEST_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1))
#define NPT_LOG_FINEST_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FINEST_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2))
#define NPT_LOG_FINEST_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FINEST_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3))
#define NPT_LOG_FINEST_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FINEST_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
#define NPT_LOG_FINEST_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FINEST_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
#define NPT_LOG_FINEST_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FINEST_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
#define NPT_LOG_FINEST_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FINEST_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
#define NPT_LOG_FINEST_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FINEST_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
#define NPT_LOG_FINEST_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_LOG_FINEST_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
#define NPT_CHECK_FATAL(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_result))
#define NPT_CHECK_FATAL_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FATAL,(_result))
#define NPT_CHECK_SEVERE(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_result))
#define NPT_CHECK_SEVERE_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_result))
#define NPT_CHECK_WARNING(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_result))
#define NPT_CHECK_WARNING_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_WARNING,(_result))
#define NPT_CHECK_INFO(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_result))
#define NPT_CHECK_INFO_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_INFO,(_result))
#define NPT_CHECK_FINE(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_result))
#define NPT_CHECK_FINE_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINE,(_result))
#define NPT_CHECK_FINER(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_result))
#define NPT_CHECK_FINER_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINER,(_result))
#define NPT_CHECK_FINEST(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_result))
#define NPT_CHECK_FINEST_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINEST,(_result))
#define NPT_CHECK_LABEL_FATAL(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_result),_label)
#define NPT_CHECK_LABEL_FATAL_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FATAL,(_result),_label)
#define NPT_CHECK_LABEL_SEVERE(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_result),_label)
#define NPT_CHECK_LABEL_SEVERE_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_result),_label)
#define NPT_CHECK_LABEL_WARNING(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_result),_label)
#define NPT_CHECK_LABEL_WARNING_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_WARNING,(_result),_label)
#define NPT_CHECK_LABEL_INFO(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_result),_label)
#define NPT_CHECK_LABEL_INFO_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_INFO,(_result),_label)
#define NPT_CHECK_LABEL_FINE(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_result),_label)
#define NPT_CHECK_LABEL_FINE_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINE,(_result),_label)
#define NPT_CHECK_LABEL_FINER(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_result),_label)
#define NPT_CHECK_LABEL_FINER_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINER,(_result),_label)
#define NPT_CHECK_LABEL_FINEST(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_result),_label)
#define NPT_CHECK_LABEL_FINEST_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINEST,(_result),_label)
#define NPT_CHECK_POINTER_FATAL(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_p))
#define NPT_CHECK_POINTER_FATAL_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FATAL,(_p))
#define NPT_CHECK_POINTER_SEVERE(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_p))
#define NPT_CHECK_POINTER_SEVERE_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_SEVERE,(_p))
#define NPT_CHECK_POINTER_WARNING(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_p))
#define NPT_CHECK_POINTER_WARNING_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_WARNING,(_p))
#define NPT_CHECK_POINTER_INFO(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_p))
#define NPT_CHECK_POINTER_INFO_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_INFO,(_p))
#define NPT_CHECK_POINTER_FINE(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_p))
#define NPT_CHECK_POINTER_FINE_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINE,(_p))
#define NPT_CHECK_POINTER_FINER(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_p))
#define NPT_CHECK_POINTER_FINER_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINER,(_p))
#define NPT_CHECK_POINTER_FINEST(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_p))
#define NPT_CHECK_POINTER_FINEST_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINEST,(_p))
#define NPT_CHECK_POINTER_LABEL_FATAL(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FATAL_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FATAL,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_SEVERE(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_SEVERE_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_SEVERE,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_WARNING(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_WARNING_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_WARNING,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_INFO(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_INFO_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_INFO,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FINE(_p, _label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FINE_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINE,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FINER(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FINER_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINER,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FINEST(_p,_label) NNPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_p),_label)
#define NPT_CHECK_POINTER_LABEL_FINEST_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINEST,(_p),_label)
#endif /* _NPT_LOGGING_H_ */
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2012-2019 the original author or 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
*
* https://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 io.spring.initializr.generator.test.project;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import io.spring.initializr.generator.project.MutableProjectDescription;
import io.spring.initializr.generator.project.ProjectDescription;
import io.spring.initializr.generator.project.contributor.ProjectContributor;
import io.spring.initializr.generator.version.Version;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ProjectGeneratorTester}.
*
* @author Andy Wilkinson
* @author Stephane Nicoll
*/
class ProjectGeneratorTesterTests {
@Test
void testerHasNoRegisteredContributorByDefault() {
Map<String, ProjectContributor> contributors = new ProjectGeneratorTester().generate(
new MutableProjectDescription(), (context) -> context.getBeansOfType(ProjectContributor.class));
assertThat(contributors).isEmpty();
}
@Test
void testerWithDescriptionCustomizer() {
Version platformVersion = Version.parse("2.1.0.RELEASE");
MutableProjectDescription description = new MutableProjectDescription();
description.setPackageName("com.example.test");
ProjectDescription customizedDescription = new ProjectGeneratorTester().withDescriptionCustomizer((desc) -> {
desc.setPlatformVersion(Version.parse("2.1.0.RELEASE"));
desc.setPackageName("com.example.another");
}).generate(description, (context) -> context.getBean(ProjectDescription.class));
assertThat(customizedDescription.getPlatformVersion()).isEqualTo(platformVersion);
assertThat(customizedDescription.getPackageName()).isEqualTo("com.example.another");
}
@Test
void testerWithExplicitProjectContributors(@TempDir Path directory) {
ProjectGeneratorTester tester = new ProjectGeneratorTester().withDirectory(directory)
.withContextInitializer((context) -> {
context.registerBean("contributor1", ProjectContributor.class,
() -> (projectDirectory) -> Files.createFile(projectDirectory.resolve("test.text")));
context.registerBean("contributor2", ProjectContributor.class, () -> (projectDirectory) -> {
Path subDir = projectDirectory.resolve("src/main/test");
Files.createDirectories(subDir);
Files.createFile(subDir.resolve("Test.src"));
});
});
ProjectStructure project = tester.generate(new MutableProjectDescription());
assertThat(project).filePaths().containsOnly("test.text", "src/main/test/Test.src");
}
}
|
{
"pile_set_name": "Github"
}
|
#pragma once
#include "envoy/config/config_provider.h"
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.h"
#include "envoy/http/filter.h"
#include "envoy/http/request_id_extension.h"
#include "envoy/router/rds.h"
#include "envoy/stats/scope.h"
#include "envoy/tracing/http_tracer.h"
#include "envoy/type/v3/percent.pb.h"
#include "common/http/date_provider.h"
#include "common/local_reply/local_reply.h"
#include "common/network/utility.h"
#include "common/stats/symbol_table_impl.h"
namespace Envoy {
namespace Http {
/**
* All stats for the connection manager. @see stats_macros.h
*/
#define ALL_HTTP_CONN_MAN_STATS(COUNTER, GAUGE, HISTOGRAM) \
COUNTER(downstream_cx_delayed_close_timeout) \
COUNTER(downstream_cx_destroy) \
COUNTER(downstream_cx_destroy_active_rq) \
COUNTER(downstream_cx_destroy_local) \
COUNTER(downstream_cx_destroy_local_active_rq) \
COUNTER(downstream_cx_destroy_remote) \
COUNTER(downstream_cx_destroy_remote_active_rq) \
COUNTER(downstream_cx_drain_close) \
COUNTER(downstream_cx_http1_total) \
COUNTER(downstream_cx_http2_total) \
COUNTER(downstream_cx_http3_total) \
COUNTER(downstream_cx_idle_timeout) \
COUNTER(downstream_cx_max_duration_reached) \
COUNTER(downstream_cx_overload_disable_keepalive) \
COUNTER(downstream_cx_protocol_error) \
COUNTER(downstream_cx_rx_bytes_total) \
COUNTER(downstream_cx_ssl_total) \
COUNTER(downstream_cx_total) \
COUNTER(downstream_cx_tx_bytes_total) \
COUNTER(downstream_cx_upgrades_total) \
COUNTER(downstream_flow_control_paused_reading_total) \
COUNTER(downstream_flow_control_resumed_reading_total) \
COUNTER(downstream_rq_1xx) \
COUNTER(downstream_rq_2xx) \
COUNTER(downstream_rq_3xx) \
COUNTER(downstream_rq_4xx) \
COUNTER(downstream_rq_5xx) \
COUNTER(downstream_rq_completed) \
COUNTER(downstream_rq_http1_total) \
COUNTER(downstream_rq_http2_total) \
COUNTER(downstream_rq_http3_total) \
COUNTER(downstream_rq_idle_timeout) \
COUNTER(downstream_rq_non_relative_path) \
COUNTER(downstream_rq_overload_close) \
COUNTER(downstream_rq_response_before_rq_complete) \
COUNTER(downstream_rq_rx_reset) \
COUNTER(downstream_rq_timeout) \
COUNTER(downstream_rq_too_large) \
COUNTER(downstream_rq_total) \
COUNTER(downstream_rq_tx_reset) \
COUNTER(downstream_rq_max_duration_reached) \
COUNTER(downstream_rq_ws_on_non_ws_route) \
COUNTER(rs_too_large) \
GAUGE(downstream_cx_active, Accumulate) \
GAUGE(downstream_cx_http1_active, Accumulate) \
GAUGE(downstream_cx_http2_active, Accumulate) \
GAUGE(downstream_cx_http3_active, Accumulate) \
GAUGE(downstream_cx_rx_bytes_buffered, Accumulate) \
GAUGE(downstream_cx_ssl_active, Accumulate) \
GAUGE(downstream_cx_tx_bytes_buffered, Accumulate) \
GAUGE(downstream_cx_upgrades_active, Accumulate) \
GAUGE(downstream_rq_active, Accumulate) \
HISTOGRAM(downstream_cx_length_ms, Milliseconds) \
HISTOGRAM(downstream_rq_time, Milliseconds)
/**
* Wrapper struct for connection manager stats. @see stats_macros.h
*/
struct ConnectionManagerNamedStats {
ALL_HTTP_CONN_MAN_STATS(GENERATE_COUNTER_STRUCT, GENERATE_GAUGE_STRUCT, GENERATE_HISTOGRAM_STRUCT)
};
struct ConnectionManagerStats {
ConnectionManagerStats(ConnectionManagerNamedStats&& named_stats, const std::string& prefix,
Stats::Scope& scope)
: named_(std::move(named_stats)), prefix_(prefix),
prefix_stat_name_storage_(prefix, scope.symbolTable()), scope_(scope) {}
Stats::StatName prefixStatName() const { return prefix_stat_name_storage_.statName(); }
ConnectionManagerNamedStats named_;
std::string prefix_;
Stats::StatNameManagedStorage prefix_stat_name_storage_;
Stats::Scope& scope_;
};
/**
* Connection manager tracing specific stats. @see stats_macros.h
*/
#define CONN_MAN_TRACING_STATS(COUNTER) \
COUNTER(random_sampling) \
COUNTER(service_forced) \
COUNTER(client_enabled) \
COUNTER(not_traceable) \
COUNTER(health_check)
/**
* Wrapper struct for connection manager tracing stats. @see stats_macros.h
*/
struct ConnectionManagerTracingStats {
CONN_MAN_TRACING_STATS(GENERATE_COUNTER_STRUCT)
};
/**
* Configuration for tracing which is set on the connection manager level.
* Http Tracing can be enabled/disabled on a per connection manager basis.
* Here we specify some specific for connection manager settings.
*/
struct TracingConnectionManagerConfig {
Tracing::OperationName operation_name_;
Tracing::CustomTagMap custom_tags_;
envoy::type::v3::FractionalPercent client_sampling_;
envoy::type::v3::FractionalPercent random_sampling_;
envoy::type::v3::FractionalPercent overall_sampling_;
bool verbose_;
uint32_t max_path_tag_length_;
};
using TracingConnectionManagerConfigPtr = std::unique_ptr<TracingConnectionManagerConfig>;
/**
* Connection manager per listener stats. @see stats_macros.h
*/
#define CONN_MAN_LISTENER_STATS(COUNTER) \
COUNTER(downstream_rq_1xx) \
COUNTER(downstream_rq_2xx) \
COUNTER(downstream_rq_3xx) \
COUNTER(downstream_rq_4xx) \
COUNTER(downstream_rq_5xx) \
COUNTER(downstream_rq_completed)
/**
* Wrapper struct for connection manager listener stats. @see stats_macros.h
*/
struct ConnectionManagerListenerStats {
CONN_MAN_LISTENER_STATS(GENERATE_COUNTER_STRUCT)
};
/**
* Configuration for how to forward client certs.
*/
enum class ForwardClientCertType {
ForwardOnly,
AppendForward,
SanitizeSet,
Sanitize,
AlwaysForwardOnly
};
/**
* Configuration for the fields of the client cert, used for populating the current client cert
* information to the next hop.
*/
enum class ClientCertDetailsType { Cert, Chain, Subject, URI, DNS };
/**
* Configuration for what addresses should be considered internal beyond the defaults.
*/
class InternalAddressConfig {
public:
virtual ~InternalAddressConfig() = default;
virtual bool isInternalAddress(const Network::Address::Instance& address) const PURE;
};
/**
* Determines if an address is internal based on whether it is an RFC1918 ip address.
*/
class DefaultInternalAddressConfig : public Http::InternalAddressConfig {
public:
bool isInternalAddress(const Network::Address::Instance& address) const override {
return Network::Utility::isInternalAddress(address);
}
};
/**
* Abstract configuration for the connection manager.
*/
class ConnectionManagerConfig {
public:
using HttpConnectionManagerProto =
envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager;
virtual ~ConnectionManagerConfig() = default;
/**
* @return RequestIDExtensionSharedPtr The request id utilities instance to use
*/
virtual RequestIDExtensionSharedPtr requestIDExtension() PURE;
/**
* @return const std::list<AccessLog::InstanceSharedPtr>& the access logs to write to.
*/
virtual const std::list<AccessLog::InstanceSharedPtr>& accessLogs() PURE;
/**
* Called to create a codec for the connection manager. This function will be called when the
* first byte of application data is received. This is done to support handling of ALPN, protocol
* detection, etc.
* @param connection supplies the owning connection.
* @param data supplies the currently available read data.
* @param callbacks supplies the callbacks to install into the codec.
* @return a codec or nullptr if no codec can be created.
*/
virtual ServerConnectionPtr createCodec(Network::Connection& connection,
const Buffer::Instance& data,
ServerConnectionCallbacks& callbacks) PURE;
/**
* @return DateProvider& the date provider to use for
*/
virtual DateProvider& dateProvider() PURE;
/**
* @return the time in milliseconds the connection manager will wait between issuing a "shutdown
* notice" to the time it will issue a full GOAWAY and not accept any new streams.
*/
virtual std::chrono::milliseconds drainTimeout() const PURE;
/**
* @return FilterChainFactory& the HTTP level filter factory to build the connection's filter
* chain.
*/
virtual FilterChainFactory& filterFactory() PURE;
/**
* @return whether the connection manager will generate a fresh x-request-id if the request does
* not have one.
*/
virtual bool generateRequestId() const PURE;
/**
* @return whether the x-request-id should not be reset on edge entry inside mesh
*/
virtual bool preserveExternalRequestId() const PURE;
/**
* @return whether the x-request-id should always be set in the response.
*/
virtual bool alwaysSetRequestIdInResponse() const PURE;
/**
* @return optional idle timeout for incoming connection manager connections.
*/
virtual absl::optional<std::chrono::milliseconds> idleTimeout() const PURE;
/**
* @return if the connection manager does routing base on router config, e.g. a Server::Admin impl
* has no route config.
*/
virtual bool isRoutable() const PURE;
/**
* @return optional maximum connection duration timeout for manager connections.
*/
virtual absl::optional<std::chrono::milliseconds> maxConnectionDuration() const PURE;
/**
* @return maximum request headers size the connection manager will accept.
*/
virtual uint32_t maxRequestHeadersKb() const PURE;
/**
* @return maximum number of request headers the codecs will accept.
*/
virtual uint32_t maxRequestHeadersCount() const PURE;
/**
* @return per-stream idle timeout for incoming connection manager connections. Zero indicates a
* disabled idle timeout.
*/
virtual std::chrono::milliseconds streamIdleTimeout() const PURE;
/**
* @return request timeout for incoming connection manager connections. Zero indicates
* a disabled request timeout.
*/
virtual std::chrono::milliseconds requestTimeout() const PURE;
/**
* @return delayed close timeout for downstream HTTP connections. Zero indicates a disabled
* timeout. See http_connection_manager.proto for a detailed description of this timeout.
*/
virtual std::chrono::milliseconds delayedCloseTimeout() const PURE;
/**
* @return maximum duration time to keep alive stream
*/
virtual absl::optional<std::chrono::milliseconds> maxStreamDuration() const PURE;
/**
* @return Router::RouteConfigProvider* the configuration provider used to acquire a route
* config for each request flow. Pointer ownership is _not_ transferred to the caller of
* this function. This will return nullptr when scoped routing is enabled.
*/
virtual Router::RouteConfigProvider* routeConfigProvider() PURE;
/**
* @return Config::ConfigProvider* the configuration provider used to acquire scoped routing
* configuration for each request flow. Pointer ownership is _not_ transferred to the caller of
* this function. This will return nullptr when scoped routing is not enabled.
*/
virtual Config::ConfigProvider* scopedRouteConfigProvider() PURE;
/**
* @return const std::string& the server name to write into responses.
*/
virtual const std::string& serverName() const PURE;
/**
* @return ServerHeaderTransformation the transformation to apply to Server response headers.
*/
virtual HttpConnectionManagerProto::ServerHeaderTransformation
serverHeaderTransformation() const PURE;
/**
* @return ConnectionManagerStats& the stats to write to.
*/
virtual ConnectionManagerStats& stats() PURE;
/**
* @return ConnectionManagerTracingStats& the stats to write to.
*/
virtual ConnectionManagerTracingStats& tracingStats() PURE;
/**
* @return bool whether to use the remote address for populating XFF, determining internal request
* status, etc. or to assume that XFF will already be populated with the remote address.
*/
virtual bool useRemoteAddress() const PURE;
/**
* @return InternalAddressConfig configuration for user defined internal addresses.
*/
virtual const InternalAddressConfig& internalAddressConfig() const PURE;
/**
* @return uint32_t the number of trusted proxy hops in front of this Envoy instance, for
* the purposes of XFF processing.
*/
virtual uint32_t xffNumTrustedHops() const PURE;
/**
* @return bool don't append the remote address to XFF? This overrides the behavior of
* useRemoteAddress() and may be used when XFF should not be modified but we still
* want to avoid trusting incoming XFF in remote IP determination.
*/
virtual bool skipXffAppend() const PURE;
/**
* @return const absl::optional<std::string>& value of via header to add to requests and response
* headers if set.
*/
virtual const std::string& via() const PURE;
/**
* @return ForwardClientCertType the configuration of how to forward the client cert information.
*/
virtual ForwardClientCertType forwardClientCert() const PURE;
/**
* @return vector of ClientCertDetailsType the configuration of the current client cert's details
* to be forwarded.
*/
virtual const std::vector<ClientCertDetailsType>& setCurrentClientCertDetails() const PURE;
/**
* @return local address.
* Gives richer information in case of internal requests.
*/
virtual const Network::Address::Instance& localAddress() PURE;
/**
* @return custom user agent for internal requests for better debugging. Must be configured to
* be enabled. User agent will only overwritten if it doesn't already exist. If enabled,
* the same user agent will be written to the x-envoy-downstream-service-cluster header.
*/
virtual const absl::optional<std::string>& userAgent() PURE;
/**
* @return HttpTracerSharedPtr HttpTracer to use.
*/
virtual Tracing::HttpTracerSharedPtr tracer() PURE;
/**
* @return tracing config.
*/
virtual const TracingConnectionManagerConfig* tracingConfig() PURE;
/**
* @return ConnectionManagerListenerStats& the stats to write to.
*/
virtual ConnectionManagerListenerStats& listenerStats() PURE;
/**
* @return bool supplies if the HttpConnectionManager should proxy the Expect: 100-Continue
*/
virtual bool proxy100Continue() const PURE;
/**
* @return bool supplies if the HttpConnectionManager should handle invalid HTTP with a stream
* error or connection error.
*/
virtual bool streamErrorOnInvalidHttpMessaging() const PURE;
/**
* @return supplies the http1 settings.
*/
virtual const Http::Http1Settings& http1Settings() const PURE;
/**
* @return if the HttpConnectionManager should normalize url following RFC3986
*/
virtual bool shouldNormalizePath() const PURE;
/**
* @return if the HttpConnectionManager should merge two or more adjacent slashes in the path into
* one.
*/
virtual bool shouldMergeSlashes() const PURE;
/**
* @return if the HttpConnectionManager should remove the port from host/authority header
*/
virtual bool shouldStripMatchingPort() const PURE;
/**
* @return the action HttpConnectionManager should take when receiving client request
* headers containing underscore characters.
*/
virtual envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction
headersWithUnderscoresAction() const PURE;
/**
* @return LocalReply configuration which supplies mapping for local reply generated by Envoy.
*/
virtual const LocalReply::LocalReply& localReply() const PURE;
};
} // namespace Http
} // namespace Envoy
|
{
"pile_set_name": "Github"
}
|
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_INCLUDE_PAIR_TIE)
#define FUSION_INCLUDE_PAIR_TIE
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/generation/pair_tie.hpp>
#endif
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// API Gateway API
//
// API for the API Gateway service. Use this API to manage gateways, deployments, and related items.
// For more information, see
// Overview of API Gateway (https://docs.cloud.oracle.com/iaas/Content/APIGateway/Concepts/apigatewayoverview.htm).
//
package apigateway
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/v25/common"
)
// CustomAuthenticationPolicy Use a function to validate a custom header or query parameter sent with the request authentication.
// A valid policy must specify either tokenHeader or tokenQueryParam.
type CustomAuthenticationPolicy struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the Oracle Functions function resource.
FunctionId *string `mandatory:"true" json:"functionId"`
// Whether an unauthenticated user may access the API. Must be "true" to enable ANONYMOUS
// route authorization.
IsAnonymousAccessAllowed *bool `mandatory:"false" json:"isAnonymousAccessAllowed"`
// The name of the header containing the authentication token.
TokenHeader *string `mandatory:"false" json:"tokenHeader"`
// The name of the query parameter containing the authentication token.
TokenQueryParam *string `mandatory:"false" json:"tokenQueryParam"`
}
//GetIsAnonymousAccessAllowed returns IsAnonymousAccessAllowed
func (m CustomAuthenticationPolicy) GetIsAnonymousAccessAllowed() *bool {
return m.IsAnonymousAccessAllowed
}
func (m CustomAuthenticationPolicy) String() string {
return common.PointerString(m)
}
// MarshalJSON marshals to json representation
func (m CustomAuthenticationPolicy) MarshalJSON() (buff []byte, e error) {
type MarshalTypeCustomAuthenticationPolicy CustomAuthenticationPolicy
s := struct {
DiscriminatorParam string `json:"type"`
MarshalTypeCustomAuthenticationPolicy
}{
"CUSTOM_AUTHENTICATION",
(MarshalTypeCustomAuthenticationPolicy)(m),
}
return json.Marshal(&s)
}
|
{
"pile_set_name": "Github"
}
|
\name{pcnm}
\alias{pcnm}
\alias{scores.pcnm}
\title{ Principal Coordinates of Neighbourhood Matrix }
\description{
This function computed classical PCNM by the principal coordinate
analysis of a truncated distance matrix. These are commonly used to
transform (spatial) distances to rectangular data that suitable for
constrained ordination or regression.
}
\usage{
pcnm(dis, threshold, w, dist.ret = FALSE)
}
\arguments{
\item{dis}{ A distance matrix. }
\item{threshold}{ A threshold value or truncation distance. If
missing, minimum distance giving connected network will be
used. This is found as the longest distance in the minimum spanning
tree of \code{dis}. }
\item{w}{Prior weights for rows.}
\item{dist.ret}{Return the distances used to calculate the PCNMs.}
}
\details{
Principal Coordinates of Neighbourhood Matrix (PCNM) map distances
between rows onto rectangular matrix on rows using a truncation
threshold for long distances (Borcard & Legendre 2002). If original
distances were Euclidean distances in two dimensions (like normal
spatial distances), they could be mapped onto two dimensions if there
is no truncation of distances. Because of truncation, there will be a
higher number of principal coordinates. The selection of truncation
distance has a huge influence on the PCNM vectors. The default is to
use the longest distance to keep data connected. The distances above
truncation threshold are given an arbitrary value of 4 times
threshold. For regular data, the first PCNM vectors show a wide scale
variation and later PCNM vectors show smaller scale variation (Borcard
& Legendre 2002), but for irregular data the interpretation is not as
clear.
The PCNM functions are used to express distances in rectangular form
that is similar to normal explanatory variables used in, e.g.,
constrained ordination (\code{\link{rda}}, \code{\link{cca}} and
\code{\link{capscale}}) or univariate regression (\code{\link{lm}})
together with environmental variables (row weights should be supplied
with \code{\link{cca}}; see Examples). This is regarded as a more
powerful method than forcing rectangular environmental data into
distances and using them in partial mantel analysis
(\code{\link{mantel.partial}}) together with geographic distances
(Legendre et al. 2008, but see Tuomisto & Ruokolainen 2008).
The function is based on \code{pcnm} function in Dray's unreleased
\pkg{spacemakeR} package. The differences are that the current
function uses \code{\link{spantree}} as an internal support
function. The current function also can use prior weights for rows by
using weighted metric scaling of \code{\link{wcmdscale}}. The use of
row weights allows finding orthonormal PCNMs also for correspondence
analysis (e.g., \code{\link{cca}}).
}
\value{
A list of the following elements:
\item{values }{Eigenvalues obtained by the principal coordinates
analysis.}
\item{vectors }{Eigenvectors obtained by the principal coordinates
analysis. They are scaled to unit norm. The vectors can be extracted
with \code{scores} function. The default is to return all PCNM vectors,
but argument \code{choices} selects the given vectors.}
\item{threshold}{Truncation distance.}
\item{dist}{The distance matrix where values above \code{threshold}
are replaced with arbitrary value of four times the
threshold. String \code{"pcnm"} is added to the \code{method}
attribute, and new attribute \code{threshold} is added to the
distances. This is returned only when \code{dist.ret = TRUE}. }
}
\references{
Borcard D. and Legendre P. (2002) All-scale spatial analysis of
ecological data by means of principal coordinates of neighbour
matrices. \emph{Ecological Modelling} \bold{153}, 51--68.
Legendre, P., Borcard, D and Peres-Neto, P. (2008) Analyzing or
explaining beta diversity? Comment. \emph{Ecology} \bold{89},
3238--3244.
Tuomisto, H. & Ruokolainen, K. (2008) Analyzing or explaining beta
diversity? A reply. \emph{Ecology} \bold{89}, 3244--3256.
}
\author{Jari Oksanen, based on the code of Stephane Dray.}
\seealso{ \code{\link{spantree}}. }
\examples{
## Example from Borcard & Legendre (2002)
data(mite.xy)
pcnm1 <- pcnm(dist(mite.xy))
op <- par(mfrow=c(1,3))
## Map of PCNMs in the sample plot
ordisurf(mite.xy, scores(pcnm1, choi=1), bubble = 4, main = "PCNM 1")
ordisurf(mite.xy, scores(pcnm1, choi=2), bubble = 4, main = "PCNM 2")
ordisurf(mite.xy, scores(pcnm1, choi=3), bubble = 4, main = "PCNM 3")
par(op)
## Plot first PCNMs against each other
ordisplom(pcnm1, choices=1:4)
## Weighted PCNM for CCA
data(mite)
rs <- rowSums(mite)/sum(mite)
pcnmw <- pcnm(dist(mite.xy), w = rs)
ord <- cca(mite ~ scores(pcnmw))
## Multiscale ordination: residual variance should have no distance
## trend
msoplot(mso(ord, mite.xy))
}
\keyword{ spatial }
\keyword{ multivariate }
|
{
"pile_set_name": "Github"
}
|
<div class="cluster-node-details">
<div class="row">
<div class="col-md-12">
<eshq-cluster-navigation></eshq-cluster-navigation>
</div>
</div>
<div class="row">
<div class="col-md-12">
<!--<span class="sub-info">Version: {{cNodeDetailsCtrl.info.version}}</span>-->
<h4>{{ cNodeDetailsCtrl.info.name}}</h4>
</div>
</div>
<div class="row">
<div class="col-md-6">
<eshq-node-summary-info-table info="cNodeDetailsCtrl.info"></eshq-node-summary-info-table>
</div>
<div class="col-md-6">
<eshq-node-os-info-table os="cNodeDetailsCtrl.info.os"
stats="cNodeDetailsCtrl.stats.os"></eshq-node-os-info-table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<eshq-node-jvm-stats-table jvm="cNodeDetailsCtrl.info.jvm"
stats="cNodeDetailsCtrl.stats.jvm"></eshq-node-jvm-stats-table>
</div>
<div class="col-md-6">
<eshq-node-process-table process="cNodeDetailsCtrl.stats.process"
info="cNodeDetailsCtrl.info.process"></eshq-node-process-table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<eshq-node-fs-info-table fs="cNodeDetailsCtrl.stats.fs"></eshq-node-fs-info-table>
</div>
<div class="col-md-6">
<eshq-node-plugins-table plugins="cNodeDetailsCtrl.info.plugins"></eshq-node-plugins-table>
</div>
</div>
</div>
|
{
"pile_set_name": "Github"
}
|
// -----------------------------------------
// input-group and input-group-addon styles
// note: form-groups are not required
//
@mixin input-group-button-variation($vertical-padding) {
.input-group-btn {
.btn {
//margin: 0 0 $vertical-padding 0;
}
}
}
// default margin - no form-group required
@include input-group-button-variation(input-padding-y);
.bmd-form-group-sm {
@include input-group-button-variation($input-padding-y-sm);
}
.bmd-form-group-lg {
@include input-group-button-variation($input-padding-y-lg);
}
.input-group {
// may be in or outside of form-group
.input-group-text {
display: flex;
justify-content: center;
align-items: center;
padding: 0 15px 0 15px;
background-color: transparent;
border-color: transparent;
}
}
|
{
"pile_set_name": "Github"
}
|
---
title: 二叉树的最近公共祖先
date: 2019-08-21T11:00:41+08:00
draft: false
categories: leetcode
---
## 题目
给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。
百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p、q,最近公共祖先表示为一个结点 x,满足 x 是 p、q 的祖先且 x 的深度尽可能大(一个节点也可以是它自己的祖先)。”
```
示例 1:
输入: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
输出: 3
解释: 节点 5 和节点 1 的最近公共祖先是节点 3。
```
## 解题思路
1. 通过 DFS 找到节点的路径
2. 从头开始遍历两个节点的路径,找到最后一个相等的节点
```
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
LinkedList<TreeNode> pathP = new LinkedList<>();
LinkedList<TreeNode> pathQ = new LinkedList<>();
findNodePath(pathP, root, p);
findNodePath(pathQ, root, q);
TreeNode last = null;
while (!pathP.isEmpty() && !pathQ.isEmpty()) {
TreeNode pi = pathP.pollFirst();
TreeNode qi = pathQ.pollFirst();
if (qi==pi) {
last = pi;
}else break;
}
return last;
}
private void findNodePath(LinkedList<TreeNode> path, TreeNode root, TreeNode target) {
if (root == null) {
return;
}
if (!path.isEmpty() && path.getLast().val == target.val) {
return;
}
path.addLast(root);
findNodePath(path, root.left, target);
if (!path.isEmpty() && path.getLast().val == target.val) {
return;
}
findNodePath(path, root.right, target);
if (!path.isEmpty() && path.getLast().val != target.val) {
path.removeLast();
}
}
```
|
{
"pile_set_name": "Github"
}
|
// Darkly 3.4.0
// Variables
// --------------------------------------------------
//== Colors
//
//## Gray and brand colors for use across Bootstrap.
@gray-base: #000;
@gray-darker: lighten(@gray-base, 13.5%); // #222
@gray-dark: #303030; // #333
@gray: #464545;
@gray-light: #999; // #999
@gray-lighter: #EBEBEB; // #eee
@brand-primary: #375a7f;
@brand-success: #00bc8c;
@brand-info: #3498DB;
@brand-warning: #F39C12;
@brand-danger: #E74C3C;
//== Scaffolding
//
//## Settings for some of the most global styles.
//** Background color for `<body>`.
@body-bg: @gray-darker;
//** Global text color on `<body>`.
@text-color: #fff;
//** Global textual link color.
@link-color: desaturate(lighten(@brand-success, 10%),10%);
//** Link hover color set via `darken()` function.
@link-hover-color: @link-color;
//** Link hover decoration.
@link-hover-decoration: underline;
//== Typography
//
//## Font, line-height, and color for body text, headings, and more.
@font-family-sans-serif: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
@font-family-serif: Georgia, "Times New Roman", Times, serif;
//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.
@font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
@font-family-base: @font-family-sans-serif;
@font-size-base: 15px;
@font-size-large: ceil((@font-size-base * 1.25)); // ~18px
@font-size-small: ceil((@font-size-base * 0.85)); // ~12px
@font-size-h1: floor((@font-size-base * 2.6)); // ~36px
@font-size-h2: floor((@font-size-base * 2.15)); // ~30px
@font-size-h3: ceil((@font-size-base * 1.7)); // ~24px
@font-size-h4: ceil((@font-size-base * 1.25)); // ~18px
@font-size-h5: @font-size-base;
@font-size-h6: ceil((@font-size-base * 0.85)); // ~12px
//** Unit-less `line-height` for use in components like buttons.
@line-height-base: 1.428571429; // 20/14
//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
@line-height-computed: floor((@font-size-base * @line-height-base)); // ~20px
//** By default, this inherits from the `<body>`.
@headings-font-family: @font-family-base;
@headings-font-weight: 400;
@headings-line-height: 1.1;
@headings-color: inherit;
//== Iconography
//
//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
//** Load fonts from this directory.
@icon-font-path: "../fonts/";
//** File name for all font files.
@icon-font-name: "glyphicons-halflings-regular";
//** Element ID within SVG icon file.
@icon-font-svg-id: "glyphicons_halflingsregular";
//== Components
//
//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
@padding-base-vertical: 10px;
@padding-base-horizontal: 15px;
@padding-large-vertical: 18px;
@padding-large-horizontal: 27px;
@padding-small-vertical: 6px;
@padding-small-horizontal: 9px;
@padding-xs-vertical: 1px;
@padding-xs-horizontal: 5px;
@line-height-large: 1.3333333; // extra decimals for Win 8.1 Chrome
@line-height-small: 1.5;
@border-radius-base: 4px;
@border-radius-large: 6px;
@border-radius-small: 3px;
//** Global color for active items (e.g., navs or dropdowns).
@component-active-color: #fff;
//** Global background color for active items (e.g., navs or dropdowns).
@component-active-bg: @brand-primary;
//** Width of the `border` for generating carets that indicate dropdowns.
@caret-width-base: 4px;
//** Carets increase slightly in size for larger components.
@caret-width-large: 5px;
//== Tables
//
//## Customizes the `.table` component with basic values, each used across all table variations.
//** Padding for `<th>`s and `<td>`s.
@table-cell-padding: 8px;
//** Padding for cells in `.table-condensed`.
@table-condensed-cell-padding: 5px;
//** Default background color used for all tables.
@table-bg: transparent;
//** Background color used for `.table-striped`.
@table-bg-accent: lighten(@gray-dark, 5%);
//** Background color used for `.table-hover`.
@table-bg-hover: @gray;
@table-bg-active: @table-bg-hover;
//** Border color for table and cell borders.
@table-border-color: @gray;
//== Buttons
//
//## For each of Bootstrap's buttons, define text, background and border color.
@btn-font-weight: normal;
@btn-default-color: @text-color;
@btn-default-bg: @gray;
@btn-default-border: @btn-default-bg;
@btn-primary-color: #fff;
@btn-primary-bg: @brand-primary;
@btn-primary-border: @btn-primary-bg;
@btn-success-color: @btn-primary-color;
@btn-success-bg: @brand-success;
@btn-success-border: @btn-success-bg;
@btn-info-color: @btn-success-color;
@btn-info-bg: @brand-info;
@btn-info-border: @btn-info-bg;
@btn-warning-color: @btn-success-color;
@btn-warning-bg: @brand-warning;
@btn-warning-border: @btn-warning-bg;
@btn-danger-color: @btn-success-color;
@btn-danger-bg: @brand-danger;
@btn-danger-border: @btn-danger-bg;
@btn-link-disabled-color: @gray-light;
// Allows for customizing button radius independently from global border radius
@btn-border-radius-base: @border-radius-base;
@btn-border-radius-large: @border-radius-large;
@btn-border-radius-small: @border-radius-small;
//== Forms
//
//##
//** `<input>` background color
@input-bg: #fff;
//** `<input disabled>` background color
@input-bg-disabled: @gray-lighter;
//** Text color for `<input>`s
@input-color: @gray;
//** `<input>` border color
@input-border: #f1f1f1;
// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
//** Default `.form-control` border radius
// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.
@input-border-radius: @border-radius-base;
//** Large `.form-control` border radius
@input-border-radius-large: @border-radius-large;
//** Small `.form-control` border radius
@input-border-radius-small: @border-radius-small;
//** Border color for inputs on focus
@input-border-focus: #fff;
//** Placeholder text color
@input-color-placeholder: @gray-light;
//** Default `.form-control` height
@input-height-base: (@line-height-computed + (@padding-base-vertical * 2) + 4);
//** Large `.form-control` height
@input-height-large: (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 4);
//** Small `.form-control` height
@input-height-small: (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 4);
//** `.form-group` margin
@form-group-margin-bottom: 15px;
@legend-color: @text-color;
@legend-border-color: transparent;
//** Background color for textual input addons
@input-group-addon-bg: @gray;
//** Border color for textual input addons
@input-group-addon-border-color: transparent;
//** Disabled cursor for form controls and buttons.
@cursor-disabled: not-allowed;
//== Dropdowns
//
//## Dropdown menu container and contents.
//** Background for the dropdown menu.
@dropdown-bg: @gray-dark;
//** Dropdown menu `border-color`.
@dropdown-border: rgba(0,0,0,.15);
//** Dropdown menu `border-color` **for IE8**.
@dropdown-fallback-border: #ccc;
//** Divider color for between dropdown items.
@dropdown-divider-bg: @gray;
//** Dropdown link text color.
@dropdown-link-color: @gray-lighter;
//** Hover color for dropdown links.
@dropdown-link-hover-color: #fff;
//** Hover background for dropdown links.
@dropdown-link-hover-bg: @component-active-bg;
//** Active dropdown menu item text color.
@dropdown-link-active-color: #fff;
//** Active dropdown menu item background color.
@dropdown-link-active-bg: @component-active-bg;
//** Disabled dropdown menu item background color.
@dropdown-link-disabled-color: @gray-light;
//** Text color for headers within dropdown menus.
@dropdown-header-color: @gray-light;
//** Deprecated `@dropdown-caret-color` as of v3.1.0
@dropdown-caret-color: #000;
//-- Z-index master list
//
// Warning: Avoid customizing these values. They're used for a bird's eye view
// of components dependent on the z-axis and are designed to all work together.
//
// Note: These variables are not generated into the Customizer.
@zindex-navbar: 1000;
@zindex-dropdown: 1000;
@zindex-popover: 1060;
@zindex-tooltip: 1070;
@zindex-navbar-fixed: 1030;
@zindex-modal-background: 1040;
@zindex-modal: 1050;
//== Media queries breakpoints
//
//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
// Extra small screen / phone
//** Deprecated `@screen-xs` as of v3.0.1
@screen-xs: 480px;
//** Deprecated `@screen-xs-min` as of v3.2.0
@screen-xs-min: @screen-xs;
//** Deprecated `@screen-phone` as of v3.0.1
@screen-phone: @screen-xs-min;
// Small screen / tablet
//** Deprecated `@screen-sm` as of v3.0.1
@screen-sm: 768px;
@screen-sm-min: @screen-sm;
//** Deprecated `@screen-tablet` as of v3.0.1
@screen-tablet: @screen-sm-min;
// Medium screen / desktop
//** Deprecated `@screen-md` as of v3.0.1
@screen-md: 992px;
@screen-md-min: @screen-md;
//** Deprecated `@screen-desktop` as of v3.0.1
@screen-desktop: @screen-md-min;
// Large screen / wide desktop
//** Deprecated `@screen-lg` as of v3.0.1
@screen-lg: 1200px;
@screen-lg-min: @screen-lg;
//** Deprecated `@screen-lg-desktop` as of v3.0.1
@screen-lg-desktop: @screen-lg-min;
// So media queries don't overlap when required, provide a maximum
@screen-xs-max: (@screen-sm-min - 1);
@screen-sm-max: (@screen-md-min - 1);
@screen-md-max: (@screen-lg-min - 1);
//== Grid system
//
//## Define your custom responsive grid.
//** Number of columns in the grid.
@grid-columns: 12;
//** Padding between columns. Gets divided in half for the left and right.
@grid-gutter-width: 30px;
// Navbar collapse
//** Point at which the navbar becomes uncollapsed.
@grid-float-breakpoint: @screen-sm-min;
//** Point at which the navbar begins collapsing.
@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
//== Container sizes
//
//## Define the maximum width of `.container` for different screen sizes.
// Small screen / tablet
@container-tablet: (720px + @grid-gutter-width);
//** For `@screen-sm-min` and up.
@container-sm: @container-tablet;
// Medium screen / desktop
@container-desktop: (940px + @grid-gutter-width);
//** For `@screen-md-min` and up.
@container-md: @container-desktop;
// Large screen / wide desktop
@container-large-desktop: (1140px + @grid-gutter-width);
//** For `@screen-lg-min` and up.
@container-lg: @container-large-desktop;
//== Navbar
//
//##
// Basics of a navbar
@navbar-height: 60px;
@navbar-margin-bottom: @line-height-computed;
@navbar-border-radius: @border-radius-base;
@navbar-padding-horizontal: floor((@grid-gutter-width / 2));
@navbar-padding-vertical: ((@navbar-height - @line-height-computed) / 2);
@navbar-collapse-max-height: 340px;
@navbar-default-color: #fff;
@navbar-default-bg: @brand-primary;
@navbar-default-border: transparent;
// Navbar links
@navbar-default-link-color: #fff;
@navbar-default-link-hover-color: @brand-success;
@navbar-default-link-hover-bg: transparent;
@navbar-default-link-active-color: #fff;
@navbar-default-link-active-bg: darken(@navbar-default-bg, 10%);
@navbar-default-link-disabled-color: #ccc;
@navbar-default-link-disabled-bg: transparent;
// Navbar brand label
@navbar-default-brand-color: @navbar-default-link-color;
@navbar-default-brand-hover-color: @navbar-default-link-hover-color;
@navbar-default-brand-hover-bg: transparent;
// Navbar toggle
@navbar-default-toggle-hover-bg: darken(@navbar-default-bg, 10%);
@navbar-default-toggle-icon-bar-bg: #fff;
@navbar-default-toggle-border-color: darken(@navbar-default-bg, 10%);
//=== Inverted navbar
// Reset inverted navbar basics
@navbar-inverse-color: #fff;
@navbar-inverse-bg: @brand-success;
@navbar-inverse-border: transparent;
// Inverted navbar links
@navbar-inverse-link-color: @navbar-inverse-color;
@navbar-inverse-link-hover-color: @brand-primary;
@navbar-inverse-link-hover-bg: transparent;
@navbar-inverse-link-active-color: @navbar-inverse-color;
@navbar-inverse-link-active-bg: darken(@navbar-inverse-bg, 5%);
@navbar-inverse-link-disabled-color: #aaa;
@navbar-inverse-link-disabled-bg: transparent;
// Inverted navbar brand label
@navbar-inverse-brand-color: @navbar-inverse-link-color;
@navbar-inverse-brand-hover-color: @navbar-inverse-link-hover-color;
@navbar-inverse-brand-hover-bg: transparent;
// Inverted navbar toggle
@navbar-inverse-toggle-hover-bg: darken(@navbar-inverse-bg, 10%);
@navbar-inverse-toggle-icon-bar-bg: #fff;
@navbar-inverse-toggle-border-color: darken(@navbar-inverse-bg, 10%);
//== Navs
//
//##
//=== Shared nav styles
@nav-link-padding: 10px 15px;
@nav-link-hover-bg: @gray-dark;
@nav-disabled-link-color: lighten(@gray, 10%);
@nav-disabled-link-hover-color: lighten(@gray, 10%);
//== Tabs
@nav-tabs-border-color: @gray;
@nav-tabs-link-hover-border-color: @gray;
@nav-tabs-active-link-hover-bg: @body-bg;
@nav-tabs-active-link-hover-color: @brand-success;
@nav-tabs-active-link-hover-border-color: @nav-tabs-link-hover-border-color;
@nav-tabs-justified-link-border-color: @gray-lighter;
@nav-tabs-justified-active-link-border-color: @body-bg;
//== Pills
@nav-pills-border-radius: @border-radius-base;
@nav-pills-active-link-hover-bg: @component-active-bg;
@nav-pills-active-link-hover-color: @component-active-color;
//== Pagination
//
//##
@pagination-color: #fff;
@pagination-bg: @brand-success;
@pagination-border: transparent;
@pagination-hover-color: #fff;
@pagination-hover-bg: lighten(@brand-success, 6%);
@pagination-hover-border: transparent;
@pagination-active-color: #fff;
@pagination-active-bg: lighten(@brand-success, 6%);
@pagination-active-border: transparent;
@pagination-disabled-color: #fff;
@pagination-disabled-bg: darken(@brand-success, 15%);
@pagination-disabled-border: transparent;
//== Pager
//
//##
@pager-bg: @pagination-bg;
@pager-border: @pagination-border;
@pager-border-radius: 15px;
@pager-hover-bg: @pagination-hover-bg;
@pager-active-bg: @pagination-active-bg;
@pager-active-color: @pagination-active-color;
@pager-disabled-color: #ddd;
//== Jumbotron
//
//##
@jumbotron-padding: 30px;
@jumbotron-color: inherit;
@jumbotron-bg: @gray-dark;
@jumbotron-heading-color: inherit;
@jumbotron-font-size: ceil((@font-size-base * 1.5));
@jumbotron-heading-font-size: ceil((@font-size-base * 4.5));
//== Form states and alerts
//
//## Define colors for form feedback states and, by default, alerts.
@state-success-text: #fff;
@state-success-bg: @brand-success;
@state-success-border: @brand-success;
@state-info-text: #fff;
@state-info-bg: @brand-info;
@state-info-border: @brand-info;
@state-warning-text: #fff;
@state-warning-bg: @brand-warning;
@state-warning-border: @brand-warning;
@state-danger-text: #fff;
@state-danger-bg: @brand-danger;
@state-danger-border: @brand-danger;
//== Tooltips
//
//##
//** Tooltip max width
@tooltip-max-width: 200px;
//** Tooltip text color
@tooltip-color: #fff;
//** Tooltip background color
@tooltip-bg: #000;
@tooltip-opacity: .9;
//** Tooltip arrow width
@tooltip-arrow-width: 5px;
//** Tooltip arrow color
@tooltip-arrow-color: @tooltip-bg;
//== Popovers
//
//##
//** Popover body background color
@popover-bg: @gray-dark;
//** Popover maximum width
@popover-max-width: 276px;
//** Popover border color
@popover-border-color: rgba(0,0,0,.2);
//** Popover fallback border color
@popover-fallback-border-color: #999;
//** Popover title background color
@popover-title-bg: darken(@popover-bg, 3%);
//** Popover arrow width
@popover-arrow-width: 10px;
//** Popover arrow color
@popover-arrow-color: @popover-bg;
//** Popover outer arrow width
@popover-arrow-outer-width: (@popover-arrow-width + 1);
//** Popover outer arrow color
@popover-arrow-outer-color: fadein(@popover-border-color, 5%);
//** Popover outer arrow fallback color
@popover-arrow-outer-fallback-color: darken(@popover-fallback-border-color, 20%);
//== Labels
//
//##
//** Default label background color
@label-default-bg: @gray;
//** Primary label background color
@label-primary-bg: @brand-primary;
//** Success label background color
@label-success-bg: @brand-success;
//** Info label background color
@label-info-bg: @brand-info;
//** Warning label background color
@label-warning-bg: @brand-warning;
//** Danger label background color
@label-danger-bg: @brand-danger;
//** Default label text color
@label-color: #fff;
//** Default text color of a linked label
@label-link-hover-color: #fff;
//== Modals
//
//##
//** Padding applied to the modal body
@modal-inner-padding: 20px;
//** Padding applied to the modal title
@modal-title-padding: 15px;
//** Modal title line-height
@modal-title-line-height: @line-height-base;
//** Background color of modal content area
@modal-content-bg: @gray-dark;
//** Modal content border color
@modal-content-border-color: rgba(0,0,0,.2);
//** Modal content border color **for IE8**
@modal-content-fallback-border-color: #999;
//** Modal backdrop background color
@modal-backdrop-bg: #000;
//** Modal backdrop opacity
@modal-backdrop-opacity: .7;
//** Modal header border color
@modal-header-border-color: @gray;
//** Modal footer border color
@modal-footer-border-color: @modal-header-border-color;
@modal-lg: 900px;
@modal-md: 600px;
@modal-sm: 300px;
//== Alerts
//
//## Define alert colors, border radius, and padding.
@alert-padding: 15px;
@alert-border-radius: @border-radius-base;
@alert-link-font-weight: bold;
@alert-success-bg: @state-success-bg;
@alert-success-text: @state-success-text;
@alert-success-border: @state-success-border;
@alert-info-bg: @state-info-bg;
@alert-info-text: @state-info-text;
@alert-info-border: @state-info-border;
@alert-warning-bg: @state-warning-bg;
@alert-warning-text: @state-warning-text;
@alert-warning-border: @state-warning-border;
@alert-danger-bg: @state-danger-bg;
@alert-danger-text: @state-danger-text;
@alert-danger-border: @state-danger-border;
//== Progress bars
//
//##
//** Background color of the whole progress component
@progress-bg: @gray-lighter;
//** Progress bar text color
@progress-bar-color: #fff;
//** Variable for setting rounded corners on progress bar.
@progress-border-radius: @border-radius-base;
//** Default progress bar color
@progress-bar-bg: @brand-primary;
//** Success progress bar color
@progress-bar-success-bg: @brand-success;
//** Warning progress bar color
@progress-bar-warning-bg: @brand-warning;
//** Danger progress bar color
@progress-bar-danger-bg: @brand-danger;
//** Info progress bar color
@progress-bar-info-bg: @brand-info;
//== List group
//
//##
//** Background color on `.list-group-item`
@list-group-bg: @gray-dark;
//** `.list-group-item` border color
@list-group-border: @gray;
//** List group border radius
@list-group-border-radius: @border-radius-base;
//** Background color of single list items on hover
@list-group-hover-bg: transparent;
//** Text color of active list items
@list-group-active-color: @component-active-color;
//** Background color of active list items
@list-group-active-bg: @component-active-bg;
//** Border color of active list elements
@list-group-active-border: @list-group-active-bg;
//** Text color for content within active list items
@list-group-active-text-color: lighten(@list-group-active-bg, 40%);
//** Text color of disabled list items
@list-group-disabled-color: @gray-light;
//** Background color of disabled list items
@list-group-disabled-bg: @gray-lighter;
//** Text color for content within disabled list items
@list-group-disabled-text-color: @list-group-disabled-color;
@list-group-link-color: @link-color;
@list-group-link-hover-color: @list-group-link-color;
@list-group-link-heading-color: darken(@link-color, 5%);
//== Panels
//
//##
@panel-bg: @gray-dark;
@panel-body-padding: 15px;
@panel-heading-padding: 10px 15px;
@panel-footer-padding: @panel-heading-padding;
@panel-border-radius: @border-radius-base;
//** Border color for elements within panels
@panel-inner-border: @gray;
@panel-footer-bg: @gray;
@panel-default-text: @text-color;
@panel-default-border: @gray;
@panel-default-heading-bg: @gray-dark;
@panel-primary-text: #fff;
@panel-primary-border: @brand-primary;
@panel-primary-heading-bg: @brand-primary;
@panel-success-text: @state-success-text;
@panel-success-border: @state-success-border;
@panel-success-heading-bg: @state-success-bg;
@panel-info-text: @state-info-text;
@panel-info-border: @state-info-border;
@panel-info-heading-bg: @state-info-bg;
@panel-warning-text: @state-warning-text;
@panel-warning-border: @state-warning-border;
@panel-warning-heading-bg: @state-warning-bg;
@panel-danger-text: @state-danger-text;
@panel-danger-border: @state-danger-border;
@panel-danger-heading-bg: @state-danger-bg;
//== Thumbnails
//
//##
//** Padding around the thumbnail image
@thumbnail-padding: 2px;
//** Thumbnail background color
@thumbnail-bg: @body-bg;
//** Thumbnail border color
@thumbnail-border: @gray;
//** Thumbnail border radius
@thumbnail-border-radius: @border-radius-base;
//** Custom text color for thumbnail captions
@thumbnail-caption-color: @text-color;
//** Padding around the thumbnail caption
@thumbnail-caption-padding: 9px;
//== Wells
//
//##
@well-bg: @gray-dark;
@well-border: transparent;
//== Badges
//
//##
@badge-color: #fff;
//** Linked badge text color on hover
@badge-link-hover-color: #fff;
@badge-bg: @gray;
//** Badge text color in active nav link
@badge-active-color: @brand-primary;
//** Badge background color in active nav link
@badge-active-bg: #fff;
@badge-font-weight: bold;
@badge-line-height: 1;
@badge-border-radius: 10px;
//== Breadcrumbs
//
//##
@breadcrumb-padding-vertical: 8px;
@breadcrumb-padding-horizontal: 15px;
//** Breadcrumb background color
@breadcrumb-bg: @gray;
//** Breadcrumb text color
@breadcrumb-color: @text-color;
//** Text color of current page in the breadcrumb
@breadcrumb-active-color: @gray-light;
//** Textual separator for between breadcrumb elements
@breadcrumb-separator: "/";
//== Carousel
//
//##
@carousel-text-shadow: 0 1px 2px rgba(0,0,0,.6);
@carousel-control-color: #fff;
@carousel-control-width: 15%;
@carousel-control-opacity: .5;
@carousel-control-font-size: 20px;
@carousel-indicator-active-bg: #fff;
@carousel-indicator-border-color: #fff;
@carousel-caption-color: #fff;
//== Close
//
//##
@close-font-weight: bold;
@close-color: #fff;
@close-text-shadow: none;
//== Code
//
//##
@code-color: #c7254e;
@code-bg: #f9f2f4;
@kbd-color: #fff;
@kbd-bg: #333;
@pre-bg: @gray-lighter;
@pre-color: @gray-dark;
@pre-border-color: #ccc;
@pre-scrollable-max-height: 340px;
//== Type
//
//##
//** Horizontal offset for forms and lists.
@component-offset-horizontal: 180px;
//** Text muted color
@text-muted: @gray-light;
//** Abbreviations and acronyms border color
@abbr-border-color: @gray-light;
//** Headings small color
@headings-small-color: @gray-light;
//** Blockquote small color
@blockquote-small-color: @gray-light;
//** Blockquote font size
@blockquote-font-size: (@font-size-base * 1.25);
//** Blockquote border color
@blockquote-border-color: @gray;
//** Page header border color
@page-header-border-color: transparent;
//** Width of horizontal description list titles
@dl-horizontal-offset: @component-offset-horizontal;
//** Point at which .dl-horizontal becomes horizontal
@dl-horizontal-breakpoint: @grid-float-breakpoint;
//** Horizontal line color.
@hr-border: @gray;
|
{
"pile_set_name": "Github"
}
|
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --opt
for (let i = 0; i < 5000; i++) {
try {
[].reduce(function() {});
} catch (x) {
}
}
|
{
"pile_set_name": "Github"
}
|
--force-restart
--max_connections=10
--innodb_thread_concurrency=0
--innodb_file_per_table
--innodb-rollback-segments=1
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2008, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
*
* Author: Alexander Duyck <[email protected]>
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/skbuff.h>
#include <net/netlink.h>
#include <net/pkt_sched.h>
struct multiq_sched_data {
u16 bands;
u16 max_bands;
u16 curband;
struct tcf_proto *filter_list;
struct Qdisc **queues;
};
static struct Qdisc *
multiq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
{
struct multiq_sched_data *q = qdisc_priv(sch);
u32 band;
struct tcf_result res;
int err;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
err = tc_classify(skb, q->filter_list, &res);
#ifdef CONFIG_NET_CLS_ACT
switch (err) {
case TC_ACT_STOLEN:
case TC_ACT_QUEUED:
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return NULL;
}
#endif
band = skb_get_queue_mapping(skb);
if (band >= q->bands)
return q->queues[0];
return q->queues[band];
}
static int
multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
struct Qdisc *qdisc;
int ret;
qdisc = multiq_classify(skb, sch, &ret);
#ifdef CONFIG_NET_CLS_ACT
if (qdisc == NULL) {
if (ret & __NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
}
#endif
ret = qdisc_enqueue(skb, qdisc);
if (ret == NET_XMIT_SUCCESS) {
sch->q.qlen++;
return NET_XMIT_SUCCESS;
}
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return ret;
}
static struct sk_buff *multiq_dequeue(struct Qdisc *sch)
{
struct multiq_sched_data *q = qdisc_priv(sch);
struct Qdisc *qdisc;
struct sk_buff *skb;
int band;
for (band = 0; band < q->bands; band++) {
/* cycle through bands to ensure fairness */
q->curband++;
if (q->curband >= q->bands)
q->curband = 0;
/* Check that target subqueue is available before
* pulling an skb to avoid head-of-line blocking.
*/
if (!netif_xmit_stopped(
netdev_get_tx_queue(qdisc_dev(sch), q->curband))) {
qdisc = q->queues[q->curband];
skb = qdisc->dequeue(qdisc);
if (skb) {
qdisc_bstats_update(sch, skb);
sch->q.qlen--;
return skb;
}
}
}
return NULL;
}
static struct sk_buff *multiq_peek(struct Qdisc *sch)
{
struct multiq_sched_data *q = qdisc_priv(sch);
unsigned int curband = q->curband;
struct Qdisc *qdisc;
struct sk_buff *skb;
int band;
for (band = 0; band < q->bands; band++) {
/* cycle through bands to ensure fairness */
curband++;
if (curband >= q->bands)
curband = 0;
/* Check that target subqueue is available before
* pulling an skb to avoid head-of-line blocking.
*/
if (!netif_xmit_stopped(
netdev_get_tx_queue(qdisc_dev(sch), curband))) {
qdisc = q->queues[curband];
skb = qdisc->ops->peek(qdisc);
if (skb)
return skb;
}
}
return NULL;
}
static unsigned int multiq_drop(struct Qdisc *sch)
{
struct multiq_sched_data *q = qdisc_priv(sch);
int band;
unsigned int len;
struct Qdisc *qdisc;
for (band = q->bands - 1; band >= 0; band--) {
qdisc = q->queues[band];
if (qdisc->ops->drop) {
len = qdisc->ops->drop(qdisc);
if (len != 0) {
sch->q.qlen--;
return len;
}
}
}
return 0;
}
static void
multiq_reset(struct Qdisc *sch)
{
u16 band;
struct multiq_sched_data *q = qdisc_priv(sch);
for (band = 0; band < q->bands; band++)
qdisc_reset(q->queues[band]);
sch->q.qlen = 0;
q->curband = 0;
}
static void
multiq_destroy(struct Qdisc *sch)
{
int band;
struct multiq_sched_data *q = qdisc_priv(sch);
tcf_destroy_chain(&q->filter_list);
for (band = 0; band < q->bands; band++)
qdisc_destroy(q->queues[band]);
kfree(q->queues);
}
static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
{
struct multiq_sched_data *q = qdisc_priv(sch);
struct tc_multiq_qopt *qopt;
int i;
if (!netif_is_multiqueue(qdisc_dev(sch)))
return -EOPNOTSUPP;
if (nla_len(opt) < sizeof(*qopt))
return -EINVAL;
qopt = nla_data(opt);
qopt->bands = qdisc_dev(sch)->real_num_tx_queues;
sch_tree_lock(sch);
q->bands = qopt->bands;
for (i = q->bands; i < q->max_bands; i++) {
if (q->queues[i] != &noop_qdisc) {
struct Qdisc *child = q->queues[i];
q->queues[i] = &noop_qdisc;
qdisc_tree_decrease_qlen(child, child->q.qlen);
qdisc_destroy(child);
}
}
sch_tree_unlock(sch);
for (i = 0; i < q->bands; i++) {
if (q->queues[i] == &noop_qdisc) {
struct Qdisc *child, *old;
child = qdisc_create_dflt(sch->dev_queue,
&pfifo_qdisc_ops,
TC_H_MAKE(sch->handle,
i + 1));
if (child) {
sch_tree_lock(sch);
old = q->queues[i];
q->queues[i] = child;
if (old != &noop_qdisc) {
qdisc_tree_decrease_qlen(old,
old->q.qlen);
qdisc_destroy(old);
}
sch_tree_unlock(sch);
}
}
}
return 0;
}
static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
{
struct multiq_sched_data *q = qdisc_priv(sch);
int i, err;
q->queues = NULL;
if (opt == NULL)
return -EINVAL;
q->max_bands = qdisc_dev(sch)->num_tx_queues;
q->queues = kcalloc(q->max_bands, sizeof(struct Qdisc *), GFP_KERNEL);
if (!q->queues)
return -ENOBUFS;
for (i = 0; i < q->max_bands; i++)
q->queues[i] = &noop_qdisc;
err = multiq_tune(sch, opt);
if (err)
kfree(q->queues);
return err;
}
static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb)
{
struct multiq_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb_tail_pointer(skb);
struct tc_multiq_qopt opt;
opt.bands = q->bands;
opt.max_bands = q->max_bands;
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
return skb->len;
nla_put_failure:
nlmsg_trim(skb, b);
return -1;
}
static int multiq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct Qdisc **old)
{
struct multiq_sched_data *q = qdisc_priv(sch);
unsigned long band = arg - 1;
if (new == NULL)
new = &noop_qdisc;
sch_tree_lock(sch);
*old = q->queues[band];
q->queues[band] = new;
qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
qdisc_reset(*old);
sch_tree_unlock(sch);
return 0;
}
static struct Qdisc *
multiq_leaf(struct Qdisc *sch, unsigned long arg)
{
struct multiq_sched_data *q = qdisc_priv(sch);
unsigned long band = arg - 1;
return q->queues[band];
}
static unsigned long multiq_get(struct Qdisc *sch, u32 classid)
{
struct multiq_sched_data *q = qdisc_priv(sch);
unsigned long band = TC_H_MIN(classid);
if (band - 1 >= q->bands)
return 0;
return band;
}
static unsigned long multiq_bind(struct Qdisc *sch, unsigned long parent,
u32 classid)
{
return multiq_get(sch, classid);
}
static void multiq_put(struct Qdisc *q, unsigned long cl)
{
}
static int multiq_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm)
{
struct multiq_sched_data *q = qdisc_priv(sch);
tcm->tcm_handle |= TC_H_MIN(cl);
tcm->tcm_info = q->queues[cl - 1]->handle;
return 0;
}
static int multiq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
struct gnet_dump *d)
{
struct multiq_sched_data *q = qdisc_priv(sch);
struct Qdisc *cl_q;
cl_q = q->queues[cl - 1];
cl_q->qstats.qlen = cl_q->q.qlen;
if (gnet_stats_copy_basic(d, &cl_q->bstats) < 0 ||
gnet_stats_copy_queue(d, &cl_q->qstats) < 0)
return -1;
return 0;
}
static void multiq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
{
struct multiq_sched_data *q = qdisc_priv(sch);
int band;
if (arg->stop)
return;
for (band = 0; band < q->bands; band++) {
if (arg->count < arg->skip) {
arg->count++;
continue;
}
if (arg->fn(sch, band + 1, arg) < 0) {
arg->stop = 1;
break;
}
arg->count++;
}
}
static struct tcf_proto **multiq_find_tcf(struct Qdisc *sch, unsigned long cl)
{
struct multiq_sched_data *q = qdisc_priv(sch);
if (cl)
return NULL;
return &q->filter_list;
}
static const struct Qdisc_class_ops multiq_class_ops = {
.graft = multiq_graft,
.leaf = multiq_leaf,
.get = multiq_get,
.put = multiq_put,
.walk = multiq_walk,
.tcf_chain = multiq_find_tcf,
.bind_tcf = multiq_bind,
.unbind_tcf = multiq_put,
.dump = multiq_dump_class,
.dump_stats = multiq_dump_class_stats,
};
static struct Qdisc_ops multiq_qdisc_ops __read_mostly = {
.next = NULL,
.cl_ops = &multiq_class_ops,
.id = "multiq",
.priv_size = sizeof(struct multiq_sched_data),
.enqueue = multiq_enqueue,
.dequeue = multiq_dequeue,
.peek = multiq_peek,
.drop = multiq_drop,
.init = multiq_init,
.reset = multiq_reset,
.destroy = multiq_destroy,
.change = multiq_tune,
.dump = multiq_dump,
.owner = THIS_MODULE,
};
static int __init multiq_module_init(void)
{
return register_qdisc(&multiq_qdisc_ops);
}
static void __exit multiq_module_exit(void)
{
unregister_qdisc(&multiq_qdisc_ops);
}
module_init(multiq_module_init)
module_exit(multiq_module_exit)
MODULE_LICENSE("GPL");
|
{
"pile_set_name": "Github"
}
|
# Maintainer: ArchStrike <[email protected]>
buildarch=1
pkgname=ruby1.9-diff-lcs
pkgver=1.2.4
pkgrel=2
pkgdesc="Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm"
arch=('any')
license=('custom')
makedepends=('ruby1.9')
url='http://diff-lcs.rubyforge.org/'
source=("http://rubygems.org/downloads/diff-lcs-$pkgver.gem")
md5sums=('59d7816d12337dba78a728cbcd6a0207')
noextract=("diff-lcs-$pkgver.gem")
package() {
cd "$srcdir"
#local _gemdir=$(ruby-1.9 -e 'puts Gem.default_dir')
local _gemdir=$(ruby-1.9 -rubygems -e 'puts Gem.default_dir')
gem-1.9 install --ignore-dependencies --no-user-install -i "$pkgdir$_gemdir" -n "$pkgdir/usr/bin" diff-lcs-$pkgver.gem
install -d ${pkgdir}/usr/share/licenses/ruby1.9-diff-lcs
install -D -m644 ${pkgdir}/usr/share/ruby1.9/lib/ruby/gems/*/gems/diff-lcs-${pkgver}/License.rdoc ${pkgdir}/usr/share/licenses/ruby1.9-diff-lcs/LICENSE
install -D -m644 ${pkgdir}/usr/share/ruby1.9/lib/ruby/gems/*/gems/diff-lcs-${pkgver}/docs/artistic.txt ${pkgdir}/usr/share/licenses/ruby1.9-diff-lcs/artistic.txt
install -D -m644 ${pkgdir}/usr/share/ruby1.9/lib/ruby/gems/*/gems/diff-lcs-${pkgver}/docs/COPYING.txt ${pkgdir}/usr/share/licenses/ruby1.9-diff-lcs/COPYING.txt
}
|
{
"pile_set_name": "Github"
}
|
/*
*
* /\\\\\
* /\\\///\\\
* /\\\/ \///\\\ /\\\\\\\\\ /\\\ /\\\
* /\\\ \//\\\ /\\\/////\\\ /\\\\\\\\\\\ \/// /\\\\\ /\\\\\ /\\\ /\\\ /\\\\\\\\\\
* \/\\\ \/\\\ \/\\\\\\\\\\ \////\\\//// /\\\ /\\\///\\\\\///\\\ \/\\\ \/\\\ \/\\\//////
* \//\\\ /\\\ \/\\\////// \/\\\ \/\\\ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\ \/\\\\\\\\\\
* \///\\\ /\\\ \/\\\ \/\\\_/\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \////////\\\
* \///\\\\\/ \/\\\ \//\\\\\ \/\\\ \/\\\ \/\\\ \/\\\ \//\\\\\\\\\ /\\\\\\\\\\
* \///// \/// \///// \/// \/// \/// \/// \///////// \//////////
*
* The mathematical programming library for Scala.
*
*/
package optimus.optimization
import optimus.optimization.enums.SolverLib
final class OJProblemTests extends ProblemTests {
def solver: SolverLib = SolverLib.oJSolver
}
|
{
"pile_set_name": "Github"
}
|
import { ChangeDetectorRef, Component, Input, OnChanges, OnInit } from '@angular/core';
import * as _ from 'lodash';
import { JsonSchemaFormService } from '../../json-schema-form.service';
import { hasOwn, isArray, isDefined, toTitleCase } from '../../shared';
@Component({
selector: 'material-design-framework',
template: `
<div
[class.array-item]="widgetLayoutNode?.arrayItem && widgetLayoutNode?.type !== '$ref'"
[orderable]="isOrderable"
[dataIndex]="dataIndex"
[layoutIndex]="layoutIndex"
[layoutNode]="widgetLayoutNode">
<svg *ngIf="showRemoveButton"
xmlns="http://www.w3.org/2000/svg"
height="18" width="18" viewBox="0 0 24 24"
class="close-button"
(click)="removeItem()">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
</svg>
<select-widget-widget
[dataIndex]="dataIndex"
[layoutIndex]="layoutIndex"
[layoutNode]="widgetLayoutNode"></select-widget-widget>
</div>
<div class="spacer" *ngIf="widgetLayoutNode?.arrayItem && widgetLayoutNode?.type !== '$ref'"></div>`,
styles: [`
.array-item {
border-radius: 2px;
box-shadow: 0 3px 1px -2px rgba(0,0,0,.2),
0 2px 2px 0 rgba(0,0,0,.14),
0 1px 5px 0 rgba(0,0,0,.12);
padding: 6px;
position: relative;
transition: all 280ms cubic-bezier(.4, 0, .2, 1);
}
.close-button {
cursor: pointer;
position: absolute;
top: 6px;
right: 6px;
fill: rgba(0,0,0,.4);
visibility: hidden;
z-index: 500;
}
.close-button:hover { fill: rgba(0,0,0,.8); }
.array-item:hover > .close-button { visibility: visible; }
.spacer { margin: 6px 0; }
[draggable=true]:hover {
box-shadow: 0 5px 5px -3px rgba(0,0,0,.2),
0 8px 10px 1px rgba(0,0,0,.14),
0 3px 14px 2px rgba(0,0,0,.12);
cursor: move;
z-index: 10;
}
[draggable=true].drag-target-top {
box-shadow: 0 -2px 0 #000;
position: relative; z-index: 20;
}
[draggable=true].drag-target-bottom {
box-shadow: 0 2px 0 #000;
position: relative; z-index: 20;
}
`],
})
export class MaterialDesignFrameworkComponent implements OnInit, OnChanges {
frameworkInitialized = false;
inputType: string;
options: any; // Options used in this framework
widgetLayoutNode: any; // layoutNode passed to child widget
widgetOptions: any; // Options passed to child widget
formControl: any = null;
parentArray: any = null;
isOrderable = false;
dynamicTitle: string = null;
@Input() layoutNode: any;
@Input() layoutIndex: number[];
@Input() dataIndex: number[];
constructor(
private changeDetector: ChangeDetectorRef,
private jsf: JsonSchemaFormService
) { }
get showRemoveButton(): boolean {
if (!this.layoutNode || !this.widgetOptions.removable ||
this.widgetOptions.readonly || this.layoutNode.type === '$ref'
) { return false; }
if (this.layoutNode.recursiveReference) { return true; }
if (!this.layoutNode.arrayItem || !this.parentArray) { return false; }
// If array length <= minItems, don't allow removing any items
return this.parentArray.items.length - 1 <= this.parentArray.options.minItems ? false :
// For removable list items, allow removing any item
this.layoutNode.arrayItemType === 'list' ? true :
// For removable tuple items, only allow removing last item in list
this.layoutIndex[this.layoutIndex.length - 1] === this.parentArray.items.length - 2;
}
ngOnInit() {
this.initializeFramework();
}
ngOnChanges() {
if (!this.frameworkInitialized) { this.initializeFramework(); }
if (this.dynamicTitle) { this.updateTitle(); }
}
initializeFramework() {
if (this.layoutNode) {
this.options = _.cloneDeep(this.layoutNode.options || {});
this.widgetLayoutNode = {
...this.layoutNode,
options: _.cloneDeep(this.layoutNode.options || {})
};
this.widgetOptions = this.widgetLayoutNode.options;
this.formControl = this.jsf.getFormControl(this);
if (
isDefined(this.widgetOptions.minimum) &&
isDefined(this.widgetOptions.maximum) &&
this.widgetOptions.multipleOf >= 1
) {
this.layoutNode.type = 'range';
}
if (
!['$ref', 'advancedfieldset', 'authfieldset', 'button', 'card',
'checkbox', 'expansion-panel', 'help', 'message', 'msg', 'section',
'submit', 'tabarray', 'tabs'].includes(this.layoutNode.type) &&
/{{.+?}}/.test(this.widgetOptions.title || '')
) {
this.dynamicTitle = this.widgetOptions.title;
this.updateTitle();
}
if (this.layoutNode.arrayItem && this.layoutNode.type !== '$ref') {
this.parentArray = this.jsf.getParentNode(this);
if (this.parentArray) {
this.isOrderable =
this.parentArray.type.slice(0, 3) !== 'tab' &&
this.layoutNode.arrayItemType === 'list' &&
!this.widgetOptions.readonly &&
this.parentArray.options.orderable;
}
}
this.frameworkInitialized = true;
} else {
this.options = {};
}
}
updateTitle() {
this.widgetLayoutNode.options.title = this.jsf.parseText(
this.dynamicTitle,
this.jsf.getFormControlValue(this),
this.jsf.getFormControlGroup(this).value,
this.dataIndex[this.dataIndex.length - 1]
);
}
removeItem() {
this.jsf.removeItem(this);
}
}
|
{
"pile_set_name": "Github"
}
|
event_timer = 0
eventvar1 = 0
eventvar2 = 0
eventvar3 = 0
eventvar4 = 0
eventvar5 = 0
sectimer = 0
local currentframe
function event_start(etype, arg1)
autotimer = 0
autoskip = 0
event_enabled = true
event_type = etype
if event_type == 's_kill_start' then
textbox_enabled = true
bgimg_disabled = true
elseif string.sub(event_type,1,6) == 's_kill' then
bgimg_disabled = true
textbox_enabled = false
if event_type == 's_kill' then
eventvar1 = 0
eventvar2 = 0
end
elseif event_type == 'wipe' then
eventvar1 = 0
hideAll()
textbox_enabled = false
if arg1 then
eventvar2 = arg1
else
eventvar2 = nil
end
elseif event_type == 'black' then
textbox_enabled = true
bgimg_disabled = true
elseif event_type == 'endscreen' then
hideAll()
textbox_enabled = false
audioUpdate('0')
elseif event_type == 's_glitch' or event_type == 'm_glitch1' or event_type == 'n_glitch1' then
bgimg_disabled = false
textbox_enabled = false
elseif event_type == 'ny_argument' then
eventvar1 = 0
eventvar2 = 0
eventvar3 = {2.0,3.6,5.2,6.8,8.3,9.90,11.5,13.1,14.7,16.3,17.90,19.45,21.1,22.7,24.2,25.8}
eventvar4 = {2.5,4.1,5.7,7.3,8.8,10.3,12.0,13.5,15.1,16.7,18.25,19.85,21.5,23.0,24.6,26.2}
eventvar5 = 1
bgimg_disabled = false
textbox_enabled = true
elseif event_type == 'yuri_eyes' then
bgimg_disabled = false
textbox_enabled = false
eventvar1 = 2
eventvar2 = -13
eventvar3 = 0
elseif event_type == 'faint_effect' then
eventvar1 = 192
bgimg_disabled = false
textbox_enabled = true
elseif event_type == 'yuri_glitch_head' then
eventvar1 = arg1
bgimg_disabled = false
textbox_enabled = true
elseif event_type == 'show_darkred' then
eventvar2 = 1
bgimg_disabled = false
textbox_enabled = true
elseif event_type == 'yuri_ch23_2' or event_type == 'natsuki_ch22' then
eventvar1 = 0
eventvar2 = 0
eventvar3 = 0
bgimg_disabled = false
textbox_enabled = true
elseif event_type == 'yuri_ch23' or event_type == 'm_ch23ex' or event_type == 'just_monika' then
bgimg_disabled = true
textbox_enabled = false
if event_type == 'just_monika' then
alpha = 0
if arg1 == 'ch30' then eventvar1 = 'ch30' end
end
elseif event_type == 'yuri_kill' then
eventvar1 = stab1
eventvar2 = 0
eventvar3 = 0.025
bgimg_disabled = true
textbox_enabled = false
elseif event_type == 'monika_end' then
eventvar1 = 200
eventvar2 = math.random(1,8)*50
eventvar3 = math.random(1,8)*50
eventvar5 = 0
bgimg_disabled = false
textbox_enabled = false
if arg1 == 2 then
event_timer = 0.69
eventvar4 = 'end2'
end
elseif event_type == 'beforecredits' or event_type == 'sayori_gs' then
if event_type == 'beforecredits' then
audioUpdate('end-voice')
end
eventvar1 = 0
eventvar2 = nil
eventvar3 = 0
bgimg_disabled = true
textbox_enabled = false
else
bgimg_disabled = false
textbox_enabled = true
end
if arg1 == 'show_noise' then
eventvar4 = 'show_noise'
elseif arg1 == 'show_vignette' then
eventvar4 = 'show_vignette'
elseif arg1 == 'show_darkred' then
eventvar4 = 'show_darkred'
elseif arg1 == '' then
eventvar4 = ''
end
end
function drawanimframe(x,y,s)
if not x then x = 0 end
if not y then y = 0 end
if not s then s = 1 end
if animframe[currentframe] then
lg.draw(animframe[currentframe],x,y,0,s,s)
end
if sectimer > 0.75 and animframe[4] then
currentframe = 4
elseif sectimer > 0.5 and animframe[3] then
currentframe = 3
elseif sectimer > 0.25 and animframe[2] then
currentframe = 2
elseif animframe[1] then
currentframe = 1
end
end
function event_next()
print_full_text = true
newgame_keypressed('a')
event_timer = 0
end
function event_keypressed(key)
if ((textbox_enabled and event_type ~= 'show_vignette') or (event_type == 'yuri_eyes' and cl < 700)) and (key == 'a' or key == 'leftshoulder') then
newgame_keypressed('a')
elseif key == 'y' and event_type == 'ch23-30' then
menu_mchance = math.random(1,50)
menu_enable('pause')
elseif (key == 'start' or key == 'return') and event_type == 'ch23-30' and chapter == 30 then --auto
sfx1:play()
if autotimer == 0 then autotimer = 0.01 else autotimer = 0 end
elseif (key == 'back' or key == '-') and event_type == 'ch23-30' then
if settings.o ~= 1 then settings.o = 1
else settings.o = 0 end
end
end
function event_draw()
lgsetColor(255,255,255)
if persistent.ptr <= 1 then
if event_draw_1 then event_draw_1() end
elseif persistent.ptr == 2 then
if event_draw_2 then event_draw_2() end
else
if event_draw_3 then event_draw_3() end
end
if event_type == 'wipe' then
lgsetColor(255,255,255,alpha)
lg.draw(bgch)
lgsetColor(0,0,0,eventvar1)
lg.rectangle('fill',0,0,1280,725)
end
if event_type == 'endscreen' then
lgsetColor(255,255,255,eventvar1)
lg.draw(bgch)
end
if event_type == 'show_dark' then
if bg1 ~= 'cg/monika_bg_glitch' then lg.draw(bgch) end
drawYuri()
if chapter == 40 then
lgsetColor(0,0,0,128)
else
lgsetColor(0,0,0,192)
end
lg.rectangle('fill',0,0,1280,725)
lgsetColor(255,255,255,255)
if bg1 == 'cg/monika_bg_glitch' then lg.draw(bgch) end
if cl < 271 then drawSayori() end
if not menu_enabled and cl >= 286 and cl <= 290 then
lgsetColor(255,255,255,128)
lg.rectangle('fill',0,0,1280,725)
end
end
if event_type == 'just_monika' then
lg.setBackgroundColor(255,255,255)
if event_timer < 3.75 then
lgsetColor(255,255,255,alpha)
lg.draw(splash)
lgsetColor(0,0,0,alpha)
lg.print('DDLC-LOVE '..dversion..' '..dvertype,15,675)
else
lgsetColor(0,0,0,alpha)
lg.print('Just Monika.', 544, 300)
end
end
if event_type == 'ch23-30' then
lg.draw(bgch)
lg.draw(cgch)
drawSayori()
drawYuri()
drawNatsuki()
drawMonika()
drawConsole()
if poem_enabled then drawPoem() end
if autotimer > 0 then
lg.draw(gui.skip,0,27)
lgsetColor(0,0,0)
outlineText(tr.auto,5,35)
end
end
lgsetColor(255,255,255,255)
lg.setFont(allerfont)
if textbox_enabled then
if dvertype == 'Test' then lg.print(cl,5,690) end
drawTextBox()
end
if event_type == 'm_onlayer_front' or event_type == 'ny_argument2' then
lgsetColor(255,255,255)
drawMonika()
textbox_enabled = true
elseif event_type == 'yuri_ch23_2' then
lgsetColor(255,255,255,eventvar2)
drawMonika()
elseif event_type == 'show_dark' and cl >= 271 and chapter == 40 then
lgsetColor(255,255,255,255)
drawSayori()
end
if menu_enabled then menu_draw() end
end
function event_update()
event_timer = event_timer + dt
if persistent.ptr <= 1 then
if event_update_1 then event_update_1() end
elseif persistent.ptr == 2 then
if event_update_2 then event_update_2() end
else
if event_update_3 then event_update_3() end
end
--wipe timers
if event_type == 'wipe' and event_timer > 1.5 then event_end('next')
elseif event_type == 'wipe' and event_timer >= 1 then
eventvar1 = math.max(eventvar1 - 15, 0)
elseif event_type == 'wipe' and event_timer > 0.5 then
if eventvar2 and bg1 ~= eventvar2 then
bgUpdate(eventvar2,true)
end
elseif event_type == 'wipe' and event_timer < 0.5 then
eventvar1 = math.min(eventvar1 + 15, 255)
end
--end screen
if event_type == 'endscreen' and event_timer > 3 then event_end('next')
elseif event_type == 'endscreen' and event_timer >= 2.5 then
eventvar1 = math.max(eventvar1 - 7, 0)
elseif event_type == 'endscreen' and event_timer <= 0.5 then
eventvar1 = math.min(eventvar1 + 7, 255)
end
if event_type == 'just_monika' then
if event_timer <= 3 then
alpha = math.min(alpha+7.75,255)
elseif event_timer > 3 and event_timer < 3.75 then
alpha = math.max(alpha-7.75,0)
elseif event_timer <= 6 then
if eventvar1 == 'ch30' then event_timer = 7 end
alpha = math.min(alpha+7.75,255)
elseif event_timer > 6 then
alpha = 255
event_end('next')
end
end
if event_type == 'ch23-30' then
if persistent.chr.m == 0 and cl < 1001 then
scriptJump(1050)
end
end
end
|
{
"pile_set_name": "Github"
}
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
|
{
"pile_set_name": "Github"
}
|
/*!
* Stylesheet for the Date Range Picker, for use with Bootstrap 3.x
*
* Copyright 2013 Dan Grossman ( http://www.dangrossman.info )
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Built for http://www.improvely.com
*/
.daterangepicker.dropdown-menu {
max-width: none;
z-index: 3000;
}
.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar {
float: left;
margin: 4px;
}
.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar,
.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar {
float: right;
margin: 4px;
}
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
float: none;
}
.daterangepicker .ranges {
width: 160px;
text-align: left;
}
.daterangepicker .ranges .range_inputs>div {
float: left;
}
.daterangepicker .ranges .range_inputs>div:nth-child(2) {
padding-left: 11px;
}
.daterangepicker .calendar {
display: none;
max-width: 270px;
}
.daterangepicker.show-calendar .calendar {
display: block;
}
.daterangepicker .calendar.single .calendar-date {
border: none;
}
.daterangepicker .calendar th, .daterangepicker .calendar td {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
white-space: nowrap;
text-align: center;
min-width: 32px;
}
.daterangepicker .daterangepicker_start_input label,
.daterangepicker .daterangepicker_end_input label {
color: #333;
display: block;
font-size: 11px;
font-weight: normal;
height: 20px;
line-height: 20px;
margin-bottom: 2px;
text-shadow: #fff 1px 1px 0px;
text-transform: uppercase;
width: 74px;
}
.daterangepicker .ranges input {
font-size: 11px;
}
.daterangepicker .ranges .input-mini {
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
display: block;
font-size: 11px;
height: 30px;
line-height: 30px;
vertical-align: middle;
margin: 0 0 10px 0;
padding: 0 6px;
width: 74px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0;
padding: 0;
}
.daterangepicker .ranges li {
font-size: 13px;
background: #f5f5f5;
border: 1px solid #f5f5f5;
color: #08c;
padding: 3px 12px;
margin-bottom: 8px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
cursor: pointer;
}
.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover {
background: #08c;
border: 1px solid #08c;
color: #fff;
}
.daterangepicker .calendar-date {
border: 1px solid #ddd;
padding: 4px;
border-radius: 4px;
background: #fff;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 8px auto 0 auto;
line-height: 30px;
}
.daterangepicker {
position: absolute;
background: #fff;
top: 100px;
left: 20px;
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.daterangepicker.opensleft:before {
position: absolute;
top: -7px;
right: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.opensleft:after {
position: absolute;
top: -6px;
right: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker.openscenter:before {
position: absolute;
top: -7px;
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.openscenter:after {
position: absolute;
top: -6px;
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker.opensright:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.opensright:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker table {
width: 100%;
margin: 0;
}
.daterangepicker td, .daterangepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
white-space: nowrap;
}
.daterangepicker td.off {
color: #999;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background: #eee;
}
.daterangepicker td.in-range {
background: #ebf4f8;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.daterangepicker td.start-date {
-webkit-border-radius: 4px 0 0 4px;
-moz-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
-webkit-border-radius: 0 4px 4px 0;
-moz-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: #3071a9;
color: #fff;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin-bottom: 0;
}
.daterangepicker_start_input {
float: left;
}
.daterangepicker_end_input {
float: left;
padding-left: 11px
}
.daterangepicker th.month {
width: auto;
}
|
{
"pile_set_name": "Github"
}
|
EXP_DIR: vgg16
TRAIN:
HAS_RPN: True
BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True
RPN_POSITIVE_OVERLAP: 0.7
RPN_BATCHSIZE: 256
PROPOSAL_METHOD: gt
BG_THRESH_LO: 0.0
BATCH_SIZE: 256
LEARNING_RATE: 0.01
TEST:
HAS_RPN: True
POOLING_MODE: align
CROP_RESIZE_WITH_MAX_POOL: False
|
{
"pile_set_name": "Github"
}
|
# Copyright 2019 The Texar 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.
"""
Modules of Texar library data inputs.
"""
from texar.torch.data.data.data_base import *
from texar.torch.data.data.data_iterators import *
from texar.torch.data.data.dataset_utils import *
from texar.torch.data.data.mono_text_data import *
from texar.torch.data.data.multi_aligned_data import *
from texar.torch.data.data.paired_text_data import *
from texar.torch.data.data.record_data import *
from texar.torch.data.data.sampler import *
from texar.torch.data.data.scalar_data import *
from texar.torch.data.data.text_data_base import *
|
{
"pile_set_name": "Github"
}
|
#!/bin/sh
XSERVERNAME=${XSERVER%% *}
WMNAME=${WM%% *}
if ! which $XSERVERNAME > /dev/null 2>&1 ; then
echo "Can't find $XSERVERNAME, skipping..." >&2
exit 1
fi
if [ ! -z "$WMNAME" -a "$WMNAME" != "none" ] \
&& ! which $WMNAME > /dev/null 2>&1 ; then
echo "Can't find $WMNAME, skipping..." >&2
exit 1
fi
|
{
"pile_set_name": "Github"
}
|
FATE_FILTER-$(call FILTERDEMDEC, DELOGO, RM, RV30) += fate-filter-delogo
fate-filter-delogo: CMD = framecrc -i $(TARGET_SAMPLES)/real/rv30.rm -vf delogo=show=0:x=290:y=25:w=26:h=16 -an
FATE_YADIF += fate-filter-yadif-mode0
fate-filter-yadif-mode0: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=0
FATE_YADIF += fate-filter-yadif-mode1
fate-filter-yadif-mode1: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=1
FATE_FILTER-$(call FILTERDEMDEC, YADIF, MPEGTS, MPEG2VIDEO) += $(FATE_YADIF)
FATE_SAMPLES_AVCONV += $(FATE_FILTER-yes)
FATE_FILTER_VSYNTH-$(CONFIG_BOXBLUR_FILTER) += fate-filter-boxblur
fate-filter-boxblur: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf boxblur=2:1
FATE_FILTER_VSYNTH-$(CONFIG_DRAWBOX_FILTER) += fate-filter-drawbox
fate-filter-drawbox: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf drawbox=10:20:200:60:[email protected]
FATE_FILTER_VSYNTH-$(CONFIG_FADE_FILTER) += fate-filter-fade
fate-filter-fade: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf fade=in:0:25,fade=out:25:25
FATE_FILTER_VSYNTH-$(call ALLYES, INTERLACE_FILTER FIELDORDER_FILTER) += fate-filter-fieldorder
fate-filter-fieldorder: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf interlace=tff,fieldorder=bff -sws_flags +accurate_rnd+bitexact
define FATE_FPFILTER_SUITE
FATE_FILTER_VSYNTH-$(CONFIG_FRAMEPACK_FILTER) += fate-filter-framepack-$(1)
fate-filter-framepack-$(1): CMD = framecrc -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -filter_complex framepack=$(1) -frames 15
endef
FPMODES = columns frameseq lines sbs tab
$(foreach MODE,$(FPMODES),$(eval $(call FATE_FPFILTER_SUITE,$(MODE))))
FATE_FILTER_VSYNTH-$(CONFIG_GRADFUN_FILTER) += fate-filter-gradfun
fate-filter-gradfun: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf gradfun
FATE_FILTER_VSYNTH-$(CONFIG_HQDN3D_FILTER) += fate-filter-hqdn3d
fate-filter-hqdn3d: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf hqdn3d
FATE_FILTER_VSYNTH-$(CONFIG_INTERLACE_FILTER) += fate-filter-interlace
fate-filter-interlace: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf interlace
FATE_FILTER_VSYNTH-$(CONFIG_NEGATE_FILTER) += fate-filter-negate
fate-filter-negate: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf negate
FATE_FILTER_VSYNTH-$(CONFIG_OVERLAY_FILTER) += fate-filter-overlay
fate-filter-overlay: tests/data/filtergraphs/overlay
fate-filter-overlay: CMD = framecrc -c:v pgmyuv -i $(SRC) -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay
FATE_FILTER_VSYNTH-$(CONFIG_SELECT_FILTER) += fate-filter-select-alternate
fate-filter-select-alternate: tests/data/filtergraphs/select-alternate
fate-filter-select-alternate: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_script $(TARGET_PATH)/tests/data/filtergraphs/select-alternate
FATE_FILTER_VSYNTH-$(call ALLYES, SETPTS_FILTER SETTB_FILTER) += fate-filter-setpts
fate-filter-setpts: tests/data/filtergraphs/setpts
fate-filter-setpts: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_script $(TARGET_PATH)/tests/data/filtergraphs/setpts
FATE_SHUFFLEPLANES += fate-filter-shuffleplanes-dup-luma
fate-filter-shuffleplanes-dup-luma: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf format=yuva444p,shuffleplanes=0:0:0:0
FATE_SHUFFLEPLANES += fate-filter-shuffleplanes-swapuv
fate-filter-shuffleplanes-swapuv: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf shuffleplanes=0:2:1
FATE_FILTER_VSYNTH-$(CONFIG_SHUFFLEPLANES_FILTER) += $(FATE_SHUFFLEPLANES)
FATE_FILTER_VSYNTH-$(CONFIG_TRANSPOSE_FILTER) += fate-filter-transpose
fate-filter-transpose: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf transpose
FATE_TRIM += fate-filter-trim-duration
fate-filter-trim-duration: CMD = framecrc -i $(SRC) -vf trim=start=0.4:duration=0.05
FATE_TRIM += fate-filter-trim-frame
fate-filter-trim-frame: CMD = framecrc -i $(SRC) -vf trim=start_frame=3:end_frame=10
FATE_TRIM += fate-filter-trim-mixed
fate-filter-trim-mixed: CMD = framecrc -i $(SRC) -vf trim=start=0.2:end=0.4:start_frame=1:end_frame=3
FATE_TRIM += fate-filter-trim-time
fate-filter-trim-time: CMD = framecrc -i $(SRC) -vf trim=0:0.09
FATE_FILTER_VSYNTH-$(CONFIG_TRIM_FILTER) += $(FATE_TRIM)
FATE_FILTER_VSYNTH-$(CONFIG_UNSHARP_FILTER) += fate-filter-unsharp
fate-filter-unsharp: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf unsharp
FATE_FILTER_VSYNTH-$(CONFIG_CROP_FILTER) += fate-filter-crop
fate-filter-crop: CMD = video_filter "crop=iw-100:ih-100:100:100"
FATE_FILTER_VSYNTH-$(call ALLYES, CROP_FILTER SCALE_FILTER) += fate-filter-crop_scale
fate-filter-crop_scale: CMD = video_filter "crop=iw-100:ih-100:100:100,scale=w=400:h=-1"
FATE_FILTER_VSYNTH-$(call ALLYES, CROP_FILTER SCALE_FILTER VFLIP_FILTER) += fate-filter-crop_scale_vflip
fate-filter-crop_scale_vflip: CMD = video_filter "null,null,crop=iw-200:ih-200:200:200,crop=iw-20:ih-20:20:20,scale=w=200:h=200,scale=w=250:h=250,vflip,vflip,null,scale=w=200:h=200,crop=iw-100:ih-100:100:100,vflip,scale=w=200:h=200,null,vflip,crop=iw-100:ih-100:100:100,null"
FATE_FILTER_VSYNTH-$(call ALLYES, CROP_FILTER VFLIP_FILTER) += fate-filter-crop_vflip
fate-filter-crop_vflip: CMD = video_filter "crop=iw-100:ih-100:100:100,vflip"
FATE_FILTER_VSYNTH-$(CONFIG_NULL_FILTER) += fate-filter-null
fate-filter-null: CMD = video_filter "null"
FATE_FILTER_VSYNTH-$(CONFIG_SCALE_FILTER) += fate-filter-scale200
fate-filter-scale200: CMD = video_filter "scale=w=200:h=200"
FATE_FILTER_VSYNTH-$(CONFIG_SCALE_FILTER) += fate-filter-scale500
fate-filter-scale500: CMD = video_filter "scale=w=500:h=500"
FATE_FILTER_VSYNTH-$(CONFIG_VFLIP_FILTER) += fate-filter-vflip
fate-filter-vflip: CMD = video_filter "vflip"
FATE_FILTER_VSYNTH-$(call ALLYES, CROP_FILTER VFLIP_FILTER) += fate-filter-vflip_crop
fate-filter-vflip_crop: CMD = video_filter "vflip,crop=iw-100:ih-100:100:100"
FATE_FILTER_VSYNTH-$(CONFIG_VFLIP_FILTER) += fate-filter-vflip_vflip
fate-filter-vflip_vflip: CMD = video_filter "vflip,vflip"
tests/pixfmts.mak: TAG = GEN
tests/pixfmts.mak: avconv$(EXESUF) | tests
$(M)printf "PIXFMTS = " > $@
$(Q)$(TARGET_EXEC) $(TARGET_PATH)/$< -pix_fmts list 2> /dev/null | awk 'NR > 8 && /^IO/ { printf $$2 " " }' >> $@
$(Q)printf "\n" >> $@
RUNNING_PIXFMTS_TESTS := $(filter check fate fate-list fate-filter fate-vfilter fate-filter-pixdesc%,$(MAKECMDGOALS))
ifneq (,$(RUNNING_PIXFMTS_TESTS))
-include tests/pixfmts.mak
endif
define PIXDESC_TEST
FATE_FILTER_PIXDESC-$(CONFIG_FORMAT_FILTER) += fate-filter-pixdesc-$(1)
fate-filter-pixdesc-$(1): CMD = video_filter "format=$(1),pixdesctest" -pix_fmt $(1)
endef
$(foreach fmt, $(PIXFMTS), $(eval $(call PIXDESC_TEST,$(fmt))))
fate-filter-pixdesc: $(FATE_FILTER_PIXDESC-yes)
FATE_FILTER_VSYNTH-yes += $(FATE_FILTER_PIXDESC-yes)
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-copy
fate-filter-pixfmts-copy: CMD = pixfmts
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-crop
fate-filter-pixfmts-crop: CMD = pixfmts "100:100:100:100"
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-hflip
fate-filter-pixfmts-hflip: CMD = pixfmts
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-null
fate-filter-pixfmts-null: CMD = pixfmts
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-pad
fate-filter-pixfmts-pad: CMD = pixfmts "500:400:20:20"
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-scale
fate-filter-pixfmts-scale: CMD = pixfmts "200:100"
FATE_FILTER_PIXFMTS += fate-filter-pixfmts-vflip
fate-filter-pixfmts-vflip: CMD = pixfmts
$(FATE_FILTER_PIXFMTS): libavfilter/tests/filtfmts$(EXESUF)
FATE_FILTER_VSYNTH-$(CONFIG_FORMAT_FILTER) += $(FATE_FILTER_PIXFMTS)
$(FATE_FILTER_VSYNTH-yes): $(VREF)
$(FATE_FILTER_VSYNTH-yes): SRC = $(TARGET_PATH)/tests/vsynth1/%02d.pgm
FATE_AVCONV-$(call DEMDEC, IMAGE2, PGMYUV) += $(FATE_FILTER_VSYNTH-yes)
fate-vfilter: $(FATE_FILTER-yes) $(FATE_FILTER_VSYNTH-yes)
fate-filter: fate-afilter fate-vfilter
|
{
"pile_set_name": "Github"
}
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_SSL_TOKEN_BINDING_H_
#define NET_SSL_TOKEN_BINDING_H_
#include <string>
#include <vector>
#include "base/strings/string_piece.h"
#include "crypto/ec_private_key.h"
#include "net/base/net_errors.h"
#include "net/base/net_export.h"
namespace net {
enum class TokenBindingType {
PROVIDED = 0,
REFERRED = 1,
};
// Takes an exported keying material value |ekm| from the TLS layer and a token
// binding key |key| and signs the EKM, putting the signature in |*out|. Returns
// true on success or false if there's an error in the signing operations.
bool SignTokenBindingEkm(base::StringPiece ekm,
crypto::ECPrivateKey* key,
std::vector<uint8_t>* out);
// Given a vector of serialized TokenBinding structs (as defined in
// draft-ietf-tokbind-protocol-04), this function combines them to form the
// serialized TokenBindingMessage struct in |*out|. This function returns a net
// error.
//
// struct {
// TokenBinding tokenbindings<0..2^16-1>;
// } TokenBindingMessage;
Error BuildTokenBindingMessageFromTokenBindings(
const std::vector<base::StringPiece>& token_bindings,
std::string* out);
// Builds a TokenBinding struct of type |type| with a TokenBindingID created
// from |*key| and a signature of |ekm| using |*key| to sign.
//
// enum {
// rsa2048_pkcs1.5(0), rsa2048_pss(1), ecdsap256(2), (255)
// } TokenBindingKeyParameters;
//
// struct {
// opaque modulus<1..2^16-1>;
// opaque publicexponent<1..2^8-1>;
// } RSAPublicKey;
//
// struct {
// opaque point <1..2^8-1>;
// } ECPoint;
//
// enum {
// provided_token_binding(0), referred_token_binding(1), (255)
// } TokenBindingType;
//
// struct {
// TokenBindingType tokenbinding_type;
// TokenBindingKeyParameters key_parameters;
// select (key_parameters) {
// case rsa2048_pkcs1.5:
// case rsa2048_pss:
// RSAPublicKey rsapubkey;
// case ecdsap256:
// ECPoint point;
// }
// } TokenBindingID;
//
// struct {
// TokenBindingID tokenbindingid;
// opaque signature<0..2^16-1>;// Signature over the exported keying
// // material value
// Extension extensions<0..2^16-1>;
// } TokenBinding;
Error BuildTokenBinding(TokenBindingType type,
crypto::ECPrivateKey* key,
const std::vector<uint8_t>& ekm,
std::string* out);
// Represents a parsed TokenBinding from a TokenBindingMessage.
struct TokenBinding {
TokenBinding();
TokenBindingType type;
std::string ec_point;
std::string signature;
};
// Given a TokenBindingMessage, parses the TokenBinding structs from it, putting
// them into |*token_bindings|. If there is an error parsing the
// TokenBindingMessage or the key parameter for any TokenBinding in the
// TokenBindingMessage is not ecdsap256, then this function returns false.
NET_EXPORT_PRIVATE bool ParseTokenBindingMessage(
base::StringPiece token_binding_message,
std::vector<TokenBinding>* token_bindings);
// Takes an ECPoint |ec_point| from a TokenBindingID and |signature| from a
// TokenBinding and verifies that |signature| is the signature of |ekm| using
// |ec_point| as the public key. Returns true if the signature verifies and
// false if it doesn't or some other error occurs in verification. This function
// is only provided for testing.
NET_EXPORT_PRIVATE bool VerifyEKMSignature(base::StringPiece ec_point,
base::StringPiece signature,
base::StringPiece ekm);
} // namespace net
#endif // NET_SSL_TOKEN_BINDING_H_
|
{
"pile_set_name": "Github"
}
|
// Screen Readers
// -------------------------
.sr-only { .sr-only(); }
.sr-only-focusable { .sr-only-focusable(); }
|
{
"pile_set_name": "Github"
}
|
<template name="foot">
<navigator class="page-foot" openType="switchTab" url="/page/component/index" hover-class="none">
<image class="icon-foot" src="../../../../image/icon_foot.png"></image>
</navigator>
</template>
|
{
"pile_set_name": "Github"
}
|
package s3crypto
import (
"bytes"
"encoding/hex"
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
)
// AES GCM
func TestAES_GCM_NIST_gcmEncryptExtIV256_PTLen_128_Test_0(t *testing.T) {
iv, _ := hex.DecodeString("0d18e06c7c725ac9e362e1ce")
key, _ := hex.DecodeString("31bdadd96698c204aa9ce1448ea94ae1fb4a9a0b3c9d773b51bb1822666b8f22")
plaintext, _ := hex.DecodeString("2db5168e932556f8089a0622981d017d")
expected, _ := hex.DecodeString("fa4362189661d163fcd6a56d8bf0405ad636ac1bbedd5cc3ee727dc2ab4a9489")
tag, _ := hex.DecodeString("d636ac1bbedd5cc3ee727dc2ab4a9489")
aesgcmTest(t, iv, key, plaintext, expected, tag)
}
func TestAES_GCM_NIST_gcmEncryptExtIV256_PTLen_104_Test_3(t *testing.T) {
iv, _ := hex.DecodeString("4742357c335913153ff0eb0f")
key, _ := hex.DecodeString("e5a0eb92cc2b064e1bc80891faf1fab5e9a17a9c3a984e25416720e30e6c2b21")
plaintext, _ := hex.DecodeString("8499893e16b0ba8b007d54665a")
expected, _ := hex.DecodeString("eb8e6175f1fe38eb1acf95fd5188a8b74bb74fda553e91020a23deed45")
tag, _ := hex.DecodeString("88a8b74bb74fda553e91020a23deed45")
aesgcmTest(t, iv, key, plaintext, expected, tag)
}
func TestAES_GCM_NIST_gcmEncryptExtIV256_PTLen_256_Test_6(t *testing.T) {
iv, _ := hex.DecodeString("a291484c3de8bec6b47f525f")
key, _ := hex.DecodeString("37f39137416bafde6f75022a7a527cc593b6000a83ff51ec04871a0ff5360e4e")
plaintext, _ := hex.DecodeString("fafd94cede8b5a0730394bec68a8e77dba288d6ccaa8e1563a81d6e7ccc7fc97")
expected, _ := hex.DecodeString("44dc868006b21d49284016565ffb3979cc4271d967628bf7cdaf86db888e92e501a2b578aa2f41ec6379a44a31cc019c")
tag, _ := hex.DecodeString("01a2b578aa2f41ec6379a44a31cc019c")
aesgcmTest(t, iv, key, plaintext, expected, tag)
}
func TestAES_GCM_NIST_gcmEncryptExtIV256_PTLen_408_Test_8(t *testing.T) {
iv, _ := hex.DecodeString("92f258071d79af3e63672285")
key, _ := hex.DecodeString("595f259c55abe00ae07535ca5d9b09d6efb9f7e9abb64605c337acbd6b14fc7e")
plaintext, _ := hex.DecodeString("a6fee33eb110a2d769bbc52b0f36969c287874f665681477a25fc4c48015c541fbe2394133ba490a34ee2dd67b898177849a91")
expected, _ := hex.DecodeString("bbca4a9e09ae9690c0f6f8d405e53dccd666aa9c5fa13c8758bc30abe1ddd1bcce0d36a1eaaaaffef20cd3c5970b9673f8a65c26ccecb9976fd6ac9c2c0f372c52c821")
tag, _ := hex.DecodeString("26ccecb9976fd6ac9c2c0f372c52c821")
aesgcmTest(t, iv, key, plaintext, expected, tag)
}
func aesgcmTest(t *testing.T, iv, key, plaintext, expected, tag []byte) {
cd := CipherData{
Key: key,
IV: iv,
}
gcm, err := newAESGCM(cd)
assert.NoError(t, err)
cipherdata := gcm.Encrypt(bytes.NewReader(plaintext))
ciphertext, err := ioutil.ReadAll(cipherdata)
assert.NoError(t, err)
// splitting tag and ciphertext
etag := ciphertext[len(ciphertext)-16:]
assert.Equal(t, etag, tag)
assert.Equal(t, len(ciphertext), len(expected))
assert.Equal(t, ciphertext, expected)
data := gcm.Decrypt(bytes.NewReader(ciphertext))
assert.NoError(t, err)
text, err := ioutil.ReadAll(data)
assert.NoError(t, err)
assert.Equal(t, len(text), len(plaintext))
assert.Equal(t, text, plaintext)
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018 st4rk
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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/>.
*/
#ifndef _PMC_H_
#define _PMC_H_
/*! PMC registers. */
#define APBDEV_PMC_CNTRL 0x0
#define PMC_CNTRL_MAIN_RST (1 << 4)
#define APBDEV_PMC_SEC_DISABLE 0x4
#define APBDEV_PMC_PWRGATE_TOGGLE 0x30
#define APBDEV_PMC_PWRGATE_STATUS 0x38
#define APBDEV_PMC_NO_IOPOWER 0x44
#define PMC_NO_IOPOWER_GPIO_IO_EN (1 << 21)
#define PMC_NO_IOPOWER_AUDIO_HV (1 << 18)
#define PMC_NO_IOPOWER_SDMMC1_IO_EN (1 << 12)
#define APBDEV_PMC_SCRATCH0 0x50
#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31)
#define PMC_SCRATCH0_MODE_FASTBOOT (1 << 30)
#define PMC_SCRATCH0_MODE_PAYLOAD (1 << 29)
#define PMC_SCRATCH0_MODE_RCM (1 << 1)
#define PMC_SCRATCH0_MODE_WARMBOOT (1 << 0)
#define APBDEV_PMC_SCRATCH1 0x54
#define APBDEV_PMC_SCRATCH20 0xA0
#define APBDEV_PMC_PWR_DET_VAL 0xE4
#define PMC_PWR_DET_GPIO_IO_EN (1 << 21)
#define PMC_PWR_DET_AUDIO_HV (1 << 18)
#define PMC_PWR_DET_SDMMC1_IO_EN (1 << 12)
#define APBDEV_PMC_DDR_PWR 0xE8
#define APBDEV_PMC_USB_AO 0xF0
#define APBDEV_PMC_CRYPTO_OP 0xF4
#define PMC_CRYPTO_OP_SE_ENABLE 0
#define PMC_CRYPTO_OP_SE_DISABLE 1
#define APBDEV_PMC_SCRATCH33 0x120
#define APBDEV_PMC_SCRATCH40 0x13C
#define APBDEV_PMC_OSC_EDPD_OVER 0x1A4
#define PMC_OSC_EDPD_OVER_OSC_CTRL_OVER 0x400000
#define APBDEV_PMC_CLK_OUT_CNTRL 0x1A8
#define PMC_CLK_OUT_CNTRL_CLK1_FORCE_EN (1 << 2)
#define APBDEV_PMC_RST_STATUS 0x1B4
#define APBDEV_PMC_IO_DPD_REQ 0x1B8
#define APBDEV_PMC_IO_DPD2_REQ 0x1C0
#define APBDEV_PMC_VDDP_SEL 0x1CC
#define APBDEV_PMC_DDR_CFG 0x1D0
#define APBDEV_PMC_SCRATCH45 0x234
#define APBDEV_PMC_SCRATCH46 0x238
#define APBDEV_PMC_SCRATCH49 0x244
#define APBDEV_PMC_TSC_MULT 0x2B4
#define APBDEV_PMC_SEC_DISABLE2 0x2C4
#define APBDEV_PMC_WEAK_BIAS 0x2C8
#define APBDEV_PMC_REG_SHORT 0x2CC
#define APBDEV_PMC_SEC_DISABLE3 0x2D8
#define APBDEV_PMC_SECURE_SCRATCH21 0x334
#define PMC_FUSE_PRIVATEKEYDISABLE_TZ_STICKY_BIT 0x10
#define APBDEV_PMC_SECURE_SCRATCH32 0x360
#define APBDEV_PMC_SECURE_SCRATCH49 0x3A4
#define APBDEV_PMC_CNTRL2 0x440
#define PMC_CNTRL2_HOLD_CKE_LOW_EN 0x1000
#define APBDEV_PMC_IO_DPD3_REQ 0x45C
#define APBDEV_PMC_IO_DPD4_REQ 0x464
#define APBDEV_PMC_UTMIP_PAD_CFG1 0x4C4
#define APBDEV_PMC_UTMIP_PAD_CFG3 0x4CC
#define APBDEV_PMC_DDR_CNTRL 0x4E4
#define APBDEV_PMC_SEC_DISABLE4 0x5B0
#define APBDEV_PMC_SEC_DISABLE5 0x5B4
#define APBDEV_PMC_SEC_DISABLE6 0x5B8
#define APBDEV_PMC_SEC_DISABLE7 0x5BC
#define APBDEV_PMC_SEC_DISABLE8 0x5C0
#define APBDEV_PMC_SCRATCH188 0x810
#define APBDEV_PMC_SCRATCH190 0x818
#define APBDEV_PMC_SCRATCH200 0x840
#endif
|
{
"pile_set_name": "Github"
}
|
{
"navigationBarTitleText": "支付订单"
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package sun.security.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
/**
* This class encodes a buffer into the classic: "Hexadecimal Dump" format of
* the past. It is useful for analyzing the contents of binary buffers.
* The format produced is as follows:
* <pre>
* xxxx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ................
* </pre>
* Where xxxx is the offset into the buffer in 16 byte chunks, followed
* by ascii coded hexadecimal bytes followed by the ASCII representation of
* the bytes or '.' if they are not valid bytes.
*
* @author Chuck McManis
*/
public class HexDumpEncoder {
private int offset;
private int thisLineLength;
private int currentByte;
private byte thisLine[] = new byte[16];
static void hexDigit(PrintStream p, byte x) {
char c;
c = (char) ((x >> 4) & 0xf);
if (c > 9)
c = (char) ((c-10) + 'A');
else
c = (char)(c + '0');
p.write(c);
c = (char) (x & 0xf);
if (c > 9)
c = (char)((c-10) + 'A');
else
c = (char)(c + '0');
p.write(c);
}
protected int bytesPerAtom() {
return (1);
}
protected int bytesPerLine() {
return (16);
}
protected void encodeBufferPrefix(OutputStream o) throws IOException {
offset = 0;
pStream = new PrintStream(o);
}
protected void encodeLinePrefix(OutputStream o, int len) throws IOException {
hexDigit(pStream, (byte)((offset >>> 8) & 0xff));
hexDigit(pStream, (byte)(offset & 0xff));
pStream.print(": ");
currentByte = 0;
thisLineLength = len;
}
protected void encodeAtom(OutputStream o, byte buf[], int off, int len) throws IOException {
thisLine[currentByte] = buf[off];
hexDigit(pStream, buf[off]);
pStream.print(" ");
currentByte++;
if (currentByte == 8)
pStream.print(" ");
}
protected void encodeLineSuffix(OutputStream o) throws IOException {
if (thisLineLength < 16) {
for (int i = thisLineLength; i < 16; i++) {
pStream.print(" ");
if (i == 7)
pStream.print(" ");
}
}
pStream.print(" ");
for (int i = 0; i < thisLineLength; i++) {
if ((thisLine[i] < ' ') || (thisLine[i] > 'z')) {
pStream.print(".");
} else {
pStream.write(thisLine[i]);
}
}
pStream.println();
offset += thisLineLength;
}
/** Stream that understands "printing" */
protected PrintStream pStream;
/**
* This method works around the bizarre semantics of BufferedInputStream's
* read method.
*/
protected int readFully(InputStream in, byte buffer[])
throws java.io.IOException {
for (int i = 0; i < buffer.length; i++) {
int q = in.read();
if (q == -1)
return i;
buffer[i] = (byte)q;
}
return buffer.length;
}
/**
* Encode bytes from the input stream, and write them as text characters
* to the output stream. This method will run until it exhausts the
* input stream, but does not print the line suffix for a final
* line that is shorter than bytesPerLine().
*/
public void encode(InputStream inStream, OutputStream outStream)
throws IOException
{
int j;
int numBytes;
byte tmpbuffer[] = new byte[bytesPerLine()];
encodeBufferPrefix(outStream);
while (true) {
numBytes = readFully(inStream, tmpbuffer);
if (numBytes == 0) {
break;
}
encodeLinePrefix(outStream, numBytes);
for (j = 0; j < numBytes; j += bytesPerAtom()) {
if ((j + bytesPerAtom()) <= numBytes) {
encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
} else {
encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
}
}
if (numBytes < bytesPerLine()) {
break;
} else {
encodeLineSuffix(outStream);
}
}
}
/**
* A 'streamless' version of encode that simply takes a buffer of
* bytes and returns a string containing the encoded buffer.
*/
public String encode(byte aBuffer[]) {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
String retVal = null;
try {
encode(inStream, outStream);
// explicit ascii->unicode conversion
retVal = outStream.toString("ISO-8859-1");
} catch (Exception IOException) {
// This should never happen.
throw new Error("CharacterEncoder.encode internal error");
}
return (retVal);
}
/**
* Return a byte array from the remaining bytes in this ByteBuffer.
* <P>
* The ByteBuffer's position will be advanced to ByteBuffer's limit.
* <P>
* To avoid an extra copy, the implementation will attempt to return the
* byte array backing the ByteBuffer. If this is not possible, a
* new byte array will be created.
*/
private byte [] getBytes(ByteBuffer bb) {
/*
* This should never return a BufferOverflowException, as we're
* careful to allocate just the right amount.
*/
byte [] buf = null;
/*
* If it has a usable backing byte buffer, use it. Use only
* if the array exactly represents the current ByteBuffer.
*/
if (bb.hasArray()) {
byte [] tmp = bb.array();
if ((tmp.length == bb.capacity()) &&
(tmp.length == bb.remaining())) {
buf = tmp;
bb.position(bb.limit());
}
}
if (buf == null) {
/*
* This class doesn't have a concept of encode(buf, len, off),
* so if we have a partial buffer, we must reallocate
* space.
*/
buf = new byte[bb.remaining()];
/*
* position() automatically updated
*/
bb.get(buf);
}
return buf;
}
/**
* A 'streamless' version of encode that simply takes a ByteBuffer
* and returns a string containing the encoded buffer.
* <P>
* The ByteBuffer's position will be advanced to ByteBuffer's limit.
*/
public String encode(ByteBuffer aBuffer) {
byte [] buf = getBytes(aBuffer);
return encode(buf);
}
/**
* Encode bytes from the input stream, and write them as text characters
* to the output stream. This method will run until it exhausts the
* input stream. It differs from encode in that it will add the
* line at the end of a final line that is shorter than bytesPerLine().
*/
public void encodeBuffer(InputStream inStream, OutputStream outStream)
throws IOException
{
int j;
int numBytes;
byte tmpbuffer[] = new byte[bytesPerLine()];
encodeBufferPrefix(outStream);
while (true) {
numBytes = readFully(inStream, tmpbuffer);
if (numBytes == 0) {
break;
}
encodeLinePrefix(outStream, numBytes);
for (j = 0; j < numBytes; j += bytesPerAtom()) {
if ((j + bytesPerAtom()) <= numBytes) {
encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
} else {
encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
}
}
encodeLineSuffix(outStream);
if (numBytes < bytesPerLine()) {
break;
}
}
}
/**
* Encode the buffer in <i>aBuffer</i> and write the encoded
* result to the OutputStream <i>aStream</i>.
*/
public void encodeBuffer(byte aBuffer[], OutputStream aStream)
throws IOException
{
ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
encodeBuffer(inStream, aStream);
}
/**
* A 'streamless' version of encode that simply takes a buffer of
* bytes and returns a string containing the encoded buffer.
*/
public String encodeBuffer(byte aBuffer[]) {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
try {
encodeBuffer(inStream, outStream);
} catch (Exception IOException) {
// This should never happen.
throw new Error("CharacterEncoder.encodeBuffer internal error");
}
return (outStream.toString());
}
/**
* Encode the <i>aBuffer</i> ByteBuffer and write the encoded
* result to the OutputStream <i>aStream</i>.
* <P>
* The ByteBuffer's position will be advanced to ByteBuffer's limit.
*/
public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream)
throws IOException
{
byte [] buf = getBytes(aBuffer);
encodeBuffer(buf, aStream);
}
}
|
{
"pile_set_name": "Github"
}
|
10.067270 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
10.171130 -0.007625 -0.025904 1.011187 0.001379 0.001611 -0.000703 0.999998
10.275010 -0.009307 -0.052322 2.016892 0.002098 0.004125 -0.001327 0.999988
|
{
"pile_set_name": "Github"
}
|
module Proof
module Generators
class DeviseGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
argument :class_name, type: :string, default: "User"
desc "This generator creates a 'login' route, and configures it to work with Devise (with the default model name User)."
def create_controller
controller_file = "authentication_controller.rb.erb"
destination_file = "app/controllers/authentication_controller.rb"
template controller_file, destination_file
end
def create_routes
route "post 'login', to: 'authentication#login'"
end
end
end
end
|
{
"pile_set_name": "Github"
}
|
<?php
namespace Codeages\Plumber\Queue;
use Codeages\Beanstalk\Client;
use Codeages\Beanstalk\Exception\DeadlineSoonException;
use Psr\Log\LoggerInterface;
class BeanstalkTopic implements TopicInterface
{
/**
* @var Client
*/
private $client;
/**
* @var string
*/
private $name;
/**
* @var LoggerInterface
*/
private $logger;
public function __construct($client, $name, LoggerInterface $logger)
{
$this->client = $client;
$this->name = $name;
$this->logger = $logger;
}
/**
* @param bool $blocking
* @param int $timeout
*
* @return Job|null
*
* @throws QueueException
*/
public function reserveJob($blocking = false, $timeout = 2)
{
$message = null;
try {
$message = $this->client->reserve($timeout);
} catch (DeadlineSoonException $e) {
$this->logger->notice('reserve job is deadline soon, sleep 1 second.');
sleep(1);
} catch (\Throwable $e) {
throw new QueueException('Reserve job failed.', 0, $e);
}
if (!$message) {
return null;
}
$job = new Job();
$job->setId($message['id']);
$job->setBody($message['body']);
try {
$stats = $this->client->statsJob($job->getId());
$job->setPriority($stats['pri']);
$job->setDelay($stats['delay']);
$job->setTtr($stats['ttr']);
} catch (\Throwable $e) {
throw new QueueException("Stats job #{$job->getId()} failed.");
}
return $job;
}
public function putJob(Job $job)
{
try {
$id = $this->client->put($job->getPriority(), $job->getDelay(), $job->getTtr(), $job->getBody());
if (!$id) {
throw new QueueException("Put job #{$job->getId()} failed.");
}
$job->setId($id);
return $job;
} catch (\Throwable $e) {
throw new QueueException("Put job #{$job->getId()} failed.", 0, $e);
}
}
public function buryJob(Job $job)
{
try {
$buried = $this->client->bury($job->getId(), $job->getPriority());
if (false === $buried) {
throw new QueueException("Bury job #{$job->getId()} failed.", 0, $e);
}
} catch (\Throwable $e) {
throw new QueueException("Bury job #{$job->getId()} failed.", 0, $e);
}
}
/**
* @param Job $job
*
* @throws QueueException
*/
public function finishJob(Job $job)
{
try {
$deleted = $this->client->delete($job->getId());
if (!$deleted) {
throw new QueueException("Delete job #{$job->getId()} failed.");
}
} catch (\Throwable $e) {
throw new QueueException("Finish job #{$job->getId()} failed.", 0, $e);
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Adapted from OpenVPN for Android
* Copyright (c) 2012-2013, Arne Schwabe
* 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library.
*/
package app.openconnect.api;
import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.VpnService;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import app.openconnect.VpnProfile;
import app.openconnect.core.OpenVPN.ConnectionStatus;
import app.openconnect.core.OpenVpnService;
import app.openconnect.core.OpenVpnService.LocalBinder;
import app.openconnect.core.ProfileManager;
public class ExternalOpenVPNService extends Service {
private static final int SEND_TOALL = 0;
final RemoteCallbackList<IOpenVPNStatusCallback> mCallbacks =
new RemoteCallbackList<IOpenVPNStatusCallback>();
private OpenVpnService mService;
private ExternalAppDatabase mExtAppDb;
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className,
IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
LocalBinder binder = (LocalBinder) service;
mService = binder.getService();
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
mService =null;
}
};
@Override
public void onCreate() {
super.onCreate();
mExtAppDb = new ExternalAppDatabase(this);
Intent intent = new Intent(getBaseContext(), OpenVpnService.class);
intent.setAction(OpenVpnService.START_SERVICE);
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
mHandler.setService(this);
}
private final IOpenVPNAPIService.Stub mBinder = new IOpenVPNAPIService.Stub() {
private void checkOpenVPNPermission() throws SecurityRemoteException{
PackageManager pm = getPackageManager();
for (String apppackage:mExtAppDb.getExtAppList()) {
ApplicationInfo app;
try {
app = pm.getApplicationInfo(apppackage, 0);
if (Binder.getCallingUid() == app.uid) {
return;
}
} catch (NameNotFoundException e) {
// App not found. Remove it from the list
mExtAppDb.removeApp(apppackage);
e.printStackTrace();
}
}
throw new SecurityException("Unauthorized OpenVPN API Caller");
}
@Override
public List<APIVpnProfile> getProfiles() throws RemoteException {
checkOpenVPNPermission();
List<APIVpnProfile> profiles = new LinkedList<APIVpnProfile>();
for(VpnProfile vp: ProfileManager.getProfiles())
profiles.add(new APIVpnProfile(vp.getUUIDString(),vp.mName,true));
return profiles;
}
@Override
public void startProfile(String profileUUID) throws RemoteException {
checkOpenVPNPermission();
/*
Intent shortVPNIntent = new Intent(Intent.ACTION_MAIN);
shortVPNIntent.setClass(getBaseContext(),app.openconnect.LaunchVPN.class);
shortVPNIntent.putExtra(app.openconnect.LaunchVPN.EXTRA_KEY,profileUUID);
shortVPNIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(shortVPNIntent);
*/
}
public void startVPN(String inlineconfig) throws RemoteException {
checkOpenVPNPermission();
/*
ConfigParser cp = new ConfigParser();
try {
cp.parseConfig(new StringReader(inlineconfig));
VpnProfile vp = cp.convertProfile();
if(vp.checkProfile(getApplicationContext()) != R.string.no_error_found)
throw new RemoteException(getString(vp.checkProfile(getApplicationContext())));
ProfileManager.setTemporaryProfile(vp);
//VPNLaunchHelper.startOpenVpn(vp, getBaseContext());
} catch (IOException e) {
throw new RemoteException(e.getMessage());
} catch (ConfigParseError e) {
throw new RemoteException(e.getMessage());
}
*/
}
@Override
public boolean addVPNProfile(String name, String config) throws RemoteException {
checkOpenVPNPermission();
/*
ConfigParser cp = new ConfigParser();
try {
cp.parseConfig(new StringReader(config));
VpnProfile vp = cp.convertProfile();
vp.mName = name;
ProfileManager pm = ProfileManager.getInstance(getBaseContext());
pm.addProfile(vp);
} catch (IOException e) {
e.printStackTrace();
return false;
} catch (ConfigParseError e) {
e.printStackTrace();
return false;
}
*/
return true;
}
@Override
public Intent prepare(String packagename) {
if (new ExternalAppDatabase(ExternalOpenVPNService.this).isAllowed(packagename))
return null;
Intent intent = new Intent();
intent.setClass(ExternalOpenVPNService.this, ConfirmDialog.class);
return intent;
}
@Override
public Intent prepareVPNService() throws RemoteException {
checkOpenVPNPermission();
if(VpnService.prepare(ExternalOpenVPNService.this)==null)
return null;
else
return new Intent(getBaseContext(), GrantPermissionsActivity.class);
}
@Override
public void registerStatusCallback(IOpenVPNStatusCallback cb)
throws RemoteException {
checkOpenVPNPermission();
if (cb != null) {
cb.newStatus(mMostRecentState.vpnUUID, mMostRecentState.state,
mMostRecentState.logmessage, mMostRecentState.level.name());
mCallbacks.register(cb);
}
}
@Override
public void unregisterStatusCallback(IOpenVPNStatusCallback cb)
throws RemoteException {
checkOpenVPNPermission();
if (cb != null)
mCallbacks.unregister(cb);
}
@Override
public void disconnect() throws RemoteException {
checkOpenVPNPermission();
if(mService != null)
mService.stopVPN();
}
};
private UpdateMessage mMostRecentState; @Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public void onDestroy() {
super.onDestroy();
mCallbacks.kill();
unbindService(mConnection);
}
class UpdateMessage {
public String state;
public String logmessage;
public ConnectionStatus level;
public String vpnUUID;
public UpdateMessage(String state, String logmessage, ConnectionStatus level) {
this.state = state;
this.logmessage = logmessage;
this.level = level;
}
}
private static final OpenVPNServiceHandler mHandler = new OpenVPNServiceHandler();
static class OpenVPNServiceHandler extends Handler {
WeakReference<ExternalOpenVPNService> service= null;
private void setService(ExternalOpenVPNService eos)
{
service = new WeakReference<ExternalOpenVPNService>(eos);
}
@Override public void handleMessage(Message msg) {
RemoteCallbackList<IOpenVPNStatusCallback> callbacks;
switch (msg.what) {
case SEND_TOALL:
if(service ==null || service.get() == null)
return;
callbacks = service.get().mCallbacks;
// Broadcast to all clients the new value.
final int N = callbacks.beginBroadcast();
for (int i=0; i<N; i++) {
try {
sendUpdate(callbacks.getBroadcastItem(i),(UpdateMessage) msg.obj);
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing
// the dead object for us.
}
}
callbacks.finishBroadcast();
break;
}
}
private void sendUpdate(IOpenVPNStatusCallback broadcastItem,
UpdateMessage um) throws RemoteException
{
broadcastItem.newStatus(um.vpnUUID, um.state, um.logmessage, um.level.name());
}
}
}
|
{
"pile_set_name": "Github"
}
|
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch08/8.12/8.12.1/8.12.1-1_45.js
* @description Properties - [[HasOwnProperty]] (configurable, enumerable inherited setter property)
*/
function testcase() {
var base = {};
Object.defineProperty(base, "foo", {set: function() {;}, enumerable:true, configurable:true});
var o = Object.create(base);
return o.hasOwnProperty("foo")===false;
}
runTestCase(testcase);
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0"?>
<!--
__COPYRIGHT__
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
-->
<!DOCTYPE sconsdoc [
<!ENTITY % scons SYSTEM '../../doc/scons.mod'>
%scons;
<!ENTITY % builders-mod SYSTEM '../../doc/generated/builders.mod'>
%builders-mod;
<!ENTITY % functions-mod SYSTEM '../../doc/generated/functions.mod'>
%functions-mod;
<!ENTITY % tools-mod SYSTEM '../../doc/generated/tools.mod'>
%tools-mod;
<!ENTITY % variables-mod SYSTEM '../../doc/generated/variables.mod'>
%variables-mod;
]>
<sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
<tool name="sunlink">
<summary>
<para>
Sets construction variables for the Sun linker.
</para>
</summary>
<sets>
<item>SHLINKFLAGS</item>
<item>RPATHPREFIX</item>
<item>RPATHSUFFIX</item>
</sets>
</tool>
</sconsdoc>
|
{
"pile_set_name": "Github"
}
|
[31m1[m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-[31m<80,1039>[m
|
{
"pile_set_name": "Github"
}
|
// Copyright David Abrahams 2002.
// 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 REGISTERED_DWA2002710_HPP
# define REGISTERED_DWA2002710_HPP
# include <boost/python/type_id.hpp>
# include <boost/python/converter/registry.hpp>
# include <boost/python/converter/registrations.hpp>
# include <boost/type_traits/transform_traits.hpp>
# include <boost/type_traits/cv_traits.hpp>
# include <boost/type_traits/is_void.hpp>
# include <boost/detail/workaround.hpp>
# include <boost/python/type_id.hpp>
# include <boost/type.hpp>
namespace boost {
// You'll see shared_ptr mentioned in this header because we need to
// note which types are shared_ptrs in their registrations, to
// implement special shared_ptr handling for rvalue conversions.
template <class T> class shared_ptr;
namespace python { namespace converter {
struct registration;
namespace detail
{
template <class T>
struct registered_base
{
static registration const& converters;
};
}
template <class T>
struct registered
: detail::registered_base<
typename add_reference<
typename add_cv<T>::type
>::type
>
{
};
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
// collapses a few more types to the same static instance. MSVC7.1
// fails to strip cv-qualification from array types in typeid. For
// some reason we can't use this collapse there or array converters
// will not be found.
template <class T>
struct registered<T&>
: registered<T> {};
# endif
//
// implementations
//
namespace detail
{
inline void
register_shared_ptr0(...)
{
}
template <class T>
inline void
register_shared_ptr0(shared_ptr<T>*)
{
registry::lookup_shared_ptr(type_id<shared_ptr<T> >());
}
template <class T>
inline void
register_shared_ptr1(T const volatile*)
{
detail::register_shared_ptr0((T*)0);
}
template <class T>
inline registration const&
registry_lookup2(T&(*)())
{
detail::register_shared_ptr1((T*)0);
return registry::lookup(type_id<T&>());
}
template <class T>
inline registration const&
registry_lookup1(type<T>)
{
return registry_lookup2((T(*)())0);
}
inline registration const&
registry_lookup1(type<const volatile void>)
{
detail::register_shared_ptr1((void*)0);
return registry::lookup(type_id<void>());
}
template <class T>
registration const& registered_base<T>::converters = detail::registry_lookup1(type<T>());
}
}}} // namespace boost::python::converter
#endif // REGISTERED_DWA2002710_HPP
|
{
"pile_set_name": "Github"
}
|
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim 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, 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.
*/
/** \file
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 1
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 2
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 64
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// RNDIS CDC Control Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// RNDIS CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;
USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixTest.Tests
{
/// <summary>
/// Provides methods for building an MSI.
/// </summary>
public class PackageBuilder : WixTest.PackageBuilder
{
/// <summary>
/// Creates a new instance of the <see cref="PackageBuilder"/> class.
/// </summary>
/// <param name="test">The container <see cref="WixTests"/> class.</param>
/// <param name="name">The name of the package to build.</param>
public PackageBuilder(WixTests test, string name)
: base(test.TestContext.TestName, name, test.TestContext.TestDataDirectory, test.TestArtifacts)
{
}
}
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<ldml>
<identity>
<version number="$Revision: 6546 $"/>
<generation date="$Date: 2012-02-07 12:32:35 -0600 (Tue, 07 Feb 2012) $"/>
<language type="lu"/>
</identity>
<localeDisplayNames>
<languages>
<language type="ak">Liakan</language>
<language type="am">Liamhariki</language>
<language type="ar">Arabi</language>
<language type="be">Belarusi</language>
<language type="bg">Bulegari</language>
<language type="bn">Bengali</language>
<language type="cs">Tsheki</language>
<language type="de">Lizelumani</language>
<language type="el">Giliki</language>
<language type="en">Lingelesa</language>
<language type="es">Lihispania</language>
<language type="fa">Mpepajemi</language>
<language type="fr">Mfwàlànsa</language>
<language type="ha">Hausa</language>
<language type="hi">Hindi</language>
<language type="hu">Hongili</language>
<language type="id">Lindonezia</language>
<language type="ig">Igbo</language>
<language type="it">Litali</language>
<language type="ja">Liyapani</language>
<language type="jv">Java</language>
<language type="ko">Likoreya</language>
<language type="lu">Tshiluba</language>
<language type="ms">Limalezia</language>
<language type="ne">nepali</language>
<language type="nl">olandi</language>
<language type="pa">Lipunjabi</language>
<language type="pl">Mpoloni</language>
<language type="pt">Mputulugɛsi</language>
<language type="ro">Liromani</language>
<language type="ru">Lirisi</language>
<language type="rw">kinyarwanda</language>
<language type="so">Lisomali</language>
<language type="sv">Lisuwidi</language>
<language type="ta">Mtamuili</language>
<language type="th">Ntailandi</language>
<language type="tr">Ntuluki</language>
<language type="uk">Nkrani</language>
<language type="ur">Urdu</language>
<language type="vi">Liviyetinamu</language>
<language type="yo">Nyoruba</language>
<language type="zh">shinɛ</language>
<language type="zu">Nzulu</language>
</languages>
<territories>
<territory type="AD">Andore</territory>
<territory type="AE">Lemila alabu</territory>
<territory type="AF">Afuganisita</territory>
<territory type="AG">Antiga ne Barbuda</territory>
<territory type="AI">Angiye</territory>
<territory type="AL">Alubani</territory>
<territory type="AM">Ameni</territory>
<territory type="AN">Antiye wa Olande</territory>
<territory type="AO">Angola</territory>
<territory type="AR">Alijantine</territory>
<territory type="AS">Samoa wa Ameriki</territory>
<territory type="AT">Otilisi</territory>
<territory type="AU">Ositali</territory>
<territory type="AW">Aruba</territory>
<territory type="AZ">Ajelbayidja</territory>
<territory type="BA">Mbosini ne Hezegovine</territory>
<territory type="BB">Barebade</territory>
<territory type="BD">Benguladeshi</territory>
<territory type="BE">Belejiki</territory>
<territory type="BF">Bukinafaso</territory>
<territory type="BG">Biligari</territory>
<territory type="BH">Bahrene</territory>
<territory type="BI">Burundi</territory>
<territory type="BJ">Bene</territory>
<territory type="BM">Bermuda</territory>
<territory type="BN">Brineyi</territory>
<territory type="BO">Mbolivi</territory>
<territory type="BR">Mnulezile</territory>
<territory type="BS">Bahamase</territory>
<territory type="BT">Butani</territory>
<territory type="BW">Mbotswana</territory>
<territory type="BY">Byelorisi</territory>
<territory type="BZ">Belize</territory>
<territory type="CA">Kanada</territory>
<territory type="CD">Ditunga wa Kongu</territory>
<territory type="CF">Ditunga dya Afrika wa munkatshi</territory>
<territory type="CG">Kongu</territory>
<territory type="CH">Swise</territory>
<territory type="CI">Kotedivuale</territory>
<territory type="CK">Lutanda lua Kookɛ</territory>
<territory type="CL">Shili</territory>
<territory type="CM">Kamerune</territory>
<territory type="CN">Shine</territory>
<territory type="CO">Kolombi</territory>
<territory type="CR">Kositarika</territory>
<territory type="CS">Nsebi ne Montenegro</territory>
<territory type="CU">Kuba</territory>
<territory type="CV">Lutanda lua Kapevele</territory>
<territory type="CY">Shipele</territory>
<territory type="CZ">Ditunga dya Tsheka</territory>
<territory type="DE">Alemanu</territory>
<territory type="DJ">Djibuti</territory>
<territory type="DK">Danemalaku</territory>
<territory type="DM">Duminiku</territory>
<territory type="DO">Ditunga wa Duminiku</territory>
<territory type="DZ">Alijeri</territory>
<territory type="EC">Ekwatele</territory>
<territory type="EE">Esitoni</territory>
<territory type="EG">Mushidi</territory>
<territory type="ER">Elitele</territory>
<territory type="ES">Nsipani</territory>
<territory type="ET">Etshiopi</territory>
<territory type="FI">Filande</territory>
<territory type="FJ">Fuji</territory>
<territory type="FK">Lutanda lua Maluni</territory>
<territory type="FM">Mikronezi</territory>
<territory type="FR">Nfalanse</territory>
<territory type="GA">Ngabu</territory>
<territory type="GB">Angeletele</territory>
<territory type="GD">Ngelenade</territory>
<territory type="GE">Joriji</territory>
<territory type="GF">Giyane wa Nfalanse</territory>
<territory type="GH">Ngana</territory>
<territory type="GI">Jibeletale</territory>
<territory type="GL">Ngowelande</territory>
<territory type="GM">Gambi</territory>
<territory type="GN">Ngine</territory>
<territory type="GP">Ngwadelupe</territory>
<territory type="GQ">Gine Ekwatele</territory>
<territory type="GR">Ngeleka</territory>
<territory type="GT">Ngwatemala</territory>
<territory type="GU">Ngwame</territory>
<territory type="GW">Nginebisau</territory>
<territory type="GY">Ngiyane</territory>
<territory type="HN">Ondurase</territory>
<territory type="HR">Krowasi</territory>
<territory type="HT">Ayiti</territory>
<territory type="HU">Ongili</territory>
<territory type="ID">Indonezi</territory>
<territory type="IE">Irelande</territory>
<territory type="IL">Isirayele</territory>
<territory type="IN">Inde</territory>
<territory type="IO">Lutanda lwa Angeletele ku mbu wa Indiya</territory>
<territory type="IQ">Iraki</territory>
<territory type="IR">Ira</territory>
<territory type="IS">Isilande</territory>
<territory type="IT">Itali</territory>
<territory type="JM">Jamaiki</territory>
<territory type="JO">Jodani</territory>
<territory type="JP">Japu</territory>
<territory type="KE">Kenya</territory>
<territory type="KG">Kigizisita</territory>
<territory type="KH">Kambodza</territory>
<territory type="KI">Kiribati</territory>
<territory type="KM">Komoru</territory>
<territory type="KN">Santu krístofe ne Neves</territory>
<territory type="KP">Kore wa muulu</territory>
<territory type="KR">Kore wa mwinshi</territory>
<territory type="KW">Koweti</territory>
<territory type="KY">Lutanda lua Kayima</territory>
<territory type="KZ">Kazakusita</territory>
<territory type="LA">Lawosi</territory>
<territory type="LB">Liba</territory>
<territory type="LC">Santu lisi</territory>
<territory type="LI">Lishuteni</territory>
<territory type="LK">Sirilanka</territory>
<territory type="LR">Liberiya</territory>
<territory type="LS">Lesoto</territory>
<territory type="LT">Litwani</territory>
<territory type="LU">Likisambulu</territory>
<territory type="LV">Letoni</territory>
<territory type="LY">Libi</territory>
<territory type="MA">Maroke</territory>
<territory type="MC">Monaku</territory>
<territory type="MD">Molidavi</territory>
<territory type="MG">Madagasikari</territory>
<territory type="MH">Lutanda lua Marishale</territory>
<territory type="MK">Masedwane</territory>
<territory type="ML">Mali</territory>
<territory type="MM">Myamare</territory>
<territory type="MN">Mongoli</territory>
<territory type="MP">Lutanda lua Mariane wa muulu</territory>
<territory type="MQ">Martiniki</territory>
<territory type="MR">Moritani</territory>
<territory type="MS">Musera</territory>
<territory type="MT">Malite</territory>
<territory type="MU">Morise</territory>
<territory type="MV">Madive</territory>
<territory type="MW">Malawi</territory>
<territory type="MX">Meksike</territory>
<territory type="MY">Malezi</territory>
<territory type="MZ">Mozambiki</territory>
<territory type="NA">Namibi</territory>
<territory type="NC">Kaledoni wa mumu</territory>
<territory type="NE">Nijere</territory>
<territory type="NF">Lutanda lua Norfok</territory>
<territory type="NG">Nijerya</territory>
<territory type="NI">Nikaragwa</territory>
<territory type="NL">Olandɛ</territory>
<territory type="NO">Noriveje</territory>
<territory type="NP">Nepálɛ</territory>
<territory type="NR">Nauru</territory>
<territory type="NU">Nyue</territory>
<territory type="NZ">Zelanda wa mumu</territory>
<territory type="OM">Omane</territory>
<territory type="PA">Panama</territory>
<territory type="PE">Peru</territory>
<territory type="PF">Polinezi wa Nfalanse</territory>
<territory type="PG">Papwazi wa Nginɛ wa mumu</territory>
<territory type="PH">Nfilipi</territory>
<territory type="PK">Pakisita</territory>
<territory type="PL">Mpoloni</territory>
<territory type="PM">Santu pététo ne Mikelu</territory>
<territory type="PN">Pikairni</territory>
<territory type="PR">Mpotoriku</territory>
<territory type="PS">Palesine</territory>
<territory type="PT">Mputulugeshi</territory>
<territory type="PW">Palau</territory>
<territory type="PY">Palagwei</territory>
<territory type="QA">Katari</territory>
<territory type="RE">Lenyo</territory>
<territory type="RO">Romani</territory>
<territory type="RU">Risi</territory>
<territory type="RW">Rwanda</territory>
<territory type="SA">Alabu Nsawudi</territory>
<territory type="SB">Lutanda lua Solomu</territory>
<territory type="SC">Seshele</territory>
<territory type="SD">Suda</territory>
<territory type="SE">Suwedi</territory>
<territory type="SG">Singapure</territory>
<territory type="SH">Santu eleni</territory>
<territory type="SI">Siloveni</territory>
<territory type="SK">Silovaki</territory>
<territory type="SL">Siera Leone</territory>
<territory type="SM">Santu Marine</territory>
<territory type="SN">Senegale</territory>
<territory type="SO">Somali</territory>
<territory type="SR">Suriname</territory>
<territory type="ST">Sao Tome ne Presipɛ</territory>
<territory type="SV">Savadore</territory>
<territory type="SY">Siri</territory>
<territory type="SZ">Swazilandi</territory>
<territory type="TC">Lutanda lua Tuluki ne Kaiko</territory>
<territory type="TD">Tshadi</territory>
<territory type="TG">Togu</territory>
<territory type="TH">Tayilanda</territory>
<territory type="TJ">Tazikisita</territory>
<territory type="TK">Tokelau</territory>
<territory type="TL">Timoru wa diboku</territory>
<territory type="TM">Tukemenisita</territory>
<territory type="TN">Tinizi</territory>
<territory type="TO">Tonga</territory>
<territory type="TR">Tuluki</territory>
<territory type="TT">Tinidade ne Tobago</territory>
<territory type="TV">Tuvalu</territory>
<territory type="TW">Taiwani</territory>
<territory type="TZ">Tanzani</territory>
<territory type="UA">Ukreni</territory>
<territory type="UG">Uganda</territory>
<territory type="US">Ameriki</territory>
<territory type="UY">Irigwei</territory>
<territory type="UZ">Uzibekisita</territory>
<territory type="VA">Nvatika</territory>
<territory type="VC">Santu vesa ne Ngelenadine</territory>
<territory type="VE">Venezuela</territory>
<territory type="VG">Lutanda lua Vierzi wa Angeletele</territory>
<territory type="VI">Lutanda lua Vierzi wa Ameriki</territory>
<territory type="VN">Viyetiname</territory>
<territory type="VU">Vanuatu</territory>
<territory type="WF">Walise ne Futuna</territory>
<territory type="WS">Samoa</territory>
<territory type="YE">Yemenu</territory>
<territory type="YT">Mayote</territory>
<territory type="ZA">Afrika ya Súdi</territory>
<territory type="ZM">Zambi</territory>
<territory type="ZW">Zimbabwe</territory>
</territories>
</localeDisplayNames>
<characters>
<exemplarCharacters>[a á à b c d e é è ɛ {ɛ\u0301} {ɛ\u0300} f h i í ì j k l m n {ng} {ny} o ó ò ɔ {ɔ\u0301} {ɔ\u0300} p {ph} q s {shi} t u ú ù v w y z]</exemplarCharacters>
<exemplarCharacters type="auxiliary">[g r x]</exemplarCharacters>
<exemplarCharacters type="index">[A B C D E F H I J K L M N O P Q S T U V W Y Z]</exemplarCharacters>
</characters>
<delimiters>
<quotationStart>“</quotationStart>
<quotationEnd>”</quotationEnd>
<alternateQuotationStart>‘</alternateQuotationStart>
<alternateQuotationEnd>’</alternateQuotationEnd>
</delimiters>
<dates>
<calendars>
<calendar type="gregorian">
<months>
<monthContext type="format">
<monthWidth type="abbreviated">
<month type="1">Cio</month>
<month type="2">Lui</month>
<month type="3">Lus</month>
<month type="4">Muu</month>
<month type="5">Lum</month>
<month type="6">Luf</month>
<month type="7">Kab</month>
<month type="8">Lush</month>
<month type="9">Lut</month>
<month type="10">Lun</month>
<month type="11">Kas</month>
<month type="12">Cis</month>
</monthWidth>
<monthWidth type="wide">
<month type="1">Ciongo</month>
<month type="2">Lùishi</month>
<month type="3">Lusòlo</month>
<month type="4">Mùuyà</month>
<month type="5">Lumùngùlù</month>
<month type="6">Lufuimi</month>
<month type="7">Kabàlàshìpù</month>
<month type="8">Lùshìkà</month>
<month type="9">Lutongolo</month>
<month type="10">Lungùdi</month>
<month type="11">Kaswèkèsè</month>
<month type="12">Ciswà</month>
</monthWidth>
</monthContext>
<monthContext type="stand-alone">
<monthWidth type="narrow">
<month type="1">C</month>
<month type="2">L</month>
<month type="3">L</month>
<month type="4">M</month>
<month type="5">L</month>
<month type="6">L</month>
<month type="7">K</month>
<month type="8">L</month>
<month type="9">L</month>
<month type="10">L</month>
<month type="11">K</month>
<month type="12">C</month>
</monthWidth>
</monthContext>
</months>
<days>
<dayContext type="format">
<dayWidth type="abbreviated">
<day type="sun">Lum</day>
<day type="mon">Nko</day>
<day type="tue">Ndy</day>
<day type="wed">Ndg</day>
<day type="thu">Njw</day>
<day type="fri">Ngv</day>
<day type="sat">Lub</day>
</dayWidth>
<dayWidth type="wide">
<day type="sun">Lumingu</day>
<day type="mon">Nkodya</day>
<day type="tue">Ndàayà</day>
<day type="wed">Ndangù</day>
<day type="thu">Njòwa</day>
<day type="fri">Ngòvya</day>
<day type="sat">Lubingu</day>
</dayWidth>
</dayContext>
<dayContext type="stand-alone">
<dayWidth type="narrow">
<day type="sun">L</day>
<day type="mon">N</day>
<day type="tue">N</day>
<day type="wed">N</day>
<day type="thu">N</day>
<day type="fri">N</day>
<day type="sat">L</day>
</dayWidth>
</dayContext>
</days>
<quarters>
<quarterContext type="format">
<quarterWidth type="abbreviated">
<quarter type="1">M1</quarter>
<quarter type="2">M2</quarter>
<quarter type="3">M3</quarter>
<quarter type="4">M4</quarter>
</quarterWidth>
<quarterWidth type="wide">
<quarter type="1">Mueji 1</quarter>
<quarter type="2">Mueji 2</quarter>
<quarter type="3">Mueji 3</quarter>
<quarter type="4">Mueji 4</quarter>
</quarterWidth>
</quarterContext>
</quarters>
<dayPeriods>
<dayPeriodContext type="format">
<dayPeriodWidth type="wide">
<dayPeriod type="am">Dinda</dayPeriod>
<dayPeriod type="pm">Dilolo</dayPeriod>
</dayPeriodWidth>
</dayPeriodContext>
</dayPeriods>
<eras>
<eraNames>
<era type="0">Kumpala kwa Yezu Kli</era>
<era type="1">Kunyima kwa Yezu Kli</era>
</eraNames>
<eraAbbr>
<era type="0">kmp. Y.K.</era>
<era type="1">kny. Y. K.</era>
</eraAbbr>
</eras>
<dateFormats>
<dateFormatLength type="full">
<dateFormat>
<pattern>EEEE d MMMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="long">
<dateFormat>
<pattern>d MMMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="medium">
<dateFormat>
<pattern>d MMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="short">
<dateFormat>
<pattern>d/M/yyyy</pattern>
</dateFormat>
</dateFormatLength>
</dateFormats>
<timeFormats>
<timeFormatLength type="full">
<timeFormat>
<pattern>HH:mm:ss zzzz</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="long">
<timeFormat>
<pattern>HH:mm:ss z</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="medium">
<timeFormat>
<pattern>HH:mm:ss</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="short">
<timeFormat>
<pattern>HH:mm</pattern>
</timeFormat>
</timeFormatLength>
</timeFormats>
<dateTimeFormats>
<availableFormats>
<dateFormatItem id="d">d</dateFormatItem>
<dateFormatItem id="Ed">E d</dateFormatItem>
<dateFormatItem id="hm">h:mm a</dateFormatItem>
<dateFormatItem id="Hm">HH:mm</dateFormatItem>
<dateFormatItem id="hms">h:mm:ss a</dateFormatItem>
<dateFormatItem id="Hms">HH:mm:ss</dateFormatItem>
<dateFormatItem id="M">L</dateFormatItem>
<dateFormatItem id="Md">d/M</dateFormatItem>
<dateFormatItem id="MEd">E d/M</dateFormatItem>
<dateFormatItem id="MMM">LLL</dateFormatItem>
<dateFormatItem id="MMMd">d MMM</dateFormatItem>
<dateFormatItem id="MMMEd">E d MMM</dateFormatItem>
<dateFormatItem id="ms">m:ss</dateFormatItem>
<dateFormatItem id="y">y</dateFormatItem>
<dateFormatItem id="yM">M/y</dateFormatItem>
<dateFormatItem id="yMd">d/M/y</dateFormatItem>
<dateFormatItem id="yMEd">E d/M/y</dateFormatItem>
<dateFormatItem id="yMMM">MMM y</dateFormatItem>
<dateFormatItem id="yMMMd">d MMM y</dateFormatItem>
<dateFormatItem id="yMMMEd">E d MMM y</dateFormatItem>
<dateFormatItem id="yQ">Q y</dateFormatItem>
<dateFormatItem id="yQQQ">QQQ y</dateFormatItem>
</availableFormats>
</dateTimeFormats>
<fields>
<field type="era">
<displayName>Tshipungu</displayName>
</field>
<field type="year">
<displayName>Tshidimu</displayName>
</field>
<field type="month">
<displayName>Ngondo</displayName>
</field>
<field type="week">
<displayName>Lubingu</displayName>
</field>
<field type="day">
<displayName>Dituku</displayName>
<relative type="-1">Makelela</relative>
<relative type="0">Lelu</relative>
<relative type="1">Malaba</relative>
</field>
<field type="weekday">
<displayName>Dituku dia lubingu</displayName>
</field>
<field type="dayperiod">
<displayName>Mutantshi wa diba</displayName>
</field>
<field type="hour">
<displayName>Diba</displayName>
</field>
<field type="minute">
<displayName>Kasunsu</displayName>
</field>
<field type="second">
<displayName>Kasunsukusu</displayName>
</field>
<field type="zone">
<displayName>Nzeepu</displayName>
</field>
</fields>
</calendar>
</calendars>
</dates>
<numbers>
<symbols numberSystem="latn">
<decimal>,</decimal>
<group>.</group>
</symbols>
<decimalFormats numberSystem="latn">
<decimalFormatLength>
<decimalFormat>
<pattern>#,##0.###</pattern>
</decimalFormat>
</decimalFormatLength>
</decimalFormats>
<currencyFormats numberSystem="latn">
<currencyFormatLength>
<currencyFormat>
<pattern>#,##0.00¤</pattern>
</currencyFormat>
</currencyFormatLength>
</currencyFormats>
<currencies>
<currency type="AED">
<displayName>Ndiriha wa Lemila alabu</displayName>
</currency>
<currency type="AOA">
<displayName>Kwanza wa Angola</displayName>
</currency>
<currency type="AUD">
<displayName>Ndola wa Ositali</displayName>
</currency>
<currency type="BHD">
<displayName>Ndina wa Bahrene</displayName>
</currency>
<currency type="BIF">
<displayName>Nfalanga wa Bulundi</displayName>
</currency>
<currency type="BWP">
<displayName>Pula wa Botswana</displayName>
</currency>
<currency type="CAD">
<displayName>Ndola wa Kanada</displayName>
</currency>
<currency type="CDF">
<displayName>Nfalanga wa Kongu</displayName>
</currency>
<currency type="CHF">
<displayName>Nfalanga wa Swise</displayName>
</currency>
<currency type="CNY">
<displayName>Yuani Renminbi wa Shine</displayName>
</currency>
<currency type="CVE">
<displayName>Esikuludo wa Kapevere</displayName>
</currency>
<currency type="DJF">
<displayName>Nfalanga wa Dzibuti</displayName>
</currency>
<currency type="DZD">
<displayName>Ndina wa Alijeri</displayName>
</currency>
<currency type="EGP">
<displayName>Pauni wa Mushidi</displayName>
</currency>
<currency type="ERN">
<displayName>Nakfa wa Elitle</displayName>
</currency>
<currency type="ETB">
<displayName>Bira wa Etshiopi</displayName>
</currency>
<currency type="EUR">
<displayName>Iro</displayName>
</currency>
<currency type="GBP">
<displayName>Pauni wa Angeletele</displayName>
</currency>
<currency type="GHC">
<displayName>Sedi wa Ngana</displayName>
</currency>
<currency type="GMD">
<displayName>Ndalasi wa Ngambi</displayName>
</currency>
<currency type="GNS">
<displayName>Nfalanga wa Ngina</displayName>
</currency>
<currency type="INR">
<displayName>Rupi wa Inde</displayName>
</currency>
<currency type="JPY">
<displayName>Yeni wa Zapɔ</displayName>
</currency>
<currency type="KES">
<displayName>Nshili wa Kenya</displayName>
</currency>
<currency type="KMF">
<displayName>Nfalanga wa Komoru</displayName>
</currency>
<currency type="LRD">
<displayName>Ndola wa Liberya</displayName>
</currency>
<currency type="LSL">
<displayName>Loti wa Lesoto</displayName>
</currency>
<currency type="LYD">
<displayName>Ndina wa Libi</displayName>
</currency>
<currency type="MAD">
<displayName>Ndiriha wa Maroke</displayName>
</currency>
<currency type="MGA">
<displayName>Nfalanga wa Madagasikare</displayName>
</currency>
<currency type="MRO">
<displayName>Ugwiya wa Moritani</displayName>
</currency>
<currency type="MUR">
<displayName>Rupia wa Morisi</displayName>
</currency>
<currency type="MWK">
<displayName>Kwasha wa Malawi</displayName>
</currency>
<currency type="MZM">
<displayName>Metikali wa Mozambiki</displayName>
</currency>
<currency type="NAD">
<displayName>Ndola wa Namibi</displayName>
</currency>
<currency type="NGN">
<displayName>Naira wa Nizerya</displayName>
</currency>
<currency type="RWF">
<displayName>Nfalanga wa Rwanda</displayName>
</currency>
<currency type="SAR">
<displayName>Riyale wa Alabu Nsawu</displayName>
</currency>
<currency type="SCR">
<displayName>Rupya wa Seshele</displayName>
</currency>
<currency type="SDG">
<displayName>Ndina wa Suda</displayName>
</currency>
<currency type="SDP">
<displayName>Pauni wa Suda</displayName>
</currency>
<currency type="SHP">
<displayName>Pauni wa Santu Elena</displayName>
</currency>
<currency type="SLL">
<displayName>Leone</displayName>
</currency>
<currency type="SOS">
<displayName>Nshili wa Somali</displayName>
</currency>
<currency type="STD">
<displayName>Dobra wa Sao Tome ne Presipe</displayName>
</currency>
<currency type="SZL">
<displayName>Lilangeni</displayName>
</currency>
<currency type="TND">
<displayName>Ndina wa Tinizi</displayName>
</currency>
<currency type="TZS">
<displayName>Nshili wa Tanzani</displayName>
</currency>
<currency type="UGX">
<displayName>Nshili wa Uganda</displayName>
</currency>
<currency type="USD">
<displayName>Ndola wa Ameriki</displayName>
</currency>
<currency type="XAF">
<displayName>Nfalanga CFA BEAC</displayName>
</currency>
<currency type="XOF">
<displayName>Nfalanga CFA BCEAO</displayName>
</currency>
<currency type="ZAR">
<displayName>Rande wa Afrika wa Mwinshi</displayName>
</currency>
<currency type="ZMK">
<displayName>Kwasha wa Zambi</displayName>
</currency>
<currency type="ZWD">
<displayName>Ndola wa Zimbabwe</displayName>
</currency>
</currencies>
</numbers>
<posix>
<messages>
<yesstr>Eyo:E</yesstr>
<nostr>To:T</nostr>
</messages>
</posix>
</ldml>
|
{
"pile_set_name": "Github"
}
|
package: fishtrip.cn/watchman
import:
- package: github.com/streadway/amqp
- package: gopkg.in/yaml.v2
- package: github.com/satori/go.uuid
version: ^1.1.0
|
{
"pile_set_name": "Github"
}
|
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
class TreeView::ContentComponent : public Component,
public TooltipClient,
public AsyncUpdater
{
public:
ContentComponent (TreeView& tree) : owner (tree)
{
}
void mouseDown (const MouseEvent& e) override
{
updateButtonUnderMouse (e);
isDragging = false;
needSelectionOnMouseUp = false;
Rectangle<int> pos;
if (auto* item = findItemAt (e.y, pos))
{
if (isEnabled())
{
// (if the open/close buttons are hidden, we'll treat clicks to the left of the item
// as selection clicks)
if (e.x < pos.getX() && owner.openCloseButtonsVisible)
{
if (e.x >= pos.getX() - owner.getIndentSize())
item->setOpen (! item->isOpen());
// (clicks to the left of an open/close button are ignored)
}
else
{
// mouse-down inside the body of the item..
if (! owner.isMultiSelectEnabled())
item->setSelected (true, true);
else if (item->isSelected())
needSelectionOnMouseUp = ! e.mods.isPopupMenu();
else
selectBasedOnModifiers (item, e.mods);
if (e.x >= pos.getX())
item->itemClicked (e.withNewPosition (e.position - pos.getPosition().toFloat()));
}
}
}
}
void mouseUp (const MouseEvent& e) override
{
updateButtonUnderMouse (e);
if (needSelectionOnMouseUp && e.mouseWasClicked() && isEnabled())
{
Rectangle<int> pos;
if (auto* item = findItemAt (e.y, pos))
selectBasedOnModifiers (item, e.mods);
}
}
void mouseDoubleClick (const MouseEvent& e) override
{
if (e.getNumberOfClicks() != 3 && isEnabled()) // ignore triple clicks
{
Rectangle<int> pos;
if (auto* item = findItemAt (e.y, pos))
if (e.x >= pos.getX() || ! owner.openCloseButtonsVisible)
item->itemDoubleClicked (e.withNewPosition (e.position - pos.getPosition().toFloat()));
}
}
void mouseDrag (const MouseEvent& e) override
{
if (isEnabled()
&& ! (isDragging || e.mouseWasClicked()
|| e.getDistanceFromDragStart() < 5
|| e.mods.isPopupMenu()))
{
isDragging = true;
Rectangle<int> pos;
if (auto* item = findItemAt (e.getMouseDownY(), pos))
{
if (e.getMouseDownX() >= pos.getX())
{
auto dragDescription = item->getDragSourceDescription();
if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
{
if (auto* dragContainer = DragAndDropContainer::findParentDragContainerFor (this))
{
pos.setSize (pos.getWidth(), item->itemHeight);
Image dragImage (Component::createComponentSnapshot (pos, true));
dragImage.multiplyAllAlphas (0.6f);
auto imageOffset = pos.getPosition() - e.getPosition();
dragContainer->startDragging (dragDescription, &owner, dragImage, true, &imageOffset, &e.source);
}
else
{
// to be able to do a drag-and-drop operation, the treeview needs to
// be inside a component which is also a DragAndDropContainer.
jassertfalse;
}
}
}
}
}
}
void mouseMove (const MouseEvent& e) override { updateButtonUnderMouse (e); }
void mouseExit (const MouseEvent& e) override { updateButtonUnderMouse (e); }
void paint (Graphics& g) override
{
if (owner.rootItem != nullptr)
{
owner.recalculateIfNeeded();
if (! owner.rootItemVisible)
g.setOrigin (0, -owner.rootItem->itemHeight);
owner.rootItem->paintRecursively (g, getWidth());
}
}
TreeViewItem* findItemAt (int y, Rectangle<int>& itemPosition) const
{
if (owner.rootItem != nullptr)
{
owner.recalculateIfNeeded();
if (! owner.rootItemVisible)
y += owner.rootItem->itemHeight;
if (auto* ti = owner.rootItem->findItemRecursively (y))
{
itemPosition = ti->getItemPosition (false);
return ti;
}
}
return nullptr;
}
void updateComponents()
{
auto visibleTop = -getY();
auto visibleBottom = visibleTop + getParentHeight();
for (auto* i : items)
i->shouldKeep = false;
{
auto* item = owner.rootItem;
int y = (item != nullptr && ! owner.rootItemVisible) ? -item->itemHeight : 0;
while (item != nullptr && y < visibleBottom)
{
y += item->itemHeight;
if (y >= visibleTop)
{
if (auto* ri = findItem (item->uid))
{
ri->shouldKeep = true;
}
else if (auto* comp = item->createItemComponent())
{
items.add (new RowItem (item, comp, item->uid));
addAndMakeVisible (comp);
}
}
item = item->getNextVisibleItem (true);
}
}
for (int i = items.size(); --i >= 0;)
{
auto* ri = items.getUnchecked(i);
bool keep = false;
if (isParentOf (ri->component))
{
if (ri->shouldKeep)
{
auto pos = ri->item->getItemPosition (false);
pos.setSize (pos.getWidth(), ri->item->itemHeight);
if (pos.getBottom() >= visibleTop && pos.getY() < visibleBottom)
{
keep = true;
ri->component->setBounds (pos);
}
}
if ((! keep) && isMouseDraggingInChildCompOf (ri->component))
{
keep = true;
ri->component->setSize (0, 0);
}
}
if (! keep)
items.remove (i);
}
}
bool isMouseOverButton (TreeViewItem* item) const noexcept
{
return item == buttonUnderMouse;
}
void resized() override
{
owner.itemsChanged();
}
String getTooltip() override
{
Rectangle<int> pos;
if (auto* item = findItemAt (getMouseXYRelative().y, pos))
return item->getTooltip();
return owner.getTooltip();
}
private:
//==============================================================================
TreeView& owner;
struct RowItem
{
RowItem (TreeViewItem* it, Component* c, int itemUID)
: component (c), item (it), uid (itemUID)
{
}
~RowItem()
{
delete component.get();
}
WeakReference<Component> component;
TreeViewItem* item;
int uid;
bool shouldKeep = true;
};
OwnedArray<RowItem> items;
TreeViewItem* buttonUnderMouse = nullptr;
bool isDragging = false, needSelectionOnMouseUp = false;
void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys modifiers)
{
TreeViewItem* firstSelected = nullptr;
if (modifiers.isShiftDown() && ((firstSelected = owner.getSelectedItem (0)) != nullptr))
{
auto* lastSelected = owner.getSelectedItem (owner.getNumSelectedItems() - 1);
jassert (lastSelected != nullptr);
auto rowStart = firstSelected->getRowNumberInTree();
auto rowEnd = lastSelected->getRowNumberInTree();
if (rowStart > rowEnd)
std::swap (rowStart, rowEnd);
auto ourRow = item->getRowNumberInTree();
auto otherEnd = ourRow < rowEnd ? rowStart : rowEnd;
if (ourRow > otherEnd)
std::swap (ourRow, otherEnd);
for (int i = ourRow; i <= otherEnd; ++i)
owner.getItemOnRow (i)->setSelected (true, false);
}
else
{
const bool cmd = modifiers.isCommandDown();
item->setSelected ((! cmd) || ! item->isSelected(), ! cmd);
}
}
bool containsItem (TreeViewItem* const item) const noexcept
{
for (auto* i : items)
if (i->item == item)
return true;
return false;
}
RowItem* findItem (const int uid) const noexcept
{
for (auto* i : items)
if (i->uid == uid)
return i;
return nullptr;
}
void updateButtonUnderMouse (const MouseEvent& e)
{
TreeViewItem* newItem = nullptr;
if (owner.openCloseButtonsVisible)
{
Rectangle<int> pos;
if (auto* item = findItemAt (e.y, pos))
{
if (e.x < pos.getX() && e.x >= pos.getX() - owner.getIndentSize())
{
newItem = item;
if (! newItem->mightContainSubItems())
newItem = nullptr;
}
}
}
if (buttonUnderMouse != newItem)
{
repaintButtonUnderMouse();
buttonUnderMouse = newItem;
repaintButtonUnderMouse();
}
}
void repaintButtonUnderMouse()
{
if (buttonUnderMouse != nullptr && containsItem (buttonUnderMouse))
{
auto r = buttonUnderMouse->getItemPosition (false);
repaint (0, r.getY(), r.getX(), buttonUnderMouse->getItemHeight());
}
}
static bool isMouseDraggingInChildCompOf (Component* const comp)
{
for (auto& ms : Desktop::getInstance().getMouseSources())
if (ms.isDragging())
if (auto* underMouse = ms.getComponentUnderMouse())
if (comp == underMouse || comp->isParentOf (underMouse))
return true;
return false;
}
void handleAsyncUpdate() override
{
owner.recalculateIfNeeded();
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ContentComponent)
};
//==============================================================================
class TreeView::TreeViewport : public Viewport
{
public:
TreeViewport() noexcept {}
void updateComponents (const bool triggerResize)
{
if (auto* tvc = getContentComp())
{
if (triggerResize)
tvc->resized();
else
tvc->updateComponents();
}
repaint();
}
void visibleAreaChanged (const Rectangle<int>& newVisibleArea) override
{
const bool hasScrolledSideways = (newVisibleArea.getX() != lastX);
lastX = newVisibleArea.getX();
updateComponents (hasScrolledSideways);
}
ContentComponent* getContentComp() const noexcept
{
return static_cast<ContentComponent*> (getViewedComponent());
}
bool keyPressed (const KeyPress& key) override
{
if (auto* tree = getParentComponent())
if (tree->keyPressed (key))
return true;
return Viewport::keyPressed (key);
}
private:
int lastX = -1;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TreeViewport)
};
//==============================================================================
TreeView::TreeView (const String& name)
: Component (name),
viewport (new TreeViewport())
{
addAndMakeVisible (viewport.get());
viewport->setViewedComponent (new ContentComponent (*this));
setWantsKeyboardFocus (true);
}
TreeView::~TreeView()
{
if (rootItem != nullptr)
rootItem->setOwnerView (nullptr);
}
void TreeView::setRootItem (TreeViewItem* const newRootItem)
{
if (rootItem != newRootItem)
{
if (newRootItem != nullptr)
{
jassert (newRootItem->ownerView == nullptr); // can't use a tree item in more than one tree at once..
if (newRootItem->ownerView != nullptr)
newRootItem->ownerView->setRootItem (nullptr);
}
if (rootItem != nullptr)
rootItem->setOwnerView (nullptr);
rootItem = newRootItem;
if (newRootItem != nullptr)
newRootItem->setOwnerView (this);
needsRecalculating = true;
recalculateIfNeeded();
if (rootItem != nullptr && (defaultOpenness || ! rootItemVisible))
{
rootItem->setOpen (false); // force a re-open
rootItem->setOpen (true);
}
}
}
void TreeView::deleteRootItem()
{
const std::unique_ptr<TreeViewItem> deleter (rootItem);
setRootItem (nullptr);
}
void TreeView::setRootItemVisible (const bool shouldBeVisible)
{
rootItemVisible = shouldBeVisible;
if (rootItem != nullptr && (defaultOpenness || ! rootItemVisible))
{
rootItem->setOpen (false); // force a re-open
rootItem->setOpen (true);
}
itemsChanged();
}
void TreeView::colourChanged()
{
setOpaque (findColour (backgroundColourId).isOpaque());
repaint();
}
void TreeView::setIndentSize (const int newIndentSize)
{
if (indentSize != newIndentSize)
{
indentSize = newIndentSize;
resized();
}
}
int TreeView::getIndentSize() noexcept
{
return indentSize >= 0 ? indentSize
: getLookAndFeel().getTreeViewIndentSize (*this);
}
void TreeView::setDefaultOpenness (const bool isOpenByDefault)
{
if (defaultOpenness != isOpenByDefault)
{
defaultOpenness = isOpenByDefault;
itemsChanged();
}
}
void TreeView::setMultiSelectEnabled (const bool canMultiSelect)
{
multiSelectEnabled = canMultiSelect;
}
void TreeView::setOpenCloseButtonsVisible (const bool shouldBeVisible)
{
if (openCloseButtonsVisible != shouldBeVisible)
{
openCloseButtonsVisible = shouldBeVisible;
itemsChanged();
}
}
Viewport* TreeView::getViewport() const noexcept
{
return viewport.get();
}
//==============================================================================
void TreeView::clearSelectedItems()
{
if (rootItem != nullptr)
rootItem->deselectAllRecursively (nullptr);
}
int TreeView::getNumSelectedItems (int maximumDepthToSearchTo) const noexcept
{
return rootItem != nullptr ? rootItem->countSelectedItemsRecursively (maximumDepthToSearchTo) : 0;
}
TreeViewItem* TreeView::getSelectedItem (const int index) const noexcept
{
return rootItem != nullptr ? rootItem->getSelectedItemWithIndex (index) : nullptr;
}
int TreeView::getNumRowsInTree() const
{
return rootItem != nullptr ? (rootItem->getNumRows() - (rootItemVisible ? 0 : 1)) : 0;
}
TreeViewItem* TreeView::getItemOnRow (int index) const
{
if (! rootItemVisible)
++index;
if (rootItem != nullptr && index >= 0)
return rootItem->getItemOnRow (index);
return nullptr;
}
TreeViewItem* TreeView::getItemAt (int y) const noexcept
{
auto tc = viewport->getContentComp();
Rectangle<int> pos;
return tc->findItemAt (tc->getLocalPoint (this, Point<int> (0, y)).y, pos);
}
TreeViewItem* TreeView::findItemFromIdentifierString (const String& identifierString) const
{
if (rootItem == nullptr)
return nullptr;
return rootItem->findItemFromIdentifierString (identifierString);
}
//==============================================================================
static void addAllSelectedItemIds (TreeViewItem* item, XmlElement& parent)
{
if (item->isSelected())
parent.createNewChildElement ("SELECTED")->setAttribute ("id", item->getItemIdentifierString());
auto numSubItems = item->getNumSubItems();
for (int i = 0; i < numSubItems; ++i)
addAllSelectedItemIds (item->getSubItem(i), parent);
}
std::unique_ptr<XmlElement> TreeView::getOpennessState (bool alsoIncludeScrollPosition) const
{
std::unique_ptr<XmlElement> e;
if (rootItem != nullptr)
{
e.reset (rootItem->getOpennessState (false));
if (e != nullptr)
{
if (alsoIncludeScrollPosition)
e->setAttribute ("scrollPos", viewport->getViewPositionY());
addAllSelectedItemIds (rootItem, *e);
}
}
return e;
}
void TreeView::restoreOpennessState (const XmlElement& newState, const bool restoreStoredSelection)
{
if (rootItem != nullptr)
{
rootItem->restoreOpennessState (newState);
needsRecalculating = true;
recalculateIfNeeded();
if (newState.hasAttribute ("scrollPos"))
viewport->setViewPosition (viewport->getViewPositionX(),
newState.getIntAttribute ("scrollPos"));
if (restoreStoredSelection)
{
clearSelectedItems();
forEachXmlChildElementWithTagName (newState, e, "SELECTED")
if (auto* item = rootItem->findItemFromIdentifierString (e->getStringAttribute ("id")))
item->setSelected (true, false);
}
}
}
//==============================================================================
void TreeView::paint (Graphics& g)
{
g.fillAll (findColour (backgroundColourId));
}
void TreeView::resized()
{
viewport->setBounds (getLocalBounds());
itemsChanged();
recalculateIfNeeded();
}
void TreeView::enablementChanged()
{
repaint();
}
void TreeView::moveSelectedRow (const int delta)
{
auto numRowsInTree = getNumRowsInTree();
if (numRowsInTree > 0)
{
int rowSelected = 0;
if (auto* firstSelected = getSelectedItem (0))
rowSelected = firstSelected->getRowNumberInTree();
rowSelected = jlimit (0, numRowsInTree - 1, rowSelected + delta);
for (;;)
{
if (auto* item = getItemOnRow (rowSelected))
{
if (! item->canBeSelected())
{
// if the row we want to highlight doesn't allow it, try skipping
// to the next item..
auto nextRowToTry = jlimit (0, numRowsInTree - 1, rowSelected + (delta < 0 ? -1 : 1));
if (rowSelected != nextRowToTry)
{
rowSelected = nextRowToTry;
continue;
}
break;
}
item->setSelected (true, true);
scrollToKeepItemVisible (item);
}
break;
}
}
}
void TreeView::scrollToKeepItemVisible (TreeViewItem* item)
{
if (item != nullptr && item->ownerView == this)
{
recalculateIfNeeded();
item = item->getDeepestOpenParentItem();
auto y = item->y;
auto viewTop = viewport->getViewPositionY();
if (y < viewTop)
{
viewport->setViewPosition (viewport->getViewPositionX(), y);
}
else if (y + item->itemHeight > viewTop + viewport->getViewHeight())
{
viewport->setViewPosition (viewport->getViewPositionX(),
(y + item->itemHeight) - viewport->getViewHeight());
}
}
}
bool TreeView::toggleOpenSelectedItem()
{
if (auto* firstSelected = getSelectedItem (0))
{
if (firstSelected->mightContainSubItems())
{
firstSelected->setOpen (! firstSelected->isOpen());
return true;
}
}
return false;
}
void TreeView::moveOutOfSelectedItem()
{
if (auto* firstSelected = getSelectedItem (0))
{
if (firstSelected->isOpen())
{
firstSelected->setOpen (false);
}
else
{
auto* parent = firstSelected->parentItem;
if ((! rootItemVisible) && parent == rootItem)
parent = nullptr;
if (parent != nullptr)
{
parent->setSelected (true, true);
scrollToKeepItemVisible (parent);
}
}
}
}
void TreeView::moveIntoSelectedItem()
{
if (auto* firstSelected = getSelectedItem (0))
{
if (firstSelected->isOpen() || ! firstSelected->mightContainSubItems())
moveSelectedRow (1);
else
firstSelected->setOpen (true);
}
}
void TreeView::moveByPages (int numPages)
{
if (auto* currentItem = getSelectedItem (0))
{
auto pos = currentItem->getItemPosition (false);
auto targetY = pos.getY() + numPages * (getHeight() - pos.getHeight());
auto currentRow = currentItem->getRowNumberInTree();
for (;;)
{
moveSelectedRow (numPages);
currentItem = getSelectedItem (0);
if (currentItem == nullptr)
break;
auto y = currentItem->getItemPosition (false).getY();
if ((numPages < 0 && y <= targetY) || (numPages > 0 && y >= targetY))
break;
auto newRow = currentItem->getRowNumberInTree();
if (newRow == currentRow)
break;
currentRow = newRow;
}
}
}
bool TreeView::keyPressed (const KeyPress& key)
{
if (rootItem != nullptr)
{
if (key == KeyPress::upKey) { moveSelectedRow (-1); return true; }
if (key == KeyPress::downKey) { moveSelectedRow (1); return true; }
if (key == KeyPress::homeKey) { moveSelectedRow (-0x3fffffff); return true; }
if (key == KeyPress::endKey) { moveSelectedRow (0x3fffffff); return true; }
if (key == KeyPress::pageUpKey) { moveByPages (-1); return true; }
if (key == KeyPress::pageDownKey) { moveByPages (1); return true; }
if (key == KeyPress::returnKey) { return toggleOpenSelectedItem(); }
if (key == KeyPress::leftKey) { moveOutOfSelectedItem(); return true; }
if (key == KeyPress::rightKey) { moveIntoSelectedItem(); return true; }
}
return false;
}
void TreeView::itemsChanged() noexcept
{
needsRecalculating = true;
repaint();
viewport->getContentComp()->triggerAsyncUpdate();
}
void TreeView::recalculateIfNeeded()
{
if (needsRecalculating)
{
needsRecalculating = false;
const ScopedLock sl (nodeAlterationLock);
if (rootItem != nullptr)
rootItem->updatePositions (rootItemVisible ? 0 : -rootItem->itemHeight);
viewport->updateComponents (false);
if (rootItem != nullptr)
{
viewport->getViewedComponent()
->setSize (jmax (viewport->getMaximumVisibleWidth(), rootItem->totalWidth + 50),
rootItem->totalHeight - (rootItemVisible ? 0 : rootItem->itemHeight));
}
else
{
viewport->getViewedComponent()->setSize (0, 0);
}
}
}
//==============================================================================
struct TreeView::InsertPoint
{
InsertPoint (TreeView& view, const StringArray& files,
const DragAndDropTarget::SourceDetails& dragSourceDetails)
: pos (dragSourceDetails.localPosition),
item (view.getItemAt (dragSourceDetails.localPosition.y))
{
if (item != nullptr)
{
auto itemPos = item->getItemPosition (true);
insertIndex = item->getIndexInParent();
auto oldY = pos.y;
pos.y = itemPos.getY();
if (item->getNumSubItems() == 0 || ! item->isOpen())
{
if (files.size() > 0 ? item->isInterestedInFileDrag (files)
: item->isInterestedInDragSource (dragSourceDetails))
{
// Check if we're trying to drag into an empty group item..
if (oldY > itemPos.getY() + itemPos.getHeight() / 4
&& oldY < itemPos.getBottom() - itemPos.getHeight() / 4)
{
insertIndex = 0;
pos.x = itemPos.getX() + view.getIndentSize();
pos.y = itemPos.getBottom();
return;
}
}
}
if (oldY > itemPos.getCentreY())
{
pos.y += item->getItemHeight();
while (item->isLastOfSiblings() && item->getParentItem() != nullptr
&& item->getParentItem()->getParentItem() != nullptr)
{
if (pos.x > itemPos.getX())
break;
item = item->getParentItem();
itemPos = item->getItemPosition (true);
insertIndex = item->getIndexInParent();
}
++insertIndex;
}
pos.x = itemPos.getX();
item = item->getParentItem();
}
else if (auto* root = view.getRootItem())
{
// If they're dragging beyond the bottom of the list, then insert at the end of the root item..
item = root;
insertIndex = root->getNumSubItems();
pos = root->getItemPosition (true).getBottomLeft();
pos.x += view.getIndentSize();
}
}
Point<int> pos;
TreeViewItem* item;
int insertIndex = 0;
};
//==============================================================================
class TreeView::InsertPointHighlight : public Component
{
public:
InsertPointHighlight()
{
setSize (100, 12);
setAlwaysOnTop (true);
setInterceptsMouseClicks (false, false);
}
void setTargetPosition (const InsertPoint& insertPos, const int width) noexcept
{
lastItem = insertPos.item;
lastIndex = insertPos.insertIndex;
auto offset = getHeight() / 2;
setBounds (insertPos.pos.x - offset, insertPos.pos.y - offset,
width - (insertPos.pos.x - offset), getHeight());
}
void paint (Graphics& g) override
{
Path p;
auto h = (float) getHeight();
p.addEllipse (2.0f, 2.0f, h - 4.0f, h - 4.0f);
p.startNewSubPath (h - 2.0f, h / 2.0f);
p.lineTo ((float) getWidth(), h / 2.0f);
g.setColour (findColour (TreeView::dragAndDropIndicatorColourId, true));
g.strokePath (p, PathStrokeType (2.0f));
}
TreeViewItem* lastItem = nullptr;
int lastIndex = 0;
private:
JUCE_DECLARE_NON_COPYABLE (InsertPointHighlight)
};
//==============================================================================
class TreeView::TargetGroupHighlight : public Component
{
public:
TargetGroupHighlight()
{
setAlwaysOnTop (true);
setInterceptsMouseClicks (false, false);
}
void setTargetPosition (TreeViewItem* const item) noexcept
{
setBounds (item->getItemPosition (true)
.withHeight (item->getItemHeight()));
}
void paint (Graphics& g) override
{
g.setColour (findColour (TreeView::dragAndDropIndicatorColourId, true));
g.drawRoundedRectangle (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 3.0f, 2.0f);
}
private:
JUCE_DECLARE_NON_COPYABLE (TargetGroupHighlight)
};
//==============================================================================
void TreeView::showDragHighlight (const InsertPoint& insertPos) noexcept
{
beginDragAutoRepeat (100);
if (dragInsertPointHighlight == nullptr)
{
dragInsertPointHighlight.reset (new InsertPointHighlight());
dragTargetGroupHighlight.reset (new TargetGroupHighlight());
addAndMakeVisible (dragInsertPointHighlight.get());
addAndMakeVisible (dragTargetGroupHighlight.get());
}
dragInsertPointHighlight->setTargetPosition (insertPos, viewport->getViewWidth());
dragTargetGroupHighlight->setTargetPosition (insertPos.item);
}
void TreeView::hideDragHighlight() noexcept
{
dragInsertPointHighlight.reset();
dragTargetGroupHighlight.reset();
}
void TreeView::handleDrag (const StringArray& files, const SourceDetails& dragSourceDetails)
{
const bool scrolled = viewport->autoScroll (dragSourceDetails.localPosition.x,
dragSourceDetails.localPosition.y, 20, 10);
InsertPoint insertPos (*this, files, dragSourceDetails);
if (insertPos.item != nullptr)
{
if (scrolled || dragInsertPointHighlight == nullptr
|| dragInsertPointHighlight->lastItem != insertPos.item
|| dragInsertPointHighlight->lastIndex != insertPos.insertIndex)
{
if (files.size() > 0 ? insertPos.item->isInterestedInFileDrag (files)
: insertPos.item->isInterestedInDragSource (dragSourceDetails))
showDragHighlight (insertPos);
else
hideDragHighlight();
}
}
else
{
hideDragHighlight();
}
}
void TreeView::handleDrop (const StringArray& files, const SourceDetails& dragSourceDetails)
{
hideDragHighlight();
InsertPoint insertPos (*this, files, dragSourceDetails);
if (insertPos.item == nullptr)
insertPos.item = rootItem;
if (insertPos.item != nullptr)
{
if (files.size() > 0)
{
if (insertPos.item->isInterestedInFileDrag (files))
insertPos.item->filesDropped (files, insertPos.insertIndex);
}
else
{
if (insertPos.item->isInterestedInDragSource (dragSourceDetails))
insertPos.item->itemDropped (dragSourceDetails, insertPos.insertIndex);
}
}
}
//==============================================================================
bool TreeView::isInterestedInFileDrag (const StringArray&)
{
return true;
}
void TreeView::fileDragEnter (const StringArray& files, int x, int y)
{
fileDragMove (files, x, y);
}
void TreeView::fileDragMove (const StringArray& files, int x, int y)
{
handleDrag (files, SourceDetails (var(), this, { x, y }));
}
void TreeView::fileDragExit (const StringArray&)
{
hideDragHighlight();
}
void TreeView::filesDropped (const StringArray& files, int x, int y)
{
handleDrop (files, SourceDetails (var(), this, { x, y }));
}
bool TreeView::isInterestedInDragSource (const SourceDetails& /*dragSourceDetails*/)
{
return true;
}
void TreeView::itemDragEnter (const SourceDetails& dragSourceDetails)
{
itemDragMove (dragSourceDetails);
}
void TreeView::itemDragMove (const SourceDetails& dragSourceDetails)
{
handleDrag (StringArray(), dragSourceDetails);
}
void TreeView::itemDragExit (const SourceDetails& /*dragSourceDetails*/)
{
hideDragHighlight();
}
void TreeView::itemDropped (const SourceDetails& dragSourceDetails)
{
handleDrop (StringArray(), dragSourceDetails);
}
//==============================================================================
TreeViewItem::TreeViewItem()
: selected (false),
redrawNeeded (true),
drawLinesInside (false),
drawLinesSet (false),
drawsInLeftMargin (false),
drawsInRightMargin (false),
openness (opennessDefault)
{
static int nextUID = 0;
uid = nextUID++;
}
TreeViewItem::~TreeViewItem()
{
}
String TreeViewItem::getUniqueName() const
{
return {};
}
void TreeViewItem::itemOpennessChanged (bool)
{
}
int TreeViewItem::getNumSubItems() const noexcept
{
return subItems.size();
}
TreeViewItem* TreeViewItem::getSubItem (const int index) const noexcept
{
return subItems[index];
}
void TreeViewItem::clearSubItems()
{
if (ownerView != nullptr)
{
const ScopedLock sl (ownerView->nodeAlterationLock);
if (! subItems.isEmpty())
{
removeAllSubItemsFromList();
treeHasChanged();
}
}
else
{
removeAllSubItemsFromList();
}
}
void TreeViewItem::removeAllSubItemsFromList()
{
for (int i = subItems.size(); --i >= 0;)
removeSubItemFromList (i, true);
}
void TreeViewItem::addSubItem (TreeViewItem* const newItem, const int insertPosition)
{
if (newItem != nullptr)
{
newItem->parentItem = nullptr;
newItem->setOwnerView (ownerView);
newItem->y = 0;
newItem->itemHeight = newItem->getItemHeight();
newItem->totalHeight = 0;
newItem->itemWidth = newItem->getItemWidth();
newItem->totalWidth = 0;
newItem->parentItem = this;
if (ownerView != nullptr)
{
const ScopedLock sl (ownerView->nodeAlterationLock);
subItems.insert (insertPosition, newItem);
treeHasChanged();
if (newItem->isOpen())
newItem->itemOpennessChanged (true);
}
else
{
subItems.insert (insertPosition, newItem);
if (newItem->isOpen())
newItem->itemOpennessChanged (true);
}
}
}
void TreeViewItem::removeSubItem (int index, bool deleteItem)
{
if (ownerView != nullptr)
{
const ScopedLock sl (ownerView->nodeAlterationLock);
if (removeSubItemFromList (index, deleteItem))
treeHasChanged();
}
else
{
removeSubItemFromList (index, deleteItem);
}
}
bool TreeViewItem::removeSubItemFromList (int index, bool deleteItem)
{
if (auto* child = subItems[index])
{
child->parentItem = nullptr;
subItems.remove (index, deleteItem);
return true;
}
return false;
}
TreeViewItem::Openness TreeViewItem::getOpenness() const noexcept
{
return (Openness) openness;
}
void TreeViewItem::setOpenness (Openness newOpenness)
{
const bool wasOpen = isOpen();
openness = newOpenness;
const bool isNowOpen = isOpen();
if (isNowOpen != wasOpen)
{
treeHasChanged();
itemOpennessChanged (isNowOpen);
}
}
bool TreeViewItem::isOpen() const noexcept
{
if (openness == opennessDefault)
return ownerView != nullptr && ownerView->defaultOpenness;
return openness == opennessOpen;
}
void TreeViewItem::setOpen (const bool shouldBeOpen)
{
if (isOpen() != shouldBeOpen)
setOpenness (shouldBeOpen ? opennessOpen
: opennessClosed);
}
bool TreeViewItem::isFullyOpen() const noexcept
{
if (! isOpen())
return false;
for (auto* i : subItems)
if (! i->isFullyOpen())
return false;
return true;
}
void TreeViewItem::restoreToDefaultOpenness()
{
setOpenness (opennessDefault);
}
bool TreeViewItem::isSelected() const noexcept
{
return selected;
}
void TreeViewItem::deselectAllRecursively (TreeViewItem* itemToIgnore)
{
if (this != itemToIgnore)
setSelected (false, false);
for (auto* i : subItems)
i->deselectAllRecursively (itemToIgnore);
}
void TreeViewItem::setSelected (const bool shouldBeSelected,
const bool deselectOtherItemsFirst,
const NotificationType notify)
{
if (shouldBeSelected && ! canBeSelected())
return;
if (deselectOtherItemsFirst)
getTopLevelItem()->deselectAllRecursively (this);
if (shouldBeSelected != selected)
{
selected = shouldBeSelected;
if (ownerView != nullptr)
ownerView->repaint();
if (notify != dontSendNotification)
itemSelectionChanged (shouldBeSelected);
}
}
void TreeViewItem::paintItem (Graphics&, int, int)
{
}
void TreeViewItem::paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour backgroundColour, bool isMouseOver)
{
getOwnerView()->getLookAndFeel()
.drawTreeviewPlusMinusBox (g, area, backgroundColour, isOpen(), isMouseOver);
}
void TreeViewItem::paintHorizontalConnectingLine (Graphics& g, const Line<float>& line)
{
g.setColour (ownerView->findColour (TreeView::linesColourId));
g.drawLine (line);
}
void TreeViewItem::paintVerticalConnectingLine (Graphics& g, const Line<float>& line)
{
g.setColour (ownerView->findColour (TreeView::linesColourId));
g.drawLine (line);
}
void TreeViewItem::itemClicked (const MouseEvent&)
{
}
void TreeViewItem::itemDoubleClicked (const MouseEvent&)
{
if (mightContainSubItems())
setOpen (! isOpen());
}
void TreeViewItem::itemSelectionChanged (bool)
{
}
String TreeViewItem::getTooltip()
{
return {};
}
void TreeViewItem::ownerViewChanged (TreeView*)
{
}
var TreeViewItem::getDragSourceDescription()
{
return {};
}
bool TreeViewItem::isInterestedInFileDrag (const StringArray&)
{
return false;
}
void TreeViewItem::filesDropped (const StringArray& /*files*/, int /*insertIndex*/)
{
}
bool TreeViewItem::isInterestedInDragSource (const DragAndDropTarget::SourceDetails& /*dragSourceDetails*/)
{
return false;
}
void TreeViewItem::itemDropped (const DragAndDropTarget::SourceDetails& /*dragSourceDetails*/, int /*insertIndex*/)
{
}
Rectangle<int> TreeViewItem::getItemPosition (const bool relativeToTreeViewTopLeft) const noexcept
{
auto indentX = getIndentX();
auto width = itemWidth;
if (ownerView != nullptr && width < 0)
width = ownerView->viewport->getViewWidth() - indentX;
Rectangle<int> r (indentX, y, jmax (0, width), totalHeight);
if (relativeToTreeViewTopLeft && ownerView != nullptr)
r -= ownerView->viewport->getViewPosition();
return r;
}
void TreeViewItem::treeHasChanged() const noexcept
{
if (ownerView != nullptr)
ownerView->itemsChanged();
}
void TreeViewItem::repaintItem() const
{
if (ownerView != nullptr && areAllParentsOpen())
ownerView->viewport->repaint (getItemPosition (true).withLeft (0));
}
bool TreeViewItem::areAllParentsOpen() const noexcept
{
return parentItem == nullptr
|| (parentItem->isOpen() && parentItem->areAllParentsOpen());
}
void TreeViewItem::updatePositions (int newY)
{
y = newY;
itemHeight = getItemHeight();
totalHeight = itemHeight;
itemWidth = getItemWidth();
totalWidth = jmax (itemWidth, 0) + getIndentX();
if (isOpen())
{
newY += totalHeight;
for (auto* i : subItems)
{
i->updatePositions (newY);
newY += i->totalHeight;
totalHeight += i->totalHeight;
totalWidth = jmax (totalWidth, i->totalWidth);
}
}
}
TreeViewItem* TreeViewItem::getDeepestOpenParentItem() noexcept
{
TreeViewItem* result = this;
TreeViewItem* item = this;
while (item->parentItem != nullptr)
{
item = item->parentItem;
if (! item->isOpen())
result = item;
}
return result;
}
void TreeViewItem::setOwnerView (TreeView* const newOwner) noexcept
{
ownerView = newOwner;
for (auto* i : subItems)
{
i->setOwnerView (newOwner);
i->ownerViewChanged (newOwner);
}
}
int TreeViewItem::getIndentX() const noexcept
{
int x = ownerView->rootItemVisible ? 1 : 0;
if (! ownerView->openCloseButtonsVisible)
--x;
for (auto* p = parentItem; p != nullptr; p = p->parentItem)
++x;
return x * ownerView->getIndentSize();
}
void TreeViewItem::setDrawsInLeftMargin (bool canDrawInLeftMargin) noexcept
{
drawsInLeftMargin = canDrawInLeftMargin;
}
void TreeViewItem::setDrawsInRightMargin (bool canDrawInRightMargin) noexcept
{
drawsInRightMargin = canDrawInRightMargin;
}
namespace TreeViewHelpers
{
static int calculateDepth (const TreeViewItem* item, const bool rootIsVisible) noexcept
{
jassert (item != nullptr);
int depth = rootIsVisible ? 0 : -1;
for (auto* p = item->getParentItem(); p != nullptr; p = p->getParentItem())
++depth;
return depth;
}
}
bool TreeViewItem::areLinesDrawn() const
{
return drawLinesSet ? drawLinesInside
: (ownerView != nullptr && ownerView->getLookAndFeel().areLinesDrawnForTreeView (*ownerView));
}
void TreeViewItem::paintRecursively (Graphics& g, int width)
{
jassert (ownerView != nullptr);
if (ownerView == nullptr)
return;
auto indent = getIndentX();
auto itemW = (itemWidth < 0 || drawsInRightMargin) ? width - indent : itemWidth;
{
Graphics::ScopedSaveState ss (g);
g.setOrigin (indent, 0);
if (g.reduceClipRegion (drawsInLeftMargin ? -indent : 0, 0,
drawsInLeftMargin ? itemW + indent : itemW, itemHeight))
{
if (isSelected())
g.fillAll (ownerView->findColour (TreeView::selectedItemBackgroundColourId));
else
g.fillAll ((getRowNumberInTree() % 2 == 0) ? ownerView->findColour (TreeView::oddItemsColourId)
: ownerView->findColour (TreeView::evenItemsColourId));
paintItem (g, itemWidth < 0 ? width - indent : itemWidth, itemHeight);
}
}
auto halfH = (float) itemHeight * 0.5f;
auto indentWidth = ownerView->getIndentSize();
auto depth = TreeViewHelpers::calculateDepth (this, ownerView->rootItemVisible);
if (depth >= 0 && ownerView->openCloseButtonsVisible)
{
auto x = ((float) depth + 0.5f) * (float) indentWidth;
const bool parentLinesDrawn = parentItem != nullptr && parentItem->areLinesDrawn();
if (parentLinesDrawn)
paintVerticalConnectingLine (g, Line<float> (x, 0, x, isLastOfSiblings() ? halfH : (float) itemHeight));
if (parentLinesDrawn || (parentItem == nullptr && areLinesDrawn()))
paintHorizontalConnectingLine (g, Line<float> (x, halfH, x + (float) indentWidth * 0.5f, halfH));
{
auto* p = parentItem;
int d = depth;
while (p != nullptr && --d >= 0)
{
x -= (float) indentWidth;
if ((p->parentItem == nullptr || p->parentItem->areLinesDrawn()) && ! p->isLastOfSiblings())
p->paintVerticalConnectingLine (g, Line<float> (x, 0, x, (float) itemHeight));
p = p->parentItem;
}
}
if (mightContainSubItems())
{
auto backgroundColour = ownerView->findColour (TreeView::backgroundColourId);
paintOpenCloseButton (g, Rectangle<float> ((float) (depth * indentWidth), 0, (float) indentWidth, (float) itemHeight),
backgroundColour.isTransparent() ? Colours::white : backgroundColour,
ownerView->viewport->getContentComp()->isMouseOverButton (this));
}
}
if (isOpen())
{
auto clip = g.getClipBounds();
for (auto* ti : subItems)
{
auto relY = ti->y - y;
if (relY >= clip.getBottom())
break;
if (relY + ti->totalHeight >= clip.getY())
{
Graphics::ScopedSaveState ss (g);
g.setOrigin (0, relY);
if (g.reduceClipRegion (0, 0, width, ti->totalHeight))
ti->paintRecursively (g, width);
}
}
}
}
bool TreeViewItem::isLastOfSiblings() const noexcept
{
return parentItem == nullptr
|| parentItem->subItems.getLast() == this;
}
int TreeViewItem::getIndexInParent() const noexcept
{
return parentItem == nullptr ? 0
: parentItem->subItems.indexOf (this);
}
TreeViewItem* TreeViewItem::getTopLevelItem() noexcept
{
return parentItem == nullptr ? this
: parentItem->getTopLevelItem();
}
int TreeViewItem::getNumRows() const noexcept
{
int num = 1;
if (isOpen())
for (auto* i : subItems)
num += i->getNumRows();
return num;
}
TreeViewItem* TreeViewItem::getItemOnRow (int index) noexcept
{
if (index == 0)
return this;
if (index > 0 && isOpen())
{
--index;
for (auto* i : subItems)
{
if (index == 0)
return i;
auto numRows = i->getNumRows();
if (numRows > index)
return i->getItemOnRow (index);
index -= numRows;
}
}
return nullptr;
}
TreeViewItem* TreeViewItem::findItemRecursively (int targetY) noexcept
{
if (isPositiveAndBelow (targetY, totalHeight))
{
auto h = itemHeight;
if (targetY < h)
return this;
if (isOpen())
{
targetY -= h;
for (auto* i : subItems)
{
if (targetY < i->totalHeight)
return i->findItemRecursively (targetY);
targetY -= i->totalHeight;
}
}
}
return nullptr;
}
int TreeViewItem::countSelectedItemsRecursively (int depth) const noexcept
{
int total = isSelected() ? 1 : 0;
if (depth != 0)
for (auto* i : subItems)
total += i->countSelectedItemsRecursively (depth - 1);
return total;
}
TreeViewItem* TreeViewItem::getSelectedItemWithIndex (int index) noexcept
{
if (isSelected())
{
if (index == 0)
return this;
--index;
}
if (index >= 0)
{
for (auto* i : subItems)
{
if (auto* found = i->getSelectedItemWithIndex (index))
return found;
index -= i->countSelectedItemsRecursively (-1);
}
}
return nullptr;
}
int TreeViewItem::getRowNumberInTree() const noexcept
{
if (parentItem != nullptr && ownerView != nullptr)
{
if (! parentItem->isOpen())
return parentItem->getRowNumberInTree();
int n = 1 + parentItem->getRowNumberInTree();
int ourIndex = parentItem->subItems.indexOf (this);
jassert (ourIndex >= 0);
while (--ourIndex >= 0)
n += parentItem->subItems [ourIndex]->getNumRows();
if (parentItem->parentItem == nullptr
&& ! ownerView->rootItemVisible)
--n;
return n;
}
return 0;
}
void TreeViewItem::setLinesDrawnForSubItems (const bool drawLines) noexcept
{
drawLinesInside = drawLines;
drawLinesSet = true;
}
TreeViewItem* TreeViewItem::getNextVisibleItem (const bool recurse) const noexcept
{
if (recurse && isOpen() && ! subItems.isEmpty())
return subItems.getFirst();
if (parentItem != nullptr)
{
const int nextIndex = parentItem->subItems.indexOf (this) + 1;
if (nextIndex >= parentItem->subItems.size())
return parentItem->getNextVisibleItem (false);
return parentItem->subItems [nextIndex];
}
return nullptr;
}
static String escapeSlashesInTreeViewItemName (const String& s)
{
return s.replaceCharacter ('/', '\\');
}
String TreeViewItem::getItemIdentifierString() const
{
String s;
if (parentItem != nullptr)
s = parentItem->getItemIdentifierString();
return s + "/" + escapeSlashesInTreeViewItemName (getUniqueName());
}
TreeViewItem* TreeViewItem::findItemFromIdentifierString (const String& identifierString)
{
auto thisId = "/" + escapeSlashesInTreeViewItemName (getUniqueName());
if (thisId == identifierString)
return this;
if (identifierString.startsWith (thisId + "/"))
{
auto remainingPath = identifierString.substring (thisId.length());
const bool wasOpen = isOpen();
setOpen (true);
for (auto* i : subItems)
if (auto* item = i->findItemFromIdentifierString (remainingPath))
return item;
setOpen (wasOpen);
}
return nullptr;
}
void TreeViewItem::restoreOpennessState (const XmlElement& e)
{
if (e.hasTagName ("CLOSED"))
{
setOpen (false);
}
else if (e.hasTagName ("OPEN"))
{
setOpen (true);
Array<TreeViewItem*> items;
items.addArray (subItems);
forEachXmlChildElement (e, n)
{
auto id = n->getStringAttribute ("id");
for (int i = 0; i < items.size(); ++i)
{
auto* ti = items.getUnchecked(i);
if (ti->getUniqueName() == id)
{
ti->restoreOpennessState (*n);
items.remove (i);
break;
}
}
}
// for any items that weren't mentioned in the XML, reset them to default:
for (auto* i : items)
i->restoreToDefaultOpenness();
}
}
std::unique_ptr<XmlElement> TreeViewItem::getOpennessState() const
{
return std::unique_ptr<XmlElement> (getOpennessState (true));
}
XmlElement* TreeViewItem::getOpennessState (bool canReturnNull) const
{
auto name = getUniqueName();
if (name.isNotEmpty())
{
XmlElement* e;
if (isOpen())
{
if (canReturnNull && ownerView != nullptr && ownerView->defaultOpenness && isFullyOpen())
return nullptr;
e = new XmlElement ("OPEN");
for (int i = subItems.size(); --i >= 0;)
e->prependChildElement (subItems.getUnchecked(i)->getOpennessState (true));
}
else
{
if (canReturnNull && ownerView != nullptr && ! ownerView->defaultOpenness)
return nullptr;
e = new XmlElement ("CLOSED");
}
e->setAttribute ("id", name);
return e;
}
// trying to save the openness for an element that has no name - this won't
// work because it needs the names to identify what to open.
jassertfalse;
return nullptr;
}
//==============================================================================
TreeViewItem::OpennessRestorer::OpennessRestorer (TreeViewItem& item)
: treeViewItem (item),
oldOpenness (item.getOpennessState())
{
}
TreeViewItem::OpennessRestorer::~OpennessRestorer()
{
if (oldOpenness != nullptr)
treeViewItem.restoreOpennessState (*oldOpenness);
}
} // namespace juce
|
{
"pile_set_name": "Github"
}
|
#include <nds.h>
#include "sdmmc.h"
static struct mmcdevice deviceSD;
/*mmcdevice *getMMCDevice(int drive) {
if(drive==0) return &deviceNAND;
return &deviceSD;
}
*/
//---------------------------------------------------------------------------------
int __attribute__((noinline)) geterror(struct mmcdevice *ctx) {
//---------------------------------------------------------------------------------
//if(ctx->error == 0x4) return -1;
//else return 0;
return (ctx->error << 29) >> 31;
}
//---------------------------------------------------------------------------------
void __attribute__((noinline)) setTarget(struct mmcdevice *ctx) {
//---------------------------------------------------------------------------------
sdmmc_mask16(REG_SDPORTSEL,0x3,(u16)ctx->devicenumber);
setckl(ctx->clk);
if (ctx->SDOPT == 0) {
sdmmc_mask16(REG_SDOPT, 0, 0x8000);
} else {
sdmmc_mask16(REG_SDOPT, 0x8000, 0);
}
}
//---------------------------------------------------------------------------------
void __attribute__((noinline)) sdmmc_send_command(struct mmcdevice *ctx, u32 cmd, u32 args) {
//---------------------------------------------------------------------------------
int i;
bool getSDRESP = (cmd << 15) >> 31;
u16 flags = (cmd << 15) >> 31;
const bool readdata = cmd & 0x20000;
const bool writedata = cmd & 0x40000;
if (readdata || writedata)
flags |= TMIO_STAT0_DATAEND;
ctx->error = 0;
while (sdmmc_read16(REG_SDSTATUS1) & TMIO_STAT1_CMD_BUSY); //mmc working?
sdmmc_write16(REG_SDIRMASK0,0);
sdmmc_write16(REG_SDIRMASK1,0);
sdmmc_write16(REG_SDSTATUS0,0);
sdmmc_write16(REG_SDSTATUS1,0);
#ifdef DATA32_SUPPORT
if (readdata)
sdmmc_mask16(REG_SDDATACTL32, 0x1000, 0x800);
if (writedata)
sdmmc_mask16(REG_SDDATACTL32, 0x800, 0x1000);
#else
sdmmc_mask16(REG_SDDATACTL32,0x1800,0);
#endif
sdmmc_write16(REG_SDCMDARG0,args &0xFFFF);
sdmmc_write16(REG_SDCMDARG1,args >> 16);
sdmmc_write16(REG_SDCMD,cmd &0xFFFF);
u32 size = ctx->size;
u16 *dataPtr = (u16*)ctx->data;
#ifdef DATA32_SUPPORT
u32 *dataPtr32 = (u32*)ctx->data;
#endif
bool useBuf = ( 0 != dataPtr );
#ifdef DATA32_SUPPORT
bool useBuf32 = (useBuf && (0 == (3 & ((u32)dataPtr))));
#endif
u16 status0 = 0;
while(true) {
u16 status1 = sdmmc_read16(REG_SDSTATUS1);
if (status1 & TMIO_STAT1_RXRDY) {
if (readdata && useBuf) {
sdmmc_mask16(REG_SDSTATUS1, TMIO_STAT1_RXRDY, 0);
//sdmmc_write16(REG_SDSTATUS1,~TMIO_STAT1_RXRDY);
if (size > 0x1FF) {
#ifdef DATA32_SUPPORT
if (useBuf32) {
for(i = 0; i<0x200; i+=4)
*dataPtr32++ = sdmmc_read32(REG_SDFIFO32);
} else {
#endif
for(i = 0; i<0x200; i+=2)
*dataPtr++ = sdmmc_read16(REG_SDFIFO);
#ifdef DATA32_SUPPORT
}
#endif
size -= 0x200;
}
}
}
if (status1 & TMIO_STAT1_TXRQ) {
if (writedata && useBuf) {
sdmmc_mask16(REG_SDSTATUS1, TMIO_STAT1_TXRQ, 0);
//sdmmc_write16(REG_SDSTATUS1,~TMIO_STAT1_TXRQ);
if (size > 0x1FF) {
#ifdef DATA32_SUPPORT
for (i = 0; i<0x200; i+=4)
sdmmc_write32(REG_SDFIFO32,*dataPtr32++);
#else
for (i = 0; i<0x200; i+=2)
sdmmc_write16(REG_SDFIFO,*dataPtr++);
#endif
size -= 0x200;
}
}
}
if (status1 & TMIO_MASK_GW) {
ctx->error |= 4;
break;
}
if (!(status1 & TMIO_STAT1_CMD_BUSY)) {
status0 = sdmmc_read16(REG_SDSTATUS0);
if (sdmmc_read16(REG_SDSTATUS0) & TMIO_STAT0_CMDRESPEND)
ctx->error |= 0x1;
if (status0 & TMIO_STAT0_DATAEND)
ctx->error |= 0x2;
if ((status0 & flags) == flags)
break;
}
}
ctx->stat0 = sdmmc_read16(REG_SDSTATUS0);
ctx->stat1 = sdmmc_read16(REG_SDSTATUS1);
sdmmc_write16(REG_SDSTATUS0,0);
sdmmc_write16(REG_SDSTATUS1,0);
if (getSDRESP != 0) {
ctx->ret[0] = sdmmc_read16(REG_SDRESP0) | (sdmmc_read16(REG_SDRESP1) << 16);
ctx->ret[1] = sdmmc_read16(REG_SDRESP2) | (sdmmc_read16(REG_SDRESP3) << 16);
ctx->ret[2] = sdmmc_read16(REG_SDRESP4) | (sdmmc_read16(REG_SDRESP5) << 16);
ctx->ret[3] = sdmmc_read16(REG_SDRESP6) | (sdmmc_read16(REG_SDRESP7) << 16);
}
}
//---------------------------------------------------------------------------------
int sdmmc_cardinserted() {
//---------------------------------------------------------------------------------
return 1; //sdmmc_cardready;
}
//---------------------------------------------------------------------------------
void sdmmc_controller_init() {
//---------------------------------------------------------------------------------
deviceSD.isSDHC = 0;
deviceSD.SDOPT = 0;
deviceSD.res = 0;
deviceSD.initarg = 0;
deviceSD.clk = 0x80;
deviceSD.devicenumber = 0;
*(vu16*)(SDMMC_BASE + REG_SDDATACTL32) &= 0xF7FFu;
*(vu16*)(SDMMC_BASE + REG_SDDATACTL32) &= 0xEFFFu;
*(vu16*)(SDMMC_BASE + REG_SDDATACTL32) |= 0x402u;
*(vu16*)(SDMMC_BASE + REG_SDDATACTL) = (*(vu16*)(SDMMC_BASE + 0xd8) & 0xFFDD) | 2;
#ifdef DATA32_SUPPORT
*(vu16*)(SDMMC_BASE + REG_SDDATACTL32) &= 0xFFFFu;
*(vu16*)(SDMMC_BASE + REG_SDDATACTL) &= 0xFFDFu;
*(vu16*)(SDMMC_BASE + REG_SDBLKLEN32) = 512;
#else
*(vu16*)(SDMMC_BASE + REG_SDDATACTL32) &= 0xFFFDu;
*(vu16*)(SDMMC_BASE + REG_SDDATACTL) &= 0xFFDDu;
*(vu16*)(SDMMC_BASE + REG_SDBLKLEN32) = 0;
#endif
*(vu16*)(SDMMC_BASE + REG_SDBLKCOUNT32) = 1; //SDBLKCOUNT32
*(vu16*)(SDMMC_BASE + REG_SDRESET) &= 0xFFFEu; //SDRESET
*(vu16*)(SDMMC_BASE + REG_SDRESET) |= 1u; //SDRESET
*(vu16*)(SDMMC_BASE + REG_SDIRMASK0) |= TMIO_MASK_ALL;
*(vu16*)(SDMMC_BASE + REG_SDIRMASK1) |= TMIO_MASK_ALL>>16;
*(vu16*)(SDMMC_BASE + 0x0fc) |= 0xDBu; //SDCTL_RESERVED7
*(vu16*)(SDMMC_BASE + 0x0fe) |= 0xDBu; //SDCTL_RESERVED8
*(vu16*)(SDMMC_BASE + REG_SDPORTSEL) &= 0xFFFCu; //SDPORTSEL
#ifdef DATA32_SUPPORT
*(vu16*)(SDMMC_BASE + REG_SDCLKCTL) = 0x20;
*(vu16*)(SDMMC_BASE + REG_SDOPT) = 0x40EE;
#else
*(vu16*)(SDMMC_BASE + REG_SDCLKCTL) = 0x40; //Nintendo sets this to 0x20
*(vu16*)(SDMMC_BASE + REG_SDOPT) = 0x40EB; //Nintendo sets this to 0x40EE
#endif
*(vu16*)(SDMMC_BASE + REG_SDPORTSEL) &= 0xFFFCu; ////SDPORTSEL
*(vu16*)(SDMMC_BASE + REG_SDBLKLEN) = 512; //SDBLKLEN
*(vu16*)(SDMMC_BASE + REG_SDSTOP) = 0; //SDSTOP
setTarget(&deviceSD);
}
//---------------------------------------------------------------------------------
static u32 calcSDSize(u8* csd, int type) {
//---------------------------------------------------------------------------------
u32 result = 0;
if (type == -1) type = csd[14] >> 6;
switch (type) {
case 0:
{
u32 block_len = csd[9] & 0xf;
block_len = 1 << block_len;
u32 mult = (csd[4] >> 7) | ((csd[5] & 3) << 1);
mult = 1 << (mult + 2);
result = csd[8] & 3;
result = (result << 8) | csd[7];
result = (result << 2) | (csd[6] >> 6);
result = (result + 1) * mult * block_len / 512;
}
break;
case 1:
result = csd[7] & 0x3f;
result = (result << 8) | csd[6];
result = (result << 8) | csd[5];
result = (result + 1) * 1024;
break;
}
return result;
}
//---------------------------------------------------------------------------------
int sdmmc_sdcard_init() {
//---------------------------------------------------------------------------------
setTarget(&deviceSD);
swiDelay(0xF000);
sdmmc_send_command(&deviceSD,0,0);
sdmmc_send_command(&deviceSD,0x10408,0x1AA);
//u32 temp = (deviceSD.ret[0] == 0x1AA) << 0x1E;
u32 temp = (deviceSD.error & 0x1) << 0x1E;
//int count = 0;
u32 temp2 = 0;
do {
do {
sdmmc_send_command(&deviceSD,0x10437,deviceSD.initarg << 0x10);
sdmmc_send_command(&deviceSD,0x10769,0x00FF8000 | temp);
temp2 = 1;
} while ( !(deviceSD.error & 1) );
} while((deviceSD.ret[0] & 0x80000000) == 0);
//do
//{
// sdmmc_send_command(&deviceSD,0x10437,deviceSD.initarg << 0x10);
// sdmmc_send_command(&deviceSD,0x10769,0x00FF8000 | temp);
//
//}
//while(!(deviceSD.ret[0] & 0x80000000));
if(!((deviceSD.ret[0] >> 30) & 1) || !temp)
temp2 = 0;
deviceSD.isSDHC = temp2;
//deviceSD.isSDHC = (deviceSD.ret[0] & 0x40000000);
sdmmc_send_command(&deviceSD,0x10602,0);
if (deviceSD.error & 0x4) return -1;
sdmmc_send_command(&deviceSD,0x10403,0);
if (deviceSD.error & 0x4) return -1;
deviceSD.initarg = deviceSD.ret[0] >> 0x10;
sdmmc_send_command(&deviceSD,0x10609,deviceSD.initarg << 0x10);
if (deviceSD.error & 0x4) return -1;
deviceSD.total_size = calcSDSize((u8*)&deviceSD.ret[0],-1);
deviceSD.clk = 1;
setckl(1);
sdmmc_send_command(&deviceSD,0x10507,deviceSD.initarg << 0x10);
if (deviceSD.error & 0x4) return -1;
sdmmc_send_command(&deviceSD,0x10437,deviceSD.initarg << 0x10);
if (deviceSD.error & 0x4) return -1;
deviceSD.SDOPT = 1;
sdmmc_send_command(&deviceSD,0x10446,0x2);
if (deviceSD.error & 0x4) return -1;
sdmmc_send_command(&deviceSD,0x1040D,deviceSD.initarg << 0x10);
if (deviceSD.error & 0x4) return -1;
sdmmc_send_command(&deviceSD,0x10410,0x200);
if (deviceSD.error & 0x4) return -1;
deviceSD.clk |= 0x200;
return 0;
}
int __attribute__((noinline)) sdmmc_sdcard_readsectors(u32 sector_no, u32 numsectors, void *out) {
if (deviceSD.isSDHC == 0)
sector_no <<= 9;
setTarget(&deviceSD);
sdmmc_write16(REG_SDSTOP,0x100);
#ifdef DATA32_SUPPORT
sdmmc_write16(REG_SDBLKCOUNT32,numsectors);
sdmmc_write16(REG_SDBLKLEN32,0x200);
#endif
sdmmc_write16(REG_SDBLKCOUNT,numsectors);
deviceSD.data = out;
deviceSD.size = numsectors << 9;
sdmmc_send_command(&deviceSD,0x33C12,sector_no);
return geterror(&deviceSD);
}
|
{
"pile_set_name": "Github"
}
|
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
<persistence-unit name="JPABVAL">
<jta-data-source>jdbc/TransactionalDataSource</jta-data-source>
<non-jta-data-source>jdbc/NonTransactionalDataSource</non-jta-data-source>
<class>jpa22bval.entity.BeanValEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.cache.shared.default" value="false"/>
</properties>
</persistence-unit>
</persistence>
|
{
"pile_set_name": "Github"
}
|
---
layout: post
title: 第106天:机器学习概览
category: python
copyright: python
---
# 机器学习概览
近年来,随着人工智能热潮的席卷,“机器学习”、“深度学习”、“强化学习”等等层出不穷的概念、术语纷纷扰扰,不绝于耳;但是对大多数并不从事相关行业的人来说,就始终有一种雾里看花、似是而非的感觉。
正巧,Python 作为一门简单易用、功能强大的编程语言,在 AI 时代与人工智能相关的技术紧密结合,在这系列的 Python 交流中,我们就来大概地了解一下“机器学习到底是什么、可以干什么、应该怎么干”。
本篇仅作粗糙了解之用,不涉及具体的数学原理。更深入的了解可以查看参考资料。
<!--more-->
## 1. 算法和“算法”
首先我们要区别的一个概念就是常说的“算法”。
在我们学习编程的过程中,肯定会经常听到的一个说法就是“数据结构 + 算法 = 程序”;而当我们学习人工智能相关的内容时,也一直会听到 K 近邻算法、模拟退火算法等等术语。但是要注意一下,我们在平常的编程中用到的算法,是一种组织行为艺术,让恰当的人去做恰当的事;而在人工智能领域提到算法,没有特殊说明的情况下都是特指“人工智能算法”,这其实更像是一种暴力美学,不管三七二十一就是莽,不断试错,总要搞出一个结果,是一种具体的计算方法。
从数学分野上来讲,前者更多的是离散数学的内容,而后者更多的则是微积分和概率统计的内容。一般来说也很少混用这两个概念;若要混用,一般也会特意指明后者是“人工智能算法”或“机器学习算法”。
当然,实际上两种算法都符合“算法”的定义,即都是用来求解/解决问题的具体方法。但出于惯用法的考虑,我认为还是应当聊作区分,尤其是对于没有接触过一般算法的同学而言,更显必要。
## 2. 机器学习
人工智能的概念十分宽泛,流派众多,机器学习仅仅是其中一个分支;之所以我们经常听到的是“机器学习”而很少听到别的名字,主要是因为在当前这波大潮中,机器学习取得了压倒性的优势,相对其他流派性能更好、使用更方便、门槛更低,因此可能会造成一种“机器学习 = 人工智能”的错觉。
实际上我们经常说的机器学习是一种基于统计学方法的人工智能实现,我们也可以称其为“统计学习”——记得当时第一次看到李航老师的《统计学习方法》,我还真以为是讲如何学习统计学的书哈哈。
机器学习的“原材料”是各种各样的数据,称为“训练数据”,而机器学习的目的就是从这些数据中抽象出一些通用的规律/经验,获取一些难以被人类直观发现的现象/特征,用来在新的数据上取得正确的判断。对于给定的数据,机器学习模型得到的结果即是该模型的输出。
## 3. 机器学习的分类
机器学习总脱不开“将数据传递给机器 -> 机器从数据中学到规律/经验”这么一个流程,我们可以按照前一个步骤的特征的分类机器学习,也可以按照后一个步骤来进行分类。
### 3.1 基本分类
按照呈现给机器的数据的不同,机器学习可以粗略地分为**监督学习**(supervised learning)和**非监督学习**(unsupervised learning)两大类,此外有时也会分出强化学习、半监督学习等类别。
#### 3.1.1 监督学习
所谓监督学习,简单地讲就是目标明确、有奔头的机器学习过程。
从呈现给机器的数据的角度来讲,监督学习给出的训练数据就是带有明确指向的,称之为“标记过的数据”。也就是说我们完全清楚,某一个具体的数据实例,想要得到的对应输出结果是什么样的,并且我们也要求机器的输出结果不断地向我们预期的标记靠拢,这个“标记”就被称为“预期输出”,而机器实实在在的输出结果即为“实际输出”。
因此监督学习的工作,实际上就是在合理区间,力求将预期输出和实际输出之间的差值降到最小。
典型的问题包括数据分类和回归分析。
#### 3.1.2 非监督学习
对应于监督学习,顾名思义,非监督学习就是没有人“监督”的机器学习过程。所谓“监督”,其实就是说的训练数据实例带有的“标记”。
在监督学习中,机器学习的结果始终受到预期输出的约束,每一次结果都需要接受预期输出的评判;而非监督学习则不然。
非要打比方的话,监督学习就是应试教育,非监督学习更像是素质教育——啊当然,此处并不对应试教育和素质教育抱有任何预设立场,对监督学习和非监督学习更是如此,二者并无高下之别,仅仅是适用情境不同,仅此而已。
非监督学习允许模型自由发挥,“在阳光下自由生长”,具体长成什么样儿我们并不能掌控,我们也并不对学习的结果有太多的明确的预期。非监督学习更多的适用情形是发掘数据中一些隐藏的、通过简单分析难以察觉的特性。
典型的问题包括聚类问题。
### 3.2 按问题分类
机器学习按照具体的问题,大概可以分为这么几类:数据分类,回归分析,聚类问题。
#### 3.2.1 数据分类
数据分类应该是最常见的机器学习问题了,最典型的例子就是垃圾邮件的判别(啊,这个例子好像都举烂了,不过确实很典型啊,我还是举吧哈哈),此外还有文本情感的判别、图像识别等等应用。属于监督学习的一种。
分类问题试图将给定的某个输入数据实例划分到一些已知的类别当中,通常还是以概率的形式给出,这个概率就是输入数据属于某个类别的置信度。通常是一种多输入多输出的模型。
#### 3.2.2 回归分析
回归分析主要是用于预测某种趋势,比如用某只个股一段时间的股价来预测第二天的股价。也属于监督学习的一种。
回归分析是要从输入数据中计算出一个具体的数值,比如高中数学中教授的线性回归,通过分析大量的身高和脚长关系,可以用来根据一个人的脚长预测其身高。“回归”这个词有些生硬,可以理解为根据输入数据往一个最可能的同时也确实最符合现实规律的情况靠拢,称之为“回归”。通常是多输入单输出的模型。
#### 3.2.3 聚类问题
聚类问题中最典型的算法就是 K 均值聚类算法了。举例来讲,聚类可以用来将电商平台上的消费者按某种特征划分为各自相似的几个群落,每个群落中的消费者具有较高的相似度,因此完全可以将他们购买过的商品在群落内部频繁推荐,可以大大提高推荐的准确度。属于非监督学习。
聚类问题要的是机器从一堆数据中找到划分数据的标准,并且一开始的划分标准和稳定后的划分标准可能会存在很大的不同。
### 3.3 按确定性分类
按照机器学习算法的确定性与否,又可以将其分为**随机学习**和**确定学习**。
其中,确定学习只要给定相同的初始状态,就必然得到完全无二的结果。整个过程中没有用到随机数。
而随机学习则一定要用到随机数。这样一来,即使初始状态相同,也必然带来不同的结果;每次训练的过程虽然在大方向上是正确的,但在细节上却是完全无法掌控的。
而这两类机器学习算法中,又以随机学习的效果更好,应用更为广泛。
### 3.4 按训练批量分类
按照每次训练时的输入数据批量大小,又可以分为**在线学习**和**批量学习**两大类。
其中,在线学习指的是一次给出一个数据,机器立刻进行运算并训练。“在线”(online)二字强调的就是无时延,不迟疑,说干就干。
而批量学习则是给出若干个数据作为一个批次,记录每一个数据的实际输出,最后一个批次结束之后计算所有输出的某个统计学特性(比如平均值),以此来作为训练的依据。
我们经常看到的机器学习算法大多数都属于批量学习的范畴。究其缘由,在线学习看起来虽好,貌似有实时性,可以即时学习,但是每次训练的样本太少,很容易造成个体偏差,模型性能波动比较厉害,尤其是遇到一些极端的离群值(即与其他大多数数据差异极大的数据)时,模型很容易就烂掉了。
## 4. 总结
本文我们辨析了机器学习的一些相关概念,梳理了机器学习的一些术语,带领读者大概认识了一下“机器学习到底是个什么东西”。读者如果觉得意犹未尽,可以通过参考资料进一步学习。
后面我们还有一系列文章为大家展示“机器学习究竟可以干什么,应该怎么干”。
> 示例代码:[Python-100-days](https://github.com/JustDoPython/python-100-day/tree/master/)
## 5. 参考资料
[《机器学习》- 周志华](https://book.douban.com/subject/26708119/)
[《统计学习方法》- 李航](https://book.douban.com/subject/10590856/)
[《人工智能简史》- 尼克](https://book.douban.com/subject/27193496/)
[《人工智能算法(卷1):基础算法》- 杰弗瑞·希顿](https://www.epubit.com/bookDetails?id=UB6ca55a7aa61e7)
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.