Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
8
99.9k
meta
dict
/// /// Copyright (c) 2016 Dropbox, Inc. All rights reserved. /// /// Auto-generated by Stone, do not modify. /// #import <Foundation/Foundation.h> #import "DBSerializableProtocol.h" @class DBTEAMPOLICIESSharedFolderJoinPolicy; NS_ASSUME_NONNULL_BEGIN #pragma mark - API Object /// /// The `SharedFolderJoinPolicy` union. /// /// Policy governing which shared folders a team member can join. /// /// This class implements the `DBSerializable` protocol (serialize and /// deserialize instance methods), which is required for all Obj-C SDK API route /// objects. /// @interface DBTEAMPOLICIESSharedFolderJoinPolicy : NSObject <DBSerializable, NSCopying> #pragma mark - Instance fields /// The `DBTEAMPOLICIESSharedFolderJoinPolicyTag` enum type represents the /// possible tag states with which the `DBTEAMPOLICIESSharedFolderJoinPolicy` /// union can exist. typedef NS_CLOSED_ENUM(NSInteger, DBTEAMPOLICIESSharedFolderJoinPolicyTag){ /// Team members can only join folders shared by teammates. DBTEAMPOLICIESSharedFolderJoinPolicyFromTeamOnly, /// Team members can join any shared folder, including those shared by users /// outside the team. DBTEAMPOLICIESSharedFolderJoinPolicyFromAnyone, /// (no description). DBTEAMPOLICIESSharedFolderJoinPolicyOther, }; /// Represents the union's current tag state. @property (nonatomic, readonly) DBTEAMPOLICIESSharedFolderJoinPolicyTag tag; #pragma mark - Constructors /// /// Initializes union class with tag state of "from_team_only". /// /// Description of the "from_team_only" tag state: Team members can only join /// folders shared by teammates. /// /// @return An initialized instance. /// - (instancetype)initWithFromTeamOnly; /// /// Initializes union class with tag state of "from_anyone". /// /// Description of the "from_anyone" tag state: Team members can join any shared /// folder, including those shared by users outside the team. /// /// @return An initialized instance. /// - (instancetype)initWithFromAnyone; /// /// Initializes union class with tag state of "other". /// /// @return An initialized instance. /// - (instancetype)initWithOther; - (instancetype)init NS_UNAVAILABLE; #pragma mark - Tag state methods /// /// Retrieves whether the union's current tag state has value "from_team_only". /// /// @return Whether the union's current tag state has value "from_team_only". /// - (BOOL)isFromTeamOnly; /// /// Retrieves whether the union's current tag state has value "from_anyone". /// /// @return Whether the union's current tag state has value "from_anyone". /// - (BOOL)isFromAnyone; /// /// Retrieves whether the union's current tag state has value "other". /// /// @return Whether the union's current tag state has value "other". /// - (BOOL)isOther; /// /// Retrieves string value of union's current tag state. /// /// @return A human-readable string representing the union's current tag state. /// - (NSString *)tagName; @end #pragma mark - Serializer Object /// /// The serialization class for the `DBTEAMPOLICIESSharedFolderJoinPolicy` /// union. /// @interface DBTEAMPOLICIESSharedFolderJoinPolicySerializer : NSObject /// /// Serializes `DBTEAMPOLICIESSharedFolderJoinPolicy` instances. /// /// @param instance An instance of the `DBTEAMPOLICIESSharedFolderJoinPolicy` /// API object. /// /// @return A json-compatible dictionary representation of the /// `DBTEAMPOLICIESSharedFolderJoinPolicy` API object. /// + (nullable NSDictionary<NSString *, id> *)serialize:(DBTEAMPOLICIESSharedFolderJoinPolicy *)instance; /// /// Deserializes `DBTEAMPOLICIESSharedFolderJoinPolicy` instances. /// /// @param dict A json-compatible dictionary representation of the /// `DBTEAMPOLICIESSharedFolderJoinPolicy` API object. /// /// @return An instantiation of the `DBTEAMPOLICIESSharedFolderJoinPolicy` /// object. /// + (DBTEAMPOLICIESSharedFolderJoinPolicy *)deserialize:(NSDictionary<NSString *, id> *)dict; @end NS_ASSUME_NONNULL_END
{ "pile_set_name": "Github" }
/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml This file is generated by Workflow compiler https://github.com/vczh-libraries ***********************************************************************/ #ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMOREFLECTION #define VCZH_WORKFLOW_COMPILER_GENERATED_DEMOREFLECTION #include "Demo.h" #ifndef VCZH_DEBUG_NO_REFLECTION #include "GacUIReflection.h" #endif #if defined( _MSC_VER) #pragma warning(push) #pragma warning(disable:4250) #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wparentheses-equality" #elif defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wparentheses-equality" #endif /*********************************************************************** Reflection ***********************************************************************/ namespace vl { namespace reflection { namespace description { #ifndef VCZH_DEBUG_NO_REFLECTION DECL_TYPE_INFO(::demo::MainWindow) DECL_TYPE_INFO(::demo::MainWindowConstructor) #endif extern bool LoadDemoTypes(); } } } #if defined( _MSC_VER) #pragma warning(pop) #elif defined(__GNUC__) #pragma GCC diagnostic pop #elif defined(__clang__) #pragma clang diagnostic pop #endif #endif
{ "pile_set_name": "Github" }
--- sandbox/linux/BUILD.gn.orig 2019-04-08 08:18:26 UTC +++ sandbox/linux/BUILD.gn @@ -12,12 +12,12 @@ if (is_android) { } declare_args() { - compile_suid_client = is_linux + compile_suid_client = is_linux && !is_bsd - compile_credentials = is_linux + compile_credentials = is_linux && !is_bsd # On Android, use plain GTest. - use_base_test_suite = is_linux + use_base_test_suite = is_linux && !is_bsd } if (is_nacl_nonsfi) { @@ -379,7 +379,7 @@ component("sandbox_services") { public_deps += [ ":sandbox_services_headers" ] } - if (is_nacl_nonsfi) { + if (is_nacl_nonsfi || is_bsd) { cflags = [ "-fgnu-inline-asm" ] sources -= [ @@ -387,6 +387,8 @@ component("sandbox_services") { "services/init_process_reaper.h", "services/scoped_process.cc", "services/scoped_process.h", + "services/syscall_wrappers.cc", + "services/syscall_wrappers.h", "services/yama.cc", "services/yama.h", "syscall_broker/broker_channel.cc", @@ -405,6 +407,10 @@ component("sandbox_services") { "syscall_broker/broker_process.h", "syscall_broker/broker_simple_message.cc", "syscall_broker/broker_simple_message.h", + ] + sources += [ + "services/libc_interceptor.cc", + "services/libc_interceptor.h", ] } else if (!is_android) { sources += [
{ "pile_set_name": "Github" }
#ifndef CREATE_EMPTY_DIRECTED_GRAPH_WITH_GRAPH_NAME_H #define CREATE_EMPTY_DIRECTED_GRAPH_WITH_GRAPH_NAME_H #include <boost/graph/adjacency_list.hpp> boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::no_property, boost::no_property, boost::property<boost::graph_name_t, std::string>> create_empty_directed_graph_with_graph_name() noexcept; #endif // CREATE_EMPTY_DIRECTED_GRAPH_WITH_GRAPH_NAME_H
{ "pile_set_name": "Github" }
#if !defined(BOOST_PP_IS_ITERATING) ///// header body #ifndef BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED #define BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/prior.hpp> # include <boost/mpl/apply_wrap.hpp> #endif #include <boost/mpl/aux_/config/use_preprocessed.hpp> #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) # define BOOST_MPL_PREPROCESSED_HEADER advance_backward.hpp # include <boost/mpl/aux_/include_preprocessed.hpp> #else # include <boost/mpl/limits/unrolling.hpp> # include <boost/mpl/aux_/nttp_decl.hpp> # include <boost/mpl/aux_/config/eti.hpp> # include <boost/preprocessor/iterate.hpp> # include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/inc.hpp> namespace boost { namespace mpl { namespace aux { // forward declaration template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_backward; # define BOOST_PP_ITERATION_PARAMS_1 \ (3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/advance_backward.hpp>)) # include BOOST_PP_ITERATE() // implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_backward { template< typename Iterator > struct apply { typedef typename apply_wrap1< advance_backward<BOOST_MPL_LIMIT_UNROLLING> , Iterator >::type chunk_result_; typedef typename apply_wrap1< advance_backward<( (N - BOOST_MPL_LIMIT_UNROLLING) < 0 ? 0 : N - BOOST_MPL_LIMIT_UNROLLING )> , chunk_result_ >::type type; }; }; }}} #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED ///// iteration, depth == 1 // For gcc 4.4 compatability, we must include the // BOOST_PP_ITERATION_DEPTH test inside an #else clause. #else // BOOST_PP_IS_ITERATING #if BOOST_PP_ITERATION_DEPTH() == 1 #define i_ BOOST_PP_FRAME_ITERATION(1) template<> struct advance_backward< BOOST_PP_FRAME_ITERATION(1) > { template< typename Iterator > struct apply { typedef Iterator iter0; #if i_ > 0 # define BOOST_PP_ITERATION_PARAMS_2 \ (3,(1, BOOST_PP_FRAME_ITERATION(1), <boost/mpl/aux_/advance_backward.hpp>)) # include BOOST_PP_ITERATE() #endif typedef BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(1)) type; }; #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) /// ETI workaround template<> struct apply<int> { typedef int type; }; #endif }; #undef i_ ///// iteration, depth == 2 #elif BOOST_PP_ITERATION_DEPTH() == 2 # define AUX778076_ITER_0 BOOST_PP_CAT(iter,BOOST_PP_DEC(BOOST_PP_FRAME_ITERATION(2))) # define AUX778076_ITER_1 BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(2)) typedef typename prior<AUX778076_ITER_0>::type AUX778076_ITER_1; # undef AUX778076_ITER_1 # undef AUX778076_ITER_0 #endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING
{ "pile_set_name": "Github" }
/* * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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. */ #import "SimpleDBMissingParameterException.h" @implementation SimpleDBMissingParameterException @synthesize boxUsage; -(id)initWithMessage:(NSString *)theMessage { if (self = [super initWithMessage:theMessage]) { } return self; } -(void)setPropertiesWithException:(AmazonServiceException *)theException { [super setPropertiesWithException:theException]; if ([theException.additionalFields valueForKey:@"BoxUsage"] != nil) { self.boxUsage = [AmazonSDKUtil convertStringToNumber:[theException.additionalFields valueForKey:@"BoxUsage"]]; } } -(NSString *)description { NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:256]; [buffer appendString:@"{"]; [buffer appendString:[[[NSString alloc] initWithFormat:@"BoxUsage: %@,", boxUsage] autorelease]]; [buffer appendString:[super description]]; [buffer appendString:@"}"]; return [buffer autorelease]; } -(void)dealloc { [boxUsage release]; [super dealloc]; } @end
{ "pile_set_name": "Github" }
// Copyright 2004-present Facebook. All Rights Reserved. #include "SamplingProfilerJniMethod.h" #include <JavaScriptCore/JSProfilerPrivate.h> #include <jschelpers/JSCHelpers.h> #include <jni.h> #include <string> using namespace facebook::jni; namespace facebook { namespace react { /* static */ jni::local_ref<SamplingProfilerJniMethod::jhybriddata> SamplingProfilerJniMethod::initHybrid(jni::alias_ref<jclass>, jlong javaScriptContext) { return makeCxxInstance(javaScriptContext); } /* static */ void SamplingProfilerJniMethod::registerNatives() { registerHybrid( {makeNativeMethod("initHybrid", SamplingProfilerJniMethod::initHybrid), makeNativeMethod("poke", SamplingProfilerJniMethod::poke)}); } SamplingProfilerJniMethod::SamplingProfilerJniMethod(jlong javaScriptContext) { context_ = reinterpret_cast<JSGlobalContextRef>(javaScriptContext); } void SamplingProfilerJniMethod::poke( jni::alias_ref<JSPackagerClientResponder::javaobject> responder) { if (!JSC_JSSamplingProfilerEnabled(context_)) { responder->error("The JSSamplingProfiler is disabled. See this " "https://fburl.com/u4lw7xeq for some help"); return; } JSValueRef jsResult = JSC_JSPokeSamplingProfiler(context_); if (JSC_JSValueGetType(context_, jsResult) == kJSTypeNull) { responder->respond("started"); } else { JSStringRef resultStrRef = JSValueToStringCopy(context_, jsResult, nullptr); size_t length = JSStringGetLength(resultStrRef); char buffer[length + 1]; JSStringGetUTF8CString(resultStrRef, buffer, length + 1); JSStringRelease(resultStrRef); responder->respond(buffer); } } } }
{ "pile_set_name": "Github" }
#include <bits/stdc++.h> #define sd(x) scanf("%d",&x) #define sd2(x,y) scanf("%d%d",&x,&y) #define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z) #define fi first #define se second #define pb(x) push_back(x) #define mp(x,y) make_pair(x,y) #define LET(x, a) __typeof(a) x(a) #define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++) #define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); #define func __FUNCTION__ #define line __LINE__ using namespace std; template<typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p){out<<'('<<p.fi<<", "<<p.se<<')'; return out;} template<typename T> ostream& operator<<(ostream& out, vector<T> const & v){ int l = v.size(); for(int i = 0; i < l-1; i++) out<<v[i]<<' '; if(l>0) out<<v[l-1]; return out;} void tr(){cout << endl;} template<typename S, typename ... Strings> void tr(S x, const Strings&... rest){cout<<x<<' ';tr(rest...);} const int N = 100100; int n, p; int l[N], r[N]; int main(){ sd2(n,p); for(int i = 0; i < n; i++){ sd2(l[i], r[i]); } l[n] = l[0]; r[n] = r[0]; long double res = 0; for(int i = 1; i <= n; i++){ long long v1 = (r[i]/p) - ((l[i]-1)/p); long long v2 = (r[i-1]/p) - ((l[i-1]-1)/p); long long l1 = r[i]-l[i]+1; long long l2 = r[i-1]-l[i-1]+1; long long t = (l1-v1)*(l2-v2); long double p = (long double) t / (long double) (l1*l2); p = 1.0f-p; res += p*2000; } printf("%.9lf\n", (double)res); return 0; }
{ "pile_set_name": "Github" }
// RUN: %clang_cc1 -emit-llvm -triple i386-apple-macosx10.7.2 < %s | FileCheck %s // The preferred alignment for a long long on x86-32 is 8; make sure the // alloca for x uses that alignment. int test (long long x) { return (int)x; } // CHECK-LABEL: define i32 @test // CHECK: alloca i64, align 8 // Make sure we honor the aligned attribute. struct X { int x,y,z,a; }; int test2(struct X x __attribute((aligned(16)))) { return x.z; } // CHECK-LABEL: define i32 @test2 // CHECK: alloca %struct._Z1X, align 16
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Gael Guennebaud <gael.guennebaud@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REF_H #define EIGEN_REF_H namespace Eigen { template<typename Derived> class RefBase; template<typename PlainObjectType, int Options = 0, typename StrideType = typename internal::conditional<PlainObjectType::IsVectorAtCompileTime,InnerStride<1>,OuterStride<> >::type > class Ref; /** \class Ref * \ingroup Core_Module * * \brief A matrix or vector expression mapping an existing expressions * * \tparam PlainObjectType the equivalent matrix type of the mapped data * \tparam Options specifies whether the pointer is \c #Aligned, or \c #Unaligned. * The default is \c #Unaligned. * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), * but accept a variable outer stride (leading dimension). * This can be overridden by specifying strides. * The type passed here must be a specialization of the Stride template, see examples below. * * This class permits to write non template functions taking Eigen's object as parameters while limiting the number of copies. * A Ref<> object can represent either a const expression or a l-value: * \code * // in-out argument: * void foo1(Ref<VectorXf> x); * * // read-only const argument: * void foo2(const Ref<const VectorXf>& x); * \endcode * * In the in-out case, the input argument must satisfies the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. * By default, a Ref<VectorXf> can reference any dense vector expression of float having a contiguous memory layout. * Likewise, a Ref<MatrixXf> can reference any column major dense matrix expression of float whose column's elements are contiguously stored with * the possibility to have a constant space inbetween each column, i.e.: the inner stride mmust be equal to 1, but the outer-stride (or leading dimension), * can be greater than the number of rows. * * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. * Here are some examples: * \code * MatrixXf A; * VectorXf a; * foo1(a.head()); // OK * foo1(A.col()); // OK * foo1(A.row()); // compilation error because here innerstride!=1 * foo2(A.row()); // The row is copied into a contiguous temporary * foo2(2*a); // The expression is evaluated into a temporary * foo2(A.col().segment(2,4)); // No temporary * \endcode * * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameter. * Here is an example accepting an innerstride!=1: * \code * // in-out argument: * void foo3(Ref<VectorXf,0,InnerStride<> > x); * foo3(A.row()); // OK * \endcode * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involved more * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overloads internally calling a * template function, e.g.: * \code * // in the .h: * void foo(const Ref<MatrixXf>& A); * void foo(const Ref<MatrixXf,0,Stride<> >& A); * * // in the .cpp: * template<typename TypeOfA> void foo_impl(const TypeOfA& A) { * ... // crazy code goes here * } * void foo(const Ref<MatrixXf>& A) { foo_impl(A); } * void foo(const Ref<MatrixXf,0,Stride<> >& A) { foo_impl(A); } * \endcode * * * \sa PlainObjectBase::Map(), \ref TopicStorageOrders */ namespace internal { template<typename _PlainObjectType, int _Options, typename _StrideType> struct traits<Ref<_PlainObjectType, _Options, _StrideType> > : public traits<Map<_PlainObjectType, _Options, _StrideType> > { typedef _PlainObjectType PlainObjectType; typedef _StrideType StrideType; enum { Options = _Options, Flags = traits<Map<_PlainObjectType, _Options, _StrideType> >::Flags | NestByRefBit }; template<typename Derived> struct match { enum { HasDirectAccess = internal::has_direct_access<Derived>::ret, StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic) || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime) || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1), OuterStrideMatch = Derived::IsVectorAtCompileTime || int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime), AlignmentMatch = (_Options!=Aligned) || ((PlainObjectType::Flags&AlignedBit)==0) || ((traits<Derived>::Flags&AlignedBit)==AlignedBit), MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch }; typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type; }; }; template<typename Derived> struct traits<RefBase<Derived> > : public traits<Derived> {}; } template<typename Derived> class RefBase : public MapBase<Derived> { typedef typename internal::traits<Derived>::PlainObjectType PlainObjectType; typedef typename internal::traits<Derived>::StrideType StrideType; public: typedef MapBase<Derived> Base; EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) inline Index innerStride() const { return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; } inline Index outerStride() const { return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() : IsVectorAtCompileTime ? this->size() : int(Flags)&RowMajorBit ? this->cols() : this->rows(); } RefBase() : Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime), // Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values: m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) protected: typedef Stride<StrideType::OuterStrideAtCompileTime,StrideType::InnerStrideAtCompileTime> StrideBase; template<typename Expression> void construct(Expression& expr) { if(PlainObjectType::RowsAtCompileTime==1) { eigen_assert(expr.rows()==1 || expr.cols()==1); ::new (static_cast<Base*>(this)) Base(expr.data(), 1, expr.size()); } else if(PlainObjectType::ColsAtCompileTime==1) { eigen_assert(expr.rows()==1 || expr.cols()==1); ::new (static_cast<Base*>(this)) Base(expr.data(), expr.size(), 1); } else ::new (static_cast<Base*>(this)) Base(expr.data(), expr.rows(), expr.cols()); ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(), StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride()); } StrideBase m_stride; }; template<typename PlainObjectType, int Options, typename StrideType> class Ref : public RefBase<Ref<PlainObjectType, Options, StrideType> > { typedef internal::traits<Ref> Traits; public: typedef RefBase<Ref> Base; EIGEN_DENSE_PUBLIC_INTERFACE(Ref) #ifndef EIGEN_PARSED_BY_DOXYGEN template<typename Derived> inline Ref(PlainObjectBase<Derived>& expr, typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0) { Base::construct(expr); } template<typename Derived> inline Ref(const DenseBase<Derived>& expr, typename internal::enable_if<bool(internal::is_lvalue<Derived>::value&&bool(Traits::template match<Derived>::MatchAtCompileTime)),Derived>::type* = 0, int = Derived::ThisConstantIsPrivateInPlainObjectBase) #else template<typename Derived> inline Ref(DenseBase<Derived>& expr) #endif { Base::construct(expr.const_cast_derived()); } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref) }; // this is the const ref version template<typename TPlainObjectType, int Options, typename StrideType> class Ref<const TPlainObjectType, Options, StrideType> : public RefBase<Ref<const TPlainObjectType, Options, StrideType> > { typedef internal::traits<Ref> Traits; public: typedef RefBase<Ref> Base; EIGEN_DENSE_PUBLIC_INTERFACE(Ref) template<typename Derived> inline Ref(const DenseBase<Derived>& expr) { // std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << "," << match_helper<Derived>::InnerStrideMatch << "\n"; // std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; // std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n"; construct(expr.derived(), typename Traits::template match<Derived>::type()); } protected: template<typename Expression> void construct(const Expression& expr,internal::true_type) { Base::construct(expr); } template<typename Expression> void construct(const Expression& expr, internal::false_type) { m_object.lazyAssign(expr); Base::construct(m_object); } protected: TPlainObjectType m_object; }; } // end namespace Eigen #endif // EIGEN_REF_H
{ "pile_set_name": "Github" }
// Copyright (C) 2005-2006 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor // Andrew Lumsdaine #ifndef BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP #define BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" #endif #include <boost/graph/parallel/process_group.hpp> #include <boost/type_traits/is_convertible.hpp> #include <vector> #include <boost/assert.hpp> #include <boost/optional.hpp> #include <queue> namespace boost { namespace graph { namespace detail { template<typename ProcessGroup> void do_synchronize(ProcessGroup& pg) { using boost::parallel::synchronize; synchronize(pg); } struct remote_set_queued {}; struct remote_set_immediate {}; template<typename ProcessGroup> class remote_set_semantics { BOOST_STATIC_CONSTANT (bool, queued = (is_convertible< typename ProcessGroup::communication_category, boost::parallel::bsp_process_group_tag>::value)); public: typedef typename mpl::if_c<queued, remote_set_queued, remote_set_immediate>::type type; }; template<typename Derived, typename ProcessGroup, typename Value, typename OwnerMap, typename Semantics = typename remote_set_semantics<ProcessGroup>::type> class remote_update_set; /********************************************************************** * Remote updating set that queues messages until synchronization * **********************************************************************/ template<typename Derived, typename ProcessGroup, typename Value, typename OwnerMap> class remote_update_set<Derived, ProcessGroup, Value, OwnerMap, remote_set_queued> { typedef typename property_traits<OwnerMap>::key_type Key; typedef std::vector<std::pair<Key, Value> > Updates; typedef typename Updates::size_type updates_size_type; typedef typename Updates::value_type updates_pair_type; public: private: typedef typename ProcessGroup::process_id_type process_id_type; enum message_kind { /** Message containing the number of updates that will be sent in * a msg_updates message that will immediately follow. This * message will contain a single value of type * updates_size_type. */ msg_num_updates, /** Contains (key, value) pairs with all of the updates from a * particular source. The number of updates is variable, but will * be provided in a msg_num_updates message that immediately * preceeds this message. * */ msg_updates }; struct handle_messages { explicit handle_messages(remote_update_set* self, const ProcessGroup& pg) : self(self), update_sizes(num_processes(pg), 0) { } void operator()(process_id_type source, int tag) { switch(tag) { case msg_num_updates: { // Receive the # of updates updates_size_type num_updates; receive(self->process_group, source, tag, num_updates); update_sizes[source] = num_updates; } break; case msg_updates: { updates_size_type num_updates = update_sizes[source]; BOOST_ASSERT(num_updates); // Receive the actual updates std::vector<updates_pair_type> updates(num_updates); receive(self->process_group, source, msg_updates, &updates[0], num_updates); // Send updates to derived "receive_update" member Derived* derived = static_cast<Derived*>(self); for (updates_size_type u = 0; u < num_updates; ++u) derived->receive_update(source, updates[u].first, updates[u].second); update_sizes[source] = 0; } break; }; } private: remote_update_set* self; std::vector<updates_size_type> update_sizes; }; friend struct handle_messages; protected: remote_update_set(const ProcessGroup& pg, const OwnerMap& owner) : process_group(pg, handle_messages(this, pg)), updates(num_processes(pg)), owner(owner) { } void update(const Key& key, const Value& value) { if (get(owner, key) == process_id(process_group)) { Derived* derived = static_cast<Derived*>(this); derived->receive_update(get(owner, key), key, value); } else { updates[get(owner, key)].push_back(std::make_pair(key, value)); } } void collect() { } void synchronize() { // Emit all updates and then remove them process_id_type num_processes = updates.size(); for (process_id_type p = 0; p < num_processes; ++p) { if (!updates[p].empty()) { send(process_group, p, msg_num_updates, updates[p].size()); send(process_group, p, msg_updates, &updates[p].front(), updates[p].size()); updates[p].clear(); } } do_synchronize(process_group); } ProcessGroup process_group; private: std::vector<Updates> updates; OwnerMap owner; }; /********************************************************************** * Remote updating set that sends messages immediately * **********************************************************************/ template<typename Derived, typename ProcessGroup, typename Value, typename OwnerMap> class remote_update_set<Derived, ProcessGroup, Value, OwnerMap, remote_set_immediate> { typedef typename property_traits<OwnerMap>::key_type Key; typedef std::pair<Key, Value> update_pair_type; typedef typename std::vector<update_pair_type>::size_type updates_size_type; public: typedef typename ProcessGroup::process_id_type process_id_type; private: enum message_kind { /** Contains a (key, value) pair that will be updated. */ msg_update }; struct handle_messages { explicit handle_messages(remote_update_set* self, const ProcessGroup& pg) : self(self) { update_sizes.resize(num_processes(pg), 0); } void operator()(process_id_type source, int tag) { // Receive the # of updates BOOST_ASSERT(tag == msg_update); update_pair_type update; receive(self->process_group, source, tag, update); // Send update to derived "receive_update" member Derived* derived = static_cast<Derived*>(self); derived->receive_update(source, update.first, update.second); } private: std::vector<updates_size_type> update_sizes; remote_update_set* self; }; friend struct handle_messages; protected: remote_update_set(const ProcessGroup& pg, const OwnerMap& owner) : process_group(pg, handle_messages(this, pg)), owner(owner) { } void update(const Key& key, const Value& value) { if (get(owner, key) == process_id(process_group)) { Derived* derived = static_cast<Derived*>(this); derived->receive_update(get(owner, key), key, value); } else send(process_group, get(owner, key), msg_update, update_pair_type(key, value)); } void collect() { typedef std::pair<process_id_type, int> probe_type; handle_messages handler(this, process_group); while (optional<probe_type> stp = probe(process_group)) if (stp->second == msg_update) handler(stp->first, stp->second); } void synchronize() { do_synchronize(process_group); } ProcessGroup process_group; OwnerMap owner; }; } } } // end namespace boost::graph::detail #endif // BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP
{ "pile_set_name": "Github" }
/** @file Intel Processor Power Management ACPI Code. Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "CpuPowerMgmt.h" DefinitionBlock ( "CPU0PSD.aml", "SSDT", 0x02, "PmRef", "Cpu0Psd", 0x3000 ) { External(\PC00, IntObj) External(\TCNT, FieldUnitObj) External(\_SB.CFGD, FieldUnitObj) External(\_SB.PR00, DeviceObj) Scope(\_SB.PR00) { Name(HPSD,Package() // HW_ALL { Package() {5, // NumEntries. Current Value is 5. 0, // Revision. Current Value is 0. 0, // Domain. 0xFE, // Coordination type 0xFE = HW_ALL 0x80 // Number of processors. } }) Name(SPSD,Package() // SW_ALL { Package() {5, // NumEntries. Current Value is 5. 0, // Revision. Current Value is 0. 0, // Domain. 0xFC, // Coordination type 0xFC = SW_ALL 0x80 // Number of processors. } }) // // The _PSD object provides information to the OSPM related // to P-State coordination between processors in a multi-processor // configurations. // Method(_PSD,0) { If (And(\_SB.CFGD, PPM_TURBO_BOOST_MAX)) // Intel Turbo Boost Max 3.0 { Store (0, Index(DerefOf(Index(HPSD, 0)),2)) // Domain Store (1, Index(DerefOf(Index(HPSD, 0)),4)) // Number of processors belonging to the domain. } Else { Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4)) Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4)) } If(And(PC00,0x0800)) // If Hardware co-ordination of P states { Return(HPSD) } Return(SPSD) } } // End of Scope(\_SB.PR00) } // End of Definition Block
{ "pile_set_name": "Github" }
--- contrib/virt.te 2012-11-25 21:35:09.181247450 +0100 +++ contrib/virt.te 2012-11-25 21:34:09.223216815 +0100 @@ -281,7 +281,11 @@ userdom_search_user_home_dirs(virt_domain) userdom_read_all_users_state(virt_domain) -qemu_exec(virt_domain) +ifdef(`distro_gentoo',` + optional_policy(` + qemu_exec(virt_domain) + ') +') tunable_policy(`virt_use_execmem',` allow virt_domain self:process { execmem execstack };
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2018 Kohei Takahashi 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 BOOST_FUSION_IS_NATIVE_FUSION_SEQUENCE #define BOOST_FUSION_IS_NATIVE_FUSION_SEQUENCE #include <boost/fusion/support/config.hpp> #include <boost/fusion/support/sequence_base.hpp> #include <boost/mpl/and.hpp> #include <boost/type_traits/is_complete.hpp> #include <boost/type_traits/is_convertible.hpp> namespace boost { namespace fusion { namespace detail { template <typename Sequence> struct is_native_fusion_sequence : mpl::and_< is_complete<Sequence> , is_convertible<Sequence, detail::from_sequence_convertible_type> > {}; }}} #endif
{ "pile_set_name": "Github" }
/* * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <stdio.h> #include <errno.h> #include "bio_lcl.h" #include "internal/cryptlib.h" /* * BIO_put and BIO_get both add to the digest, BIO_gets returns the digest */ static int nullf_write(BIO *h, const char *buf, int num); static int nullf_read(BIO *h, char *buf, int size); static int nullf_puts(BIO *h, const char *str); static int nullf_gets(BIO *h, char *str, int size); static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2); static long nullf_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp); static const BIO_METHOD methods_nullf = { BIO_TYPE_NULL_FILTER, "NULL filter", /* TODO: Convert to new style write function */ bwrite_conv, nullf_write, /* TODO: Convert to new style read function */ bread_conv, nullf_read, nullf_puts, nullf_gets, nullf_ctrl, NULL, NULL, nullf_callback_ctrl, }; const BIO_METHOD *BIO_f_null(void) { return &methods_nullf; } static int nullf_read(BIO *b, char *out, int outl) { int ret = 0; if (out == NULL) return 0; if (b->next_bio == NULL) return 0; ret = BIO_read(b->next_bio, out, outl); BIO_clear_retry_flags(b); BIO_copy_next_retry(b); return ret; } static int nullf_write(BIO *b, const char *in, int inl) { int ret = 0; if ((in == NULL) || (inl <= 0)) return 0; if (b->next_bio == NULL) return 0; ret = BIO_write(b->next_bio, in, inl); BIO_clear_retry_flags(b); BIO_copy_next_retry(b); return ret; } static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr) { long ret; if (b->next_bio == NULL) return 0; switch (cmd) { case BIO_C_DO_STATE_MACHINE: BIO_clear_retry_flags(b); ret = BIO_ctrl(b->next_bio, cmd, num, ptr); BIO_copy_next_retry(b); break; case BIO_CTRL_DUP: ret = 0L; break; default: ret = BIO_ctrl(b->next_bio, cmd, num, ptr); } return ret; } static long nullf_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) { long ret = 1; if (b->next_bio == NULL) return 0; switch (cmd) { default: ret = BIO_callback_ctrl(b->next_bio, cmd, fp); break; } return ret; } static int nullf_gets(BIO *bp, char *buf, int size) { if (bp->next_bio == NULL) return 0; return BIO_gets(bp->next_bio, buf, size); } static int nullf_puts(BIO *bp, const char *str) { if (bp->next_bio == NULL) return 0; return BIO_puts(bp->next_bio, str); }
{ "pile_set_name": "Github" }
#include "api_config.h" #include "common.h" #include <iostream> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ini_parser.hpp> #include <boost/algorithm/string.hpp> // === implementation of the api_config class === using namespace lsl; using namespace lslboost::algorithm; /// Helper function: Substitute the "~" character by the full home directory (according to environment variables). std::string expand_tilde(const std::string &filename) { if (!filename.empty() && filename[0] == '~') { std::string homedir; if (getenv("HOME")) homedir = getenv("HOME"); else if (getenv("USERPROFILE")) homedir = getenv("USERPROFILE"); else if (getenv("HOMEDRIVE") && getenv("HOMEPATH")) homedir = std::string(getenv("HOMEDRIVE")) + getenv("HOMEPATH"); else { std::cerr << "Cannot determine the user's home directory; config files in the home directory will not be discovered." << std::endl; return filename; } return homedir + filename.substr(1); } return filename; } /// Helper function: Parse a set specifier (a string of the form {a, b, c, ...}) into a vector of strings. static std::vector<std::string> parse_set(const std::string &setstr) { std::vector<std::string> result; if ((setstr.size() > 2) && setstr[0] == '{' && setstr[setstr.size()-1] == '}') { // non-empty set: split by "," std::string sub = setstr.substr(1,setstr.size()-2); lslboost::algorithm::split(result,sub,lslboost::algorithm::is_any_of(",")); // remove leading and trailing whitespace from each element for (std::vector<std::string>::iterator i=result.begin(); i!=result.end(); i++) trim(*i); } return result; } // Returns true if the file exists and is openable for reading bool file_is_readable(const std::string& filename) { std::ifstream f(filename.c_str()); return f.good(); } /** * Constructor. * Applies default settings and overrides them based on a config file (if present). */ api_config::api_config() { // for each config file location under consideration... std::string filenames[] = {"lsl_api.cfg", expand_tilde("~/lsl_api/lsl_api.cfg"), "/etc/lsl_api/lsl_api.cfg"}; for (std::size_t k=0; k < sizeof(filenames)/sizeof(filenames[0]); k++) { try { if (file_is_readable(filenames[k])) { // try to load it if the file exists load_from_file(filenames[k]); // successful: finished return; } } catch(std::exception &e) { std::cerr << "Error trying to load config file " << filenames[k] << ": " << e.what() << std::endl; } } // unsuccessful: load default settings load_from_file(); } /** * Load a configuration file (or use defaults if a filename is empty). * Expects a proper platform-native file name. Throws if there's an error. */ void api_config::load_from_file(const std::string &filename) { try { lslboost::property_tree::ptree pt; if (!filename.empty()) read_ini(filename, pt); // read out the [ports] parameters multicast_port_ = pt.get("ports.MulticastPort",16571); base_port_ = pt.get("ports.BasePort",16572); port_range_ = pt.get("ports.PortRange",32); allow_random_ports_ = pt.get("ports.AllowRandomPorts",true); #ifdef __APPLE__ ipv6_ = pt.get("ports.IPv6","disable"); // on Mac OS (10.7) there's a bug in the IPv6 implementation that breaks LSL when it tries to use both v4 and v6 #else ipv6_ = pt.get("ports.IPv6","allow"); #endif // fix some common mis-spellings if (ipv6_ == "disabled") ipv6_ = "disable"; if (ipv6_ == "allowed") ipv6_ = "allow"; if (ipv6_ == "forced") ipv6_ = "force"; if (ipv6_ != "disable" && ipv6_ != "allow" && ipv6_ != "force") throw std::runtime_error("Unsupported setting for the IPv6 parameter."); // read the [multicast] parameters resolve_scope_ = pt.get("multicast.ResolveScope","site"); listen_address_ = pt.get("multicast.ListenAddress",""); std::vector<std::string> machine_group = parse_set(pt.get("multicast.MachineAddresses","{127.0.0.1, FF31:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}")); std::vector<std::string> link_group = parse_set(pt.get("multicast.LinkAddresses","{255.255.255.255, 224.0.0.183, FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}")); std::vector<std::string> site_group = parse_set(pt.get("multicast.SiteAddresses","{239.255.172.215, FF05:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}")); std::vector<std::string> organization_group = parse_set(pt.get("multicast.OrganizationAddresses","{239.192.172.215, FF08:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}")); std::vector<std::string> global_group = parse_set(pt.get("multicast.GlobalAddresses","{}")); multicast_ttl_ = -1; // construct list of addresses & TTL according to the ResolveScope. if (resolve_scope_ == "machine") { multicast_addresses_ = machine_group; multicast_ttl_ = 0; } if (resolve_scope_ == "link") { multicast_addresses_ = machine_group; multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end()); multicast_ttl_ = 1; } if (resolve_scope_ == "site") { multicast_addresses_ = machine_group; multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end()); multicast_addresses_.insert(multicast_addresses_.end(),site_group.begin(),site_group.end()); multicast_ttl_ = 24; } if (resolve_scope_ == "organization") { multicast_addresses_ = machine_group; multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end()); multicast_addresses_.insert(multicast_addresses_.end(),site_group.begin(),site_group.end()); multicast_addresses_.insert(multicast_addresses_.end(),organization_group.begin(),organization_group.end()); multicast_ttl_ = 32; } if (resolve_scope_ == "global") { multicast_addresses_ = machine_group; multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end()); multicast_addresses_.insert(multicast_addresses_.end(),site_group.begin(),site_group.end()); multicast_addresses_.insert(multicast_addresses_.end(),organization_group.begin(),organization_group.end()); multicast_addresses_.insert(multicast_addresses_.end(),global_group.begin(),global_group.end()); multicast_ttl_ = 255; } if (multicast_ttl_ == -1) throw std::runtime_error("This ResolveScope setting is unsupported."); // apply overrides, if any int ttl_override = pt.get("multicast.TTLOverride",-1); std::vector<std::string> address_override = parse_set(pt.get("multicast.AddressesOverride","{}")); if (ttl_override >= 0) multicast_ttl_ = ttl_override; if (!address_override.empty()) multicast_addresses_ = address_override; // read the [lab] settings known_peers_ = parse_set(pt.get("lab.KnownPeers","{}")); session_id_ = pt.get("lab.SessionID","default"); // read the [tuning] settings use_protocol_version_ = std::min(LSL_PROTOCOL_VERSION,pt.get("tuning.UseProtocolVersion",LSL_PROTOCOL_VERSION)); watchdog_check_interval_ = pt.get("tuning.WatchdogCheckInterval",15.0); watchdog_time_threshold_ = pt.get("tuning.WatchdogTimeThreshold",15.0); multicast_min_rtt_ = pt.get("tuning.MulticastMinRTT",0.5); multicast_max_rtt_ = pt.get("tuning.MulticastMaxRTT",3.0); unicast_min_rtt_ = pt.get("tuning.UnicastMinRTT",0.75); unicast_max_rtt_ = pt.get("tuning.UnicastMaxRTT",5.0); continuous_resolve_interval_ = pt.get("tuning.ContinuousResolveInterval",0.5); timer_resolution_ = pt.get("tuning.TimerResolution",1); max_cached_queries_ = pt.get("tuning.MaxCachedQueries",100); time_update_interval_ = pt.get("tuning.TimeUpdateInterval",2.0); time_update_minprobes_ = pt.get("tuning.TimeUpdateMinProbes",6); time_probe_count_ = pt.get("tuning.TimeProbeCount",8); time_probe_interval_ = pt.get("tuning.TimeProbeInterval",0.064); time_probe_max_rtt_ = pt.get("tuning.TimeProbeMaxRTT",0.128); outlet_buffer_reserve_ms_ = pt.get("tuning.OutletBufferReserveMs",5000); outlet_buffer_reserve_samples_ = pt.get("tuning.OutletBufferReserveSamples",128); inlet_buffer_reserve_ms_ = pt.get("tuning.InletBufferReserveMs",5000); inlet_buffer_reserve_samples_ = pt.get("tuning.InletBufferReserveSamples",128); smoothing_halftime_ = pt.get("tuning.SmoothingHalftime",90.0f); force_default_timestamps_ = pt.get("tuning.ForceDefaultTimestamps", false); } catch(std::exception &e) { std::cerr << "Error parsing config file " << filename << " (" << e.what() << "). Rolling back to defaults." << std::endl; // any error: assign defaults load_from_file(); // and rethrow throw e; } } /** * Instantiate / retrieve singleton. */ const api_config *api_config::get_instance() { lslboost::call_once(&called_once,once_flag); return get_instance_internal(); } api_config *api_config::get_instance_internal() { static api_config cfg; return &cfg; } void api_config::called_once() { get_instance_internal(); } lslboost::once_flag api_config::once_flag = BOOST_ONCE_INIT;
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Preprocessed version of "boost/mpl/apply_wrap.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { template< typename F , typename has_apply_ = typename aux::has_apply<F>::type > struct apply_wrap0 : F::template apply< > { }; template< typename F, typename T1 > struct apply_wrap1 : F::template apply<T1> { }; template< typename F, typename T1, typename T2 > struct apply_wrap2 : F::template apply< T1,T2 > { }; template< typename F, typename T1, typename T2, typename T3 > struct apply_wrap3 : F::template apply< T1,T2,T3 > { }; template< typename F, typename T1, typename T2, typename T3, typename T4 > struct apply_wrap4 : F::template apply< T1,T2,T3,T4 > { }; template< typename F, typename T1, typename T2, typename T3, typename T4 , typename T5 > struct apply_wrap5 : F::template apply< T1,T2,T3,T4,T5 > { }; }}
{ "pile_set_name": "Github" }
--- a/pppd/sha1.c +++ b/pppd/sha1.c @@ -18,7 +18,7 @@ #include <string.h> #include <netinet/in.h> /* htonl() */ -#include <net/ppp_defs.h> +#include "pppd.h" #include "sha1.h" static void
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <memory.h> #include <malloc.h> #include <time.h> #include <ctype.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <errno.h> #include <sys/time.h> #include <linux/hpet.h> extern void hpet_open_close(int, const char **); extern void hpet_info(int, const char **); extern void hpet_poll(int, const char **); extern void hpet_fasync(int, const char **); extern void hpet_read(int, const char **); #include <sys/poll.h> #include <sys/ioctl.h> struct hpet_command { char *command; void (*func)(int argc, const char ** argv); } hpet_command[] = { { "open-close", hpet_open_close }, { "info", hpet_info }, { "poll", hpet_poll }, { "fasync", hpet_fasync }, }; int main(int argc, const char ** argv) { unsigned int i; argc--; argv++; if (!argc) { fprintf(stderr, "-hpet: requires command\n"); return -1; } for (i = 0; i < (sizeof (hpet_command) / sizeof (hpet_command[0])); i++) if (!strcmp(argv[0], hpet_command[i].command)) { argc--; argv++; fprintf(stderr, "-hpet: executing %s\n", hpet_command[i].command); hpet_command[i].func(argc, argv); return 0; } fprintf(stderr, "do_hpet: command %s not implemented\n", argv[0]); return -1; } void hpet_open_close(int argc, const char **argv) { int fd; if (argc != 1) { fprintf(stderr, "hpet_open_close: device-name\n"); return; } fd = open(argv[0], O_RDONLY); if (fd < 0) fprintf(stderr, "hpet_open_close: open failed\n"); else close(fd); return; } void hpet_info(int argc, const char **argv) { struct hpet_info info; int fd; if (argc != 1) { fprintf(stderr, "hpet_info: device-name\n"); return; } fd = open(argv[0], O_RDONLY); if (fd < 0) { fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]); return; } if (ioctl(fd, HPET_INFO, &info) < 0) { fprintf(stderr, "hpet_info: failed to get info\n"); goto out; } fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ", info.hi_ireqfreq, info.hi_flags); fprintf(stderr, "hi_hpet %d hi_timer %d\n", info.hi_hpet, info.hi_timer); out: close(fd); return; } void hpet_poll(int argc, const char **argv) { unsigned long freq; int iterations, i, fd; struct pollfd pfd; struct hpet_info info; struct timeval stv, etv; struct timezone tz; long usec; if (argc != 3) { fprintf(stderr, "hpet_poll: device-name freq iterations\n"); return; } freq = atoi(argv[1]); iterations = atoi(argv[2]); fd = open(argv[0], O_RDONLY); if (fd < 0) { fprintf(stderr, "hpet_poll: open of %s failed\n", argv[0]); return; } if (ioctl(fd, HPET_IRQFREQ, freq) < 0) { fprintf(stderr, "hpet_poll: HPET_IRQFREQ failed\n"); goto out; } if (ioctl(fd, HPET_INFO, &info) < 0) { fprintf(stderr, "hpet_poll: failed to get info\n"); goto out; } fprintf(stderr, "hpet_poll: info.hi_flags 0x%lx\n", info.hi_flags); if (info.hi_flags && (ioctl(fd, HPET_EPI, 0) < 0)) { fprintf(stderr, "hpet_poll: HPET_EPI failed\n"); goto out; } if (ioctl(fd, HPET_IE_ON, 0) < 0) { fprintf(stderr, "hpet_poll, HPET_IE_ON failed\n"); goto out; } pfd.fd = fd; pfd.events = POLLIN; for (i = 0; i < iterations; i++) { pfd.revents = 0; gettimeofday(&stv, &tz); if (poll(&pfd, 1, -1) < 0) fprintf(stderr, "hpet_poll: poll failed\n"); else { long data; gettimeofday(&etv, &tz); usec = stv.tv_sec * 1000000 + stv.tv_usec; usec = (etv.tv_sec * 1000000 + etv.tv_usec) - usec; fprintf(stderr, "hpet_poll: expired time = 0x%lx\n", usec); fprintf(stderr, "hpet_poll: revents = 0x%x\n", pfd.revents); if (read(fd, &data, sizeof(data)) != sizeof(data)) { fprintf(stderr, "hpet_poll: read failed\n"); } else fprintf(stderr, "hpet_poll: data 0x%lx\n", data); } } out: close(fd); return; } static int hpet_sigio_count; static void hpet_sigio(int val) { fprintf(stderr, "hpet_sigio: called\n"); hpet_sigio_count++; } void hpet_fasync(int argc, const char **argv) { unsigned long freq; int iterations, i, fd, value; sig_t oldsig; struct hpet_info info; hpet_sigio_count = 0; fd = -1; if ((oldsig = signal(SIGIO, hpet_sigio)) == SIG_ERR) { fprintf(stderr, "hpet_fasync: failed to set signal handler\n"); return; } if (argc != 3) { fprintf(stderr, "hpet_fasync: device-name freq iterations\n"); goto out; } fd = open(argv[0], O_RDONLY); if (fd < 0) { fprintf(stderr, "hpet_fasync: failed to open %s\n", argv[0]); return; } if ((fcntl(fd, F_SETOWN, getpid()) == 1) || ((value = fcntl(fd, F_GETFL)) == 1) || (fcntl(fd, F_SETFL, value | O_ASYNC) == 1)) { fprintf(stderr, "hpet_fasync: fcntl failed\n"); goto out; } freq = atoi(argv[1]); iterations = atoi(argv[2]); if (ioctl(fd, HPET_IRQFREQ, freq) < 0) { fprintf(stderr, "hpet_fasync: HPET_IRQFREQ failed\n"); goto out; } if (ioctl(fd, HPET_INFO, &info) < 0) { fprintf(stderr, "hpet_fasync: failed to get info\n"); goto out; } fprintf(stderr, "hpet_fasync: info.hi_flags 0x%lx\n", info.hi_flags); if (info.hi_flags && (ioctl(fd, HPET_EPI, 0) < 0)) { fprintf(stderr, "hpet_fasync: HPET_EPI failed\n"); goto out; } if (ioctl(fd, HPET_IE_ON, 0) < 0) { fprintf(stderr, "hpet_fasync, HPET_IE_ON failed\n"); goto out; } for (i = 0; i < iterations; i++) { (void) pause(); fprintf(stderr, "hpet_fasync: count = %d\n", hpet_sigio_count); } out: signal(SIGIO, oldsig); if (fd >= 0) close(fd); return; }
{ "pile_set_name": "Github" }
// // Created by Fabrice Aneche on 06/01/14. // Copyright (c) 2014 Dailymotion. All rights reserved. // #import <Foundation/Foundation.h> @interface NSData (ImageContentType) /** * Compute the content type for an image data * * @param data the input data * * @return the content type as string (i.e. image/jpeg, image/gif) */ + (NSString *)sd_contentTypeForImageData:(NSData *)data; @end @interface NSData (ImageContentTypeDeprecated) + (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); @end
{ "pile_set_name": "Github" }
#include "ExtractionOptionsJsonObject.h" #include <regex> namespace polycube { namespace service { namespace model { ExtractionOptionsJsonObject::ExtractionOptionsJsonObject() { m_swapOnRead = false; m_swapOnReadIsSet = true; m_emptyOnRead = false; m_emptyOnReadIsSet = true; } ExtractionOptionsJsonObject::ExtractionOptionsJsonObject(const nlohmann::json &val) : JsonObjectBase(val) { m_swapOnReadIsSet = false; m_emptyOnReadIsSet = false; if (val.count("swap-on-read")) setSwapOnRead(val.at("swap-on-read").get<bool>()); if (val.count("empty-on-read")) setEmptyOnRead(val.at("empty-on-read").get<bool>()); } nlohmann::json ExtractionOptionsJsonObject::toJson() const { nlohmann::json val = nlohmann::json::object(); if (!getBase().is_null()) val.update(getBase()); if (m_swapOnReadIsSet) val["swap-on-read"] = m_swapOnRead; if (m_emptyOnReadIsSet) val["empty-on-read"] = m_emptyOnRead; return val; } bool ExtractionOptionsJsonObject::getSwapOnRead() const { return m_swapOnRead; } void ExtractionOptionsJsonObject::setSwapOnRead(bool value) { m_swapOnRead = value; m_swapOnReadIsSet = true; } bool ExtractionOptionsJsonObject::swapOnReadIsSet() const { return m_swapOnReadIsSet; } void ExtractionOptionsJsonObject::unsetSwapOnRead() { m_swapOnReadIsSet = false; } bool ExtractionOptionsJsonObject::getEmptyOnRead() const { return m_emptyOnRead; } void ExtractionOptionsJsonObject::setEmptyOnRead(bool value) { m_emptyOnRead = value; m_emptyOnReadIsSet = true; } bool ExtractionOptionsJsonObject::emptyOnReadIsSet() const { return m_emptyOnReadIsSet; } void ExtractionOptionsJsonObject::unsetEmptyOnRead() { m_emptyOnReadIsSet = false; } }// namespace model }// namespace service }// namespace polycube
{ "pile_set_name": "Github" }
/* Mantis PCI bridge driver Copyright (C) Manu Abraham (abraham.manu@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <asm/io.h> #include <linux/ioport.h> #include <linux/pci.h> #include <linux/i2c.h> #include "dmxdev.h" #include "dvbdev.h" #include "dvb_demux.h" #include "dvb_frontend.h" #include "dvb_net.h" #include "mantis_common.h" #include "mantis_reg.h" #include "mantis_i2c.h" #define TRIALS 10000 static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg) { u32 rxd, i, stat, trials; dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", __func__, msg->addr); for (i = 0; i < msg->len; i++) { rxd = (msg->addr << 25) | (1 << 24) | MANTIS_I2C_RATE_3 | MANTIS_I2C_STOP | MANTIS_I2C_PGMODE; if (i == (msg->len - 1)) rxd &= ~MANTIS_I2C_STOP; mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT); mmwrite(rxd, MANTIS_I2CDATA_CTL); /* wait for xfer completion */ for (trials = 0; trials < TRIALS; trials++) { stat = mmread(MANTIS_INT_STAT); if (stat & MANTIS_INT_I2CDONE) break; } dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials); /* wait for xfer completion */ for (trials = 0; trials < TRIALS; trials++) { stat = mmread(MANTIS_INT_STAT); if (stat & MANTIS_INT_I2CRACK) break; } dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials); rxd = mmread(MANTIS_I2CDATA_CTL); msg->buf[i] = (u8)((rxd >> 8) & 0xFF); dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]); } dprintk(MANTIS_INFO, 0, "]\n"); return 0; } static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg) { int i; u32 txd = 0, stat, trials; dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", __func__, msg->addr); for (i = 0; i < msg->len; i++) { dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]); txd = (msg->addr << 25) | (msg->buf[i] << 8) | MANTIS_I2C_RATE_3 | MANTIS_I2C_STOP | MANTIS_I2C_PGMODE; if (i == (msg->len - 1)) txd &= ~MANTIS_I2C_STOP; mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT); mmwrite(txd, MANTIS_I2CDATA_CTL); /* wait for xfer completion */ for (trials = 0; trials < TRIALS; trials++) { stat = mmread(MANTIS_INT_STAT); if (stat & MANTIS_INT_I2CDONE) break; } dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials); /* wait for xfer completion */ for (trials = 0; trials < TRIALS; trials++) { stat = mmread(MANTIS_INT_STAT); if (stat & MANTIS_INT_I2CRACK) break; } dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials); } dprintk(MANTIS_INFO, 0, "]\n"); return 0; } static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) { int ret = 0, i = 0, trials; u32 stat, data, txd; struct mantis_pci *mantis; struct mantis_hwconfig *config; mantis = i2c_get_adapdata(adapter); BUG_ON(!mantis); config = mantis->hwconfig; BUG_ON(!config); dprintk(MANTIS_DEBUG, 1, "Messages:%d", num); mutex_lock(&mantis->i2c_lock); while (i < num) { /* Byte MODE */ if ((config->i2c_mode & MANTIS_BYTE_MODE) && ((i + 1) < num) && (msgs[i].len < 2) && (msgs[i + 1].len < 2) && (msgs[i + 1].flags & I2C_M_RD)) { dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n"); /* Read operation */ txd = msgs[i].addr << 25 | (0x1 << 24) | (msgs[i].buf[0] << 16) | MANTIS_I2C_RATE_3; mmwrite(txd, MANTIS_I2CDATA_CTL); /* wait for xfer completion */ for (trials = 0; trials < TRIALS; trials++) { stat = mmread(MANTIS_INT_STAT); if (stat & MANTIS_INT_I2CDONE) break; } /* check for xfer completion */ if (stat & MANTIS_INT_I2CDONE) { /* check xfer was acknowledged */ if (stat & MANTIS_INT_I2CRACK) { data = mmread(MANTIS_I2CDATA_CTL); msgs[i + 1].buf[0] = (data >> 8) & 0xff; dprintk(MANTIS_DEBUG, 0, " Byte <%d> RXD=0x%02x [%02x]\n", 0x0, data, msgs[i + 1].buf[0]); } else { /* I/O error */ dprintk(MANTIS_ERROR, 1, " I/O error, LINE:%d", __LINE__); ret = -EIO; break; } } else { /* I/O error */ dprintk(MANTIS_ERROR, 1, " I/O error, LINE:%d", __LINE__); ret = -EIO; break; } i += 2; /* Write/Read operation in one go */ } if (i < num) { if (msgs[i].flags & I2C_M_RD) ret = mantis_i2c_read(mantis, &msgs[i]); else ret = mantis_i2c_write(mantis, &msgs[i]); i++; if (ret < 0) goto bail_out; } } mutex_unlock(&mantis->i2c_lock); return num; bail_out: mutex_unlock(&mantis->i2c_lock); return ret; } static u32 mantis_i2c_func(struct i2c_adapter *adapter) { return I2C_FUNC_SMBUS_EMUL; } static struct i2c_algorithm mantis_algo = { .master_xfer = mantis_i2c_xfer, .functionality = mantis_i2c_func, }; int __devinit mantis_i2c_init(struct mantis_pci *mantis) { u32 intstat, intmask; struct i2c_adapter *i2c_adapter = &mantis->adapter; struct pci_dev *pdev = mantis->pdev; init_waitqueue_head(&mantis->i2c_wq); mutex_init(&mantis->i2c_lock); strncpy(i2c_adapter->name, "Mantis I2C", sizeof(i2c_adapter->name)); i2c_set_adapdata(i2c_adapter, mantis); i2c_adapter->owner = THIS_MODULE; i2c_adapter->algo = &mantis_algo; i2c_adapter->algo_data = NULL; i2c_adapter->timeout = 500; i2c_adapter->retries = 3; i2c_adapter->dev.parent = &pdev->dev; mantis->i2c_rc = i2c_add_adapter(i2c_adapter); if (mantis->i2c_rc < 0) return mantis->i2c_rc; dprintk(MANTIS_DEBUG, 1, "Initializing I2C .."); intstat = mmread(MANTIS_INT_STAT); intmask = mmread(MANTIS_INT_MASK); mmwrite(intstat, MANTIS_INT_STAT); dprintk(MANTIS_DEBUG, 1, "Disabling I2C interrupt"); intmask = mmread(MANTIS_INT_MASK); mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK); return 0; } EXPORT_SYMBOL_GPL(mantis_i2c_init); int mantis_i2c_exit(struct mantis_pci *mantis) { u32 intmask; dprintk(MANTIS_DEBUG, 1, "Disabling I2C interrupt"); intmask = mmread(MANTIS_INT_MASK); mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK); dprintk(MANTIS_DEBUG, 1, "Removing I2C adapter"); return i2c_del_adapter(&mantis->adapter); } EXPORT_SYMBOL_GPL(mantis_i2c_exit);
{ "pile_set_name": "Github" }
#include <elle/das/tuple.hh> #include <elle/test.hh> #include <elle/serialization/json.hh> #include <elle/das/Symbol.hh> #include <elle/das/serializer.hh> ELLE_DAS_SYMBOL(foo); ELLE_DAS_SYMBOL(bar); static void basics() { auto t = elle::das::make_tuple(foo = 3, bar = "lol"); BOOST_CHECK_EQUAL(t.foo, 3); BOOST_CHECK_EQUAL(t.bar, "lol"); } static void move() { elle::das::make_tuple(foo = elle::make_unique<int>(42), bar = std::vector<int>()); auto f = elle::make_unique<int>(42); auto b = std::vector<int>(); elle::das::make_tuple(foo = std::move(f), bar = b); } static void print() { auto t = elle::das::make_tuple(foo = 3, bar = "lol"); BOOST_CHECK_EQUAL(elle::sprintf("%s", t), "(foo = 3, bar = lol)"); } static void serialize() { auto t = elle::das::make_tuple(foo = 3, bar = std::string("lol")); auto s = elle::serialization::json::serialize(t); auto j = elle::json::read(s.string()); BOOST_CHECK(j["foo"] == 3); BOOST_CHECK(j["bar"] == "lol"); auto d = elle::serialization::json::deserialize<decltype(t)>(s); BOOST_CHECK(d.foo == t.foo); BOOST_CHECK(d.bar == t.bar); } static void hash() { using elle::das::make_tuple; BOOST_TEST( hash_value(elle::das::make_tuple()) == hash_value(elle::das::make_tuple())); BOOST_TEST( hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) == hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol")))); BOOST_TEST( hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) != hash_value(elle::das::make_tuple(foo = 4, bar = std::string("lol")))); BOOST_TEST( hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) != hash_value(elle::das::make_tuple(foo = 3, bar = std::string("bar")))); BOOST_TEST( hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) != hash_value(elle::das::make_tuple(bar = std::string("lol"), foo = 3))); } static void compare() { BOOST_TEST( elle::das::make_tuple() == elle::das::make_tuple()); BOOST_TEST( elle::das::make_tuple(foo = 3, bar = std::string("lol")) == elle::das::make_tuple(foo = 3, bar = std::string("lol"))); BOOST_TEST( elle::das::make_tuple(foo = 3, bar = std::string("lol")) != elle::das::make_tuple(foo = 4, bar = std::string("lol"))); BOOST_TEST( elle::das::make_tuple(foo = 3, bar = std::string("lol")) != elle::das::make_tuple(foo = 3, bar = std::string("bar"))); } /*-------. | Driver | `-------*/ ELLE_TEST_SUITE() { auto& master = boost::unit_test::framework::master_test_suite(); master.add(BOOST_TEST_CASE(basics)); master.add(BOOST_TEST_CASE(move)); master.add(BOOST_TEST_CASE(print)); master.add(BOOST_TEST_CASE(serialize)); master.add(BOOST_TEST_CASE(hash)); master.add(BOOST_TEST_CASE(compare)); }
{ "pile_set_name": "Github" }
// Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved. #pragma once namespace Designer { class Model; enum ECompilerFlag { eCompiler_CastShadow = BIT(1), eCompiler_Physicalize = BIT(2), eCompiler_General = eCompiler_CastShadow | eCompiler_Physicalize }; //! This class plays a role of creating engine resources used for rendering and physicalizing out of the Designer::Model instance. class ModelCompiler : public _i_reference_target_t { public: ModelCompiler(int nCompilerFlag); ModelCompiler(const ModelCompiler& compiler); virtual ~ModelCompiler(); bool IsValid() const; void Compile(CBaseObject* pBaseObject, Model* pModel, ShelfID shelfID = eShelf_Any, bool bUpdateOnlyRenderNode = false); void DeleteAllRenderNodes(); void DeleteRenderNode(ShelfID shelfID); IRenderNode* GetRenderNode() { return m_pRenderNode[0]; } void UpdateHighlightPassState(bool bSelected, bool bHighlighted); bool GetIStatObj(_smart_ptr<IStatObj>* pStatObj); bool CreateIndexdMesh(Model* pModel, IIndexedMesh* pMesh, bool bCreateBackFaces); void SaveToCgf(const char* filename); void SetViewDistRatio(int nViewDistRatio) { m_viewDistRatio = nViewDistRatio; } int GetViewDistRatio() const { return m_viewDistRatio; } void SetRenderFlags(uint64 nRenderFlag) { m_RenderFlags = nRenderFlag; } uint64 GetRenderFlags() const { return m_RenderFlags; } void SetStaticObjFlags(int nStaticObjFlag); int GetStaticObjFlags(); void SetSelected(bool bSelect); void AddFlags(int nFlags) { m_nCompilerFlag |= nFlags; } void RemoveFlags(int nFlags) { m_nCompilerFlag &= (~nFlags); } bool CheckFlags(int nFlags) const { return (m_nCompilerFlag & nFlags) ? true : false; } void SaveMesh(CArchive& ar, CBaseObject* pObj, Model* pModel); bool LoadMesh(CArchive& ar, CBaseObject* pObj, Model* pModel); bool SaveMesh(int nVersion, std::vector<char>& buffer, CBaseObject* pObj, Model* pModel); bool LoadMesh(int nVersion, std::vector<char>& buffer, CBaseObject* pObj, Model* pModel); private: bool UpdateMesh(CBaseObject* pBaseObject, Model* pModel, ShelfID nShelf); void UpdateRenderNode(CBaseObject* pBaseObject, ShelfID nShelf); void RemoveStatObj(ShelfID nShelf); void CreateStatObj(ShelfID nShelf); IMaterial* GetMaterialFromBaseObj(CBaseObject* pObj) const; void InvalidateStatObj(IStatObj* pStatObj, bool bPhysics); private: mutable IStatObj* m_pStatObj[cShelfMax]; mutable IRenderNode* m_pRenderNode[cShelfMax]; uint64 m_RenderFlags; int m_viewDistRatio; int m_nCompilerFlag; }; }
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Giacomo Po <gpo@ucla.edu> // Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include <cmath> #include "../../test/sparse_solver.h" #include <Eigen/IterativeSolvers> template<typename T> void test_minres_T() { // Identity preconditioner MINRES<SparseMatrix<T>, Lower, IdentityPreconditioner > minres_colmajor_lower_I; MINRES<SparseMatrix<T>, Upper, IdentityPreconditioner > minres_colmajor_upper_I; // Diagonal preconditioner MINRES<SparseMatrix<T>, Lower, DiagonalPreconditioner<T> > minres_colmajor_lower_diag; MINRES<SparseMatrix<T>, Upper, DiagonalPreconditioner<T> > minres_colmajor_upper_diag; MINRES<SparseMatrix<T>, Lower|Upper, DiagonalPreconditioner<T> > minres_colmajor_uplo_diag; // call tests for SPD matrix CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) ); CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) ); CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) ); CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) ); CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) ); // TO DO: symmetric semi-definite matrix // TO DO: symmetric indefinite matrix } void test_minres() { CALL_SUBTEST_1(test_minres_T<double>()); // CALL_SUBTEST_2(test_minres_T<std::compex<double> >()); }
{ "pile_set_name": "Github" }
#define YEAR 2013 #define STATUS "release" #ifndef ROOT_DIR #define ROOT_DIR ".." #endif #define BUILD_DIR ROOT_DIR + "/build/NetBox/ #ifndef SOURCE_DIR #define SOURCE_DIR ROOT_DIR + "/src/NetBox" #endif #ifndef OUTPUT_DIR #define OUTPUT_DIR ROOT_DIR + "/build" #endif #ifndef BINARIES_DIR_FAR2 #define BINARIES_DIR_FAR2 BUILD_DIR + "/Far2" #endif #ifndef BINARIES_DIR_FAR3 #define BINARIES_DIR_FAR3 BUILD_DIR + "/Far3" #endif #ifndef PUTTY_SOURCE_DIR #define PUTTY_SOURCE_DIR "C:/Program Files/Putty" #endif #define FileSourceMain_Far2x86 BINARIES_DIR_FAR2 + "/x86/NetBox.dll" #define FileSourceMain_Far2x64 BINARIES_DIR_FAR2 + "/x64/NetBox.dll" #define FileSourceMain_Far3x86 BINARIES_DIR_FAR3 + "/x86/NetBox.dll" #define FileSourceMain_Far3x64 BINARIES_DIR_FAR3 + "/x64/NetBox.dll" #define FileSourceEng SOURCE_DIR + "/NetBoxEng.lng" #define FileSourceRus SOURCE_DIR + "/NetBoxRus.lng" #define FileSourceChangeLog ROOT_DIR + "/ChangeLog" #define FileSourceReadmeEng ROOT_DIR + "/README.md" #define FileSourceReadmeRu ROOT_DIR + "/README.RU.md" #define FileSourceLicense ROOT_DIR + "/LICENSE.txt" #define PluginSubDirName "NetBox" #define Major #define Minor #define Rev #define Build #expr ParseVersion(FileSourceMain_Far2x86, Major, Minor, Rev, Build) #define Version Str(Major) + "." + Str(Minor) + (Rev > 0 ? "." + Str(Rev) : "") + \ (STATUS != "" ? " " + STATUS : "") [Setup] AppId=netbox AppMutex=NetBox AppName=NetBox plugin for Far2/Far3 AppPublisher=Michael Lukashov AppPublisherURL=https://github.com/michaellukashov/Far-NetBox AppSupportURL=http://forum.farmanager.com/viewtopic.php?f=39&t=6638 AppUpdatesURL=http://plugring.farmanager.com/plugin.php?pid=859&l=en VersionInfoCompany=Michael Lukashov VersionInfoDescription=Setup for NetBox plugin for Far2/Far3 {#Version} VersionInfoVersion={#Major}.{#Minor}.{#Rev}.{#Build} VersionInfoTextVersion={#Version} VersionInfoCopyright=(c) 2011-{#YEAR} Michael Lukashov DefaultDirName={pf}\Far Manager\Plugins\{#PluginSubDirName} UsePreviousAppDir=false DisableProgramGroupPage=true LicenseFile=licence.setup ; UninstallDisplayIcon={app}\winscp.ico OutputDir={#OUTPUT_DIR} DisableStartupPrompt=yes AppVersion={#Version} AppVerName=NetBox plugin for Far2/Far3 {#Version} OutputBaseFilename=FarNetBox-{#Major}.{#Minor}.{#Rev}_Far2_Far3_x86_x64 Compression=lzma2/ultra SolidCompression=yes PrivilegesRequired=none Uninstallable=no MinVersion=5.1 DisableDirPage=yes ; AlwaysShowDirOnReadyPage=yes ArchitecturesInstallIn64BitMode=x64 [Types] Name: full; Description: "Full installation" ; Name: compact; Description: "Compact installation" Name: custom; Description: "Custom installation"; Flags: iscustom ; Languages: en ru [Components] Name: main_far2_x86; Description: "NetBox for Far2/x86"; Types: full custom; check: IsFar2X86Installed Name: main_far2_x64; Description: "NetBox for Far2/x64"; Types: full custom; check: IsWin64 and IsFar3X64Installed Name: main_far3_x86; Description: "NetBox for Far3/x86"; Types: full custom; check: IsFar3X86Installed Name: main_far3_x64; Description: "NetBox for Far3/x64"; Types: full custom; check: IsWin64 and IsFar3X64Installed ; Name: pageant; Description: "Pageant (SSH authentication agent)"; Types: full ; Name: puttygen; Description: "PuTTYgen (key generator)"; Types: full [Files] Source: "{#FileSourceMain_Far2x86}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceMain_Far2x64}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceMain_Far3x86}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceMain_Far3x64}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion Source: "{#FileSourceReadmeEng}"; DestName: "README.md"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceReadmeEng}"; DestName: "README.md"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceReadmeEng}"; DestName: "README.md"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceReadmeEng}"; DestName: "README.md"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion Source: "{#FileSourceReadmeRu}"; DestName: "README.RU.md"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceReadmeRu}"; DestName: "README.RU.md"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceReadmeRu}"; DestName: "README.RU.md"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceReadmeRu}"; DestName: "README.RU.md"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion Source: "{#FileSourceLicense}"; DestName: "LICENSE.txt"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion Source: "{#FileSourceLicense}"; DestName: "LICENSE.txt"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion Source: "{#FileSourceLicense}"; DestName: "LICENSE.txt"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion Source: "{#FileSourceLicense}"; DestName: "LICENSE.txt"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\LICENCE"; DestDir: "{code:GetPluginX86Dir}\PuTTY"; Components: main_x86 pageant puttygen; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\LICENCE"; DestDir: "{code:GetPluginX64Dir}\PuTTY"; Components: main_x64 pageant puttygen; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\putty.hlp"; DestDir: "{code:GetPluginX86Dir}\PuTTY"; Components: main_x86 pageant puttygen; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\putty.hlp"; DestDir: "{code:GetPluginX64Dir}\PuTTY"; Components: main_x64 pageant puttygen; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\pageant.exe"; DestDir: "{code:GetPluginX86Dir}\PuTTY"; Components: main_x86 pageant; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\pageant.exe"; DestDir: "{code:GetPluginX64Dir}\PuTTY"; Components: main_x64 pageant; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\puttygen.exe"; DestDir: "{code:GetPluginX86Dir}\PuTTY"; Components: main_x86 puttygen; Flags: ignoreversion ; Source: "{#PUTTY_SOURCE_DIR}\puttygen.exe"; DestDir: "{code:GetPluginX64Dir}\PuTTY"; Components: main_x64 puttygen; Flags: ignoreversion [InstallDelete] [Code] var InputDirsPage: TInputDirWizardPage; function GetFar2X86InstallDir(): String; var InstallDir: String; begin if RegQueryStringValue(HKLM, 'Software\Far2', 'InstallDir', InstallDir) or RegQueryStringValue(HKCU, 'Software\Far2', 'InstallDir', InstallDir) then begin Result := InstallDir; end; end; function GetFar2X64InstallDir(): String; var InstallDir: String; begin if RegQueryStringValue(HKCU, 'Software\Far2', 'InstallDir_x64', InstallDir) or RegQueryStringValue(HKLM, 'Software\Far2', 'InstallDir_x64', InstallDir) then begin Result := InstallDir; end; end; function IsFar2X86Installed(): Boolean; begin Result := GetFar2X86InstallDir() <> ''; end; function IsFar2X64Installed(): Boolean; begin Result := GetFar2X64InstallDir() <> ''; end; function GetDefaultFar2X86Dir(): String; var InstallDir: String; begin InstallDir := GetFar2X86InstallDir(); if InstallDir <> '' then begin Result := AddBackslash(InstallDir) + 'Plugins\{#PluginSubDirName}'; end else begin Result := ExpandConstant('{pf}\Far2\Plugins\{#PluginSubDirName}'); end; end; function GetDefaultFar2X64Dir(): String; var InstallDir: String; begin InstallDir := GetFar2X64InstallDir(); if InstallDir <> '' then begin Result := AddBackslash(InstallDir) + 'Plugins\{#PluginSubDirName}'; end else begin Result := ExpandConstant('{pf}\Far2\Plugins\{#PluginSubDirName}'); end; end; function GetPlugin2X86Dir(Param: String): String; begin Result := InputDirsPage.Values[0]; end; function GetPlugin2X64Dir(Param: String): String; begin Result := InputDirsPage.Values[1]; end; function GetFar3X86InstallDir(): String; var InstallDir: String; begin if RegQueryStringValue(HKLM, 'Software\Far Manager', 'InstallDir', InstallDir) or RegQueryStringValue(HKCU, 'Software\Far Manager', 'InstallDir', InstallDir) then begin Result := InstallDir; end; end; function GetFar3X64InstallDir(): String; var InstallDir: String; begin if RegQueryStringValue(HKLM, 'Software\Far Manager', 'InstallDir_x64', InstallDir) or RegQueryStringValue(HKCU, 'Software\Far Manager', 'InstallDir_x64', InstallDir) then begin Result := InstallDir; end; end; function IsFar3X86Installed(): Boolean; begin Result := GetFar3X86InstallDir() <> ''; end; function IsFar3X64Installed(): Boolean; begin Result := GetFar3X64InstallDir() <> ''; end; function GetDefaultFar3X86Dir(): String; var InstallDir: String; begin InstallDir := GetFar3X86InstallDir(); if InstallDir <> '' then begin Result := AddBackslash(InstallDir) + 'Plugins\{#PluginSubDirName}'; end else begin Result := ExpandConstant('{pf}\Far Manager\Plugins\{#PluginSubDirName}'); end; end; function GetDefaultFar3X64Dir(): String; var InstallDir: String; begin InstallDir := GetFar3X64InstallDir(); if InstallDir <> '' then begin Result := AddBackslash(InstallDir) + 'Plugins\{#PluginSubDirName}'; end else begin Result := ExpandConstant('{pf}\Far Manager\Plugins\{#PluginSubDirName}'); end; end; function GetPlugin3X86Dir(Param: String): String; begin Result := InputDirsPage.Values[2]; end; function GetPlugin3X64Dir(Param: String): String; begin Result := InputDirsPage.Values[3]; end; procedure CreateTheWizardPage; begin // Input dirs InputDirsPage := CreateInputDirPage(wpSelectComponents, 'Select plugin location', 'Where plugin should be installed?', 'Plugin will be installed in the following folder(s).'#13#10#13#10 + 'To continue, click Next. If you would like to select a different folder, click Browse.', False, 'Plugin folder'); InputDirsPage.Add('Far2/x86 plugin location:'); InputDirsPage.Values[0] := GetDefaultFar2X86Dir(); InputDirsPage.Add('Far2/x64 plugin location:'); InputDirsPage.Values[1] := GetDefaultFar2X64Dir(); InputDirsPage.Add('Far3/x86 plugin location:'); InputDirsPage.Values[2] := GetDefaultFar3X86Dir(); InputDirsPage.Add('Far3/x64 plugin location:'); InputDirsPage.Values[3] := GetDefaultFar3X64Dir(); end; procedure SetupInputDirs(); begin InputDirsPage.Edits[0].Enabled := IsComponentSelected('main_far2_x86'); InputDirsPage.Buttons[0].Enabled := IsComponentSelected('main_far2_x86'); InputDirsPage.PromptLabels[0].Enabled := IsComponentSelected('main_far2_x86'); // InputDirsPage.Edits[1].Visible := IsWin64(); // InputDirsPage.Buttons[1].Visible := IsWin64(); // InputDirsPage.PromptLabels[1].Visible := IsWin64(); InputDirsPage.Edits[1].Enabled := IsComponentSelected('main_far2_x64'); InputDirsPage.Buttons[1].Enabled := IsComponentSelected('main_far2_x64'); InputDirsPage.PromptLabels[1].Enabled := IsComponentSelected('main_far2_x64'); InputDirsPage.Edits[2].Enabled := IsComponentSelected('main_far3_x86'); InputDirsPage.Buttons[2].Enabled := IsComponentSelected('main_far3_x86'); InputDirsPage.PromptLabels[2].Enabled := IsComponentSelected('main_far3_x86'); // InputDirsPage.Edits[3].Visible := IsWin64(); // InputDirsPage.Buttons[3].Visible := IsWin64(); // InputDirsPage.PromptLabels[3].Visible := IsWin64(); InputDirsPage.Edits[3].Enabled := IsComponentSelected('main_far3_x64'); InputDirsPage.Buttons[3].Enabled := IsComponentSelected('main_far3_x64'); InputDirsPage.PromptLabels[3].Enabled := IsComponentSelected('main_far3_x64'); end; function NextButtonClick(CurPageID: Integer): Boolean; begin if CurPageID = wpWelcome then begin // SetupComponents(); end else if CurPageID = wpSelectComponents then begin SetupInputDirs(); end else if CurPageID = InputDirsPage.ID then begin WizardForm.DirEdit.Text := InputDirsPage.Values[0]; end; Result := True; end; function BackButtonClick(CurPageID: Integer): Boolean; begin // MsgBox('CurPageID: ' + IntToStr(CurPageID), mbInformation, mb_Ok); if CurPageID = InputDirsPage.ID then begin // SetupComponents(); end; if CurPageID = wpReady then begin SetupInputDirs(); end; Result := True; end; procedure InitializeWizard(); begin // Custom wizard page CreateTheWizardPage; WizardForm.LicenseAcceptedRadio.Checked := True; end;
{ "pile_set_name": "Github" }
/* fre:ac - free audio converter * Copyright (C) 2001-2020 Robert Kausch <robert.kausch@freac.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of * the License, or (at your option) any later version. * * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #include <dialogs/config/configcomponent.h> #include <config.h> #include <resources.h> #ifdef __WIN32__ # include <smooth/init.win32.h> #endif using namespace BoCA; using namespace BoCA::AS; freac::ConfigComponentDialog::ConfigComponentDialog(Component *component) { BoCA::Config *config = BoCA::Config::Get(); BoCA::I18n *i18n = BoCA::I18n::Get(); i18n->SetContext("Configuration"); layer = component->GetConfigurationLayer(); if (layer != NIL) { mainWnd = new Window(component->GetName(), Point(config->GetIntValue(Config::CategorySettingsID, Config::SettingsWindowPosXID, Config::SettingsWindowPosXDefault), config->GetIntValue(Config::CategorySettingsID, Config::SettingsWindowPosYID, Config::SettingsWindowPosYDefault)) + Point(60, 60), layer->GetSize() + Size(8, 73)); mainWnd->SetRightToLeft(i18n->IsActiveLanguageRightToLeft()); mainWnd_titlebar = new Titlebar(TB_CLOSEBUTTON); divbar = new Divider(39, OR_HORZ | OR_BOTTOM); btn_cancel = new Button(i18n->TranslateString("Cancel"), Point(175, 29), Size()); btn_cancel->onAction.Connect(&ConfigComponentDialog::Cancel, this); btn_cancel->SetOrientation(OR_LOWERRIGHT); btn_ok = new Button(i18n->TranslateString("OK"), btn_cancel->GetPosition() - Point(88, 0), Size()); btn_ok->onAction.Connect(&ConfigComponentDialog::OK, this); btn_ok->SetOrientation(OR_LOWERRIGHT); Add(mainWnd); mainWnd->Add(mainWnd_titlebar); mainWnd->Add(divbar); mainWnd->Add(btn_ok); mainWnd->Add(btn_cancel); mainWnd->GetMainLayer()->Add(layer); mainWnd->SetFlags(mainWnd->GetFlags() | WF_NOTASKBUTTON | WF_MODAL); mainWnd->SetIcon(ImageLoader::Load(String(Config::Get()->resourcesPath).Append("icons/freac.png"))); #ifdef __WIN32__ mainWnd->SetIconDirect(LoadImageA(hInstance, MAKEINTRESOURCEA(IDI_ICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED)); #endif } else { mainWnd = NIL; mainWnd_titlebar = NIL; btn_cancel = NIL; btn_ok = NIL; divbar = NIL; } } freac::ConfigComponentDialog::~ConfigComponentDialog() { if (layer == NIL) return; DeleteObject(mainWnd_titlebar); DeleteObject(mainWnd); DeleteObject(btn_ok); DeleteObject(btn_cancel); DeleteObject(divbar); } const Error &freac::ConfigComponentDialog::ShowDialog() { if (layer != NIL) mainWnd->WaitUntilClosed(); else error = Error(); return error; } Void freac::ConfigComponentDialog::OK() { if (layer->SaveSettings() == Error()) return; mainWnd->Close(); } Void freac::ConfigComponentDialog::Cancel() { mainWnd->Close(); }
{ "pile_set_name": "Github" }
--- record.c.orig 2001-08-14 20:10:46.000000000 +0800 +++ record.c 2011-09-05 15:09:11.000000000 +0800 @@ -31,14 +31,18 @@ ** May 25, 2000 Ver 1.0 */ -#include<stdio.h> -#include<fcntl.h> -#include<sys/types.h> -#include<pwd.h> -#include<ctype.h> -#include<errno.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <pwd.h> +#include <ctype.h> +#include <errno.h> -#include"record.h" +#include "record.h" +#include "xjump.h" #define FS '\t' /* field separator */
{ "pile_set_name": "Github" }
/* * linux/fs/super.c * * (C) 1991 Linus Torvalds */ /* * super.c contains code to handle the super-block tables. */ #include <linux/config.h> #include <linux/sched.h> #include <linux/kernel.h> #include <asm/system.h> #include <errno.h> #include <sys/stat.h> int sync_dev(int dev); void wait_for_keypress(void); /* set_bit uses setb, as gas doesn't recognize setc */ #define set_bit(bitnr,addr) ({ \ register int __res __asm__("ax"); \ __asm__("bt %2,%3;setb %%al":"=a" (__res):"a" (0),"r" (bitnr),"m" (*(addr))); \ __res; }) struct super_block super_block[NR_SUPER]; /* this is initialized in init/main.c */ int ROOT_DEV = 0; static void lock_super(struct super_block * sb) { cli(); while (sb->s_lock) sleep_on(&(sb->s_wait)); sb->s_lock = 1; sti(); } static void free_super(struct super_block * sb) { cli(); sb->s_lock = 0; wake_up(&(sb->s_wait)); sti(); } static void wait_on_super(struct super_block * sb) { cli(); while (sb->s_lock) sleep_on(&(sb->s_wait)); sti(); } struct super_block * get_super(int dev) { struct super_block * s; if (!dev) return NULL; s = 0+super_block; while (s < NR_SUPER+super_block) if (s->s_dev == dev) { wait_on_super(s); if (s->s_dev == dev) return s; s = 0+super_block; } else s++; return NULL; } void put_super(int dev) { struct super_block * sb; struct m_inode * inode; int i; if (dev == ROOT_DEV) { printk("root diskette changed: prepare for armageddon\n\r"); return; } if (!(sb = get_super(dev))) return; if (sb->s_imount) { printk("Mounted disk changed - tssk, tssk\n\r"); return; } lock_super(sb); sb->s_dev = 0; for(i=0;i<I_MAP_SLOTS;i++) brelse(sb->s_imap[i]); for(i=0;i<Z_MAP_SLOTS;i++) brelse(sb->s_zmap[i]); free_super(sb); return; } static struct super_block * read_super(int dev) { struct super_block * s; struct buffer_head * bh; int i,block; if (!dev) return NULL; check_disk_change(dev); if (s = get_super(dev)) return s; for (s = 0+super_block ;; s++) { if (s >= NR_SUPER+super_block) return NULL; if (!s->s_dev) break; } s->s_dev = dev; s->s_isup = NULL; s->s_imount = NULL; s->s_time = 0; s->s_rd_only = 0; s->s_dirt = 0; lock_super(s); if (!(bh = bread(dev,1))) { s->s_dev=0; free_super(s); return NULL; } *((struct d_super_block *) s) = *((struct d_super_block *) bh->b_data); brelse(bh); if (s->s_magic != SUPER_MAGIC) { s->s_dev = 0; free_super(s); return NULL; } for (i=0;i<I_MAP_SLOTS;i++) s->s_imap[i] = NULL; for (i=0;i<Z_MAP_SLOTS;i++) s->s_zmap[i] = NULL; block=2; for (i=0 ; i < s->s_imap_blocks ; i++) if (s->s_imap[i]=bread(dev,block)) block++; else break; for (i=0 ; i < s->s_zmap_blocks ; i++) if (s->s_zmap[i]=bread(dev,block)) block++; else break; if (block != 2+s->s_imap_blocks+s->s_zmap_blocks) { for(i=0;i<I_MAP_SLOTS;i++) brelse(s->s_imap[i]); for(i=0;i<Z_MAP_SLOTS;i++) brelse(s->s_zmap[i]); s->s_dev=0; free_super(s); return NULL; } s->s_imap[0]->b_data[0] |= 1; s->s_zmap[0]->b_data[0] |= 1; free_super(s); return s; } int sys_umount(char * dev_name) { struct m_inode * inode; struct super_block * sb; int dev; if (!(inode=namei(dev_name))) return -ENOENT; dev = inode->i_zone[0]; if (!S_ISBLK(inode->i_mode)) { iput(inode); return -ENOTBLK; } iput(inode); if (dev==ROOT_DEV) return -EBUSY; if (!(sb=get_super(dev)) || !(sb->s_imount)) return -ENOENT; if (!sb->s_imount->i_mount) printk("Mounted inode has i_mount=0\n"); for (inode=inode_table+0 ; inode<inode_table+NR_INODE ; inode++) if (inode->i_dev==dev && inode->i_count) return -EBUSY; sb->s_imount->i_mount=0; iput(sb->s_imount); sb->s_imount = NULL; iput(sb->s_isup); sb->s_isup = NULL; put_super(dev); sync_dev(dev); return 0; } int sys_mount(char * dev_name, char * dir_name, int rw_flag) { struct m_inode * dev_i, * dir_i; struct super_block * sb; int dev; if (!(dev_i=namei(dev_name))) return -ENOENT; dev = dev_i->i_zone[0]; if (!S_ISBLK(dev_i->i_mode)) { iput(dev_i); return -EPERM; } iput(dev_i); if (!(dir_i=namei(dir_name))) return -ENOENT; if (dir_i->i_count != 1 || dir_i->i_num == ROOT_INO) { iput(dir_i); return -EBUSY; } if (!S_ISDIR(dir_i->i_mode)) { iput(dir_i); return -EPERM; } if (!(sb=read_super(dev))) { iput(dir_i); return -EBUSY; } if (sb->s_imount) { iput(dir_i); return -EBUSY; } if (dir_i->i_mount) { iput(dir_i); return -EPERM; } sb->s_imount=dir_i; dir_i->i_mount=1; dir_i->i_dirt=1; /* NOTE! we don't iput(dir_i) */ return 0; /* we do that in umount */ } void mount_root(void) { int i,free; struct super_block * p; struct m_inode * mi; if (32 != sizeof (struct d_inode)) panic("bad i-node size"); for(i=0;i<NR_FILE;i++) file_table[i].f_count=0; if (MAJOR(ROOT_DEV) == 2) { printk("Insert root floppy and press ENTER"); wait_for_keypress(); } for(p = &super_block[0] ; p < &super_block[NR_SUPER] ; p++) { p->s_dev = 0; p->s_lock = 0; p->s_wait = NULL; } if (!(p=read_super(ROOT_DEV))) panic("Unable to mount root"); if (!(mi=iget(ROOT_DEV,ROOT_INO))) panic("Unable to read root i-node"); mi->i_count += 3 ; /* NOTE! it is logically used 4 times, not 1 */ p->s_isup = p->s_imount = mi; current->pwd = mi; current->root = mi; free=0; i=p->s_nzones; while (-- i >= 0) if (!set_bit(i&8191,p->s_zmap[i>>13]->b_data)) free++; printk("%d/%d free blocks\n\r",free,p->s_nzones); free=0; i=p->s_ninodes+1; while (-- i >= 0) if (!set_bit(i&8191,p->s_imap[i>>13]->b_data)) free++; printk("%d/%d free inodes\n\r",free,p->s_ninodes); }
{ "pile_set_name": "Github" }
// // GDDropboxUploadStateWrapper.m // GDFileManagerExample // // Created by Graham Dennis on 11/08/13. // Copyright (c) 2013 Graham Dennis. All rights reserved. // #import "GDFileManagerUploadState.h" @implementation GDFileManagerUploadState @synthesize parentVersionID = _parentVersionID; - (instancetype)initWithUploadState:(id<NSCoding>)uploadState mimeType:(NSString *)mimeType uploadURL:(NSURL *)uploadURL parentVersionID:(NSString *)parentVersionID { return [self initWithUploadState:uploadState mimeType:mimeType uploadURL:uploadURL parentVersionID:parentVersionID extraState:nil]; } - (instancetype)initWithUploadState:(id <NSCoding>)uploadState mimeType:(NSString *)mimeType uploadURL:(NSURL *)uploadURL parentVersionID:(NSString *)parentVersionID extraState:(NSDictionary *)extraState { if ((self = [super init])) { _uploadState = uploadState; _uploadURL = uploadURL; _parentVersionID = parentVersionID; _mimeType = mimeType; _extraState = extraState; } return self; } - (NSURL *)fileServiceSessionURL { return self.uploadURL; } #pragma mark - NSCoding static NSString *const kUploadState = @"UploadState"; static NSString *const kUploadURL = @"UploadURL"; static NSString *const kParentVersionID = @"ParentVersionID"; static NSString *const kMIMEType = @"MIMEType"; static NSString *const kExtraState = @"ExtraState"; - (id)initWithCoder:(NSCoder *)aDecoder { id <NSCoding> uploadState = [aDecoder decodeObjectForKey:kUploadState]; NSURL *uploadURL = [aDecoder decodeObjectForKey:kUploadURL]; NSString *parentVersionID = [aDecoder decodeObjectForKey:kParentVersionID]; NSString *mimeType = [aDecoder decodeObjectForKey:kMIMEType]; NSDictionary *extraState = [aDecoder decodeObjectForKey:kExtraState]; return [self initWithUploadState:uploadState mimeType:mimeType uploadURL:uploadURL parentVersionID:parentVersionID extraState:extraState]; } - (void)encodeWithCoder:(NSCoder *)aCoder { [aCoder encodeObject:self.uploadState forKey:kUploadState]; [aCoder encodeObject:self.uploadURL forKey:kUploadURL]; [aCoder encodeObject:self.parentVersionID forKey:kParentVersionID]; [aCoder encodeObject:self.mimeType forKey:kMIMEType]; [aCoder encodeObject:self.extraState forKey:kExtraState]; } @end
{ "pile_set_name": "Github" }
/dts-v1/; #include "bcm6348.dtsi" #include <dt-bindings/input/input.h> / { model = "Sagem F@st 2404"; compatible = "sagem,fast-2404", "brcm,bcm6348"; chosen { bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; stdout-path = "serial0:115200n8"; }; }; &pflash { status = "okay"; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; cfe@0 { label = "CFE"; reg = <0x000000 0x010000>; read-only; }; linux@10000 { label = "linux"; reg = <0x010000 0x3e0000>; compatible = "brcm,bcm963xx-imagetag"; }; nvram@3f0000 { label = "nvram"; reg = <0x3f0000 0x010000>; }; }; }; &pinctrl { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; }; &uart0 { status = "okay"; };
{ "pile_set_name": "Github" }
// // TAPIResponse.m // TwitterNetworkLayer // // Created on 10/17/14. // Copyright © 2020 Twitter. All rights reserved. // #import "TAPIError.h" #import "TAPIResponse.h" #import "TNL_Project.h" NS_INLINE BOOL _DataBeginsWithHTMLDocType(NSData *data) { static const char sDocType[] = "<!DOCTYPE html"; static const size_t sDocTypeLength = (sizeof(sDocType) / sizeof(sDocType[0])) - 1; // minus 1 to ignore the NULL terminator return data.length >= sDocTypeLength && 0 == strncmp(data.bytes, sDocType, sDocTypeLength); } static id _ParseAPIResponse(TNLResponseInfo *info, NSError ** parseErrorOut, NSError ** apiErrorOut); static NSArray *_ExtractAPIErrors(id parsedObject); @implementation TAPIResponse @synthesize apiError = _apiError; @synthesize parseError = _parseError; @synthesize parsedObject = _parsedObject; - (void)prepare { [super prepare]; if (!_operationError) { NSError *apiError; NSError *parseError; _parsedObject = _ParseAPIResponse(_info, &parseError, &apiError); _parseError = parseError; _apiError = apiError; TNLAttemptMetrics *metrics = _metrics.attemptMetrics.lastObject; metrics.responseBodyParseError = parseError; if (apiError) { metrics.APIErrors = @[apiError]; } } } - (instancetype)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { _parsedObject = [coder decodeObjectOfClasses:[NSSet setWithObjects:[NSString class], [NSNumber class], [NSArray class], [NSDictionary class], nil] forKey:@"parsedObject"]; _parseError = [coder decodeObjectOfClass:[NSError class] forKey:@"parseError"]; _apiError = [coder decodeObjectOfClass:[NSError class] forKey:@"apiError"]; } return self; } - (void)encodeWithCoder:(NSCoder *)aCoder { [super encodeWithCoder:aCoder]; [aCoder encodeObject:TNLErrorToSecureCodingError(_parsedObject) forKey:@"parsedObject"]; [aCoder encodeObject:TNLErrorToSecureCodingError(_apiError) forKey:@"apiError"]; [aCoder encodeObject:TNLErrorToSecureCodingError(_parseError) forKey:@"parseError"]; } - (NSError *)anyError { return self.operationError ?: self.parseError ?: self.apiError; } @end static id _ParseAPIResponse(TNLResponseInfo *info, NSError ** errorOut, NSError ** apiErrorOut) { id json = nil; NSError *parseError = nil; __block NSError *apiError = TNLHTTPStatusCodeIsSuccess(info.statusCode) ? nil : [NSError errorWithDomain:TAPIErrorDomain code:0 userInfo:nil]; NSInteger statusCode = info.statusCode; NSData *data = info.data; TNLAssert(statusCode > 0); BOOL hasDocTypePrefix = _DataBeginsWithHTMLDocType(data); if (hasDocTypePrefix) { parseError = [NSError errorWithDomain:TAPIOperationErrorDomain code:TAPIOperationErrorCodeServiceEncounteredTechnicalError userInfo:nil]; } else { json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError]; if (json) { NSArray *apiErrors = _ExtractAPIErrors(json); // Underlying behavior in some 4XX errors if (TNLHTTPStatusCodeIsClientError(statusCode)) { [apiErrors enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSError *currentError = obj; if ([currentError.domain isEqualToString:TAPIErrorDomain]) { apiError = currentError; *stop = YES; } }]; } } else { parseError = [NSError errorWithDomain:TAPIParseErrorDomain code:TAPIParseErrorCodeCannotParseResponse userInfo:(parseError) ? @{ NSUnderlyingErrorKey : parseError } : nil]; } } if (errorOut) { *errorOut = parseError; } if (apiErrorOut) { *apiErrorOut = apiError; } return json; } static NSArray *_ExtractAPIErrors(id parsedObject) { TNLAssert(parsedObject != nil); NSMutableArray *errorItems = [[NSMutableArray alloc] init]; if ([parsedObject isKindOfClass:[NSDictionary class]]) { id errors = [parsedObject objectForKey:@"errors"]; if ([errors isKindOfClass:[NSArray class]]) { [errors enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { BOOL successfullyParsedError = NO; if ([obj isKindOfClass:[NSDictionary class]]) { id codeObject = [obj objectForKey:@"code"]; id messageObject = [obj objectForKey:@"message"]; if (codeObject && messageObject) { NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; if (messageObject) { userInfo[NSLocalizedDescriptionKey] = messageObject; } NSInteger code = [codeObject integerValue]; id timestamp = [obj objectForKey:@"timestamp"]; if (timestamp) { userInfo[@"timestamp"] = timestamp; } [errorItems addObject:[NSError errorWithDomain:TAPIErrorDomain code:code userInfo:userInfo]]; successfullyParsedError = YES; } } if (!successfullyParsedError) { NSLog(@"Failed to parse server error:[%@]", obj); } }]; } } return errorItems; }
{ "pile_set_name": "Github" }
// Copyright (c) 2013 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. // // This implements a Clang tool to convert all instances of std::string("") to // std::string(). The latter is more efficient (as std::string doesn't have to // take a copy of an empty string) and generates fewer instructions as well. It // should be run using the tools/clang/scripts/run_tool.py helper. #include <memory> #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/Basic/SourceManager.h" #include "clang/Frontend/FrontendActions.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Refactoring.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/CommandLine.h" using namespace clang::ast_matchers; using clang::tooling::CommonOptionsParser; using clang::tooling::Replacement; using clang::tooling::Replacements; namespace { // Handles replacements for stack and heap-allocated instances, e.g.: // std::string a(""); // std::string* b = new std::string(""); class ConstructorCallback : public MatchFinder::MatchCallback { public: ConstructorCallback(Replacements* replacements) : replacements_(replacements) {} virtual void run(const MatchFinder::MatchResult& result) override; private: Replacements* const replacements_; }; // Handles replacements for invocations of std::string("") in an initializer // list. class InitializerCallback : public MatchFinder::MatchCallback { public: InitializerCallback(Replacements* replacements) : replacements_(replacements) {} virtual void run(const MatchFinder::MatchResult& result) override; private: Replacements* const replacements_; }; // Handles replacements for invocations of std::string("") in a temporary // context, e.g. FunctionThatTakesString(std::string("")). Note that this // handles implicits construction of std::string as well. class TemporaryCallback : public MatchFinder::MatchCallback { public: TemporaryCallback(Replacements* replacements) : replacements_(replacements) {} virtual void run(const MatchFinder::MatchResult& result) override; private: Replacements* const replacements_; }; class EmptyStringConverter { public: explicit EmptyStringConverter(Replacements* replacements) : constructor_callback_(replacements), initializer_callback_(replacements), temporary_callback_(replacements) {} void SetupMatchers(MatchFinder* match_finder); private: ConstructorCallback constructor_callback_; InitializerCallback initializer_callback_; TemporaryCallback temporary_callback_; }; void EmptyStringConverter::SetupMatchers(MatchFinder* match_finder) { const clang::ast_matchers::StatementMatcher& constructor_call = id( "call", cxxConstructExpr( hasDeclaration(cxxMethodDecl(ofClass(hasName("std::basic_string")))), argumentCountIs(2), hasArgument(0, id("literal", stringLiteral())), hasArgument(1, cxxDefaultArgExpr()))); // Note that expr(has()) in the matcher is significant; the Clang AST wraps // calls to the std::string constructor with exprWithCleanups nodes. Without // the expr(has()) matcher, the first and last rules would not match anything! match_finder->addMatcher(varDecl(forEach(expr(has(constructor_call)))), &constructor_callback_); match_finder->addMatcher(cxxNewExpr(has(constructor_call)), &constructor_callback_); // The implicitly generated constructor for temporary could be wrapped by // implicitCastExpr, so ignoringParenImpCasts is needed. match_finder->addMatcher( cxxBindTemporaryExpr(ignoringParenImpCasts(forEach(constructor_call))), &temporary_callback_); // Note that forEachConstructorInitializer is needed. The std::string // constructor is wrapped by exprWithCleanups and cxxCtorInitializer. // forEach() would not work. match_finder->addMatcher(cxxConstructorDecl(forEachConstructorInitializer( withInitializer(expr(has(constructor_call))))), &initializer_callback_); } void ConstructorCallback::run(const MatchFinder::MatchResult& result) { const clang::StringLiteral* literal = result.Nodes.getNodeAs<clang::StringLiteral>("literal"); if (literal->getLength() > 0) return; const clang::CXXConstructExpr* call = result.Nodes.getNodeAs<clang::CXXConstructExpr>("call"); clang::CharSourceRange range = clang::CharSourceRange::getTokenRange(call->getParenOrBraceRange()); auto err = replacements_->add(Replacement(*result.SourceManager, range, "")); assert(!err); } void InitializerCallback::run(const MatchFinder::MatchResult& result) { const clang::StringLiteral* literal = result.Nodes.getNodeAs<clang::StringLiteral>("literal"); if (literal->getLength() > 0) return; const clang::CXXConstructExpr* call = result.Nodes.getNodeAs<clang::CXXConstructExpr>("call"); auto err = replacements_->add(Replacement(*result.SourceManager, call, "")); assert(!err); } void TemporaryCallback::run(const MatchFinder::MatchResult& result) { const clang::StringLiteral* literal = result.Nodes.getNodeAs<clang::StringLiteral>("literal"); if (literal->getLength() > 0) return; const clang::CXXConstructExpr* call = result.Nodes.getNodeAs<clang::CXXConstructExpr>("call"); // Differentiate between explicit and implicit calls to std::string's // constructor. An implicitly generated constructor won't have a valid // source range for the parenthesis. We do this because the matched expression // for |call| in the explicit case doesn't include the closing parenthesis. clang::SourceRange range = call->getParenOrBraceRange(); if (range.isValid()) { auto err = replacements_->add(Replacement(*result.SourceManager, literal, "")); assert(!err); } else { auto err = replacements_->add( Replacement(*result.SourceManager, call, literal->isWide() ? "std::wstring()" : "std::string()")); assert(!err); } } } // namespace static llvm::cl::extrahelp common_help(CommonOptionsParser::HelpMessage); int main(int argc, const char* argv[]) { llvm::cl::OptionCategory category("EmptyString Tool"); CommonOptionsParser options(argc, argv, category); clang::tooling::ClangTool tool(options.getCompilations(), options.getSourcePathList()); Replacements replacements; EmptyStringConverter converter(&replacements); MatchFinder match_finder; converter.SetupMatchers(&match_finder); std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = clang::tooling::newFrontendActionFactory(&match_finder); int result = tool.run(frontend_factory.get()); if (result != 0) return result; if (replacements.empty()) return 0; // Each replacement line should have the following format: // r:<file path>:<offset>:<length>:<replacement text> // Only the <replacement text> field can contain embedded ":" characters. // TODO(dcheng): Use a more clever serialization. Ideally we'd use the YAML // serialization and then use clang-apply-replacements, but that would require // copying and pasting a larger amount of boilerplate for all Chrome clang // tools. llvm::outs() << "==== BEGIN EDITS ====\n"; for (const auto& r : replacements) { llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() << ":::" << r.getLength() << ":::" << r.getReplacementText() << "\n"; } llvm::outs() << "==== END EDITS ====\n"; return 0; }
{ "pile_set_name": "Github" }
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <XCTest/XCTest.h> #import <IGListKit/IGListKit.h> #import "IGListDebugger.h" #import "IGListAdapterUpdaterInternal.h" #import "IGListTestAdapterDataSource.h" #import "IGListMoveIndexInternal.h" #import "IGListMoveIndexPathInternal.h" @interface IGListDebuggerTests : XCTestCase @end @implementation IGListDebuggerTests - (void)test_whenSearchingAdapterInstances_thatCorrectCountReturned { UIViewController *controller = [UIViewController new]; UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:[UICollectionViewFlowLayout new]]; IGListAdapterUpdater *updater = [IGListAdapterUpdater new]; NSIndexPath *path = [NSIndexPath indexPathForItem:0 inSection:0]; updater.applyingUpdateData = [[IGListBatchUpdateData alloc] initWithInsertSections:[NSIndexSet indexSetWithIndex:1] deleteSections:[NSIndexSet indexSetWithIndex:2] moveSections:[NSSet setWithObject:[[IGListMoveIndex alloc] initWithFrom:3 to:4]] insertIndexPaths:@[path] deleteIndexPaths:@[path] moveIndexPaths:@[[[IGListMoveIndexPath alloc] initWithFrom:path to:path]]]; IGListTestAdapterDataSource *dataSource = [IGListTestAdapterDataSource new]; dataSource.objects = @[@1, @2, @3]; IGListAdapter *adapter1 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:nil workingRangeSize:0]; adapter1.collectionView = collectionView; adapter1.dataSource = dataSource; IGListAdapter *adapter2 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:controller workingRangeSize:2]; adapter2.collectionView = collectionView; IGListAdapter *adapter3 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:controller workingRangeSize:2]; adapter3.collectionView = collectionView; NSArray *descriptions = [IGListDebugger adapterDescriptions]; XCTAssertEqual(descriptions.count, 4); } @end
{ "pile_set_name": "Github" }
// Copyright 2014 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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TEST_UTILS_H_ #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TEST_UTILS_H_ #include <map> #include <memory> #include <string> #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "components/prefs/testing_pref_service.h" #include "net/log/test_net_log.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" class PrefService; class TestingPrefServiceSimple; namespace data_reduction_proxy { class DataReductionProxyTestContext; class MockDataReductionProxyConfig; template <class C> class MockDataReductionProxySettings : public C { public: MockDataReductionProxySettings<C>() : C() { } MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*()); MOCK_METHOD0(GetLocalStatePrefs, PrefService*()); MOCK_METHOD1(RecordStartupState, void(ProxyStartupState state)); }; class DataReductionProxySettingsTestBase : public testing::Test { public: static void AddTestProxyToCommandLine(); DataReductionProxySettingsTestBase(); DataReductionProxySettingsTestBase(bool allowed, bool fallback_allowed, bool promo_allowed); ~DataReductionProxySettingsTestBase() override; void AddProxyToCommandLine(); void SetUp() override; template <class C> void ResetSettings(bool allowed, bool fallback_allowed, bool promo_allowed, bool holdback); virtual void ResetSettings(bool allowed, bool fallback_allowed, bool promo_allowed, bool holdback) = 0; void ExpectSetProxyPrefs(bool expected_enabled, bool expected_at_startup); void CheckMaybeActivateDataReductionProxy(bool initially_enabled, bool request_succeeded, bool expected_enabled, bool expected_restricted, bool expected_fallback_restricted); void CheckOnPrefChange(bool enabled, bool expected_enabled, bool managed); void InitWithStatisticsPrefs(); void InitDataReductionProxy(bool enabled_at_startup); void CheckDataReductionProxySyntheticTrial(bool enabled); bool SyntheticFieldTrialRegistrationCallback(const std::string& trial_name, const std::string& group_name) { synthetic_field_trials_[trial_name] = group_name; return true; } base::MessageLoopForIO message_loop_; std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxySettings> settings_; base::Time last_update_time_; std::map<std::string, std::string> synthetic_field_trials_; }; // Test implementations should be subclasses of an instantiation of this // class parameterized for whatever DataReductionProxySettings class // is being tested. template <class C> class ConcreteDataReductionProxySettingsTest : public DataReductionProxySettingsTestBase { public: typedef MockDataReductionProxySettings<C> MockSettings; void ResetSettings(bool allowed, bool fallback_allowed, bool promo_allowed, bool holdback) override { return DataReductionProxySettingsTestBase::ResetSettings<C>( allowed, fallback_allowed, promo_allowed, holdback); } }; } // namespace data_reduction_proxy #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TEST_UTILS_H_
{ "pile_set_name": "Github" }
// // CSSlider.m // AppSlate // // Created by Taehan Kim on 12. 01. 26.. // Copyright (c) 2012년 ChocolateSoft. All rights reserved. // #import "CSSlider.h" @implementation CSSlider -(id) object { return ((UISlider*)csView); } //=========================================================================== #pragma mark - -(void) setMinimumBarColor:(UIColor*)color { if( [color isKindOfClass:[UIColor class]] ) [((UISlider*)csView) setMinimumTrackTintColor:color]; } -(UIColor*) getMinimumBarColor { return ((UISlider*)csView).minimumTrackTintColor; } -(void) setMaximumBarColor:(UIColor*)color { if( [color isKindOfClass:[UIColor class]] ) [((UISlider*)csView) setMaximumTrackTintColor:color]; } -(UIColor*) getMaximumBarColor { return ((UISlider*)csView).maximumTrackTintColor; } -(void) setThumbColor:(UIColor*)color { if( [color isKindOfClass:[UIColor class]] ) [((UISlider*)csView) setThumbTintColor:color]; } -(UIColor*) getThumbColor { return ((UISlider*)csView).thumbTintColor; } -(void) setMinimumValue:(NSNumber*)number { if( [number isKindOfClass:[NSNumber class]] ) [((UISlider*)csView) setMinimumValue:[number floatValue]]; else if( [number isKindOfClass:[NSString class]] ) [((UISlider*)csView) setMinimumValue:[(NSString*)number length]]; } -(NSNumber*) getMinimumValue { return @( ((UISlider*)csView).minimumValue ); } -(void) setMaximumValue:(NSNumber*)number { if( [number isKindOfClass:[NSNumber class]] ) [((UISlider*)csView) setMaximumValue:[number floatValue]]; else if( [number isKindOfClass:[NSString class]] ) [((UISlider*)csView) setMaximumValue:[(NSString*)number length]]; } -(NSNumber*) getMaximumValue { return @( ((UISlider*)csView).maximumValue ); } -(void) setThumbValue:(NSNumber*)number { CGFloat toValue; if( [number isKindOfClass:[NSNumber class]] ) toValue = [number floatValue]; else if( [number isKindOfClass:[NSString class]] ) toValue = [(NSString*)number length]; else{ EXCLAMATION; return; } if( toValue > ((UISlider*)csView).maximumValue ) toValue = ((UISlider*)csView).maximumValue; if( toValue < ((UISlider*)csView).minimumValue ) toValue = ((UISlider*)csView).minimumValue; [((UISlider*)csView) setValue:toValue animated:YES]; } -(NSNumber*) getThumbValue { return @( ((UISlider*)csView).value ); } -(void) setContinuosChange:(NSNumber*)boolVal { if( [boolVal isKindOfClass:[NSNumber class]] ) [((UISlider*)csView) setContinuous:[boolVal boolValue]]; } -(NSNumber*) getContinuosChange { return@( ((UISlider*)csView).continuous ); } #pragma mark - -(id) initGear { if( !(self = [super init]) ) return nil; csView = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 400, MINSIZE)]; [csView setBackgroundColor:[UIColor clearColor]]; [csView setUserInteractionEnabled:YES]; csCode = CS_SLIDER; isUIObj = YES; [((UISlider*)csView) setMinimumValue:0]; [((UISlider*)csView) setMaximumValue:10]; [((UISlider*)csView) setValue:5]; [((UISlider*)csView) setContinuous:NO]; [((UISlider*)csView) setMinimumTrackTintColor:[UIColor darkGrayColor]]; [((UISlider*)csView) setMaximumTrackTintColor:[UIColor whiteColor]]; [((UISlider*)csView) setThumbTintColor:[UIColor whiteColor]]; [((UISlider*)csView) addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; DEFAULT_CENTER_D; NSDictionary *d0 = ALPHA_D; NSDictionary *d1 = MAKE_PROPERTY_D(@"Value", P_NUM, @selector(setThumbValue:),@selector(getThumbValue)); NSDictionary *d2 = MAKE_PROPERTY_D(@"Minimum Value", P_NUM, @selector(setMinimumValue:),@selector(getMinimumValue)); NSDictionary *d3 = MAKE_PROPERTY_D(@"Maximum Value", P_NUM, @selector(setMaximumValue:),@selector(getMaximumValue)); NSDictionary *d4 = MAKE_PROPERTY_D(@"Minimum Bar Color", P_COLOR, @selector(setMinimumBarColor:),@selector(getMinimumBarColor)); NSDictionary *d5 = MAKE_PROPERTY_D(@"Maximum Bar Color", P_COLOR, @selector(setMaximumBarColor:),@selector(getMaximumBarColor)); // NSDictionary *d6 = MAKE_PROPERTY_D(@"Thumb Color", P_COLOR, @selector(setThumbColor:),@selector(getThumbColor)); NSDictionary *d7 = MAKE_PROPERTY_D(@"Continuos Change", P_BOOL, @selector(setContinuosChange:),@selector(getContinuosChange)); pListArray = @[xc,yc,d0,d1,d2,d3,d4,d5,d7]; NSMutableDictionary MAKE_ACTION_D(@"Changed Value", A_NUM, a1); NSMutableDictionary MAKE_ACTION_D(@"Minimum Value", A_NUM, a2); NSMutableDictionary MAKE_ACTION_D(@"Maximum Value", A_NUM, a3); actionArray = @[a1, a2, a3]; return self; } -(id)initWithCoder:(NSCoder *)decoder { if( (self=[super initWithCoder:decoder]) ) { [((UISlider*)csView) addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; } return self; } #pragma mark - Gear's Unique Actions -(void) valueChanged:(id) sender { SEL act; NSNumber *nsMagicNum; CGFloat myValue = ((UISlider*)sender).value; // 1. value changed act = ((NSValue*)((NSDictionary*)actionArray[0])[@"selector"]).pointerValue; if( nil != act ){ nsMagicNum = ((NSDictionary*)actionArray[0])[@"mNum"]; CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue]; if( nil != gObj ){ if( [gObj respondsToSelector:act] ) [gObj performSelector:act withObject:@(myValue)]; else EXCLAMATION; } } // 2. did min value act = ((NSValue*)((NSDictionary*)actionArray[1])[@"selector"]).pointerValue; if( nil != act && myValue == ((UISlider*)sender).minimumValue ) { nsMagicNum = ((NSDictionary*)actionArray[1])[@"mNum"]; CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue]; if( nil != gObj ){ if( [gObj respondsToSelector:act] ) [gObj performSelector:act withObject:@(myValue)]; else EXCLAMATION; } } // 3. did max value act = ((NSValue*)((NSDictionary*)actionArray[2])[@"selector"]).pointerValue; if( nil != act && myValue == (NSUInteger)((UISlider*)sender).maximumValue ) { nsMagicNum = ((NSDictionary*)actionArray[2])[@"mNum"]; CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue]; if( nil != gObj ){ if( [gObj respondsToSelector:act] ) [gObj performSelector:act withObject:@(myValue)]; else EXCLAMATION; } } } #pragma mark - Code Generatorz // If not supported gear, return NO. -(BOOL) setDefaultVarName:(NSString *) _name { return [super setDefaultVarName:NSStringFromClass([self class])]; } -(NSString*) sdkClassName { return @"UISlider"; } -(NSString*) addTargetCode { return [NSString stringWithFormat:@" [%@ addTarget:self action:@selector(%@ValueChanged) forControlEvents:UIControlEventValueChanged];\n",varName,varName]; } -(NSString*) actionCode { NSMutableString *code = [[NSMutableString alloc] initWithFormat:@"-(void)%@ValueChanged\n{\n",varName]; SEL act; NSNumber *nsMagicNum; act = ((NSValue*)((NSDictionary*)actionArray[0])[@"selector"]).pointerValue; if( act ) { nsMagicNum = ((NSDictionary*)actionArray[0])[@"mNum"]; CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue]; const char *sel_name_c = sel_getName(act); NSString *selNameStr = [NSString stringWithCString:sel_name_c encoding:NSUTF8StringEncoding]; if( [selNameStr hasSuffix:@"Action:"] ) { [code appendFormat:@" %@\n",[gObj actionPropertyCode:selNameStr valStr:[NSString stringWithFormat:@"%@.value",varName]]]; } else [code appendFormat:@" [%@ %@@(%@.value)];\n",[gObj getVarName],@(sel_name_c),self.getVarName]; } act = ((NSValue*)((NSDictionary*)actionArray[1])[@"selector"]).pointerValue; if( act ) { nsMagicNum = ((NSDictionary*)actionArray[1])[@"mNum"]; CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue]; const char *sel_name_c = sel_getName(act); NSString *selNameStr = [NSString stringWithCString:sel_name_c encoding:NSUTF8StringEncoding]; if( [selNameStr hasSuffix:@"Action:"] ) { [code appendFormat:@" %@\n",[gObj actionPropertyCode:selNameStr valStr:[NSString stringWithFormat:@"%@.value",varName]]]; } else [code appendFormat:@" if( %@.minimumValue == %@.value )[%@ %@@(%@.value)];\n",self.getVarName,self.getVarName,[gObj getVarName],@(sel_name_c),self.getVarName]; } act = ((NSValue*)((NSDictionary*)actionArray[2])[@"selector"]).pointerValue; if( act ) { nsMagicNum = ((NSDictionary*)actionArray[2])[@"mNum"]; CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue]; const char *sel_name_c = sel_getName(act); NSString *selNameStr = [NSString stringWithCString:sel_name_c encoding:NSUTF8StringEncoding]; if( [selNameStr hasSuffix:@"Action:"] ) { [code appendFormat:@" %@\n",[gObj actionPropertyCode:selNameStr valStr:[NSString stringWithFormat:@"%@.value",varName]]]; } else [code appendFormat:@" if( %@.maximumValue == %@.value )[%@ %@@(%@.value)];\n",self.getVarName,self.getVarName,[gObj getVarName],@(sel_name_c),self.getVarName]; } [code appendString:@"}\n"]; return code; } @end
{ "pile_set_name": "Github" }
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !gccgo #include "textflag.h" // // System call support for AMD64, OpenBSD // // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. TEXT ·Syscall(SB),NOSPLIT,$0-56 JMP syscall·Syscall(SB) TEXT ·Syscall6(SB),NOSPLIT,$0-80 JMP syscall·Syscall6(SB) TEXT ·Syscall9(SB),NOSPLIT,$0-104 JMP syscall·Syscall9(SB) TEXT ·RawSyscall(SB),NOSPLIT,$0-56 JMP syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 JMP syscall·RawSyscall6(SB)
{ "pile_set_name": "Github" }
SubDir HAIKU_TOP src tests system network posixnet ; UsePrivateHeaders private shared ; UnitTestLib posixnettest.so : PosixNetTestAddon.cpp GetAddrInfo.cpp SocketTests.cpp : be $(TARGET_NETWORK_LIBS) [ TargetLibstdc++ ] ;
{ "pile_set_name": "Github" }
/* * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef _LIBROOT_MEMORY_PRIVATE_H #define _LIBROOT_MEMORY_PRIVATE_H #include <OS.h> #include <sys/cdefs.h> __BEGIN_DECLS status_t get_memory_properties(team_id teamID, const void* address, uint32* _protected, uint32* _lock); __END_DECLS #endif // _LIBROOT_MEMORY_PRIVATE_H
{ "pile_set_name": "Github" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53a.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.string.label.xml Template File: sources-sink-53a.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using malloc() and set data pointer to a small buffer * GoodSource: Allocate using malloc() and set data pointer to a large buffer * Sink: snprintf * BadSink : Copy string to data using snprintf * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define SNPRINTF _snwprintf #else #define SNPRINTF snprintf #endif #ifndef OMITBAD /* bad function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53b_badSink(wchar_t * data); void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53_bad() { wchar_t * data; data = NULL; /* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */ data = (wchar_t *)malloc(50*sizeof(wchar_t)); data[0] = L'\0'; /* null terminate */ CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53b_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { wchar_t * data; data = NULL; /* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */ data = (wchar_t *)malloc(100*sizeof(wchar_t)); data[0] = L'\0'; /* null terminate */ CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53b_goodG2BSink(data); } void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_snprintf_53_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2011 Eric Niebler Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED) #define BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED #include <boost/fusion/support/config.hpp> #include <boost/fusion/support/is_sequence.hpp> #include <boost/utility/enable_if.hpp> namespace boost { namespace fusion { namespace result_of { template <typename Sequence, typename State, typename F> struct accumulate; } template <typename Sequence, typename State, typename F> BOOST_FUSION_GPU_ENABLED typename lazy_enable_if< traits::is_sequence<Sequence> , result_of::accumulate<Sequence, State const, F> >::type accumulate(Sequence& seq, State const& state, F f); template <typename Sequence, typename State, typename F> BOOST_FUSION_GPU_ENABLED typename lazy_enable_if< traits::is_sequence<Sequence> , result_of::accumulate<Sequence const, State const, F> >::type accumulate(Sequence const& seq, State const& state, F f); }} #endif
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #include "../../../util/debug.h" #include "../../../util/header.h" static inline void cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c, unsigned int *d) { __asm__ __volatile__ (".byte 0x53\n\tcpuid\n\t" "movl %%ebx, %%esi\n\t.byte 0x5b" : "=a" (*a), "=S" (*b), "=c" (*c), "=d" (*d) : "a" (op)); } static int __get_cpuid(char *buffer, size_t sz, const char *fmt) { unsigned int a, b, c, d, lvl; int family = -1, model = -1, step = -1; int nb; char vendor[16]; cpuid(0, &lvl, &b, &c, &d); strncpy(&vendor[0], (char *)(&b), 4); strncpy(&vendor[4], (char *)(&d), 4); strncpy(&vendor[8], (char *)(&c), 4); vendor[12] = '\0'; if (lvl >= 1) { cpuid(1, &a, &b, &c, &d); family = (a >> 8) & 0xf; /* bits 11 - 8 */ model = (a >> 4) & 0xf; /* Bits 7 - 4 */ step = a & 0xf; /* extended family */ if (family == 0xf) family += (a >> 20) & 0xff; /* extended model */ if (family >= 0x6) model += ((a >> 16) & 0xf) << 4; } nb = scnprintf(buffer, sz, fmt, vendor, family, model, step); /* look for end marker to ensure the entire data fit */ if (strchr(buffer, '$')) { buffer[nb-1] = '\0'; return 0; } return ENOBUFS; } int get_cpuid(char *buffer, size_t sz) { return __get_cpuid(buffer, sz, "%s,%u,%u,%u$"); } char * get_cpuid_str(struct perf_pmu *pmu __maybe_unused) { char *buf = malloc(128); if (buf && __get_cpuid(buf, 128, "%s-%u-%X-%X$") < 0) { free(buf); return NULL; } return buf; } /* Full CPUID format for x86 is vendor-family-model-stepping */ static bool is_full_cpuid(const char *id) { const char *tmp = id; int count = 0; while ((tmp = strchr(tmp, '-')) != NULL) { count++; tmp++; } if (count == 3) return true; return false; } int strcmp_cpuid_str(const char *mapcpuid, const char *id) { regex_t re; regmatch_t pmatch[1]; int match; bool full_mapcpuid = is_full_cpuid(mapcpuid); bool full_cpuid = is_full_cpuid(id); /* * Full CPUID format is required to identify a platform. * Error out if the cpuid string is incomplete. */ if (full_mapcpuid && !full_cpuid) { pr_info("Invalid CPUID %s. Full CPUID is required, " "vendor-family-model-stepping\n", id); return 1; } if (regcomp(&re, mapcpuid, REG_EXTENDED) != 0) { /* Warn unable to generate match particular string. */ pr_info("Invalid regular expression %s\n", mapcpuid); return 1; } match = !regexec(&re, id, 1, pmatch, 0); regfree(&re); if (match) { size_t match_len = (pmatch[0].rm_eo - pmatch[0].rm_so); size_t cpuid_len; /* If the full CPUID format isn't required, * ignoring the stepping. */ if (!full_mapcpuid && full_cpuid) cpuid_len = strrchr(id, '-') - id; else cpuid_len = strlen(id); /* Verify the entire string matched. */ if (match_len == cpuid_len) return 0; } return 1; }
{ "pile_set_name": "Github" }
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double QuickLayoutVersionNumber; FOUNDATION_EXPORT const unsigned char QuickLayoutVersionString[];
{ "pile_set_name": "Github" }
/***************************************************************************/ /* */ /* ftlcdfil.h */ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ /* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTLCDFIL_H_ #define FTLCDFIL_H_ #include <ft2build.h> #include FT_FREETYPE_H #include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************** * * @section: * lcd_filtering * * @title: * LCD Filtering * * @abstract: * Reduce color fringes of subpixel-rendered bitmaps. * * @description: * Should you #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your * `ftoption.h', which enables patented ClearType-style rendering, * the LCD-optimized glyph bitmaps should be filtered to reduce color * fringes inherent to this technology. The default FreeType LCD * rendering uses different technology, and API described below, * although available, does nothing. * * ClearType-style LCD rendering exploits the color-striped structure of * LCD pixels, increasing the available resolution in the direction of * the stripe (usually horizontal RGB) by a factor of~3. Since these * subpixels are color pixels, using them unfiltered creates severe * color fringes. Use the @FT_Library_SetLcdFilter API to specify a * low-pass filter, which is then applied to subpixel-rendered bitmaps * generated through @FT_Render_Glyph. The filter sacrifices some of * the higher resolution to reduce color fringes, making the glyph image * slightly blurrier. Positional improvements will remain. * * A filter should have two properties: * * 1) It should be normalized, meaning the sum of the 5~components * should be 256 (0x100). It is possible to go above or under this * target sum, however: going under means tossing out contrast, going * over means invoking clamping and thereby non-linearities that * increase contrast somewhat at the expense of greater distortion * and color-fringing. Contrast is better enhanced through stem * darkening. * * 2) It should be color-balanced, meaning a filter `{~a, b, c, b, a~}' * where a~+ b~=~c. It distributes the computed coverage for one * subpixel to all subpixels equally, sacrificing some won resolution * but drastically reducing color-fringing. Positioning improvements * remain! Note that color-fringing can only really be minimized * when using a color-balanced filter and alpha-blending the glyph * onto a surface in linear space; see @FT_Render_Glyph. * * Regarding the form, a filter can be a `boxy' filter or a `beveled' * filter. Boxy filters are sharper but are less forgiving of non-ideal * gamma curves of a screen (viewing angles!), beveled filters are * fuzzier but more tolerant. * * Examples: * * - [0x10 0x40 0x70 0x40 0x10] is beveled and neither balanced nor * normalized. * * - [0x1A 0x33 0x4D 0x33 0x1A] is beveled and balanced but not * normalized. * * - [0x19 0x33 0x66 0x4c 0x19] is beveled and normalized but not * balanced. * * - [0x00 0x4c 0x66 0x4c 0x00] is boxily beveled and normalized but not * balanced. * * - [0x00 0x55 0x56 0x55 0x00] is boxy, normalized, and almost * balanced. * * - [0x08 0x4D 0x56 0x4D 0x08] is beveled, normalized and, almost * balanced. * * The filter affects glyph bitmaps rendered through @FT_Render_Glyph, * @FT_Load_Glyph, and @FT_Load_Char. It does _not_ affect the output * of @FT_Outline_Render and @FT_Outline_Get_Bitmap. * * If this feature is activated, the dimensions of LCD glyph bitmaps are * either wider or taller than the dimensions of the corresponding * outline with regard to the pixel grid. For example, for * @FT_RENDER_MODE_LCD, the filter adds 3~subpixels to the left, and * 3~subpixels to the right. The bitmap offset values are adjusted * accordingly, so clients shouldn't need to modify their layout and * glyph positioning code when enabling the filter. * * It is important to understand that linear alpha blending and gamma * correction is critical for correctly rendering glyphs onto surfaces * without artifacts and even more critical when subpixel rendering is * involved. * * Each of the 3~alpha values (subpixels) is independently used to blend * one color channel. That is, red alpha blends the red channel of the * text color with the red channel of the background pixel. The * distribution of density values by the color-balanced filter assumes * alpha blending is done in linear space; only then color artifacts * cancel out. */ /**************************************************************************** * * @enum: * FT_LcdFilter * * @description: * A list of values to identify various types of LCD filters. * * @values: * FT_LCD_FILTER_NONE :: * Do not perform filtering. When used with subpixel rendering, this * results in sometimes severe color fringes. * * FT_LCD_FILTER_DEFAULT :: * The default filter reduces color fringes considerably, at the cost * of a slight blurriness in the output. * * It is a beveled, normalized, and color-balanced five-tap filter * that is more forgiving to screens with non-ideal gamma curves and * viewing angles. Note that while color-fringing is reduced, it can * only be minimized by using linear alpha blending and gamma * correction to render glyphs onto surfaces. The default filter * weights are [0x08 0x4D 0x56 0x4D 0x08]. * * FT_LCD_FILTER_LIGHT :: * The light filter is a variant that is sharper at the cost of * slightly more color fringes than the default one. * * It is a boxy, normalized, and color-balanced three-tap filter that * is less forgiving to screens with non-ideal gamma curves and * viewing angles. This filter works best when the rendering system * uses linear alpha blending and gamma correction to render glyphs * onto surfaces. The light filter weights are * [0x00 0x55 0x56 0x55 0x00]. * * FT_LCD_FILTER_LEGACY :: * This filter corresponds to the original libXft color filter. It * provides high contrast output but can exhibit really bad color * fringes if glyphs are not extremely well hinted to the pixel grid. * In other words, it only works well if the TrueType bytecode * interpreter is enabled *and* high-quality hinted fonts are used. * * This filter is only provided for comparison purposes, and might be * disabled or stay unsupported in the future. * * FT_LCD_FILTER_LEGACY1 :: * For historical reasons, the FontConfig library returns a different * enumeration value for legacy LCD filtering. To make code work that * (incorrectly) forwards FontConfig's enumeration value to * @FT_Library_SetLcdFilter without proper mapping, it is thus easiest * to have another enumeration value, which is completely equal to * `FT_LCD_FILTER_LEGACY'. * * @since: * 2.3.0 (`FT_LCD_FILTER_LEGACY1' since 2.6.2) */ typedef enum FT_LcdFilter_ { FT_LCD_FILTER_NONE = 0, FT_LCD_FILTER_DEFAULT = 1, FT_LCD_FILTER_LIGHT = 2, FT_LCD_FILTER_LEGACY1 = 3, FT_LCD_FILTER_LEGACY = 16, FT_LCD_FILTER_MAX /* do not remove */ } FT_LcdFilter; /************************************************************************** * * @func: * FT_Library_SetLcdFilter * * @description: * This function is used to apply color filtering to LCD decimated * bitmaps, like the ones used when calling @FT_Render_Glyph with * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V. * * @input: * library :: * A handle to the target library instance. * * filter :: * The filter type. * * You can use @FT_LCD_FILTER_NONE here to disable this feature, or * @FT_LCD_FILTER_DEFAULT to use a default filter that should work * well on most LCD screens. * * @return: * FreeType error code. 0~means success. * * @note: * This feature is always disabled by default. Clients must make an * explicit call to this function with a `filter' value other than * @FT_LCD_FILTER_NONE in order to enable it. * * Due to *PATENTS* covering subpixel rendering, this function doesn't * do anything except returning `FT_Err_Unimplemented_Feature' if the * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not * defined in your build of the library, which should correspond to all * default builds of FreeType. * * @since: * 2.3.0 */ FT_EXPORT( FT_Error ) FT_Library_SetLcdFilter( FT_Library library, FT_LcdFilter filter ); /************************************************************************** * * @func: * FT_Library_SetLcdFilterWeights * * @description: * This function can be used to enable LCD filter with custom weights, * instead of using presets in @FT_Library_SetLcdFilter. * * @input: * library :: * A handle to the target library instance. * * weights :: * A pointer to an array; the function copies the first five bytes and * uses them to specify the filter weights. * * @return: * FreeType error code. 0~means success. * * @note: * Due to *PATENTS* covering subpixel rendering, this function doesn't * do anything except returning `FT_Err_Unimplemented_Feature' if the * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not * defined in your build of the library, which should correspond to all * default builds of FreeType. * * LCD filter weights can also be set per face using @FT_Face_Properties * with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS. * * @since: * 2.4.0 */ FT_EXPORT( FT_Error ) FT_Library_SetLcdFilterWeights( FT_Library library, unsigned char *weights ); /* * @type: * FT_LcdFiveTapFilter * * @description: * A typedef for passing the five LCD filter weights to * @FT_Face_Properties within an @FT_Parameter structure. * * @since: * 2.8 * */ #define FT_LCD_FILTER_FIVE_TAPS 5 typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]; /* */ FT_END_HEADER #endif /* FTLCDFIL_H_ */ /* END */
{ "pile_set_name": "Github" }
/* (No Commment) */ "CFBundleName" = "餐厅";
{ "pile_set_name": "Github" }
// // LMJCalendarViewController.m // PLMMPRJK // // Created by HuXuPeng on 2017/5/7. // Copyright © 2017年 GoMePrjk. All rights reserved. // #import "LMJCalendarViewController.h" #import "LMJEventTool.h" @interface LMJCalendarViewController () @end @implementation LMJCalendarViewController - (void)viewDidLoad { [super viewDidLoad]; LMJWeak(self); LMJEventModel *eventModel = [[LMJEventModel alloc] init]; // @property (nonatomic, strong) NSString *title; //标题 // @property (nonatomic, strong) NSString *location; //地点 //@"yyyy-MM-dd HH:mm" // @property (nonatomic, strong) NSString *startDateStr; //开始时间 // @property (nonatomic, strong) NSString *endDateStr; //结束时间 // @property (nonatomic, assign) BOOL allDay; //是否全天 // @property (nonatomic, strong) NSString *notes; //备注 // if (alarmStr.length == 0) { // alarmTime = 0; // } else if ([alarmStr isEqualToString:@"不提醒"]) { // alarmTime = 0; // } else if ([alarmStr isEqualToString:@"1分钟前"]) { // alarmTime = 60.0 * -1.0f; // } else if ([alarmStr isEqualToString:@"10分钟前"]) { // alarmTime = 60.0 * -10.f; // } else if ([alarmStr isEqualToString:@"30分钟前"]) { // alarmTime = 60.0 * -30.f; // } else if ([alarmStr isEqualToString:@"1小时前"]) { // alarmTime = 60.0 * -60.f; // } else if ([alarmStr isEqualToString:@"1天前"]) { // alarmTime = 60.0 * - 60.f * 24; // @property (nonatomic, strong) NSString *alarmStr; //提醒 eventModel.title = @"eventModel标题"; eventModel.location = @"BeiJing"; eventModel.startDateStr = @"2018-04-05 19:10"; eventModel.endDateStr = @"2018-04-05 20:10"; eventModel.allDay = YES; eventModel.notes = @"eventModel备注"; eventModel.alarmStr = @"1小时前"; self.addItem([LMJWordItem itemWithTitle:@"事件标题: " subTitle:@"" itemOperation:nil]) .addItem([LMJWordItem itemWithTitle:@"增加日历事件" subTitle: nil itemOperation:^(NSIndexPath *indexPath) { [[LMJEventTool sharedEventTool] createEventWithEventModel:eventModel]; [weakself.view makeToast:@"增加了"]; }]) .addItem([LMJWordItem itemWithTitle:@"查找" subTitle: nil itemOperation:^(NSIndexPath *indexPath) { EKEvent *event = [[LMJEventTool sharedEventTool] getEventWithEKEventModel:eventModel]; weakself.sections.firstObject.items.firstObject.subTitle = event.title; [weakself.tableView reloadRow:0 inSection:0 withRowAnimation:0]; }]) .addItem([LMJWordItem itemWithTitle:@"删除" subTitle:nil itemOperation:^(NSIndexPath *indexPath) { BOOL isDeleted = [[LMJEventTool sharedEventTool] deleteEvent:eventModel]; if (isDeleted) { [weakself.view makeToast:@"删除成功"]; weakself.sections.firstObject.items.firstObject.subTitle = nil; [weakself.tableView reloadRow:0 inSection:0 withRowAnimation:0]; }else { [weakself.view makeToast:@"删除失败"]; } }]); } #pragma mark - LMJNavUIBaseViewControllerDataSource /** 导航条左边的按钮 */ - (UIImage *)lmjNavigationBarLeftButtonImage:(UIButton *)leftButton navigationBar:(LMJNavigationBar *)navigationBar { [leftButton setImage:[UIImage imageNamed:@"NavgationBar_white_back"] forState:UIControlStateHighlighted]; return [UIImage imageNamed:@"NavgationBar_blue_back"]; } #pragma mark - LMJNavUIBaseViewControllerDelegate /** 左边的按钮的点击 */ -(void)leftButtonEvent:(UIButton *)sender navigationBar:(LMJNavigationBar *)navigationBar { [self.navigationController popViewControllerAnimated:YES]; } @end
{ "pile_set_name": "Github" }
// // detail/winrt_ssocket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ASIO_DETAIL_WINRT_SSOCKET_SERVICE_HPP #define ASIO_DETAIL_WINRT_SSOCKET_SERVICE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" #if defined(ASIO_WINDOWS_RUNTIME) #include "asio/error.hpp" #include "asio/io_service.hpp" #include "asio/detail/addressof.hpp" #include "asio/detail/winrt_socket_connect_op.hpp" #include "asio/detail/winrt_ssocket_service_base.hpp" #include "asio/detail/winrt_utils.hpp" #include "asio/detail/push_options.hpp" namespace clmdep_asio { namespace detail { template <typename Protocol> class winrt_ssocket_service : public winrt_ssocket_service_base { public: // The protocol type. typedef Protocol protocol_type; // The endpoint type. typedef typename Protocol::endpoint endpoint_type; // The native type of a socket. typedef Windows::Networking::Sockets::StreamSocket^ native_handle_type; // The implementation type of the socket. struct implementation_type : base_implementation_type { // Default constructor. implementation_type() : base_implementation_type(), protocol_(endpoint_type().protocol()) { } // The protocol associated with the socket. protocol_type protocol_; }; // Constructor. winrt_ssocket_service(clmdep_asio::io_service& io_service) : winrt_ssocket_service_base(io_service) { } // Move-construct a new socket implementation. void move_construct(implementation_type& impl, implementation_type& other_impl) { this->base_move_construct(impl, other_impl); impl.protocol_ = other_impl.protocol_; other_impl.protocol_ = endpoint_type().protocol(); } // Move-assign from another socket implementation. void move_assign(implementation_type& impl, winrt_ssocket_service& other_service, implementation_type& other_impl) { this->base_move_assign(impl, other_service, other_impl); impl.protocol_ = other_impl.protocol_; other_impl.protocol_ = endpoint_type().protocol(); } // Move-construct a new socket implementation from another protocol type. template <typename Protocol1> void converting_move_construct(implementation_type& impl, typename winrt_ssocket_service< Protocol1>::implementation_type& other_impl) { this->base_move_construct(impl, other_impl); impl.protocol_ = protocol_type(other_impl.protocol_); other_impl.protocol_ = typename Protocol1::endpoint().protocol(); } // Open a new socket implementation. clmdep_asio::error_code open(implementation_type& impl, const protocol_type& protocol, clmdep_asio::error_code& ec) { if (is_open(impl)) { ec = clmdep_asio::error::already_open; return ec; } try { impl.socket_ = ref new Windows::Networking::Sockets::StreamSocket; impl.protocol_ = protocol; ec = clmdep_asio::error_code(); } catch (Platform::Exception^ e) { ec = clmdep_asio::error_code(e->HResult, clmdep_asio::system_category()); } return ec; } // Assign a native socket to a socket implementation. clmdep_asio::error_code assign(implementation_type& impl, const protocol_type& protocol, const native_handle_type& native_socket, clmdep_asio::error_code& ec) { if (is_open(impl)) { ec = clmdep_asio::error::already_open; return ec; } impl.socket_ = native_socket; impl.protocol_ = protocol; ec = clmdep_asio::error_code(); return ec; } // Bind the socket to the specified local endpoint. clmdep_asio::error_code bind(implementation_type&, const endpoint_type&, clmdep_asio::error_code& ec) { ec = clmdep_asio::error::operation_not_supported; return ec; } // Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, clmdep_asio::error_code& ec) const { endpoint_type endpoint; endpoint.resize(do_get_endpoint(impl, true, endpoint.data(), endpoint.size(), ec)); return endpoint; } // Get the remote endpoint. endpoint_type remote_endpoint(const implementation_type& impl, clmdep_asio::error_code& ec) const { endpoint_type endpoint; endpoint.resize(do_get_endpoint(impl, false, endpoint.data(), endpoint.size(), ec)); return endpoint; } // Set a socket option. template <typename Option> clmdep_asio::error_code set_option(implementation_type& impl, const Option& option, clmdep_asio::error_code& ec) { return do_set_option(impl, option.level(impl.protocol_), option.name(impl.protocol_), option.data(impl.protocol_), option.size(impl.protocol_), ec); } // Get a socket option. template <typename Option> clmdep_asio::error_code get_option(const implementation_type& impl, Option& option, clmdep_asio::error_code& ec) const { std::size_t size = option.size(impl.protocol_); do_get_option(impl, option.level(impl.protocol_), option.name(impl.protocol_), option.data(impl.protocol_), &size, ec); if (!ec) option.resize(impl.protocol_, size); return ec; } // Connect the socket to the specified endpoint. clmdep_asio::error_code connect(implementation_type& impl, const endpoint_type& peer_endpoint, clmdep_asio::error_code& ec) { return do_connect(impl, peer_endpoint.data(), ec); } // Start an asynchronous connect. template <typename Handler> void async_connect(implementation_type& impl, const endpoint_type& peer_endpoint, Handler& handler) { bool is_continuation = clmdep_asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef winrt_socket_connect_op<Handler> op; typename op::ptr p = { clmdep_asio::detail::addressof(handler), clmdep_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect")); start_connect_op(impl, peer_endpoint.data(), p.p, is_continuation); p.v = p.p = 0; } }; } // namespace detail } // namespace clmdep_asio #include "asio/detail/pop_options.hpp" #endif // defined(ASIO_WINDOWS_RUNTIME) #endif // ASIO_DETAIL_WINRT_SSOCKET_SERVICE_HPP
{ "pile_set_name": "Github" }
%verify "executed" %include "arm-vfp/funop.S" {"instr":"ftosizs s1, s0"}
{ "pile_set_name": "Github" }
// Copyright 2015 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <memory> #include <optional> #include <vector> #include "Common/CommonTypes.h" class PointerWrap; namespace DiscIO { struct Partition; } namespace DVDInterface { enum class ReplyType : u32; } namespace DiscIO { enum class Platform; class Volume; } // namespace DiscIO namespace IOS::ES { class TMDReader; class TicketReader; } // namespace IOS::ES namespace DVDThread { void Start(); void Stop(); void DoState(PointerWrap& p); void SetDisc(std::unique_ptr<DiscIO::Volume> disc); bool HasDisc(); bool IsEncryptedAndHashed(); DiscIO::Platform GetDiscType(); u64 PartitionOffsetToRawOffset(u64 offset, const DiscIO::Partition& partition); IOS::ES::TMDReader GetTMD(const DiscIO::Partition& partition); IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition); bool IsInsertedDiscRunning(); // This function returns true and calls SConfig::SetRunningGameMetadata(Volume&, Partition&) // if both of the following conditions are true: // - A disc is inserted // - The title_id argument doesn't contain a value, or its value matches the disc's title ID bool UpdateRunningGameMetadata(const DiscIO::Partition& partition, std::optional<u64> title_id = {}); void StartRead(u64 dvd_offset, u32 length, const DiscIO::Partition& partition, DVDInterface::ReplyType reply_type, s64 ticks_until_completion); void StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset, u32 length, const DiscIO::Partition& partition, DVDInterface::ReplyType reply_type, s64 ticks_until_completion); } // namespace DVDThread
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Freescale Semiconductor * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __FSL_DPAA_FD_H #define __FSL_DPAA_FD_H /* Place-holder for FDs, we represent it via the simplest form that we need for * now. Different overlays may be needed to support different options, etc. (It * is impractical to define One True Struct, because the resulting encoding * routines (lots of read-modify-writes) would be worst-case performance whether * or not circumstances required them.) */ struct dpaa_fd { union { u32 words[8]; struct dpaa_fd_simple { u32 addr_lo; u32 addr_hi; u32 len; /* offset in the MS 16 bits, BPID in the LS 16 bits */ u32 bpid_offset; u32 frc; /* frame context */ /* "err", "va", "cbmt", "asal", [...] */ u32 ctrl; /* flow context */ u32 flc_lo; u32 flc_hi; } simple; }; }; enum dpaa_fd_format { dpaa_fd_single = 0, dpaa_fd_list, dpaa_fd_sg }; static inline u64 ldpaa_fd_get_addr(const struct dpaa_fd *fd) { return (u64)((((uint64_t)fd->simple.addr_hi) << 32) + fd->simple.addr_lo); } static inline void ldpaa_fd_set_addr(struct dpaa_fd *fd, u64 addr) { fd->simple.addr_hi = upper_32_bits(addr); fd->simple.addr_lo = lower_32_bits(addr); } static inline u32 ldpaa_fd_get_len(const struct dpaa_fd *fd) { return fd->simple.len; } static inline void ldpaa_fd_set_len(struct dpaa_fd *fd, u32 len) { fd->simple.len = len; } static inline uint16_t ldpaa_fd_get_offset(const struct dpaa_fd *fd) { return (uint16_t)(fd->simple.bpid_offset >> 16) & 0x0FFF; } static inline void ldpaa_fd_set_offset(struct dpaa_fd *fd, uint16_t offset) { fd->simple.bpid_offset &= 0xF000FFFF; fd->simple.bpid_offset |= (u32)offset << 16; } static inline uint16_t ldpaa_fd_get_bpid(const struct dpaa_fd *fd) { return (uint16_t)(fd->simple.bpid_offset & 0xFFFF); } static inline void ldpaa_fd_set_bpid(struct dpaa_fd *fd, uint16_t bpid) { fd->simple.bpid_offset &= 0xFFFF0000; fd->simple.bpid_offset |= (u32)bpid; } /* When frames are dequeued, the FDs show up inside "dequeue" result structures * (if at all, not all dequeue results contain valid FDs). This structure type * is intentionally defined without internal detail, and the only reason it * isn't declared opaquely (without size) is to allow the user to provide * suitably-sized (and aligned) memory for these entries. */ struct ldpaa_dq { uint32_t dont_manipulate_directly[16]; }; /* Parsing frame dequeue results */ #define LDPAA_DQ_STAT_FQEMPTY 0x80 #define LDPAA_DQ_STAT_HELDACTIVE 0x40 #define LDPAA_DQ_STAT_FORCEELIGIBLE 0x20 #define LDPAA_DQ_STAT_VALIDFRAME 0x10 #define LDPAA_DQ_STAT_ODPVALID 0x04 #define LDPAA_DQ_STAT_VOLATILE 0x02 #define LDPAA_DQ_STAT_EXPIRED 0x01 uint32_t ldpaa_dq_flags(const struct ldpaa_dq *); static inline int ldpaa_dq_is_pull(const struct ldpaa_dq *dq) { return (int)(ldpaa_dq_flags(dq) & LDPAA_DQ_STAT_VOLATILE); } static inline int ldpaa_dq_is_pull_complete( const struct ldpaa_dq *dq) { return (int)(ldpaa_dq_flags(dq) & LDPAA_DQ_STAT_EXPIRED); } /* seqnum/odpid are valid only if VALIDFRAME and ODPVALID flags are TRUE */ uint16_t ldpaa_dq_seqnum(const struct ldpaa_dq *); uint16_t ldpaa_dq_odpid(const struct ldpaa_dq *); uint32_t ldpaa_dq_fqid(const struct ldpaa_dq *); uint32_t ldpaa_dq_byte_count(const struct ldpaa_dq *); uint32_t ldpaa_dq_frame_count(const struct ldpaa_dq *); uint32_t ldpaa_dq_fqd_ctx_hi(const struct ldpaa_dq *); uint32_t ldpaa_dq_fqd_ctx_lo(const struct ldpaa_dq *); /* get the Frame Descriptor */ const struct dpaa_fd *ldpaa_dq_fd(const struct ldpaa_dq *); #endif /* __FSL_DPAA_FD_H */
{ "pile_set_name": "Github" }
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build aix // +build ppc package unix //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: int32(sec), Nsec: int32(nsec)} } func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } func (iov *Iovec) SetLen(length int) { iov.Len = uint32(length) } func (msghdr *Msghdr) SetControllen(length int) { msghdr.Controllen = uint32(length) } func (msghdr *Msghdr) SetIovlen(length int) { msghdr.Iovlen = int32(length) } func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } func Fstat(fd int, stat *Stat_t) error { return fstat(fd, stat) } func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { return fstatat(dirfd, path, stat, flags) } func Lstat(path string, stat *Stat_t) error { return lstat(path, stat) } func Stat(path string, statptr *Stat_t) error { return stat(path, statptr) }
{ "pile_set_name": "Github" }
# /* ************************************************************************** # * * # * (C) Copyright Edward Diener 2014. * # * Distributed under the Boost Software License, Version 1.0. (See * # * accompanying file LICENSE_1_0.txt or copy at * # * http://www.boost.org/LICENSE_1_0.txt) * # * * # ************************************************************************** */ # # /* See http://www.boost.org for most recent version. */ # # ifndef BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP # define BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP # # include <boost/preprocessor/config/config.hpp> # include <boost/preprocessor/tuple/rem.hpp> # include <boost/preprocessor/control/if.hpp> # include <boost/preprocessor/control/iif.hpp> # include <boost/preprocessor/facilities/is_1.hpp> # # /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ # # define BOOST_PP_ARRAY_DETAIL_GET_DATA_NONE(size, data) # if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) # if BOOST_PP_VARIADICS_MSVC # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_DEFAULT(size, data) BOOST_PP_TUPLE_REM(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_CAT(size, data) BOOST_PP_TUPLE_REM_CAT(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) \ BOOST_PP_IIF \ ( \ BOOST_PP_IS_1(size), \ BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_CAT, \ BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_DEFAULT \ ) \ (size,data) \ /**/ # else # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data # endif # else # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data # endif # define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ BOOST_PP_IF \ ( \ size, \ BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY, \ BOOST_PP_ARRAY_DETAIL_GET_DATA_NONE \ ) \ (size,data) \ /**/ # # endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */
{ "pile_set_name": "Github" }
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2007-2016 Hartmut Kaiser // Copyright (c) 2008-2009 Chirag Dekate, Anshul Tandon // Copyright (c) 2012-2013 Thomas Heller // // SPDX-License-Identifier: BSL-1.0 // 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) //////////////////////////////////////////////////////////////////////////////// #pragma once #include <hpx/config.hpp> #include <hpx/assert.hpp> #include <hpx/modules/errors.hpp> #include <hpx/topology/cpu_mask.hpp> #include <boost/variant.hpp> #include <cstddef> #include <cstdint> #include <limits> #include <string> #include <utility> #include <vector> namespace hpx { namespace threads { namespace detail { typedef std::vector<std::int64_t> bounds_type; enum distribution_type { compact = 0x01, scatter = 0x02, balanced = 0x04, numa_balanced = 0x08 }; struct spec_type { enum type { unknown, thread, socket, numanode, core, pu }; HPX_CORE_EXPORT static char const* type_name(type t); static std::int64_t all_entities() { return (std::numeric_limits<std::int64_t>::min)(); } spec_type(type t = unknown, std::int64_t min = all_entities(), std::int64_t max = all_entities()) : type_(t) , index_bounds_() { if (t != unknown) { if (max == 0 || max == all_entities()) { // one or all entities index_bounds_.push_back(min); } else if (min != all_entities()) { // all entities between min and -max, or just min,max HPX_ASSERT(min >= 0); index_bounds_.push_back(min); index_bounds_.push_back(max); } } } bool operator==(spec_type const& rhs) const { if (type_ != rhs.type_ || index_bounds_.size() != rhs.index_bounds_.size()) return false; for (std::size_t i = 0; i < index_bounds_.size(); ++i) { if (index_bounds_[i] != rhs.index_bounds_[i]) return false; } return true; } type type_; bounds_type index_bounds_; }; typedef std::vector<spec_type> mapping_type; typedef std::pair<spec_type, mapping_type> full_mapping_type; typedef std::vector<full_mapping_type> mappings_spec_type; typedef boost::variant<distribution_type, mappings_spec_type> mappings_type; HPX_CORE_EXPORT bounds_type extract_bounds( spec_type const& m, std::size_t default_last, error_code& ec); HPX_CORE_EXPORT void parse_mappings(std::string const& spec, mappings_type& mappings, error_code& ec = throws); } // namespace detail HPX_CORE_EXPORT void parse_affinity_options(std::string const& spec, std::vector<mask_type>& affinities, std::size_t used_cores, std::size_t max_cores, std::size_t num_threads, std::vector<std::size_t>& num_pus, bool use_process_mask, error_code& ec = throws); // backwards compatibility helper inline void parse_affinity_options(std::string const& spec, std::vector<mask_type>& affinities, error_code& ec = throws) { std::vector<std::size_t> num_pus; parse_affinity_options( spec, affinities, 1, 1, affinities.size(), num_pus, false, ec); } }} // namespace hpx::threads
{ "pile_set_name": "Github" }
// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // 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 BOOST_UNITS_ACCELERATION_DERIVED_DIMENSION_HPP #define BOOST_UNITS_ACCELERATION_DERIVED_DIMENSION_HPP #include <boost/units/derived_dimension.hpp> #include <boost/units/physical_dimensions/length.hpp> #include <boost/units/physical_dimensions/time.hpp> namespace boost { namespace units { /// derived dimension for acceleration : L T^-2 typedef derived_dimension<length_base_dimension,1, time_base_dimension,-2>::type acceleration_dimension; } // namespace units } // namespace boost #endif // BOOST_UNITS_ACCELERATION_DERIVED_DIMENSION_HPP
{ "pile_set_name": "Github" }
// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // 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 BOOST_UNITS_PRESSURE_DERIVED_DIMENSION_HPP #define BOOST_UNITS_PRESSURE_DERIVED_DIMENSION_HPP #include <boost/units/derived_dimension.hpp> #include <boost/units/physical_dimensions/length.hpp> #include <boost/units/physical_dimensions/mass.hpp> #include <boost/units/physical_dimensions/time.hpp> namespace boost { namespace units { /// derived dimension for pressure : L^-1 M T^-2 typedef derived_dimension<length_base_dimension,-1, mass_base_dimension,1, time_base_dimension,-2>::type pressure_dimension; } // namespace units } // namespace boost #endif // BOOST_UNITS_PRESSURE_DERIVED_DIMENSION_HPP
{ "pile_set_name": "Github" }
{ config, pkgs, lib, ... }: with lib; let cfg = config.services.jackett; in { options = { services.jackett = { enable = mkEnableOption "Jackett"; dataDir = mkOption { type = types.str; default = "/var/lib/jackett/.config/Jackett"; description = "The directory where Jackett stores its data files."; }; openFirewall = mkOption { type = types.bool; default = false; description = "Open ports in the firewall for the Jackett web interface."; }; user = mkOption { type = types.str; default = "jackett"; description = "User account under which Jackett runs."; }; group = mkOption { type = types.str; default = "jackett"; description = "Group under which Jackett runs."; }; package = mkOption { type = types.package; default = pkgs.jackett; defaultText = "pkgs.jackett"; description = "Jackett package to use."; }; }; }; config = mkIf cfg.enable { systemd.tmpfiles.rules = [ "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -" ]; systemd.services.jackett = { description = "Jackett"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; User = cfg.user; Group = cfg.group; ExecStart = "${cfg.package}/bin/Jackett --NoUpdates --DataFolder '${cfg.dataDir}'"; Restart = "on-failure"; }; }; networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = [ 9117 ]; }; users.users = mkIf (cfg.user == "jackett") { jackett = { group = cfg.group; home = cfg.dataDir; uid = config.ids.uids.jackett; }; }; users.groups = mkIf (cfg.group == "jackett") { jackett.gid = config.ids.gids.jackett; }; }; }
{ "pile_set_name": "Github" }
; RUN: opt < %s -instcombine -S | FileCheck %s ; <rdar://problem/10803154> ; There should be no transformation. ; CHECK: %a = trunc i32 %x to i8 ; CHECK: %b = icmp ne i8 %a, 0 ; CHECK: %c = and i32 %x, 16711680 ; CHECK: %d = icmp ne i32 %c, 0 ; CHECK: %e = and i1 %b, %d ; CHECK: ret i1 %e define i1 @f1(i32 %x) { %a = trunc i32 %x to i8 %b = icmp ne i8 %a, 0 %c = and i32 %x, 16711680 %d = icmp ne i32 %c, 0 %e = and i1 %b, %d ret i1 %e }
{ "pile_set_name": "Github" }
//===- llvm/Assembly/PrintModulePass.h - Printing Pass ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines two passes to print out a module. The PrintModulePass pass // simply prints out the entire module when it is executed. The // PrintFunctionPass class is designed to be pipelined with other // FunctionPass's, and prints out the functions of the module as they are // processed. // //===----------------------------------------------------------------------===// #ifndef LLVM_ASSEMBLY_PRINTMODULEPASS_H #define LLVM_ASSEMBLY_PRINTMODULEPASS_H #include <string> namespace llvm { class FunctionPass; class ModulePass; class raw_ostream; /// createPrintModulePass - Create and return a pass that writes the /// module to the specified raw_ostream. ModulePass *createPrintModulePass(raw_ostream *OS, bool DeleteStream=false, const std::string &Banner = ""); /// createPrintFunctionPass - Create and return a pass that prints /// functions to the specified raw_ostream as they are processed. FunctionPass *createPrintFunctionPass(const std::string &Banner, raw_ostream *OS, bool DeleteStream=false); } // End llvm namespace #endif
{ "pile_set_name": "Github" }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
8