text
stringlengths
2
100k
meta
dict
one.txt two.txt unknown.txt
{ "pile_set_name": "Github" }
min: uglifyjs jquery.easing.js > jquery.easing.min.js
{ "pile_set_name": "Github" }
#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED // // boost/detail/atomic_count_gcc.hpp // // atomic_count for GNU libstdc++ v3 // // http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html // // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. // Copyright (c) 2002 Lars Gullik Bjønnes <[email protected]> // Copyright 2003-2005 Peter Dimov // // 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 __GNUC__ * 100 + __GNUC_MINOR__ >= 402 # include <ext/atomicity.h> #else # include <bits/atomicity.h> #endif namespace boost { namespace detail { #if defined(__GLIBCXX__) // g++ 3.4+ using __gnu_cxx::__atomic_add; using __gnu_cxx::__exchange_and_add; #endif class atomic_count { public: explicit atomic_count( long v ) : value_( v ) {} long operator++() { return __exchange_and_add( &value_, +1 ) + 1; } long operator--() { return __exchange_and_add( &value_, -1 ) - 1; } operator long() const { return __exchange_and_add( &value_, 0 ); } private: atomic_count(atomic_count const &); atomic_count & operator=(atomic_count const &); mutable _Atomic_word value_; }; } // namespace detail } // namespace boost #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob <[email protected]> // // 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_NUMTRAITS_H #define EIGEN_NUMTRAITS_H namespace Eigen { namespace internal { // default implementation of digits10(), based on numeric_limits if specialized, // 0 for integer types, and log10(epsilon()) otherwise. template< typename T, bool use_numeric_limits = std::numeric_limits<T>::is_specialized, bool is_integer = NumTraits<T>::IsInteger> struct default_digits10_impl { static int run() { return std::numeric_limits<T>::digits10; } }; template<typename T> struct default_digits10_impl<T,false,false> // Floating point { static int run() { using std::log10; using std::ceil; typedef typename NumTraits<T>::Real Real; return int(ceil(-log10(NumTraits<Real>::epsilon()))); } }; template<typename T> struct default_digits10_impl<T,false,true> // Integer { static int run() { return 0; } }; } // end namespace internal /** \class NumTraits * \ingroup Core_Module * * \brief Holds information about the various numeric (i.e. scalar) types allowed by Eigen. * * \tparam T the numeric type at hand * * This class stores enums, typedefs and static methods giving information about a numeric type. * * The provided data consists of: * \li A typedef \c Real, giving the "real part" type of \a T. If \a T is already real, * then \c Real is just a typedef to \a T. If \a T is \c std::complex<U> then \c Real * is a typedef to \a U. * \li A typedef \c NonInteger, giving the type that should be used for operations producing non-integral values, * such as quotients, square roots, etc. If \a T is a floating-point type, then this typedef just gives * \a T again. Note however that many Eigen functions such as internal::sqrt simply refuse to * take integers. Outside of a few cases, Eigen doesn't do automatic type promotion. Thus, this typedef is * only intended as a helper for code that needs to explicitly promote types. * \li A typedef \c Literal giving the type to use for numeric literals such as "2" or "0.5". For instance, for \c std::complex<U>, Literal is defined as \c U. * Of course, this type must be fully compatible with \a T. In doubt, just use \a T here. * \li A typedef \a Nested giving the type to use to nest a value inside of the expression tree. If you don't know what * this means, just use \a T here. * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex * type, and to 0 otherwise. * \li An enum value \a IsInteger. It is equal to \c 1 if \a T is an integer type such as \c int, * and to \c 0 otherwise. * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed * to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. * Stay vague here. No need to do architecture-specific stuff. * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned. * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must * be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise. * \li An epsilon() function which, unlike <a href="http://en.cppreference.com/w/cpp/types/numeric_limits/epsilon">std::numeric_limits::epsilon()</a>, * it returns a \a Real instead of a \a T. * \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default * value by the fuzzy comparison operators. * \li highest() and lowest() functions returning the highest and lowest possible values respectively. * \li digits10() function returning the number of decimal digits that can be represented without change. This is * the analogue of <a href="http://en.cppreference.com/w/cpp/types/numeric_limits/digits10">std::numeric_limits<T>::digits10</a> * which is used as the default implementation if specialized. */ template<typename T> struct GenericNumTraits { enum { IsInteger = std::numeric_limits<T>::is_integer, IsSigned = std::numeric_limits<T>::is_signed, IsComplex = 0, RequireInitialization = internal::is_arithmetic<T>::value ? 0 : 1, ReadCost = 1, AddCost = 1, MulCost = 1 }; typedef T Real; typedef typename internal::conditional< IsInteger, typename internal::conditional<sizeof(T)<=2, float, double>::type, T >::type NonInteger; typedef T Nested; typedef T Literal; EIGEN_DEVICE_FUNC static inline Real epsilon() { return numext::numeric_limits<T>::epsilon(); } EIGEN_DEVICE_FUNC static inline int digits10() { return internal::default_digits10_impl<T>::run(); } EIGEN_DEVICE_FUNC static inline Real dummy_precision() { // make sure to override this for floating-point types return Real(0); } EIGEN_DEVICE_FUNC static inline T highest() { return (numext::numeric_limits<T>::max)(); } EIGEN_DEVICE_FUNC static inline T lowest() { return IsInteger ? (numext::numeric_limits<T>::min)() : (-(numext::numeric_limits<T>::max)()); } EIGEN_DEVICE_FUNC static inline T infinity() { return numext::numeric_limits<T>::infinity(); } EIGEN_DEVICE_FUNC static inline T quiet_NaN() { return numext::numeric_limits<T>::quiet_NaN(); } }; template<typename T> struct NumTraits : GenericNumTraits<T> {}; template<> struct NumTraits<float> : GenericNumTraits<float> { EIGEN_DEVICE_FUNC static inline float dummy_precision() { return 1e-5f; } }; template<> struct NumTraits<double> : GenericNumTraits<double> { EIGEN_DEVICE_FUNC static inline double dummy_precision() { return 1e-12; } }; template<> struct NumTraits<long double> : GenericNumTraits<long double> { static inline long double dummy_precision() { return 1e-15l; } }; template<typename _Real> struct NumTraits<std::complex<_Real> > : GenericNumTraits<std::complex<_Real> > { typedef _Real Real; typedef typename NumTraits<_Real>::Literal Literal; enum { IsComplex = 1, RequireInitialization = NumTraits<_Real>::RequireInitialization, ReadCost = 2 * NumTraits<_Real>::ReadCost, AddCost = 2 * NumTraits<Real>::AddCost, MulCost = 4 * NumTraits<Real>::MulCost + 2 * NumTraits<Real>::AddCost }; EIGEN_DEVICE_FUNC static inline Real epsilon() { return NumTraits<Real>::epsilon(); } EIGEN_DEVICE_FUNC static inline Real dummy_precision() { return NumTraits<Real>::dummy_precision(); } EIGEN_DEVICE_FUNC static inline int digits10() { return NumTraits<Real>::digits10(); } }; template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols> struct NumTraits<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > { typedef Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> ArrayType; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Array<RealScalar, Rows, Cols, Options, MaxRows, MaxCols> Real; typedef typename NumTraits<Scalar>::NonInteger NonIntegerScalar; typedef Array<NonIntegerScalar, Rows, Cols, Options, MaxRows, MaxCols> NonInteger; typedef ArrayType & Nested; typedef typename NumTraits<Scalar>::Literal Literal; enum { IsComplex = NumTraits<Scalar>::IsComplex, IsInteger = NumTraits<Scalar>::IsInteger, IsSigned = NumTraits<Scalar>::IsSigned, RequireInitialization = 1, ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * NumTraits<Scalar>::ReadCost, AddCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * NumTraits<Scalar>::AddCost, MulCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * NumTraits<Scalar>::MulCost }; EIGEN_DEVICE_FUNC static inline RealScalar epsilon() { return NumTraits<RealScalar>::epsilon(); } EIGEN_DEVICE_FUNC static inline RealScalar dummy_precision() { return NumTraits<RealScalar>::dummy_precision(); } static inline int digits10() { return NumTraits<Scalar>::digits10(); } }; template<> struct NumTraits<std::string> : GenericNumTraits<std::string> { enum { RequireInitialization = 1, ReadCost = HugeCost, AddCost = HugeCost, MulCost = HugeCost }; static inline int digits10() { return 0; } private: static inline std::string epsilon(); static inline std::string dummy_precision(); static inline std::string lowest(); static inline std::string highest(); static inline std::string infinity(); static inline std::string quiet_NaN(); }; // Empty specialization for void to allow template specialization based on NumTraits<T>::Real with T==void and SFINAE. template<> struct NumTraits<void> {}; } // end namespace Eigen #endif // EIGEN_NUMTRAITS_H
{ "pile_set_name": "Github" }
AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) lib_LTLIBRARIES = libwebpdemux.la libwebpdemux_la_SOURCES = libwebpdemux_la_SOURCES += anim_decode.c demux.c libwebpdemuxinclude_HEADERS = libwebpdemuxinclude_HEADERS += ../webp/decode.h libwebpdemuxinclude_HEADERS += ../webp/demux.h libwebpdemuxinclude_HEADERS += ../webp/mux_types.h libwebpdemuxinclude_HEADERS += ../webp/types.h noinst_HEADERS = noinst_HEADERS += ../webp/format_constants.h libwebpdemux_la_LIBADD = ../libwebp.la libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:6:0 libwebpdemuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpdemux.pc
{ "pile_set_name": "Github" }
--------------------------------------- Build the Multi-Mechanize docs/website: --------------------------------------- The multi-mechanize documentation/website is built using `Sphinx`_. .. _Sphinx: http://sphinx.pocoo.org/ To build the docs you need to perform the following tasks: * Install Sphinx (``$ sudo apt-get install python-sphinx``) * From this ``docs`` directory, run: ``$ make html`` * This will produce HTML documentation in the ``_build/html/`` directory * Open ``_build/html/index.html`` with your browser
{ "pile_set_name": "Github" }
// Signature format: 3.0 package androidx.concurrent.futures { @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public abstract class AbstractResolvableFuture<V> implements com.google.common.util.concurrent.ListenableFuture<V> { ctor protected AbstractResolvableFuture(); method public final void addListener(Runnable!, java.util.concurrent.Executor!); method protected void afterDone(); method public final boolean cancel(boolean); method public final V! get(long, java.util.concurrent.TimeUnit!) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; method public final V! get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException; method protected void interruptTask(); method public final boolean isCancelled(); method public final boolean isDone(); method protected String? pendingToString(); method protected boolean set(V?); method protected boolean setException(Throwable!); method protected boolean setFuture(com.google.common.util.concurrent.ListenableFuture<? extends V>!); method protected final boolean wasInterrupted(); } public final class CallbackToFutureAdapter { method public static <T> com.google.common.util.concurrent.ListenableFuture<T!> getFuture(androidx.concurrent.futures.CallbackToFutureAdapter.Resolver<T!>); } public static final class CallbackToFutureAdapter.Completer<T> { method public void addCancellationListener(Runnable, java.util.concurrent.Executor); method protected void finalize(); method public boolean set(T!); method public boolean setCancelled(); method public boolean setException(Throwable); } public static interface CallbackToFutureAdapter.Resolver<T> { method public Object? attachCompleter(androidx.concurrent.futures.CallbackToFutureAdapter.Completer<T!>) throws java.lang.Exception; } @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class ResolvableFuture<V> extends androidx.concurrent.futures.AbstractResolvableFuture<V> { method public static <V> androidx.concurrent.futures.ResolvableFuture<V!>! create(); method public boolean set(V?); method public boolean setException(Throwable!); method public boolean setFuture(com.google.common.util.concurrent.ListenableFuture<? extends V>!); } }
{ "pile_set_name": "Github" }
import babel from "rollup-plugin-babel"; import commonjs from "rollup-plugin-commonjs"; import resolve from "rollup-plugin-node-resolve"; import uglify from "rollup-plugin-uglify"; const name = process.env.NODE_ENV === "production" ? "freactal.umd.min.js" : "freactal.umd.js"; const config = { input: "./src/index.js", output: { file: `./umd/${name}`, directory: "umd", format: "umd" }, name: "Freactal", external: ["react"], globals: { "react": "React" }, plugins: [ resolve(), commonjs({ include: [ "node_modules/**" ], namedExports: { // Manually specify named `import`s from CJS libraries "node_modules/prop-types/index.js": [ "object" ] } }), babel() ] }; if (process.env.NODE_ENV === "production") { config.plugins.push(uglify()); } export default config;
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> <global name="Category" module="erp5.portal_type"/> </pickle> <pickle> <dictionary> <item> <key> <string>_count</string> </key> <value> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> <item> <key> <string>_mt_index</string> </key> <value> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </value> </item> <item> <key> <string>_tree</string> </key> <value> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> </value> </item> <item> <key> <string>categories</string> </key> <value> <tuple> <string>gap/fr/m14/6/64/641/6416/64161</string> </tuple> </value> </item> <item> <key> <string>id</string> </key> <value> <string>64161</string> </value> </item> <item> <key> <string>portal_type</string> </key> <value> <string>Category</string> </value> </item> <item> <key> <string>title</string> </key> <value> <string>Emplois-jeunes</string> </value> </item> </dictionary> </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> <pickle> <global name="Length" module="BTrees.Length"/> </pickle> <pickle> <int>0</int> </pickle> </record> <record id="3" aka="AAAAAAAAAAM="> <pickle> <global name="OOBTree" module="BTrees.OOBTree"/> </pickle> <pickle> <none/> </pickle> </record> <record id="4" aka="AAAAAAAAAAQ="> <pickle> <global name="OOBTree" module="BTrees.OOBTree"/> </pickle> <pickle> <none/> </pickle> </record> </ZopeData>
{ "pile_set_name": "Github" }
# Contributor: Hidde van der Heide <[email protected]> # Maintainer: Jakub Jirutka <[email protected]> pkgname=opendmarc pkgver=1.3.2 pkgrel=0 pkgdesc="A free open source implementation of the DMARC specification" url="http://www.trusteddomain.org/opendmarc/" arch="all" license="BSD-3-Clause Sendmail" makedepends="libmilter-dev libspf2-dev" pkgusers="$pkgname" install="$pkgname.pre-install" subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-openrc" source="https://downloads.sourceforge.net/project/$pkgname/$pkgname-$pkgver.tar.gz netdb_defines.patch fix-153-duplicate-dkim-auth_result-sections.patch fix-193-sql-strict-mode-compatibility.patch dmarcfail-fix-shebang.patch config-defaults.patch $pkgname.initd " builddir="$srcdir/$pkgname-$pkgver" prepare() { default_prepare update_config_guess update_config_sub } build() { cd "$builddir" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --localstatedir=/var \ --with-installdir=/usr \ --with-spf \ --with-spf2-lib=/usr/lib \ --with-spf2-include=/usr/include/spf2 make } check() { cd "$builddir" opendmarc/opendmarc -V } package() { cd "$builddir" make DESTDIR="$pkgdir" install cd "$pkgdir" install -m 644 -D "$builddir"/opendmarc/opendmarc.conf.sample \ ./etc/$pkgname/opendmarc.conf install -m 755 -D "$srcdir"/$pkgname.initd ./etc/init.d/$pkgname install -m 750 -o $pkgusers -g mail -d ./var/spool/$pkgname # Not needed, standard SPDX licenses. rm -Rf ./usr/share/doc/$pkgname/LICENSE* } sha512sums="6045fb7d2be8f0ffdeca07324857d92908a41c6792749017c2fcc1058f05f55317b1919c67c780827dd7094ec8fff2e1fa4aeb5bab7ff7461537957af2652748 opendmarc-1.3.2.tar.gz a6808ac27264c84a8f7210ccc67f03028bc3644542c4def30824e6342a3fb207615c7b4b21f38084523df0b4dd777fbb6e9d3802bb50b41d3c5b0ce29ebfeff7 netdb_defines.patch 90036e48151d054e43e68f739c4a9cb029b5a698910a566a59148673f9a3329ba7550038fba73538309bf7c43374615819f0351623f273c1ef139129fb2bc5fc fix-153-duplicate-dkim-auth_result-sections.patch b9b7ce647f58e28f28862aa70b43c23579c453ecf839fde57524826193b099c4865e1da0b97eb7bcccf169c9343fd8f1187de4bbad37e1920561c790ac0ca7c2 fix-193-sql-strict-mode-compatibility.patch a8585104490d42ecb2acce40df2e36fc5ed6155fecb16a9de5606703b1b3f5fc7f84f2933350fa3ff8f7da133bc251f30dc33b9c1310bc64e801179de68df026 dmarcfail-fix-shebang.patch ea19017a1e2cab4fe388bca45f44f2f3d71c3212e7f5b312e13e0b7af7cd4180bf5ec1e441e65f0ac33e8d98241b4d980a56fe8afc16a443d304cfab06d2bd95 config-defaults.patch db4a9c79bbf4c54ae70a61d1501b1fb044b2242b43b82b34365b1c1e45429290f3aa89a78711e9fae5518753ddb3e15de2ef68118dae275ed6a6d6be9b2c03ec opendmarc.initd"
{ "pile_set_name": "Github" }
#ifdef EIGEN_MPL2_ONLY #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode #endif
{ "pile_set_name": "Github" }
0.33266 -0.228261 0.292573 0.175263 -0.315777 -0.335011 -0.363145 0.131993 -0.277334 -0.204487 -0.305075 0.06946 0.122532 -0.149162 0.0974565 0.101641 0.33266 -0.228261 -0.315777 -0.335011 -0.315777 -0.335011 -0.277334 -0.204487 -0.277334 -0.204487 0.122532 -0.149162 0.122532 -0.149162 0.33266 -0.228261 0.292573 0.175263 0.155595 0.296675 0.155595 0.296675 0.0974565 0.101641 -0.363145 0.131993 -0.345412 0.278831 -0.345412 0.278831 -0.305075 0.06946 0.155595 0.296675 -0.345412 0.278831 0.292573 0.175263 -0.363145 0.131993 0.0974565 0.101641 -0.305075 0.06946 0.184102 -0.172339 0.150797 -0.159802 0.150797 -0.159802 0.129951 0.0488809 0.129951 0.0488809 0.161419 0.0549538 0.161419 0.0549538 0.184102 -0.172339 0.258634 -0.0673197 0.211495 -0.0626063 0.211495 -0.0626063 0.199054 0.0622165 0.199054 0.0622165 0.244862 0.0710567 0.244862 0.0710567 0.258634 -0.0673197
{ "pile_set_name": "Github" }
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.addthis.hydra.data.filter.bundle.unary; import javax.annotation.Nullable; import com.addthis.hydra.data.filter.bundle.BundleFilter; import com.addthis.hydra.data.filter.util.UnaryOperation; import com.fasterxml.jackson.annotation.JsonCreator; public class BundleFilterIdentity extends BundleFilterUnary { @JsonCreator public BundleFilterIdentity(@Nullable BundleFilter filter) { super(UnaryOperation.IDENTITY, filter); } }
{ "pile_set_name": "Github" }
typedef int T; struct X { int a, b; }; void f(void *ptr) { T* t_ptr = (T *)ptr; (void)sizeof(T); /* A comment */ struct X x = (struct X){1, 2}; void *xx = ptr ? : &x; const char * hello = "Hello"; } enum Color { Red, Green, Blue }; typedef int Int; enum Color g(int i, ...) { __builtin_va_list va; (void)__builtin_va_arg(va, Int); (void)__builtin_types_compatible_p(Int, Int); struct X x = { 0, 0 }; do { x.a++; } while (x.a < 10); enum Color c; switch (c) { case Red: return Green; case Green: return Blue; case Blue: return Red; } } __attribute__((unavailable)) Int __attribute__((unavailable)) test() __attribute__((unavailable)); #define HEADER() \ int x; \ int y; \ int z #define TYPE_INST(name, ...) \ static const struct { \ HEADER(); \ } name = { \ __VA_ARGS__ \ } void func1(void); TYPE_INST(Foo, .x = 0, .y = 1, .z = 2, ); void func2(void); typedef union { struct { int field : 16; }; } r_t; void test() { r_t reg; reg.field = 1; } // RUN: c-index-test -test-annotate-tokens=%s:4:1:37:1 %s | FileCheck %s // CHECK: Identifier: "T" [4:3 - 4:4] TypeRef=T:1:13 // CHECK: Punctuation: "*" [4:4 - 4:5] VarDecl=t_ptr:4:6 (Definition) // CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition) // CHECK: Punctuation: "=" [4:12 - 4:13] VarDecl=t_ptr:4:6 (Definition) // CHECK: Punctuation: "(" [4:14 - 4:15] CStyleCastExpr= // CHECK: Identifier: "T" [4:15 - 4:16] TypeRef=T:1:13 // CHECK: Identifier: "ptr" [4:19 - 4:22] DeclRefExpr=ptr:3:14 // CHECK: Punctuation: ";" [4:22 - 4:23] DeclStmt= // CHECK: Punctuation: "(" [5:3 - 5:4] CStyleCastExpr= // CHECK: Keyword: "void" [5:4 - 5:8] CStyleCastExpr= // CHECK: Punctuation: ")" [5:8 - 5:9] CStyleCastExpr= // CHECK: Keyword: "sizeof" [5:9 - 5:15] UnaryExpr= // CHECK: Punctuation: "(" [5:15 - 5:16] UnaryExpr= // CHECK: Identifier: "T" [5:16 - 5:17] TypeRef=T:1:13 // CHECK: Punctuation: ")" [5:17 - 5:18] UnaryExpr= // CHECK: Punctuation: ";" [5:18 - 5:19] CompoundStmt= // CHECK: Keyword: "struct" [7:3 - 7:9] VarDecl=x:7:12 (Definition) // CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8 // CHECK: Identifier: "x" [7:12 - 7:13] VarDecl=x:7:12 (Definition) // CHECK: Punctuation: "=" [7:14 - 7:15] VarDecl=x:7:12 (Definition) // CHECK: Punctuation: "(" [7:16 - 7:17] CompoundLiteralExpr= // CHECK: Keyword: "struct" [7:17 - 7:23] CompoundLiteralExpr= // CHECK: Identifier: "X" [7:24 - 7:25] TypeRef=struct X:2:8 // CHECK: Punctuation: ")" [7:25 - 7:26] CompoundLiteralExpr= // CHECK: Punctuation: "{" [7:26 - 7:27] InitListExpr= // CHECK: Literal: "1" [7:27 - 7:28] IntegerLiteral= // CHECK: Punctuation: "," [7:28 - 7:29] InitListExpr= // CHECK: Literal: "2" [7:30 - 7:31] IntegerLiteral= // CHECK: Punctuation: "}" [7:31 - 7:32] InitListExpr= // CHECK: Punctuation: ";" [7:32 - 7:33] DeclStmt= // CHECK: Keyword: "void" [8:3 - 8:7] VarDecl=xx:8:9 (Definition) // CHECK: Punctuation: "*" [8:8 - 8:9] VarDecl=xx:8:9 (Definition) // CHECK: Identifier: "xx" [8:9 - 8:11] VarDecl=xx:8:9 (Definition) // CHECK: Punctuation: "=" [8:12 - 8:13] VarDecl=xx:8:9 (Definition) // CHECK: Identifier: "ptr" [8:14 - 8:17] DeclRefExpr=ptr:3:14 // CHECK: Punctuation: "?" [8:18 - 8:19] UnexposedExpr= // CHECK: Punctuation: ":" [8:20 - 8:21] UnexposedExpr= // CHECK: Punctuation: "&" [8:22 - 8:23] UnaryOperator= // CHECK: Identifier: "x" [8:23 - 8:24] DeclRefExpr=x:7:12 // CHECK: Punctuation: ";" [8:24 - 8:25] DeclStmt= // CHECK: Keyword: "const" [9:3 - 9:8] VarDecl=hello:9:16 (Definition) // CHECK: Keyword: "char" [9:9 - 9:13] VarDecl=hello:9:16 (Definition) // CHECK: Punctuation: "*" [9:14 - 9:15] VarDecl=hello:9:16 (Definition) // CHECK: Identifier: "hello" [9:16 - 9:21] VarDecl=hello:9:16 (Definition) // CHECK: Punctuation: "=" [9:22 - 9:23] VarDecl=hello:9:16 (Definition) // CHECK: Literal: ""Hello"" [9:24 - 9:31] StringLiteral= // CHECK: Punctuation: ";" [9:31 - 9:32] DeclStmt= // CHECK: Punctuation: "}" [10:1 - 10:2] CompoundStmt= // CHECK: Keyword: "__builtin_va_arg" [15:9 - 15:25] UnexposedExpr= // CHECK: Identifier: "Int" [15:30 - 15:33] TypeRef=Int:12:13 // CHECK: Keyword: "__builtin_types_compatible_p" [16:9 - 16:37] UnexposedExpr= // CHECK: Identifier: "Int" [16:38 - 16:41] TypeRef=Int:12:13 // CHECK: Punctuation: "," [16:41 - 16:42] UnexposedExpr= // CHECK: Identifier: "Int" [16:43 - 16:46] TypeRef=Int:12:13 // CHECK: Keyword: "struct" [18:3 - 18:9] VarDecl=x:18:12 (Definition) // CHECK: Identifier: "X" [18:10 - 18:11] TypeRef=struct X:2:8 // CHECK: Identifier: "x" [18:12 - 18:13] VarDecl=x:18:12 (Definition) // CHECK: Keyword: "do" [19:3 - 19:5] DoStmt= // CHECK: Identifier: "x" [20:5 - 20:6] DeclRefExpr=x:18:12 // CHECK: Punctuation: "." [20:6 - 20:7] MemberRefExpr=a:2:16 // CHECK: Identifier: "a" [20:7 - 20:8] MemberRefExpr=a:2:16 // CHECK: Punctuation: "++" [20:8 - 20:10] UnaryOperator= // CHECK: Punctuation: ";" [20:10 - 20:11] CompoundStmt= // CHECK: Punctuation: "}" [21:3 - 21:4] CompoundStmt= // CHECK: Keyword: "while" [21:5 - 21:10] DoStmt= // CHECK: Punctuation: "(" [21:11 - 21:12] DoStmt= // CHECK: Identifier: "x" [21:12 - 21:13] DeclRefExpr=x:18:12 // CHECK: Punctuation: "." [21:13 - 21:14] MemberRefExpr=a:2:16 // CHECK: Identifier: "a" [21:14 - 21:15] MemberRefExpr=a:2:16 // CHECK: Keyword: "enum" [23:3 - 23:7] VarDecl=c:23:14 (Definition) // CHECK: Identifier: "Color" [23:8 - 23:13] TypeRef=enum Color:11:6 // CHECK: Identifier: "c" [23:14 - 23:15] VarDecl=c:23:14 (Definition) // CHECK: Punctuation: ";" [23:15 - 23:16] DeclStmt= // CHECK: Keyword: "switch" [24:3 - 24:9] SwitchStmt= // CHECK: Punctuation: "(" [24:10 - 24:11] SwitchStmt= // CHECK: Identifier: "c" [24:11 - 24:12] DeclRefExpr=c:23:14 // CHECK: Punctuation: ")" [24:12 - 24:13] SwitchStmt= // CHECK: Punctuation: "{" [24:14 - 24:15] CompoundStmt= // CHECK: Keyword: "case" [25:3 - 25:7] CaseStmt= // CHECK: Identifier: "Red" [25:8 - 25:11] DeclRefExpr=Red:11:14 // CHECK: Punctuation: ":" [25:11 - 25:12] CaseStmt= // CHECK: Keyword: "return" [26:5 - 26:11] ReturnStmt= // CHECK: Identifier: "Green" [26:12 - 26:17] DeclRefExpr=Green:11:19 // CHECK: Punctuation: ";" [26:17 - 26:18] CompoundStmt= // CHECK: Keyword: "case" [28:3 - 28:7] CaseStmt= // CHECK: Identifier: "Green" [28:8 - 28:13] DeclRefExpr=Green:11:19 // CHECK: Punctuation: ":" [28:13 - 28:14] CaseStmt= // CHECK: Keyword: "return" [29:5 - 29:11] ReturnStmt= // CHECK: Identifier: "Blue" [29:12 - 29:16] DeclRefExpr=Blue:11:26 // CHECK: Punctuation: ";" [29:16 - 29:17] CompoundStmt= // CHECK: Keyword: "case" [31:3 - 31:7] CaseStmt= // CHECK: Identifier: "Blue" [31:8 - 31:12] DeclRefExpr=Blue:11:26 // CHECK: Punctuation: ":" [31:12 - 31:13] CaseStmt= // CHECK: Keyword: "return" [32:5 - 32:11] ReturnStmt= // CHECK: Identifier: "Red" [32:12 - 32:15] DeclRefExpr=Red:11:14 // CHECK: Punctuation: ";" [32:15 - 32:16] CompoundStmt= // CHECK: Keyword: "__attribute__" [36:1 - 36:14] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:14 - 36:15] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:15 - 36:16] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Identifier: "unavailable" [36:16 - 36:27] UnexposedAttr= // CHECK: Punctuation: ")" [36:27 - 36:28] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: ")" [36:28 - 36:29] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Identifier: "Int" [36:30 - 36:33] TypeRef=Int:12:13 // CHECK: Keyword: "__attribute__" [36:34 - 36:47] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:47 - 36:48] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:48 - 36:49] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Identifier: "unavailable" [36:49 - 36:60] UnexposedAttr= // CHECK: Punctuation: ")" [36:60 - 36:61] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: ")" [36:61 - 36:62] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Identifier: "test" [36:63 - 36:67] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:67 - 36:68] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: ")" [36:68 - 36:69] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Keyword: "__attribute__" [36:70 - 36:83] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:83 - 36:84] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: "(" [36:84 - 36:85] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Identifier: "unavailable" [36:85 - 36:96] UnexposedAttr= // CHECK: Punctuation: ")" [36:96 - 36:97] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: ")" [36:97 - 36:98] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: ";" [36:98 - 36:99] // RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 %s | FileCheck %s // RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 %s | FileCheck %s // RUN: c-index-test -test-annotate-tokens=%s:50:1:55:1 %s | FileCheck %s -check-prefix=CHECK-RANGE1 // CHECK-RANGE1: Keyword: "void" [50:1 - 50:5] FunctionDecl=func1:50:6 // CHECK-RANGE1: Identifier: "func1" [50:6 - 50:11] FunctionDecl=func1:50:6 // CHECK-RANGE1: Punctuation: "(" [50:11 - 50:12] FunctionDecl=func1:50:6 // CHECK-RANGE1: Keyword: "void" [50:12 - 50:16] FunctionDecl=func1:50:6 // CHECK-RANGE1: Punctuation: ")" [50:16 - 50:17] FunctionDecl=func1:50:6 // CHECK-RANGE1: Punctuation: ";" [50:17 - 50:18] // CHECK-RANGE1: Identifier: "TYPE_INST" [52:1 - 52:10] macro expansion=TYPE_INST:43:9 // CHECK-RANGE1: Punctuation: "(" [52:10 - 52:11] // CHECK-RANGE1: Identifier: "Foo" [52:11 - 52:14] VarDecl=Foo:52:11 (Definition) // CHECK-RANGE1: Punctuation: "," [52:14 - 52:15] // CHECK-RANGE1: Punctuation: "." [53:5 - 53:6] UnexposedExpr= // CHECK-RANGE1: Identifier: "x" [53:6 - 53:7] MemberRef=x:52:1 // CHECK-RANGE1: Punctuation: "=" [53:8 - 53:9] UnexposedExpr= // CHECK-RANGE1: Literal: "0" [53:10 - 53:11] IntegerLiteral= // CHECK-RANGE1: Punctuation: "," [53:11 - 53:12] InitListExpr= // CHECK-RANGE1: Punctuation: "." [54:5 - 54:6] UnexposedExpr= // CHECK-RANGE1: Identifier: "y" [54:6 - 54:7] MemberRef=y:52:1 // CHECK-RANGE1: Punctuation: "=" [54:8 - 54:9] UnexposedExpr= // CHECK-RANGE1: Literal: "1" [54:10 - 54:11] IntegerLiteral= // CHECK-RANGE1: Punctuation: "," [54:11 - 54:12] InitListExpr= // RUN: c-index-test -test-annotate-tokens=%s:54:1:70:1 %s | FileCheck %s -check-prefix=CHECK-RANGE2 // CHECK-RANGE2: Punctuation: "." [54:5 - 54:6] UnexposedExpr= // CHECK-RANGE2: Identifier: "y" [54:6 - 54:7] MemberRef=y:52:1 // CHECK-RANGE2: Punctuation: "=" [54:8 - 54:9] UnexposedExpr= // CHECK-RANGE2: Literal: "1" [54:10 - 54:11] IntegerLiteral= // CHECK-RANGE2: Punctuation: "," [54:11 - 54:12] InitListExpr= // CHECK-RANGE2: Punctuation: "." [55:5 - 55:6] UnexposedExpr= // CHECK-RANGE2: Identifier: "z" [55:6 - 55:7] MemberRef=z:52:1 // CHECK-RANGE2: Punctuation: "=" [55:8 - 55:9] UnexposedExpr= // CHECK-RANGE2: Literal: "2" [55:10 - 55:11] IntegerLiteral= // CHECK-RANGE2: Punctuation: "," [55:11 - 55:12] InitListExpr= // CHECK-RANGE2: Punctuation: ")" [56:1 - 56:2] // CHECK-RANGE2: Punctuation: ";" [56:2 - 56:3] // CHECK-RANGE2: Keyword: "void" [58:1 - 58:5] FunctionDecl=func2:58:6 // CHECK-RANGE2: Identifier: "func2" [58:6 - 58:11] FunctionDecl=func2:58:6 // CHECK-RANGE2: Punctuation: "(" [58:11 - 58:12] FunctionDecl=func2:58:6 // CHECK-RANGE2: Keyword: "void" [58:12 - 58:16] FunctionDecl=func2:58:6 // CHECK-RANGE2: Punctuation: ")" [58:16 - 58:17] FunctionDecl=func2:58:6 // CHECK-RANGE2: Punctuation: ";" [58:17 - 58:18] // CHECK-RANGE2: Identifier: "reg" [68:3 - 68:6] DeclRefExpr=reg:67:7 // CHECK-RANGE2: Punctuation: "." [68:6 - 68:7] MemberRefExpr=field:62:9 // CHECK-RANGE2: Identifier: "field" [68:7 - 68:12] MemberRefExpr=field:62:9 // RUN: c-index-test -test-annotate-tokens=%s:68:15:68:16 %s | FileCheck %s -check-prefix=CHECK-RANGE3 // CHECK-RANGE3: Literal: "1" [68:15 - 68:16] IntegerLiteral= // CHECK-RANGE3-NOT: Punctuation: ";"
{ "pile_set_name": "Github" }
/****************************************************************************** * Copyright (c) 2011, 2018 GitHub Inc. and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Kevin Sawicki (GitHub Inc.) - initial API and implementation * Michael Mathews (Arizona Board of Regents) - (Bug: 447419) * Team Membership API implementation * Singaram Subramanian (Capital One) - (Bug: 529850) * User teams across GitHub organizations implementation *****************************************************************************/ package org.eclipse.egit.github.core.service; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_MEMBERS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_MEMBERSHIPS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_ORGS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_REPOS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_TEAMS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_USER; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.eclipse.egit.github.core.IRepositoryIdProvider; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.Team; import org.eclipse.egit.github.core.TeamMembership; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.GitHubClient; import org.eclipse.egit.github.core.client.GitHubRequest; import org.eclipse.egit.github.core.client.PagedRequest; /** * Service class for working with organization teams * * @see <a href="http://developer.github.com/v3/orgs/teams">GitHub team API * documentation</a> */ public class TeamService extends GitHubService { /** * Create team service */ public TeamService() { super(); } /** * Create team service * * @param client */ public TeamService(GitHubClient client) { super(client); } /** * Get team with given id * * @param id * @return team * @throws IOException */ public Team getTeam(int id) throws IOException { StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); GitHubRequest request = createRequest(); request.setUri(uri); request.setType(Team.class); return (Team) client.get(request).getBody(); } /** * Get all teams in the given organization * * @param organization * @return list of teams * @throws IOException */ public List<Team> getTeams(String organization) throws IOException { if (organization == null) throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$ if (organization.length() == 0) throw new IllegalArgumentException("Organization cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_ORGS); uri.append('/').append(organization); uri.append(SEGMENT_TEAMS); PagedRequest<Team> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<Team>>() { // make protected type visible }.getType()); return getAll(request); } /** * Create the given team * * @param organization * @param team * @return created team * @throws IOException */ public Team createTeam(String organization, Team team) throws IOException { return createTeam(organization, team, null); } /** * Create the given team * * @param organization * @param team * @param repoNames * @return created team * @throws IOException */ public Team createTeam(String organization, Team team, List<String> repoNames) throws IOException { if (organization == null) throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$ if (organization.length() == 0) throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$ if (team == null) throw new IllegalArgumentException("Team cannot be null"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_ORGS); uri.append('/').append(organization); uri.append(SEGMENT_TEAMS); Map<String, Object> params = new HashMap<>(); params.put("name", team.getName()); //$NON-NLS-1$ params.put("permission", team.getPermission()); //$NON-NLS-1$ if (repoNames != null) params.put("repo_names", repoNames); //$NON-NLS-1$ return client.post(uri.toString(), params, Team.class); } /** * Edit the given team * * @param team * @return edited team * @throws IOException */ public Team editTeam(Team team) throws IOException { if (team == null) throw new IllegalArgumentException("Team cannot be null"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(team.getId()); return client.post(uri.toString(), team, Team.class); } /** * Delete the team with the given id * * @param id * @throws IOException */ public void deleteTeam(int id) throws IOException { StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); client.delete(uri.toString()); } /** * Get members of team with given id * * @param id * @return team members * @throws IOException */ public List<User> getMembers(int id) throws IOException { StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERS); PagedRequest<User> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<User>>() { // make protected type visible }.getType()); return getAll(request); } /** * Is the given user a member of the team with the given id * * @param id * @param user * @return true if member, false if not member * @throws IOException */ public boolean isMember(int id, String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERS); uri.append('/').append(user); return check(uri.toString()); } /** * Add given user to team with given id * * @param id * @param user * @throws IOException */ public void addMember(int id, String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERS); uri.append('/').append(user); client.put(uri.toString()); } /** * Remove given user from team with given id * * @param id * @param user * @throws IOException */ public void removeMember(int id, String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERS); uri.append('/').append(user); client.delete(uri.toString()); } /** * Determines a user's membership status in a team. * * @param id * of the team * @param user * to query * @return the team membership of the user * @throws IOException * if the user is not a member of the team */ public TeamMembership getMembership(int id, String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERSHIPS); uri.append('/').append(user); GitHubRequest request = createRequest(); request.setUri(uri); request.setType(TeamMembership.class); // According to // https://developer.github.com/v3/teams/members/#get-team-membership // GitHub returns a 404 if the user is not a member of the team, which // the GitHubClient translates into an IOException. Is that correct? return (TeamMembership) client.get(request).getBody(); } /** * Add a user to a team. * * @param id * of the team * @param user * to query * @return the resulting {@link TeamMembership} * @throws IOException * if the user cannot be added */ public TeamMembership addMembership(int id, String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERSHIPS); uri.append('/').append(user); return client.put(uri.toString(), null, TeamMembership.class); } /** * Remove a user from a team. * * @param id * of the team * @param user * to remove * @throws IOException * on communication errors */ public void removeMembership(int id, String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_MEMBERSHIPS); uri.append('/').append(user); client.delete(uri.toString()); } /** * Get all repositories for given team * * @param id * @return non-null list of repositories * @throws IOException */ public List<Repository> getRepositories(int id) throws IOException { StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_REPOS); PagedRequest<Repository> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<Repository>>() { // make protected type visible }.getType()); return getAll(request); } /** * Is given repository managed by given team * * @param id * @param repository * @return true if managed by team, false otherwise * @throws IOException */ public boolean isTeamRepository(int id, IRepositoryIdProvider repository) throws IOException { String repoId = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_REPOS); uri.append('/').append(repoId); return check(uri.toString()); } /** * Add repository to team * * @param id * @param repository * @throws IOException */ public void addRepository(int id, IRepositoryIdProvider repository) throws IOException { String repoId = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_REPOS); uri.append('/').append(repoId); client.put(uri.toString()); } /** * Remove repository from team * * @param id * @param repository * @throws IOException */ public void removeRepository(int id, IRepositoryIdProvider repository) throws IOException { String repoId = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_TEAMS); uri.append('/').append(id); uri.append(SEGMENT_REPOS); uri.append('/').append(repoId); client.delete(uri.toString()); } /** * Get teams associated with given repository * * @param repository * @return list of teams * @throws IOException */ public List<Team> getTeams(IRepositoryIdProvider repository) throws IOException { String id = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(id); uri.append(SEGMENT_TEAMS); PagedRequest<Team> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<Team>>() { // make protected type visible }.getType()); return getAll(request); } /** * Get teams of the current user across all of the GitHub organizations * * @return list of teams * @throws IOException */ public List<Team> getTeams() throws IOException { StringBuilder uri = new StringBuilder(SEGMENT_USER).append(SEGMENT_TEAMS); PagedRequest<Team> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<Team>>() { // make protected type visible }.getType()); return getAll(request); } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2015 David Boissier * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.codinjutsu.tools.nosql.commons.view.editor; import com.intellij.openapi.components.ApplicationComponent; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.FileEditorPolicy; import com.intellij.openapi.fileEditor.FileEditorProvider; import com.intellij.openapi.fileEditor.FileEditorState; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import org.codinjutsu.tools.nosql.DatabaseVendorUIManager; import org.codinjutsu.tools.nosql.commons.DatabaseUI; import org.jdom.Element; import org.jetbrains.annotations.NotNull; public class NoSqlDatabaseDataEditorProvider implements FileEditorProvider, ApplicationComponent, DumbAware { @Override public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { return DatabaseVendorUIManager.getInstance(project).accept(file); } @NotNull @Override public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { NoSqlDatabaseObjectFile objectFile = (NoSqlDatabaseObjectFile) file; DatabaseUI databaseUI = DatabaseVendorUIManager.getInstance(project).get(objectFile.getConfiguration().getDatabaseVendor()); if (databaseUI == null) { throw new IllegalStateException("Unsupported file"); } return new NoSqlDatabaseDataEditor(databaseUI.createResultPanel(project, objectFile)); } @Override public void disposeEditor(@NotNull FileEditor editor) { editor.dispose(); } @Override public void initComponent() { } @Override public void disposeComponent() { } @NotNull @Override public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) { return FileEditorState.INSTANCE; } @Override public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) { } @NotNull @Override public String getEditorTypeId() { return "NoSqlData"; } @NotNull @Override public FileEditorPolicy getPolicy() { return FileEditorPolicy.HIDE_DEFAULT_EDITOR; } @NotNull @Override public String getComponentName() { return "NoSqlPlugin.NoSqlEditorProvider"; } }
{ "pile_set_name": "Github" }
// -------------------------------------------------------------------------- // OpenMS -- Open-Source Mass Spectrometry // -------------------------------------------------------------------------- // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen, // ETH Zurich, and Freie Universitaet Berlin 2002-2020. // // This software is released under a three-clause BSD license: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of any author or any participating institution // may be used to endorse or promote products derived from this software // without specific prior written permission. // For a full list of authors, refer to the file AUTHORS. // -------------------------------------------------------------------------- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // -------------------------------------------------------------------------- // $Maintainer: George Rosenberger $ // $Authors: George Rosenberger, Hannes Roest $ // -------------------------------------------------------------------------- #include <OpenMS/CONCEPT/ClassTest.h> #include <OpenMS/test_config.h> #include <OpenMS/FORMAT/TraMLFile.h> #include <boost/assign/std/vector.hpp> /////////////////////////// #include <OpenMS/ANALYSIS/OPENSWATH/TransitionPQPFile.h> /////////////////////////// using namespace OpenMS; using namespace std; START_TEST(TransitionPQPFile, "$Id$") ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// TransitionPQPFile* ptr = nullptr; TransitionPQPFile* nullPointer = nullptr; START_SECTION(TransitionPQPFile()) { ptr = new TransitionPQPFile(); TEST_NOT_EQUAL(ptr, nullPointer) } END_SECTION START_SECTION(~TransitionPQPFile()) { delete ptr; } END_SECTION START_SECTION( void convertTargetedExperimentToPQP(const char * filename, OpenMS::TargetedExperiment & targeted_exp)) { // see TOPP / UTILS tool test NOT_TESTABLE } END_SECTION START_SECTION( void convertPQPToTargetedExperiment(const char * filename, OpenMS::TargetedExperiment & targeted_exp)) { // see TOPP / UTILS tool test NOT_TESTABLE } END_SECTION START_SECTION( void validateTargetedExperiment(OpenMS::TargetedExperiment & targeted_exp)) { NOT_TESTABLE } END_SECTION ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// END_TEST
{ "pile_set_name": "Github" }
//============= // N64 Include //============= // N64 MIPS 4300 CPU Registers constant r0(0) constant r1(1) constant r2(2) constant r3(3) constant r4(4) constant r5(5) constant r6(6) constant r7(7) constant r8(8) constant r9(9) constant r10(10) constant r11(11) constant r12(12) constant r13(13) constant r14(14) constant r15(15) constant r16(16) constant r17(17) constant r18(18) constant r19(19) constant r20(20) constant r21(21) constant r22(22) constant r23(23) constant r24(24) constant r25(25) constant r26(26) constant r27(27) constant r28(28) constant r29(29) constant r30(30) constant r31(31) constant at(1) constant v0(2) constant v1(3) constant a0(4) constant a1(5) constant a2(6) constant a3(7) constant t0(8) constant t1(9) constant t2(10) constant t3(11) constant t4(12) constant t5(13) constant t6(14) constant t7(15) constant s0(16) constant s1(17) constant s2(18) constant s3(19) constant s4(20) constant s5(21) constant s6(22) constant s7(23) constant t8(24) constant t9(25) constant k0(26) constant k1(27) constant gp(28) constant sp(29) constant s8(30) constant ra(31) // N64 MIPS 4300 CP1 Floating Point Unit (FPU) Registers (COP1) constant f0(0) constant f1(1) constant f2(2) constant f3(3) constant f4(4) constant f5(5) constant f6(6) constant f7(7) constant f8(8) constant f9(9) constant f10(10) constant f11(11) constant f12(12) constant f13(13) constant f14(14) constant f15(15) constant f16(16) constant f17(17) constant f18(18) constant f19(19) constant f20(20) constant f21(21) constant f22(22) constant f23(23) constant f24(24) constant f25(25) constant f26(26) constant f27(27) constant f28(28) constant f29(29) constant f30(30) constant f31(31) // Memory Map constant RDRAM($A000) // $00000000..$003FFFFF RDRAM Memory 4MB ($00000000..$007FFFFF 8MB With Expansion Pak) constant RDRAM_BASE($A3F0) // $03F00000..$03F00027 RDRAM Base Register constant RDRAM_DEVICE_TYPE($00) // $03F00000..$03F00003 RDRAM: Device Type Register constant RDRAM_DEVICE_ID($04) // $03F00004..$03F00007 RDRAM: Device ID Register constant RDRAM_DELAY($08) // $03F00008..$03F0000B RDRAM: Delay Register constant RDRAM_MODE($0C) // $03F0000C..$03F0000F RDRAM: Mode Register constant RDRAM_REF_INTERVAL($10) // $03F00010..$03F00013 RDRAM: Ref Interval Register constant RDRAM_REF_ROW($14) // $03F00014..$03F00017 RDRAM: Ref Row Register constant RDRAM_RAS_INTERVAL($18) // $03F00018..$03F0001B RDRAM: Ras Interval Register constant RDRAM_MIN_INTERVAL($1C) // $03F0001C..$03F0001F RDRAM: Minimum Interval Register constant RDRAM_ADDR_SELECT($20) // $03F00020..$03F00023 RDRAM: Address Select Register constant RDRAM_DEVICE_MANUF($24) // $03F00024..$03F00027 RDRAM: Device Manufacturer Register constant SP_MEM_BASE($A400) // $04000000..$04000FFF SP MEM Base Register constant SP_DMEM($0000) // $04000000..$04000FFF SP: RSP DMEM (4096 Bytes) constant SP_IMEM($1000) // $04001000..$04001FFF SP: RSP IMEM (4096 Bytes) constant SP_BASE($A404) // $04040000..$0404001F SP Base Register constant SP_MEM_ADDR($00) // $04040000..$04040003 SP: Master, SP Memory Address Register constant SP_DRAM_ADDR($04) // $04040004..$04040007 SP: Slave, SP DRAM DMA Address Register constant SP_RD_LEN($08) // $04040008..$0404000B SP: Read DMA Length Register constant SP_WR_LEN($0C) // $0404000C..$0404000F SP: Write DMA Length Register constant SP_STATUS($10) // $04040010..$04040013 SP: Status Register constant SP_DMA_FULL($14) // $04040014..$04040017 SP: DMA Full Register constant SP_DMA_BUSY($18) // $04040018..$0404001B SP: DMA Busy Register constant SP_SEMAPHORE($1C) // $0404001C..$0404001F SP: Semaphore Register constant SP_PC_BASE($A408) // $04080000..$04080007 SP PC Base Register constant SP_PC($00) // $04080000..$04080003 SP: PC Register constant SP_IBIST_REG($04) // $04080004..$04080007 SP: IMEM BIST Register constant DPC_BASE($A410) // $04100000..$0410001F DP Command (DPC) Base Register constant DPC_START($00) // $04100000..$04100003 DPC: CMD DMA Start Register constant DPC_END($04) // $04100004..$04100007 DPC: CMD DMA End Register constant DPC_CURRENT($08) // $04100008..$0410000B DPC: CMD DMA Current Register constant DPC_STATUS($0C) // $0410000C..$0410000F DPC: CMD Status Register constant DPC_CLOCK($10) // $04100010..$04100013 DPC: Clock Counter Register constant DPC_BUFBUSY($14) // $04100014..$04100017 DPC: Buffer Busy Counter Register constant DPC_PIPEBUSY($18) // $04100018..$0410001B DPC: Pipe Busy Counter Register constant DPC_TMEM($1C) // $0410001C..$0410001F DPC: TMEM Load Counter Register constant DPS_BASE($A420) // $04200000..$0420000F DP Span (DPS) Base Register constant DPS_TBIST($00) // $04200000..$04200003 DPS: Tmem Bist Register constant DPS_TEST_MODE($04) // $04200004..$04200007 DPS: Span Test Mode Register constant DPS_BUFTEST_ADDR($08) // $04200008..$0420000B DPS: Span Buffer Test Address Register constant DPS_BUFTEST_DATA($0C) // $0420000C..$0420000F DPS: Span Buffer Test Data Register constant MI_BASE($A430) // $04300000..$0430000F MIPS Interface (MI) Base Register constant MI_INIT_MODE($00) // $04300000..$04300003 MI: Init Mode Register constant MI_VERSION($04) // $04300004..$04300007 MI: Version Register constant MI_INTR($08) // $04300008..$0430000B MI: Interrupt Register constant MI_INTR_MASK($0C) // $0430000C..$0430000F MI: Interrupt Mask Register constant VI_BASE($A440) // $04400000..$04400037 Video Interface (VI) Base Register constant VI_STATUS($00) // $04400000..$04400003 VI: Status/Control Register constant VI_ORIGIN($04) // $04400004..$04400007 VI: Origin Register constant VI_WIDTH($08) // $04400008..$0440000B VI: Width Register constant VI_V_INTR($0C) // $0440000C..$0440000F VI: Vertical Interrupt Register constant VI_V_CURRENT_LINE($10) // $04400010..$04400013 VI: Current Vertical Line Register constant VI_TIMING($14) // $04400014..$04400017 VI: Video Timing Register constant VI_V_SYNC($18) // $04400018..$0440001B VI: Vertical Sync Register constant VI_H_SYNC($1C) // $0440001C..$0440001F VI: Horizontal Sync Register constant VI_H_SYNC_LEAP($20) // $04400020..$04400023 VI: Horizontal Sync Leap Register constant VI_H_VIDEO($24) // $04400024..$04400027 VI: Horizontal Video Register constant VI_V_VIDEO($28) // $04400028..$0440002B VI: Vertical Video Register constant VI_V_BURST($2C) // $0440002C..$0440002F VI: Vertical Burst Register constant VI_X_SCALE($30) // $04400030..$04400033 VI: X-Scale Register constant VI_Y_SCALE($34) // $04400034..$04400037 VI: Y-Scale Register constant AI_BASE($A450) // $04500000..$04500017 Audio Interface (AI) Base Register constant AI_DRAM_ADDR($00) // $04500000..$04500003 AI: DRAM Address Register constant AI_LEN($04) // $04500004..$04500007 AI: Length Register constant AI_CONTROL($08) // $04500008..$0450000B AI: Control Register constant AI_STATUS($0C) // $0450000C..$0450000F AI: Status Register constant AI_DACRATE($10) // $04500010..$04500013 AI: DAC Sample Period Register constant AI_BITRATE($14) // $04500014..$04500017 AI: Bit Rate Register constant PI_BASE($A460) // $04600000..$04600033 Peripheral Interface (PI) Base Register constant PI_DRAM_ADDR($00) // $04600000..$04600003 PI: DRAM Address Register constant PI_CART_ADDR($04) // $04600004..$04600007 PI: Pbus (Cartridge) Address Register constant PI_RD_LEN($08) // $04600008..$0460000B PI: Read Length Register constant PI_WR_LEN($0C) // $0460000C..$0460000F PI: Write length register constant PI_STATUS($10) // $04600010..$04600013 PI: Status Register constant PI_BSD_DOM1_LAT($14) // $04600014..$04600017 PI: Domain 1 Latency Register constant PI_BSD_DOM1_PWD($18) // $04600018..$0460001B PI: Domain 1 Pulse Width Register constant PI_BSD_DOM1_PGS($1C) // $0460001C..$0460001F PI: Domain 1 Page Size Register constant PI_BSD_DOM1_RLS($20) // $04600020..$04600023 PI: Domain 1 Release Register constant PI_BSD_DOM2_LAT($24) // $04600024..$04600027 PI: Domain 2 Latency Register constant PI_BSD_DOM2_PWD($28) // $04600028..$0460002B PI: Domain 2 Pulse Width Register constant PI_BSD_DOM2_PGS($2C) // $0460002C..$0460002F PI: Domain 2 Page Size Register constant PI_BSD_DOM2_RLS($30) // $04600030..$04600033 PI: Domain 2 Release Register constant RI_BASE($A470) // $04700000..$0470001F RDRAM Interface (RI) Base Register constant RI_MODE($00) // $04700000..$04700003 RI: Mode Register constant RI_CONFIG($04) // $04700004..$04700007 RI: Config Register constant RI_CURRENT_LOAD($08) // $04700008..$0470000B RI: Current Load Register constant RI_SELECT($0C) // $0470000C..$0470000F RI: Select Register constant RI_REFRESH($10) // $04700010..$04700013 RI: Refresh Register constant RI_LATENCY($14) // $04700014..$04700017 RI: Latency Register constant RI_RERROR($18) // $04700018..$0470001B RI: Read Error Register constant RI_WERROR($1C) // $0470001C..$0470001F RI: Write Error Register constant SI_BASE($A480) // $04800000..$0480001B Serial Interface (SI) Base Register constant SI_DRAM_ADDR($00) // $04800000..$04800003 SI: DRAM Address Register constant SI_PIF_ADDR_RD64B($04) // $04800004..$04800007 SI: Address Read 64B Register //*RESERVED*($08) // $04800008..$0480000B SI: Reserved Register //*RESERVED*($0C) // $0480000C..$0480000F SI: Reserved Register constant SI_PIF_ADDR_WR64B($10) // $04800010..$04800013 SI: Address Write 64B Register //*RESERVED*($14) // $04800014..$04800017 SI: Reserved Register constant SI_STATUS($18) // $04800018..$0480001B SI: Status Register constant CART_DOM2_ADDR1($A500) // $05000000..$0507FFFF Cartridge Domain 2(Address 1) SRAM constant CART_DOM1_ADDR1($A600) // $06000000..$07FFFFFF Cartridge Domain 1(Address 1) 64DD constant CART_DOM2_ADDR2($A800) // $08000000..$0FFFFFFF Cartridge Domain 2(Address 2) SRAM constant CART_DOM1_ADDR2($B000) // $10000000..$18000803 Cartridge Domain 1(Address 2) ROM constant PIF_BASE($BFC0) // $1FC00000..$1FC007BF PIF Base Register constant PIF_ROM($000) // $1FC00000..$1FC007BF PIF: Boot ROM constant PIF_RAM($7C0) // $1FC007C0..$1FC007FF PIF: RAM (JoyChannel) constant PIF_HWORD($7C4) // $1FC007C4..$1FC007C5 PIF: HWORD constant PIF_XBYTE($7C6) // $1FC007C6 PIF: Analog X Byte constant PIF_YBYTE($7C7) // $1FC007C7 PIF: Analog Y Byte constant CART_DOM1_ADDR3($BFD0) // $1FD00000..$7FFFFFFF Cartridge Domain 1 (Address 3) constant EXT_SYS_AD($8000) // $80000000..$FFFFFFFF External SysAD Device constant VI_NTSC_CLOCK(48681812) // NTSC: Hz = 48.681812 MHz constant VI_PAL_CLOCK(49656530) // PAL: Hz = 49.656530 MHz constant VI_MPAL_CLOCK(48628316) // MPAL: Hz = 48.628316 MHz macro align(size) { // Align Byte Amount while (pc() % {size}) { db 0 } } macro N64_INIT() { // Initialise N64 (Stop N64 From Crashing 5 Seconds After Boot) lui a0,PIF_BASE // A0 = PIF Base Register ($BFC00000) ori t0,r0,8 sw t0,PIF_RAM+$3C(a0) } macro DMA(start, end, dest) { // DMA Data Copy Cart->DRAM: Start Cart Address, End Cart Address, Destination DRAM Address lui a0,PI_BASE // A0 = PI Base Register ($A4600000) - lw t0,PI_STATUS(a0) // T0 = Word From PI Status Register ($A4600010) andi t0,3 // AND PI Status With 3 bnez t0,- // IF TRUE DMA Is Busy nop // Delay Slot la t0,{dest}&$7FFFFF // T0 = Aligned DRAM Physical RAM Offset ($00000000..$007FFFFF 8MB) sw t0,PI_DRAM_ADDR(a0) // Store RAM Offset To PI DRAM Address Register ($A4600000) la t0,$10000000|({start}&$3FFFFFF) // T0 = Aligned Cart Physical ROM Offset ($10000000..$13FFFFFF 64MB) sw t0,PI_CART_ADDR(a0) // Store ROM Offset To PI Cart Address Register ($A4600004) la t0,({end}-{start})-1 // T0 = Length Of DMA Transfer In Bytes - 1 sw t0,PI_WR_LEN(a0) // Store DMA Length To PI Write Length Register ($A460000C) }
{ "pile_set_name": "Github" }
<template> <div id="profile-dropdown-container" class="flex items-center cursor-pointer"> <div id="profile-dropdown" class="flex flex-row items-center" @click="toggleProfileDropdown" v-click-outside="hideProfileDropdown"> <img class="w-8 h-8 rounded-full" :src="generateUrl(user.avatar)"> </div> <div v-if="currentComponent === 'profile-dropdown'" id="profile-menu" class="absolute bg-white w-48 -ml-32 mr-2 py-1 shadow-lg rounded z-50" style="top:3.5rem;"> <a class="px-4 py-2 hover:bg-indigo-500 hover:text-white no-underline text-gray-600 block font-medium" :href="profileUrl"> <span class="w-6 inline-block"> <font-awesome-icon :icon="faUser" class="pr-1"></font-awesome-icon> </span> {{ 'Your Profile' | localize }} </a> <a class="px-4 py-2 hover:bg-indigo-500 hover:text-white text-gray-600 font-medium no-underline block" href="/admin"> <span class="w-6 inline-block"> <font-awesome-icon :icon="faShieldAlt" class="pr-1 font-regular"></font-awesome-icon> </span> {{ 'Admin' | localize }} </a> <a name="timer-menu" class="px-4 py-2 hover:bg-indigo-500 hover:text-white text-gray-600 font-medium no-underline block" @click="showTimer"> <span class="w-6 inline-block"> <font-awesome-icon :icon="faStopwatch" class="pr-1 font-regular"></font-awesome-icon> </span> {{ 'Timer' | localize }} </a> <a v-if="authenticated" class="px-4 py-2 hover:bg-indigo-500 hover:text-white text-gray-600 font-medium no-underline block" href="/settings"> <span class="w-6 inline-block"> <font-awesome-icon :icon="faCog" class="pr-1 font-regular"></font-awesome-icon> </span> {{ 'Settings' | localize }} </a> <span class="block border-t"></span> <a v-if="impersonating" class="px-4 py-2 hover:bg-indigo-500 hover:text-white text-gray-600 font-medium no-underline block" href="/impersonate/leave"> <span class="w-6 inline-block"> <font-awesome-icon :icon="faUserMinus" class="pr-1 font-regular"></font-awesome-icon> </span> {{ 'Leave User' | localize }} </a> <a class="px-4 py-2 hover:bg-indigo-500 hover:text-white text-gray-600 font-medium no-underline block" :href="url.logout" @click="logoutUser"> <span class="w-6 inline-block"> <font-awesome-icon :icon="faSignOutAlt" class="pr-1 font-regular"></font-awesome-icon> </span> {{ 'Logout' | localize }} </a> </div> <form id="logout-form" :action="url.logout" method="POST" style="display: none;"> <input type="hidden" name="_token" :value="token"> </form> </div> </template> <script> import { mapState, mapActions } from 'vuex' import { faAngleDown, faCog, faShieldAlt, faSignOutAlt, faUser, faEnvelope, faUserMinus, faStopwatch } from '@fortawesome/free-solid-svg-icons' export default { data: () => ({ user: user, token: Laravel.csrfToken, url: navUrl, avatar: '', profileUrl: navUrl.site + '/users/' + user.username, impersonating: impersonating, authenticated, faAngleDown, faCog, faShieldAlt, faSignOutAlt, faUser, faUserMinus, faEnvelope, faStopwatch }), computed: { ...mapState({ currentComponent: state => state.dropdown.currentComponent, }), }, methods: { ...mapActions([ 'setCurrentComponent', 'closeComponent' ]), logoutUser (event) { event.preventDefault() document.getElementById('logout-form').submit() }, toggleProfileDropdown (event) { if (this.currentComponent === 'profile-dropdown') { this.hideProfileDropdown(event) document.body.removeEventListener('keyup', this.hideProfileDropdown) } else { this.showProfileDropdown() document.body.addEventListener('keyup', this.hideProfileDropdown) } }, showProfileDropdown (event) { if (this.notificationShown) { this.notificationShown = false } this.setCurrentComponent('profile-dropdown') }, hideProfileDropdown (event) { if (event.type === 'keyup' && event.key !== 'Escape') { return false } if (this.currentComponent === 'profile-dropdown') { this.closeComponent('') } }, showTimer (event) { this.setCurrentComponent('timer') } } } </script>
{ "pile_set_name": "Github" }
/* * JBoss, Home of Professional Open Source. * Copyright 2016, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.wildfly.clustering.server.singleton; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; import org.jboss.msc.service.Service; import org.jboss.msc.service.ServiceController; import org.jboss.msc.service.ServiceName; import org.jboss.msc.service.ServiceRegistry; import org.jboss.msc.service.ServiceTarget; import org.jboss.msc.service.StartContext; import org.jboss.msc.service.StartException; import org.jboss.msc.service.StopContext; import org.wildfly.clustering.dispatcher.CommandDispatcher; import org.wildfly.clustering.server.logging.ClusteringServerLogger; import org.wildfly.clustering.singleton.SingletonService; /** * Distributed {@link SingletonService} implementation that uses JBoss MSC 1.3.x service installation. * Decorates an MSC service ensuring that it is only started on one node in the cluster at any given time. * @author Paul Ferraro */ @Deprecated public class LegacyDistributedSingletonService<T> extends AbstractDistributedSingletonService<LegacySingletonContext<T>> implements SingletonService<T>, LegacySingletonContext<T>, PrimaryProxyContext<T> { private final ServiceName name; private volatile boolean started = false; private volatile ServiceController<T> primaryController; private volatile ServiceController<T> backupController; public LegacyDistributedSingletonService(DistributedSingletonServiceContext context, Service<T> primaryService, Service<T> backupService) { this(context, primaryService, backupService, new LazySupplier<>()); } private LegacyDistributedSingletonService(DistributedSingletonServiceContext context, Service<T> primaryService, Service<T> backupService, LazySupplier<PrimaryProxyContext<T>> contextFactory) { super(context, new ServiceLifecycleFactory<>(context.getServiceName(), primaryService, (backupService != null) ? backupService : new PrimaryProxyService<>(contextFactory))); contextFactory.accept(this); this.name = context.getServiceName(); } @Override public ServiceName getServiceName() { return this.name; } @Override public LegacySingletonContext<T> get() { return this; } @SuppressWarnings("unchecked") @Override public void start(StartContext context) throws StartException { super.start(context); ServiceRegistry registry = context.getController().getServiceContainer(); this.primaryController = (ServiceController<T>) registry.getService(this.getServiceName().append("primary")); this.backupController = (ServiceController<T>) registry.getService(this.getServiceName().append("backup")); this.started = true; } @Override public void stop(StopContext context) { this.started = false; super.stop(context); } @Override public T getValue() { while (this.started) { try { return (this.isPrimary() ? this.primaryController : this.backupController).getValue(); } catch (IllegalStateException e) { // Verify whether ISE is due to unmet quorum in the previous election if (this.getServiceProviderRegistration().getProviders().size() < this.getQuorum()) { throw ClusteringServerLogger.ROOT_LOGGER.notStarted(this.getServiceName().getCanonicalName()); } if (Thread.currentThread().isInterrupted()) { throw e; } // Otherwise, we're in the midst of a new election, so just try again Thread.yield(); } } throw ClusteringServerLogger.ROOT_LOGGER.notStarted(this.getServiceName().getCanonicalName()); } @Override public CommandDispatcher<LegacySingletonContext<T>> getCommandDispatcher() { return super.getCommandDispatcher(); } @Override public Optional<T> getLocalValue() { try { return this.isPrimary() ? Optional.ofNullable(this.primaryController.getValue()) : null; } catch (IllegalStateException e) { // This might happen if primary service has not yet started, or if node is no longer the primary node return null; } } static class LazySupplier<T> implements Supplier<T>, Consumer<T> { private volatile T value; @Override public void accept(T value) { this.value = value; } @Override public T get() { return this.value; } } private static class ServiceLifecycleFactory<T> implements Function<ServiceTarget, Lifecycle> { private final ServiceName name; private final Service<T> primaryService; private final Service<T> backupService; ServiceLifecycleFactory(ServiceName name, Service<T> primaryService, Service<T> backupService) { this.name = name; this.primaryService = primaryService; this.backupService = backupService; } @Override public Lifecycle apply(ServiceTarget target) { Lifecycle primaryLifecycle = new ServiceLifecycle(target.addService(this.name.append("primary"), this.primaryService).setInitialMode(ServiceController.Mode.NEVER).install()); Lifecycle backupLifecycle = new ServiceLifecycle(target.addService(this.name.append("backup"), this.backupService).setInitialMode(ServiceController.Mode.ACTIVE).install()); return new PrimaryBackupLifecycle(primaryLifecycle, backupLifecycle); } } private static class PrimaryBackupLifecycle implements Lifecycle { private final Lifecycle primaryLifecycle; private final Lifecycle backupLifecycle; PrimaryBackupLifecycle(Lifecycle primaryLifecycle, Lifecycle backupLifecycle) { this.primaryLifecycle = primaryLifecycle; this.backupLifecycle = backupLifecycle; } @Override public void start() { this.backupLifecycle.stop(); this.primaryLifecycle.start(); } @Override public void stop() { this.primaryLifecycle.stop(); this.backupLifecycle.start(); } } }
{ "pile_set_name": "Github" }
// This file tests a specific bug that occurs when the API returns facets data for hierarchical attributes in a // different order than the declared attributes order at the helper initialization 'use strict'; test('hierarchical facets: attributes order', function(done) { var algoliasearch = require('algoliasearch'); var algoliasearchHelper = require('../../../'); var appId = 'hierarchical-toggleRefine-appId'; var apiKey = 'hierarchical-toggleRefine-apiKey'; var indexName = 'hierarchical-toggleRefine-indexName'; var client = algoliasearch(appId, apiKey); var helper = algoliasearchHelper(client, indexName, { hierarchicalFacets: [{ name: 'categories', attributes: ['categories.lvl0', 'categories.lvl1'] }] }); helper.toggleFacetRefinement('categories', 'beers'); var algoliaResponse = { 'results': [{ 'query': 'a', 'index': indexName, 'hits': [{'objectID': 'one'}], 'nbHits': 3, 'page': 0, 'nbPages': 1, 'hitsPerPage': 20, 'exhaustiveFacetsCount': true, 'facets': { // /!\ Note that lvl1 comes *before* lvl0 here 'categories.lvl1': {'beers > IPA': 6, 'beers > 1664': 3}, 'categories.lvl0': {'beers': 9} } }, { 'query': 'a', 'index': indexName, 'hits': [{'objectID': 'one'}], 'nbHits': 1, 'page': 0, 'nbPages': 1, 'hitsPerPage': 1, 'facets': { 'categories.lvl0': {'beers': 9, 'fruits': 5, 'sales': 20} } }] }; var expectedHelperResponse = [{ 'name': 'categories', 'count': null, 'isRefined': true, 'path': null, 'exhaustive': true, 'data': [{ 'name': 'beers', 'path': 'beers', 'count': 9, 'isRefined': true, 'exhaustive': true, 'data': [{ 'name': '1664', 'path': 'beers > 1664', 'count': 3, 'isRefined': false, 'exhaustive': true, 'data': null }, { 'name': 'IPA', 'path': 'beers > IPA', 'count': 6, 'isRefined': false, 'exhaustive': true, 'data': null }] }, { 'name': 'fruits', 'path': 'fruits', 'count': 5, 'isRefined': false, 'exhaustive': true, 'data': null }, { 'name': 'sales', 'path': 'sales', 'count': 20, 'isRefined': false, 'exhaustive': true, 'data': null }] }]; client.search = jest.fn(function() { return Promise.resolve(algoliaResponse); }); helper.setQuery('a').search(); helper.once('result', function(event) { expect(event.results.hierarchicalFacets).toEqual(expectedHelperResponse); expect(event.results.getFacetByName('categories')).toEqual(expectedHelperResponse[0]); done(); }); });
{ "pile_set_name": "Github" }
package com.dlsc.preferencesfx.formsfx.view.controls; /* - * ========================LICENSE_START================================= * FormsFX * %% * Copyright (C) 2017 DLSC Software & Consulting * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * =========================LICENSE_END================================== */ import com.dlsc.formsfx.model.structure.StringField; import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; import javafx.beans.binding.Bindings; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; import javafx.stage.DirectoryChooser; import javafx.stage.FileChooser; /** * This class provides the base implementation for a simple control to select or enter a directory * path. * * @author Rinesch Murugathas * @author Sacha Schmid * @author François Martin * @author Marco Sanfratello * @author Arvid Nyström */ public class SimpleChooserControl extends SimpleControl<StringField, StackPane> { /** * - The fieldLabel is the container that displays the label property of the field. - The * editableField allows users to modify the field's value. - The readOnlyLabel displays the * field's value if it is not editable. */ private TextField editableField; private TextArea editableArea; private Label readOnlyLabel; private Label fieldLabel; private Button chooserButton = new Button(); private HBox contentBox = new HBox(); private String buttonText; private File initialDirectory; private boolean directory; /** * Create a new SimpleChooserControl. * * @param buttonText Text for the button to show, e.g. "Browse" * @param initialDirectory An optional initial path, can be null. * If null, will use the path from the previously * chosen file if present. * @param directory true, if only directories are allowed */ public SimpleChooserControl(String buttonText, File initialDirectory, boolean directory) { this.buttonText = buttonText; this.initialDirectory = initialDirectory; this.directory = directory; } /** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); node = new StackPane(); node.getStyleClass().add("simple-text-control"); editableField = new TextField(field.getValue()); editableArea = new TextArea(field.getValue()); readOnlyLabel = new Label(field.getValue()); fieldLabel = new Label(field.labelProperty().getValue()); editableField.setPromptText(field.placeholderProperty().getValue()); if (field.valueProperty().get().equals("null")) { field.valueProperty().set(""); } chooserButton.setOnAction(event -> { File currentInitialDirectory = initialDirectory; boolean fileChosen = !field.valueProperty().get().trim().isEmpty(); if (initialDirectory == null && fileChosen) { // define previously chosen path as initial directory String previousPath = field.valueProperty().get(); // initial directory must be a folder if (!new File(previousPath).isDirectory()) { Path path = Paths.get(previousPath); previousPath = path.getParent().toAbsolutePath().toString(); } currentInitialDirectory = new File(previousPath); } File chosen; if (directory) { DirectoryChooser directoryChooser = new DirectoryChooser(); directoryChooser.setInitialDirectory(currentInitialDirectory); chosen = directoryChooser.showDialog(getNode().getScene().getWindow()); } else { FileChooser fileChooser = new FileChooser(); fileChooser.setInitialDirectory(currentInitialDirectory); chosen = fileChooser.showOpenDialog(getNode().getScene().getWindow()); } if (chosen != null) { editableField.setText(chosen.getAbsolutePath()); } }); chooserButton.setText(buttonText); StackPane fieldStackPane = new StackPane(); fieldStackPane.getChildren().addAll(editableField, editableArea, readOnlyLabel); fieldStackPane.setAlignment(Pos.CENTER_LEFT); HBox.setHgrow(fieldStackPane, Priority.ALWAYS); contentBox.getChildren().addAll(fieldStackPane, chooserButton); } /** * {@inheritDoc} */ @Override public void layoutParts() { readOnlyLabel.getStyleClass().add("read-only-label"); readOnlyLabel.setPrefHeight(26); editableArea.getStyleClass().add("simple-textarea"); editableArea.setPrefRowCount(5); editableArea.setPrefHeight(80); editableArea.setWrapText(true); if (field.isMultiline()) { node.setPrefHeight(80); readOnlyLabel.setPrefHeight(80); } node.getChildren().add(contentBox); node.setAlignment(Pos.CENTER_LEFT); } /** * {@inheritDoc} */ @Override public void setupBindings() { super.setupBindings(); editableArea.visibleProperty().bind(Bindings.and(field.editableProperty(), field.multilineProperty())); editableField.visibleProperty().bind(Bindings.and(field.editableProperty(), field.multilineProperty().not())); readOnlyLabel.visibleProperty().bind(field.editableProperty().not()); editableField.textProperty().bindBidirectional(field.userInputProperty()); editableArea.textProperty().bindBidirectional(field.userInputProperty()); readOnlyLabel.textProperty().bind(field.userInputProperty()); editableField.promptTextProperty().bind(field.placeholderProperty()); editableArea.promptTextProperty().bind(field.placeholderProperty()); editableArea.managedProperty().bind(editableArea.visibleProperty()); editableField.managedProperty().bind(editableField.visibleProperty()); } /** * {@inheritDoc} */ @Override public void setupValueChangedListeners() { super.setupValueChangedListeners(); field.multilineProperty().addListener((observable, oldValue, newValue) -> { node.setPrefHeight(newValue ? 80 : 0); readOnlyLabel.setPrefHeight(newValue ? 80 : 26); }); field.errorMessagesProperty().addListener((observable, oldValue, newValue) -> toggleTooltip(field.isMultiline() ? editableArea : editableField) ); editableField.focusedProperty().addListener( (observable, oldValue, newValue) -> toggleTooltip(editableField) ); editableArea.focusedProperty().addListener( (observable, oldValue, newValue) -> toggleTooltip(editableArea) ); } }
{ "pile_set_name": "Github" }
// UpdateProduce.cpp #include "StdAfx.h" #include "UpdateProduce.h" using namespace NUpdateArchive; static const char *kUpdateActionSetCollision = "Internal collision in update action set"; void UpdateProduce( const CRecordVector<CUpdatePair> &updatePairs, const CActionSet &actionSet, CRecordVector<CUpdatePair2> &operationChain, IUpdateProduceCallback *callback) { for (int i = 0; i < updatePairs.Size(); i++) { const CUpdatePair &pair = updatePairs[i]; CUpdatePair2 up2; up2.IsAnti = false; up2.DirIndex = pair.DirIndex; up2.ArcIndex = pair.ArcIndex; up2.NewData = up2.NewProps = true; switch(actionSet.StateActions[pair.State]) { case NPairAction::kIgnore: /* if (pair.State != NPairState::kOnlyOnDisk) IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]); // cout << "deleting"; */ if (callback) callback->ShowDeleteFile(pair.ArcIndex); continue; case NPairAction::kCopy: if (pair.State == NPairState::kOnlyOnDisk) throw kUpdateActionSetCollision; up2.NewData = up2.NewProps = false; break; case NPairAction::kCompress: if (pair.State == NPairState::kOnlyInArchive || pair.State == NPairState::kNotMasked) throw kUpdateActionSetCollision; break; case NPairAction::kCompressAsAnti: up2.IsAnti = true; break; } operationChain.Add(up2); } operationChain.ReserveDown(); }
{ "pile_set_name": "Github" }
{% extends "index.html" %} {% block title %}500-OMS{% endblock %} {% block container %} <section id="error-container"> <div class="block-error"> <header> <h1 class="error">500</h1> <p class="text-center">Something went wrong.</p> </header> <p class="text-center">Houston, we have a problem. Please try again later.</p> <div class="row"> <div class="col-md-12"> <a class="btn btn-info btn-block btn-3d" href="index.html">Back to Dashboard</a> </div> </div> </div> </section> {% endblock %}
{ "pile_set_name": "Github" }
/********************************************************************** * LeechCraft - modular cross-platform feature rich internet client. * Copyright (C) 2006-2014 Georg Rudoy * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) **********************************************************************/ #pragma once #include <memory> #include <optional> #include <QObject> #include <util/db/oral/oralfwd.h> #include <util/db/oral/oraltypes.h> namespace LC { namespace NamAuth { class SQLStorageBackend : public QObject { Q_OBJECT std::shared_ptr<QSqlDatabase> DB_; public: struct AuthRecord { QString RealmName_; QString Context_; QString Login_; QString Password_; static QString ClassName () { return "AuthRecords"; } static QString FieldNameMorpher (const QString& str) { return str; } using Constraints = Util::oral::Constraints< Util::oral::PrimaryKey<0, 1> >; }; private: Util::oral::ObjectInfo_ptr<AuthRecord> AdaptedRecord_; public: SQLStorageBackend (); static QString GetDBPath (); std::optional<AuthRecord> GetAuth (const QString&, const QString&); void SetAuth (const AuthRecord&); }; } }
{ "pile_set_name": "Github" }
row.names,sbp,tobacco,ldl,adiposity,famhist,typea,obesity,alcohol,age,chd 1,160,12.00, 5.73,23.11,Present,49,25.30, 97.20,52,1 2,144, 0.01, 4.41,28.61,Absent,55,28.87, 2.06,63,1 3,118, 0.08, 3.48,32.28,Present,52,29.14, 3.81,46,0 4,170, 7.50, 6.41,38.03,Present,51,31.99, 24.26,58,1 5,134,13.60, 3.50,27.78,Present,60,25.99, 57.34,49,1 6,132, 6.20, 6.47,36.21,Present,62,30.77, 14.14,45,0 7,142, 4.05, 3.38,16.20,Absent,59,20.81, 2.62,38,0 8,114, 4.08, 4.59,14.60,Present,62,23.11, 6.72,58,1 9,114, 0.00, 3.83,19.40,Present,49,24.86, 2.49,29,0 10,132, 0.00, 5.80,30.96,Present,69,30.11, 0.00,53,1 11,206, 6.00, 2.95,32.27,Absent,72,26.81, 56.06,60,1 12,134,14.10, 4.44,22.39,Present,65,23.09, 0.00,40,1 13,118, 0.00, 1.88,10.05,Absent,59,21.57, 0.00,17,0 14,132, 0.00, 1.87,17.21,Absent,49,23.63, 0.97,15,0 15,112, 9.65, 2.29,17.20,Present,54,23.53, 0.68,53,0 16,117, 1.53, 2.44,28.95,Present,35,25.89, 30.03,46,0 17,120, 7.50,15.33,22.00,Absent,60,25.31, 34.49,49,0 18,146,10.50, 8.29,35.36,Present,78,32.73, 13.89,53,1 19,158, 2.60, 7.46,34.07,Present,61,29.30, 53.28,62,1 20,124,14.00, 6.23,35.96,Present,45,30.09, 0.00,59,1 21,106, 1.61, 1.74,12.32,Absent,74,20.92, 13.37,20,1 22,132, 7.90, 2.85,26.50,Present,51,26.16, 25.71,44,0 23,150, 0.30, 6.38,33.99,Present,62,24.64, 0.00,50,0 24,138, 0.60, 3.81,28.66,Absent,54,28.70, 1.46,58,0 25,142,18.20, 4.34,24.38,Absent,61,26.19, 0.00,50,0 26,124, 4.00,12.42,31.29,Present,54,23.23, 2.06,42,1 27,118, 6.00, 9.65,33.91,Absent,60,38.80, 0.00,48,0 28,145, 9.10, 5.24,27.55,Absent,59,20.96, 21.60,61,1 29,144, 4.09, 5.55,31.40,Present,60,29.43, 5.55,56,0 30,146, 0.00, 6.62,25.69,Absent,60,28.07, 8.23,63,1 31,136, 2.52, 3.95,25.63,Absent,51,21.86, 0.00,45,1 32,158, 1.02, 6.33,23.88,Absent,66,22.13, 24.99,46,1 33,122, 6.60, 5.58,35.95,Present,53,28.07, 12.55,59,1 34,126, 8.75, 6.53,34.02,Absent,49,30.25, 0.00,41,1 35,148, 5.50, 7.10,25.31,Absent,56,29.84, 3.60,48,0 36,122, 4.26, 4.44,13.04,Absent,57,19.49, 48.99,28,1 37,140, 3.90, 7.32,25.05,Absent,47,27.36, 36.77,32,0 38,110, 4.64, 4.55,30.46,Absent,48,30.90, 15.22,46,0 39,130, 0.00, 2.82,19.63,Present,70,24.86, 0.00,29,0 40,136,11.20, 5.81,31.85,Present,75,27.68, 22.94,58,1 41,118, 0.28, 5.80,33.70,Present,60,30.98, 0.00,41,1 42,144, 0.04, 3.38,23.61,Absent,30,23.75, 4.66,30,0 43,120, 0.00, 1.07,16.02,Absent,47,22.15, 0.00,15,0 44,130, 2.61, 2.72,22.99,Present,51,26.29, 13.37,51,1 45,114, 0.00, 2.99, 9.74,Absent,54,46.58, 0.00,17,0 46,128, 4.65, 3.31,22.74,Absent,62,22.95, 0.51,48,0 47,162, 7.40, 8.55,24.65,Present,64,25.71, 5.86,58,1 48,116, 1.91, 7.56,26.45,Present,52,30.01, 3.60,33,1 49,114, 0.00, 1.94,11.02,Absent,54,20.17, 38.98,16,0 50,126, 3.80, 3.88,31.79,Absent,57,30.53, 0.00,30,0 51,122, 0.00, 5.75,30.90,Present,46,29.01, 4.11,42,0 52,134, 2.50, 3.66,30.90,Absent,52,27.19, 23.66,49,0 53,152, 0.90, 9.12,30.23,Absent,56,28.64, 0.37,42,1 54,134, 8.08, 1.55,17.50,Present,56,22.65, 66.65,31,1 55,156, 3.00, 1.82,27.55,Absent,60,23.91, 54.00,53,0 56,152, 5.99, 7.99,32.48,Absent,45,26.57,100.32,48,0 57,118, 0.00, 2.99,16.17,Absent,49,23.83, 3.22,28,0 58,126, 5.10, 2.96,26.50,Absent,55,25.52, 12.34,38,1 59,103, 0.03, 4.21,18.96,Absent,48,22.94, 2.62,18,0 60,121, 0.80, 5.29,18.95,Present,47,22.51, 0.00,61,0 61,142, 0.28, 1.80,21.03,Absent,57,23.65, 2.93,33,0 62,138, 1.15, 5.09,27.87,Present,61,25.65, 2.34,44,0 63,152,10.10, 4.71,24.65,Present,65,26.21, 24.53,57,0 64,140, 0.45, 4.30,24.33,Absent,41,27.23, 10.08,38,0 65,130, 0.00, 1.82,10.45,Absent,57,22.07, 2.06,17,0 66,136, 7.36, 2.19,28.11,Present,61,25.00, 61.71,54,0 67,124, 4.82, 3.24,21.10,Present,48,28.49, 8.42,30,0 68,112, 0.41, 1.88,10.29,Absent,39,22.08, 20.98,27,0 69,118, 4.46, 7.27,29.13,Present,48,29.01, 11.11,33,0 70,122, 0.00, 3.37,16.10,Absent,67,21.06, 0.00,32,1 71,118, 0.00, 3.67,12.13,Absent,51,19.15, 0.60,15,0 72,130, 1.72, 2.66,10.38,Absent,68,17.81, 11.10,26,0 73,130, 5.60, 3.37,24.80,Absent,58,25.76, 43.20,36,0 74,126, 0.09, 5.03,13.27,Present,50,17.75, 4.63,20,0 75,128, 0.40, 6.17,26.35,Absent,64,27.86, 11.11,34,0 76,136, 0.00, 4.12,17.42,Absent,52,21.66, 12.86,40,0 77,134, 0.00, 5.90,30.84,Absent,49,29.16, 0.00,55,0 78,140, 0.60, 5.56,33.39,Present,58,27.19, 0.00,55,1 79,168, 4.50, 6.68,28.47,Absent,43,24.25, 24.38,56,1 80,108, 0.40, 5.91,22.92,Present,57,25.72, 72.00,39,0 81,114, 3.00, 7.04,22.64,Present,55,22.59, 0.00,45,1 82,140, 8.14, 4.93,42.49,Absent,53,45.72, 6.43,53,1 83,148, 4.80, 6.09,36.55,Present,63,25.44, 0.88,55,1 84,148,12.20, 3.79,34.15,Absent,57,26.38, 14.40,57,1 85,128, 0.00, 2.43,13.15,Present,63,20.75, 0.00,17,0 86,130, 0.56, 3.30,30.86,Absent,49,27.52, 33.33,45,0 87,126,10.50, 4.49,17.33,Absent,67,19.37, 0.00,49,1 88,140, 0.00, 5.08,27.33,Present,41,27.83, 1.25,38,0 89,126, 0.90, 5.64,17.78,Present,55,21.94, 0.00,41,0 90,122, 0.72, 4.04,32.38,Absent,34,28.34, 0.00,55,0 91,116, 1.03, 2.83,10.85,Absent,45,21.59, 1.75,21,0 92,120, 3.70, 4.02,39.66,Absent,61,30.57, 0.00,64,1 93,143, 0.46, 2.40,22.87,Absent,62,29.17, 15.43,29,0 94,118, 4.00, 3.95,18.96,Absent,54,25.15, 8.33,49,1 95,194, 1.70, 6.32,33.67,Absent,47,30.16, 0.19,56,0 96,134, 3.00, 4.37,23.07,Absent,56,20.54, 9.65,62,0 97,138, 2.16, 4.90,24.83,Present,39,26.06, 28.29,29,0 98,136, 0.00, 5.00,27.58,Present,49,27.59, 1.47,39,0 99,122, 3.20,11.32,35.36,Present,55,27.07, 0.00,51,1 100,164,12.00, 3.91,19.59,Absent,51,23.44, 19.75,39,0 101,136, 8.00, 7.85,23.81,Present,51,22.69, 2.78,50,0 102,166, 0.07, 4.03,29.29,Absent,53,28.37, 0.00,27,0 103,118, 0.00, 4.34,30.12,Present,52,32.18, 3.91,46,0 104,128, 0.42, 4.60,26.68,Absent,41,30.97, 10.33,31,0 105,118, 1.50, 5.38,25.84,Absent,64,28.63, 3.89,29,0 106,158, 3.60, 2.97,30.11,Absent,63,26.64,108.00,64,0 107,108, 1.50, 4.33,24.99,Absent,66,22.29, 21.60,61,1 108,170, 7.60, 5.50,37.83,Present,42,37.41, 6.17,54,1 109,118, 1.00, 5.76,22.10,Absent,62,23.48, 7.71,42,0 110,124, 0.00, 3.04,17.33,Absent,49,22.04, 0.00,18,0 111,114, 0.00, 8.01,21.64,Absent,66,25.51, 2.49,16,0 112,168, 9.00, 8.53,24.48,Present,69,26.18, 4.63,54,1 113,134, 2.00, 3.66,14.69,Absent,52,21.03, 2.06,37,0 114,174, 0.00, 8.46,35.10,Present,35,25.27, 0.00,61,1 115,116,31.20, 3.17,14.99,Absent,47,19.40, 49.06,59,1 116,128, 0.00,10.58,31.81,Present,46,28.41, 14.66,48,0 117,140, 4.50, 4.59,18.01,Absent,63,21.91, 22.09,32,1 118,154, 0.70, 5.91,25.00,Absent,13,20.60, 0.00,42,0 119,150, 3.50, 6.99,25.39,Present,50,23.35, 23.48,61,1 120,130, 0.00, 3.92,25.55,Absent,68,28.02, 0.68,27,0 121,128, 2.00, 6.13,21.31,Absent,66,22.86, 11.83,60,0 122,120, 1.40, 6.25,20.47,Absent,60,25.85, 8.51,28,0 123,120, 0.00, 5.01,26.13,Absent,64,26.21, 12.24,33,0 124,138, 4.50, 2.85,30.11,Absent,55,24.78, 24.89,56,1 125,153, 7.80, 3.96,25.73,Absent,54,25.91, 27.03,45,0 126,123, 8.60,11.17,35.28,Present,70,33.14, 0.00,59,1 127,148, 4.04, 3.99,20.69,Absent,60,27.78, 1.75,28,0 128,136, 3.96, 2.76,30.28,Present,50,34.42, 18.51,38,0 129,134, 8.80, 7.41,26.84,Absent,35,29.44, 29.52,60,1 130,152,12.18, 4.04,37.83,Present,63,34.57, 4.17,64,0 131,158,13.50, 5.04,30.79,Absent,54,24.79, 21.50,62,0 132,132, 2.00, 3.08,35.39,Absent,45,31.44, 79.82,58,1 133,134, 1.50, 3.73,21.53,Absent,41,24.70, 11.11,30,1 134,142, 7.44, 5.52,33.97,Absent,47,29.29, 24.27,54,0 135,134, 6.00, 3.30,28.45,Absent,65,26.09, 58.11,40,0 136,122, 4.18, 9.05,29.27,Present,44,24.05, 19.34,52,1 137,116, 2.70, 3.69,13.52,Absent,55,21.13, 18.51,32,0 138,128, 0.50, 3.70,12.81,Present,66,21.25, 22.73,28,0 139,120, 0.00, 3.68,12.24,Absent,51,20.52, 0.51,20,0 140,124, 0.00, 3.95,36.35,Present,59,32.83, 9.59,54,0 141,160,14.00, 5.90,37.12,Absent,58,33.87, 3.52,54,1 142,130, 2.78, 4.89, 9.39,Present,63,19.30, 17.47,25,1 143,128, 2.80, 5.53,14.29,Absent,64,24.97, 0.51,38,0 144,130, 4.50, 5.86,37.43,Absent,61,31.21, 32.30,58,0 145,109, 1.20, 6.14,29.26,Absent,47,24.72, 10.46,40,0 146,144, 0.00, 3.84,18.72,Absent,56,22.10, 4.80,40,0 147,118, 1.05, 3.16,12.98,Present,46,22.09, 16.35,31,0 148,136, 3.46, 6.38,32.25,Present,43,28.73, 3.13,43,1 149,136, 1.50, 6.06,26.54,Absent,54,29.38, 14.50,33,1 150,124,15.50, 5.05,24.06,Absent,46,23.22, 0.00,61,1 151,148, 6.00, 6.49,26.47,Absent,48,24.70, 0.00,55,0 152,128, 6.60, 3.58,20.71,Absent,55,24.15, 0.00,52,0 153,122, 0.28, 4.19,19.97,Absent,61,25.63, 0.00,24,0 154,108, 0.00, 2.74,11.17,Absent,53,22.61, 0.95,20,0 155,124, 3.04, 4.80,19.52,Present,60,21.78,147.19,41,1 156,138, 8.80, 3.12,22.41,Present,63,23.33,120.03,55,1 157,127, 0.00, 2.81,15.70,Absent,42,22.03, 1.03,17,0 158,174, 9.45, 5.13,35.54,Absent,55,30.71, 59.79,53,0 159,122, 0.00, 3.05,23.51,Absent,46,25.81, 0.00,38,0 160,144, 6.75, 5.45,29.81,Absent,53,25.62, 26.23,43,1 161,126, 1.80, 6.22,19.71,Absent,65,24.81, 0.69,31,0 162,208,27.40, 3.12,26.63,Absent,66,27.45, 33.07,62,1 163,138, 0.00, 2.68,17.04,Absent,42,22.16, 0.00,16,0 164,148, 0.00, 3.84,17.26,Absent,70,20.00, 0.00,21,0 165,122, 0.00, 3.08,16.30,Absent,43,22.13, 0.00,16,0 166,132, 7.00, 3.20,23.26,Absent,77,23.64, 23.14,49,0 167,110,12.16, 4.99,28.56,Absent,44,27.14, 21.60,55,1 168,160, 1.52, 8.12,29.30,Present,54,25.87, 12.86,43,1 169,126, 0.54, 4.39,21.13,Present,45,25.99, 0.00,25,0 170,162, 5.30, 7.95,33.58,Present,58,36.06, 8.23,48,0 171,194, 2.55, 6.89,33.88,Present,69,29.33, 0.00,41,0 172,118, 0.75, 2.58,20.25,Absent,59,24.46, 0.00,32,0 173,124, 0.00, 4.79,34.71,Absent,49,26.09, 9.26,47,0 174,160, 0.00, 2.42,34.46,Absent,48,29.83, 1.03,61,0 175,128, 0.00, 2.51,29.35,Present,53,22.05, 1.37,62,0 176,122, 4.00, 5.24,27.89,Present,45,26.52, 0.00,61,1 177,132, 2.00, 2.70,21.57,Present,50,27.95, 9.26,37,0 178,120, 0.00, 2.42,16.66,Absent,46,20.16, 0.00,17,0 179,128, 0.04, 8.22,28.17,Absent,65,26.24, 11.73,24,0 180,108,15.00, 4.91,34.65,Absent,41,27.96, 14.40,56,0 181,166, 0.00, 4.31,34.27,Absent,45,30.14, 13.27,56,0 182,152, 0.00, 6.06,41.05,Present,51,40.34, 0.00,51,0 183,170, 4.20, 4.67,35.45,Present,50,27.14, 7.92,60,1 184,156, 4.00, 2.05,19.48,Present,50,21.48, 27.77,39,1 185,116, 8.00, 6.73,28.81,Present,41,26.74, 40.94,48,1 186,122, 4.40, 3.18,11.59,Present,59,21.94, 0.00,33,1 187,150,20.00, 6.40,35.04,Absent,53,28.88, 8.33,63,0 188,129, 2.15, 5.17,27.57,Absent,52,25.42, 2.06,39,0 189,134, 4.80, 6.58,29.89,Present,55,24.73, 23.66,63,0 190,126, 0.00, 5.98,29.06,Present,56,25.39, 11.52,64,1 191,142, 0.00, 3.72,25.68,Absent,48,24.37, 5.25,40,1 192,128, 0.70, 4.90,37.42,Present,72,35.94, 3.09,49,1 193,102, 0.40, 3.41,17.22,Present,56,23.59, 2.06,39,1 194,130, 0.00, 4.89,25.98,Absent,72,30.42, 14.71,23,0 195,138, 0.05, 2.79,10.35,Absent,46,21.62, 0.00,18,0 196,138, 0.00, 1.96,11.82,Present,54,22.01, 8.13,21,0 197,128, 0.00, 3.09,20.57,Absent,54,25.63, 0.51,17,0 198,162, 2.92, 3.63,31.33,Absent,62,31.59, 18.51,42,0 199,160, 3.00, 9.19,26.47,Present,39,28.25, 14.40,54,1 200,148, 0.00, 4.66,24.39,Absent,50,25.26, 4.03,27,0 201,124, 0.16, 2.44,16.67,Absent,65,24.58, 74.91,23,0 202,136, 3.15, 4.37,20.22,Present,59,25.12, 47.16,31,1 203,134, 2.75, 5.51,26.17,Absent,57,29.87, 8.33,33,0 204,128, 0.73, 3.97,23.52,Absent,54,23.81, 19.20,64,0 205,122, 3.20, 3.59,22.49,Present,45,24.96, 36.17,58,0 206,152, 3.00, 4.64,31.29,Absent,41,29.34, 4.53,40,0 207,162, 0.00, 5.09,24.60,Present,64,26.71, 3.81,18,0 208,124, 4.00, 6.65,30.84,Present,54,28.40, 33.51,60,0 209,136, 5.80, 5.90,27.55,Absent,65,25.71, 14.40,59,0 210,136, 8.80, 4.26,32.03,Present,52,31.44, 34.35,60,0 211,134, 0.05, 8.03,27.95,Absent,48,26.88, 0.00,60,0 212,122, 1.00, 5.88,34.81,Present,69,31.27, 15.94,40,1 213,116, 3.00, 3.05,30.31,Absent,41,23.63, 0.86,44,0 214,132, 0.00, 0.98,21.39,Absent,62,26.75, 0.00,53,0 215,134, 0.00, 2.40,21.11,Absent,57,22.45, 1.37,18,0 216,160, 7.77, 8.07,34.80,Absent,64,31.15, 0.00,62,1 217,180, 0.52, 4.23,16.38,Absent,55,22.56, 14.77,45,1 218,124, 0.81, 6.16,11.61,Absent,35,21.47, 10.49,26,0 219,114, 0.00, 4.97, 9.69,Absent,26,22.60, 0.00,25,0 220,208, 7.40, 7.41,32.03,Absent,50,27.62, 7.85,57,0 221,138, 0.00, 3.14,12.00,Absent,54,20.28, 0.00,16,0 222,164, 0.50, 6.95,39.64,Present,47,41.76, 3.81,46,1 223,144, 2.40, 8.13,35.61,Absent,46,27.38, 13.37,60,0 224,136, 7.50, 7.39,28.04,Present,50,25.01, 0.00,45,1 225,132, 7.28, 3.52,12.33,Absent,60,19.48, 2.06,56,0 226,143, 5.04, 4.86,23.59,Absent,58,24.69, 18.72,42,0 227,112, 4.46, 7.18,26.25,Present,69,27.29, 0.00,32,1 228,134,10.00, 3.79,34.72,Absent,42,28.33, 28.80,52,1 229,138, 2.00, 5.11,31.40,Present,49,27.25, 2.06,64,1 230,188, 0.00, 5.47,32.44,Present,71,28.99, 7.41,50,1 231,110, 2.35, 3.36,26.72,Present,54,26.08,109.80,58,1 232,136,13.20, 7.18,35.95,Absent,48,29.19, 0.00,62,0 233,130, 1.75, 5.46,34.34,Absent,53,29.42, 0.00,58,1 234,122, 0.00, 3.76,24.59,Absent,56,24.36, 0.00,30,0 235,138, 0.00, 3.24,27.68,Absent,60,25.70, 88.66,29,0 236,130,18.00, 4.13,27.43,Absent,54,27.44, 0.00,51,1 237,126, 5.50, 3.78,34.15,Absent,55,28.85, 3.18,61,0 238,176, 5.76, 4.89,26.10,Present,46,27.30, 19.44,57,0 239,122, 0.00, 5.49,19.56,Absent,57,23.12, 14.02,27,0 240,124, 0.00, 3.23, 9.64,Absent,59,22.70, 0.00,16,0 241,140, 5.20, 3.58,29.26,Absent,70,27.29, 20.17,45,1 242,128, 6.00, 4.37,22.98,Present,50,26.01, 0.00,47,0 243,190, 4.18, 5.05,24.83,Absent,45,26.09, 82.85,41,0 244,144, 0.76,10.53,35.66,Absent,63,34.35, 0.00,55,1 245,126, 4.60, 7.40,31.99,Present,57,28.67, 0.37,60,1 246,128, 0.00, 2.63,23.88,Absent,45,21.59, 6.54,57,0 247,136, 0.40, 3.91,21.10,Present,63,22.30, 0.00,56,1 248,158, 4.00, 4.18,28.61,Present,42,25.11, 0.00,60,0 249,160, 0.60, 6.94,30.53,Absent,36,25.68, 1.42,64,0 250,124, 6.00, 5.21,33.02,Present,64,29.37, 7.61,58,1 251,158, 6.17, 8.12,30.75,Absent,46,27.84, 92.62,48,0 252,128, 0.00, 6.34,11.87,Absent,57,23.14, 0.00,17,0 253,166, 3.00, 3.82,26.75,Absent,45,20.86, 0.00,63,1 254,146, 7.50, 7.21,25.93,Present,55,22.51, 0.51,42,0 255,161, 9.00, 4.65,15.16,Present,58,23.76, 43.20,46,0 256,164,13.02, 6.26,29.38,Present,47,22.75, 37.03,54,1 257,146, 5.08, 7.03,27.41,Present,63,36.46, 24.48,37,1 258,142, 4.48, 3.57,19.75,Present,51,23.54, 3.29,49,0 259,138,12.00, 5.13,28.34,Absent,59,24.49, 32.81,58,1 260,154, 1.80, 7.13,34.04,Present,52,35.51, 39.36,44,0 261,118, 0.00, 2.39,12.13,Absent,49,18.46, 0.26,17,1 263,124, 0.61, 2.69,17.15,Present,61,22.76, 11.55,20,0 264,124, 1.04, 2.84,16.42,Present,46,20.17, 0.00,61,0 265,136, 5.00, 4.19,23.99,Present,68,27.80, 25.86,35,0 266,132, 9.90, 4.63,27.86,Present,46,23.39, 0.51,52,1 267,118, 0.12, 1.96,20.31,Absent,37,20.01, 2.42,18,0 268,118, 0.12, 4.16, 9.37,Absent,57,19.61, 0.00,17,0 269,134,12.00, 4.96,29.79,Absent,53,24.86, 8.23,57,0 270,114, 0.10, 3.95,15.89,Present,57,20.31, 17.14,16,0 271,136, 6.80, 7.84,30.74,Present,58,26.20, 23.66,45,1 272,130, 0.00, 4.16,39.43,Present,46,30.01, 0.00,55,1 273,136, 2.20, 4.16,38.02,Absent,65,37.24, 4.11,41,1 274,136, 1.36, 3.16,14.97,Present,56,24.98, 7.30,24,0 275,154, 4.20, 5.59,25.02,Absent,58,25.02, 1.54,43,0 276,108, 0.80, 2.47,17.53,Absent,47,22.18, 0.00,55,1 277,136, 8.80, 4.69,36.07,Present,38,26.56, 2.78,63,1 278,174, 2.02, 6.57,31.90,Present,50,28.75, 11.83,64,1 279,124, 4.25, 8.22,30.77,Absent,56,25.80, 0.00,43,0 280,114, 0.00, 2.63, 9.69,Absent,45,17.89, 0.00,16,0 281,118, 0.12, 3.26,12.26,Absent,55,22.65, 0.00,16,0 282,106, 1.08, 4.37,26.08,Absent,67,24.07, 17.74,28,1 283,146, 3.60, 3.51,22.67,Absent,51,22.29, 43.71,42,0 284,206, 0.00, 4.17,33.23,Absent,69,27.36, 6.17,50,1 285,134, 3.00, 3.17,17.91,Absent,35,26.37, 15.12,27,0 286,148,15.00, 4.98,36.94,Present,72,31.83, 66.27,41,1 287,126, 0.21, 3.95,15.11,Absent,61,22.17, 2.42,17,0 288,134, 0.00, 3.69,13.92,Absent,43,27.66, 0.00,19,0 289,134, 0.02, 2.80,18.84,Absent,45,24.82, 0.00,17,0 290,123, 0.05, 4.61,13.69,Absent,51,23.23, 2.78,16,0 291,112, 0.60, 5.28,25.71,Absent,55,27.02, 27.77,38,1 292,112, 0.00, 1.71,15.96,Absent,42,22.03, 3.50,16,0 293,101, 0.48, 7.26,13.00,Absent,50,19.82, 5.19,16,0 294,150, 0.18, 4.14,14.40,Absent,53,23.43, 7.71,44,0 295,170, 2.60, 7.22,28.69,Present,71,27.87, 37.65,56,1 296,134, 0.00, 5.63,29.12,Absent,68,32.33, 2.02,34,0 297,142, 0.00, 4.19,18.04,Absent,56,23.65, 20.78,42,1 298,132, 0.10, 3.28,10.73,Absent,73,20.42, 0.00,17,0 299,136, 0.00, 2.28,18.14,Absent,55,22.59, 0.00,17,0 300,132,12.00, 4.51,21.93,Absent,61,26.07, 64.80,46,1 301,166, 4.10, 4.00,34.30,Present,32,29.51, 8.23,53,0 302,138, 0.00, 3.96,24.70,Present,53,23.80, 0.00,45,0 303,138, 2.27, 6.41,29.07,Absent,58,30.22, 2.93,32,1 304,170, 0.00, 3.12,37.15,Absent,47,35.42, 0.00,53,0 305,128, 0.00, 8.41,28.82,Present,60,26.86, 0.00,59,1 306,136, 1.20, 2.78, 7.12,Absent,52,22.51, 3.41,27,0 307,128, 0.00, 3.22,26.55,Present,39,26.59, 16.71,49,0 308,150,14.40, 5.04,26.52,Present,60,28.84, 0.00,45,0 309,132, 8.40, 3.57,13.68,Absent,42,18.75, 15.43,59,1 310,142, 2.40, 2.55,23.89,Absent,54,26.09, 59.14,37,0 311,130, 0.05, 2.44,28.25,Present,67,30.86, 40.32,34,0 312,174, 3.50, 5.26,21.97,Present,36,22.04, 8.33,59,1 313,114, 9.60, 2.51,29.18,Absent,49,25.67, 40.63,46,0 314,162, 1.50, 2.46,19.39,Present,49,24.32, 0.00,59,1 315,174, 0.00, 3.27,35.40,Absent,58,37.71, 24.95,44,0 316,190, 5.15, 6.03,36.59,Absent,42,30.31, 72.00,50,0 317,154, 1.40, 1.72,18.86,Absent,58,22.67, 43.20,59,0 318,124, 0.00, 2.28,24.86,Present,50,22.24, 8.26,38,0 319,114, 1.20, 3.98,14.90,Absent,49,23.79, 25.82,26,0 320,168,11.40, 5.08,26.66,Present,56,27.04, 2.61,59,1 321,142, 3.72, 4.24,32.57,Absent,52,24.98, 7.61,51,0 322,154, 0.00, 4.81,28.11,Present,56,25.67, 75.77,59,0 323,146, 4.36, 4.31,18.44,Present,47,24.72, 10.80,38,0 324,166, 6.00, 3.02,29.30,Absent,35,24.38, 38.06,61,0 325,140, 8.60, 3.90,32.16,Present,52,28.51, 11.11,64,1 326,136, 1.70, 3.53,20.13,Absent,56,19.44, 14.40,55,0 327,156, 0.00, 3.47,21.10,Absent,73,28.40, 0.00,36,1 328,132, 0.00, 6.63,29.58,Present,37,29.41, 2.57,62,0 329,128, 0.00, 2.98,12.59,Absent,65,20.74, 2.06,19,0 330,106, 5.60, 3.20,12.30,Absent,49,20.29, 0.00,39,0 331,144, 0.40, 4.64,30.09,Absent,30,27.39, 0.74,55,0 332,154, 0.31, 2.33,16.48,Absent,33,24.00, 11.83,17,0 333,126, 3.10, 2.01,32.97,Present,56,28.63, 26.74,45,0 334,134, 6.40, 8.49,37.25,Present,56,28.94, 10.49,51,1 335,152,19.45, 4.22,29.81,Absent,28,23.95, 0.00,59,1 336,146, 1.35, 6.39,34.21,Absent,51,26.43, 0.00,59,1 337,162, 6.94, 4.55,33.36,Present,52,27.09, 32.06,43,0 338,130, 7.28, 3.56,23.29,Present,20,26.80, 51.87,58,1 339,138, 6.00, 7.24,37.05,Absent,38,28.69, 0.00,59,0 340,148, 0.00, 5.32,26.71,Present,52,32.21, 32.78,27,0 341,124, 4.20, 2.94,27.59,Absent,50,30.31, 85.06,30,0 342,118, 1.62, 9.01,21.70,Absent,59,25.89, 21.19,40,0 343,116, 4.28, 7.02,19.99,Present,68,23.31, 0.00,52,1 344,162, 6.30, 5.73,22.61,Present,46,20.43, 62.54,53,1 345,138, 0.87, 1.87,15.89,Absent,44,26.76, 42.99,31,0 346,137, 1.20, 3.14,23.87,Absent,66,24.13, 45.00,37,0 347,198, 0.52,11.89,27.68,Present,48,28.40, 78.99,26,1 348,154, 4.50, 4.75,23.52,Present,43,25.76, 0.00,53,1 349,128, 5.40, 2.36,12.98,Absent,51,18.36, 6.69,61,0 350,130, 0.08, 5.59,25.42,Present,50,24.98, 6.27,43,1 351,162, 5.60, 4.24,22.53,Absent,29,22.91, 5.66,60,0 352,120,10.50, 2.70,29.87,Present,54,24.50, 16.46,49,0 353,136, 3.99, 2.58,16.38,Present,53,22.41, 27.67,36,0 354,176, 1.20, 8.28,36.16,Present,42,27.81, 11.60,58,1 355,134,11.79, 4.01,26.57,Present,38,21.79, 38.88,61,1 356,122, 1.70, 5.28,32.23,Present,51,24.08, 0.00,54,0 357,134, 0.90, 3.18,23.66,Present,52,23.26, 27.36,58,1 358,134, 0.00, 2.43,22.24,Absent,52,26.49, 41.66,24,0 359,136, 6.60, 6.08,32.74,Absent,64,33.28, 2.72,49,0 360,132, 4.05, 5.15,26.51,Present,31,26.67, 16.30,50,0 361,152, 1.68, 3.58,25.43,Absent,50,27.03, 0.00,32,0 362,132,12.30, 5.96,32.79,Present,57,30.12, 21.50,62,1 363,124, 0.40, 3.67,25.76,Absent,43,28.08, 20.57,34,0 364,140, 4.20, 2.91,28.83,Present,43,24.70, 47.52,48,0 365,166, 0.60, 2.42,34.03,Present,53,26.96, 54.00,60,0 366,156, 3.02, 5.35,25.72,Present,53,25.22, 28.11,52,1 367,132, 0.72, 4.37,19.54,Absent,48,26.11, 49.37,28,0 368,150, 0.00, 4.99,27.73,Absent,57,30.92, 8.33,24,0 369,134, 0.12, 3.40,21.18,Present,33,26.27, 14.21,30,0 370,126, 3.40, 4.87,15.16,Present,65,22.01, 11.11,38,0 371,148, 0.50, 5.97,32.88,Absent,54,29.27, 6.43,42,0 372,148, 8.20, 7.75,34.46,Present,46,26.53, 6.04,64,1 373,132, 6.00, 5.97,25.73,Present,66,24.18,145.29,41,0 374,128, 1.60, 5.41,29.30,Absent,68,29.38, 23.97,32,0 375,128, 5.16, 4.90,31.35,Present,57,26.42, 0.00,64,0 376,140, 0.00, 2.40,27.89,Present,70,30.74,144.00,29,0 377,126, 0.00, 5.29,27.64,Absent,25,27.62, 2.06,45,0 378,114, 3.60, 4.16,22.58,Absent,60,24.49, 65.31,31,0 379,118, 1.25, 4.69,31.58,Present,52,27.16, 4.11,53,0 380,126, 0.96, 4.99,29.74,Absent,66,33.35, 58.32,38,0 381,154, 4.50, 4.68,39.97,Absent,61,33.17, 1.54,64,1 382,112, 1.44, 2.71,22.92,Absent,59,24.81, 0.00,52,0 383,140, 8.00, 4.42,33.15,Present,47,32.77, 66.86,44,0 384,140, 1.68,11.41,29.54,Present,74,30.75, 2.06,38,1 385,128, 2.60, 4.94,21.36,Absent,61,21.30, 0.00,31,0 386,126,19.60, 6.03,34.99,Absent,49,26.99, 55.89,44,0 387,160, 4.20, 6.76,37.99,Present,61,32.91, 3.09,54,1 388,144, 0.00, 4.17,29.63,Present,52,21.83, 0.00,59,0 389,148, 4.50,10.49,33.27,Absent,50,25.92, 2.06,53,1 390,146, 0.00, 4.92,18.53,Absent,57,24.20, 34.97,26,0 391,164, 5.60, 3.17,30.98,Present,44,25.99, 43.20,53,1 392,130, 0.54, 3.63,22.03,Present,69,24.34, 12.86,39,1 393,154, 2.40, 5.63,42.17,Present,59,35.07, 12.86,50,1 394,178, 0.95, 4.75,21.06,Absent,49,23.74, 24.69,61,0 395,180, 3.57, 3.57,36.10,Absent,36,26.70, 19.95,64,0 396,134,12.50, 2.73,39.35,Absent,48,35.58, 0.00,48,0 397,142, 0.00, 3.54,16.64,Absent,58,25.97, 8.36,27,0 398,162, 7.00, 7.67,34.34,Present,33,30.77, 0.00,62,0 399,218,11.20, 2.77,30.79,Absent,38,24.86, 90.93,48,1 400,126, 8.75, 6.06,32.72,Present,33,27.00, 62.43,55,1 401,126, 0.00, 3.57,26.01,Absent,61,26.30, 7.97,47,0 402,134, 6.10, 4.77,26.08,Absent,47,23.82, 1.03,49,0 403,132, 0.00, 4.17,36.57,Absent,57,30.61, 18.00,49,0 404,178, 5.50, 3.79,23.92,Present,45,21.26, 6.17,62,1 405,208, 5.04, 5.19,20.71,Present,52,25.12, 24.27,58,1 406,160, 1.15,10.19,39.71,Absent,31,31.65, 20.52,57,0 407,116, 2.38, 5.67,29.01,Present,54,27.26, 15.77,51,0 408,180,25.01, 3.70,38.11,Present,57,30.54, 0.00,61,1 409,200,19.20, 4.43,40.60,Present,55,32.04, 36.00,60,1 410,112, 4.20, 3.58,27.14,Absent,52,26.83, 2.06,40,0 411,120, 0.00, 3.10,26.97,Absent,41,24.80, 0.00,16,0 412,178,20.00, 9.78,33.55,Absent,37,27.29, 2.88,62,1 413,166, 0.80, 5.63,36.21,Absent,50,34.72, 28.80,60,0 414,164, 8.20,14.16,36.85,Absent,52,28.50, 17.02,55,1 415,216, 0.92, 2.66,19.85,Present,49,20.58, 0.51,63,1 416,146, 6.40, 5.62,33.05,Present,57,31.03, 0.74,46,0 417,134, 1.10, 3.54,20.41,Present,58,24.54, 39.91,39,1 418,158,16.00, 5.56,29.35,Absent,36,25.92, 58.32,60,0 419,176, 0.00, 3.14,31.04,Present,45,30.18, 4.63,45,0 420,132, 2.80, 4.79,20.47,Present,50,22.15, 11.73,48,0 421,126, 0.00, 4.55,29.18,Absent,48,24.94, 36.00,41,0 422,120, 5.50, 3.51,23.23,Absent,46,22.40, 90.31,43,0 423,174, 0.00, 3.86,21.73,Absent,42,23.37, 0.00,63,0 424,150,13.80, 5.10,29.45,Present,52,27.92, 77.76,55,1 425,176, 6.00, 3.98,17.20,Present,52,21.07, 4.11,61,1 426,142, 2.20, 3.29,22.70,Absent,44,23.66, 5.66,42,1 427,132, 0.00, 3.30,21.61,Absent,42,24.92, 32.61,33,0 428,142, 1.32, 7.63,29.98,Present,57,31.16, 72.93,33,0 429,146, 1.16, 2.28,34.53,Absent,50,28.71, 45.00,49,0 430,132, 7.20, 3.65,17.16,Present,56,23.25, 0.00,34,0 431,120, 0.00, 3.57,23.22,Absent,58,27.20, 0.00,32,0 432,118, 0.00, 3.89,15.96,Absent,65,20.18, 0.00,16,0 433,108, 0.00, 1.43,26.26,Absent,42,19.38, 0.00,16,0 434,136, 0.00, 4.00,19.06,Absent,40,21.94, 2.06,16,0 435,120, 0.00, 2.46,13.39,Absent,47,22.01, 0.51,18,0 436,132, 0.00, 3.55, 8.66,Present,61,18.50, 3.87,16,0 437,136, 0.00, 1.77,20.37,Absent,45,21.51, 2.06,16,0 438,138, 0.00, 1.86,18.35,Present,59,25.38, 6.51,17,0 439,138, 0.06, 4.15,20.66,Absent,49,22.59, 2.49,16,0 440,130, 1.22, 3.30,13.65,Absent,50,21.40, 3.81,31,0 441,130, 4.00, 2.40,17.42,Absent,60,22.05, 0.00,40,0 442,110, 0.00, 7.14,28.28,Absent,57,29.00, 0.00,32,0 443,120, 0.00, 3.98,13.19,Present,47,21.89, 0.00,16,0 444,166, 6.00, 8.80,37.89,Absent,39,28.70, 43.20,52,0 445,134, 0.57, 4.75,23.07,Absent,67,26.33, 0.00,37,0 446,142, 3.00, 3.69,25.10,Absent,60,30.08, 38.88,27,0 447,136, 2.80, 2.53, 9.28,Present,61,20.70, 4.55,25,0 448,142, 0.00, 4.32,25.22,Absent,47,28.92, 6.53,34,1 449,130, 0.00, 1.88,12.51,Present,52,20.28, 0.00,17,0 450,124, 1.80, 3.74,16.64,Present,42,22.26, 10.49,20,0 451,144, 4.00, 5.03,25.78,Present,57,27.55, 90.00,48,1 452,136, 1.81, 3.31, 6.74,Absent,63,19.57, 24.94,24,0 453,120, 0.00, 2.77,13.35,Absent,67,23.37, 1.03,18,0 454,154, 5.53, 3.20,28.81,Present,61,26.15, 42.79,42,0 455,124, 1.60, 7.22,39.68,Present,36,31.50, 0.00,51,1 456,146, 0.64, 4.82,28.02,Absent,60,28.11, 8.23,39,1 457,128, 2.24, 2.83,26.48,Absent,48,23.96, 47.42,27,1 458,170, 0.40, 4.11,42.06,Present,56,33.10, 2.06,57,0 459,214, 0.40, 5.98,31.72,Absent,64,28.45, 0.00,58,0 460,182, 4.20, 4.41,32.10,Absent,52,28.61, 18.72,52,1 461,108, 3.00, 1.59,15.23,Absent,40,20.09, 26.64,55,0 462,118, 5.40,11.61,30.79,Absent,64,27.35, 23.97,40,0 463,132, 0.00, 4.82,33.41,Present,62,14.70, 0.00,46,1
{ "pile_set_name": "Github" }
2 2 1 6 6 1 10 10 1 13 13 1 14 14 1 15 15 1 16 16 1 17 17 1 18 18 1 19 19 1 22 2 2 26 6 2 30 10 2 33 13 2 34 14 2 35 15 2 36 16 2 37 17 2 39 19 2 42 2 3 45 5 3 48 8 3 49 9 3 50 10 3 54 14 3 55 15 3 58 18 3 59 19 3 62 2 4 65 5 4 68 8 4 69 9 4 70 10 4 73 13 4 74 14 4 75 15 4 78 18 4 79 19 4 82 2 5 86 6 5 90 10 5 93 13 5 94 14 5 95 15 5 96 16 5 97 17 5 98 18 5 99 19 5 102 2 6 105 5 6 108 8 6 109 9 6 110 10 6 113 13 6 114 14 6 115 15 6 118 18 6 119 19 6
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // This source file is part of the Soto for AWS open source project // // Copyright (c) 2017-2020 the Soto project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of Soto project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// // THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/swift-aws/soto/blob/main/CodeGenerator/Sources/CodeGenerator/main.swift. DO NOT EDIT. import SotoCore /// Error enum for IoT1ClickProjects public enum IoT1ClickProjectsErrorType: AWSErrorType { case internalFailureException(message: String?) case invalidRequestException(message: String?) case resourceConflictException(message: String?) case resourceNotFoundException(message: String?) case tooManyRequestsException(message: String?) } extension IoT1ClickProjectsErrorType { public init?(errorCode: String, message: String?) { var errorCode = errorCode if let index = errorCode.firstIndex(of: "#") { errorCode = String(errorCode[errorCode.index(index, offsetBy: 1)...]) } switch errorCode { case "InternalFailureException": self = .internalFailureException(message: message) case "InvalidRequestException": self = .invalidRequestException(message: message) case "ResourceConflictException": self = .resourceConflictException(message: message) case "ResourceNotFoundException": self = .resourceNotFoundException(message: message) case "TooManyRequestsException": self = .tooManyRequestsException(message: message) default: return nil } } } extension IoT1ClickProjectsErrorType: CustomStringConvertible { public var description: String { switch self { case .internalFailureException(let message): return "InternalFailureException: \(message ?? "")" case .invalidRequestException(let message): return "InvalidRequestException: \(message ?? "")" case .resourceConflictException(let message): return "ResourceConflictException: \(message ?? "")" case .resourceNotFoundException(let message): return "ResourceNotFoundException: \(message ?? "")" case .tooManyRequestsException(let message): return "TooManyRequestsException: \(message ?? "")" } } }
{ "pile_set_name": "Github" }
.popup-card { @include horizontalAbsoluteCenter; position: absolute; border: none; top: 100%; filter: drop-shadow(0px 0px 3px $color-grey-2); background-color: $color-white; min-width: 25rem; cursor: initial; border-radius: 50rem; &__empty { display: flex; flex-direction: column; align-items: center; padding: 2rem; line-height: 4rem; text-align: center; @include respond(phone) { line-height: 3rem; padding: 2rem 5rem; } } &:before { content: ''; @include horizontalAbsoluteCenter; width: 2.5rem; height: 1rem; bottom: 100%; background-color: $color-white; clip-path: polygon(50% 0, 100% 100%, 0 100%); box-shadow: 0 0 30px 0px $color-grey-1; } &--left-align { transform: translateX(-80%); left: 80%; width: 50rem; &:before { transform: translateX(-80%); left: 80%; } } }
{ "pile_set_name": "Github" }
# lru cache A cache object that deletes the least-recently-used items. ## Usage: ```javascript var LRU = require("lru-cache") , options = { max: 500 , length: function (n) { return n * 2 } , dispose: function (key, n) { n.close() } , maxAge: 1000 * 60 * 60 } , cache = LRU(options) , otherCache = LRU(50) // sets just the max size cache.set("key", "value") cache.get("key") // "value" cache.reset() // empty the cache ``` If you put more stuff in it, then items will fall out. If you try to put an oversized thing in it, then it'll fall out right away. ## Options * `max` The maximum size of the cache, checked by applying the length function to all values in the cache. Not setting this is kind of silly, since that's the whole purpose of this lib, but it defaults to `Infinity`. * `maxAge` Maximum age in ms. Items are not pro-actively pruned out as they age, but if you try to get an item that is too old, it'll drop it and return undefined instead of giving it to you. * `length` Function that is used to calculate the length of stored items. If you're storing strings or buffers, then you probably want to do something like `function(n){return n.length}`. The default is `function(n){return 1}`, which is fine if you want to store `n` like-sized things. * `dispose` Function that is called on items when they are dropped from the cache. This can be handy if you want to close file descriptors or do other cleanup tasks when items are no longer accessible. Called with `key, value`. It's called *before* actually removing the item from the internal cache, so if you want to immediately put it back in, you'll have to do that in a `nextTick` or `setTimeout` callback or it won't do anything. * `stale` By default, if you set a `maxAge`, it'll only actually pull stale items out of the cache when you `get(key)`. (That is, it's not pre-emptively doing a `setTimeout` or anything.) If you set `stale:true`, it'll return the stale value before deleting it. If you don't set this, then it'll return `undefined` when you try to get a stale entry, as if it had already been deleted. ## API * `set(key, value)` * `get(key) => value` Both of these will update the "recently used"-ness of the key. They do what you think. * `peek(key)` Returns the key value (or `undefined` if not found) without updating the "recently used"-ness of the key. (If you find yourself using this a lot, you *might* be using the wrong sort of data structure, but there are some use cases where it's handy.) * `del(key)` Deletes a key out of the cache. * `reset()` Clear the cache entirely, throwing away all values. * `has(key)` Check if a key is in the cache, without updating the recent-ness or deleting it for being stale. * `forEach(function(value,key,cache), [thisp])` Just like `Array.prototype.forEach`. Iterates over all the keys in the cache, in order of recent-ness. (Ie, more recently used items are iterated over first.) * `keys()` Return an array of the keys in the cache. * `values()` Return an array of the values in the cache.
{ "pile_set_name": "Github" }
#include "CppUTest/TestHarness.h" #include "CppUTest/CommandLineTestRunner.h" #include "yxml.h" #include "map.h" #include "btstack_defines.h" #include "btstack_util.h" #include "btstack_debug.h" #include "btstack_event.h" #include "map_util.h" const static char * folders = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>" "<folder-listing version=\"1.0\">" " <folder name=\"deleted\" />" " <folder name=\"draft\" />" " <folder name=\"inbox\" />" " <folder name=\"outbox\" />" " <folder name=\"sent\" />" "</folder-listing>"; const char * expected_folders[] = { "deleted", "draft", "inbox", "outbox", "sent" }; const int num_expected_folders = 5; const static char * messages = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>" "<MAP-msg-listing version=\"1.0\">" " <msg handle=\"0400000000000002\" subject=\"Ping\" datetime=\"20190319T223947\" sender_name=\"John Doe\" sender_addressing=\"+41786786211\" recipient_name=\"@@@@@@@@@@@@@@@@\" recipient_addressing=\"+41798155782\" type=\"SMS_GSM\" size=\"4\" text=\"yes\" reception_status=\"complete\" attachment_size=\"0\" priority=\"no\" read=\"no\" sent=\"no\" protected=\"no\" />" " <msg handle=\"0400000000000001\" subject=\"Lieber Kunde. Information und Hilfe zur Inbetriebnahme Ihres Mobiltelefons haben wir unter www.swisscom.ch/handy-einrichten für Sie zusammengestellt.\" datetime=\"20190308T224830\" sender_name=\"\" sender_addressing=\"Swisscom\" recipient_name=\"@@@@@@@@@@@@@@@@\" recipient_addressing=\"+41798155782\" type=\"SMS_GSM\" size=\"149\" text=\"yes\" reception_status=\"complete\" attachment_size=\"0\" priority=\"no\" read=\"no\" sent=\"no\" protected=\"no\" />" "</MAP-msg-listing>"; const map_message_handle_t expected_message_handles[] = { {4,0,0,0,0,0,0,2}, {4,0,0,0,0,0,0,1} }; const int num_expected_message_handles = 2; #if 0 const static char * message = "BEGIN:BMSG\n" "VERSION:1.0\n" "STATUS:UNREAD\n" "TYPE:SMS_GSM\n" "FOLDER:telecom/msg/INBOX\n" "BEGIN:VCARD\n" "VERSION:3.0\n" "FN:\n" "N:\n" "TEL:Swisscom\n" "END:VCARD\n" "BEGIN:BENV\n" "BEGIN:BBODY\n" "CHARSET:UTF-8\n" "LENGTH:172\n" "BEGIN:MSG\n" "Lieber Kunde. Information und Hilfe zur Inbetriebnahme Ihres Mobiltelefons haben wir unter www.swisscom.ch/handy-einrichten für Sie zusammengestellt.\n" "END:MSG\n" "END:BBODY\n" "END:BENV\n" "END:BMSG\n"; #endif /* xml parser */ static int num_found_items; static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static void CHECK_EQUAL_ARRAY(const uint8_t * expected, uint8_t * actual, int size){ for (int i=0; i<size; i++){ // printf("%03u: %02x - %02x\n", i, expected[i], actual[i]); BYTES_EQUAL(expected[i], actual[i]); } } static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ if (packet_type != HCI_EVENT_PACKET) return; if (hci_event_packet_get_type(packet) != HCI_EVENT_MAP_META) return; int value_len; char value[MAP_MAX_VALUE_LEN]; memset(value, 0, MAP_MAX_VALUE_LEN); switch (hci_event_goep_meta_get_subevent_code(packet)){ case MAP_SUBEVENT_FOLDER_LISTING_ITEM: value_len = btstack_min(map_subevent_folder_listing_item_get_name_len(packet), MAP_MAX_VALUE_LEN); memcpy(value, map_subevent_folder_listing_item_get_name(packet), value_len); STRCMP_EQUAL(value, expected_folders[num_found_items]); num_found_items++; break; case MAP_SUBEVENT_MESSAGE_LISTING_ITEM: memcpy(value, map_subevent_message_listing_item_get_handle(packet), MAP_MESSAGE_HANDLE_SIZE); CHECK_EQUAL_ARRAY((uint8_t *) value, (uint8_t *) expected_message_handles[num_found_items], MAP_MESSAGE_HANDLE_SIZE); num_found_items++; break; default: break; } } TEST_GROUP(MAP_XML){ btstack_packet_handler_t map_callback; uint16_t map_cid; void setup(void){ map_callback = &packet_handler; num_found_items = 0; map_cid = 1; } }; TEST(MAP_XML, Folders){ map_client_parse_folder_listing(map_callback, map_cid, (const uint8_t *) folders, strlen(folders)); CHECK_EQUAL(num_found_items, num_expected_folders); } TEST(MAP_XML, Messages){ map_client_parse_message_listing(map_callback, map_cid, (const uint8_t *) messages, strlen(messages)); CHECK_EQUAL(num_found_items, num_expected_message_handles); } TEST(MAP_XML, Msg2Handle){ uint8_t expected_handle[] = {4,0,0,0,0,0,0,2}; map_message_handle_t msg_handle; char handle[] = "0400000000000002"; map_message_str_to_handle(handle, msg_handle); CHECK_EQUAL_ARRAY((uint8_t *) msg_handle, (uint8_t *) expected_handle, MAP_MESSAGE_HANDLE_SIZE); } int main (int argc, const char * argv[]){ return CommandLineTestRunner::RunAllTests(argc, argv); }
{ "pile_set_name": "Github" }
<script> /* eslint-disable vue/no-v-html */ import { mapState, mapActions } from 'vuex'; import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui'; import DiffFileHeader from '~/diffs/components/diff_file_header.vue'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; import ImageDiffOverlay from '~/diffs/components/image_diff_overlay.vue'; import { getDiffMode } from '~/diffs/store/utils'; import { diffViewerModes } from '~/ide/constants'; const FIRST_CHAR_REGEX = /^(\+|-| )/; export default { components: { DiffFileHeader, GlSkeletonLoading, DiffViewer, ImageDiffOverlay, }, props: { discussion: { type: Object, required: true, }, }, data() { return { error: false, }; }, computed: { ...mapState({ projectPath: state => state.diffs.projectPath, }), diffMode() { return getDiffMode(this.discussion.diff_file); }, diffViewerMode() { return this.discussion.diff_file.viewer.name; }, isTextFile() { return this.diffViewerMode === diffViewerModes.text; }, hasTruncatedDiffLines() { return ( this.discussion.truncated_diff_lines && this.discussion.truncated_diff_lines.length !== 0 ); }, }, mounted() { if (this.isTextFile && !this.hasTruncatedDiffLines) { this.fetchDiff(); } }, methods: { ...mapActions(['fetchDiscussionDiffLines']), fetchDiff() { this.error = false; this.fetchDiscussionDiffLines(this.discussion) .then(this.highlight) .catch(() => { this.error = true; }); }, trimChar(line) { return line.replace(FIRST_CHAR_REGEX, ''); }, }, userColorSchemeClass: window.gon.user_color_scheme, }; </script> <template> <div :class="{ 'text-file': isTextFile }" class="diff-file file-holder"> <diff-file-header :discussion-path="discussion.discussion_path" :diff-file="discussion.diff_file" :can-current-user-fork="false" :expanded="!discussion.diff_file.viewer.collapsed" /> <div v-if="isTextFile" class="diff-content"> <table class="code js-syntax-highlight" :class="$options.userColorSchemeClass"> <template v-if="hasTruncatedDiffLines"> <tr v-for="line in discussion.truncated_diff_lines" v-once :key="line.line_code" class="line_holder" > <td :class="line.type" class="diff-line-num old_line">{{ line.old_line }}</td> <td :class="line.type" class="diff-line-num new_line">{{ line.new_line }}</td> <td :class="line.type" class="line_content" v-html="trimChar(line.rich_text)"></td> </tr> </template> <tr v-if="!hasTruncatedDiffLines" class="line_holder line-holder-placeholder"> <td class="old_line diff-line-num"></td> <td class="new_line diff-line-num"></td> <td v-if="error" class="js-error-lazy-load-diff diff-loading-error-block"> {{ __('Unable to load the diff') }} <button class="btn-link btn-link-retry btn-no-padding js-toggle-lazy-diff-retry-button" @click="fetchDiff" > {{ __('Try again') }} </button> </td> <td v-else class="line_content js-success-lazy-load"> <span></span> <gl-skeleton-loading /> <span></span> </td> </tr> <tr class="notes_holder"> <td class="notes-content" colspan="3"><slot></slot></td> </tr> </table> </div> <div v-else> <diff-viewer :diff-file="discussion.diff_file" :diff-mode="diffMode" :diff-viewer-mode="diffViewerMode" :new-path="discussion.diff_file.new_path" :new-sha="discussion.diff_file.diff_refs.head_sha" :old-path="discussion.diff_file.old_path" :old-sha="discussion.diff_file.diff_refs.base_sha" :file-hash="discussion.diff_file.file_hash" :project-path="projectPath" > <image-diff-overlay slot="image-overlay" :discussions="discussion" :file-hash="discussion.diff_file.file_hash" :show-comment-icon="true" :should-toggle-discussion="false" badge-class="image-comment-badge" /> </diff-viewer> <slot></slot> </div> </div> </template>
{ "pile_set_name": "Github" }
// mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // +build 386,netbsd // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_ARP = 0x1c AF_BLUETOOTH = 0x1f AF_CCITT = 0xa AF_CHAOS = 0x5 AF_CNT = 0x15 AF_COIP = 0x14 AF_DATAKIT = 0x9 AF_DECnet = 0xc AF_DLI = 0xd AF_E164 = 0x1a AF_ECMA = 0x8 AF_HYLINK = 0xf AF_IEEE80211 = 0x20 AF_IMPLINK = 0x3 AF_INET = 0x2 AF_INET6 = 0x18 AF_IPX = 0x17 AF_ISDN = 0x1a AF_ISO = 0x7 AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 AF_MAX = 0x23 AF_MPLS = 0x21 AF_NATM = 0x1b AF_NS = 0x6 AF_OROUTE = 0x11 AF_OSI = 0x7 AF_PUP = 0x4 AF_ROUTE = 0x22 AF_SNA = 0xb AF_UNIX = 0x1 AF_UNSPEC = 0x0 ARPHRD_ARCNET = 0x7 ARPHRD_ETHER = 0x1 ARPHRD_FRELAY = 0xf ARPHRD_IEEE1394 = 0x18 ARPHRD_IEEE802 = 0x6 ARPHRD_STRIP = 0x17 B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 B1200 = 0x4b0 B134 = 0x86 B14400 = 0x3840 B150 = 0x96 B1800 = 0x708 B19200 = 0x4b00 B200 = 0xc8 B230400 = 0x38400 B2400 = 0x960 B28800 = 0x7080 B300 = 0x12c B38400 = 0x9600 B460800 = 0x70800 B4800 = 0x12c0 B50 = 0x32 B57600 = 0xe100 B600 = 0x258 B7200 = 0x1c20 B75 = 0x4b B76800 = 0x12c00 B921600 = 0xe1000 B9600 = 0x2580 BIOCFEEDBACK = 0x8004427d BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 BIOCGDLT = 0x4004426a BIOCGDLTLIST = 0xc0084277 BIOCGETIF = 0x4090426b BIOCGFEEDBACK = 0x4004427c BIOCGHDRCMPLT = 0x40044274 BIOCGRTIMEOUT = 0x400c427b BIOCGSEESENT = 0x40044278 BIOCGSTATS = 0x4080426f BIOCGSTATSOLD = 0x4008426f BIOCIMMEDIATE = 0x80044270 BIOCPROMISC = 0x20004269 BIOCSBLEN = 0xc0044266 BIOCSDLT = 0x80044276 BIOCSETF = 0x80084267 BIOCSETIF = 0x8090426c BIOCSFEEDBACK = 0x8004427d BIOCSHDRCMPLT = 0x80044275 BIOCSRTIMEOUT = 0x800c427a BIOCSSEESENT = 0x80044279 BIOCSTCPF = 0x80084272 BIOCSUDPF = 0x80084273 BIOCVERSION = 0x40044271 BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALIGNMENT = 0x4 BPF_ALIGNMENT32 = 0x4 BPF_ALU = 0x4 BPF_AND = 0x50 BPF_B = 0x10 BPF_DFLTBUFSIZE = 0x100000 BPF_DIV = 0x30 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 BPF_JA = 0x0 BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 BPF_JMP = 0x5 BPF_JSET = 0x40 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 BPF_LEN = 0x80 BPF_LSH = 0x60 BPF_MAJOR_VERSION = 0x1 BPF_MAXBUFSIZE = 0x1000000 BPF_MAXINSNS = 0x200 BPF_MEM = 0x60 BPF_MEMWORDS = 0x10 BPF_MINBUFSIZE = 0x20 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 BPF_TAX = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 CLONE_CSIGNAL = 0xff CLONE_FILES = 0x400 CLONE_FS = 0x200 CLONE_PID = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SIGHAND = 0x800 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 CREAD = 0x800 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 CS8 = 0x300 CSIZE = 0x300 CSTART = 0x11 CSTATUS = 0x14 CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a CTL_MAXNAME = 0xc CTL_NET = 0x4 CTL_QUERY = -0x2 DIOCBSFLUSH = 0x20006478 DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 DLT_ARCNET_LINUX = 0x81 DLT_ATM_CLIP = 0x13 DLT_ATM_RFC1483 = 0xb DLT_AURORA = 0x7e DLT_AX25 = 0x3 DLT_AX25_KISS = 0xca DLT_BACNET_MS_TP = 0xa5 DLT_BLUETOOTH_HCI_H4 = 0xbb DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 DLT_CAN20B = 0xbe DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 DLT_C_HDLC_WITH_DIR = 0xcd DLT_DECT = 0xdd DLT_DOCSIS = 0x8f DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 DLT_ENC = 0x6d DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 DLT_FC_2 = 0xe0 DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa DLT_FLEXRAY = 0xd2 DLT_FRELAY = 0x6b DLT_FRELAY_WITH_DIR = 0xce DLT_GCOM_SERIAL = 0xad DLT_GCOM_T1E1 = 0xac DLT_GPF_F = 0xab DLT_GPF_T = 0xaa DLT_GPRS_LLC = 0xa9 DLT_GSMTAP_ABIS = 0xda DLT_GSMTAP_UM = 0xd9 DLT_HDLC = 0x10 DLT_HHDLC = 0x79 DLT_HIPPI = 0xf DLT_IBM_SN = 0x92 DLT_IBM_SP = 0x91 DLT_IEEE802 = 0x6 DLT_IEEE802_11 = 0x69 DLT_IEEE802_11_RADIO = 0x7f DLT_IEEE802_11_RADIO_AVS = 0xa3 DLT_IEEE802_15_4 = 0xc3 DLT_IEEE802_15_4_LINUX = 0xbf DLT_IEEE802_15_4_NONASK_PHY = 0xd7 DLT_IEEE802_16_MAC_CPS = 0xbc DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_IPMB = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPNET = 0xe2 DLT_IPV4 = 0xe4 DLT_IPV6 = 0xe5 DLT_IP_OVER_FC = 0x7a DLT_JUNIPER_ATM1 = 0x89 DLT_JUNIPER_ATM2 = 0x87 DLT_JUNIPER_CHDLC = 0xb5 DLT_JUNIPER_ES = 0x84 DLT_JUNIPER_ETHER = 0xb2 DLT_JUNIPER_FRELAY = 0xb4 DLT_JUNIPER_GGSN = 0x85 DLT_JUNIPER_ISM = 0xc2 DLT_JUNIPER_MFR = 0x86 DLT_JUNIPER_MLFR = 0x83 DLT_JUNIPER_MLPPP = 0x82 DLT_JUNIPER_MONITOR = 0xa4 DLT_JUNIPER_PIC_PEER = 0xae DLT_JUNIPER_PPP = 0xb3 DLT_JUNIPER_PPPOE = 0xa7 DLT_JUNIPER_PPPOE_ATM = 0xa8 DLT_JUNIPER_SERVICES = 0x88 DLT_JUNIPER_ST = 0xc8 DLT_JUNIPER_VP = 0xb7 DLT_LAPB_WITH_DIR = 0xcf DLT_LAPD = 0xcb DLT_LIN = 0xd4 DLT_LINUX_EVDEV = 0xd8 DLT_LINUX_IRDA = 0x90 DLT_LINUX_LAPD = 0xb1 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 DLT_MFR = 0xb6 DLT_MOST = 0xd3 DLT_MPLS = 0xdb DLT_MTP2 = 0x8c DLT_MTP2_WITH_PHDR = 0x8b DLT_MTP3 = 0x8d DLT_NULL = 0x0 DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0xe DLT_PPP_ETHER = 0x33 DLT_PPP_PPPD = 0xa6 DLT_PPP_SERIAL = 0x32 DLT_PPP_WITH_DIR = 0xcc DLT_PRISM_HEADER = 0x77 DLT_PRONET = 0x4 DLT_RAIF1 = 0xc6 DLT_RAW = 0xc DLT_RAWAF_MASK = 0x2240000 DLT_RIO = 0x7c DLT_SCCP = 0x8e DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xd DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba DLT_USB_LINUX = 0xbd DLT_USB_LINUX_MMAPPED = 0xdc DLT_WIHART = 0xdf DLT_X2E_SERIAL = 0xd5 DLT_X2E_XORAYA = 0xd6 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 DT_FIFO = 0x1 DT_LNK = 0xa DT_REG = 0x8 DT_SOCK = 0xc DT_UNKNOWN = 0x0 DT_WHT = 0xe ECHO = 0x8 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 ECHOKE = 0x1 ECHONL = 0x10 ECHOPRT = 0x20 EMUL_LINUX = 0x1 EMUL_LINUX32 = 0x5 EMUL_MAXID = 0x6 EN_SW_CTL_INF = 0x1000 EN_SW_CTL_PREC = 0x300 EN_SW_CTL_ROUND = 0xc00 EN_SW_DATACHAIN = 0x80 EN_SW_DENORM = 0x2 EN_SW_INVOP = 0x1 EN_SW_OVERFLOW = 0x8 EN_SW_PRECLOSS = 0x20 EN_SW_UNDERFLOW = 0x10 EN_SW_ZERODIV = 0x4 ETHERCAP_JUMBO_MTU = 0x4 ETHERCAP_VLAN_HWTAGGING = 0x2 ETHERCAP_VLAN_MTU = 0x1 ETHERMIN = 0x2e ETHERMTU = 0x5dc ETHERMTU_JUMBO = 0x2328 ETHERTYPE_8023 = 0x4 ETHERTYPE_AARP = 0x80f3 ETHERTYPE_ACCTON = 0x8390 ETHERTYPE_AEONIC = 0x8036 ETHERTYPE_ALPHA = 0x814a ETHERTYPE_AMBER = 0x6008 ETHERTYPE_AMOEBA = 0x8145 ETHERTYPE_APOLLO = 0x80f7 ETHERTYPE_APOLLODOMAIN = 0x8019 ETHERTYPE_APPLETALK = 0x809b ETHERTYPE_APPLITEK = 0x80c7 ETHERTYPE_ARGONAUT = 0x803a ETHERTYPE_ARP = 0x806 ETHERTYPE_AT = 0x809b ETHERTYPE_ATALK = 0x809b ETHERTYPE_ATOMIC = 0x86df ETHERTYPE_ATT = 0x8069 ETHERTYPE_ATTSTANFORD = 0x8008 ETHERTYPE_AUTOPHON = 0x806a ETHERTYPE_AXIS = 0x8856 ETHERTYPE_BCLOOP = 0x9003 ETHERTYPE_BOFL = 0x8102 ETHERTYPE_CABLETRON = 0x7034 ETHERTYPE_CHAOS = 0x804 ETHERTYPE_COMDESIGN = 0x806c ETHERTYPE_COMPUGRAPHIC = 0x806d ETHERTYPE_COUNTERPOINT = 0x8062 ETHERTYPE_CRONUS = 0x8004 ETHERTYPE_CRONUSVLN = 0x8003 ETHERTYPE_DCA = 0x1234 ETHERTYPE_DDE = 0x807b ETHERTYPE_DEBNI = 0xaaaa ETHERTYPE_DECAM = 0x8048 ETHERTYPE_DECCUST = 0x6006 ETHERTYPE_DECDIAG = 0x6005 ETHERTYPE_DECDNS = 0x803c ETHERTYPE_DECDTS = 0x803e ETHERTYPE_DECEXPER = 0x6000 ETHERTYPE_DECLAST = 0x8041 ETHERTYPE_DECLTM = 0x803f ETHERTYPE_DECMUMPS = 0x6009 ETHERTYPE_DECNETBIOS = 0x8040 ETHERTYPE_DELTACON = 0x86de ETHERTYPE_DIDDLE = 0x4321 ETHERTYPE_DLOG1 = 0x660 ETHERTYPE_DLOG2 = 0x661 ETHERTYPE_DN = 0x6003 ETHERTYPE_DOGFIGHT = 0x1989 ETHERTYPE_DSMD = 0x8039 ETHERTYPE_ECMA = 0x803 ETHERTYPE_ENCRYPT = 0x803d ETHERTYPE_ES = 0x805d ETHERTYPE_EXCELAN = 0x8010 ETHERTYPE_EXPERDATA = 0x8049 ETHERTYPE_FLIP = 0x8146 ETHERTYPE_FLOWCONTROL = 0x8808 ETHERTYPE_FRARP = 0x808 ETHERTYPE_GENDYN = 0x8068 ETHERTYPE_HAYES = 0x8130 ETHERTYPE_HIPPI_FP = 0x8180 ETHERTYPE_HITACHI = 0x8820 ETHERTYPE_HP = 0x8005 ETHERTYPE_IEEEPUP = 0xa00 ETHERTYPE_IEEEPUPAT = 0xa01 ETHERTYPE_IMLBL = 0x4c42 ETHERTYPE_IMLBLDIAG = 0x424c ETHERTYPE_IP = 0x800 ETHERTYPE_IPAS = 0x876c ETHERTYPE_IPV6 = 0x86dd ETHERTYPE_IPX = 0x8137 ETHERTYPE_IPXNEW = 0x8037 ETHERTYPE_KALPANA = 0x8582 ETHERTYPE_LANBRIDGE = 0x8038 ETHERTYPE_LANPROBE = 0x8888 ETHERTYPE_LAT = 0x6004 ETHERTYPE_LBACK = 0x9000 ETHERTYPE_LITTLE = 0x8060 ETHERTYPE_LOGICRAFT = 0x8148 ETHERTYPE_LOOPBACK = 0x9000 ETHERTYPE_MATRA = 0x807a ETHERTYPE_MAX = 0xffff ETHERTYPE_MERIT = 0x807c ETHERTYPE_MICP = 0x873a ETHERTYPE_MOPDL = 0x6001 ETHERTYPE_MOPRC = 0x6002 ETHERTYPE_MOTOROLA = 0x818d ETHERTYPE_MPLS = 0x8847 ETHERTYPE_MPLS_MCAST = 0x8848 ETHERTYPE_MUMPS = 0x813f ETHERTYPE_NBPCC = 0x3c04 ETHERTYPE_NBPCLAIM = 0x3c09 ETHERTYPE_NBPCLREQ = 0x3c05 ETHERTYPE_NBPCLRSP = 0x3c06 ETHERTYPE_NBPCREQ = 0x3c02 ETHERTYPE_NBPCRSP = 0x3c03 ETHERTYPE_NBPDG = 0x3c07 ETHERTYPE_NBPDGB = 0x3c08 ETHERTYPE_NBPDLTE = 0x3c0a ETHERTYPE_NBPRAR = 0x3c0c ETHERTYPE_NBPRAS = 0x3c0b ETHERTYPE_NBPRST = 0x3c0d ETHERTYPE_NBPSCD = 0x3c01 ETHERTYPE_NBPVCD = 0x3c00 ETHERTYPE_NBS = 0x802 ETHERTYPE_NCD = 0x8149 ETHERTYPE_NESTAR = 0x8006 ETHERTYPE_NETBEUI = 0x8191 ETHERTYPE_NOVELL = 0x8138 ETHERTYPE_NS = 0x600 ETHERTYPE_NSAT = 0x601 ETHERTYPE_NSCOMPAT = 0x807 ETHERTYPE_NTRAILER = 0x10 ETHERTYPE_OS9 = 0x7007 ETHERTYPE_OS9NET = 0x7009 ETHERTYPE_PACER = 0x80c6 ETHERTYPE_PAE = 0x888e ETHERTYPE_PCS = 0x4242 ETHERTYPE_PLANNING = 0x8044 ETHERTYPE_PPP = 0x880b ETHERTYPE_PPPOE = 0x8864 ETHERTYPE_PPPOEDISC = 0x8863 ETHERTYPE_PRIMENTS = 0x7031 ETHERTYPE_PUP = 0x200 ETHERTYPE_PUPAT = 0x200 ETHERTYPE_RACAL = 0x7030 ETHERTYPE_RATIONAL = 0x8150 ETHERTYPE_RAWFR = 0x6559 ETHERTYPE_RCL = 0x1995 ETHERTYPE_RDP = 0x8739 ETHERTYPE_RETIX = 0x80f2 ETHERTYPE_REVARP = 0x8035 ETHERTYPE_SCA = 0x6007 ETHERTYPE_SECTRA = 0x86db ETHERTYPE_SECUREDATA = 0x876d ETHERTYPE_SGITW = 0x817e ETHERTYPE_SG_BOUNCE = 0x8016 ETHERTYPE_SG_DIAG = 0x8013 ETHERTYPE_SG_NETGAMES = 0x8014 ETHERTYPE_SG_RESV = 0x8015 ETHERTYPE_SIMNET = 0x5208 ETHERTYPE_SLOWPROTOCOLS = 0x8809 ETHERTYPE_SNA = 0x80d5 ETHERTYPE_SNMP = 0x814c ETHERTYPE_SONIX = 0xfaf5 ETHERTYPE_SPIDER = 0x809f ETHERTYPE_SPRITE = 0x500 ETHERTYPE_STP = 0x8181 ETHERTYPE_TALARIS = 0x812b ETHERTYPE_TALARISMC = 0x852b ETHERTYPE_TCPCOMP = 0x876b ETHERTYPE_TCPSM = 0x9002 ETHERTYPE_TEC = 0x814f ETHERTYPE_TIGAN = 0x802f ETHERTYPE_TRAIL = 0x1000 ETHERTYPE_TRANSETHER = 0x6558 ETHERTYPE_TYMSHARE = 0x802e ETHERTYPE_UBBST = 0x7005 ETHERTYPE_UBDEBUG = 0x900 ETHERTYPE_UBDIAGLOOP = 0x7002 ETHERTYPE_UBDL = 0x7000 ETHERTYPE_UBNIU = 0x7001 ETHERTYPE_UBNMC = 0x7003 ETHERTYPE_VALID = 0x1600 ETHERTYPE_VARIAN = 0x80dd ETHERTYPE_VAXELN = 0x803b ETHERTYPE_VEECO = 0x8067 ETHERTYPE_VEXP = 0x805b ETHERTYPE_VGLAB = 0x8131 ETHERTYPE_VINES = 0xbad ETHERTYPE_VINESECHO = 0xbaf ETHERTYPE_VINESLOOP = 0xbae ETHERTYPE_VITAL = 0xff00 ETHERTYPE_VLAN = 0x8100 ETHERTYPE_VLTLMAN = 0x8080 ETHERTYPE_VPROD = 0x805c ETHERTYPE_VURESERVED = 0x8147 ETHERTYPE_WATERLOO = 0x8130 ETHERTYPE_WELLFLEET = 0x8103 ETHERTYPE_X25 = 0x805 ETHERTYPE_X75 = 0x801 ETHERTYPE_XNSSM = 0x9001 ETHERTYPE_XTP = 0x817d ETHER_ADDR_LEN = 0x6 ETHER_CRC_LEN = 0x4 ETHER_CRC_POLY_BE = 0x4c11db6 ETHER_CRC_POLY_LE = 0xedb88320 ETHER_HDR_LEN = 0xe ETHER_MAX_LEN = 0x5ee ETHER_MAX_LEN_JUMBO = 0x233a ETHER_MIN_LEN = 0x40 ETHER_PPPOE_ENCAP_LEN = 0x8 ETHER_TYPE_LEN = 0x2 ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = 0x2 EVFILT_PROC = 0x4 EVFILT_READ = 0x0 EVFILT_SIGNAL = 0x5 EVFILT_SYSCOUNT = 0x7 EVFILT_TIMER = 0x6 EVFILT_VNODE = 0x3 EVFILT_WRITE = 0x1 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x100 FLUSHO = 0x800000 F_CLOSEM = 0xa F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0xc F_FSCTL = -0x80000000 F_FSDIRMASK = 0x70000000 F_FSIN = 0x10000000 F_FSINOUT = 0x30000000 F_FSOUT = 0x20000000 F_FSPRIV = 0x8000 F_FSVOID = 0x40000000 F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x7 F_GETNOSIGPIPE = 0xd F_GETOWN = 0x5 F_MAXFD = 0xb F_OK = 0x0 F_PARAM_MASK = 0xfff F_PARAM_MAX = 0xfff F_RDLCK = 0x1 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLK = 0x8 F_SETLKW = 0x9 F_SETNOSIGPIPE = 0xe F_SETOWN = 0x6 F_UNLCK = 0x2 F_WRLCK = 0x3 HUPCL = 0x4000 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 IEXTEN = 0x400 IFAN_ARRIVAL = 0x0 IFAN_DEPARTURE = 0x1 IFA_ROUTE = 0x1 IFF_ALLMULTI = 0x200 IFF_BROADCAST = 0x2 IFF_CANTCHANGE = 0x8f52 IFF_DEBUG = 0x4 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 IFF_LINK2 = 0x4000 IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 IFT_A12MPPSWITCH = 0x82 IFT_AAL2 = 0xbb IFT_AAL5 = 0x31 IFT_ADSL = 0x5e IFT_AFLANE8023 = 0x3b IFT_AFLANE8025 = 0x3c IFT_ARAP = 0x58 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 IFT_ASYNC = 0x54 IFT_ATM = 0x25 IFT_ATMDXI = 0x69 IFT_ATMFUNI = 0x6a IFT_ATMIMA = 0x6b IFT_ATMLOGICAL = 0x50 IFT_ATMRADIO = 0xbd IFT_ATMSUBINTERFACE = 0x86 IFT_ATMVCIENDPT = 0xc2 IFT_ATMVIRTUAL = 0x95 IFT_BGPPOLICYACCOUNTING = 0xa2 IFT_BRIDGE = 0xd1 IFT_BSC = 0x53 IFT_CARP = 0xf8 IFT_CCTEMUL = 0x3d IFT_CEPT = 0x13 IFT_CES = 0x85 IFT_CHANNEL = 0x46 IFT_CNR = 0x55 IFT_COFFEE = 0x84 IFT_COMPOSITELINK = 0x9b IFT_DCN = 0x8d IFT_DIGITALPOWERLINE = 0x8a IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba IFT_DLSW = 0x4a IFT_DOCSCABLEDOWNSTREAM = 0x80 IFT_DOCSCABLEMACLAYER = 0x7f IFT_DOCSCABLEUPSTREAM = 0x81 IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd IFT_DS0 = 0x51 IFT_DS0BUNDLE = 0x52 IFT_DS1FDL = 0xaa IFT_DS3 = 0x1e IFT_DTM = 0x8c IFT_DVBASILN = 0xac IFT_DVBASIOUT = 0xad IFT_DVBRCCDOWNSTREAM = 0x93 IFT_DVBRCCMACLAYER = 0x92 IFT_DVBRCCUPSTREAM = 0x94 IFT_ECONET = 0xce IFT_EON = 0x19 IFT_EPLRS = 0x57 IFT_ESCON = 0x49 IFT_ETHER = 0x6 IFT_FAITH = 0xf2 IFT_FAST = 0x7d IFT_FASTETHER = 0x3e IFT_FASTETHERFX = 0x45 IFT_FDDI = 0xf IFT_FIBRECHANNEL = 0x38 IFT_FRAMERELAYINTERCONNECT = 0x3a IFT_FRAMERELAYMPI = 0x5c IFT_FRDLCIENDPT = 0xc1 IFT_FRELAY = 0x20 IFT_FRELAYDCE = 0x2c IFT_FRF16MFRBUNDLE = 0xa3 IFT_FRFORWARD = 0x9e IFT_G703AT2MB = 0x43 IFT_G703AT64K = 0x42 IFT_GIF = 0xf0 IFT_GIGABITETHERNET = 0x75 IFT_GR303IDT = 0xb2 IFT_GR303RDT = 0xb1 IFT_H323GATEKEEPER = 0xa4 IFT_H323PROXY = 0xa5 IFT_HDH1822 = 0x3 IFT_HDLC = 0x76 IFT_HDSL2 = 0xa8 IFT_HIPERLAN2 = 0xb7 IFT_HIPPI = 0x2f IFT_HIPPIINTERFACE = 0x39 IFT_HOSTPAD = 0x5a IFT_HSSI = 0x2e IFT_HY = 0xe IFT_IBM370PARCHAN = 0x48 IFT_IDSL = 0x9a IFT_IEEE1394 = 0x90 IFT_IEEE80211 = 0x47 IFT_IEEE80212 = 0x37 IFT_IEEE8023ADLAG = 0xa1 IFT_IFGSN = 0x91 IFT_IMT = 0xbe IFT_INFINIBAND = 0xc7 IFT_INTERLEAVE = 0x7c IFT_IP = 0x7e IFT_IPFORWARD = 0x8e IFT_IPOVERATM = 0x72 IFT_IPOVERCDLC = 0x6d IFT_IPOVERCLAW = 0x6e IFT_IPSWITCH = 0x4e IFT_ISDN = 0x3f IFT_ISDNBASIC = 0x14 IFT_ISDNPRIMARY = 0x15 IFT_ISDNS = 0x4b IFT_ISDNU = 0x4c IFT_ISO88022LLC = 0x29 IFT_ISO88023 = 0x7 IFT_ISO88024 = 0x8 IFT_ISO88025 = 0x9 IFT_ISO88025CRFPINT = 0x62 IFT_ISO88025DTR = 0x56 IFT_ISO88025FIBER = 0x73 IFT_ISO88026 = 0xa IFT_ISUP = 0xb3 IFT_L2VLAN = 0x87 IFT_L3IPVLAN = 0x88 IFT_L3IPXVLAN = 0x89 IFT_LAPB = 0x10 IFT_LAPD = 0x4d IFT_LAPF = 0x77 IFT_LINEGROUP = 0xd2 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 IFT_MEDIAMAILOVERIP = 0x8b IFT_MFSIGLINK = 0xa7 IFT_MIOX25 = 0x26 IFT_MODEM = 0x30 IFT_MPC = 0x71 IFT_MPLS = 0xa6 IFT_MPLSTUNNEL = 0x96 IFT_MSDSL = 0x8f IFT_MVL = 0xbf IFT_MYRINET = 0x63 IFT_NFAS = 0xaf IFT_NSIP = 0x1b IFT_OPTICALCHANNEL = 0xc3 IFT_OPTICALTRANSPORT = 0xc4 IFT_OTHER = 0x1 IFT_P10 = 0xc IFT_P80 = 0xd IFT_PARA = 0x22 IFT_PFLOG = 0xf5 IFT_PFSYNC = 0xf6 IFT_PLC = 0xae IFT_PON155 = 0xcf IFT_PON622 = 0xd0 IFT_POS = 0xab IFT_PPP = 0x17 IFT_PPPMULTILINKBUNDLE = 0x6c IFT_PROPATM = 0xc5 IFT_PROPBWAP2MP = 0xb8 IFT_PROPCNLS = 0x59 IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 IFT_PROPMUX = 0x36 IFT_PROPVIRTUAL = 0x35 IFT_PROPWIRELESSP2P = 0x9d IFT_PTPSERIAL = 0x16 IFT_PVC = 0xf1 IFT_Q2931 = 0xc9 IFT_QLLC = 0x44 IFT_RADIOMAC = 0xbc IFT_RADSL = 0x5f IFT_REACHDSL = 0xc0 IFT_RFC1483 = 0x9f IFT_RS232 = 0x21 IFT_RSRB = 0x4f IFT_SDLC = 0x11 IFT_SDSL = 0x60 IFT_SHDSL = 0xa9 IFT_SIP = 0x1f IFT_SIPSIG = 0xcc IFT_SIPTG = 0xcb IFT_SLIP = 0x1c IFT_SMDSDXI = 0x2b IFT_SMDSICIP = 0x34 IFT_SONET = 0x27 IFT_SONETOVERHEADCHANNEL = 0xb9 IFT_SONETPATH = 0x32 IFT_SONETVT = 0x33 IFT_SRP = 0x97 IFT_SS7SIGLINK = 0x9c IFT_STACKTOSTACK = 0x6f IFT_STARLAN = 0xb IFT_STF = 0xd7 IFT_T1 = 0x12 IFT_TDLC = 0x74 IFT_TELINK = 0xc8 IFT_TERMPAD = 0x5b IFT_TR008 = 0xb0 IFT_TRANSPHDLC = 0x7b IFT_TUNNEL = 0x83 IFT_ULTRA = 0x1d IFT_USB = 0xa0 IFT_V11 = 0x40 IFT_V35 = 0x2d IFT_V36 = 0x41 IFT_V37 = 0x78 IFT_VDSL = 0x61 IFT_VIRTUALIPADDRESS = 0x70 IFT_VIRTUALTG = 0xca IFT_VOICEDID = 0xd5 IFT_VOICEEM = 0x64 IFT_VOICEEMFGD = 0xd3 IFT_VOICEENCAP = 0x67 IFT_VOICEFGDEANA = 0xd4 IFT_VOICEFXO = 0x65 IFT_VOICEFXS = 0x66 IFT_VOICEOVERATM = 0x98 IFT_VOICEOVERCABLE = 0xc6 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 IFT_X25HUNTGROUP = 0x7a IFT_X25MLP = 0x79 IFT_X25PLE = 0x28 IFT_XETHER = 0x1a IGNBRK = 0x1 IGNCR = 0x80 IGNPAR = 0x4 IMAXBEL = 0x2000 INLCR = 0x40 INPCK = 0x10 IN_CLASSA_HOST = 0xffffff IN_CLASSA_MAX = 0x80 IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 0x18 IN_CLASSB_HOST = 0xffff IN_CLASSB_MAX = 0x10000 IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 0x10 IN_CLASSC_HOST = 0xff IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 0x8 IN_CLASSD_HOST = 0xfffffff IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LOOPBACKNET = 0x7f IPPROTO_AH = 0x33 IPPROTO_CARP = 0x70 IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 IPPROTO_ENCAP = 0x62 IPPROTO_EON = 0x50 IPPROTO_ESP = 0x32 IPPROTO_ETHERIP = 0x61 IPPROTO_FRAGMENT = 0x2c IPPROTO_GGP = 0x3 IPPROTO_GRE = 0x2f IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 IPPROTO_ICMPV6 = 0x3a IPPROTO_IDP = 0x16 IPPROTO_IGMP = 0x2 IPPROTO_IP = 0x0 IPPROTO_IPCOMP = 0x6c IPPROTO_IPIP = 0x4 IPPROTO_IPV4 = 0x4 IPPROTO_IPV6 = 0x29 IPPROTO_IPV6_ICMP = 0x3a IPPROTO_MAX = 0x100 IPPROTO_MAXID = 0x34 IPPROTO_MOBILE = 0x37 IPPROTO_NONE = 0x3b IPPROTO_PFSYNC = 0xf0 IPPROTO_PIM = 0x67 IPPROTO_PUP = 0xc IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 IPPROTO_VRRP = 0x70 IPV6_CHECKSUM = 0x1a IPV6_DEFAULT_MULTICAST_HOPS = 0x1 IPV6_DEFAULT_MULTICAST_LOOP = 0x1 IPV6_DEFHLIM = 0x40 IPV6_DONTFRAG = 0x3e IPV6_DSTOPTS = 0x32 IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FRAGTTL = 0x78 IPV6_HLIMDEC = 0x1 IPV6_HOPLIMIT = 0x2f IPV6_HOPOPTS = 0x31 IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff IPV6_MAXPACKET = 0xffff IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb IPV6_NEXTHOP = 0x30 IPV6_PATHMTU = 0x2c IPV6_PKTINFO = 0x2e IPV6_PORTRANGE = 0xe IPV6_PORTRANGE_DEFAULT = 0x0 IPV6_PORTRANGE_HIGH = 0x1 IPV6_PORTRANGE_LOW = 0x2 IPV6_RECVDSTOPTS = 0x28 IPV6_RECVHOPLIMIT = 0x25 IPV6_RECVHOPOPTS = 0x27 IPV6_RECVPATHMTU = 0x2b IPV6_RECVPKTINFO = 0x24 IPV6_RECVRTHDR = 0x26 IPV6_RECVTCLASS = 0x39 IPV6_RTHDR = 0x33 IPV6_RTHDRDSTOPTS = 0x23 IPV6_RTHDR_LOOSE = 0x0 IPV6_RTHDR_STRICT = 0x1 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_SOCKOPT_RESERVED1 = 0x3 IPV6_TCLASS = 0x3d IPV6_UNICAST_HOPS = 0x4 IPV6_USE_MIN_MTU = 0x2a IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 IP_ADD_MEMBERSHIP = 0xc IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 IP_DROP_MEMBERSHIP = 0xd IP_EF = 0x8000 IP_ERRORMTU = 0x15 IP_HDRINCL = 0x2 IP_IPSEC_POLICY = 0x16 IP_MAXPACKET = 0xffff IP_MAX_MEMBERSHIPS = 0x14 IP_MF = 0x2000 IP_MINFRAGSIZE = 0x45 IP_MINTTL = 0x18 IP_MSS = 0x240 IP_MULTICAST_IF = 0x9 IP_MULTICAST_LOOP = 0xb IP_MULTICAST_TTL = 0xa IP_OFFMASK = 0x1fff IP_OPTIONS = 0x1 IP_PORTRANGE = 0x13 IP_PORTRANGE_DEFAULT = 0x0 IP_PORTRANGE_HIGH = 0x1 IP_PORTRANGE_LOW = 0x2 IP_RECVDSTADDR = 0x7 IP_RECVIF = 0x14 IP_RECVOPTS = 0x5 IP_RECVRETOPTS = 0x6 IP_RECVTTL = 0x17 IP_RETOPTS = 0x8 IP_RF = 0x8000 IP_TOS = 0x3 IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 MADV_DONTNEED = 0x4 MADV_FREE = 0x6 MADV_NORMAL = 0x0 MADV_RANDOM = 0x1 MADV_SEQUENTIAL = 0x2 MADV_SPACEAVAIL = 0x5 MADV_WILLNEED = 0x3 MAP_ALIGNMENT_16MB = 0x18000000 MAP_ALIGNMENT_1TB = 0x28000000 MAP_ALIGNMENT_256TB = 0x30000000 MAP_ALIGNMENT_4GB = 0x20000000 MAP_ALIGNMENT_64KB = 0x10000000 MAP_ALIGNMENT_64PB = 0x38000000 MAP_ALIGNMENT_MASK = -0x1000000 MAP_ALIGNMENT_SHIFT = 0x18 MAP_ANON = 0x1000 MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_HASSEMAPHORE = 0x200 MAP_INHERIT = 0x80 MAP_INHERIT_COPY = 0x1 MAP_INHERIT_DEFAULT = 0x1 MAP_INHERIT_DONATE_COPY = 0x3 MAP_INHERIT_NONE = 0x2 MAP_INHERIT_SHARE = 0x0 MAP_NORESERVE = 0x40 MAP_PRIVATE = 0x2 MAP_RENAME = 0x20 MAP_SHARED = 0x1 MAP_STACK = 0x2000 MAP_TRYFIXED = 0x400 MAP_WIRED = 0x800 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CONTROLMBUF = 0x2000000 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_DONTWAIT = 0x80 MSG_EOR = 0x8 MSG_IOVUSRSPACE = 0x4000000 MSG_LENUSRSPACE = 0x8000000 MSG_MCAST = 0x200 MSG_NAMEMBUF = 0x1000000 MSG_NBIO = 0x1000 MSG_NOSIGNAL = 0x400 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_USERFLAGS = 0xffffff MSG_WAITALL = 0x40 MS_ASYNC = 0x1 MS_INVALIDATE = 0x2 MS_SYNC = 0x4 NAME_MAX = 0x1ff NET_RT_DUMP = 0x1 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x5 NET_RT_MAXID = 0x6 NET_RT_OIFLIST = 0x4 NET_RT_OOIFLIST = 0x3 NOFLSH = 0x80000000 NOTE_ATTRIB = 0x8 NOTE_CHILD = 0x4 NOTE_DELETE = 0x1 NOTE_EXEC = 0x20000000 NOTE_EXIT = 0x80000000 NOTE_EXTEND = 0x4 NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 NOTE_REVOKE = 0x40 NOTE_TRACK = 0x1 NOTE_TRACKERR = 0x2 NOTE_WRITE = 0x2 OCRNL = 0x10 OFIOGETBMAP = 0xc004667a ONLCR = 0x2 ONLRET = 0x40 ONOCR = 0x20 ONOEOT = 0x8 OPOST = 0x1 O_ACCMODE = 0x3 O_ALT_IO = 0x40000 O_APPEND = 0x8 O_ASYNC = 0x40 O_CLOEXEC = 0x400000 O_CREAT = 0x200 O_DIRECT = 0x80000 O_DIRECTORY = 0x200000 O_DSYNC = 0x10000 O_EXCL = 0x800 O_EXLOCK = 0x20 O_FSYNC = 0x80 O_NDELAY = 0x4 O_NOCTTY = 0x8000 O_NOFOLLOW = 0x100 O_NONBLOCK = 0x4 O_NOSIGPIPE = 0x1000000 O_RDONLY = 0x0 O_RDWR = 0x2 O_RSYNC = 0x20000 O_SHLOCK = 0x10 O_SYNC = 0x80 O_TRUNC = 0x400 O_WRONLY = 0x1 PARENB = 0x1000 PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 PRI_IOFLUSH = 0x7c PROT_EXEC = 0x4 PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 RLIMIT_AS = 0xa RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 RLIMIT_NOFILE = 0x8 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_MAX = 0x9 RTAX_NETMASK = 0x2 RTAX_TAG = 0x8 RTA_AUTHOR = 0x40 RTA_BRD = 0x80 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 RTA_IFA = 0x20 RTA_IFP = 0x10 RTA_NETMASK = 0x4 RTA_TAG = 0x100 RTF_ANNOUNCE = 0x20000 RTF_BLACKHOLE = 0x1000 RTF_CLONED = 0x2000 RTF_CLONING = 0x100 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_LLINFO = 0x400 RTF_MASK = 0x80 RTF_MODIFIED = 0x20 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_REJECT = 0x8 RTF_SRC = 0x10000 RTF_STATIC = 0x800 RTF_UP = 0x1 RTF_XRESOLVE = 0x200 RTM_ADD = 0x1 RTM_CHANGE = 0x3 RTM_CHGADDR = 0x15 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_GET = 0x4 RTM_IEEE80211 = 0x11 RTM_IFANNOUNCE = 0x10 RTM_IFINFO = 0x14 RTM_LLINFO_UPD = 0x13 RTM_LOCK = 0x8 RTM_LOSING = 0x5 RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_OIFINFO = 0xf RTM_OLDADD = 0x9 RTM_OLDDEL = 0xa RTM_OOIFINFO = 0xe RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 RTM_SETGATE = 0x12 RTM_VERSION = 0x4 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_MTU = 0x1 RTV_RPIPE = 0x8 RTV_RTT = 0x40 RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 SCM_CREDS = 0x4 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x8 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80906931 SIOCADDRT = 0x8030720a SIOCAIFADDR = 0x8040691a SIOCALIFADDR = 0x8118691c SIOCATMARK = 0x40047307 SIOCDELMULTI = 0x80906932 SIOCDELRT = 0x8030720b SIOCDIFADDR = 0x80906919 SIOCDIFPHYADDR = 0x80906949 SIOCDLIFADDR = 0x8118691e SIOCGDRVSPEC = 0xc01c697b SIOCGETPFSYNC = 0xc09069f8 SIOCGETSGCNT = 0xc0147534 SIOCGETVIFCNT = 0xc0147533 SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0906921 SIOCGIFADDRPREF = 0xc0946920 SIOCGIFALIAS = 0xc040691b SIOCGIFBRDADDR = 0xc0906923 SIOCGIFCAP = 0xc0206976 SIOCGIFCONF = 0xc0086926 SIOCGIFDATA = 0xc0946985 SIOCGIFDLT = 0xc0906977 SIOCGIFDSTADDR = 0xc0906922 SIOCGIFFLAGS = 0xc0906911 SIOCGIFGENERIC = 0xc090693a SIOCGIFMEDIA = 0xc0286936 SIOCGIFMETRIC = 0xc0906917 SIOCGIFMTU = 0xc090697e SIOCGIFNETMASK = 0xc0906925 SIOCGIFPDSTADDR = 0xc0906948 SIOCGIFPSRCADDR = 0xc0906947 SIOCGLIFADDR = 0xc118691d SIOCGLIFPHYADDR = 0xc118694b SIOCGLINKSTR = 0xc01c6987 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCGVH = 0xc0906983 SIOCIFCREATE = 0x8090697a SIOCIFDESTROY = 0x80906979 SIOCIFGCLONERS = 0xc00c6978 SIOCINITIFADDR = 0xc0446984 SIOCSDRVSPEC = 0x801c697b SIOCSETPFSYNC = 0x809069f7 SIOCSHIWAT = 0x80047300 SIOCSIFADDR = 0x8090690c SIOCSIFADDRPREF = 0x8094691f SIOCSIFBRDADDR = 0x80906913 SIOCSIFCAP = 0x80206975 SIOCSIFDSTADDR = 0x8090690e SIOCSIFFLAGS = 0x80906910 SIOCSIFGENERIC = 0x80906939 SIOCSIFMEDIA = 0xc0906935 SIOCSIFMETRIC = 0x80906918 SIOCSIFMTU = 0x8090697f SIOCSIFNETMASK = 0x80906916 SIOCSIFPHYADDR = 0x80406946 SIOCSLIFPHYADDR = 0x8118694a SIOCSLINKSTR = 0x801c6988 SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SIOCSVH = 0xc0906982 SIOCZIFDATA = 0xc0946986 SOCK_CLOEXEC = 0x10000000 SOCK_DGRAM = 0x2 SOCK_FLAGS_MASK = 0xf0000000 SOCK_NONBLOCK = 0x20000000 SOCK_NOSIGPIPE = 0x40000000 SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 SO_ACCEPTFILTER = 0x1000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 SO_LINGER = 0x80 SO_NOHEADER = 0x100a SO_NOSIGPIPE = 0x800 SO_OOBINLINE = 0x100 SO_OVERFLOWED = 0x1009 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x100c SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_SNDBUF = 0x1001 SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x100b SO_TIMESTAMP = 0x2000 SO_TYPE = 0x1008 SO_USELOOPBACK = 0x40 SYSCTL_VERSION = 0x1000000 SYSCTL_VERS_0 = 0x0 SYSCTL_VERS_1 = 0x1000000 SYSCTL_VERS_MASK = 0xff000000 S_ARCH1 = 0x10000 S_ARCH2 = 0x20000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 S_IFCHR = 0x2000 S_IFDIR = 0x4000 S_IFIFO = 0x1000 S_IFLNK = 0xa000 S_IFMT = 0xf000 S_IFREG = 0x8000 S_IFSOCK = 0xc000 S_IFWHT = 0xe000 S_IREAD = 0x100 S_IRGRP = 0x20 S_IROTH = 0x4 S_IRUSR = 0x100 S_IRWXG = 0x38 S_IRWXO = 0x7 S_IRWXU = 0x1c0 S_ISGID = 0x400 S_ISTXT = 0x200 S_ISUID = 0x800 S_ISVTX = 0x200 S_IWGRP = 0x10 S_IWOTH = 0x2 S_IWRITE = 0x80 S_IWUSR = 0x80 S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 S_LOGIN_SET = 0x1 TCIFLUSH = 0x1 TCIOFLUSH = 0x3 TCOFLUSH = 0x2 TCP_CONGCTL = 0x20 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x3 TCP_KEEPINIT = 0x7 TCP_KEEPINTVL = 0x5 TCP_MAXBURST = 0x4 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0x10 TCP_MINMSS = 0xd8 TCP_MSS = 0x218 TCP_NODELAY = 0x1 TCSAFLUSH = 0x2 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 TIOCDCDTIMESTAMP = 0x400c7458 TIOCDRAIN = 0x2000745e TIOCEXCL = 0x2000740d TIOCEXT = 0x80047460 TIOCFLAG_CDTRCTS = 0x10 TIOCFLAG_CLOCAL = 0x2 TIOCFLAG_CRTSCTS = 0x4 TIOCFLAG_MDMBUF = 0x8 TIOCFLAG_SOFTCAR = 0x1 TIOCFLUSH = 0x80047410 TIOCGETA = 0x402c7413 TIOCGETD = 0x4004741a TIOCGFLAGS = 0x4004745d TIOCGLINED = 0x40207442 TIOCGPGRP = 0x40047477 TIOCGQSIZE = 0x40047481 TIOCGRANTPT = 0x20007447 TIOCGSID = 0x40047463 TIOCGSIZE = 0x40087468 TIOCGWINSZ = 0x40087468 TIOCMBIC = 0x8004746b TIOCMBIS = 0x8004746c TIOCMGET = 0x4004746a TIOCMSET = 0x8004746d TIOCM_CAR = 0x40 TIOCM_CD = 0x40 TIOCM_CTS = 0x20 TIOCM_DSR = 0x100 TIOCM_DTR = 0x2 TIOCM_LE = 0x1 TIOCM_RI = 0x80 TIOCM_RNG = 0x80 TIOCM_RTS = 0x4 TIOCM_SR = 0x10 TIOCM_ST = 0x8 TIOCNOTTY = 0x20007471 TIOCNXCL = 0x2000740e TIOCOUTQ = 0x40047473 TIOCPKT = 0x80047470 TIOCPKT_DATA = 0x0 TIOCPKT_DOSTOP = 0x20 TIOCPKT_FLUSHREAD = 0x1 TIOCPKT_FLUSHWRITE = 0x2 TIOCPKT_IOCTL = 0x40 TIOCPKT_NOSTOP = 0x10 TIOCPKT_START = 0x8 TIOCPKT_STOP = 0x4 TIOCPTMGET = 0x40287446 TIOCPTSNAME = 0x40287448 TIOCRCVFRAME = 0x80047445 TIOCREMOTE = 0x80047469 TIOCSBRK = 0x2000747b TIOCSCTTY = 0x20007461 TIOCSDTR = 0x20007479 TIOCSETA = 0x802c7414 TIOCSETAF = 0x802c7416 TIOCSETAW = 0x802c7415 TIOCSETD = 0x8004741b TIOCSFLAGS = 0x8004745c TIOCSIG = 0x2000745f TIOCSLINED = 0x80207443 TIOCSPGRP = 0x80047476 TIOCSQSIZE = 0x80047480 TIOCSSIZE = 0x80087467 TIOCSTART = 0x2000746e TIOCSTAT = 0x80047465 TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSWINSZ = 0x80087467 TIOCUCNTL = 0x80047466 TIOCXMTFRAME = 0x80047444 TOSTOP = 0x400000 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 VEOL = 0x1 VEOL2 = 0x2 VERASE = 0x3 VINTR = 0x8 VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc VSTATUS = 0x12 VSTOP = 0xd VSUSP = 0xa VTIME = 0x11 VWERASE = 0x4 WALL = 0x8 WALLSIG = 0x8 WALTSIG = 0x4 WCLONE = 0x4 WCOREFLAG = 0x80 WNOHANG = 0x1 WNOWAIT = 0x10000 WNOZOMBIE = 0x20000 WOPTSCHECKED = 0x40000 WSTOPPED = 0x7f WUNTRACED = 0x2 ) // Errors const ( E2BIG = syscall.Errno(0x7) EACCES = syscall.Errno(0xd) EADDRINUSE = syscall.Errno(0x30) EADDRNOTAVAIL = syscall.Errno(0x31) EAFNOSUPPORT = syscall.Errno(0x2f) EAGAIN = syscall.Errno(0x23) EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) EBADF = syscall.Errno(0x9) EBADMSG = syscall.Errno(0x58) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x57) ECHILD = syscall.Errno(0xa) ECONNABORTED = syscall.Errno(0x35) ECONNREFUSED = syscall.Errno(0x3d) ECONNRESET = syscall.Errno(0x36) EDEADLK = syscall.Errno(0xb) EDESTADDRREQ = syscall.Errno(0x27) EDOM = syscall.Errno(0x21) EDQUOT = syscall.Errno(0x45) EEXIST = syscall.Errno(0x11) EFAULT = syscall.Errno(0xe) EFBIG = syscall.Errno(0x1b) EFTYPE = syscall.Errno(0x4f) EHOSTDOWN = syscall.Errno(0x40) EHOSTUNREACH = syscall.Errno(0x41) EIDRM = syscall.Errno(0x52) EILSEQ = syscall.Errno(0x55) EINPROGRESS = syscall.Errno(0x24) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) ELAST = syscall.Errno(0x60) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) EMSGSIZE = syscall.Errno(0x28) EMULTIHOP = syscall.Errno(0x5e) ENAMETOOLONG = syscall.Errno(0x3f) ENEEDAUTH = syscall.Errno(0x51) ENETDOWN = syscall.Errno(0x32) ENETRESET = syscall.Errno(0x34) ENETUNREACH = syscall.Errno(0x33) ENFILE = syscall.Errno(0x17) ENOATTR = syscall.Errno(0x5d) ENOBUFS = syscall.Errno(0x37) ENODATA = syscall.Errno(0x59) ENODEV = syscall.Errno(0x13) ENOENT = syscall.Errno(0x2) ENOEXEC = syscall.Errno(0x8) ENOLCK = syscall.Errno(0x4d) ENOLINK = syscall.Errno(0x5f) ENOMEM = syscall.Errno(0xc) ENOMSG = syscall.Errno(0x53) ENOPROTOOPT = syscall.Errno(0x2a) ENOSPC = syscall.Errno(0x1c) ENOSR = syscall.Errno(0x5a) ENOSTR = syscall.Errno(0x5b) ENOSYS = syscall.Errno(0x4e) ENOTBLK = syscall.Errno(0xf) ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) ENOTSOCK = syscall.Errno(0x26) ENOTSUP = syscall.Errno(0x56) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x2d) EOVERFLOW = syscall.Errno(0x54) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) EPROCLIM = syscall.Errno(0x43) EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) EPROTO = syscall.Errno(0x60) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) ERANGE = syscall.Errno(0x22) EREMOTE = syscall.Errno(0x47) EROFS = syscall.Errno(0x1e) ERPCMISMATCH = syscall.Errno(0x49) ESHUTDOWN = syscall.Errno(0x3a) ESOCKTNOSUPPORT = syscall.Errno(0x2c) ESPIPE = syscall.Errno(0x1d) ESRCH = syscall.Errno(0x3) ESTALE = syscall.Errno(0x46) ETIME = syscall.Errno(0x5c) ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) EUSERS = syscall.Errno(0x44) EWOULDBLOCK = syscall.Errno(0x23) EXDEV = syscall.Errno(0x12) ) // Signals const ( SIGABRT = syscall.Signal(0x6) SIGALRM = syscall.Signal(0xe) SIGBUS = syscall.Signal(0xa) SIGCHLD = syscall.Signal(0x14) SIGCONT = syscall.Signal(0x13) SIGEMT = syscall.Signal(0x7) SIGFPE = syscall.Signal(0x8) SIGHUP = syscall.Signal(0x1) SIGILL = syscall.Signal(0x4) SIGINFO = syscall.Signal(0x1d) SIGINT = syscall.Signal(0x2) SIGIO = syscall.Signal(0x17) SIGIOT = syscall.Signal(0x6) SIGKILL = syscall.Signal(0x9) SIGPIPE = syscall.Signal(0xd) SIGPROF = syscall.Signal(0x1b) SIGPWR = syscall.Signal(0x20) SIGQUIT = syscall.Signal(0x3) SIGSEGV = syscall.Signal(0xb) SIGSTOP = syscall.Signal(0x11) SIGSYS = syscall.Signal(0xc) SIGTERM = syscall.Signal(0xf) SIGTRAP = syscall.Signal(0x5) SIGTSTP = syscall.Signal(0x12) SIGTTIN = syscall.Signal(0x15) SIGTTOU = syscall.Signal(0x16) SIGURG = syscall.Signal(0x10) SIGUSR1 = syscall.Signal(0x1e) SIGUSR2 = syscall.Signal(0x1f) SIGVTALRM = syscall.Signal(0x1a) SIGWINCH = syscall.Signal(0x1c) SIGXCPU = syscall.Signal(0x18) SIGXFSZ = syscall.Signal(0x19) ) // Error table var errors = [...]string{ 1: "operation not permitted", 2: "no such file or directory", 3: "no such process", 4: "interrupted system call", 5: "input/output error", 6: "device not configured", 7: "argument list too long", 8: "exec format error", 9: "bad file descriptor", 10: "no child processes", 11: "resource deadlock avoided", 12: "cannot allocate memory", 13: "permission denied", 14: "bad address", 15: "block device required", 16: "device busy", 17: "file exists", 18: "cross-device link", 19: "operation not supported by device", 20: "not a directory", 21: "is a directory", 22: "invalid argument", 23: "too many open files in system", 24: "too many open files", 25: "inappropriate ioctl for device", 26: "text file busy", 27: "file too large", 28: "no space left on device", 29: "illegal seek", 30: "read-only file system", 31: "too many links", 32: "broken pipe", 33: "numerical argument out of domain", 34: "result too large or too small", 35: "resource temporarily unavailable", 36: "operation now in progress", 37: "operation already in progress", 38: "socket operation on non-socket", 39: "destination address required", 40: "message too long", 41: "protocol wrong type for socket", 42: "protocol option not available", 43: "protocol not supported", 44: "socket type not supported", 45: "operation not supported", 46: "protocol family not supported", 47: "address family not supported by protocol family", 48: "address already in use", 49: "can't assign requested address", 50: "network is down", 51: "network is unreachable", 52: "network dropped connection on reset", 53: "software caused connection abort", 54: "connection reset by peer", 55: "no buffer space available", 56: "socket is already connected", 57: "socket is not connected", 58: "can't send after socket shutdown", 59: "too many references: can't splice", 60: "connection timed out", 61: "connection refused", 62: "too many levels of symbolic links", 63: "file name too long", 64: "host is down", 65: "no route to host", 66: "directory not empty", 67: "too many processes", 68: "too many users", 69: "disc quota exceeded", 70: "stale NFS file handle", 71: "too many levels of remote in path", 72: "RPC struct is bad", 73: "RPC version wrong", 74: "RPC prog. not avail", 75: "program version wrong", 76: "bad procedure for program", 77: "no locks available", 78: "function not implemented", 79: "inappropriate file type or format", 80: "authentication error", 81: "need authenticator", 82: "identifier removed", 83: "no message of desired type", 84: "value too large to be stored in data type", 85: "illegal byte sequence", 86: "not supported", 87: "operation Canceled", 88: "bad or Corrupt message", 89: "no message available", 90: "no STREAM resources", 91: "not a STREAM", 92: "STREAM ioctl timeout", 93: "attribute not found", 94: "multihop attempted", 95: "link has been severed", 96: "protocol error", } // Signal table var signals = [...]string{ 1: "hangup", 2: "interrupt", 3: "quit", 4: "illegal instruction", 5: "trace/BPT trap", 6: "abort trap", 7: "EMT trap", 8: "floating point exception", 9: "killed", 10: "bus error", 11: "segmentation fault", 12: "bad system call", 13: "broken pipe", 14: "alarm clock", 15: "terminated", 16: "urgent I/O condition", 17: "stopped (signal)", 18: "stopped", 19: "continued", 20: "child exited", 21: "stopped (tty input)", 22: "stopped (tty output)", 23: "I/O possible", 24: "cputime limit exceeded", 25: "filesize limit exceeded", 26: "virtual timer expired", 27: "profiling timer expired", 28: "window size changes", 29: "information request", 30: "user defined signal 1", 31: "user defined signal 2", 32: "power fail/restart", }
{ "pile_set_name": "Github" }
/*************************************************************************/ /* Copyright (C) 2018 matias <[email protected]> */ /* */ /* This program is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation, either version 3 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /*************************************************************************/ #if defined(GETTEXT_PACKAGE) #include <glib/gi18n-lib.h> #else #include <glib/gi18n.h> #endif #include "pragha-favorites.h" #include <glib/gstdio.h> #include "pragha-database.h" #include "pragha-musicobject.h" struct _PraghaFavorites { GObject _parent; PraghaDatabase *cdbase; }; enum { SIGNAL_SONG_ADDED, SIGNAL_SONG_REMOVED, LAST_SIGNAL }; static int signals[LAST_SIGNAL] = { 0 }; G_DEFINE_TYPE(PraghaFavorites, pragha_favorites, G_TYPE_OBJECT) static void pragha_favorites_dispose (GObject *object) { PraghaFavorites *favorites = PRAGHA_FAVORITES(object); if (favorites->cdbase) { g_object_unref (favorites->cdbase); favorites->cdbase = NULL; } G_OBJECT_CLASS(pragha_favorites_parent_class)->dispose(object); } static void pragha_favorites_class_init (PraghaFavoritesClass *klass) { GObjectClass *object_class; object_class = G_OBJECT_CLASS(klass); object_class->dispose = pragha_favorites_dispose; signals[SIGNAL_SONG_ADDED] = g_signal_new ("song-added", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PraghaFavoritesClass, song_added), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[SIGNAL_SONG_REMOVED] = g_signal_new ("song-removed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PraghaFavoritesClass, song_removed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); } static void pragha_favorites_init (PraghaFavorites *favorites) { favorites->cdbase = pragha_database_get(); } PraghaFavorites * pragha_favorites_get (void) { static PraghaFavorites *favorites = NULL; if (G_UNLIKELY (favorites == NULL)) { favorites = g_object_new (PRAGHA_TYPE_FAVORITES, NULL); g_object_add_weak_pointer (G_OBJECT (favorites), (gpointer) &favorites); } else { g_object_ref (G_OBJECT(favorites)); } return favorites; } void pragha_favorites_put_song (PraghaFavorites *favorites, PraghaMusicobject *mobj) { gint playlist_id = 0; playlist_id = pragha_database_find_playlist (favorites->cdbase, _("Favorites")); pragha_database_add_playlist_track (favorites->cdbase, playlist_id, pragha_musicobject_get_file(mobj)); g_signal_emit (favorites, signals[SIGNAL_SONG_ADDED], 0, mobj); return; } void pragha_favorites_remove_song (PraghaFavorites *favorites, PraghaMusicobject *mobj) { gint playlist_id = 0; playlist_id = pragha_database_find_playlist (favorites->cdbase, _("Favorites")); pragha_database_delete_playlist_track (favorites->cdbase, playlist_id, pragha_musicobject_get_file(mobj)); g_signal_emit (favorites, signals[SIGNAL_SONG_REMOVED], 0, mobj); return; } gboolean pragha_favorites_contains_song (PraghaFavorites *favorites, PraghaMusicobject *mobj) { gint playlist_id = 0; playlist_id = pragha_database_find_playlist (favorites->cdbase, _("Favorites")); if (!playlist_id) { pragha_database_add_new_playlist (favorites->cdbase, _("Favorites")); return FALSE; } return pragha_database_playlist_has_track (favorites->cdbase, playlist_id, pragha_musicobject_get_file(mobj)); }
{ "pile_set_name": "Github" }
// Copyright 2014 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --allow-natives-syntax // Try to get a GC because of a heap number allocation while we // have live values (o) in a register. function f(o) { var x = 1.5; var y = 2.5; for (var i = 1; i < 3; i += 1) { %SetAllocationTimeout(1, 0, false); o.val = x + y + i; %SetAllocationTimeout(-1, -1, true); } return o; } var o = { val: 0 }; f(o);
{ "pile_set_name": "Github" }
/* * Copyright (c) 2014. Real Time Genomics Limited. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.rtg.util.array.objectindex; import com.rtg.util.test.RandomByteGenerator; import com.rtg.util.diagnostic.Diagnostic; import junit.framework.TestCase; /** * Class for testing the Object Chunks implementation that is capable of * holding more than the maximum integer worth of data. */ public class ObjectChunksRegression extends TestCase { private static final long NUM_ELEMENTS = 2L * Integer.MAX_VALUE + 9000L; private static final int RANGE = 128; /** * Test the common index implementation */ public void testIndex() { Diagnostic.setLogStream(); doTest(RANGE, NUM_ELEMENTS); } private void doTest(int range, long elements) { final RandomByteGenerator value = new RandomByteGenerator(range); final ObjectChunks<Byte> index = new ObjectChunks<>(elements); assertEquals(elements, index.length()); for (long l = 0; l < elements; ++l) { index.set(l, value.nextValue()); } value.reset(); for (long l = 0; l < elements; ++l) { assertEquals(Byte.valueOf(value.nextValue()), index.get(l)); } } }
{ "pile_set_name": "Github" }
/* Generated by camel build tools - do NOT edit this file! */ package org.apache.camel.component.hazelcast.replicatedmap; import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.spi.GeneratedPropertyConfigurer; import org.apache.camel.spi.PropertyConfigurerGetter; import org.apache.camel.util.CaseInsensitiveMap; import org.apache.camel.support.component.PropertyConfigurerSupport; /** * Generated by camel build tools - do NOT edit this file! */ @SuppressWarnings("unchecked") public class HazelcastReplicatedmapEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { HazelcastReplicatedmapEndpoint target = (HazelcastReplicatedmapEndpoint) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; case "bridgeerrorhandler": case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true; case "defaultoperation": case "defaultOperation": target.setDefaultOperation(property(camelContext, org.apache.camel.component.hazelcast.HazelcastOperation.class, value)); return true; case "exceptionhandler": case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true; case "exchangepattern": case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true; case "hazelcastinstance": case "hazelcastInstance": target.setHazelcastInstance(property(camelContext, com.hazelcast.core.HazelcastInstance.class, value)); return true; case "hazelcastinstancename": case "hazelcastInstanceName": target.setHazelcastInstanceName(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true; default: return false; } } @Override public Map<String, Object> getAllOptions(Object target) { Map<String, Object> answer = new CaseInsensitiveMap(); answer.put("basicPropertyBinding", boolean.class); answer.put("bridgeErrorHandler", boolean.class); answer.put("defaultOperation", org.apache.camel.component.hazelcast.HazelcastOperation.class); answer.put("exceptionHandler", org.apache.camel.spi.ExceptionHandler.class); answer.put("exchangePattern", org.apache.camel.ExchangePattern.class); answer.put("hazelcastInstance", com.hazelcast.core.HazelcastInstance.class); answer.put("hazelcastInstanceName", java.lang.String.class); answer.put("lazyStartProducer", boolean.class); answer.put("synchronous", boolean.class); return answer; } @Override public Object getOptionValue(Object obj, String name, boolean ignoreCase) { HazelcastReplicatedmapEndpoint target = (HazelcastReplicatedmapEndpoint) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": return target.isBasicPropertyBinding(); case "bridgeerrorhandler": case "bridgeErrorHandler": return target.isBridgeErrorHandler(); case "defaultoperation": case "defaultOperation": return target.getDefaultOperation(); case "exceptionhandler": case "exceptionHandler": return target.getExceptionHandler(); case "exchangepattern": case "exchangePattern": return target.getExchangePattern(); case "hazelcastinstance": case "hazelcastInstance": return target.getHazelcastInstance(); case "hazelcastinstancename": case "hazelcastInstanceName": return target.getHazelcastInstanceName(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); case "synchronous": return target.isSynchronous(); default: return null; } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0"> <Import Project="..\..\build\common.props" /> <PropertyGroup> <TargetFrameworks>net47</TargetFrameworks> <IsPackable>false</IsPackable> </PropertyGroup> <ItemGroup> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.DefineDosDevice_RegularDriveMapping.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS_Device.EnumerateDevices.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_NoRetry_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_RetryFails1Time_ThenSucceeds.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_RetryFails2Times_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.GetSize\AlphaFS_Directory.GetSize_NoStreamsOnRootFolder.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.GetSize\AlphaFS_Directory.GetSize_WithStreamsOnRootFolder.cs" /> <Compile Include="AlphaFS Utils Class\AlphaFS_UtilsTest.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_3ExistingDirectories_FromVolumeShadowCopy.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_EmptyAsPath_ThrowsArgumentException.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_NullAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\AlphaFS_Directory.CreateDirectory_And_Delete_UsingMSDOSReservedNames.cs" /> <Compile Include="Directory Class\Directory.Delete\Directory.Delete_ExistingDirectory.cs" /> <Compile Include="Directory Class\Directory.Delete\Directory.Delete_EmptyAsPath_ThrowsArgumentException.cs" /> <Compile Include="Directory Class\Directory.Delete\Directory.Delete_NullAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="Directory Class\Directory_Timestamps\AlphaFS_Directory.CopyTimestamps.cs" /> <Compile Include="Directory Class\Directory_Timestamps\AlphaFS_Directory.SetTimestamps_SymbolicLink.cs" /> <Compile Include="File Class\AlphaFS_File_GetSize\AlphaFS_File.GetSize_AllStreams.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.InitializeInstance\DirectoryInfo.InitializeInstance_ExistingFileAsDirectoryeName_PropertyExistsShouldbeFalse.cs" /> <Compile Include="File Class\File.Copy\File.Copy_EmptySourceFileNameAsPath_ThrowsArgumentException.cs" /> <Compile Include="File Class\File.Copy\File.Copy_EmptyDestFileNameAsPath_ThrowsArgumentException.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_3ExistingFiles_FromVolumeShadowCopy.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_RetryFails2Times_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="File Class\File.Copy\File.Copy_NullDestFileNameAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="File Class\File.Copy\File.Copy_NullSourceFileNameAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="File Class\File.Delete\File.Delete_EmptyAsPath_ThrowsArgumentException.cs" /> <Compile Include="File Class\File.Delete\File.Delete_NullAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="File Class\File.Delete\File.Delete_NonExistingFile_NoException.cs" /> <Compile Include="File Class\File.Move\File.Move_EmptyDestFileNameAsPath_ThrowsArgumentException.cs" /> <Compile Include="File Class\File.Move\File.Move_EmptySourceFileNameAsPath_ThrowsArgumentException.cs" /> <Compile Include="File Class\File.Move\File.Move_FileOpenedWithFileShareDeleteFlag.cs" /> <Compile Include="File Class\File.Move\File.Move_NullDestFileNameAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="File Class\File.Move\File.Move_NullSourceFileNameAsPath_ThrowsArgumentNullException.cs" /> <Compile Include="File Class\FileTest.cs" /> <Compile Include="FileInfo Class\FileInfo.InitializeInstance\FileInfo.InitializeInstance_ExistingDirectoryAsFileName_PropertyExistsShouldbeFalse.cs" /> <Compile Include="AlphaFS Utils Class\AlphaFS_Utils.ReplaceIgnoreCase.cs" /> <Compile Include="Path Class\PathTest.cs" /> <Compile Include="UnitTest Utility\DirectoryAssert.cs" /> <Compile Include="UnitTest Utility\Dump.cs" /> <Compile Include="UnitTest Utility\FileAssert.cs" /> <Compile Include="UnitTest Utility\PrintUnitTestHeader.cs" /> <Compile Include="UnitTest Utility\StringToByteArray.cs" /> <Compile Include="UnitTest Utility\TemporaryDirectory.cs" /> <Compile Include="UnitTest Utility\TestAccessRules.cs" /> <Compile Include="UnitTest Utility\UnitTestAssert.cs" /> <Compile Include="UnitTest Utility\UnitTestConstants.cs" /> <Compile Include="UnitTests\AccessControlTest.cs" /> <Compile Include="AlphaFS BackupFileStream Class\AlphaFS_BackupFileStream_SegmentAlreadyUnlocked_ThrowsIOException.cs" /> <Compile Include="AlphaFS BackupFileStream Class\AlphaFS_AlphaFS_BackupFileStream_FilePortionIsLocked_ThrowsIOException.cs" /> <Compile Include="AlphaFS Compression\AlphaFS_Directory.Compress_And_Decompress_Recursive.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_Directory.ExportImportEncryptedDirectoryRaw.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_EncryptionTest.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.ConnectTo_Share_And_DisconnectFrom_Share.cs" /> <Compile Include="AlphaFS BackupFileStream Class\AlphaFS_BackupFileStreamTest.cs" /> <Compile Include="AlphaFS ByHandleFileInfo Class\AlphaFS_ByHandleFileInfoTest.cs" /> <Compile Include="AlphaFS Compression\AlphaFS CompressionTest.cs" /> <Compile Include="AlphaFS Crc Class\AlphaFS_CrcTest.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_Directory_Encrypt_And_Decrypt_Recursive.cs" /> <Compile Include="AlphaFS FileIdInfo Class\AlphaFS_Directory.GetFileIdInfo.cs" /> <Compile Include="AlphaFS FileIdInfo Class\AlphaFS_File.GetFileIdInfo.cs" /> <Compile Include="AlphaFS ByHandleFileInfo Class\AlphaFS_Directory.GetFileInfo.cs" /> <Compile Include="AlphaFS Crc Class\AlphaFS_Crc64Iso_StaticDefaultSeedAndPolynomialWithShortAsciiString2.cs" /> <Compile Include="AlphaFS Crc Class\AlphaFS_Crc64Iso_StaticDefaultSeedAndPolynomialWithShortAsciiString.cs" /> <Compile Include="AlphaFS Crc Class\AlphaFS_Crc32_StaticDefaultSeedAndPolynomialWithShortAsciiString2.cs" /> <Compile Include="AlphaFS Crc Class\AlphaFS_Crc32_StaticDefaultSeedAndPolynomialWithShortAsciiString.cs" /> <Compile Include="AlphaFS ByHandleFileInfo Class\AlphaFS_File.GetFileInfoByHandle.cs" /> <Compile Include="AlphaFS FileIdInfo Class\AlphaFS_FileIdInfoTest.cs" /> <Compile Include="UnitTests\SizeTest.cs" /> <Compile Include="UnitTests\DeleteTest.cs" /> <Compile Include="Directory Class\Directory.Delete\AlphaFS_Directory.Delete_NonExistingLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="Directory Class\Directory.Delete\AlphaFS_Directory.Delete_NonEmptyDirectory_ThrowsDirectoryNotEmptyException.cs" /> <Compile Include="Directory Class\Directory.Delete\AlphaFS_Directory.Delete_ThrowDirectoryReadOnlyException_DirectoryIsReadOnly.cs" /> <Compile Include="Directory Class\Directory.Delete\Directory.Directory_Delete_DirectoryHasDenyPermission_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="Directory Class\Directory.Delete\Directory.Delete.DirectoryIsReadOnly_ThrowsDirectoryReadOnlyException.cs" /> <Compile Include="Directory Class\Directory.Delete\Directory.Delete_NonExistingDirectory_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_TypeFileInfo.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_TypeDirectoryInfo.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_TypeFileSystemEntryInfo.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_FolderWithSpaceAsName.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.GetFileSystemEntryInfo_LogicalDrives.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.AlphaFS_Directory_GetFileSystemEntryInfo_FileExistsWithSameNameAsDirectory_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.GetFileSystemEntryInfo.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_File.GetFileSystemEntryInfo_DirectoryExistsWithSameNameAsFile_ThrowsFileNotFoundException.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_FileSystemEntryInfoTest.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_File.GetFileSystemEntryInfo.cs" /> <Compile Include="AlphaFS BackupFileStream Class\AlphaFS_BackupFileStream_InitializeInstance.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateNetworkConnections.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateNetworks.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.GetWorkstationStatistics.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.GetServerStatistics.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_HostTest.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateSessions.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.Copy_SymbolicLink_SourceIsASymbolicLink_TargetMustAlsoBeASymbolicLink.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.CreateJunction_FileExistsWithSameNameAsDirectory_ThrowsIOException.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.CreateJunction_FromMappedDrive_ThrowsArgumentException.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.CreateJunction_FromUncPath_ThrowsArgumentException.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.CreateSymbolicLink_FileExistsWithSameNameAsDirectory_ThrowsIOException.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_File.Copy_SymbolicLink_SourceIsASymbolicLink_TargetMustAlsoBeASymbolicLink.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_File.CreateSymbolicLink_DirectoryExistsWithSameNameAsFile_ThrowsIOException.cs" /> <Compile Include="UnitTests\AlphaFS_ProcessContextTest.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32.GetFileAssociation.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32Test.PathCreateFromUrlAlloc.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32Test.PathCreateFromUrl.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32Test.PathFileExists.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32Test..cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetUniqueVolumeNameForPath.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_VolumeTest.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetDriveType.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetDriveNameForNtDeviceName.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetXxx.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.QueryDosDevice.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.EnumerateVolumeMountPoints.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.SetVolumeLabel.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.IsSameVolume.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetVolumeLabel.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.DefineDosDevice_SymbolicLinkDriveMapping.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetDriveFormat.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.EnumerateVolumes.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_WithProgress.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_DestinationFileAlreadyExists_ThrowsAlreadyExistsException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_NonExistingDestinationLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_UserExplicitDenyOnDestinationFolder_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_Overwrite_DestinationFileAlreadyExists.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_NonExistingSourceDirectory_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.Copy\AlphaFS_Directory.Copy_NonExistingSourceLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.CountFileSystemObjects\AlphaFS_Directory.CountFileSystemObjectsTest.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.CountFileSystemObjects\AlphaFS_Directory.CountFileSystemObjects_FilesOnly_NonRecursive.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.CountFileSystemObjects\AlphaFS_Directory.CountFileSystemObjects_FilesOnly_Recursive.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.CountFileSystemObjects\AlphaFS_Directory.CountFileSystemObjects_FoldersOnly_Recursive.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.CountFileSystemObjects\AlphaFS_Directory.CountFileSystemObjects_FoldersOnly_NonRecursive.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.DeleteEmptySubdirectories\AlphaFS_Directory.DeleteEmptySubdirectories_DirectoryContainsAFolder_DirectoryRemains.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.DeleteEmptySubdirectories\AlphaFS_Directory.DeleteEmptySubdirectories_DirectoryContainsAFile_DirectoryRemains.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.DeleteEmptySubdirectories\AlphaFS_Directory.DeleteEmptySubdirectoriesTest.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.IsEmpty\AlphaFS_Directory.IsEmpty_DirectoryContainsAFolder_IsFalse.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.IsEmpty\AlphaFS_Directory.IsEmpty_DirectoryContainsAFile_IsFalse.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.IsEmpty\AlphaFS_Directory.IsEmptyTest.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectoryTest.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_NonExistingDriveLetter_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\AlphaFS_Directory.CreateDirectory_FileExistsWithSameNameAsDirectory_ThrowsAlreadyExistsException.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_WithDirectorySecurity.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_WithMultipleSpacesAndSlashes.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_FolderWithSpaceAsName.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\AlphaFS_Directory.CreateDirectory_NonExistingDriveLetter_ThrowsIOExceptionOrDeviceNotReadyException.cs" /> <Compile Include="Directory Class\Directory.CurrentDirectory\Directory.SetCurrentDirectory_WithLongPath.cs" /> <Compile Include="Directory Class\Directory.CurrentDirectory\Directory.CurrentDirectoryTest.cs" /> <Compile Include="Directory Class\Directory.CurrentDirectory\Directory.SetCurrentDirectory.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_Directory_EnableEncryption_And_DisableEncryption.cs" /> <Compile Include="Directory Class\Directory_AccessControl\AlphaFS_Directory.HasInheritedPermissions.cs" /> <Compile Include="Directory Class\Directory.GetDirectoryRoot.cs" /> <Compile Include="Directory Class\Directory.GetParent.cs" /> <Compile Include="Directory Class\Directory.GetProperties.cs" /> <Compile Include="Directory Class\DirectoryTest.cs" /> <Compile Include="UnitTests\EnumerationTest.cs" /> <Compile Include="Directory Class\Directory.Exists\Directory.Exists_UseCases.cs" /> <Compile Include="Directory Class\Directory.Exists\Directory.Exists_DriveLetter.cs" /> <Compile Include="Directory Class\Directory.Exists\Directory.Exists_NonExistingDirectory.cs" /> <Compile Include="Directory Class\Directory.Exists\Directory.Exists_ExistingDirectory.cs" /> <Compile Include="UnitTests\ExistsTest.cs" /> <Compile Include="Directory Class\Directory.GetDirectories\Directory.GetDirectories_RelativePath.cs" /> <Compile Include="Directory Class\Directory.GetDirectories\Directory.GetDirectories_AbsolutePath.cs" /> <Compile Include="Directory Class\Directory.GetFiles\Directory.GetFiles_RelativePath.cs" /> <Compile Include="Directory Class\Directory.GetFiles\Directory.GetFiles_AbsolutePath.cs" /> <Compile Include="Directory Class\Directory.GetLogicalDrives.cs" /> <Compile Include="Directory Class\Directory.GetFiles\Directory.GetFiles_WithSearchPattern.cs" /> <Compile Include="Directory Class\Directory.GetFileSystemEntries.cs" /> <Compile Include="Directory Class\Directory.GetDirectories\Directory.GetDirectories_WithSearchPattern.cs" /> <Compile Include="Directory Class\Directory_Enumeration\AlphaFS_Directory.EnumerateFileIdBothDirectoryInfo.cs" /> <Compile Include="Directory Class\Directory_Enumeration\Directory.EnumerateFiles.cs" /> <Compile Include="Directory Class\Directory_Enumeration\Directory.EnumerateFileSystemEntries.cs" /> <Compile Include="Directory Class\Directory_Enumeration\Directory.EnumerateDirectories.cs" /> <Compile Include="File Class\File_Read\File.ReadAllText.cs" /> <Compile Include="File Class\File_Read\File.ReadLines.cs" /> <Compile Include="File Class\File_Read\File.ReadAllLines.cs" /> <Compile Include="File Class\File_Write\File.WriteAllText.cs" /> <Compile Include="File Class\File_Write\File.WriteAllLines.cs" /> <Compile Include="File Class\File_Write\File.WriteAllBytes.cs" /> <Compile Include="File Class\File_Read\File.ReadAllBytes.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_File_EncryptDecrypt_GetEncryptionStatus.cs" /> <Compile Include="File Class\File_Attributes\File.SetAttributes.cs" /> <Compile Include="File Class\File_Attributes\File.GetAttributes.cs" /> <Compile Include="File Class\File.Delete\AlphaFS_File.Delete_FileIsReadOnly_ThrowsFileReadOnlyException.cs" /> <Compile Include="File Class\File.Delete\File.Delete_ExistingFile.cs" /> <Compile Include="File Class\File.Delete\File.Delete_NonExistingDriveLetter_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="File Class\File.Delete\File.Delete_NonExistingDriveLetter_ThrowsIOExceptionOrDeviceNotReadyException.cs" /> <Compile Include="File Class\File.Delete\File.Delete_PathIsADirectoryNotAFile_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="File Class\File_Timestamps\File_Timestamps_CompareTimestamps_NonExistingFile.cs" /> <Compile Include="Directory Class\Directory.Move\AlphaFS_Directory.Move_NonExistingSourceLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="UnitTests\MoveTest.cs" /> <Compile Include="Directory Class\Directory.Move\AlphaFS_Directory.Move_Overwrite_DestinationDirectoryAlreadyExists.cs" /> <Compile Include="Directory Class\Directory.Move\Directory.Move_UserExplicitDenyOnDestinationFolder_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="Directory Class\Directory.Move\AlphaFS_Directory.Move_DestinationDirectoryAlreadyExists_ThrowsAlreadyExistsException.cs" /> <Compile Include="Directory Class\Directory.Move\AlphaFS_Directory.Move_FileToMappedDriveLetter.cs" /> <Compile Include="Directory Class\Directory.Move\Directory.Move_Rename_DifferentCasingDirectory.cs" /> <Compile Include="Directory Class\Directory.Move\Directory.Move_Rename.cs" /> <Compile Include="Directory Class\Directory.Move\Directory.Move_SameVolume.cs" /> <Compile Include="Directory Class\Directory.Move\AlphaFS_Directory.Move_ToDifferentVolume_EmulateMoveUsingCopyDelete.cs" /> <Compile Include="Directory Class\Directory.Move\Directory.Move_NonExistingSourceDirectory_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="Directory Class\Directory.Move\AlphaFS_Directory.Move_NonExistingDestinationLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="AlphaFS Compression\AlphaFS_Directory.Compress_And_Decompress.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_Directory_Encrypt_And_Decrypt.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_EnumerateFiles_UsingDirectoryEnumerationFilters.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.IsEmpty\AlphaFS_Directory.IsEmpty.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_TypeString.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.CreateSymbolicLink_And_GetLinkTargetInfo.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_Directory.CreateJunction_DirectoryContainsFile_ThrowsDirectoryNotEmptyException.cs" /> <Compile Include="Directory Class\Directory.CurrentDirectory\Directory.GetCurrentDirectory.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.DeleteEmptySubdirectories\AlphaFS_Directory.DeleteEmptySubdirectories.cs" /> <Compile Include="AlphaFS FileSystemEntryInfo Class\AlphaFS_Directory.EnumerateFileSystemEntryInfos_ContinueOnAccessDeniedExceptionUsingDirectoryEnumerationErrorFilter.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_DirectoryInfo.CreateJunction_And_ExistsJunction_And_DeleteJunction.cs" /> <Compile Include="Directory Class\Directory.Move\Directory.Move_SameSourceAndDestination_ThrowsIOException.cs" /> <Compile Include="Directory Class\AlphaFS_Directory.CountFileSystemObjects\AlphaFS_Directory.CountFileSystemObjects_FoldersAndFiles_Recursive.cs" /> <Compile Include="Directory Class\Directory_Enumeration\AlphaFS_Directory.EnumerateAlternateDataStreams.cs" /> <Compile Include="Directory Class\Directory.Exists\AlphaFS_Directory.Exists_WithLeadingOrTrailingSpace.cs" /> <Compile Include="Directory Class\Directory_AccessControl\Directory.GetAccessControl.cs" /> <Compile Include="Directory Class\Directory_Timestamps\AlphaFS_Directory.Copy_UsingCopyOptionsCopyTimestampFlag.cs" /> <Compile Include="Directory Class\Directory_Timestamps\AlphaFS_Directory.SetTimestamps.cs" /> <Compile Include="Directory Class\Directory_Timestamps\Directory_Timestamps_CompareTimestamps_NonExistingDirectory.cs" /> <Compile Include="Directory Class\Directory_Timestamps\AlphaFS_Directory.GetChangeTime.cs" /> <Compile Include="Directory Class\Directory_AccessControl\Directory.SetAccessControl.cs" /> <Compile Include="Path Class\AlphaFS_Path.GetFinalPathNameByHandle\AlphaFS_Path.GetFinalPathNameByHandle_ToGetFileStreamName.cs" /> <Compile Include="Path Class\AlphaFS_Path.GetFinalPathNameByHandle\AlphaFS_Path.GetFinalPathNameByHandle.cs" /> <Compile Include="Path Class\AlphaFS_Path.IsLongPath.cs" /> <Compile Include="Path Class\AlphaFS_Path.GetRegularPath.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.GetMappedUncName.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.GetMappedConnectionName.cs" /> <Compile Include="Path Class\AlphaFS_Path.GetShort83PathAndGetLongFrom83ShortPath_FromFile.cs" /> <Compile Include="Path Class\Path.Combine.cs" /> <Compile Include="Path Class\AlphaFS_Path_TrailingDirectorySeparator.cs" /> <Compile Include="Path Class\AlphaFS_Path.GetLongPath.cs" /> <Compile Include="Path Class\Path.GetDirectoryName\AlphaFS_Path.GetDirectoryNameWithoutRoot.cs" /> <Compile Include="Path Class\Path.GetDirectoryName\AlphaFS_Path.GetSuffixedDirectoryNameWithoutRoot.cs" /> <Compile Include="Path Class\Path.GetDirectoryName\AlphaFS_Path.GetSuffixedDirectoryName.cs" /> <Compile Include="Path Class\Path.GetExtension\Path.GetExtension_NullOrEmpty.cs" /> <Compile Include="Path Class\Path.GetFileNameWithoutExtension\Path.GetFileNameWithoutExtension_NullOrEmpty.cs" /> <Compile Include="Path Class\Path.GetFileName\Path.GetFileName_NullOrEmpty.cs" /> <Compile Include="Path Class\Path.GetPathRoot\Path.GetPathRoot_ThrowArgumentExceptionEmptyString.cs" /> <Compile Include="Path Class\Path.GetPathRoot\Path.GetPathRoot.cs" /> <Compile Include="Path Class\Path.GetFileNameWithoutExtension\Path.GetFileNameWithoutExtension.cs" /> <Compile Include="Path Class\Path.GetFileName\Path.GetFileName.cs" /> <Compile Include="Path Class\Path.GetFullPath\AlphaFS_Path.GetFullPath_WithTrailingDotOrSpace.cs" /> <Compile Include="Path Class\Path.GetFullPath\Path.GetFullPath_InvalidPath_ThrowsNotSupportedException.cs" /> <Compile Include="Path Class\Path.GetFullPath\Path.GetFullPath_InvalidLocalPath2_ThrowsArgumentException.cs" /> <Compile Include="Path Class\Path.GetFullPath\Path.GetFullPath_InvalidLocalPath1_ThrowsArgumentException_Success.cs" /> <Compile Include="Path Class\Path.IsPathRooted\Path.IsPathRooted_NullOrEmpty.cs" /> <Compile Include="UnitTests\TimestampsTest.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.InitializeInstance\DirectoryInfo.InitializeInstance_NonExistingDirectory.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.InitializeInstance\DirectoryInfo.InitializeInstance_AnalyzeDirectoryInfoSecurity.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.MoveTo\DirectoryInfo.MoveTo_FolderToEmptyFolder.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.MoveTo\DirectoryInfo.MoveTo_Rename.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.MoveTo\AlphaFS_DirectoryInfo.MoveTo_DelayUntilReboot.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.InitializeInstance\DirectoryInfo.InitializeInstance_FolderNameGreaterThan255Characters_ThrowsPathTooLongException.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.FolderName255Characters.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.MoveTo\AlphaFS_DirectoryInfo.MoveTo_DelayUntilRebootFlagCombinedWithCopyAllowedFlagUsingUncPath_ThrowsArgumentException.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.Attributes.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.Refresh.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfoTest.cs" /> <Compile Include="AlphaFS Device Class\DriveInfo Class\DriveInfo.GetDrives.cs" /> <Compile Include="AlphaFS Device Class\DriveInfo Class\DriveInfo.InitializeInstance.cs" /> <Compile Include="AlphaFS Device Class\DriveInfo Class\DriveInfoTest.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_File.GetHash.cs" /> <Compile Include="File Class\AlphaFS_File_Lock\AlphaFS_File.GetProcessForFileLock_NoLockReturnsNull.cs" /> <Compile Include="File Class\AlphaFS_File_Lock\AlphaFS_File.GetProcessForFileLock.cs" /> <Compile Include="File Class\AlphaFS_File_Lock\AlphaFS_File.LockTest.cs" /> <Compile Include="File Class\File_Create\File.CreateTest.cs" /> <Compile Include="File Class\File_Create\File.CreateText_ThenReadAllLinesShouldReturnSameCollection.cs" /> <Compile Include="File Class\File_Append\File.AppendText_ThenReadAllLinesShouldReturnSameCollection.cs" /> <Compile Include="File Class\File_Append\File.AppendAllText_ThenReadAllLinesShouldReturnSameCollection.cs" /> <Compile Include="File Class\File_Append\File.AppendAllLines_ThenReadAllLinesShouldReturnSameCollection.cs" /> <Compile Include="File Class\File_Append\File.AppendTest.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_WithProgress.cs" /> <Compile Include="File Class\File.Copy\File.Copy.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_NonExistingDestinationLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="File Class\File.Copy\File.Copy_DestinationFileIsReadOnly_ThrowsUnauthorizedAccessException.cs" /> <Compile Include="File Class\File.Copy\File.Copy_NonExistingSourceFile_ThrowsFileNotFoundException.cs" /> <Compile Include="File Class\File.Copy\File.Copy_NonExistingSourceDirectory_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_NonExistingSourceLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_DestinationFileAlreadyExists_ThrowsAlreadyExistsException.cs" /> <Compile Include="File Class\File.Copy\AlphaFS_File.Copy_Overwrite_DestinationFileAlreadyExists.cs" /> <Compile Include="File Class\File_Create\File.Create_WithFileSecurity.cs" /> <Compile Include="File Class\File.Exists\AlphaFS_File.Exists_WithLeadingOrTrailingSpace.cs" /> <Compile Include="File Class\File.Move\File.Move_NonExistingSourceDirectory_ThrowsDirectoryNotFoundException.cs" /> <Compile Include="File Class\File.Move\File.Move_NonExistingSourceFile_ThrowsFileNotFoundException.cs" /> <Compile Include="File Class\File.Move\AlphaFS_File.Move_NonExistingDestinationLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="File Class\File.Move\AlphaFS_File.Move_NonExistingSourceLogicalDrive_ThrowsDeviceNotReadyException.cs" /> <Compile Include="File Class\File.Move\AlphaFS_File.Move_DestinationFileAlreadyExists_ThrowsAlreadyExistsException.cs" /> <Compile Include="File Class\File.Move\File.Move_ExistingFile.cs" /> <Compile Include="File Class\File_Create\File.CreateText.cs" /> <Compile Include="File Class\File.Open\File.OpenRead_OpenReadTwiceShouldNotLock.cs" /> <Compile Include="File Class\File.Open\File.OpenWrite.cs" /> <Compile Include="File Class\File.Open\File.OpenText.cs" /> <Compile Include="File Class\File.Open\File.OpenRead.cs" /> <Compile Include="File Class\File.Open\File_Open_OverlappedIO.cs" /> <Compile Include="File Class\File.Open\File_Open_Create.cs" /> <Compile Include="File Class\File.Open\File_Open_Append_NoObjectDisposedException.cs" /> <Compile Include="File Class\File.Replace\File.Replace_NoBackup.cs" /> <Compile Include="File Class\File.Replace\File.Replace.cs" /> <Compile Include="File Class\File.Move\AlphaFS_File.Move_Overwrite_DestinationFileAlreadyExists.cs" /> <Compile Include="UnitTests\CopyTest.cs" /> <Compile Include="File Class\File_Timestamps\AlphaFS_File.GetChangeTime.cs" /> <Compile Include="File Class\File_Timestamps\AlphaFS_File.CopyTimestamps.cs" /> <Compile Include="File Class\File_Timestamps\AlphaFS_File.SetTimestamps.cs" /> <Compile Include="File Class\AlphaFS_File_Lock\AlphaFS_File.IsLocked.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_File.CreateSymbolicLink_And_GetLinkTargetInfo.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_File.CreateHardLink_And_EnumerateHardLinks.cs" /> <Compile Include="AlphaFS Compression\AlphaFS_File.Compress_And_Decompress.cs" /> <Compile Include="File Class\AlphaFS_File_GetSize\AlphaFS_File.GetCompressedSize.cs" /> <Compile Include="File Class\AlphaFS_File_GetSize\AlphaFS_File.GetSize_Stream0.cs" /> <Compile Include="File Class\AlphaFS_File.EnumerateAlternateDataStreams.cs" /> <Compile Include="File Class\File_Create\File.Create.cs" /> <Compile Include="File Class\File.Open\File_Open_Append.cs" /> <Compile Include="AlphaFS Encryption\AlphaFS_File.ExportImportEncryptedFileRaw.cs" /> <Compile Include="File Class\File.Exists\File.Exists_ExistingFile.cs" /> <Compile Include="File Class\File_AccessControl\File.SetAccessControl.cs" /> <Compile Include="File Class\File_AccessControl\File.GetAccessControl.cs" /> <Compile Include="FileInfo Class\FileInfo.InitializeInstance\FileInfo.InitializeInstance_NonExistingFile.cs" /> <Compile Include="FileInfo Class\FileInfoTest.cs" /> <Compile Include="FileInfo Class\FileInfo.Attributes.cs" /> <Compile Include="FileInfo Class\FileInfo.InitializeInstance\FileInfo.InitializeInstance_ExistingFile.cs" /> <Compile Include="FileInfo Class\FileInfo.Refresh.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateDomainDfsRoot.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateDfsRoot.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateDfsLinks.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.ConnectTo_Ipc_And_DisconnectFrom_Ipc.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.ConnectDrive_And_DisconnectDrive.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateDrives.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.GetHostShareFromPath.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.DriveConnection.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.GetUncName.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateOpenResources.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateOpenConnections.cs" /> <Compile Include="AlphaFS Host Class\AlphaFS_Host.EnumerateShares.cs" /> <Compile Include="UnitTests\AlphaFS_DfsInfoTest.cs" /> <Compile Include="Directory Class\Directory.CreateDirectory\Directory.CreateDirectory_And_Delete_CreatesStructureWithoutFiles.cs" /> <Compile Include="Directory Class\Directory_GetFileSystemEntries_LongPathPrefix_ShouldReturnCorrectEntries.cs" /> <Compile Include="AlphaFS Junctions, Links\AlphaFS_JunctionsLinksTest.cs" /> <Compile Include="UnitTests\AlphaFS_OperatingSystemTest.cs" /> <Compile Include="Path Class\AlphaFS_Path.CheckSupportedPathFormat\AlphaFS_Path.CheckSupportedPathFormat_PathContainsInvalidCharacters_ThrowsArgumentException.cs" /> <Compile Include="Path Class\AlphaFS_Path.CheckSupportedPathFormat\AlphaFS_Path.CheckSupportedPathFormat_PathStartsWithColon.cs" /> <Compile Include="Path Class\AlphaFS_Path.CheckSupportedPathFormat\AlphaFS_Path.CheckSupportedPathFormat_PathContainsColon_ThrowsNotSupportedException.cs" /> <Compile Include="Path Class\Path.GetFullPath\Path.GetFullPath.cs" /> <Compile Include="Path Class\AlphaFS_Path.LocalToUnc.cs" /> <Compile Include="Path Class\AlphaFS_Path.GetRelativePathResolveRelativePath.cs" /> <Compile Include="Path Class\Path.IsPathRooted\Path.IsPathRooted.cs" /> <Compile Include="Path Class\Path.GetExtension\Path.GetExtension.cs" /> <Compile Include="Path Class\Path.GetDirectoryName\Path.GetDirectoryName.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32.GetFileIcon.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32.GetVerbCommand.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32Info.InitializeInstance.cs" /> <Compile Include="AlphaFS Shell32 Class\AlphaFS_Shell32Test.UrlIs.cs" /> <Compile Include="DirectoryInfo Class\DirectoryInfo.InitializeInstance\DirectoryInfo.InitializeInstance_ExistingDirectory.cs" /> <Compile Include="Path Class\AlphaFS_Path_IsUncPath.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.SetVolumeMountPoint.cs" /> <Compile Include="AlphaFS Device Class\AlphaFS Volume Class\AlphaFS_Volume.GetVolumeInfo.cs" /> </ItemGroup> <ItemGroup> <None Include="..\..\build\AlphaFS.snk"> <Link>AlphaFS.snk</Link> </None> </ItemGroup> <ItemGroup> <PackageReference Include="MSTest.TestAdapter" Version="1.3.2" /> <PackageReference Include="MSTest.TestFramework" Version="1.3.2" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\src\AlphaFS\AlphaFS.csproj" /> </ItemGroup> </Project>
{ "pile_set_name": "Github" }
# Copyright (c) 2020 Sony Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import glob import numpy as np import nnabla.logger as logger from nnabla.utils.data_iterator import data_iterator from nnabla.utils.data_source import DataSource from nnabla.utils.image_utils import imread from utils import get_points_list, get_bod_map def celebv_data_iterator(dataset_mode=None, celeb_name=None, data_dir=None, ref_dir=None, mode="all", batch_size=1, shuffle=False, rng=None, with_memory_cache=False, with_file_cache=False, resize_size=(64, 64), line_thickness=3, gaussian_kernel=(5, 5), gaussian_sigma=3 ): if dataset_mode == 'transformer': if ref_dir: assert os.path.exists(ref_dir), f'{ref_dir} not found.' logger.info( 'CelebV Dataiterator using reference .npz file for Transformer is created.') return data_iterator(CelebVDataRefSource( celeb_name=celeb_name, data_dir=data_dir, ref_dir=ref_dir, need_image=False, need_heatmap=True, need_resized_heatmap=False, mode=mode, shuffle=shuffle, rng=rng), batch_size, rng, with_memory_cache, with_file_cache) else: logger.info('CelebV Dataiterator for Transformer is created.') return data_iterator(CelebVDataSource( celeb_name=celeb_name, data_dir=data_dir, need_image=False, need_heatmap=True, need_resized_heatmap=False, mode=mode, shuffle=shuffle, rng=rng, resize_size=resize_size, line_thickness=line_thickness, gaussian_kernel=gaussian_kernel, gaussian_sigma=gaussian_sigma), batch_size, rng, with_memory_cache, with_file_cache) elif dataset_mode == 'decoder': if ref_dir: assert os.path.exists(ref_dir), f'{ref_dir} not found.' logger.info( 'CelebV Dataiterator using reference .npz file for Decoder is created.') return data_iterator(CelebVDataRefSource( celeb_name=celeb_name, data_dir=data_dir, ref_dir=ref_dir, need_image=True, need_heatmap=True, need_resized_heatmap=True, mode=mode, shuffle=shuffle, rng=rng), batch_size, rng, with_memory_cache, with_file_cache) else: logger.info('CelebV Dataiterator for Decoder is created.') return data_iterator(CelebVDataSource( celeb_name=celeb_name, data_dir=data_dir, need_image=True, need_heatmap=True, need_resized_heatmap=True, mode=mode, shuffle=shuffle, rng=rng, resize_size=resize_size, line_thickness=line_thickness, gaussian_kernel=gaussian_kernel, gaussian_sigma=gaussian_sigma), batch_size, rng, with_memory_cache, with_file_cache) else: logger.error( 'Specified Dataitaretor is wrong? given: {}'.format(dataset_mode)) import sys sys.exit() def wflw_data_iterator(data_dir=None, dataset_mode="encoder_ref", mode="train", use_reference=False, batch_size=1, shuffle=True, rng=None, with_memory_cache=False, with_file_cache=False, transform=None): if use_reference: logger.info( 'WFLW Dataset for Encoder using reference .npz file is created.') return data_iterator(WFLWDataEncoderRefSource(data_dir, shuffle=shuffle, rng=rng, transform=transform, mode=mode), batch_size, rng, with_memory_cache, with_file_cache) else: logger.info('WFLW Dataset for Encoder is created.') return data_iterator(WFLWDataEncoderSource(data_dir, shuffle=shuffle, rng=rng, transform=transform, mode=mode), batch_size, rng, with_memory_cache, with_file_cache) class CelebVBaseDatahandler(object): """docstring for CelebVBaseDatahandler""" def __init__(self, celeb_name=None, data_dir=None, mode="all", shuffle=True, rng=None, resize_size=(64, 64), line_thickness=3, gaussian_kernel=(5, 5), gaussian_sigma=3): self.resize_size = resize_size self.line_thickness = line_thickness self.gaussian_kernel = gaussian_kernel self.gaussian_sigma = gaussian_sigma celeb_name_list = ['Donald_Trump', 'Emmanuel_Macron', 'Jack_Ma', 'Kathleen', 'Theresa_May'] assert celeb_name in celeb_name_list self.data_dir = data_dir self._shuffle = shuffle self.mode = mode self.celeb_name = celeb_name self.imgs_root_path = os.path.join(self.data_dir, self.celeb_name) if not os.path.exists(self.imgs_root_path): logger.error('{} is not exists.'.format(self.imgs_root_path)) # use an annotation file to know how many images are needed. self.ant, self._size = self.get_ant_and_size( self.imgs_root_path, self.mode) logger.info(f'the number of images for {self.mode}: {self._size}') self._variables = list() self._ref_files = dict() self.reset() def get_img_path(self, imgs_root_path, img_name): img_path = os.path.join(imgs_root_path, 'Image', img_name) return img_path def get_img_name(self, ant): name = ant.split(' ')[-1].split('\n')[0] return name def get_img(self, img_path): img = imread(img_path, num_channels=3, channel_first=True) return img # (3, 256, 256) def normalize_img(self, img, normalize_type="image"): if normalize_type == "image": # [0, 255] -> [-1, +1] img = (img / 255.0) * 2.0 - 1.0 elif normalize_type == "heatmap": # [0, 255] -> [0., 1.] img = img / 255.0 else: raise TypeError return img def get_ant_and_size(self, imgs_root_path, mode="all"): if mode == "all": filename = 'all_98pt.txt' elif mode == "train": filename = 'train_98pt.txt' else: filename = 'test_98pt.txt' # get the annotation txt file path txt_path = os.path.join(imgs_root_path, filename) logger.info(f'checking {txt_path}...') with open(txt_path, "r", encoding="utf-8") as f: ant = f.readlines() # read the annotation data from the txt size = len(ant) # the number of training images return ant, size def _get_data(self, position): return NotImplemented def reset(self): # reset method initialize self._indexes if self._shuffle: self._indexes = np.arange(self._size) np.random.shuffle(self._indexes) else: self._indexes = np.arange(self._size) class CelebVDataSource(DataSource, CelebVBaseDatahandler): def __init__(self, celeb_name=None, data_dir=None, need_image=False, need_heatmap=True, need_resized_heatmap=False, mode="all", shuffle=True, rng=None, resize_size=(64, 64), line_thickness=3, gaussian_kernel=(5, 5), gaussian_sigma=3): super(CelebVDataSource, self).__init__() CelebVBaseDatahandler.__init__(self, celeb_name=celeb_name, data_dir=data_dir, mode=mode, shuffle=shuffle, rng=rng, resize_size=resize_size, line_thickness=line_thickness, gaussian_kernel=gaussian_kernel, gaussian_sigma=gaussian_sigma) if need_image: self._variables.append('image') if need_heatmap: self._variables.append('heatmap') if need_resized_heatmap: self._variables.append('resized_heatmap') assert self._variables # must contain at least one element self._variables = tuple(self._variables) self.reset() def _get_data(self, position): idx = self._indexes[position] data = self.get_required_data(idx) return data def get_required_data(self, idx): img_name = self.get_img_name(self.ant[idx]) img, bod_map, bod_map_resized = None, None, None img_path = self.get_img_path(self.imgs_root_path, img_name) _img = self.get_img(img_path) # (3, 256, 256) if 'heatmap' in self._variables or 'resized_heatmap' in self._variables: # len(x_list)=98, len(y_list)=98 x_list, y_list = get_points_list(self.ant[idx]) if 'image' in self._variables: img = self.normalize_img(_img) if 'heatmap' in self._variables: bod_map = get_bod_map(_img, x_list, y_list, resize_size=self.resize_size, line_thickness=self.line_thickness, gaussian_kernel=self.gaussian_kernel, gaussian_sigma=self.gaussian_sigma) # (15, 64, 64) bod_map = self.normalize_img(bod_map, normalize_type="heatmap") if 'resized_heatmap' in self._variables: bod_map_resized = get_bod_map(_img, x_list, y_list, resize_size=(256, 256), line_thickness=self.line_thickness, gaussian_kernel=self.gaussian_kernel, gaussian_sigma=self.gaussian_sigma) # (15, 256, 256) bod_map_resized = self.normalize_img( bod_map_resized, normalize_type="heatmap") return [_ for _ in (img, bod_map, bod_map_resized) if _ is not None] def reset(self): # reset method initialize self._indexes if self._shuffle: self._indexes = np.arange(self._size) np.random.shuffle(self._indexes) else: self._indexes = np.arange(self._size) super(CelebVDataSource, self).reset() class CelebVDataRefSource(DataSource, CelebVBaseDatahandler): def __init__(self, celeb_name="Donald_Trump", data_dir="./datasets/CelebV", ref_dir=None, need_image=False, need_heatmap=True, need_resized_heatmap=False, mode="all", shuffle=True, rng=None): super(CelebVDataRefSource, self).__init__() CelebVBaseDatahandler.__init__(self, celeb_name=celeb_name, data_dir=data_dir, mode=mode, shuffle=shuffle, rng=rng) self.ref_dir = ref_dir if need_image: self._assign_variable_and_load_ref('image') if need_heatmap: self._assign_variable_and_load_ref('heatmap') if need_resized_heatmap: self._assign_variable_and_load_ref('resized_heatmap') assert self._variables # must contain at least one element self._variables = tuple(self._variables) self.reset() def _assign_variable_and_load_ref(self, data): assert data in ('image', 'heatmap', 'resized_heatmap') self._variables.append(data) _ref_path = os.path.join(self.ref_dir, f'{self.celeb_name}_{data}.npz') assert _ref_path, f"{_ref_path} does not exist." self._ref_files[data] = np.load(_ref_path) logger.info(f'loaded {_ref_path}.') def _get_data(self, position): idx = self._indexes[position] data = self.get_required_data(idx) return data def get_required_data(self, idx): img_name = self.get_img_name(self.ant[idx]) img, bod_map, bod_map_resized = None, None, None if 'image' in self._variables: img = self._ref_files['image'][img_name] # uint8, [0, 255] img = self.normalize_img(img) if 'heatmap' in self._variables: bod_map = self._ref_files['heatmap'][img_name] bod_map = self.normalize_img(bod_map, normalize_type="heatmap") if 'resized_heatmap' in self._variables: # uint8, [0, 255] bod_map_resized = self._ref_files['resized_heatmap'][img_name] bod_map_resized = self.normalize_img( bod_map_resized, normalize_type="heatmap") return [_ for _ in (img, bod_map, bod_map_resized) if _ is not None] def reset(self): # reset method initialize self._indexes if self._shuffle: self._indexes = np.arange(self._size) np.random.shuffle(self._indexes) else: self._indexes = np.arange(self._size) super(CelebVDataRefSource, self).reset() class WFLWDataEncoderSource(DataSource): def __init__(self, data_dir=None, shuffle=True, rng=None, transform=None, mode="train"): super(WFLWDataEncoderSource, self).__init__() self.ref_dir = data_dir # './datasets/WFLW_heatmaps' self.mode = mode self.img_dir = os.path.join( self.ref_dir, "WFLW_cropped_images", self.mode) self.bod_dir = os.path.join( self.ref_dir, "WFLW_landmark_images", self.mode) self._size = len(glob.glob(f"{self.img_dir}/*.png")) self._shuffle = shuffle self.transform = transform self._variables = ('x', 'y') self.reset() def _get_data(self, position): idx = self._indexes[position] # image load img = self.get_img(os.path.join(self.img_dir, f"train_{idx}.png")) img = self.normalize_img(img) # pose # uint8, [0, 255] bod_map = self.get_img(os.path.join(self.bod_dir, f"train_{idx}.png")) bod_map = self.normalize_img(bod_map, normalize_type="heatmap") if self.transform is not None: img = np.transpose(img, (1, 2, 0)) bod_map = np.transpose(bod_map, (1, 2, 0)) aug = self.transform(image=img, mask=bod_map) img = aug['image'] bod_map = aug['mask'] img = np.transpose(img, (2, 0, 1)) bod_map = np.transpose(bod_map, (2, 0, 1)) return img, bod_map def reset(self): # reset method initialize self._indexes if self._shuffle: self._indexes = np.arange(self._size) np.random.shuffle(self._indexes) else: self._indexes = np.arange(self._size) super(WFLWDataEncoderSource, self).reset() def get_img(self, img_path): img = imread(img_path, num_channels=3, channel_first=True) return img # (3, 256, 256) def normalize_img(self, img, normalize_type="image"): if normalize_type == "image": # [0, 255] -> [-1, +1] img = (img / 255.0) * 2.0 - 1.0 elif normalize_type == "heatmap": # [0, 255] -> [0., 1.] img = img / 255.0 else: raise TypeError return img class WFLWDataEncoderRefSource(DataSource): def __init__(self, data_dir=None, shuffle=True, rng=None, transform=None, mode="train"): super(WFLWDataEncoderRefSource, self).__init__() self.ref_dir = data_dir # './datasets/WFLW_heatmaps' self.mode = mode ref_img_path = os.path.join(self.ref_dir, f'WFLW_cropped_image_{self.mode}.npz') ref_bod_path = os.path.join(self.ref_dir, f'WFLW_heatmap_{self.mode}.npz') self.ref_img = np.load(ref_img_path) self.ref_bod = np.load(ref_bod_path) self._size = len(self.ref_img.files) self._shuffle = shuffle self.transform = transform self._variables = ('x', 'y') self.reset() def _get_data(self, position): idx = self._indexes[position] # image load img = self.ref_img[f"{self.mode}_{idx}.png"] img = self.normalize_img(img) # pose bod_map = self.ref_bod[f"{self.mode}_{idx}.png"] # uint8, [0, 255] bod_map = self.normalize_img(bod_map, normalize_type="heatmap") if self.transform is not None: img = np.transpose(img, (1, 2, 0)) bod_map = np.transpose(bod_map, (1, 2, 0)) aug = self.transform(image=img, mask=bod_map) img = aug['image'] bod_map = aug['mask'] img = np.transpose(img, (2, 0, 1)) bod_map = np.transpose(bod_map, (2, 0, 1)) return img, bod_map def reset(self): # reset method initialize self._indexes if self._shuffle: self._indexes = np.arange(self._size) np.random.shuffle(self._indexes) else: self._indexes = np.arange(self._size) super(WFLWDataEncoderRefSource, self).reset() def get_img(self, img_path): img = imread(img_path, num_channels=3, channel_first=True) return img # (3, 256, 256) def normalize_img(self, img, normalize_type="image"): if normalize_type == "image": # [0, 255] -> [-1, +1] img = (img / 255.0) * 2.0 - 1.0 elif normalize_type == "heatmap": # [0, 255] -> [0., 1.] img = img / 255.0 else: raise TypeError return img
{ "pile_set_name": "Github" }
// RUN: %clang_cc1 -std=c++11 %s -verify // expected-no-diagnostics constexpr int operator "" _a(const char *c) { return c[0]; } static_assert(operator "" _a("foo") == 'f', ""); void puts(const char *); static inline void operator "" _puts(const char *c) { puts(c); } void f() { operator "" _puts("foo"); operator "" _puts("bar"); }
{ "pile_set_name": "Github" }
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Tree shaking</title> </head> <body> <script> window.assert = window.parent.assert; window.done = window.parent.done; </script> <script src="../../steal-with-promises.js" data-base-url="." data-config="package.json!npm" data-main="@empty"> import { a } from "~/mod"; var mod = steal.loader.get("[email protected]#mod"); var modB = steal.loader.get("[email protected]#mod_b"); if(typeof window.assert !== "undefined") { window.assert.equal(mod.a, "a", "a was not tree shaken"); window.assert.equal(mod.b, undefined, "b was tree shaken"); window.assert.equal(modB, undefined, "b was not loaded at all"); window.done(); } else { console.log("mod", mod); console.log("mod_b", modB); } </script> <!--<script> function assertMain() { var mod = steal.loader.get("[email protected]#mod"); var modB = steal.loader.get("[email protected]#mod_b"); if(typeof window.assert !== "undefined") { window.assert.equal(mod.a, "a", "a was not tree shaken"); window.assert.equal(mod.b, undefined, "b was tree shaken"); window.assert.equal(modB, undefined, "b was not loaded at all"); } else { console.log("mod", mod); console.log("mod_b", modB); } } function assertOther() { var mod = steal.loader.get("[email protected]#mod"); var modA = steal.loader.get("[email protected]#mod_a"); var modB = steal.loader.get("[email protected]#mod_b"); var modC = steal.loader.get("[email protected]#mod_c"); if(typeof window.assert !== "undefined") { window.assert.equal(mod.a, "a", "a was not tree shaken"); window.assert.equal(mod.b, "b", "b not tree shaken"); window.assert.equal(mod.c, undefined, "c still tree shaken"); window.assert.equal(modA.default, "a", "a is still present"); window.assert.equal(modB.default, "b", "b exists now"); window.assert.equal(modC, undefined, "c was not loaded at all"); } else { console.log("mod", mod); console.log("mod_b", modB); console.log("mod_c", modC); } } steal.done() .then(assertMain) .then(function(){ return steal.import("~/other"); }) .then(assertOther) .then(function(){ if(window.assert) { window.done(); } }); </script>--> </body> </html>
{ "pile_set_name": "Github" }
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package prototext import ( "fmt" "strings" "unicode/utf8" "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/encoding/text" "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/fieldnum" "google.golang.org/protobuf/internal/flags" "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/internal/set" "google.golang.org/protobuf/internal/strs" "google.golang.org/protobuf/proto" pref "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" ) // Unmarshal reads the given []byte into the given proto.Message. func Unmarshal(b []byte, m proto.Message) error { return UnmarshalOptions{}.Unmarshal(b, m) } // UnmarshalOptions is a configurable textproto format unmarshaler. type UnmarshalOptions struct { pragma.NoUnkeyedLiterals // AllowPartial accepts input for messages that will result in missing // required fields. If AllowPartial is false (the default), Unmarshal will // return error if there are any missing required fields. AllowPartial bool // DiscardUnknown specifies whether to ignore unknown fields when parsing. // An unknown field is any field whose field name or field number does not // resolve to any known or extension field in the message. // By default, unmarshal rejects unknown fields as an error. DiscardUnknown bool // Resolver is used for looking up types when unmarshaling // google.protobuf.Any messages or extension fields. // If nil, this defaults to using protoregistry.GlobalTypes. Resolver interface { protoregistry.MessageTypeResolver protoregistry.ExtensionTypeResolver } } // Unmarshal reads the given []byte and populates the given proto.Message using options in // UnmarshalOptions object. func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error { proto.Reset(m) if o.Resolver == nil { o.Resolver = protoregistry.GlobalTypes } dec := decoder{text.NewDecoder(b), o} if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil { return err } if o.AllowPartial { return nil } return proto.CheckInitialized(m) } type decoder struct { *text.Decoder opts UnmarshalOptions } // newError returns an error object with position info. func (d decoder) newError(pos int, f string, x ...interface{}) error { line, column := d.Position(pos) head := fmt.Sprintf("(line %d:%d): ", line, column) return errors.New(head+f, x...) } // unexpectedTokenError returns a syntax error for the given unexpected token. func (d decoder) unexpectedTokenError(tok text.Token) error { return d.syntaxError(tok.Pos(), "unexpected token: %s", tok.RawString()) } // syntaxError returns a syntax error for given position. func (d decoder) syntaxError(pos int, f string, x ...interface{}) error { line, column := d.Position(pos) head := fmt.Sprintf("syntax error (line %d:%d): ", line, column) return errors.New(head+f, x...) } // unmarshalMessage unmarshals into the given protoreflect.Message. func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error { messageDesc := m.Descriptor() if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) { return errors.New("no support for proto1 MessageSets") } if messageDesc.FullName() == "google.protobuf.Any" { return d.unmarshalAny(m, checkDelims) } if checkDelims { tok, err := d.Read() if err != nil { return err } if tok.Kind() != text.MessageOpen { return d.unexpectedTokenError(tok) } } var seenNums set.Ints var seenOneofs set.Ints fieldDescs := messageDesc.Fields() for { // Read field name. tok, err := d.Read() if err != nil { return err } switch typ := tok.Kind(); typ { case text.Name: // Continue below. case text.EOF: if checkDelims { return text.ErrUnexpectedEOF } return nil default: if checkDelims && typ == text.MessageClose { return nil } return d.unexpectedTokenError(tok) } // Resolve the field descriptor. var name pref.Name var fd pref.FieldDescriptor var xt pref.ExtensionType var xtErr error var isFieldNumberName bool switch tok.NameKind() { case text.IdentName: name = pref.Name(tok.IdentName()) fd = fieldDescs.ByName(name) if fd == nil { // The proto name of a group field is in all lowercase, // while the textproto field name is the group message name. gd := fieldDescs.ByName(pref.Name(strings.ToLower(string(name)))) if gd != nil && gd.Kind() == pref.GroupKind && gd.Message().Name() == name { fd = gd } } else if fd.Kind() == pref.GroupKind && fd.Message().Name() != name { fd = nil // reset since field name is actually the message name } case text.TypeName: // Handle extensions only. This code path is not for Any. xt, xtErr = d.findExtension(pref.FullName(tok.TypeName())) case text.FieldNumber: isFieldNumberName = true num := pref.FieldNumber(tok.FieldNumber()) if !num.IsValid() { return d.newError(tok.Pos(), "invalid field number: %d", num) } fd = fieldDescs.ByNumber(num) if fd == nil { xt, xtErr = d.opts.Resolver.FindExtensionByNumber(messageDesc.FullName(), num) } } if xt != nil { fd = xt.TypeDescriptor() if !messageDesc.ExtensionRanges().Has(fd.Number()) || fd.ContainingMessage().FullName() != messageDesc.FullName() { return d.newError(tok.Pos(), "message %v cannot be extended by %v", messageDesc.FullName(), fd.FullName()) } } else if xtErr != nil && xtErr != protoregistry.NotFound { return d.newError(tok.Pos(), "unable to resolve [%s]: %v", tok.RawString(), xtErr) } if flags.ProtoLegacy { if fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() { fd = nil // reset since the weak reference is not linked in } } // Handle unknown fields. if fd == nil { if d.opts.DiscardUnknown || messageDesc.ReservedNames().Has(name) { d.skipValue() continue } return d.newError(tok.Pos(), "unknown field: %v", tok.RawString()) } // Handle fields identified by field number. if isFieldNumberName { // TODO: Add an option to permit parsing field numbers. // // This requires careful thought as the MarshalOptions.EmitUnknown // option allows formatting unknown fields as the field number and the // best-effort textual representation of the field value. In that case, // it may not be possible to unmarshal the value from a parser that does // have information about the unknown field. return d.newError(tok.Pos(), "cannot specify field by number: %v", tok.RawString()) } switch { case fd.IsList(): kind := fd.Kind() if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() { return d.syntaxError(tok.Pos(), "missing field separator :") } list := m.Mutable(fd).List() if err := d.unmarshalList(fd, list); err != nil { return err } case fd.IsMap(): mmap := m.Mutable(fd).Map() if err := d.unmarshalMap(fd, mmap); err != nil { return err } default: kind := fd.Kind() if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() { return d.syntaxError(tok.Pos(), "missing field separator :") } // If field is a oneof, check if it has already been set. if od := fd.ContainingOneof(); od != nil { idx := uint64(od.Index()) if seenOneofs.Has(idx) { return d.newError(tok.Pos(), "error parsing %q, oneof %v is already set", tok.RawString(), od.FullName()) } seenOneofs.Set(idx) } num := uint64(fd.Number()) if seenNums.Has(num) { return d.newError(tok.Pos(), "non-repeated field %q is repeated", tok.RawString()) } if err := d.unmarshalSingular(fd, m); err != nil { return err } seenNums.Set(num) } } return nil } // findExtension returns protoreflect.ExtensionType from the Resolver if found. func (d decoder) findExtension(xtName pref.FullName) (pref.ExtensionType, error) { xt, err := d.opts.Resolver.FindExtensionByName(xtName) if err == nil { return xt, nil } return messageset.FindMessageSetExtension(d.opts.Resolver, xtName) } // unmarshalSingular unmarshals a non-repeated field value specified by the // given FieldDescriptor. func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error { var val pref.Value var err error switch fd.Kind() { case pref.MessageKind, pref.GroupKind: val = m.NewField(fd) err = d.unmarshalMessage(val.Message(), true) default: val, err = d.unmarshalScalar(fd) } if err == nil { m.Set(fd, val) } return err } // unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the // given FieldDescriptor. func (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) { tok, err := d.Read() if err != nil { return pref.Value{}, err } if tok.Kind() != text.Scalar { return pref.Value{}, d.unexpectedTokenError(tok) } kind := fd.Kind() switch kind { case pref.BoolKind: if b, ok := tok.Bool(); ok { return pref.ValueOfBool(b), nil } case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind: if n, ok := tok.Int32(); ok { return pref.ValueOfInt32(n), nil } case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind: if n, ok := tok.Int64(); ok { return pref.ValueOfInt64(n), nil } case pref.Uint32Kind, pref.Fixed32Kind: if n, ok := tok.Uint32(); ok { return pref.ValueOfUint32(n), nil } case pref.Uint64Kind, pref.Fixed64Kind: if n, ok := tok.Uint64(); ok { return pref.ValueOfUint64(n), nil } case pref.FloatKind: if n, ok := tok.Float32(); ok { return pref.ValueOfFloat32(n), nil } case pref.DoubleKind: if n, ok := tok.Float64(); ok { return pref.ValueOfFloat64(n), nil } case pref.StringKind: if s, ok := tok.String(); ok { if strs.EnforceUTF8(fd) && !utf8.ValidString(s) { return pref.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8") } return pref.ValueOfString(s), nil } case pref.BytesKind: if b, ok := tok.String(); ok { return pref.ValueOfBytes([]byte(b)), nil } case pref.EnumKind: if lit, ok := tok.Enum(); ok { // Lookup EnumNumber based on name. if enumVal := fd.Enum().Values().ByName(pref.Name(lit)); enumVal != nil { return pref.ValueOfEnum(enumVal.Number()), nil } } if num, ok := tok.Int32(); ok { return pref.ValueOfEnum(pref.EnumNumber(num)), nil } default: panic(fmt.Sprintf("invalid scalar kind %v", kind)) } return pref.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString()) } // unmarshalList unmarshals into given protoreflect.List. A list value can // either be in [] syntax or simply just a single scalar/message value. func (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error { tok, err := d.Peek() if err != nil { return err } switch fd.Kind() { case pref.MessageKind, pref.GroupKind: switch tok.Kind() { case text.ListOpen: d.Read() for { tok, err := d.Peek() if err != nil { return err } switch tok.Kind() { case text.ListClose: d.Read() return nil case text.MessageOpen: pval := list.NewElement() if err := d.unmarshalMessage(pval.Message(), true); err != nil { return err } list.Append(pval) default: return d.unexpectedTokenError(tok) } } case text.MessageOpen: pval := list.NewElement() if err := d.unmarshalMessage(pval.Message(), true); err != nil { return err } list.Append(pval) return nil } default: switch tok.Kind() { case text.ListOpen: d.Read() for { tok, err := d.Peek() if err != nil { return err } switch tok.Kind() { case text.ListClose: d.Read() return nil case text.Scalar: pval, err := d.unmarshalScalar(fd) if err != nil { return err } list.Append(pval) default: return d.unexpectedTokenError(tok) } } case text.Scalar: pval, err := d.unmarshalScalar(fd) if err != nil { return err } list.Append(pval) return nil } } return d.unexpectedTokenError(tok) } // unmarshalMap unmarshals into given protoreflect.Map. A map value is a // textproto message containing {key: <kvalue>, value: <mvalue>}. func (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error { // Determine ahead whether map entry is a scalar type or a message type in // order to call the appropriate unmarshalMapValue func inside // unmarshalMapEntry. var unmarshalMapValue func() (pref.Value, error) switch fd.MapValue().Kind() { case pref.MessageKind, pref.GroupKind: unmarshalMapValue = func() (pref.Value, error) { pval := mmap.NewValue() if err := d.unmarshalMessage(pval.Message(), true); err != nil { return pref.Value{}, err } return pval, nil } default: unmarshalMapValue = func() (pref.Value, error) { return d.unmarshalScalar(fd.MapValue()) } } tok, err := d.Read() if err != nil { return err } switch tok.Kind() { case text.MessageOpen: return d.unmarshalMapEntry(fd, mmap, unmarshalMapValue) case text.ListOpen: for { tok, err := d.Read() if err != nil { return err } switch tok.Kind() { case text.ListClose: return nil case text.MessageOpen: if err := d.unmarshalMapEntry(fd, mmap, unmarshalMapValue); err != nil { return err } default: return d.unexpectedTokenError(tok) } } default: return d.unexpectedTokenError(tok) } } // unmarshalMap unmarshals into given protoreflect.Map. A map value is a // textproto message containing {key: <kvalue>, value: <mvalue>}. func (d decoder) unmarshalMapEntry(fd pref.FieldDescriptor, mmap pref.Map, unmarshalMapValue func() (pref.Value, error)) error { var key pref.MapKey var pval pref.Value Loop: for { // Read field name. tok, err := d.Read() if err != nil { return err } switch tok.Kind() { case text.Name: if tok.NameKind() != text.IdentName { if !d.opts.DiscardUnknown { return d.newError(tok.Pos(), "unknown map entry field %q", tok.RawString()) } d.skipValue() continue Loop } // Continue below. case text.MessageClose: break Loop default: return d.unexpectedTokenError(tok) } name := tok.IdentName() switch name { case "key": if !tok.HasSeparator() { return d.syntaxError(tok.Pos(), "missing field separator :") } if key.IsValid() { return d.newError(tok.Pos(), `map entry "key" cannot be repeated`) } val, err := d.unmarshalScalar(fd.MapKey()) if err != nil { return err } key = val.MapKey() case "value": if kind := fd.MapValue().Kind(); (kind != pref.MessageKind) && (kind != pref.GroupKind) { if !tok.HasSeparator() { return d.syntaxError(tok.Pos(), "missing field separator :") } } if pval.IsValid() { return d.newError(tok.Pos(), `map entry "value" cannot be repeated`) } pval, err = unmarshalMapValue() if err != nil { return err } default: if !d.opts.DiscardUnknown { return d.newError(tok.Pos(), "unknown map entry field %q", name) } d.skipValue() } } if !key.IsValid() { key = fd.MapKey().Default().MapKey() } if !pval.IsValid() { switch fd.MapValue().Kind() { case pref.MessageKind, pref.GroupKind: // If value field is not set for message/group types, construct an // empty one as default. pval = mmap.NewValue() default: pval = fd.MapValue().Default() } } mmap.Set(key, pval) return nil } // unmarshalAny unmarshals an Any textproto. It can either be in expanded form // or non-expanded form. func (d decoder) unmarshalAny(m pref.Message, checkDelims bool) error { var typeURL string var bValue []byte // hasFields tracks which valid fields have been seen in the loop below in // order to flag an error if there are duplicates or conflicts. It may // contain the strings "type_url", "value" and "expanded". The literal // "expanded" is used to indicate that the expanded form has been // encountered already. hasFields := map[string]bool{} if checkDelims { tok, err := d.Read() if err != nil { return err } if tok.Kind() != text.MessageOpen { return d.unexpectedTokenError(tok) } } Loop: for { // Read field name. Can only have 3 possible field names, i.e. type_url, // value and type URL name inside []. tok, err := d.Read() if err != nil { return err } if typ := tok.Kind(); typ != text.Name { if checkDelims { if typ == text.MessageClose { break Loop } } else if typ == text.EOF { break Loop } return d.unexpectedTokenError(tok) } switch tok.NameKind() { case text.IdentName: // Both type_url and value fields require field separator :. if !tok.HasSeparator() { return d.syntaxError(tok.Pos(), "missing field separator :") } switch tok.IdentName() { case "type_url": if hasFields["type_url"] { return d.newError(tok.Pos(), "duplicate Any type_url field") } if hasFields["expanded"] { return d.newError(tok.Pos(), "conflict with [%s] field", typeURL) } tok, err := d.Read() if err != nil { return err } var ok bool typeURL, ok = tok.String() if !ok { return d.newError(tok.Pos(), "invalid Any type_url: %v", tok.RawString()) } hasFields["type_url"] = true case "value": if hasFields["value"] { return d.newError(tok.Pos(), "duplicate Any value field") } if hasFields["expanded"] { return d.newError(tok.Pos(), "conflict with [%s] field", typeURL) } tok, err := d.Read() if err != nil { return err } s, ok := tok.String() if !ok { return d.newError(tok.Pos(), "invalid Any value: %v", tok.RawString()) } bValue = []byte(s) hasFields["value"] = true default: if !d.opts.DiscardUnknown { return d.newError(tok.Pos(), "invalid field name %q in google.protobuf.Any message", tok.RawString()) } } case text.TypeName: if hasFields["expanded"] { return d.newError(tok.Pos(), "cannot have more than one type") } if hasFields["type_url"] { return d.newError(tok.Pos(), "conflict with type_url field") } typeURL = tok.TypeName() var err error bValue, err = d.unmarshalExpandedAny(typeURL, tok.Pos()) if err != nil { return err } hasFields["expanded"] = true default: if !d.opts.DiscardUnknown { return d.newError(tok.Pos(), "invalid field name %q in google.protobuf.Any message", tok.RawString()) } } } fds := m.Descriptor().Fields() if len(typeURL) > 0 { m.Set(fds.ByNumber(fieldnum.Any_TypeUrl), pref.ValueOfString(typeURL)) } if len(bValue) > 0 { m.Set(fds.ByNumber(fieldnum.Any_Value), pref.ValueOfBytes(bValue)) } return nil } func (d decoder) unmarshalExpandedAny(typeURL string, pos int) ([]byte, error) { mt, err := d.opts.Resolver.FindMessageByURL(typeURL) if err != nil { return nil, d.newError(pos, "unable to resolve message [%v]: %v", typeURL, err) } // Create new message for the embedded message type and unmarshal the value // field into it. m := mt.New() if err := d.unmarshalMessage(m, true); err != nil { return nil, err } // Serialize the embedded message and return the resulting bytes. b, err := proto.MarshalOptions{ AllowPartial: true, // Never check required fields inside an Any. Deterministic: true, }.Marshal(m.Interface()) if err != nil { return nil, d.newError(pos, "error in marshaling message into Any.value: %v", err) } return b, nil } // skipValue makes the decoder parse a field value in order to advance the read // to the next field. It relies on Read returning an error if the types are not // in valid sequence. func (d decoder) skipValue() error { tok, err := d.Read() if err != nil { return err } // Only need to continue reading for messages and lists. switch tok.Kind() { case text.MessageOpen: return d.skipMessageValue() case text.ListOpen: for { tok, err := d.Read() if err != nil { return err } switch tok.Kind() { case text.ListClose: return nil case text.MessageOpen: return d.skipMessageValue() default: // Skip items. This will not validate whether skipped values are // of the same type or not, same behavior as C++ // TextFormat::Parser::AllowUnknownField(true) version 3.8.0. if err := d.skipValue(); err != nil { return err } } } } return nil } // skipMessageValue makes the decoder parse and skip over all fields in a // message. It assumes that the previous read type is MessageOpen. func (d decoder) skipMessageValue() error { for { tok, err := d.Read() if err != nil { return err } switch tok.Kind() { case text.MessageClose: return nil case text.Name: if err := d.skipValue(); err != nil { return err } } } }
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 # JWT Decoder import base64 import sys import hmac import hashlib import binascii # eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNDE2OTI5MDYxIiwianRpIjoiODAyMDU3ZmY5YjViNGViN2ZiYjg4NTZiNmViMmNjNWIiLCJzY29wZXMiOnsidXNlcnMiOnsiYWN0aW9ucyI6WyJyZWFkIiwiY3JlYXRlIl19LCJ1c2Vyc19hcHBfbWV0YWRhdGEiOnsiYWN0aW9ucyI6WyJyZWFkIiwiY3JlYXRlIl19fX0.gll8YBKPLq6ZLkCPLoghaBZG_ojFLREyLQYx0l2BG3E # eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNDE2OTI5MDYxIiwianRpIjoiODAyMDU3ZmY5YjViNGViN2ZiYjg4NTZiNmViMmNjNWIiLCJzY29wZXMiOnsidXNlcnMiOnsiYWN0aW9ucyI6WyJyZWFkIiwiY3JlYXRlIl19LCJ1c2Vyc19hcHBfbWV0YWRhdGEiOnsiYWN0aW9ucyI6WyJyZWFkIiwiY3JlYXRlIl19fX0.15308fa263baaa57c2c84528d913ab75892352d927ccbd29e5af8fd783257996 def get_parts(jwt): return dict(zip(['header', 'payload', 'signature'], jwt.split('.'))) def decode_part(part): # use Base64URL decode plus optional padding. # === makes sure that padding will be always correct # extraneous padding is ignored return base64.urlsafe_b64decode(part + '===') def encode_part(part): return base64.urlsafe_b64encode(part).replace(b'=', b'') # doesn't work, needs to be fixed, one day :P def build_jwt(header, payload, key, alg='hmac'): message = b'.'.join([ encode_part(header), encode_part(payload) ]) print(message) if alg == 'hmac': signature = hmac.new(key.encode(), message, hashlib.sha256).hexdigest() print(encode_part(bytes(signature, encoding='utf8'))) elif alg == 'none': # if alg is set to 'none' signature = '' else: pass return f'{message}.{signature}' parts = get_parts(sys.argv[1]) header = decode_part(parts['header']) print(header) payload = decode_part(parts['payload']) print(payload)
{ "pile_set_name": "Github" }
source = {} sink = {} pump = {} filter = {} -- source.chain dofile("ex6.lua") -- source.file dofile("ex5.lua") -- encode require"mime" encode = mime.encode -- sink.chain require"ltn12" sink.chain = ltn12.sink.chain -- wrap wrap = mime.wrap -- sink.file sink.file = ltn12.sink.file -- pump.all dofile("ex10.lua") -- run test dofile("ex11.lua")
{ "pile_set_name": "Github" }
<?php /** * PHP Command Line Tools * * This source file is subject to the MIT license that is bundled * with this package in the file LICENSE. * * @author James Logsdon <[email protected]> * @copyright 2010 James Logsdom (http://girsbrain.org) * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ namespace cli\table; use cli\Colors; use cli\Shell; /** * The ASCII renderer renders tables with ASCII borders. */ class Ascii extends Renderer { protected $_characters = array( 'corner' => '+', 'line' => '-', 'border' => '|', 'padding' => ' ', ); protected $_border = null; protected $_constraintWidth = null; /** * Set the widths of each column in the table. * * @param array $widths The widths of the columns. */ public function setWidths(array $widths) { if ( is_null( $this->_constraintWidth ) ) { $this->_constraintWidth = (int) Shell::columns(); } $col_count = count( $widths ); $col_borders_count = $col_count * strlen( $this->_characters['border'] ); $table_borders_count = strlen( $this->_characters['border'] ) * 1; $col_padding_count = $col_count * strlen( $this->_characters['padding'] ) * 2; $max_width = $this->_constraintWidth - $col_borders_count - $table_borders_count - $col_padding_count; if ( $widths && $max_width && array_sum( $widths ) > $max_width ) { $avg = floor( $max_width / count( $widths ) ); $resize_widths = array(); $extra_width = 0; foreach( $widths as $width ) { if ( $width > $avg ) { $resize_widths[] = $width; } else { $extra_width = $extra_width + ( $avg - $width ); } } if ( ! empty( $resize_widths ) && $extra_width ) { $avg_extra_width = floor( $extra_width / count( $resize_widths ) ); foreach( $widths as &$width ) { if ( in_array( $width, $resize_widths ) ) { $width = $avg + $avg_extra_width; $extra_width = $extra_width - $avg_extra_width; array_shift( $resize_widths ); // Last item gets the cake if ( empty( $resize_widths ) ) { $width = $width + $extra_width; } } } } } $this->_widths = $widths; } /** * Set the constraint width for the table * * @param int $constraintWidth */ public function setConstraintWidth( $constraintWidth ) { $this->_constraintWidth = $constraintWidth; } /** * Set the characters used for rendering the Ascii table. * * The keys `corner`, `line` and `border` are used in rendering. * * @param $characters array Characters used in rendering. */ public function setCharacters(array $characters) { $this->_characters = array_merge($this->_characters, $characters); } /** * Render a border for the top and bottom and separating the headers from the * table rows. * * @return string The table border. */ public function border() { if (!isset($this->_border)) { $this->_border = $this->_characters['corner']; foreach ($this->_widths as $width) { $this->_border .= str_repeat($this->_characters['line'], $width + 2); $this->_border .= $this->_characters['corner']; } } return $this->_border; } /** * Renders a row for output. * * @param array $row The table row. * @return string The formatted table row. */ public function row( array $row ) { $extra_row_count = 0; if ( count( $row ) > 0 ) { $extra_rows = array_fill( 0, count( $row ), array() ); foreach( $row as $col => $value ) { $value = str_replace( PHP_EOL, ' ', $value ); $col_width = $this->_widths[ $col ]; $original_val_width = Colors::length( $value ); if ( $original_val_width > $col_width ) { $row[ $col ] = \cli\safe_substr( $value, 0, $col_width ); $value = \cli\safe_substr( $value, $col_width, $original_val_width ); $i = 0; do { $extra_value = \cli\safe_substr( $value, 0, $col_width ); $val_width = \cli\safe_strlen( $extra_value ); if ( $val_width ) { $extra_rows[ $col ][] = $extra_value; $value = \cli\safe_substr( $value, $col_width, $original_val_width ); $i++; if ( $i > $extra_row_count ) { $extra_row_count = $i; } } } while( $value ); } } } $row = array_map(array($this, 'padColumn'), $row, array_keys($row)); array_unshift($row, ''); // First border array_push($row, ''); // Last border $ret = join($this->_characters['border'], $row); if ( $extra_row_count ) { foreach( $extra_rows as $col => $col_values ) { while( count( $col_values ) < $extra_row_count ) { $col_values[] = ''; } } do { $row_values = array(); $has_more = false; foreach( $extra_rows as $col => &$col_values ) { $row_values[ $col ] = array_shift( $col_values ); if ( count( $col_values ) ) { $has_more = true; } } $row_values = array_map(array($this, 'padColumn'), $row_values, array_keys($row_values)); array_unshift($row_values, ''); // First border array_push($row_values, ''); // Last border $ret .= PHP_EOL . join($this->_characters['border'], $row_values); } while( $has_more ); } return $ret; } private function padColumn($content, $column) { return $this->_characters['padding'] . Colors::pad($content, $this->_widths[$column]) . $this->_characters['padding']; } }
{ "pile_set_name": "Github" }
Simple table with caption: || Right || Left || Center || Default || | 12 | 12 | 12 | 12 | | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 | Simple table without caption: || Right || Left || Center || Default || | 12 | 12 | 12 | 12 | | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 | Simple table indented two spaces: || Right || Left || Center || Default || | 12 | 12 | 12 | 12 | | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 | Multiline table with caption: || Centered Header || Left Aligned || Right Aligned || Default aligned || | First | row | 12.0 | Example of a row that spans multiple lines. | | Second | row | 5.0 | Here’s another one. Note the blank line between rows. | Multiline table without caption: || Centered Header || Left Aligned || Right Aligned || Default aligned || | First | row | 12.0 | Example of a row that spans multiple lines. | | Second | row | 5.0 | Here’s another one. Note the blank line between rows. | Table without column headers: | 12 | 12 | 12 | 12 | | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 | Multiline table without column headers: | First | row | 12.0 | Example of a row that spans multiple lines. | | Second | row | 5.0 | Here’s another one. Note the blank line between rows. |
{ "pile_set_name": "Github" }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /* | ------------------------------------------------------------------- | AUTO-LOADER (module-specific) | ------------------------------------------------------------------- | For detailed usage, please check the comments from original file: | /application/config/autoload.php | */ $autoload['packages'] = array(); $autoload['libraries'] = array(); $autoload['drivers'] = array(); $autoload['helper'] = array(); $autoload['config'] = array(); $autoload['language'] = array(); $autoload['model'] = array( 'api_key_model' => 'api_keys', 'user_model' => 'users' );
{ "pile_set_name": "Github" }
var utils = require('./connection_utils'), inherits = require('util').inherits, net = require('net'), timers = require('timers'), EventEmitter = require('events').EventEmitter, inherits = require('util').inherits, MongoReply = require("../responses/mongo_reply").MongoReply, Connection = require("./connection").Connection; // Set processor, setImmediate if 0.10 otherwise nextTick var processor = require('../utils').processor(); var ConnectionPool = exports.ConnectionPool = function(host, port, poolSize, bson, socketOptions) { if(typeof host !== 'string') { throw new Error("host must be specified [" + host + "]"); } // Set up event emitter EventEmitter.call(this); // Keep all options for the socket in a specific collection allowing the user to specify the // Wished upon socket connection parameters this.socketOptions = typeof socketOptions === 'object' ? socketOptions : {}; this.socketOptions.host = host; this.socketOptions.port = port; this.socketOptions.domainSocket = false; this.bson = bson; // PoolSize is always + 1 for special reserved "measurment" socket (like ping, stats etc) this.poolSize = poolSize; this.minPoolSize = Math.floor(this.poolSize / 2) + 1; // Check if the host is a socket if(host.match(/^\//)) { this.socketOptions.domainSocket = true; } else if(typeof port === 'string') { try { port = parseInt(port, 10); } catch(err) { new Error("port must be specified or valid integer[" + port + "]"); } } else if(typeof port !== 'number') { throw new Error("port must be specified [" + port + "]"); } // Set default settings for the socket options utils.setIntegerParameter(this.socketOptions, 'timeout', 0); // Delay before writing out the data to the server utils.setBooleanParameter(this.socketOptions, 'noDelay', true); // Delay before writing out the data to the server utils.setIntegerParameter(this.socketOptions, 'keepAlive', 0); // Set the encoding of the data read, default is binary == null utils.setStringParameter(this.socketOptions, 'encoding', null); // Allows you to set a throttling bufferSize if you need to stop overflows utils.setIntegerParameter(this.socketOptions, 'bufferSize', 0); // Internal structures this.openConnections = []; // Assign connection id's this.connectionId = 0; // Current index for selection of pool connection this.currentConnectionIndex = 0; // The pool state this._poolState = 'disconnected'; // timeout control this._timeout = false; // Time to wait between connections for the pool this._timeToWait = 10; } inherits(ConnectionPool, EventEmitter); ConnectionPool.prototype.setMaxBsonSize = function(maxBsonSize) { if(maxBsonSize == null){ maxBsonSize = Connection.DEFAULT_MAX_BSON_SIZE; } for(var i = 0; i < this.openConnections.length; i++) { this.openConnections[i].maxBsonSize = maxBsonSize; this.openConnections[i].maxBsonSettings.maxBsonSize = maxBsonSize; } } ConnectionPool.prototype.setMaxMessageSizeBytes = function(maxMessageSizeBytes) { if(maxMessageSizeBytes == null){ maxMessageSizeBytes = Connection.DEFAULT_MAX_MESSAGE_SIZE; } for(var i = 0; i < this.openConnections.length; i++) { this.openConnections[i].maxMessageSizeBytes = maxMessageSizeBytes; this.openConnections[i].maxBsonSettings.maxMessageSizeBytes = maxMessageSizeBytes; } } // Start a function var _connect = function(_self) { // return new function() { // Create a new connection instance var connection = new Connection(_self.connectionId++, _self.socketOptions); // Set logger on pool connection.logger = _self.logger; // Connect handler connection.on("connect", function(err, connection) { // Add connection to list of open connections _self.openConnections.push(connection); // If the number of open connections is equal to the poolSize signal ready pool if(_self.openConnections.length === _self.poolSize && _self._poolState !== 'disconnected') { // Set connected _self._poolState = 'connected'; // Emit pool ready _self.emit("poolReady"); } else if(_self.openConnections.length < _self.poolSize) { // Wait a little bit of time to let the close event happen if the server closes the connection // so we don't leave hanging connections around if(typeof _self._timeToWait == 'number') { setTimeout(function() { // If we are still connecting (no close events fired in between start another connection) if(_self._poolState == 'connecting') { _connect(_self); } }, _self._timeToWait); } else { processor(function() { // If we are still connecting (no close events fired in between start another connection) if(_self._poolState == 'connecting') { _connect(_self); } }); } } }); var numberOfErrors = 0 // Error handler connection.on("error", function(err, connection, error_options) { numberOfErrors++; // If we are already disconnected ignore the event if(_self._poolState != 'disconnected' && _self.listeners("error").length > 0) { _self.emit("error", err, connection, error_options); } // Close the connection connection.close(); // Set pool as disconnected _self._poolState = 'disconnected'; // Stop the pool _self.stop(); }); // Close handler connection.on("close", function() { // If we are already disconnected ignore the event if(_self._poolState !== 'disconnected' && _self.listeners("close").length > 0) { _self.emit("close"); } // Set disconnected _self._poolState = 'disconnected'; // Stop _self.stop(); }); // Timeout handler connection.on("timeout", function(err, connection) { // If we are already disconnected ignore the event if(_self._poolState !== 'disconnected' && _self.listeners("timeout").length > 0) { _self.emit("timeout", err); } // Close the connection connection.close(); // Set disconnected _self._poolState = 'disconnected'; _self.stop(); }); // Parse error, needs a complete shutdown of the pool connection.on("parseError", function() { // If we are already disconnected ignore the event if(_self._poolState !== 'disconnected' && _self.listeners("parseError").length > 0) { _self.emit("parseError", new Error("parseError occured")); } // Set disconnected _self._poolState = 'disconnected'; _self.stop(); }); connection.on("message", function(message) { _self.emit("message", message); }); // Start connection in the next tick connection.start(); // }(); } // Start method, will throw error if no listeners are available // Pass in an instance of the listener that contains the api for // finding callbacks for a given message etc. ConnectionPool.prototype.start = function() { var markerDate = new Date().getTime(); var self = this; if(this.listeners("poolReady").length == 0) { throw "pool must have at least one listener ready that responds to the [poolReady] event"; } // Set pool state to connecting this._poolState = 'connecting'; this._timeout = false; _connect(self); } // Restart a connection pool (on a close the pool might be in a wrong state) ConnectionPool.prototype.restart = function() { // Close all connections this.stop(false); // Now restart the pool this.start(); } // Stop the connections in the pool ConnectionPool.prototype.stop = function(removeListeners) { removeListeners = removeListeners == null ? true : removeListeners; // Set disconnected this._poolState = 'disconnected'; // Clear all listeners if specified if(removeListeners) { this.removeAllEventListeners(); } // Close all connections for(var i = 0; i < this.openConnections.length; i++) { this.openConnections[i].close(); } // Clean up this.openConnections = []; } // Check the status of the connection ConnectionPool.prototype.isConnected = function() { // return this._poolState === 'connected'; return this.openConnections.length > 0 && this.openConnections[0].isConnected(); } // Checkout a connection from the pool for usage, or grab a specific pool instance ConnectionPool.prototype.checkoutConnection = function(id) { var index = (this.currentConnectionIndex++ % (this.openConnections.length)); var connection = this.openConnections[index]; return connection; } ConnectionPool.prototype.getAllConnections = function() { return this.openConnections; } // Remove all non-needed event listeners ConnectionPool.prototype.removeAllEventListeners = function() { this.removeAllListeners("close"); this.removeAllListeners("error"); this.removeAllListeners("timeout"); this.removeAllListeners("connect"); this.removeAllListeners("end"); this.removeAllListeners("parseError"); this.removeAllListeners("message"); this.removeAllListeners("poolReady"); }
{ "pile_set_name": "Github" }
PinnedItems ============================= There are situations where a screen has an area for favorites or pinned items. This Component allows adding items to that area. Most of the time, the Component should not be used directly as, for example, `ComplementaryArea` Component already renders PinnedItems that allow opening complementary areas marked as favorite. When used directly, items should not unconditionally add items should only be added if they are marked as "favorite" or verify other conditions. ## Props ### children The content to be displayed for the pinned items. Most of the time, a button with an icon should be used. - Type: `Element` - Required: Yes ### scope The scope of the pinned items area e.g: "core/edit-post", "core/edit-site", "myplugin/custom-screen-a", - Type: `String` - Required: Yes PinnedItems.Slot ============================= A slot that renders the pinned items. ## Props ### scope The scope of the pinned items area e.g: "core/edit-post", "core/edit-site", "myplugin/custom-screen-a", - Type: `String` - Required: Yes
{ "pile_set_name": "Github" }
/* * (C) Copyright 2005 * Stefan Roese, DENX Software Engineering, [email protected]. * * Copyright (C) 2002 Scott McNutt <[email protected]> * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <ppc_asm.tmpl> #include <config.h> /* General */ #define TLB_VALID 0x00000200 /* Supported page sizes */ #define SZ_1K 0x00000000 #define SZ_4K 0x00000010 #define SZ_16K 0x00000020 #define SZ_64K 0x00000030 #define SZ_256K 0x00000040 #define SZ_1M 0x00000050 #define SZ_16M 0x00000070 #define SZ_256M 0x00000090 /* Storage attributes */ #define SA_W 0x00000800 /* Write-through */ #define SA_I 0x00000400 /* Caching inhibited */ #define SA_M 0x00000200 /* Memory coherence */ #define SA_G 0x00000100 /* Guarded */ #define SA_E 0x00000080 /* Endian */ /* Access control */ #define AC_X 0x00000024 /* Execute */ #define AC_W 0x00000012 /* Write */ #define AC_R 0x00000009 /* Read */ /* Some handy macros */ #define EPN(e) ((e) & 0xfffffc00) #define TLB0(epn,sz) ( (EPN((epn)) | (sz) | TLB_VALID ) ) #define TLB1(rpn,erpn) ( ((rpn)&0xfffffc00) | (erpn) ) #define TLB2(a) ( (a)&0x00000fbf ) #define tlbtab_start\ mflr r1 ;\ bl 0f ; #define tlbtab_end\ .long 0, 0, 0 ; \ 0: mflr r0 ; \ mtlr r1 ; \ blr ; #define tlbentry(epn,sz,rpn,erpn,attr)\ .long TLB0(epn,sz),TLB1(rpn,erpn),TLB2(attr) /************************************************************************** * TLB TABLE * * This table is used by the cpu boot code to setup the initial tlb * entries. Rather than make broad assumptions in the cpu source tree, * this table lets each board set things up however they like. * * Pointer to the table is returned in r1 * *************************************************************************/ .section .bootpg,"ax" .globl tlbtab tlbtab: tlbtab_start tlbentry( 0xf0000000, SZ_256M, 0xf0000000, 1, AC_R|AC_W|AC_X|SA_G|SA_I) tlbentry( CONFIG_SYS_PERIPHERAL_BASE, SZ_256M, 0x40000000, 1, AC_R|AC_W|SA_G|SA_I) tlbentry( CONFIG_SYS_ISRAM_BASE, SZ_4K, 0x80000000, 0, AC_R|AC_W|AC_X ) tlbentry( CONFIG_SYS_ISRAM_BASE + 0x1000, SZ_4K, 0x80001000, 0, AC_R|AC_W|AC_X ) tlbentry( CONFIG_SYS_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I ) tlbentry( CONFIG_SYS_PCI_BASE, SZ_256M, 0x00000000, 2, AC_R|AC_W|SA_G|SA_I ) tlbentry( CONFIG_SYS_PCI_MEMBASE, SZ_256M, 0x00000000, 3, AC_R|AC_W|SA_G|SA_I ) tlbtab_end
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright (c) 2009,2011 QNX Software Systems * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * QNX Software Systems (Alena Laskavaia) - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.codan.core.model; /** * Additional interface to the problem kind to quiry either it supports multiple * instances or not * * @since 2.0 */ public interface IProblemMultiple { /** * * @return true if problem can be replicated by the user, i.e. multiple is * true in the extension */ public boolean isMultiple(); /** * @return true if this is original problem, false if it replica */ public boolean isOriginal(); }
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S12.14_A7_T3; * @section: 12.14; * @assertion: Evaluating the nested productions TryStatement; * @description: Checking if the production of nested TryStatement statements evaluates correct; */ // CHECK#1 try{ try{ throw "ex2"; } catch(er2){ if (er2!=="ex2") $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+er2); throw "ex1"; } finally{ throw "ex3"; } } catch(er1){ if (er1!=="ex3") $ERROR('#1.2: Exception === "ex3". Actual: Exception ==='+er1); if (er1==="ex2") $ERROR('#1.3: Exception !=="ex2". Actual: catch previous catched exception'); if (er1==="ex1") $ERROR('#1.4: Exception !=="ex1". Actual: catch previous embedded exception'); } // CHECK#2 var c2=0; try{ throw "ex1"; } catch(er1){ try{ throw "ex2"; } catch(er1){ if (er1==="ex1") $ERROR('#2.1: Exception !=="ex1". Actual: catch previous catched exception'); if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+er1); } finally{ c2=1; } if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+er1); if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous embedded exception'); } if (c2!==1) $ERROR('#2.5: "finally" block must be evaluated'); // CHECK#3 var c3=0; try{ throw "ex1"; } catch(er1){ if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1); } finally{ try{ throw "ex2"; } catch(er1){ if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous catched exception'); if (er1!=="ex2") $ERROR('#3.3: Exception === "ex2". Actual: Exception ==='+er1); } finally{ c3=1; } } if (c3!==1) $ERROR('#3.4: "finally" block must be evaluated'); // CHECK#4 var c4=0; try{ try{ throw "ex1"; } catch(er1){ try{ throw "ex2"; } catch(er1){ if (er1==="ex1") $ERROR('#4.1: Exception !=="ex2". Actual: catch previous catched exception'); if (er1!=="ex2") $ERROR('#4.2: Exception === "ex2". Actual: Exception ==='+er1); } finally{ c4=2; throw "ex3"; } if (er1!=="ex1") $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+er1); if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: catch previous catched exception'); if (er1==="ex3") $ERROR('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception'); } finally{ c4*=2; } } catch(er1){} if (c4!==4) $ERROR('#4.6: "finally" block must be evaluated'); // CHECK#5 var c5=0; try{ try{ throw "ex2"; } catch(er1){ if (er1!=="ex2") $ERROR('#5.1: Exception === "ex2". Actual: Exception ==='+er1); } finally{ throw "ex3"; } throw "ex1"; } catch(er1){ if (er1!=="ex3") $ERROR('#5.2: Exception === "ex3". Actual: Exception ==='+er1); if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous catched exception'); if (er1==="ex1") $ERROR('#5.4: Exception !=="ex1". Actual: catch previous embedded exception'); } finally{ c5=1; } if (c5!==1) $ERROR('#5.5: "finally" block must be evaluated'); // CHECK#6 var c6=0; try{ try{ throw "ex1"; } catch(er1){ if (er1!=="ex1") $ERROR('#6.1: Exception === "ex1". Actual: Exception ==='+er1); } finally{ c6=2; } } finally{ c6*=2; } if (c6!==4) $ERROR('#6.2: "finally" block must be evaluated'); // CHECK#7 var c7=0; try{ try{ throw "ex1"; } finally{ try{ c7=1; throw "ex2"; } catch(er1){ if (er1!=="ex2") $ERROR('#7.1: Exception === "ex2". Actual: Exception ==='+er1); if (er1==="ex1") $ERROR('#7.2: Exception !=="ex2". Actual: catch previous catched exception'); c7++; } finally{ c7*=2; } } } catch(er1){ if (er1!=="ex1") $ERROR('#7.3: Exception === "ex1". Actual: Exception ==='+er1); } if (c7!==4) $ERROR('#7.4: "finally" block must be evaluated');
{ "pile_set_name": "Github" }
<?php /** * Open Source Social Network * * @package Open Source Social Network * @author Open Social Website Core Team <[email protected]> * @copyright (C) SOFTLAB24 LIMITED * @license Open Source Social Network License (OSSN LICENSE) http://www.opensource-socialnetwork.org/licence * @link https://www.opensource-socialnetwork.org/ */ $type = input('type'); $types = array( 'friends', 'public' ); if(!in_array($type, $types)) { ossn_trigger_message(ossn_print('ossn:wall:settings:save:error'), 'error'); redirect(REF); } if(ossn_set_homepage_wall_access($type)) { ossn_trigger_message(ossn_print('ossn:wall:settings:saved')); } else { ossn_trigger_message(ossn_print('ossn:wall:settings:save:error'), 'error'); } redirect(REF);
{ "pile_set_name": "Github" }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.process = void 0; var _Commom = require("../utils/Commom"); var __assign = void 0 && (void 0).__assign || function () { __assign = Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } } return t; }; return __assign.apply(this, arguments); }; function setGuideLine(chart, item) { var newItem = _Commom.Util.omit(item, ['type']); chart.guide().line(__assign({}, newItem)); } function setGuideTag(chart, item) { var newItem = _Commom.Util.omit(item, ['type']); chart.guide().tag(__assign({}, newItem)); } function setGuideArc(chart, item) { if (item.quickType === 'parallel') { var data = item.data; chart.guide().arc(__assign({ start: ['min', data], end: ['max', data] }, item)); chart.guide().arc(__assign({ start: ['max', data], end: ['min', data] }, item)); } else if (item.quickType === 'normal') { var data = item.data; chart.guide().line(__assign({ start: [data, 'min'], end: [data, 'max'] }, item)); } else { var newItem = _Commom.Util.omit(item, ['type']); chart.guide().arc(__assign({}, newItem)); } } function setGuideText(chart, item) { var newItem = _Commom.Util.omit(item, ['type']); chart.guide().text(__assign({}, newItem)); } function setGuideHtml(chart, item) { var newItem = _Commom.Util.omit(item, ['type']); chart.guide().html(__assign({}, newItem)); } function setGuideRect(chart, item) { var newItem = _Commom.Util.omit(item, ['type']); chart.guide().rect(__assign({}, newItem)); } var process = function process(chart, config) { var cGuide = _Commom.Util.deepClone(config.guide); var isArr = _Commom.Util.isArray(cGuide); if (_Commom.Util.isNil(cGuide) || _Commom.Util.isEmpty(cGuide)) { return; } var arrGuide = isArr ? cGuide : [cGuide]; chart.guide().clear(); arrGuide.forEach(function (res) { if (res.type === 'line') { setGuideLine(chart, res); } else if (res.type === 'text') { setGuideText(chart, res); } else if (res.type === 'tag') { setGuideTag(chart, res); } else if (res.type === 'rect') { setGuideRect(chart, res); } else if (res.type === 'arc') { setGuideArc(chart, res); } else if (res.type === 'html') { setGuideHtml(chart, res); } }); }; exports.process = process;
{ "pile_set_name": "Github" }
module Vagrant module Plugin autoload :V1, "vagrant/plugin/v1" autoload :V2, "vagrant/plugin/v2" autoload :Manager, "vagrant/plugin/manager" autoload :StateFile, "vagrant/plugin/state_file" end end
{ "pile_set_name": "Github" }
var React = require('react'); var assign = require('domkit/appendVendorPrefix'); var insertKeyframesRule = require('domkit/insertKeyframesRule'); /** * @type {Object} */ var rightRotateKeyframes = { '0%': { transform: 'rotateX(0deg) rotateY(0deg) rotateZ(0deg)' }, '100%': { transform: 'rotateX(180deg) rotateY(360deg) rotateZ(360deg)' } }; /** * @type {Object} */ var leftRotateKeyframes = { '0%': { transform: 'rotateX(0deg) rotateY(0deg) rotateZ(0deg)' }, '100%': { transform: 'rotateX(360deg) rotateY(180deg) rotateZ(360deg)' } }; /** * @type {String} */ var rightRotateAnimationName = insertKeyframesRule(rightRotateKeyframes); /** * @type {String} */ var leftRotateAnimationName = insertKeyframesRule(leftRotateKeyframes); var Loader = React.createClass({ /** * @type {Object} */ propTypes: { loading: React.PropTypes.bool, color: React.PropTypes.string, size: React.PropTypes.string, margin: React.PropTypes.string }, /** * @return {Object} */ getDefaultProps: function() { return { loading: true, color: '#ffffff', size: '60px' }; }, /** * @param {String} size * @return {Object} */ getCircleStyle: function(size) { return { width: size, height: size, border: size/10 +'px solid ' + this.props.color, opacity: 0.4, borderRadius: '100%', verticalAlign: this.props.verticalAlign }; }, /** * @param {Number} i * @return {Object} */ getAnimationStyle: function(i) { var animation = [i==1? rightRotateAnimationName: leftRotateAnimationName, '2s', '0s', 'infinite', 'linear'].join(' '); var animationFillMode = 'forwards'; var perspective = '800px'; return { perspective: perspective, animation: animation, animationFillMode: animationFillMode }; }, /** * @param {Number} i * @return {Object} */ getStyle: function(i) { var size = parseInt(this.props.size); if (i) { return assign( this.getCircleStyle(size), this.getAnimationStyle(i), { position: 'absolute', top: 0, left: 0 } ); } return { width: size, height: size, position: 'relative' }; }, /** * @param {Boolean} loading * @return {ReactComponent || null} */ renderLoader: function(loading) { if (loading) { return ( <div id={this.props.id} className={this.props.className}> <div style={this.getStyle(0)}> <div style={this.getStyle(1)}></div> <div style={this.getStyle(2)}></div> </div> </div> ); } return null; }, render: function() { return this.renderLoader(this.props.loading); } }); module.exports = Loader;
{ "pile_set_name": "Github" }
module Facter module Util module PuppetSettings # This method is intended to provide a convenient way to evaluate a # Facter code block only if Puppet is loaded. This is to account for the # situation where the fact happens to be in the load path, but Puppet is # not loaded for whatever reason. Perhaps the user is simply running # facter without the --puppet flag and they happen to be working in a lib # directory of a module. def self.with_puppet begin Module.const_get("Puppet") rescue NameError nil else yield end end end end end
{ "pile_set_name": "Github" }
import { MiniBrowser } from "./mini-browser"; export { MiniBrowser };
{ "pile_set_name": "Github" }
5000 2800 85 505 630 98 767 773 392 592 650 316 362 265 519 556 85 315 27 477 247 225 377 356 248 772 501 338 150 221 36 123 48 199 686 427 401 601 110 64 108 760 469 748 332 765 622 676 135 449 582 714 494 582 374 266 551 361 754 704 570 339 537 678 661 114 440 318 352 498 228 176 644 21 187 146 454 432 704 759 595 510 37 25 195 526 448 189 133 106 115 508 710 647 675 209 778 276 468 83 515 267 56 436 419 470 410 317 293 402 23 472 92 216 284 225 680 413 359 37 267 229 685 700 324 195 192 727 435 753 624 62 688 345 293 127 256 164 520 202 345 266 452 426 777 10 410 347 596 465 616 714 623 275 506 534 578 92 532 493 451 687 222 366 117 365 369 302 691 742 625 705 706 52 67 537 116 621 208 164 313 462 406 400 464 778 490 11 704 532 22 525 692 523 140 117 118 169 156 94 539 115 714 168 75 182 534 765 2 272 583 706 152 613 454 335 514 327 171 185 620 675 703 454 265 518 459 104 717 658 567 383 215 236 505 379 152 592 630 741 84 44 469 576 589 137 294 233 435 108 576 156 578 206 713 460 48 594 264 668 245 181 330 406 85 724 374 111 240 159 441 226 635 648 775 171 171 145 484 84 97 731 592 496 557 632 664 345 143 363 762 659 619 116 226 166 462 553 652 737 361 740 275 10 528 345 160 157 81 315 2 147 344 308 452 251 575 471 247 22 439 490 442 197 7 536 371 455 521 397 445 169 25 621 117 522 92 639 181 40 189 667 144 323 547 388 271 374 745 304 251 245 772 342 560 613 526 390 305 106 421 577 268 428 62 362 34 108 627 643 708 348 192 245 497 60 322 682 258 729 687 160 273 84 302 91 330 394 205 239 686 214 4 442 315 417 106 390 340 372 227 5 39 235 21 107 622 748 380 84 642 418 254 532 280 97 380 651 103 1 767 148 772 123 707 360 198 774 703 85 375 264 295 636 83 256 681 115 49 82 527 509 158 243 385 405 198 688 405 286 478 355 443 143 644 389 152 477 560 158 289 293 168 360 559 630 660 560 445 38 93 593 684 670 493 698 598 466 242 708 280 741 66 60 281 499 755 628 74 522 708 490 688 326 700 561 123 232 435 357 58 678 78 31 627 448 702 551 507 213 46 590 533 690 81 326 152 686 779 433 701 274 440 524 468 726 49 187 256 7 203 600 184 741 59 582 405 671 715 286 312 245 94 275 475 263 577 58 465 495 456 637 681 298 247 708 711 512 598 69 741 140 351 147 64 750 295 711 254 234 265 695 649 13 394 115 251 687 392 193 591 598 513 640 594 229 251 258 208 196 438 18 319 506 667 591 104 354 200 403 411 312 668 98 624 750 677 457 144 198 431 554 652 608 135 744 327 442 627 84 717 54 509 628 28 325 553 675 225 352 276 699 430 468 475 722 660 740 168 315 657 654 526 493 30 480 740 553 42 480 769 259 96 283 613 463 508 132 44 152 583 445 424 277 728 290 201 482 421 448 445 171 643 289 405 616 10 179 72 57 448 103 715 221 175 296 253 691 655 221 433 247 384 147 438 350 518 712 152 141 762 763 83 754 83 275 483 513 35 353 387 666 443 207 541 537 157 684 30 421 354 624 259 318 638 99 5 377 315 742 310 552 758 204 169 492 149 562 523 686 423 507 725 353 288 125 450 381 98 427 84 277 678 685 247 462 320 302 107 535 40 104 339 475 317 26 51 619 126 156 458 476 262 503 165 444 597 258 390 474 30 663 640 563 369 162 494 328 370 325 26 449 147 402 85 58 211 512 54 401 174 709 641 193 208 347 741 281 620 306 375 179 595 594 384 657 690 704 379 754 330 313 444 19 686 516 191 219 676 487 673 8 186 526 357 26 457 193 299 415 136 499 320 59 114 717 59 7 333 294 59 52 472 86 565 397 261 637 99 674 552 474 159 516 585 441 444 29 505 175 617 682 642 753 590 142 162 545 772 349 252 521 24 135 460 591 566 45 732 551 60 113 438 518 259 651 770 129 277 21 315 469 773 577 21 494 508 542 576 527 513 194 112 594 677 275 389 323 411 297 111 316 529 461 157 84 238 8 285 36 418 546 161 404 328 748 528 310 677 118 632 15 187 648 764 287 745 700 698 344 84 544 559 646 111 49 246 412 601 578 755 766 411 635 310 135 227 547 127 363 163 606 554 223 63 394 676 527 398 64 558 368 94 593 680 235 251 220 72 380 553 719 414 301 680 529 169 588 260 607 271 638 597 221 629 93 284 448 729 460 84 413 593 328 280 432 575 576 678 63 774 283 489 681 303 346 358 421 384 511 488 688 135 286 467 523 659 292 372 410 629 722 167 565 176 23 436 159 550 715 29 686 144 667 548 576 736 397 776 261 505 370 778 213 290 360 226 413 123 104 448 605 568 70 186 114 619 345 30 441 111 271 487 740 125 513 317 554 72 151 200 256 389 238 404 314 618 198 702 278 239 116 665 372 733 558 466 413 606 260 513 7 742 185 444 696 24 611 46 435 122 531 467 100 278 625 441 765 659 309 643 278 509 142 26 708 613 622 245 593 623 38 488 694 406 48 529 707 772 43 663 765 623 614 199 455 726 423 766 768 429 465 24 215 272 600 429 714 49 604 479 699 420 232 490 175 394 178 13 225 364 193 650 218 337 163 690 42 414 130 633 85 547 401 158 552 202 684 740 720 78 75 56 635 20 678 614 28 778 259 327 541 336 318 270 647 467 408 705 435 57 622 85 117 512 402 214 333 234 768 770 16 71 592 577 774 758 703 754 710 430 408 524 509 312 633 324 697 674 310 59 245 297 208 266 662 173 594 668 168 558 56 738 465 118 254 650 716 528 121 693 188 440 354 637 652 474 81 470 181 531 404 685 111 230 466 683 514 126 122 50 541 605 3 502 52 480 697 317 486 750 666 466 504 414 265 90 452 660 58 634 23 579 589 114 200 62 233 28 747 635 491 175 517 305 665 517 106 68 438 439 662 521 427 587 88 514 474 114 127 385 484 440 512 260 28 360 726 487 717 191 168 262 224 3 343 130 477 219 122 546 666 534 270 157 390 195 226 267 508 432 256 165 272 158 567 126 349 651 430 747 326 590 447 25 690 311 547 289 631 475 25 118 486 137 616 486 101 529 398 4 132 735 454 636 270 456 768 138 52 120 413 435 609 363 317 256 134 119 263 268 440 338 154 731 717 176 656 632 757 83 765 625 480 321 559 649 474 559 388 692 778 689 485 741 362 228 221 654 436 28 624 634 404 213 126 280 268 76 642 107 537 547 528 537 190 179 87 169 493 656 525 509 123 436 79 104 67 518 705 43 519 429 359 507 157 106 96 580 278 338 415 181 469 533 323 274 188 133 214 593 520 387 465 371 194 415 255 217 723 438 353 109 141 392 367 425 232 376 110 327 65 60 529 214 208 83 488 387 369 758 113 519 93 8 131 600 383 387 140 192 557 518 708 269 462 775 485 88 253 704 297 716 50 713 351 270 452 758 256 11 244 360 500 622 489 762 449 491 433 212 692 311 135 48 616 421 204 224 561 712 169 1 720 718 391 189 559 258 722 146 600 385 63 626 762 93 226 137 445 63 170 293 563 167 686 48 658 266 264 58 743 716 255 755 505 345 361 115 274 672 668 646 220 475 442 318 168 613 437 343 52 638 196 654 59 154 704 442 135 293 26 502 600 687 262 308 516 584 444 321 144 649 622 207 633 673 131 765 457 339 228 6 432 730 20 639 326 466 554 427 240 108 566 342 587 113 441 590 639 411 501 335 71 733 239 469 510 157 84 166 43 108 352 623 643 111 267 361 494 332 689 65 558 761 337 393 9 293 167 104 622 601 654 510 545 620 272 739 679 765 206 478 505 414 774 138 410 750 763 420 186 209 78 383 204 532 89 263 438 561 771 482 181 720 582 42 183 58 99 27 704 635 70 778 21 489 299 506 12 342 366 281 753 313 711 35 73 151 261 488 173 692 514 738 333 587 747 75 773 175 721 502 680 592 99 89 638 620 234 22 35 628 464 349 193 560 626 590 377 714 596 303 394 515 11 636 106 363 481 581 725 173 394 304 61 304 492 704 159 330 760 435 589 515 84 380 48 733 28 597 85 125 31 778 19 254 567 338 696 429 340 767 706 682 412 250 139 171 608 722 197 585 560 381 379 96 131 31 513 500 606 611 205 138 353 477 690 419 504 584 336 684 534 272 22 144 403 660 448 771 773 325 403 295 59 478 706 372 14 415 528 437 17 110 406 252 8 383 470 81 759 713 502 405 515 774 498 197 661 408 369 255 644 380 297 749 133 197 745 635 278 9 103 574 608 707 266 650 251 553 5 155 676 342 498 641 89 593 344 187 224 104 117 201 777 760 511 438 540 165 85 114 747 130 602 713 61 463 85 550 664 596 513 389 744 425 261 162 131 613 180 680 428 495 698 65 764 342 729 153 42 143 353 407 3 102 265 610 166 733 91 152 1 456 211 582 193 201 106 164 148 88 603 10 312 323 133 100 551 620 164 36 151 84 60 487 494 419 143 380 641 218 777 335 432 328 489 191 762 517 138 209 121 642 242 591 621 304 331 659 683 79 173 658 436 776 226 282 176 282 599 747 168 773 66 500 748 106 399 594 648 711 485 575 751 162 142 480 431 337 103 611 266 760 64 738 572 549 107 729 700 15 435 418 392 415 177 382 756 312 107 300 82 314 425 505 194 330 71 159 36 494 396 718 88 140 501 443 180 132 588 712 571 184 602 312 8 427 418 25 94 207 454 603 204 529 669 547 111 159 385 19 359 696 323 671 351 643 96 549 739 466 13 607 168 159 417 224 364 443 450 600 435 502 566 285 313 424 644 5 408 53 476 601 51 266 745 307 429 575 373 172 609 91 19 364 321 370 687 23 387 616 392 268 561 138 150 768 116 680 494 37 180 431 452 548 16 78 222 711 265 362 33 485 696 290 691 311 276 123 135 290 685 337 493 244 280 776 620 305 340 490 409 309 593 756 176 431 178 679 52 162 670 322 703 2 120 469 261 389 123 670 278 477 78 140 746 443 326 693 773 193 552 463 3 518 718 138 754 386 556 663 129 86 582 515 428 509 179 502 505 543 274 710 495 407 541 158 86 659 189 272 647 12 27 239 477 146 760 681 274 522 30 380 7 393 249 684 205 681 653 325 305 331 737 277 775 65 671 212 197 669 513 18 711 220 489 545 593 739 578 710 555 579 204 441 108 161 587 717 593 338 517 275 371 466 552 162 92 401 682 342 332 425 296 44 666 777 217 740 104 192 139 96 360 24 714 92 361 156 672 433 470 173 336 224 27 453 132 378 143 84 609 626 642 719 217 644 587 122 152 29 126 463 730 141 401 522 421 530 546 577 755 648 656 446 497 240 474 513 663 392 24 281 674 684 406 49 771 451 117 307 590 392 43 282 302 750 255 261 178 285 392 640 295 463 341 593 352 43 122 363 166 738 165 705 329 6 105 523 291 352 11 6 528 723 709 508 483 734 68 11 568 220 610 389 739 507 711 143 206 767 298 732 646 162 331 583 235 307 723 616 248 308 164 711 55 465 290 718 706 81 396 256 444 602 565 460 200 57 605 547 316 69 675 178 219 382 638 239 579 150 675 85 310 380 769 10 734 699 295 647 122 675 603 707 563 777 775 172 674 114 150 527 405 439 413 88 215 147 531 575 773 148 75 300 681 115 747 395 448 699 356 654 645 416 78 241 234 262 494 587 144 367 312 126 76 741 704 316 376 27 4 64 159 443 294 379 419 572 73 478 262 510 72 33 634 598 329 779 615 103 114 434 339 538 312 615 527 174 558 650 471 400 338 545 102 195 746 420 714 38 162 177 303 557 517 570 631 444 566 684 249 207 218 130 156 301 297 640 149 256 236 716 121 36 66 393 79 250 299 539 242 180 362 775 633 256 348 165 502 231 384 660 368 43 777 218 69 466 319 683 776 540 254 269 367 349 586 398 601 33 588 776 149 420 290 250 501 673 141 267 69 137 608 739 84 777 109 102 766 389 673 655 25 147 244 239 346 120 772 129 134 731 716 696 337 420 613 624 238 735 544 253 493 675 337 418 587 652 214 572 307 558 108 346 520 30 397 274 367 550 448 774 420 365 85 643 709 141 333 449 763 597 104 175 579 402 715 2 779 360 194 367 318 613 64 14 544 159 432 166 105 21 651 33 334 610 407 346 720 207 298 90 275 121 141 570 67 660 230 439 356 110 718 434 570 210 551 727 775 551 363 97 76 735 301 478 477 46 265 737 773 638 100 721 237 627 728 515 171 598 628 457 564 458 461 676 264 772 498 156 253 330 345 102 568 385 554 638 205 715 537 12 370 658 428 531 763 180 613 541 213 772 471 756 709 278 480 487 165 736 648 594 648 643 771 682 736 392 117 323 725 334 32 690 428 766 361 226 615 730 694 660 66 142 83 60 140 57 564 348 529 259 23 738 518 145 662 305 606 714 583 351 612 145 439 3 37 438 115 291 634 218 543 151 250 94 370 559 656 772 405 208 666 188 374 474 217 576 201 284 127 326 382 168 523 762 698 636 480 420 290 531 93 425 40 244 45 303 567 530 366 306 523 473 522 373 322 341 697 229 12 311 354 630 326 765 327 413 691 130 582 654 340 723 370 572 279 764 274 51 764 248 431 237 232 564 6 37 593 737 478 631 677 595 122 511 92 43 754 652 587 631 110 461 550 429 777 426 244 468 207 748 244 534 148 48 38 83 338 592 500 495 539 333 560 98 302 556 74 480 585 444 153 411 720 589 124 707 146 66 548 680 683 657 600 559 243 152 286 663 17 388 68 648 376 356 105 605 428 477 403 683 686 55 739 290 169 500 340 299 696 583 600 152 593 171 768 759 739 117 354 303 606 490 415 545 416 638 538 659 578 248 664 20 480 333 208 400 419 647 689 729 519 667 499 243 342 76 733 328 14 267 322 64 132 39 437 731 266 353 482 778 295 672 677 373 477 99 677 158 444 766 95 431 35 353 251 542 232 234 268 601 125 35 76 138 186 302 305 500 212 131 215 100 423 651 411 724 354 625 629 274 595 39 459 123 184 657 600 128 389 606 116 681 83 464 111 493 642 651 493 659 109 364 723 415 431 124 188 546 765 421 612 171 230 285 482 323 554 246 404 190 262 354 542 509 57 358 536 232 295 111 613 189 734 633 275 59 202 481 18 703 697 231 323 561 671 116 387 761 166 459 289 598 456 63 766 75 550 469 232 749 685 189 779 448 204 670 587 662 434 524 8 680 111 681 712 650 652 692 31 511 522 353 521 160 246 480 441 623 39 548 439 596 265 21 450 162 642 112 386 631 490 25 672 348 473 772 589 499 213 103 127 13 409 95 482 189 529 489 455 433 39 549 709 371 328 595 583 290 556 565 121 709 315 388 426 389 432 724 579 360 181 124 754 699 756 620 149 70 132 160 332 390 79 145 61 94 494 516 143 455 591 221 304 170 579 453 775 241 306 209 25 483 775 45 636 277 462 723 58 28 668 704 395 236 97 58 633 383 507 64 595 582 440 144 87 407 657 305 113 162 154 149 469 236 459 541 719 421 728 544 167 570 73 151 541 709 524 146 182 6 154 686 88 325 557 772 388 728 288 219 666 36 415 693 512 40 143 53 733 772 353 150 312 563 147 734 657 270 456 80 310 344 48 324 290 592 493 728 233 748 630 606 158 732 39 412 375 276 641 448 49 670 317 617 337 556 438 317 762 41 520 674 439 8 532 532 573 517 464 658 759 456 419 213 517 655 296 248 171 668 10 513 90 442 105 211 271 52 676 199 459 225 708 23 488 256 667 81 187 431 328 29 109 642 99 770 511 304 624 114 86 535 504 273 124 284 200 73 163 38 460 72 442 59 574 407 210 569 10 357 238 275 237 508 647 215 281 549 768 450 157 234 517 300 615 169 77 273 221 335 760 241 478 18 204 156 625 659 222 344 485 353 413 113 246 750 67 122 368 596 508 549 640 609 210 749 624 147 619 300 101 283 719 79 202 563 136 589 630 89 468 100 135 351 187 776 48 95 271 256 94 660 419 115 219 531 586 431 242 618 133 350 34 641 107 572 238 412 600 586 670 324 386 238 202 642 228 357 8 691 130 631 442 2 378 326 304 123 287 158 421 218 652 721 347 551 449 599 367 45 726 199 677 11 385 79 205 368 496 194 752 611 581 216 463 366 187 21 199 379 582 191 369 104 554 228 137 565 155 356 684 652 413 466 367 682 370 699 109 758 94 475 163 184 602 43 497 583 608 506 121 535 205 635 290 385 112 596 508 342 505 705 763 354 493 97 778 23 350 247 616 681 45 643 626 121 74 75 495 357 409 69 557 192 285 746 109 745 37 269 343 10 18 379 362 571 650 778 759 207 424 74 425 502 36 347 430 371 542 349 92 350 714 423 668 321 259 669 30 217 412 628 566 138 150 776 500 329 174 432 507 513 522 229 177 589 424 509 94 126 378 547 779 540 693 522 35 445 760 539 188 372 414 72 169 695 153 18 610 708 366 549 55 329 299 307 259 321 539 258 634 123 329 736 473 347 555 747 235 167 616 442 585 636 755 519 720 168 151 71 739 345 428 694 143 471 346 577 619 337 700 226 411 627 339 533 332 130 551 695 407 759 29 82 111 152 687 198 301 691 390 7 610 307 458 71 369 85 427 670 666 597 522 141 263 167 523 209 54 564 276 326 445 201 210 91 528 333 57 419 607 89 132 762 609 13 270 294 502 423 606 105 408 122 158 451 211 67 437 231 753 277 213 175 513 740 626 702 195 712 601 205 352 51 506 725 415 187 639 410 641 320 170 265 110 356 177 582 562 391 146 401 223 708 452 232 394 544 491 506 532 170 611 216 280 444 14 473 337 764 377 133 626 99 220 431 423 59 466 442 30 129 383 543 439 658 97 239 621 231 206 371 682 19 514 770 715 409 202 679 285 360 504 10 651 288 168 714 244 66 119 124 593 464 605 19 442 400 84 207 322 486 31 423 235 774 273 590 594 399 102 600 679 53 356 457 337 200 236 595 496 354 239 515 23 616 27 342 685 154 452 9 743 539 267 636 267 21 689 552 714 92 61 635 209 164 13 48 562 677 201 482 202 736 717 548 497 648 465 387 546 337 244 761 33 201 227 722 766 313 417 365 678 362 572 21 204 556 105 477 651 458 239 427 24 106 705 31 207 749 456 159 295 64 434 594 714 407 269 502 271 250 778 260 61 343 363 151 406 172 165 641 647 606 364 297 436 84 71 675 275 469 545 271 122 542 131 14 627 323 292 361 451 267 58 281 272 117 391 689 567 91 580 511 497 230 400 229 352 202 662 245 119 660 624 624 507 495 487 84 457 742 508 631 448 171 273 686 519 45 92 538 464 376 755 362 441 259 104 194 513 603 750 480 329 700 642 259 422 358 323 76 188 149 233 277 52 482 305 738 701 272 309 169 288 428 97 433 634 69 609 637 324 178 197 346 231 749 395 307 775 73 239 411 448 195 519 734 427 187 724 155 736 772 35 230 226 147 662 629 423 605 559 653 221 665 363 730 629 82 333 314 236 198 777 381 579 720 126 489 426 653 437 511 590 3 610 740 415 714 164 647 754 364 577 358 609 719 705 694 442 446 675 2 193 513 497 395 37 288 9 263 585 486 348 732 631 343 623 466 96 709 663 153 772 195 88 31 97 631 250 486 88 36 765 643 534 378 580 561 408 302 368 497 369 446 403 326 349 447 603 767 250 438 608 147 677 191 137 316 428 130 429 26 319 296 622 181 669 486 759 667 636 599 761 87 762 92 527 608 517 607 747 275 761 26 218 498 322 721 121 766 585 590 332 239 12 216 402 424 724 137 233 405 649 187 563 667 108 586 404 411 608 503 651 288 285 263 350 219 181 233 516 218 704 344 321 646 317 336 495 209 177 579 32 211 536 377 164 461 743 4 31 703 421 601 654 208 768 346 679 141 387 308 296 189 615 616 405 583 749 488 310 621 570 753 233 7 336 571 162 685 318 257 669 570 84 613 498 575 656 701 712 548 587 465 348 755 402 668 749 566 78 224 33 89 211 666 191 122 45 360 523 749 143 295 345 552 375 51 383 48 532 363 119 417 205 240 23 227 265 456 53 288 76 775 296 759 735 282 630 111 241 506 76 549 553 135 646 457 637 511 126 758 572 219 341 200 300 347 455 555 67 283 740 641 33 349 143 63 207 587 178 537 588 101 641 126 57 523 282 627 127 713 710 598 299 31 51 752 377 204 245 167 512 180 329 36 361 308 694 578 414 177 776 310 512 402 591 192 206 175 721 38 74 274 34 111 275 538 470 350 684 9 248 334 118 168 529 214 92 11 104 410 713 243 522 107 102 172 59 20 220 340 144 168 602 133 412 220 650 124 646 322 255 729 719 518 53 257 169 106 336 194 445 309 604 416 54 567 63 35 252 88 449 705 251 256 708 22 144 525 81 451 235 195 430 68 559 239 95 542 409 750 83 475 426 656 538 664 272 335 325 664 383 535 266 291 617 670 104 389 725 132 81 435 51 682 217 376 604 56 112 258 11 599 303 721 49 380 563 281 353 577 60 651 402 483 126 594 442 770 217 580 469 607 390 738 760 75 264 72 437 492 457 54 556 314 385 431 442 545 309 599 346 757 239 660 563 168 392 474 310 217 60 686 653 551 559 502 126 32 222 125 31 75 98 97 164 300 535 424 44 526 700 108 170 117 584 256 559 51 422 297 438 226 593 447 414 101 338 704 87 112 45 272 364 676 668 630 271 705 418 212 778 411 9 313 71 551 628 243 165 403 670 170 496 472 61 251 264 154 47 530 695 130 134 176 298 268 465 688 140 402 636 9 446 661 198 113 598 364 610 2 228 196 368 413 592 618 166 748 603 617 536 372 769 609 741 454 219 777 600 46 526 766 447 759 558 207 593 122 148 347 255 357 495 374 550 12 700 614 97 667 276 397 6 175 219 159 228 56 378 247 316 115 528 643 666 245 394 380 290 198 593 732 509 643 122 194 336 442 492 160 611 255 243 306 549 524 512 291 362 541 550 79 567 270 482 16 463 442 260 265 351 682 356 330 28 533 471 284 107 445 714 53 654 591 296 692 641 630 567 145 345 475 620 491 653 136 380 306 122 55 324 219 719 730 235 581 86 743 467 330 276 75 297 372 133 723 112 433 470 611 158 214 218 601 148 147 3 431 427 137 37 643 89 712 32 362 573 95 343 696 474 357 720
{ "pile_set_name": "Github" }
//-------------------------------------------------------------------------------------- // File: DXUTguiIME.cpp // // Copyright (c) Microsoft Corporation. All rights reserved. //-------------------------------------------------------------------------------------- #include "DXUT.h" #include "DXUTgui.h" #include "DXUTsettingsDlg.h" #include "DXUTres.h" #include "DXUTgui.h" #include "DXUTguiIME.h" #undef min // use __min instead #undef max // use __max instead #define DXUT_NEAR_BUTTON_DEPTH 0.6f //-------------------------------------------------------------------------------------- // CDXUTIMEEditBox class //-------------------------------------------------------------------------------------- // IME constants POINT CDXUTIMEEditBox::s_ptCompString; // Composition string position. Updated every frame. int CDXUTIMEEditBox::s_nFirstTargetConv; // Index of the first target converted char in comp string. If none, -1. CUniBuffer CDXUTIMEEditBox::s_CompString = CUniBuffer( 0 ); DWORD CDXUTIMEEditBox::s_adwCompStringClause[MAX_COMPSTRING_SIZE]; WCHAR CDXUTIMEEditBox::s_wszReadingString[32]; CDXUTIMEEditBox::CCandList CDXUTIMEEditBox::s_CandList; // Data relevant to the candidate list bool CDXUTIMEEditBox::s_bImeFlag = true; #if defined(DEBUG) || defined(_DEBUG) bool CDXUTIMEEditBox::m_bIMEStaticMsgProcCalled = false; #endif //-------------------------------------------------------------------------------------- HRESULT CDXUTIMEEditBox::CreateIMEEditBox( CDXUTDialog* pDialog, int ID, LPCWSTR strText, int x, int y, int width, int height, bool bIsDefault, CDXUTIMEEditBox** ppCreated ) { CDXUTIMEEditBox* pEditBox = new CDXUTIMEEditBox( pDialog ); if( ppCreated != NULL ) *ppCreated = pEditBox; if( pEditBox == NULL ) return E_OUTOFMEMORY; // Set the ID and position pEditBox->SetID( ID ); pEditBox->SetLocation( x, y ); pEditBox->SetSize( width, height ); pEditBox->m_bIsDefault = bIsDefault; if( strText ) pEditBox->SetText( strText ); return S_OK; } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::InitDefaultElements( CDXUTDialog* pDialog ) { //------------------------------------- // CDXUTIMEEditBox //------------------------------------- CDXUTElement Element; RECT rcTexture; Element.SetFont( 0, D3DCOLOR_ARGB( 255, 0, 0, 0 ), DT_LEFT | DT_TOP ); // Assign the style SetRect( &rcTexture, 14, 90, 241, 113 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 0, &Element ); SetRect( &rcTexture, 8, 82, 14, 90 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 1, &Element ); SetRect( &rcTexture, 14, 82, 241, 90 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 2, &Element ); SetRect( &rcTexture, 241, 82, 246, 90 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 3, &Element ); SetRect( &rcTexture, 8, 90, 14, 113 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 4, &Element ); SetRect( &rcTexture, 241, 90, 246, 113 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 5, &Element ); SetRect( &rcTexture, 8, 113, 14, 121 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 6, &Element ); SetRect( &rcTexture, 14, 113, 241, 121 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 7, &Element ); SetRect( &rcTexture, 241, 113, 246, 121 ); Element.SetTexture( 0, &rcTexture ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 8, &Element ); // Element 9 for IME text, and indicator button SetRect( &rcTexture, 0, 0, 136, 54 ); Element.SetTexture( 0, &rcTexture ); Element.SetFont( 0, D3DCOLOR_ARGB( 255, 0, 0, 0 ), DT_CENTER | DT_VCENTER ); pDialog->SetDefaultElement( DXUT_CONTROL_IMEEDITBOX, 9, &Element ); } //-------------------------------------------------------------------------------------- CDXUTIMEEditBox::CDXUTIMEEditBox( CDXUTDialog* pDialog ) { m_Type = DXUT_CONTROL_IMEEDITBOX; m_pDialog = pDialog; m_nIndicatorWidth = 0; m_ReadingColor = D3DCOLOR_ARGB( 188, 255, 255, 255 ); m_ReadingWinColor = D3DCOLOR_ARGB( 128, 0, 0, 0 ); m_ReadingSelColor = D3DCOLOR_ARGB( 255, 255, 0, 0 ); m_ReadingSelBkColor = D3DCOLOR_ARGB( 128, 80, 80, 80 ); m_CandidateColor = D3DCOLOR_ARGB( 255, 200, 200, 200 ); m_CandidateWinColor = D3DCOLOR_ARGB( 128, 0, 0, 0 ); m_CandidateSelColor = D3DCOLOR_ARGB( 255, 255, 255, 255 ); m_CandidateSelBkColor = D3DCOLOR_ARGB( 128, 158, 158, 158 ); m_CompColor = D3DCOLOR_ARGB( 255, 200, 200, 255 ); m_CompWinColor = D3DCOLOR_ARGB( 198, 0, 0, 0 ); m_CompCaretColor = D3DCOLOR_ARGB( 255, 255, 255, 255 ); m_CompTargetColor = D3DCOLOR_ARGB( 255, 255, 255, 255 ); m_CompTargetBkColor = D3DCOLOR_ARGB( 255, 150, 150, 150 ); m_CompTargetNonColor = D3DCOLOR_ARGB( 255, 255, 255, 0 ); m_CompTargetNonBkColor = D3DCOLOR_ARGB( 255, 150, 150, 150 ); m_IndicatorImeColor = D3DCOLOR_ARGB( 255, 255, 255, 255 ); m_IndicatorEngColor = D3DCOLOR_ARGB( 255, 0, 0, 0 ); m_IndicatorBkColor = D3DCOLOR_ARGB( 255, 128, 128, 128 ); } //-------------------------------------------------------------------------------------- CDXUTIMEEditBox::~CDXUTIMEEditBox() { } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::SendKey( BYTE nVirtKey ) { keybd_event( nVirtKey, 0, 0, 0 ); keybd_event( nVirtKey, 0, KEYEVENTF_KEYUP, 0 ); } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::UpdateRects() { // Temporary adjust m_width so that CDXUTEditBox can compute // the correct rects for its rendering since we need to make space // for the indicator button int nWidth = m_width; m_width -= m_nIndicatorWidth + m_nBorder * 2; // Make room for the indicator button CDXUTEditBox::UpdateRects(); m_width = nWidth; // Restore // Compute the indicator button rectangle SetRect( &m_rcIndicator, m_rcBoundingBox.right, m_rcBoundingBox.top, m_x + m_width, m_rcBoundingBox.bottom ); // InflateRect( &m_rcIndicator, -m_nBorder, -m_nBorder ); m_rcBoundingBox.right = m_rcBoundingBox.left + m_width; } //-------------------------------------------------------------------------------------- // GetImeId( UINT uIndex ) // returns // returned value: // 0: In the following cases // - Non Chinese IME input locale // - Older Chinese IME // - Other error cases // // Othewise: // When uIndex is 0 (default) // bit 31-24: Major version // bit 23-16: Minor version // bit 15-0: Language ID // When uIndex is 1 // pVerFixedInfo->dwFileVersionLS // // Use IMEID_VER and IMEID_LANG macro to extract version and language information. // // We define the locale-invariant ID ourselves since it doesn't exist prior to WinXP // For more information, see the CompareString() reference. #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) //-------------------------------------------------------------------------------------- // Enable/disable the entire IME system. When disabled, the default IME handling // kicks in. void CDXUTIMEEditBox::EnableImeSystem( bool bEnable ) { ImeUi_EnableIme( bEnable ); } //-------------------------------------------------------------------------------------- // Resets the composition string. void CDXUTIMEEditBox::ResetCompositionString() { s_CompString.SetText( L"" ); } //-------------------------------------------------------------------------------------- // This function is used only briefly in CHT IME handling, // so accelerator isn't processed. void CDXUTIMEEditBox::PumpMessage() { MSG msg; while( PeekMessageW( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { if( !GetMessageW( &msg, NULL, 0, 0 ) ) { PostQuitMessage( ( int )msg.wParam ); return; } TranslateMessage( &msg ); DispatchMessageA( &msg ); } } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::OnFocusIn() { ImeUi_EnableIme( s_bImeFlag ); CDXUTEditBox::OnFocusIn(); } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::OnFocusOut() { ImeUi_FinalizeString(); ImeUi_EnableIme( false ); CDXUTEditBox::OnFocusOut(); } //-------------------------------------------------------------------------------------- bool CDXUTIMEEditBox::StaticMsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if( !ImeUi_IsEnabled() ) return false; #if defined(DEBUG) || defined(_DEBUG) m_bIMEStaticMsgProcCalled = true; #endif switch( uMsg ) { case WM_INPUTLANGCHANGE: DXUTTRACE( L"WM_INPUTLANGCHANGE\n" ); { } return true; case WM_IME_SETCONTEXT: DXUTTRACE( L"WM_IME_SETCONTEXT\n" ); // // We don't want anything to display, so we have to clear this // lParam = 0; return false; // Handle WM_IME_STARTCOMPOSITION here since // we do not want the default IME handler to see // this when our fullscreen app is running. case WM_IME_STARTCOMPOSITION: DXUTTRACE( L"WM_IME_STARTCOMPOSITION\n" ); ResetCompositionString(); // Since the composition string has its own caret, we don't render // the edit control's own caret to avoid double carets on screen. s_bHideCaret = true; return true; case WM_IME_ENDCOMPOSITION: DXUTTRACE( L"WM_IME_ENDCOMPOSITION\n" ); s_bHideCaret = false; return false; case WM_IME_COMPOSITION: DXUTTRACE( L"WM_IME_COMPOSITION\n" ); return false; } return false; } //-------------------------------------------------------------------------------------- bool CDXUTIMEEditBox::HandleMouse( UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam ) { if( !m_bEnabled || !m_bVisible ) return false; switch( uMsg ) { case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: { DXUTFontNode* pFont = m_pDialog->GetFont( m_Elements.GetAt( 9 )->iFont ); // Check if this click is on top of the composition string int nCompStrWidth; s_CompString.CPtoX( s_CompString.GetTextSize(), FALSE, &nCompStrWidth ); if( s_ptCompString.x <= pt.x && s_ptCompString.y <= pt.y && s_ptCompString.x + nCompStrWidth > pt.x && s_ptCompString.y + pFont->nHeight > pt.y ) { int nCharBodyHit, nCharHit; int nTrail; // Determine the character clicked on. s_CompString.XtoCP( pt.x - s_ptCompString.x, &nCharBodyHit, &nTrail ); if( nTrail && nCharBodyHit < s_CompString.GetTextSize() ) nCharHit = nCharBodyHit + 1; else nCharHit = nCharBodyHit; switch( GetPrimaryLanguage() ) { case LANG_JAPANESE: // For Japanese, there are two cases. If s_nFirstTargetConv is // -1, the comp string hasn't been converted yet, and we use // s_nCompCaret. For any other value of s_nFirstTargetConv, // the string has been converted, so we use clause information. if( s_nFirstTargetConv != -1 ) { int nClauseClicked = 0; while( ( int )s_adwCompStringClause[nClauseClicked + 1] <= nCharBodyHit ) ++nClauseClicked; int nClauseSelected = 0; while( ( int )s_adwCompStringClause[nClauseSelected + 1] <= s_nFirstTargetConv ) ++nClauseSelected; BYTE nVirtKey = nClauseClicked > nClauseSelected ? VK_RIGHT : VK_LEFT; int nSendCount = abs( nClauseClicked - nClauseSelected ); while( nSendCount-- > 0 ) SendKey( nVirtKey ); return true; } // Not converted case. Fall thru to Chinese case. case LANG_CHINESE: { // For Chinese, use s_nCompCaret. BYTE nVirtKey = nCharHit > ( int )ImeUi_GetImeCursorChars() ? VK_RIGHT : VK_LEFT; int nSendCount = abs( nCharHit - ( int )ImeUi_GetImeCursorChars() ); while( nSendCount-- > 0 ) SendKey( nVirtKey ); break; } } return true; } // Check if the click is on top of the candidate window if( ImeUi_IsShowCandListWindow() && PtInRect( &s_CandList.rcCandidate, pt ) ) { if( ImeUi_IsVerticalCand() ) { // Vertical candidate window // Compute the row the click is on int nRow = ( pt.y - s_CandList.rcCandidate.top ) / pFont->nHeight; if( nRow < ( int )ImeUi_GetCandidateCount() ) { // nRow is a valid entry. // Now emulate keystrokes to select the candidate at this row. switch( GetPrimaryLanguage() ) { case LANG_CHINESE: case LANG_KOREAN: // For Chinese and Korean, simply send the number keystroke. SendKey( ( BYTE )( '0' + nRow + 1 ) ); break; case LANG_JAPANESE: // For Japanese, move the selection to the target row, // then send Right, then send Left. BYTE nVirtKey; if( nRow > ( int )ImeUi_GetCandidateSelection() ) nVirtKey = VK_DOWN; else nVirtKey = VK_UP; int nNumToHit = abs( int( nRow - ImeUi_GetCandidateSelection() ) ); for( int nStrike = 0; nStrike < nNumToHit; ++nStrike ) SendKey( nVirtKey ); // Do this to close the candidate window without ending composition. SendKey( VK_RIGHT ); SendKey( VK_LEFT ); break; } } } else { // Horizontal candidate window // Determine which the character the click has hit. int nCharHit; int nTrail; s_CandList.HoriCand.XtoCP( pt.x - s_CandList.rcCandidate.left, &nCharHit, &nTrail ); // Determine which candidate string the character belongs to. int nCandidate = ImeUi_GetCandidateCount() - 1; int nEntryStart = 0; for( UINT i = 0; i < ImeUi_GetCandidateCount(); ++i ) { if( nCharHit >= nEntryStart ) { // Haven't found it. nEntryStart += lstrlenW( ImeUi_GetCandidate( i ) ) + 1; // plus space separator } else { // Found it. This entry starts at the right side of the click point, // so the char belongs to the previous entry. nCandidate = i - 1; break; } } // Now emulate keystrokes to select the candidate entry. switch( GetPrimaryLanguage() ) { case LANG_CHINESE: case LANG_KOREAN: // For Chinese and Korean, simply send the number keystroke. SendKey( ( BYTE )( '0' + nCandidate + 1 ) ); break; } } return true; } } } // If we didn't care for the msg, let the parent process it. return CDXUTEditBox::HandleMouse( uMsg, pt, wParam, lParam ); } //-------------------------------------------------------------------------------------- bool CDXUTIMEEditBox::MsgProc( UINT uMsg, WPARAM wParam, LPARAM lParam ) { if( !m_bEnabled || !m_bVisible ) return false; #if defined(DEBUG) || defined(_DEBUG) // DXUT.cpp used to call CDXUTIMEEditBox::StaticMsgProc() so that, but now // this is the application's responsiblity. To do this, call // CDXUTDialogResourceManager::MsgProc() before calling this function. assert( m_bIMEStaticMsgProcCalled && L"To fix, call CDXUTDialogResourceManager::MsgProc() first" ); #endif switch( uMsg ) { case WM_DESTROY: ImeUi_Uninitialize(); break; } bool trappedData; bool* trapped = &trappedData; *trapped = false; if( !ImeUi_IsEnabled() ) return CDXUTEditBox::MsgProc( uMsg, wParam, lParam ); ImeUi_ProcessMessage( DXUTGetHWND(), uMsg, wParam, lParam, trapped ); if( *trapped == false ) CDXUTEditBox::MsgProc( uMsg, wParam, lParam ); return *trapped; } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::RenderCandidateReadingWindow( float fElapsedTime, bool bReading ) { RECT rc; UINT nNumEntries = bReading ? 4 : MAX_CANDLIST; D3DCOLOR TextColor, TextBkColor, SelTextColor, SelBkColor; int nX, nXFirst, nXComp; m_Buffer.CPtoX( m_nCaret, FALSE, &nX ); m_Buffer.CPtoX( m_nFirstVisible, FALSE, &nXFirst ); if( bReading ) { TextColor = m_ReadingColor; TextBkColor = m_ReadingWinColor; SelTextColor = m_ReadingSelColor; SelBkColor = m_ReadingSelBkColor; } else { TextColor = m_CandidateColor; TextBkColor = m_CandidateWinColor; SelTextColor = m_CandidateSelColor; SelBkColor = m_CandidateSelBkColor; } // For Japanese IME, align the window with the first target converted character. // For all other IMEs, align with the caret. This is because the caret // does not move for Japanese IME. if( GetLanguage() == MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL ) && !GetImeId() ) nXComp = 0; else if( GetPrimaryLanguage() == LANG_JAPANESE ) s_CompString.CPtoX( s_nFirstTargetConv, FALSE, &nXComp ); else s_CompString.CPtoX( ImeUi_GetImeCursorChars(), FALSE, &nXComp ); // Compute the size of the candidate window int nWidthRequired = 0; int nHeightRequired = 0; int nSingleLineHeight = 0; if( ( ImeUi_IsVerticalCand() && !bReading ) || ( !ImeUi_IsHorizontalReading() && bReading ) ) { // Vertical window for( UINT i = 0; i < nNumEntries; ++i ) { if( *( ImeUi_GetCandidate( i ) ) == L'\0' ) break; SetRect( &rc, 0, 0, 0, 0 ); m_pDialog->CalcTextRect( ImeUi_GetCandidate( i ), m_Elements.GetAt( 1 ), &rc ); nWidthRequired = __max( nWidthRequired, rc.right - rc.left ); nSingleLineHeight = __max( nSingleLineHeight, rc.bottom - rc.top ); } nHeightRequired = nSingleLineHeight * nNumEntries; } else { // Horizontal window SetRect( &rc, 0, 0, 0, 0 ); if( bReading ) m_pDialog->CalcTextRect( s_wszReadingString, m_Elements.GetAt( 1 ), &rc ); else { WCHAR wszCand[256] = L""; s_CandList.nFirstSelected = 0; s_CandList.nHoriSelectedLen = 0; for( UINT i = 0; i < MAX_CANDLIST; ++i ) { if( *ImeUi_GetCandidate( i ) == L'\0' ) break; WCHAR wszEntry[32]; swprintf_s( wszEntry, 32, L"%s ", ImeUi_GetCandidate( i ) ); // If this is the selected entry, mark its char position. if( ImeUi_GetCandidateSelection() == i ) { s_CandList.nFirstSelected = lstrlen( wszCand ); s_CandList.nHoriSelectedLen = lstrlen( wszEntry ) - 1; // Minus space } wcscat_s( wszCand, 256, wszEntry ); } wszCand[lstrlen( wszCand ) - 1] = L'\0'; // Remove the last space s_CandList.HoriCand.SetText( wszCand ); m_pDialog->CalcTextRect( s_CandList.HoriCand.GetBuffer(), m_Elements.GetAt( 1 ), &rc ); } nWidthRequired = rc.right - rc.left; nSingleLineHeight = nHeightRequired = rc.bottom - rc.top; } // Now that we have the dimension, calculate the location for the candidate window. // We attempt to fit the window in this order: // bottom, top, right, left. bool bHasPosition = false; // Bottom SetRect( &rc, s_ptCompString.x + nXComp, s_ptCompString.y + m_rcText.bottom - m_rcText.top, s_ptCompString.x + nXComp + nWidthRequired, s_ptCompString.y + m_rcText.bottom - m_rcText.top + nHeightRequired ); // if the right edge is cut off, move it left. if( rc.right > m_pDialog->GetWidth() ) { rc.left -= rc.right - m_pDialog->GetWidth(); rc.right = m_pDialog->GetWidth(); } if( rc.bottom <= m_pDialog->GetHeight() ) bHasPosition = true; // Top if( !bHasPosition ) { SetRect( &rc, s_ptCompString.x + nXComp, s_ptCompString.y - nHeightRequired, s_ptCompString.x + nXComp + nWidthRequired, s_ptCompString.y ); // if the right edge is cut off, move it left. if( rc.right > m_pDialog->GetWidth() ) { rc.left -= rc.right - m_pDialog->GetWidth(); rc.right = m_pDialog->GetWidth(); } if( rc.top >= 0 ) bHasPosition = true; } // Right if( !bHasPosition ) { int nXCompTrail; s_CompString.CPtoX( ImeUi_GetImeCursorChars(), TRUE, &nXCompTrail ); SetRect( &rc, s_ptCompString.x + nXCompTrail, 0, s_ptCompString.x + nXCompTrail + nWidthRequired, nHeightRequired ); if( rc.right <= m_pDialog->GetWidth() ) bHasPosition = true; } // Left if( !bHasPosition ) { SetRect( &rc, s_ptCompString.x + nXComp - nWidthRequired, 0, s_ptCompString.x + nXComp, nHeightRequired ); if( rc.right >= 0 ) bHasPosition = true; } if( !bHasPosition ) { // The dialog is too small for the candidate window. // Fall back to render at 0, 0. Some part of the window // will be cut off. rc.left = 0; rc.right = nWidthRequired; } // If we are rendering the candidate window, save the position // so that mouse clicks are checked properly. if( !bReading ) s_CandList.rcCandidate = rc; // Render the elements m_pDialog->DrawRect( &rc, TextBkColor ); if( ( ImeUi_IsVerticalCand() && !bReading ) || ( !ImeUi_IsHorizontalReading() && bReading ) ) { // Vertical candidate window for( UINT i = 0; i < nNumEntries; ++i ) { // Here we are rendering one line at a time rc.bottom = rc.top + nSingleLineHeight; // Use a different color for the selected string if( ImeUi_GetCandidateSelection() == i ) { m_pDialog->DrawRect( &rc, SelBkColor ); m_Elements.GetAt( 1 )->FontColor.Current = SelTextColor; } else m_Elements.GetAt( 1 )->FontColor.Current = TextColor; m_pDialog->DrawText( ImeUi_GetCandidate( i ), m_Elements.GetAt( 1 ), &rc ); rc.top += nSingleLineHeight; } } else { // Horizontal candidate window m_Elements.GetAt( 1 )->FontColor.Current = TextColor; if( bReading ) m_pDialog->DrawText( s_wszReadingString, m_Elements.GetAt( 1 ), &rc ); else m_pDialog->DrawText( s_CandList.HoriCand.GetBuffer(), m_Elements.GetAt( 1 ), &rc ); // Render the selected entry differently if( !bReading ) { int nXLeft, nXRight; s_CandList.HoriCand.CPtoX( s_CandList.nFirstSelected, FALSE, &nXLeft ); s_CandList.HoriCand.CPtoX( s_CandList.nFirstSelected + s_CandList.nHoriSelectedLen, FALSE, &nXRight ); rc.right = rc.left + nXRight; rc.left += nXLeft; m_pDialog->DrawRect( &rc, SelBkColor ); m_Elements.GetAt( 1 )->FontColor.Current = SelTextColor; m_pDialog->DrawText( s_CandList.HoriCand.GetBuffer() + s_CandList.nFirstSelected, m_Elements.GetAt( 1 ), &rc, false, s_CandList.nHoriSelectedLen ); } } } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::RenderComposition( float fElapsedTime ) { s_CompString.SetText( ImeUi_GetCompositionString() ); RECT rcCaret = { 0, 0, 0, 0 }; int nX, nXFirst; m_Buffer.CPtoX( m_nCaret, FALSE, &nX ); m_Buffer.CPtoX( m_nFirstVisible, FALSE, &nXFirst ); CDXUTElement* pElement = m_Elements.GetAt( 1 ); // Get the required width RECT rc = { m_rcText.left + nX - nXFirst, m_rcText.top, m_rcText.left + nX - nXFirst, m_rcText.bottom }; m_pDialog->CalcTextRect( s_CompString.GetBuffer(), pElement, &rc ); // If the composition string is too long to fit within // the text area, move it to below the current line. // This matches the behavior of the default IME. if( rc.right > m_rcText.right ) OffsetRect( &rc, m_rcText.left - rc.left, rc.bottom - rc.top ); // Save the rectangle position for processing highlighted text. RECT rcFirst = rc; // Update s_ptCompString for RenderCandidateReadingWindow(). s_ptCompString.x = rc.left; s_ptCompString.y = rc.top; D3DCOLOR TextColor = m_CompColor; // Render the window and string. // If the string is too long, we must wrap the line. pElement->FontColor.Current = TextColor; const WCHAR* pwszComp = s_CompString.GetBuffer(); int nCharLeft = s_CompString.GetTextSize(); for(; ; ) { // Find the last character that can be drawn on the same line. int nLastInLine; int bTrail; s_CompString.XtoCP( m_rcText.right - rc.left, &nLastInLine, &bTrail ); int nNumCharToDraw = __min( nCharLeft, nLastInLine ); m_pDialog->CalcTextRect( pwszComp, pElement, &rc, nNumCharToDraw ); // Draw the background // For Korean IME, blink the composition window background as if it // is a cursor. if( GetPrimaryLanguage() == LANG_KOREAN ) { if( m_bCaretOn ) { m_pDialog->DrawRect( &rc, m_CompWinColor ); } else { // Not drawing composition string background. We // use the editbox's text color for composition // string text. TextColor = m_Elements.GetAt( 0 )->FontColor.States[DXUT_STATE_NORMAL]; } } else { // Non-Korean IME. Always draw composition background. m_pDialog->DrawRect( &rc, m_CompWinColor ); } // Draw the text pElement->FontColor.Current = TextColor; m_pDialog->DrawText( pwszComp, pElement, &rc, false, nNumCharToDraw ); // Advance pointer and counter nCharLeft -= nNumCharToDraw; pwszComp += nNumCharToDraw; if( nCharLeft <= 0 ) break; // Advance rectangle coordinates to beginning of next line OffsetRect( &rc, m_rcText.left - rc.left, rc.bottom - rc.top ); } // Load the rect for the first line again. rc = rcFirst; // Inspect each character in the comp string. // For target-converted and target-non-converted characters, // we display a different background color so they appear highlighted. int nCharFirst = 0; nXFirst = 0; s_nFirstTargetConv = -1; BYTE* pAttr; const WCHAR* pcComp; for( pcComp = s_CompString.GetBuffer(), pAttr = ImeUi_GetCompStringAttr(); *pcComp != L'\0'; ++pcComp, ++pAttr ) { D3DCOLOR bkColor; // Render a different background for this character int nXLeft, nXRight; s_CompString.CPtoX( int( pcComp - s_CompString.GetBuffer() ), FALSE, &nXLeft ); s_CompString.CPtoX( int( pcComp - s_CompString.GetBuffer() ), TRUE, &nXRight ); // Check if this character is off the right edge and should // be wrapped to the next line. if( nXRight - nXFirst > m_rcText.right - rc.left ) { // Advance rectangle coordinates to beginning of next line OffsetRect( &rc, m_rcText.left - rc.left, rc.bottom - rc.top ); // Update the line's first character information nCharFirst = int( pcComp - s_CompString.GetBuffer() ); s_CompString.CPtoX( nCharFirst, FALSE, &nXFirst ); } // If the caret is on this character, save the coordinates // for drawing the caret later. if( ImeUi_GetImeCursorChars() == ( DWORD )( pcComp - s_CompString.GetBuffer() ) ) { rcCaret = rc; rcCaret.left += nXLeft - nXFirst - 1; rcCaret.right = rcCaret.left + 2; } // Set up color based on the character attribute if( *pAttr == ATTR_TARGET_CONVERTED ) { pElement->FontColor.Current = m_CompTargetColor; bkColor = m_CompTargetBkColor; } else if( *pAttr == ATTR_TARGET_NOTCONVERTED ) { pElement->FontColor.Current = m_CompTargetNonColor; bkColor = m_CompTargetNonBkColor; } else { continue; } RECT rcTarget = { rc.left + nXLeft - nXFirst, rc.top, rc.left + nXRight - nXFirst, rc.bottom }; m_pDialog->DrawRect( &rcTarget, bkColor ); m_pDialog->DrawText( pcComp, pElement, &rcTarget, false, 1 ); // Record the first target converted character's index if( -1 == s_nFirstTargetConv ) s_nFirstTargetConv = int( pAttr - ImeUi_GetCompStringAttr() ); } // Render the composition caret if( m_bCaretOn ) { // If the caret is at the very end, its position would not have // been computed in the above loop. We compute it here. if( ImeUi_GetImeCursorChars() == ( DWORD )s_CompString.GetTextSize() ) { s_CompString.CPtoX( ImeUi_GetImeCursorChars(), FALSE, &nX ); rcCaret = rc; rcCaret.left += nX - nXFirst - 1; rcCaret.right = rcCaret.left + 2; } m_pDialog->DrawRect( &rcCaret, m_CompCaretColor ); } } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::RenderIndicator( float fElapsedTime ) { CDXUTElement* pElement = m_Elements.GetAt( 9 ); pElement->TextureColor.Blend( DXUT_STATE_NORMAL, fElapsedTime ); m_pDialog->DrawSprite( pElement, &m_rcIndicator, DXUT_NEAR_BUTTON_DEPTH ); RECT rc = m_rcIndicator; InflateRect( &rc, -m_nSpacing, -m_nSpacing ); pElement->FontColor.Current = m_IndicatorImeColor; RECT rcCalc = { 0, 0, 0, 0 }; // If IME system is off, draw English indicator. WCHAR* pwszIndicator = ImeUi_IsEnabled() ? ImeUi_GetIndicatior() : L"En"; m_pDialog->CalcTextRect( pwszIndicator, pElement, &rcCalc ); m_pDialog->DrawText( pwszIndicator, pElement, &rc ); } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::Render( float fElapsedTime ) { if( m_bVisible == false ) return; // If we have not computed the indicator symbol width, // do it. if( !m_nIndicatorWidth ) { RECT rc = { 0, 0, 0, 0 }; m_pDialog->CalcTextRect( L"En", m_Elements.GetAt( 9 ), &rc ); m_nIndicatorWidth = rc.right - rc.left; // Update the rectangles now that we have the indicator's width UpdateRects(); } // Let the parent render first (edit control) CDXUTEditBox::Render( fElapsedTime ); CDXUTElement* pElement = GetElement( 1 ); if( pElement ) { s_CompString.SetFontNode( m_pDialog->GetFont( pElement->iFont ) ); s_CandList.HoriCand.SetFontNode( m_pDialog->GetFont( pElement->iFont ) ); } // // Now render the IME elements // ImeUi_RenderUI(); if( m_bHasFocus ) { // Render the input locale indicator RenderIndicator( fElapsedTime ); // Display the composition string. // This method should also update s_ptCompString // for RenderCandidateReadingWindow. RenderComposition( fElapsedTime ); // Display the reading/candidate window. RenderCandidateReadingWindow() // uses s_ptCompString to position itself. s_ptCompString must have // been filled in by RenderComposition(). if( ImeUi_IsShowReadingWindow() ) // Reading window RenderCandidateReadingWindow( fElapsedTime, true ); else if( ImeUi_IsShowCandListWindow() ) // Candidate list window RenderCandidateReadingWindow( fElapsedTime, false ); } } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::SetImeEnableFlag( bool bFlag ) { s_bImeFlag = bFlag; } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::Initialize( HWND hWnd ) { ImeUiCallback_DrawRect = NULL; ImeUiCallback_Malloc = malloc; ImeUiCallback_Free = free; ImeUiCallback_DrawFans = NULL; ImeUi_Initialize( hWnd ); s_CompString.SetBufferSize( MAX_COMPSTRING_SIZE ); ImeUi_EnableIme( true ); } //-------------------------------------------------------------------------------------- void CDXUTIMEEditBox::Uninitialize() { ImeUi_EnableIme( false ); ImeUi_Uninitialize( ); }
{ "pile_set_name": "Github" }
{ "id": "Prisma Cloud", "group": "incident", "name": "Prisma Cloud Incident", "description": "", "version": -1, "fromVersion": "6.0.0", "detailsV2": { "tabs": [ { "hidden": false, "id": "gfrgdzfgei", "name": "Case Info", "sections": [ { "displayType": "ROW", "h": 2, "hideName": false, "i": "gfrgdzfgei-aa0d7560-b338-11e9-b119-d93d58ec6fe8", "items": [ { "dropEffect": "move", "endCol": 2, "fieldId": "type", "height": 24, "id": "0acff760-b339-11e9-b119-d93d58ec6fe8", "index": 0, "listId": "gfrgdzfgei-aa0d7560-b338-11e9-b119-d93d58ec6fe8", "startCol": 0 }, { "endCol": 2, "fieldId": "severity", "height": 24, "id": "0d2d2140-b339-11e9-b119-d93d58ec6fe8", "index": 1, "startCol": 0 }, { "endCol": 2, "fieldId": "owner", "height": 24, "id": "108218a0-b339-11e9-b119-d93d58ec6fe8", "index": 2, "startCol": 0 }, { "endCol": 2, "fieldId": "sourceinstance", "height": 24, "id": "19d3ced0-b339-11e9-b119-d93d58ec6fe8", "index": 3, "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "sourcebrand", "height": 24, "id": "21f23520-b339-11e9-b119-d93d58ec6fe8", "index": 4, "listId": "gfrgdzfgei-aa0d7560-b338-11e9-b119-d93d58ec6fe8", "startCol": 0 }, { "endCol": 2, "fieldId": "playbookid", "height": 24, "id": "282bfcf0-b339-11e9-b119-d93d58ec6fe8", "index": 5, "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Case Details", "static": false, "w": 1, "x": 0, "y": 0 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-ba344900-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Work Plan", "static": false, "type": "workplan", "w": 1, "x": 2, "y": 2 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-c0c5f4d0-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Notes", "static": false, "type": "notes", "w": 1, "x": 2, "y": 4 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-c690a720-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Incident Timeline", "query": { "categories": [ "incidentInfo" ], "lastId": "", "pageSize": 100, "tags": [], "users": [] }, "queryType": "warRoomFilter", "static": false, "type": "invTimeline", "w": 2, "x": 0, "y": 2 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-d95ef410-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Team Members", "static": false, "type": "team", "w": 1, "x": 1, "y": 4 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-de75bfb0-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Evidence", "static": false, "type": "evidence", "w": 1, "x": 0, "y": 4 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-f0395360-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Linked Incidents", "static": false, "type": "linkedIncidents", "w": 1, "x": 0, "y": 6 }, { "h": 2, "hideName": false, "i": "gfrgdzfgei-f2767220-b338-11e9-b119-d93d58ec6fe8", "items": [], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Child Incidents", "static": false, "type": "childInv", "w": 1, "x": 1, "y": 6 }, { "displayType": "CARD", "h": 2, "hideItemTitleOnlyOne": true, "hideName": false, "i": "gfrgdzfgei-f84ce440-b338-11e9-b119-d93d58ec6fe8", "items": [ { "endCol": 2, "fieldId": "incident_attachment", "height": 55, "id": "f8545e50-b338-11e9-b119-d93d58ec6fe8", "index": 0, "isVisible": true, "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Attachments", "static": false, "type": "", "w": 1, "x": 2, "y": 6 }, { "description": "Prisma Cloud alert summary details.", "displayType": "ROW", "h": 2, "hideName": false, "i": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "items": [ { "dropEffect": "move", "endCol": 2, "fieldId": "prismacloudalertid", "height": 24, "id": "959c3cc0-f766-11e9-8c27-6359f1848ae7", "index": 0, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 0 }, { "endCol": 2, "fieldId": "prismacloudalertstatus", "height": 24, "id": "9a8baa40-f766-11e9-8c27-6359f1848ae7", "index": 0, "startCol": 0 }, { "endCol": 2, "fieldId": "prismacloudalertreason", "height": 24, "id": "9d27b1e0-f766-11e9-8c27-6359f1848ae7", "index": 0, "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "prismacloudalerttime", "height": 24, "id": "9bae0a30-f766-11e9-8c27-6359f1848ae7", "index": 0, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 0 }, { "endCol": 2, "fieldId": "prismacloudid", "height": 24, "id": "7a4369a0-f8b8-11e9-a470-b7537b797c27", "index": 0, "startCol": 0 }, { "dropEffect": "move", "endCol": 4, "fieldId": "firstseen", "height": 24, "id": "a5bd1cf0-f766-11e9-8c27-6359f1848ae7", "index": 0, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 2 }, { "dropEffect": "move", "endCol": 2, "fieldId": "prismacloudtime", "height": 24, "id": "97ada000-f8b8-11e9-a470-b7537b797c27", "index": 1, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 0 }, { "dropEffect": "move", "endCol": 4, "fieldId": "lastseen", "height": 24, "id": "a6b97e50-f766-11e9-8c27-6359f1848ae7", "index": 1, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 2 }, { "dropEffect": "move", "endCol": 2, "fieldId": "prismacloudstatus", "height": 24, "id": "7fc5c850-f8b8-11e9-a470-b7537b797c27", "index": 2, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 0 }, { "dropEffect": "move", "endCol": 4, "fieldId": "riskscore", "height": 24, "id": "b062f170-f766-11e9-8c27-6359f1848ae7", "index": 2, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 2 }, { "endCol": 2, "fieldId": "prismacloudreason", "height": 24, "id": "7cf9fe20-f8b8-11e9-a470-b7537b797c27", "index": 3, "startCol": 0 }, { "dropEffect": "move", "endCol": 4, "fieldId": "riskrating", "height": 24, "id": "aa6fa880-f766-11e9-8c27-6359f1848ae7", "index": 3, "listId": "gfrgdzfgei-57cfecc0-f766-11e9-8c27-6359f1848ae7", "startCol": 2 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Prisma Cloud Alert Summary", "static": false, "w": 2, "x": 1, "y": 0 } ], "type": "custom" }, { "hidden": false, "id": "fyjdlofdhd", "name": "Investigation", "sections": [ { "description": "Remediation tasks information.", "displayType": "ROW", "h": 2, "hideName": false, "i": "fyjdlofdhd-f70ad9a0-93c3-11e9-a1e7-13edb5b78371", "isVisible": true, "items": [ { "dropEffect": "move", "endCol": 4, "fieldId": "policyrecommendation", "height": 48, "id": "25b6c980-93c4-11e9-a1e7-13edb5b78371", "index": 0, "listId": "f70ad9a0-93c3-11e9-a1e7-13edb5b78371", "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Remediation Actions", "static": false, "w": 3, "x": 0, "y": 3 }, { "description": "Violated policy information.", "displayType": "ROW", "h": 3, "hideName": false, "i": "fyjdlofdhd-3cf20d80-93c4-11e9-a1e7-13edb5b78371", "isVisible": true, "items": [ { "endCol": 2, "fieldId": "policyid", "height": 24, "id": "60add970-93c4-11e9-a1e7-13edb5b78371", "index": 0, "startCol": 0 }, { "endCol": 2, "fieldId": "policytype", "height": 24, "id": "650d8a10-93c4-11e9-a1e7-13edb5b78371", "index": 1, "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "policyseverity", "height": 24, "id": "569fc100-a9d1-11e9-a91e-57df9227e86a", "index": 2, "listId": "3cf20d80-93c4-11e9-a1e7-13edb5b78371", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "policydescription", "height": 48, "id": "52384830-a9d1-11e9-a91e-57df9227e86a", "index": 3, "listId": "3cf20d80-93c4-11e9-a1e7-13edb5b78371", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "systemdefault", "height": 24, "id": "dbf3d150-a9d8-11e9-a91e-57df9227e86a", "index": 4, "listId": "3cf20d80-93c4-11e9-a1e7-13edb5b78371", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "policyremediable", "height": 24, "id": "67e58940-93c4-11e9-a1e7-13edb5b78371", "index": 5, "listId": "3cf20d80-93c4-11e9-a1e7-13edb5b78371", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "policydeleted", "height": 24, "id": "642758b0-a9d1-11e9-a91e-57df9227e86a", "index": 6, "listId": "3cf20d80-93c4-11e9-a1e7-13edb5b78371", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "lastmodifiedon", "height": 24, "id": "ad90aa40-a9d8-11e9-a91e-57df9227e86a", "index": 7, "listId": "3cf20d80-93c4-11e9-a1e7-13edb5b78371", "startCol": 0 }, { "endCol": 2, "fieldId": "lastmodifiedby", "height": 24, "id": "b07a0e90-a9d8-11e9-a91e-57df9227e86a", "index": 8, "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Policy Violated", "static": false, "w": 1, "x": 0, "y": 0 }, { "description": "Violating resource information.", "displayType": "ROW", "h": 3, "hideName": false, "i": "fyjdlofdhd-9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "isVisible": true, "items": [ { "dropEffect": "move", "endCol": 2, "fieldId": "resourceid", "height": 24, "id": "bac55b40-93c4-11e9-9dd5-3b4f6f9f1bae", "index": 0, "listId": "9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "resourcename", "height": 24, "id": "b80a59f0-93c4-11e9-9dd5-3b4f6f9f1bae", "index": 1, "listId": "9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "startCol": 0 }, { "endCol": 2, "fieldId": "resourcetype", "height": 24, "id": "c9fc50a0-93c4-11e9-9dd5-3b4f6f9f1bae", "index": 2, "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "region", "height": 24, "id": "c61a8290-93c4-11e9-9dd5-3b4f6f9f1bae", "index": 3, "listId": "9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "accountname", "height": 24, "id": "209fc340-3066-11ea-9aa4-0df78411179a", "index": 4, "listId": "9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "accountid", "height": 24, "id": "18654c40-a9d9-11e9-a91e-57df9227e86a", "index": 5, "listId": "9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "startCol": 0 }, { "endCol": 2, "fieldId": "resourceapiname", "height": 24, "id": "0a428600-a9d9-11e9-a91e-57df9227e86a", "index": 6, "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "resourcecloudtype", "height": 24, "id": "cc430c50-93c4-11e9-9dd5-3b4f6f9f1bae", "index": 7, "listId": "9c8d74a0-93c4-11e9-9dd5-3b4f6f9f1bae", "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Violating Resource", "static": false, "w": 1, "x": 1, "y": 0 }, { "description": "Policy compliance-related information.", "displayType": "ROW", "h": 3, "hideName": false, "i": "fyjdlofdhd-98793800-a9d5-11e9-a91e-57df9227e86a", "isVisible": true, "items": [ { "dropEffect": "move", "endCol": 6, "fieldId": "compliancemetadata", "height": 110, "id": "bea01080-a9d5-11e9-a91e-57df9227e86a", "index": 1, "listId": "fyjdlofdhd-98793800-a9d5-11e9-a91e-57df9227e86a", "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Policy Compliance Metadata", "static": false, "w": 3, "x": 0, "y": 8 }, { "description": "Resource subscription metadata.", "displayType": "ROW", "h": 3, "hideName": false, "i": "fyjdlofdhd-5a18c180-a9d9-11e9-a91e-57df9227e86a", "isVisible": true, "items": [ { "endCol": 2, "fieldId": "subscriptionid", "height": 24, "id": "83f1a580-a9d9-11e9-a91e-57df9227e86a", "index": 0, "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "subscriptionname", "height": 24, "id": "89d759e0-a9d9-11e9-a91e-57df9227e86a", "index": 1, "listId": "5a18c180-a9d9-11e9-a91e-57df9227e86a", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "subscriptiontype", "height": 24, "id": "8f7e0970-a9d9-11e9-a91e-57df9227e86a", "index": 2, "listId": "5a18c180-a9d9-11e9-a91e-57df9227e86a", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "subscriptiondescription", "height": 24, "id": "b0f03380-a9d9-11e9-a91e-57df9227e86a", "index": 3, "listId": "5a18c180-a9d9-11e9-a91e-57df9227e86a", "startCol": 0 }, { "dropEffect": "move", "endCol": 2, "fieldId": "skuname", "height": 24, "id": "a0994f30-a9d9-11e9-a91e-57df9227e86a", "index": 4, "listId": "5a18c180-a9d9-11e9-a91e-57df9227e86a", "startCol": 0 }, { "endCol": 2, "fieldId": "skutier", "height": 24, "id": "a21e6890-a9d9-11e9-a91e-57df9227e86a", "index": 5, "startCol": 0 }, { "endCol": 2, "fieldId": "subscriptioncreatedby", "height": 24, "id": "c4f66430-a9d9-11e9-a91e-57df9227e86a", "index": 6, "startCol": 0 }, { "endCol": 2, "fieldId": "subscriptioncreatedon", "height": 24, "id": "c67f2710-a9d9-11e9-a91e-57df9227e86a", "index": 7, "startCol": 0 }, { "endCol": 2, "fieldId": "subscriptionupdatedby", "height": 24, "id": "cdf73b40-a9d9-11e9-a91e-57df9227e86a", "index": 8, "startCol": 0 }, { "endCol": 2, "fieldId": "subscriptionupdatedon", "height": 24, "id": "cf929bc0-a9d9-11e9-a91e-57df9227e86a", "index": 9, "startCol": 0 }, { "endCol": 2, "fieldId": "subscriptionassignedby", "height": 24, "id": "dcfebc30-a9d9-11e9-a91e-57df9227e86a", "index": 10, "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Resource Subscription Details", "static": false, "w": 1, "x": 2, "y": 0 }, { "description": "Alert Rules created using the policy.", "displayType": "ROW", "h": 3, "hideItemTitleOnlyOne": true, "hideName": false, "i": "fyjdlofdhd-1adf4900-f761-11e9-8abd-b54c9337d32a", "items": [ { "dropEffect": "move", "endCol": 6, "fieldId": "prismacloudrules", "height": 110, "id": "aabb18d0-f8b8-11e9-a470-b7537b797c27", "index": 0, "listId": "fyjdlofdhd-1adf4900-f761-11e9-8abd-b54c9337d32a", "startCol": 0 } ], "maxW": 3, "minH": 1, "minW": 1, "moved": false, "name": "Alert Rules", "static": false, "w": 3, "x": 0, "y": 5 } ], "type": "custom" }, { "id": "warRoom", "name": "War Room", "type": "warRoom" }, { "id": "workPlan", "name": "Work Plan", "type": "workPlan" }, { "id": "evidenceBoard", "name": "Evidence Board", "type": "evidenceBoard" }, { "id": "relatedIncidents", "name": "Related Incidents", "type": "relatedIncidents" }, { "id": "canvas", "name": "Canvas", "type": "canvas" } ] } }
{ "pile_set_name": "Github" }
// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,darwin package unix const ( SYS_SYSCALL = 0 SYS_EXIT = 1 SYS_FORK = 2 SYS_READ = 3 SYS_WRITE = 4 SYS_OPEN = 5 SYS_CLOSE = 6 SYS_WAIT4 = 7 SYS_LINK = 9 SYS_UNLINK = 10 SYS_CHDIR = 12 SYS_FCHDIR = 13 SYS_MKNOD = 14 SYS_CHMOD = 15 SYS_CHOWN = 16 SYS_GETFSSTAT = 18 SYS_GETPID = 20 SYS_SETUID = 23 SYS_GETUID = 24 SYS_GETEUID = 25 SYS_PTRACE = 26 SYS_RECVMSG = 27 SYS_SENDMSG = 28 SYS_RECVFROM = 29 SYS_ACCEPT = 30 SYS_GETPEERNAME = 31 SYS_GETSOCKNAME = 32 SYS_ACCESS = 33 SYS_CHFLAGS = 34 SYS_FCHFLAGS = 35 SYS_SYNC = 36 SYS_KILL = 37 SYS_GETPPID = 39 SYS_DUP = 41 SYS_PIPE = 42 SYS_GETEGID = 43 SYS_SIGACTION = 46 SYS_GETGID = 47 SYS_SIGPROCMASK = 48 SYS_GETLOGIN = 49 SYS_SETLOGIN = 50 SYS_ACCT = 51 SYS_SIGPENDING = 52 SYS_SIGALTSTACK = 53 SYS_IOCTL = 54 SYS_REBOOT = 55 SYS_REVOKE = 56 SYS_SYMLINK = 57 SYS_READLINK = 58 SYS_EXECVE = 59 SYS_UMASK = 60 SYS_CHROOT = 61 SYS_MSYNC = 65 SYS_VFORK = 66 SYS_MUNMAP = 73 SYS_MPROTECT = 74 SYS_MADVISE = 75 SYS_MINCORE = 78 SYS_GETGROUPS = 79 SYS_SETGROUPS = 80 SYS_GETPGRP = 81 SYS_SETPGID = 82 SYS_SETITIMER = 83 SYS_SWAPON = 85 SYS_GETITIMER = 86 SYS_GETDTABLESIZE = 89 SYS_DUP2 = 90 SYS_FCNTL = 92 SYS_SELECT = 93 SYS_FSYNC = 95 SYS_SETPRIORITY = 96 SYS_SOCKET = 97 SYS_CONNECT = 98 SYS_GETPRIORITY = 100 SYS_BIND = 104 SYS_SETSOCKOPT = 105 SYS_LISTEN = 106 SYS_SIGSUSPEND = 111 SYS_GETTIMEOFDAY = 116 SYS_GETRUSAGE = 117 SYS_GETSOCKOPT = 118 SYS_READV = 120 SYS_WRITEV = 121 SYS_SETTIMEOFDAY = 122 SYS_FCHOWN = 123 SYS_FCHMOD = 124 SYS_SETREUID = 126 SYS_SETREGID = 127 SYS_RENAME = 128 SYS_FLOCK = 131 SYS_MKFIFO = 132 SYS_SENDTO = 133 SYS_SHUTDOWN = 134 SYS_SOCKETPAIR = 135 SYS_MKDIR = 136 SYS_RMDIR = 137 SYS_UTIMES = 138 SYS_FUTIMES = 139 SYS_ADJTIME = 140 SYS_GETHOSTUUID = 142 SYS_SETSID = 147 SYS_GETPGID = 151 SYS_SETPRIVEXEC = 152 SYS_PREAD = 153 SYS_PWRITE = 154 SYS_NFSSVC = 155 SYS_STATFS = 157 SYS_FSTATFS = 158 SYS_UNMOUNT = 159 SYS_GETFH = 161 SYS_QUOTACTL = 165 SYS_MOUNT = 167 SYS_CSOPS = 169 SYS_CSOPS_AUDITTOKEN = 170 SYS_WAITID = 173 SYS_KDEBUG_TYPEFILTER = 177 SYS_KDEBUG_TRACE_STRING = 178 SYS_KDEBUG_TRACE64 = 179 SYS_KDEBUG_TRACE = 180 SYS_SETGID = 181 SYS_SETEGID = 182 SYS_SETEUID = 183 SYS_SIGRETURN = 184 SYS_THREAD_SELFCOUNTS = 186 SYS_FDATASYNC = 187 SYS_STAT = 188 SYS_FSTAT = 189 SYS_LSTAT = 190 SYS_PATHCONF = 191 SYS_FPATHCONF = 192 SYS_GETRLIMIT = 194 SYS_SETRLIMIT = 195 SYS_GETDIRENTRIES = 196 SYS_MMAP = 197 SYS_LSEEK = 199 SYS_TRUNCATE = 200 SYS_FTRUNCATE = 201 SYS_SYSCTL = 202 SYS_MLOCK = 203 SYS_MUNLOCK = 204 SYS_UNDELETE = 205 SYS_OPEN_DPROTECTED_NP = 216 SYS_GETATTRLIST = 220 SYS_SETATTRLIST = 221 SYS_GETDIRENTRIESATTR = 222 SYS_EXCHANGEDATA = 223 SYS_SEARCHFS = 225 SYS_DELETE = 226 SYS_COPYFILE = 227 SYS_FGETATTRLIST = 228 SYS_FSETATTRLIST = 229 SYS_POLL = 230 SYS_WATCHEVENT = 231 SYS_WAITEVENT = 232 SYS_MODWATCH = 233 SYS_GETXATTR = 234 SYS_FGETXATTR = 235 SYS_SETXATTR = 236 SYS_FSETXATTR = 237 SYS_REMOVEXATTR = 238 SYS_FREMOVEXATTR = 239 SYS_LISTXATTR = 240 SYS_FLISTXATTR = 241 SYS_FSCTL = 242 SYS_INITGROUPS = 243 SYS_POSIX_SPAWN = 244 SYS_FFSCTL = 245 SYS_NFSCLNT = 247 SYS_FHOPEN = 248 SYS_MINHERIT = 250 SYS_SEMSYS = 251 SYS_MSGSYS = 252 SYS_SHMSYS = 253 SYS_SEMCTL = 254 SYS_SEMGET = 255 SYS_SEMOP = 256 SYS_MSGCTL = 258 SYS_MSGGET = 259 SYS_MSGSND = 260 SYS_MSGRCV = 261 SYS_SHMAT = 262 SYS_SHMCTL = 263 SYS_SHMDT = 264 SYS_SHMGET = 265 SYS_SHM_OPEN = 266 SYS_SHM_UNLINK = 267 SYS_SEM_OPEN = 268 SYS_SEM_CLOSE = 269 SYS_SEM_UNLINK = 270 SYS_SEM_WAIT = 271 SYS_SEM_TRYWAIT = 272 SYS_SEM_POST = 273 SYS_SYSCTLBYNAME = 274 SYS_OPEN_EXTENDED = 277 SYS_UMASK_EXTENDED = 278 SYS_STAT_EXTENDED = 279 SYS_LSTAT_EXTENDED = 280 SYS_FSTAT_EXTENDED = 281 SYS_CHMOD_EXTENDED = 282 SYS_FCHMOD_EXTENDED = 283 SYS_ACCESS_EXTENDED = 284 SYS_SETTID = 285 SYS_GETTID = 286 SYS_SETSGROUPS = 287 SYS_GETSGROUPS = 288 SYS_SETWGROUPS = 289 SYS_GETWGROUPS = 290 SYS_MKFIFO_EXTENDED = 291 SYS_MKDIR_EXTENDED = 292 SYS_IDENTITYSVC = 293 SYS_SHARED_REGION_CHECK_NP = 294 SYS_VM_PRESSURE_MONITOR = 296 SYS_PSYNCH_RW_LONGRDLOCK = 297 SYS_PSYNCH_RW_YIELDWRLOCK = 298 SYS_PSYNCH_RW_DOWNGRADE = 299 SYS_PSYNCH_RW_UPGRADE = 300 SYS_PSYNCH_MUTEXWAIT = 301 SYS_PSYNCH_MUTEXDROP = 302 SYS_PSYNCH_CVBROAD = 303 SYS_PSYNCH_CVSIGNAL = 304 SYS_PSYNCH_CVWAIT = 305 SYS_PSYNCH_RW_RDLOCK = 306 SYS_PSYNCH_RW_WRLOCK = 307 SYS_PSYNCH_RW_UNLOCK = 308 SYS_PSYNCH_RW_UNLOCK2 = 309 SYS_GETSID = 310 SYS_SETTID_WITH_PID = 311 SYS_PSYNCH_CVCLRPREPOST = 312 SYS_AIO_FSYNC = 313 SYS_AIO_RETURN = 314 SYS_AIO_SUSPEND = 315 SYS_AIO_CANCEL = 316 SYS_AIO_ERROR = 317 SYS_AIO_READ = 318 SYS_AIO_WRITE = 319 SYS_LIO_LISTIO = 320 SYS_IOPOLICYSYS = 322 SYS_PROCESS_POLICY = 323 SYS_MLOCKALL = 324 SYS_MUNLOCKALL = 325 SYS_ISSETUGID = 327 SYS___PTHREAD_KILL = 328 SYS___PTHREAD_SIGMASK = 329 SYS___SIGWAIT = 330 SYS___DISABLE_THREADSIGNAL = 331 SYS___PTHREAD_MARKCANCEL = 332 SYS___PTHREAD_CANCELED = 333 SYS___SEMWAIT_SIGNAL = 334 SYS_PROC_INFO = 336 SYS_SENDFILE = 337 SYS_STAT64 = 338 SYS_FSTAT64 = 339 SYS_LSTAT64 = 340 SYS_STAT64_EXTENDED = 341 SYS_LSTAT64_EXTENDED = 342 SYS_FSTAT64_EXTENDED = 343 SYS_GETDIRENTRIES64 = 344 SYS_STATFS64 = 345 SYS_FSTATFS64 = 346 SYS_GETFSSTAT64 = 347 SYS___PTHREAD_CHDIR = 348 SYS___PTHREAD_FCHDIR = 349 SYS_AUDIT = 350 SYS_AUDITON = 351 SYS_GETAUID = 353 SYS_SETAUID = 354 SYS_GETAUDIT_ADDR = 357 SYS_SETAUDIT_ADDR = 358 SYS_AUDITCTL = 359 SYS_BSDTHREAD_CREATE = 360 SYS_BSDTHREAD_TERMINATE = 361 SYS_KQUEUE = 362 SYS_KEVENT = 363 SYS_LCHOWN = 364 SYS_BSDTHREAD_REGISTER = 366 SYS_WORKQ_OPEN = 367 SYS_WORKQ_KERNRETURN = 368 SYS_KEVENT64 = 369 SYS___OLD_SEMWAIT_SIGNAL = 370 SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS_THREAD_SELFID = 372 SYS_LEDGER = 373 SYS_KEVENT_QOS = 374 SYS_KEVENT_ID = 375 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 SYS___MAC_SET_FILE = 383 SYS___MAC_GET_LINK = 384 SYS___MAC_SET_LINK = 385 SYS___MAC_GET_PROC = 386 SYS___MAC_SET_PROC = 387 SYS___MAC_GET_FD = 388 SYS___MAC_SET_FD = 389 SYS___MAC_GET_PID = 390 SYS_PSELECT = 394 SYS_PSELECT_NOCANCEL = 395 SYS_READ_NOCANCEL = 396 SYS_WRITE_NOCANCEL = 397 SYS_OPEN_NOCANCEL = 398 SYS_CLOSE_NOCANCEL = 399 SYS_WAIT4_NOCANCEL = 400 SYS_RECVMSG_NOCANCEL = 401 SYS_SENDMSG_NOCANCEL = 402 SYS_RECVFROM_NOCANCEL = 403 SYS_ACCEPT_NOCANCEL = 404 SYS_MSYNC_NOCANCEL = 405 SYS_FCNTL_NOCANCEL = 406 SYS_SELECT_NOCANCEL = 407 SYS_FSYNC_NOCANCEL = 408 SYS_CONNECT_NOCANCEL = 409 SYS_SIGSUSPEND_NOCANCEL = 410 SYS_READV_NOCANCEL = 411 SYS_WRITEV_NOCANCEL = 412 SYS_SENDTO_NOCANCEL = 413 SYS_PREAD_NOCANCEL = 414 SYS_PWRITE_NOCANCEL = 415 SYS_WAITID_NOCANCEL = 416 SYS_POLL_NOCANCEL = 417 SYS_MSGSND_NOCANCEL = 418 SYS_MSGRCV_NOCANCEL = 419 SYS_SEM_WAIT_NOCANCEL = 420 SYS_AIO_SUSPEND_NOCANCEL = 421 SYS___SIGWAIT_NOCANCEL = 422 SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 SYS___MAC_MOUNT = 424 SYS___MAC_GET_MOUNT = 425 SYS___MAC_GETFSSTAT = 426 SYS_FSGETPATH = 427 SYS_AUDIT_SESSION_SELF = 428 SYS_AUDIT_SESSION_JOIN = 429 SYS_FILEPORT_MAKEPORT = 430 SYS_FILEPORT_MAKEFD = 431 SYS_AUDIT_SESSION_PORT = 432 SYS_PID_SUSPEND = 433 SYS_PID_RESUME = 434 SYS_PID_HIBERNATE = 435 SYS_PID_SHUTDOWN_SOCKETS = 436 SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 SYS_KAS_INFO = 439 SYS_MEMORYSTATUS_CONTROL = 440 SYS_GUARDED_OPEN_NP = 441 SYS_GUARDED_CLOSE_NP = 442 SYS_GUARDED_KQUEUE_NP = 443 SYS_CHANGE_FDGUARD_NP = 444 SYS_USRCTL = 445 SYS_PROC_RLIMIT_CONTROL = 446 SYS_CONNECTX = 447 SYS_DISCONNECTX = 448 SYS_PEELOFF = 449 SYS_SOCKET_DELEGATE = 450 SYS_TELEMETRY = 451 SYS_PROC_UUID_POLICY = 452 SYS_MEMORYSTATUS_GET_LEVEL = 453 SYS_SYSTEM_OVERRIDE = 454 SYS_VFS_PURGE = 455 SYS_SFI_CTL = 456 SYS_SFI_PIDCTL = 457 SYS_COALITION = 458 SYS_COALITION_INFO = 459 SYS_NECP_MATCH_POLICY = 460 SYS_GETATTRLISTBULK = 461 SYS_CLONEFILEAT = 462 SYS_OPENAT = 463 SYS_OPENAT_NOCANCEL = 464 SYS_RENAMEAT = 465 SYS_FACCESSAT = 466 SYS_FCHMODAT = 467 SYS_FCHOWNAT = 468 SYS_FSTATAT = 469 SYS_FSTATAT64 = 470 SYS_LINKAT = 471 SYS_UNLINKAT = 472 SYS_READLINKAT = 473 SYS_SYMLINKAT = 474 SYS_MKDIRAT = 475 SYS_GETATTRLISTAT = 476 SYS_PROC_TRACE_LOG = 477 SYS_BSDTHREAD_CTL = 478 SYS_OPENBYID_NP = 479 SYS_RECVMSG_X = 480 SYS_SENDMSG_X = 481 SYS_THREAD_SELFUSAGE = 482 SYS_CSRCTL = 483 SYS_GUARDED_OPEN_DPROTECTED_NP = 484 SYS_GUARDED_WRITE_NP = 485 SYS_GUARDED_PWRITE_NP = 486 SYS_GUARDED_WRITEV_NP = 487 SYS_RENAMEATX_NP = 488 SYS_MREMAP_ENCRYPTED = 489 SYS_NETAGENT_TRIGGER = 490 SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 SYS_MICROSTACKSHOT = 492 SYS_GRAB_PGO_DATA = 493 SYS_PERSONA = 494 SYS_WORK_INTERVAL_CTL = 499 SYS_GETENTROPY = 500 SYS_NECP_OPEN = 501 SYS_NECP_CLIENT_ACTION = 502 SYS___NEXUS_OPEN = 503 SYS___NEXUS_REGISTER = 504 SYS___NEXUS_DEREGISTER = 505 SYS___NEXUS_CREATE = 506 SYS___NEXUS_DESTROY = 507 SYS___NEXUS_GET_OPT = 508 SYS___NEXUS_SET_OPT = 509 SYS___CHANNEL_OPEN = 510 SYS___CHANNEL_GET_INFO = 511 SYS___CHANNEL_SYNC = 512 SYS___CHANNEL_GET_OPT = 513 SYS___CHANNEL_SET_OPT = 514 SYS_ULOCK_WAIT = 515 SYS_ULOCK_WAKE = 516 SYS_FCLONEFILEAT = 517 SYS_FS_SNAPSHOT = 518 SYS_TERMINATE_WITH_PAYLOAD = 520 SYS_ABORT_WITH_PAYLOAD = 521 SYS_NECP_SESSION_OPEN = 522 SYS_NECP_SESSION_ACTION = 523 SYS_SETATTRLISTAT = 524 SYS_NET_QOS_GUIDELINE = 525 SYS_FMOUNT = 526 SYS_NTP_ADJTIME = 527 SYS_NTP_GETTIME = 528 SYS_OS_FAULT_WITH_PAYLOAD = 529 SYS_MAXSYSCALL = 530 SYS_INVALID = 63 )
{ "pile_set_name": "Github" }
# kubectl ## 增加 hosts 执行 kubectl 的主机必须能 ping 通节点,可以在主机增加 `hosts` ```bash NODE_IP NODE_NAME ``` 否则将不能执行 `exec` `port-forward` 等命令. * https://www.jianshu.com/p/258539db000a * https://kubernetes.io/zh/docs/user-guide/kubectl-overview/
{ "pile_set_name": "Github" }
/* * strlen - calculate the length of a string * * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. * See https://llvm.org/LICENSE.txt for license information. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ /* Assumptions: * * ARMv8-a, AArch64, unaligned accesses, min page size 4k. */ #include "../asmdefs.h" /* To test the page crossing code path more thoroughly, compile with -DTEST_PAGE_CROSS - this will force all calls through the slower entry path. This option is not intended for production use. */ /* Arguments and results. */ #define srcin x0 #define len x0 /* Locals and temporaries. */ #define src x1 #define data1 x2 #define data2 x3 #define has_nul1 x4 #define has_nul2 x5 #define tmp1 x4 #define tmp2 x5 #define tmp3 x6 #define tmp4 x7 #define zeroones x8 /* NUL detection works on the principle that (X - 1) & (~X) & 0x80 (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and can be done in parallel across the entire word. A faster check (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives false hits for characters 129..255. */ #define REP8_01 0x0101010101010101 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 #ifdef TEST_PAGE_CROSS # define MIN_PAGE_SIZE 15 #else # define MIN_PAGE_SIZE 4096 #endif /* Since strings are short on average, we check the first 16 bytes of the string for a NUL character. In order to do an unaligned ldp safely we have to do a page cross check first. If there is a NUL byte we calculate the length from the 2 8-byte words using conditional select to reduce branch mispredictions (it is unlikely __strlen_aarch64 will be repeatedly called on strings with the same length). If the string is longer than 16 bytes, we align src so don't need further page cross checks, and process 32 bytes per iteration using the fast NUL check. If we encounter non-ASCII characters, fallback to a second loop using the full NUL check. If the page cross check fails, we read 16 bytes from an aligned address, remove any characters before the string, and continue in the main loop using aligned loads. Since strings crossing a page in the first 16 bytes are rare (probability of 16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized. AArch64 systems have a minimum page size of 4k. We don't bother checking for larger page sizes - the cost of setting up the correct page size is just not worth the extra gain from a small reduction in the cases taking the slow path. Note that we only care about whether the first fetch, which may be misaligned, crosses a page boundary. */ ENTRY (__strlen_aarch64) and tmp1, srcin, MIN_PAGE_SIZE - 1 mov zeroones, REP8_01 cmp tmp1, MIN_PAGE_SIZE - 16 b.gt L(page_cross) ldp data1, data2, [srcin] #ifdef __AARCH64EB__ /* For big-endian, carry propagation (if the final byte in the string is 0x01) means we cannot use has_nul1/2 directly. Since we expect strings to be small and early-exit, byte-swap the data now so has_null1/2 will be correct. */ rev data1, data1 rev data2, data2 #endif sub tmp1, data1, zeroones orr tmp2, data1, REP8_7f sub tmp3, data2, zeroones orr tmp4, data2, REP8_7f bics has_nul1, tmp1, tmp2 bic has_nul2, tmp3, tmp4 ccmp has_nul2, 0, 0, eq beq L(main_loop_entry) /* Enter with C = has_nul1 == 0. */ csel has_nul1, has_nul1, has_nul2, cc mov len, 8 rev has_nul1, has_nul1 clz tmp1, has_nul1 csel len, xzr, len, cc add len, len, tmp1, lsr 3 ret /* The inner loop processes 32 bytes per iteration and uses the fast NUL check. If we encounter non-ASCII characters, use a second loop with the accurate NUL check. */ .p2align 4 L(main_loop_entry): bic src, srcin, 15 sub src, src, 16 L(main_loop): ldp data1, data2, [src, 32]! L(page_cross_entry): sub tmp1, data1, zeroones sub tmp3, data2, zeroones orr tmp2, tmp1, tmp3 tst tmp2, zeroones, lsl 7 bne 1f ldp data1, data2, [src, 16] sub tmp1, data1, zeroones sub tmp3, data2, zeroones orr tmp2, tmp1, tmp3 tst tmp2, zeroones, lsl 7 beq L(main_loop) add src, src, 16 1: /* The fast check failed, so do the slower, accurate NUL check. */ orr tmp2, data1, REP8_7f orr tmp4, data2, REP8_7f bics has_nul1, tmp1, tmp2 bic has_nul2, tmp3, tmp4 ccmp has_nul2, 0, 0, eq beq L(nonascii_loop) /* Enter with C = has_nul1 == 0. */ L(tail): #ifdef __AARCH64EB__ /* For big-endian, carry propagation (if the final byte in the string is 0x01) means we cannot use has_nul1/2 directly. The easiest way to get the correct byte is to byte-swap the data and calculate the syndrome a second time. */ csel data1, data1, data2, cc rev data1, data1 sub tmp1, data1, zeroones orr tmp2, data1, REP8_7f bic has_nul1, tmp1, tmp2 #else csel has_nul1, has_nul1, has_nul2, cc #endif sub len, src, srcin rev has_nul1, has_nul1 add tmp2, len, 8 clz tmp1, has_nul1 csel len, len, tmp2, cc add len, len, tmp1, lsr 3 ret L(nonascii_loop): ldp data1, data2, [src, 16]! sub tmp1, data1, zeroones orr tmp2, data1, REP8_7f sub tmp3, data2, zeroones orr tmp4, data2, REP8_7f bics has_nul1, tmp1, tmp2 bic has_nul2, tmp3, tmp4 ccmp has_nul2, 0, 0, eq bne L(tail) ldp data1, data2, [src, 16]! sub tmp1, data1, zeroones orr tmp2, data1, REP8_7f sub tmp3, data2, zeroones orr tmp4, data2, REP8_7f bics has_nul1, tmp1, tmp2 bic has_nul2, tmp3, tmp4 ccmp has_nul2, 0, 0, eq beq L(nonascii_loop) b L(tail) /* Load 16 bytes from [srcin & ~15] and force the bytes that precede srcin to 0x7f, so we ignore any NUL bytes before the string. Then continue in the aligned loop. */ L(page_cross): bic src, srcin, 15 ldp data1, data2, [src] lsl tmp1, srcin, 3 mov tmp4, -1 #ifdef __AARCH64EB__ /* Big-endian. Early bytes are at MSB. */ lsr tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */ #else /* Little-endian. Early bytes are at LSB. */ lsl tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */ #endif orr tmp1, tmp1, REP8_80 orn data1, data1, tmp1 orn tmp2, data2, tmp1 tst srcin, 8 csel data1, data1, tmp4, eq csel data2, data2, tmp2, eq b L(page_cross_entry) END (__strlen_aarch64)
{ "pile_set_name": "Github" }
package com.brioal.rxlearnapp.activity; import android.os.Bundle; import com.brioal.baselib.base.BaseActivity; import com.brioal.rxlearnapp.R; public class MainActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_main); } }
{ "pile_set_name": "Github" }
<?php namespace Test\Variables; use Test\Analyzer; include_once dirname(__DIR__, 2).'/Test/Analyzer.php'; class Php5IndirectExpression extends Analyzer { /* 1 methods */ public function testVariables_Php5IndirectExpression01() { $this->generic_test('Variables_Php5IndirectExpression.01'); } } ?>
{ "pile_set_name": "Github" }
package com.kelin.calendarlistview; import android.app.Application; /** * Created by kelin on 16-4-12. */ public class CalendarListViewApp extends Application { @Override public void onCreate() { super.onCreate(); } }
{ "pile_set_name": "Github" }
( var functions = (); // make a dictionary of functions var recSynth, recBufs, counter = 0, recording = false; var path = "~/tidalchunks/"; var whichOrbit = ~dirt.orbits[0]; var maxTime = 4; // allow a maximum of four seconds, adjust to your needs: this represents one tidal cycle var prevTime; if(pathMatch(path +/+ "*").isEmpty) { unixCmd("mkdir" + path) }; ~recBufs.do(_.free); // free them if they are left over (this is why we keep it in the environment variable) // we need two buffers ~recBufs = recBufs = { Buffer.alloc(~dirt.server, ~dirt.server.sampleRate * maxTime, ~dirt.numChannels) } ! 2; SynthDef(\record, { |bufnum| var in = InFeedback.ar(whichOrbit.outBus, ~dirt.numChannels); RecordBuf.ar(in, bufnum, loop:0, doneAction:2); }).add; functions[\startRec] = { if(recording) { functions[\stopRec].value }; counter = counter + 1; prevTime = Main.elapsedTime + ~latency; ~server.makeBundle(~latency, { recSynth = Synth(\record, [bufnum: (recBufs @@ counter)], ~server); recording = true; }) }; functions[\stopRec] = { if(recording) { ~server.makeBundle(~latency, { var p = path +/+ "chunk" ++ Date.localtime.stamp ++ ".aiff"; var buf = (recBufs @@ counter); buf.write(p.standardizePath, numFrames: Main.elapsedTime + ~latency - prevTime * buf.sampleRate); recSynth.free; recording = false; }) } }; // use the "diversion" key as a hook for playing the synth ~dirt.orbits[0].defaultParentEvent[\diversion] = { var div = functions[~s]; if(div.notNil) { div.value; 1.0 } }; ) // open the directory with the sound files systemCmd("open" + "~/tidalchunks/");
{ "pile_set_name": "Github" }
// 7.2.2 IsArray(argument) var cof = require('./$.cof'); module.exports = Array.isArray || function(arg){ return cof(arg) == 'Array'; };
{ "pile_set_name": "Github" }
![Decoraki Logo](http://www.decoraki.co/img/decoraki-full-logo.png) > 3D Simulator for interior design - http://www.decoraki.co ## Decoraki [![Build Status](https://img.shields.io/travis/vitorabner/decoraki/master.svg?style=flat)](https://travis-ci.org/vitorabner/decoraki) Decoraki is a 3D simulator that aims to help people to decorate and furnish their homes, providing them a way to inspire, combine products and bring their ideias to life. ## Install First install all dependecies ```sh npm install ``` And then run the project ```sh npm run dev ``` ## File format Decoraki only supports 3D collada(.dae) format. If you have another 3D file format, don't worry, it's very easy to convert. You can use softwares like SketchUp, Blender and Collada Exporter for Unity3D. ## How it works First we need to create a model(you can see all examples in src/helpers/decoraki.repository.js): ```sh var sofa = { model: 'Sofa01.dae', lightMap: 'Sofa01_LM.jpg', folderName: 'Sofa01', descriptionName: 'Kael The Invoker', descriptionImage: 'invoker.jpg', moveType: 'floor', category: 'furniture' }; ``` Two properties are important: category and moveType. The **category** property can be a room, furniture or texture, it defines the model's behavior. For example: If the model's category is a furniture you can drag, rotate and delete. The **moveType** property defines if an object can be dragged in wall, floor or both. To insert the sofa in simulator: ```sh simulator.insertObject(sofa); ``` ## Browser Support Unfortunately WebGL isn't fully supported by all browser, but as you can see [here](http://caniuse.com/#search=webgl) **Chrome(45+)** is the best browser to run this project. ## Contributing If you want to colaborate check the project's issues. 1. Fork the repository 2. Create a new branch 3. Implement your solution 4. Commit 5. Open a Pull Request Remeber: Always run lint and test. If you change the core system update the tests. Thanks! ## License [MIT License](https://github.com/vitorabner/decoraki/blob/master/LICENSE.md) © Vitor Abner
{ "pile_set_name": "Github" }
define([ "./var/arr", "./var/slice", "./var/concat", "./var/push", "./var/indexOf", "./var/class2type", "./var/toString", "./var/hasOwn", "./var/support" ], function( arr, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) { var // Use the correct document accordingly with window argument (sandbox) document = window.document, version = "@VERSION", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android<4.1 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: arr.sort, splice: arr.splice }; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // Skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // Extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray, isWindow: function( obj ) { return obj != null && obj === obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; }, isPlainObject: function( obj ) { // Not plain objects: // - Any object or value whose internal [[Class]] property is not "[object Object]" // - DOM nodes // - window if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } if ( obj.constructor && !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { return false; } // If the function hasn't returned already, we're confident that // |obj| is a plain object, created by {} or constructed with new Object return true; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, type: function( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android<4.0, iOS<6 (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call(obj) ] || "object" : typeof obj; }, // Evaluates a script in a global context globalEval: function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf("use strict") === 1 ) { script = document.createElement("script"); script.text = code; document.head.appendChild( script ).parentNode.removeChild( script ); } else { // Otherwise, avoid the DOM node creation, insertion // and removal by using an indirect global eval indirect( code ); } } }, // Convert dashed to camelCase; used by the css and data modules // Support: IE9-11+ // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // Support: Android<4.1 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArraylike( Object(arr) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; for ( ; j < len; j++ ) { first[ i++ ] = second[ j ]; } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; // Go through the array, translating each of the items to their new values if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } return jQuery; });
{ "pile_set_name": "Github" }
// // detail/solaris_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2018 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_SOLARIS_FENCED_BLOCK_HPP #define ASIO_DETAIL_SOLARIS_FENCED_BLOCK_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" #if defined(__sun) #include <atomic.h> #include "asio/detail/noncopyable.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace detail { class solaris_fenced_block : private noncopyable { public: enum half_t { half }; enum full_t { full }; // Constructor for a half fenced block. explicit solaris_fenced_block(half_t) { } // Constructor for a full fenced block. explicit solaris_fenced_block(full_t) { membar_consumer(); } // Destructor. ~solaris_fenced_block() { membar_producer(); } }; } // namespace detail } // namespace asio #include "asio/detail/pop_options.hpp" #endif // defined(__sun) #endif // ASIO_DETAIL_SOLARIS_FENCED_BLOCK_HPP
{ "pile_set_name": "Github" }
A
{ "pile_set_name": "Github" }
/* * Copyright 2016 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <folly/portability/Time.h> #include <chrono> #include <stdexcept> #include <utility> namespace folly { #ifdef CLOCK_MONOTONIC_COARSE struct monotonic_coarse_clock { typedef std::chrono::milliseconds::rep rep; typedef std::chrono::milliseconds::period period; typedef std::chrono::milliseconds duration; typedef std::chrono::time_point<monotonic_coarse_clock> time_point; constexpr static bool is_steady = true; static time_point now() { timespec ts; auto ret = clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); if (ret != 0) { throw std::runtime_error("Error using CLOCK_MONOTONIC_COARSE."); } return time_point( duration((ts.tv_sec * 1000) + ((ts.tv_nsec / 1000) / 1000))); } }; #else using monotonic_coarse_clock = std::chrono::steady_clock; #endif using monotonic_clock = std::chrono::steady_clock; /** * Calculates the duration of time intervals. Prefer this over directly using * monotonic clocks. It is very lightweight and provides convenient facilitles * to avoid common pitfalls. * * There are two type aliases that should be preferred over instantiating this * class directly: `coarse_stop_watch` and `stop_watch`. * * Arguments: * - Clock: the monotonic clock to use when calculating time intervals * - Duration: (optional) the duration to use when reporting elapsed time. * Defaults to the clock's duration. * * Example 1: * * coarse_stop_watch<std::seconds> watch; * do_something(); * std::cout << "time elapsed: " << watch.elapsed() << std::endl; * * auto const ttl = 60_s; * if (watch.elapsed(ttl)) { * process_expiration(); * } * * Example 2: * * struct run_every_n_seconds { * using callback = std::function<void()>; * run_every_n_seconds(std::chrono::seconds period, callback action) * period_(period), * action_(std::move(action)) * { * // watch_ is correctly initialized to the current time * } * * void run() { * while (true) { * if (watch_.lap(period_)) { * action_(); * } * std::this_thread::yield(); * } * } * * private: * stop_watch<> watch_; * std::chrono::seconds period_; * callback action_; * }; * * @author: Marcelo Juchem <[email protected]> */ template <typename Clock, typename Duration = typename Clock::duration> struct custom_stop_watch { using clock_type = Clock; using duration = Duration; using time_point = std::chrono::time_point<clock_type, duration>; static_assert( std::ratio_less_equal< typename clock_type::duration::period, typename duration::period>::value, "clock must be at least as precise as the requested duration"); static_assert( Clock::is_steady, "only monotonic clocks should be used to track time intervals"); /** * Initializes the stop watch with the current time as its checkpoint. * * Example: * * stop_watch<> watch; * do_something(); * std::cout << "time elapsed: " << watch.elapsed() << std::endl; * * @author: Marcelo Juchem <[email protected]> */ custom_stop_watch() : checkpoint_(clock_type::now()) {} /** * Initializes the stop watch with the given time as its checkpoint. * * NOTE: this constructor should be seldomly used. It is only provided so * that, in the rare occasions it is needed, one does not have to reimplement * the `custom_stop_watch` class. * * Example: * * custom_stop_watch<monotonic_clock> watch(monotonic_clock::now()); * do_something(); * std::cout << "time elapsed: " << watch.elapsed() << std::endl; * * @author: Marcelo Juchem <[email protected]> */ explicit custom_stop_watch(typename clock_type::time_point checkpoint) : checkpoint_(std::move(checkpoint)) {} /** * Updates the stop watch checkpoint to the current time. * * Example: * * struct some_resource { * // ... * * void on_reloaded() { * time_alive.reset(); * } * * void report() { * std::cout << "resource has been alive for " << time_alive.elapsed(); * } * * private: * stop_watch<> time_alive; * }; * * @author: Marcelo Juchem <[email protected]> */ void reset() { checkpoint_ = clock_type::now(); } /** * Tells the elapsed time since the last update. * * The stop watch's checkpoint remains unchanged. * * Example: * * stop_watch<> watch; * do_something(); * std::cout << "time elapsed: " << watch.elapsed() << std::endl; * * @author: Marcelo Juchem <[email protected]> */ duration elapsed() const { return std::chrono::duration_cast<duration>( clock_type::now() - checkpoint_); } /** * Tells whether the given duration has already elapsed since the last * checkpoint. * * Example: * * auto const ttl = 60_s; * stop_watch<> watch; * * do_something(); * * std::cout << "has the TTL expired? " std::boolalpha<< watch.elapsed(ttl); * * @author: Marcelo Juchem <[email protected]> */ template <typename UDuration> bool elapsed(UDuration&& amount) const { return clock_type::now() - checkpoint_ >= amount; } /** * Tells the elapsed time since the last update, and updates the checkpoint * to the current time. * * Example: * * struct some_resource { * // ... * * void on_reloaded() { * auto const alive = time_alive.lap(); * std::cout << "resource reloaded after being alive for " << alive; * } * * private: * stop_watch<> time_alive; * }; * * @author: Marcelo Juchem <[email protected]> */ duration lap() { auto lastCheckpoint = checkpoint_; checkpoint_ = clock_type::now(); return std::chrono::duration_cast<duration>(checkpoint_ - lastCheckpoint); } /** * Tells whether the given duration has already elapsed since the last * checkpoint. If so, update the checkpoint to the current time. If not, * the checkpoint remains unchanged. * * Example: * * void run_every_n_seconds( * std::chrono::seconds period, * std::function<void()> action * ) { * for (stop_watch<> watch;; ) { * if (watch.lap(period)) { * action(); * } * std::this_thread::yield(); * } * } * * @author: Marcelo Juchem <[email protected]> */ template <typename UDuration> bool lap(UDuration&& amount) { auto now = clock_type::now(); if (now - checkpoint_ < amount) { return false; } checkpoint_ = now; return true; } private: typename clock_type::time_point checkpoint_; }; /** * A type alias for `custom_stop_watch` that uses a coarse monotonic clock as * the time source. Refer to the documentation of `custom_stop_watch` for full * documentation. * * Arguments: * - Duration: (optional) the duration to use when reporting elapsed time. * Defaults to the clock's duration. * * Example: * * coarse_stop_watch<std::seconds> watch; * do_something(); * std::cout << "time elapsed: " << watch.elapsed() << std::endl; * * @author: Marcelo Juchem <[email protected]> */ template <typename Duration = monotonic_coarse_clock::duration> using coarse_stop_watch = custom_stop_watch<monotonic_coarse_clock, Duration>; /** * A type alias for `custom_stop_watch` that uses a monotonic clock as the time * source. Refer to the documentation of `custom_stop_watch` for full * documentation. * * Arguments: * - Duration: (optional) the duration to use when reporting elapsed time. * Defaults to the clock's duration. * * Example: * * stop_watch<std::seconds> watch; * do_something(); * std::cout << "time elapsed: " << watch.elapsed() << std::endl; * * @author: Marcelo Juchem <[email protected]> */ template <typename Duration = monotonic_clock::duration> using stop_watch = custom_stop_watch<monotonic_clock, Duration>; }
{ "pile_set_name": "Github" }
// Copyright (c) 2011-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. // // Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. #define __STDC_FORMAT_MACROS #ifndef GFLAGS #include <cstdio> int main() { fprintf(stderr, "Please install gflags to run rocksdb tools\n"); return 1; } #else #include <gflags/gflags.h> #include <atomic> #include <iostream> #include <memory> #include <thread> #include <type_traits> #include <vector> #include "db/dbformat.h" #include "db/memtable.h" #include "port/port.h" #include "port/stack_trace.h" #include "rocksdb/comparator.h" #include "rocksdb/memtablerep.h" #include "rocksdb/options.h" #include "rocksdb/slice_transform.h" #include "rocksdb/write_buffer_manager.h" #include "util/arena.h" #include "util/mutexlock.h" #include "util/stop_watch.h" #include "util/testutil.h" using GFLAGS::ParseCommandLineFlags; using GFLAGS::RegisterFlagValidator; using GFLAGS::SetUsageMessage; DEFINE_string(benchmarks, "fillrandom", "Comma-separated list of benchmarks to run. Options:\n" "\tfillrandom -- write N random values\n" "\tfillseq -- write N values in sequential order\n" "\treadrandom -- read N values in random order\n" "\treadseq -- scan the DB\n" "\treadwrite -- 1 thread writes while N - 1 threads " "do random\n" "\t reads\n" "\tseqreadwrite -- 1 thread writes while N - 1 threads " "do scans\n"); DEFINE_string(memtablerep, "skiplist", "Which implementation of memtablerep to use. See " "include/memtablerep.h for\n" " more details. Options:\n" "\tskiplist -- backed by a skiplist\n" "\tvector -- backed by an std::vector\n" "\thashskiplist -- backed by a hash skip list\n" "\thashlinklist -- backed by a hash linked list\n" "\tcuckoo -- backed by a cuckoo hash table"); DEFINE_int64(bucket_count, 1000000, "bucket_count parameter to pass into NewHashSkiplistRepFactory or " "NewHashLinkListRepFactory"); DEFINE_int32( hashskiplist_height, 4, "skiplist_height parameter to pass into NewHashSkiplistRepFactory"); DEFINE_int32( hashskiplist_branching_factor, 4, "branching_factor parameter to pass into NewHashSkiplistRepFactory"); DEFINE_int32( huge_page_tlb_size, 0, "huge_page_tlb_size parameter to pass into NewHashLinkListRepFactory"); DEFINE_int32(bucket_entries_logging_threshold, 4096, "bucket_entries_logging_threshold parameter to pass into " "NewHashLinkListRepFactory"); DEFINE_bool(if_log_bucket_dist_when_flash, true, "if_log_bucket_dist_when_flash parameter to pass into " "NewHashLinkListRepFactory"); DEFINE_int32( threshold_use_skiplist, 256, "threshold_use_skiplist parameter to pass into NewHashLinkListRepFactory"); DEFINE_int64( write_buffer_size, 256, "write_buffer_size parameter to pass into NewHashCuckooRepFactory"); DEFINE_int64( average_data_size, 64, "average_data_size parameter to pass into NewHashCuckooRepFactory"); DEFINE_int64( hash_function_count, 4, "hash_function_count parameter to pass into NewHashCuckooRepFactory"); DEFINE_int32( num_threads, 1, "Number of concurrent threads to run. If the benchmark includes writes,\n" "then at most one thread will be a writer"); DEFINE_int32(num_operations, 1000000, "Number of operations to do for write and random read benchmarks"); DEFINE_int32(num_scans, 10, "Number of times for each thread to scan the memtablerep for " "sequential read " "benchmarks"); DEFINE_int32(item_size, 100, "Number of bytes each item should be"); DEFINE_int32(prefix_length, 8, "Prefix length to pass into NewFixedPrefixTransform"); /* VectorRep settings */ DEFINE_int64(vectorrep_count, 0, "Number of entries to reserve on VectorRep initialization"); DEFINE_int64(seed, 0, "Seed base for random number generators. " "When 0 it is deterministic."); namespace rocksdb { namespace { struct CallbackVerifyArgs { bool found; LookupKey* key; MemTableRep* table; InternalKeyComparator* comparator; }; } // namespace // Helper for quickly generating random data. class RandomGenerator { private: std::string data_; unsigned int pos_; public: RandomGenerator() { Random rnd(301); auto size = (unsigned)std::max(1048576, FLAGS_item_size); test::RandomString(&rnd, size, &data_); pos_ = 0; } Slice Generate(unsigned int len) { assert(len <= data_.size()); if (pos_ + len > data_.size()) { pos_ = 0; } pos_ += len; return Slice(data_.data() + pos_ - len, len); } }; enum WriteMode { SEQUENTIAL, RANDOM, UNIQUE_RANDOM }; class KeyGenerator { public: KeyGenerator(Random64* rand, WriteMode mode, uint64_t num) : rand_(rand), mode_(mode), num_(num), next_(0) { if (mode_ == UNIQUE_RANDOM) { // NOTE: if memory consumption of this approach becomes a concern, // we can either break it into pieces and only random shuffle a section // each time. Alternatively, use a bit map implementation // (https://reviews.facebook.net/differential/diff/54627/) values_.resize(num_); for (uint64_t i = 0; i < num_; ++i) { values_[i] = i; } std::shuffle( values_.begin(), values_.end(), std::default_random_engine(static_cast<unsigned int>(FLAGS_seed))); } } uint64_t Next() { switch (mode_) { case SEQUENTIAL: return next_++; case RANDOM: return rand_->Next() % num_; case UNIQUE_RANDOM: return values_[next_++]; } assert(false); return std::numeric_limits<uint64_t>::max(); } private: Random64* rand_; WriteMode mode_; const uint64_t num_; uint64_t next_; std::vector<uint64_t> values_; }; class BenchmarkThread { public: explicit BenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits) : table_(table), key_gen_(key_gen), bytes_written_(bytes_written), bytes_read_(bytes_read), sequence_(sequence), num_ops_(num_ops), read_hits_(read_hits) {} virtual void operator()() = 0; virtual ~BenchmarkThread() {} protected: MemTableRep* table_; KeyGenerator* key_gen_; uint64_t* bytes_written_; uint64_t* bytes_read_; uint64_t* sequence_; uint64_t num_ops_; uint64_t* read_hits_; RandomGenerator generator_; }; class FillBenchmarkThread : public BenchmarkThread { public: FillBenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits) : BenchmarkThread(table, key_gen, bytes_written, bytes_read, sequence, num_ops, read_hits) {} void FillOne() { char* buf = nullptr; auto internal_key_size = 16; auto encoded_len = FLAGS_item_size + VarintLength(internal_key_size) + internal_key_size; KeyHandle handle = table_->Allocate(encoded_len, &buf); assert(buf != nullptr); char* p = EncodeVarint32(buf, internal_key_size); auto key = key_gen_->Next(); EncodeFixed64(p, key); p += 8; EncodeFixed64(p, ++(*sequence_)); p += 8; Slice bytes = generator_.Generate(FLAGS_item_size); memcpy(p, bytes.data(), FLAGS_item_size); p += FLAGS_item_size; assert(p == buf + encoded_len); table_->Insert(handle); *bytes_written_ += encoded_len; } void operator()() override { for (unsigned int i = 0; i < num_ops_; ++i) { FillOne(); } } }; class ConcurrentFillBenchmarkThread : public FillBenchmarkThread { public: ConcurrentFillBenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits, std::atomic_int* threads_done) : FillBenchmarkThread(table, key_gen, bytes_written, bytes_read, sequence, num_ops, read_hits) { threads_done_ = threads_done; } void operator()() override { // # of read threads will be total threads - write threads (always 1). Loop // while all reads complete. while ((*threads_done_).load() < (FLAGS_num_threads - 1)) { FillOne(); } } private: std::atomic_int* threads_done_; }; class ReadBenchmarkThread : public BenchmarkThread { public: ReadBenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits) : BenchmarkThread(table, key_gen, bytes_written, bytes_read, sequence, num_ops, read_hits) {} static bool callback(void* arg, const char* entry) { CallbackVerifyArgs* callback_args = static_cast<CallbackVerifyArgs*>(arg); assert(callback_args != nullptr); uint32_t key_length; const char* key_ptr = GetVarint32Ptr(entry, entry + 5, &key_length); if ((callback_args->comparator) ->user_comparator() ->Equal(Slice(key_ptr, key_length - 8), callback_args->key->user_key())) { callback_args->found = true; } return false; } void ReadOne() { std::string user_key; auto key = key_gen_->Next(); PutFixed64(&user_key, key); LookupKey lookup_key(user_key, *sequence_); InternalKeyComparator internal_key_comp(BytewiseComparator()); CallbackVerifyArgs verify_args; verify_args.found = false; verify_args.key = &lookup_key; verify_args.table = table_; verify_args.comparator = &internal_key_comp; table_->Get(lookup_key, &verify_args, callback); if (verify_args.found) { *bytes_read_ += VarintLength(16) + 16 + FLAGS_item_size; ++*read_hits_; } } void operator()() override { for (unsigned int i = 0; i < num_ops_; ++i) { ReadOne(); } } }; class SeqReadBenchmarkThread : public BenchmarkThread { public: SeqReadBenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits) : BenchmarkThread(table, key_gen, bytes_written, bytes_read, sequence, num_ops, read_hits) {} void ReadOneSeq() { std::unique_ptr<MemTableRep::Iterator> iter(table_->GetIterator()); for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { // pretend to read the value *bytes_read_ += VarintLength(16) + 16 + FLAGS_item_size; } ++*read_hits_; } void operator()() override { for (unsigned int i = 0; i < num_ops_; ++i) { { ReadOneSeq(); } } } }; class ConcurrentReadBenchmarkThread : public ReadBenchmarkThread { public: ConcurrentReadBenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits, std::atomic_int* threads_done) : ReadBenchmarkThread(table, key_gen, bytes_written, bytes_read, sequence, num_ops, read_hits) { threads_done_ = threads_done; } void operator()() override { for (unsigned int i = 0; i < num_ops_; ++i) { ReadOne(); } ++*threads_done_; } private: std::atomic_int* threads_done_; }; class SeqConcurrentReadBenchmarkThread : public SeqReadBenchmarkThread { public: SeqConcurrentReadBenchmarkThread(MemTableRep* table, KeyGenerator* key_gen, uint64_t* bytes_written, uint64_t* bytes_read, uint64_t* sequence, uint64_t num_ops, uint64_t* read_hits, std::atomic_int* threads_done) : SeqReadBenchmarkThread(table, key_gen, bytes_written, bytes_read, sequence, num_ops, read_hits) { threads_done_ = threads_done; } void operator()() override { for (unsigned int i = 0; i < num_ops_; ++i) { ReadOneSeq(); } ++*threads_done_; } private: std::atomic_int* threads_done_; }; class Benchmark { public: explicit Benchmark(MemTableRep* table, KeyGenerator* key_gen, uint64_t* sequence, uint32_t num_threads) : table_(table), key_gen_(key_gen), sequence_(sequence), num_threads_(num_threads) {} virtual ~Benchmark() {} virtual void Run() { std::cout << "Number of threads: " << num_threads_ << std::endl; std::vector<port::Thread> threads; uint64_t bytes_written = 0; uint64_t bytes_read = 0; uint64_t read_hits = 0; StopWatchNano timer(Env::Default(), true); RunThreads(&threads, &bytes_written, &bytes_read, true, &read_hits); auto elapsed_time = static_cast<double>(timer.ElapsedNanos() / 1000); std::cout << "Elapsed time: " << static_cast<int>(elapsed_time) << " us" << std::endl; if (bytes_written > 0) { auto MiB_written = static_cast<double>(bytes_written) / (1 << 20); auto write_throughput = MiB_written / (elapsed_time / 1000000); std::cout << "Total bytes written: " << MiB_written << " MiB" << std::endl; std::cout << "Write throughput: " << write_throughput << " MiB/s" << std::endl; auto us_per_op = elapsed_time / num_write_ops_per_thread_; std::cout << "write us/op: " << us_per_op << std::endl; } if (bytes_read > 0) { auto MiB_read = static_cast<double>(bytes_read) / (1 << 20); auto read_throughput = MiB_read / (elapsed_time / 1000000); std::cout << "Total bytes read: " << MiB_read << " MiB" << std::endl; std::cout << "Read throughput: " << read_throughput << " MiB/s" << std::endl; auto us_per_op = elapsed_time / num_read_ops_per_thread_; std::cout << "read us/op: " << us_per_op << std::endl; } } virtual void RunThreads(std::vector<port::Thread>* threads, uint64_t* bytes_written, uint64_t* bytes_read, bool write, uint64_t* read_hits) = 0; protected: MemTableRep* table_; KeyGenerator* key_gen_; uint64_t* sequence_; uint64_t num_write_ops_per_thread_; uint64_t num_read_ops_per_thread_; const uint32_t num_threads_; }; class FillBenchmark : public Benchmark { public: explicit FillBenchmark(MemTableRep* table, KeyGenerator* key_gen, uint64_t* sequence) : Benchmark(table, key_gen, sequence, 1) { num_write_ops_per_thread_ = FLAGS_num_operations; } void RunThreads(std::vector<port::Thread>* threads, uint64_t* bytes_written, uint64_t* bytes_read, bool write, uint64_t* read_hits) override { FillBenchmarkThread(table_, key_gen_, bytes_written, bytes_read, sequence_, num_write_ops_per_thread_, read_hits)(); } }; class ReadBenchmark : public Benchmark { public: explicit ReadBenchmark(MemTableRep* table, KeyGenerator* key_gen, uint64_t* sequence) : Benchmark(table, key_gen, sequence, FLAGS_num_threads) { num_read_ops_per_thread_ = FLAGS_num_operations / FLAGS_num_threads; } void RunThreads(std::vector<port::Thread>* threads, uint64_t* bytes_written, uint64_t* bytes_read, bool write, uint64_t* read_hits) override { for (int i = 0; i < FLAGS_num_threads; ++i) { threads->emplace_back( ReadBenchmarkThread(table_, key_gen_, bytes_written, bytes_read, sequence_, num_read_ops_per_thread_, read_hits)); } for (auto& thread : *threads) { thread.join(); } std::cout << "read hit%: " << (static_cast<double>(*read_hits) / FLAGS_num_operations) * 100 << std::endl; } }; class SeqReadBenchmark : public Benchmark { public: explicit SeqReadBenchmark(MemTableRep* table, uint64_t* sequence) : Benchmark(table, nullptr, sequence, FLAGS_num_threads) { num_read_ops_per_thread_ = FLAGS_num_scans; } void RunThreads(std::vector<port::Thread>* threads, uint64_t* bytes_written, uint64_t* bytes_read, bool write, uint64_t* read_hits) override { for (int i = 0; i < FLAGS_num_threads; ++i) { threads->emplace_back(SeqReadBenchmarkThread( table_, key_gen_, bytes_written, bytes_read, sequence_, num_read_ops_per_thread_, read_hits)); } for (auto& thread : *threads) { thread.join(); } } }; template <class ReadThreadType> class ReadWriteBenchmark : public Benchmark { public: explicit ReadWriteBenchmark(MemTableRep* table, KeyGenerator* key_gen, uint64_t* sequence) : Benchmark(table, key_gen, sequence, FLAGS_num_threads) { num_read_ops_per_thread_ = FLAGS_num_threads <= 1 ? 0 : (FLAGS_num_operations / (FLAGS_num_threads - 1)); num_write_ops_per_thread_ = FLAGS_num_operations; } void RunThreads(std::vector<port::Thread>* threads, uint64_t* bytes_written, uint64_t* bytes_read, bool write, uint64_t* read_hits) override { std::atomic_int threads_done; threads_done.store(0); threads->emplace_back(ConcurrentFillBenchmarkThread( table_, key_gen_, bytes_written, bytes_read, sequence_, num_write_ops_per_thread_, read_hits, &threads_done)); for (int i = 1; i < FLAGS_num_threads; ++i) { threads->emplace_back( ReadThreadType(table_, key_gen_, bytes_written, bytes_read, sequence_, num_read_ops_per_thread_, read_hits, &threads_done)); } for (auto& thread : *threads) { thread.join(); } } }; } // namespace rocksdb void PrintWarnings() { #if defined(__GNUC__) && !defined(__OPTIMIZE__) fprintf(stdout, "WARNING: Optimization is disabled: benchmarks unnecessarily slow\n"); #endif #ifndef NDEBUG fprintf(stdout, "WARNING: Assertions are enabled; benchmarks unnecessarily slow\n"); #endif } int main(int argc, char** argv) { rocksdb::port::InstallStackTraceHandler(); SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + " [OPTIONS]..."); ParseCommandLineFlags(&argc, &argv, true); PrintWarnings(); rocksdb::Options options; std::unique_ptr<rocksdb::MemTableRepFactory> factory; if (FLAGS_memtablerep == "skiplist") { factory.reset(new rocksdb::SkipListFactory); #ifndef ROCKSDB_LITE } else if (FLAGS_memtablerep == "vector") { factory.reset(new rocksdb::VectorRepFactory); } else if (FLAGS_memtablerep == "hashskiplist") { factory.reset(rocksdb::NewHashSkipListRepFactory( FLAGS_bucket_count, FLAGS_hashskiplist_height, FLAGS_hashskiplist_branching_factor)); options.prefix_extractor.reset( rocksdb::NewFixedPrefixTransform(FLAGS_prefix_length)); } else if (FLAGS_memtablerep == "hashlinklist") { factory.reset(rocksdb::NewHashLinkListRepFactory( FLAGS_bucket_count, FLAGS_huge_page_tlb_size, FLAGS_bucket_entries_logging_threshold, FLAGS_if_log_bucket_dist_when_flash, FLAGS_threshold_use_skiplist)); options.prefix_extractor.reset( rocksdb::NewFixedPrefixTransform(FLAGS_prefix_length)); } else if (FLAGS_memtablerep == "cuckoo") { factory.reset(rocksdb::NewHashCuckooRepFactory( FLAGS_write_buffer_size, FLAGS_average_data_size, static_cast<uint32_t>(FLAGS_hash_function_count))); options.prefix_extractor.reset( rocksdb::NewFixedPrefixTransform(FLAGS_prefix_length)); #endif // ROCKSDB_LITE } else { fprintf(stdout, "Unknown memtablerep: %s\n", FLAGS_memtablerep.c_str()); exit(1); } rocksdb::InternalKeyComparator internal_key_comp( rocksdb::BytewiseComparator()); rocksdb::MemTable::KeyComparator key_comp(internal_key_comp); rocksdb::Arena arena; rocksdb::WriteBufferManager wb(FLAGS_write_buffer_size); rocksdb::MemTableAllocator memtable_allocator(&arena, &wb); uint64_t sequence; auto createMemtableRep = [&] { sequence = 0; return factory->CreateMemTableRep(key_comp, &memtable_allocator, options.prefix_extractor.get(), options.info_log.get()); }; std::unique_ptr<rocksdb::MemTableRep> memtablerep; rocksdb::Random64 rng(FLAGS_seed); const char* benchmarks = FLAGS_benchmarks.c_str(); while (benchmarks != nullptr) { std::unique_ptr<rocksdb::KeyGenerator> key_gen; const char* sep = strchr(benchmarks, ','); rocksdb::Slice name; if (sep == nullptr) { name = benchmarks; benchmarks = nullptr; } else { name = rocksdb::Slice(benchmarks, sep - benchmarks); benchmarks = sep + 1; } std::unique_ptr<rocksdb::Benchmark> benchmark; if (name == rocksdb::Slice("fillseq")) { memtablerep.reset(createMemtableRep()); key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::SEQUENTIAL, FLAGS_num_operations)); benchmark.reset(new rocksdb::FillBenchmark(memtablerep.get(), key_gen.get(), &sequence)); } else if (name == rocksdb::Slice("fillrandom")) { memtablerep.reset(createMemtableRep()); key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::UNIQUE_RANDOM, FLAGS_num_operations)); benchmark.reset(new rocksdb::FillBenchmark(memtablerep.get(), key_gen.get(), &sequence)); } else if (name == rocksdb::Slice("readrandom")) { key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::RANDOM, FLAGS_num_operations)); benchmark.reset(new rocksdb::ReadBenchmark(memtablerep.get(), key_gen.get(), &sequence)); } else if (name == rocksdb::Slice("readseq")) { key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::SEQUENTIAL, FLAGS_num_operations)); benchmark.reset( new rocksdb::SeqReadBenchmark(memtablerep.get(), &sequence)); } else if (name == rocksdb::Slice("readwrite")) { memtablerep.reset(createMemtableRep()); key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::RANDOM, FLAGS_num_operations)); benchmark.reset(new rocksdb::ReadWriteBenchmark< rocksdb::ConcurrentReadBenchmarkThread>(memtablerep.get(), key_gen.get(), &sequence)); } else if (name == rocksdb::Slice("seqreadwrite")) { memtablerep.reset(createMemtableRep()); key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::RANDOM, FLAGS_num_operations)); benchmark.reset(new rocksdb::ReadWriteBenchmark< rocksdb::SeqConcurrentReadBenchmarkThread>(memtablerep.get(), key_gen.get(), &sequence)); } else { std::cout << "WARNING: skipping unknown benchmark '" << name.ToString() << std::endl; continue; } std::cout << "Running " << name.ToString() << std::endl; benchmark->Run(); } return 0; } #endif // GFLAGS
{ "pile_set_name": "Github" }
#!/usr/sbin/dtrace -Zs /* * tcl_procflow.d * * Example script from Chapter 8 of the book: DTrace: Dynamic Tracing in * Oracle Solaris, Mac OS X, and FreeBSD", by Brendan Gregg and Jim Mauro, * Prentice Hall, 2011. ISBN-10: 0132091518. http://dtracebook.com. * * See the book for the script description and warnings. Many of these are * provided as example solutions, and will need changes to work on your OS. */ #pragma D option quiet #pragma D option switchrate=10 self int depth; dtrace:::BEGIN { printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "PROCEDURE"); } tcl*:::proc-entry { printf("%3d %6d %-16d %*s-> %s\n", cpu, pid, timestamp / 1000, self->depth * 2, "", copyinstr(arg0)); self->depth++; } tcl*:::proc-return { self->depth -= self->depth > 0 ? 1 : 0; printf("%3d %6d %-16d %*s<- %s\n", cpu, pid, timestamp / 1000, self->depth * 2, "", copyinstr(arg0)); }
{ "pile_set_name": "Github" }
pixdesc-gbrp10le 870de5644f6eb7bfbf183bd89f45130a
{ "pile_set_name": "Github" }
/* * HD audio interface patch for Creative CA0132 chip. * CA0132 registers defines. * * Copyright (c) 2011, Creative Technology Ltd. * * This driver 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 driver is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CA0132_REGS_H #define __CA0132_REGS_H #define DSP_CHIP_OFFSET 0x100000 #define DSP_DBGCNTL_MODULE_OFFSET 0xE30 #define DSP_DBGCNTL_INST_OFFSET \ (DSP_CHIP_OFFSET + DSP_DBGCNTL_MODULE_OFFSET) #define DSP_DBGCNTL_EXEC_LOBIT 0x0 #define DSP_DBGCNTL_EXEC_HIBIT 0x3 #define DSP_DBGCNTL_EXEC_MASK 0xF #define DSP_DBGCNTL_SS_LOBIT 0x4 #define DSP_DBGCNTL_SS_HIBIT 0x7 #define DSP_DBGCNTL_SS_MASK 0xF0 #define DSP_DBGCNTL_STATE_LOBIT 0xA #define DSP_DBGCNTL_STATE_HIBIT 0xD #define DSP_DBGCNTL_STATE_MASK 0x3C00 #define XRAM_CHIP_OFFSET 0x0 #define XRAM_XRAM_CHANNEL_COUNT 0xE000 #define XRAM_XRAM_MODULE_OFFSET 0x0 #define XRAM_XRAM_CHAN_INCR 4 #define XRAM_XRAM_INST_OFFSET(_chan) \ (XRAM_CHIP_OFFSET + XRAM_XRAM_MODULE_OFFSET + \ (_chan * XRAM_XRAM_CHAN_INCR)) #define YRAM_CHIP_OFFSET 0x40000 #define YRAM_YRAM_CHANNEL_COUNT 0x8000 #define YRAM_YRAM_MODULE_OFFSET 0x0 #define YRAM_YRAM_CHAN_INCR 4 #define YRAM_YRAM_INST_OFFSET(_chan) \ (YRAM_CHIP_OFFSET + YRAM_YRAM_MODULE_OFFSET + \ (_chan * YRAM_YRAM_CHAN_INCR)) #define UC_CHIP_OFFSET 0x80000 #define UC_UC_CHANNEL_COUNT 0x10000 #define UC_UC_MODULE_OFFSET 0x0 #define UC_UC_CHAN_INCR 4 #define UC_UC_INST_OFFSET(_chan) \ (UC_CHIP_OFFSET + UC_UC_MODULE_OFFSET + \ (_chan * UC_UC_CHAN_INCR)) #define AXRAM_CHIP_OFFSET 0x3C000 #define AXRAM_AXRAM_CHANNEL_COUNT 0x1000 #define AXRAM_AXRAM_MODULE_OFFSET 0x0 #define AXRAM_AXRAM_CHAN_INCR 4 #define AXRAM_AXRAM_INST_OFFSET(_chan) \ (AXRAM_CHIP_OFFSET + AXRAM_AXRAM_MODULE_OFFSET + \ (_chan * AXRAM_AXRAM_CHAN_INCR)) #define AYRAM_CHIP_OFFSET 0x78000 #define AYRAM_AYRAM_CHANNEL_COUNT 0x1000 #define AYRAM_AYRAM_MODULE_OFFSET 0x0 #define AYRAM_AYRAM_CHAN_INCR 4 #define AYRAM_AYRAM_INST_OFFSET(_chan) \ (AYRAM_CHIP_OFFSET + AYRAM_AYRAM_MODULE_OFFSET + \ (_chan * AYRAM_AYRAM_CHAN_INCR)) #define DSPDMAC_CHIP_OFFSET 0x110000 #define DSPDMAC_DMA_CFG_CHANNEL_COUNT 12 #define DSPDMAC_DMACFG_MODULE_OFFSET 0xF00 #define DSPDMAC_DMACFG_CHAN_INCR 0x10 #define DSPDMAC_DMACFG_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_DMACFG_MODULE_OFFSET + \ (_chan * DSPDMAC_DMACFG_CHAN_INCR)) #define DSPDMAC_DMACFG_DBADR_LOBIT 0x0 #define DSPDMAC_DMACFG_DBADR_HIBIT 0x10 #define DSPDMAC_DMACFG_DBADR_MASK 0x1FFFF #define DSPDMAC_DMACFG_LP_LOBIT 0x11 #define DSPDMAC_DMACFG_LP_HIBIT 0x11 #define DSPDMAC_DMACFG_LP_MASK 0x20000 #define DSPDMAC_DMACFG_AINCR_LOBIT 0x12 #define DSPDMAC_DMACFG_AINCR_HIBIT 0x12 #define DSPDMAC_DMACFG_AINCR_MASK 0x40000 #define DSPDMAC_DMACFG_DWR_LOBIT 0x13 #define DSPDMAC_DMACFG_DWR_HIBIT 0x13 #define DSPDMAC_DMACFG_DWR_MASK 0x80000 #define DSPDMAC_DMACFG_AJUMP_LOBIT 0x14 #define DSPDMAC_DMACFG_AJUMP_HIBIT 0x17 #define DSPDMAC_DMACFG_AJUMP_MASK 0xF00000 #define DSPDMAC_DMACFG_AMODE_LOBIT 0x18 #define DSPDMAC_DMACFG_AMODE_HIBIT 0x19 #define DSPDMAC_DMACFG_AMODE_MASK 0x3000000 #define DSPDMAC_DMACFG_LK_LOBIT 0x1A #define DSPDMAC_DMACFG_LK_HIBIT 0x1A #define DSPDMAC_DMACFG_LK_MASK 0x4000000 #define DSPDMAC_DMACFG_AICS_LOBIT 0x1B #define DSPDMAC_DMACFG_AICS_HIBIT 0x1F #define DSPDMAC_DMACFG_AICS_MASK 0xF8000000 #define DSPDMAC_DMACFG_LP_SINGLE 0 #define DSPDMAC_DMACFG_LP_LOOPING 1 #define DSPDMAC_DMACFG_AINCR_XANDY 0 #define DSPDMAC_DMACFG_AINCR_XORY 1 #define DSPDMAC_DMACFG_DWR_DMA_RD 0 #define DSPDMAC_DMACFG_DWR_DMA_WR 1 #define DSPDMAC_DMACFG_AMODE_LINEAR 0 #define DSPDMAC_DMACFG_AMODE_RSV1 1 #define DSPDMAC_DMACFG_AMODE_WINTLV 2 #define DSPDMAC_DMACFG_AMODE_GINTLV 3 #define DSPDMAC_DSP_ADR_OFS_CHANNEL_COUNT 12 #define DSPDMAC_DSPADROFS_MODULE_OFFSET 0xF04 #define DSPDMAC_DSPADROFS_CHAN_INCR 0x10 #define DSPDMAC_DSPADROFS_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_DSPADROFS_MODULE_OFFSET + \ (_chan * DSPDMAC_DSPADROFS_CHAN_INCR)) #define DSPDMAC_DSPADROFS_COFS_LOBIT 0x0 #define DSPDMAC_DSPADROFS_COFS_HIBIT 0xF #define DSPDMAC_DSPADROFS_COFS_MASK 0xFFFF #define DSPDMAC_DSPADROFS_BOFS_LOBIT 0x10 #define DSPDMAC_DSPADROFS_BOFS_HIBIT 0x1F #define DSPDMAC_DSPADROFS_BOFS_MASK 0xFFFF0000 #define DSPDMAC_DSP_ADR_WOFS_CHANNEL_COUNT 12 #define DSPDMAC_DSPADRWOFS_MODULE_OFFSET 0xF04 #define DSPDMAC_DSPADRWOFS_CHAN_INCR 0x10 #define DSPDMAC_DSPADRWOFS_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_DSPADRWOFS_MODULE_OFFSET + \ (_chan * DSPDMAC_DSPADRWOFS_CHAN_INCR)) #define DSPDMAC_DSPADRWOFS_WCOFS_LOBIT 0x0 #define DSPDMAC_DSPADRWOFS_WCOFS_HIBIT 0xA #define DSPDMAC_DSPADRWOFS_WCOFS_MASK 0x7FF #define DSPDMAC_DSPADRWOFS_WCBFR_LOBIT 0xB #define DSPDMAC_DSPADRWOFS_WCBFR_HIBIT 0xF #define DSPDMAC_DSPADRWOFS_WCBFR_MASK 0xF800 #define DSPDMAC_DSPADRWOFS_WBOFS_LOBIT 0x10 #define DSPDMAC_DSPADRWOFS_WBOFS_HIBIT 0x1A #define DSPDMAC_DSPADRWOFS_WBOFS_MASK 0x7FF0000 #define DSPDMAC_DSPADRWOFS_WBBFR_LOBIT 0x1B #define DSPDMAC_DSPADRWOFS_WBBFR_HIBIT 0x1F #define DSPDMAC_DSPADRWOFS_WBBFR_MASK 0xF8000000 #define DSPDMAC_DSP_ADR_GOFS_CHANNEL_COUNT 12 #define DSPDMAC_DSPADRGOFS_MODULE_OFFSET 0xF04 #define DSPDMAC_DSPADRGOFS_CHAN_INCR 0x10 #define DSPDMAC_DSPADRGOFS_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_DSPADRGOFS_MODULE_OFFSET + \ (_chan * DSPDMAC_DSPADRGOFS_CHAN_INCR)) #define DSPDMAC_DSPADRGOFS_GCOFS_LOBIT 0x0 #define DSPDMAC_DSPADRGOFS_GCOFS_HIBIT 0x9 #define DSPDMAC_DSPADRGOFS_GCOFS_MASK 0x3FF #define DSPDMAC_DSPADRGOFS_GCS_LOBIT 0xA #define DSPDMAC_DSPADRGOFS_GCS_HIBIT 0xC #define DSPDMAC_DSPADRGOFS_GCS_MASK 0x1C00 #define DSPDMAC_DSPADRGOFS_GCBFR_LOBIT 0xD #define DSPDMAC_DSPADRGOFS_GCBFR_HIBIT 0xF #define DSPDMAC_DSPADRGOFS_GCBFR_MASK 0xE000 #define DSPDMAC_DSPADRGOFS_GBOFS_LOBIT 0x10 #define DSPDMAC_DSPADRGOFS_GBOFS_HIBIT 0x19 #define DSPDMAC_DSPADRGOFS_GBOFS_MASK 0x3FF0000 #define DSPDMAC_DSPADRGOFS_GBS_LOBIT 0x1A #define DSPDMAC_DSPADRGOFS_GBS_HIBIT 0x1C #define DSPDMAC_DSPADRGOFS_GBS_MASK 0x1C000000 #define DSPDMAC_DSPADRGOFS_GBBFR_LOBIT 0x1D #define DSPDMAC_DSPADRGOFS_GBBFR_HIBIT 0x1F #define DSPDMAC_DSPADRGOFS_GBBFR_MASK 0xE0000000 #define DSPDMAC_XFR_CNT_CHANNEL_COUNT 12 #define DSPDMAC_XFRCNT_MODULE_OFFSET 0xF08 #define DSPDMAC_XFRCNT_CHAN_INCR 0x10 #define DSPDMAC_XFRCNT_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_XFRCNT_MODULE_OFFSET + \ (_chan * DSPDMAC_XFRCNT_CHAN_INCR)) #define DSPDMAC_XFRCNT_CCNT_LOBIT 0x0 #define DSPDMAC_XFRCNT_CCNT_HIBIT 0xF #define DSPDMAC_XFRCNT_CCNT_MASK 0xFFFF #define DSPDMAC_XFRCNT_BCNT_LOBIT 0x10 #define DSPDMAC_XFRCNT_BCNT_HIBIT 0x1F #define DSPDMAC_XFRCNT_BCNT_MASK 0xFFFF0000 #define DSPDMAC_IRQ_CNT_CHANNEL_COUNT 12 #define DSPDMAC_IRQCNT_MODULE_OFFSET 0xF0C #define DSPDMAC_IRQCNT_CHAN_INCR 0x10 #define DSPDMAC_IRQCNT_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_IRQCNT_MODULE_OFFSET + \ (_chan * DSPDMAC_IRQCNT_CHAN_INCR)) #define DSPDMAC_IRQCNT_CICNT_LOBIT 0x0 #define DSPDMAC_IRQCNT_CICNT_HIBIT 0xF #define DSPDMAC_IRQCNT_CICNT_MASK 0xFFFF #define DSPDMAC_IRQCNT_BICNT_LOBIT 0x10 #define DSPDMAC_IRQCNT_BICNT_HIBIT 0x1F #define DSPDMAC_IRQCNT_BICNT_MASK 0xFFFF0000 #define DSPDMAC_AUD_CHSEL_CHANNEL_COUNT 12 #define DSPDMAC_AUDCHSEL_MODULE_OFFSET 0xFC0 #define DSPDMAC_AUDCHSEL_CHAN_INCR 0x4 #define DSPDMAC_AUDCHSEL_INST_OFFSET(_chan) \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_AUDCHSEL_MODULE_OFFSET + \ (_chan * DSPDMAC_AUDCHSEL_CHAN_INCR)) #define DSPDMAC_AUDCHSEL_ACS_LOBIT 0x0 #define DSPDMAC_AUDCHSEL_ACS_HIBIT 0x1F #define DSPDMAC_AUDCHSEL_ACS_MASK 0xFFFFFFFF #define DSPDMAC_CHNLSTART_MODULE_OFFSET 0xFF0 #define DSPDMAC_CHNLSTART_INST_OFFSET \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_CHNLSTART_MODULE_OFFSET) #define DSPDMAC_CHNLSTART_EN_LOBIT 0x0 #define DSPDMAC_CHNLSTART_EN_HIBIT 0xB #define DSPDMAC_CHNLSTART_EN_MASK 0xFFF #define DSPDMAC_CHNLSTART_VAI1_LOBIT 0xC #define DSPDMAC_CHNLSTART_VAI1_HIBIT 0xF #define DSPDMAC_CHNLSTART_VAI1_MASK 0xF000 #define DSPDMAC_CHNLSTART_DIS_LOBIT 0x10 #define DSPDMAC_CHNLSTART_DIS_HIBIT 0x1B #define DSPDMAC_CHNLSTART_DIS_MASK 0xFFF0000 #define DSPDMAC_CHNLSTART_VAI2_LOBIT 0x1C #define DSPDMAC_CHNLSTART_VAI2_HIBIT 0x1F #define DSPDMAC_CHNLSTART_VAI2_MASK 0xF0000000 #define DSPDMAC_CHNLSTATUS_MODULE_OFFSET 0xFF4 #define DSPDMAC_CHNLSTATUS_INST_OFFSET \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_CHNLSTATUS_MODULE_OFFSET) #define DSPDMAC_CHNLSTATUS_ISC_LOBIT 0x0 #define DSPDMAC_CHNLSTATUS_ISC_HIBIT 0xB #define DSPDMAC_CHNLSTATUS_ISC_MASK 0xFFF #define DSPDMAC_CHNLSTATUS_AOO_LOBIT 0xC #define DSPDMAC_CHNLSTATUS_AOO_HIBIT 0xC #define DSPDMAC_CHNLSTATUS_AOO_MASK 0x1000 #define DSPDMAC_CHNLSTATUS_AOU_LOBIT 0xD #define DSPDMAC_CHNLSTATUS_AOU_HIBIT 0xD #define DSPDMAC_CHNLSTATUS_AOU_MASK 0x2000 #define DSPDMAC_CHNLSTATUS_AIO_LOBIT 0xE #define DSPDMAC_CHNLSTATUS_AIO_HIBIT 0xE #define DSPDMAC_CHNLSTATUS_AIO_MASK 0x4000 #define DSPDMAC_CHNLSTATUS_AIU_LOBIT 0xF #define DSPDMAC_CHNLSTATUS_AIU_HIBIT 0xF #define DSPDMAC_CHNLSTATUS_AIU_MASK 0x8000 #define DSPDMAC_CHNLSTATUS_IEN_LOBIT 0x10 #define DSPDMAC_CHNLSTATUS_IEN_HIBIT 0x1B #define DSPDMAC_CHNLSTATUS_IEN_MASK 0xFFF0000 #define DSPDMAC_CHNLSTATUS_VAI0_LOBIT 0x1C #define DSPDMAC_CHNLSTATUS_VAI0_HIBIT 0x1F #define DSPDMAC_CHNLSTATUS_VAI0_MASK 0xF0000000 #define DSPDMAC_CHNLPROP_MODULE_OFFSET 0xFF8 #define DSPDMAC_CHNLPROP_INST_OFFSET \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_CHNLPROP_MODULE_OFFSET) #define DSPDMAC_CHNLPROP_DCON_LOBIT 0x0 #define DSPDMAC_CHNLPROP_DCON_HIBIT 0xB #define DSPDMAC_CHNLPROP_DCON_MASK 0xFFF #define DSPDMAC_CHNLPROP_FFS_LOBIT 0xC #define DSPDMAC_CHNLPROP_FFS_HIBIT 0xC #define DSPDMAC_CHNLPROP_FFS_MASK 0x1000 #define DSPDMAC_CHNLPROP_NAJ_LOBIT 0xD #define DSPDMAC_CHNLPROP_NAJ_HIBIT 0xD #define DSPDMAC_CHNLPROP_NAJ_MASK 0x2000 #define DSPDMAC_CHNLPROP_ENH_LOBIT 0xE #define DSPDMAC_CHNLPROP_ENH_HIBIT 0xE #define DSPDMAC_CHNLPROP_ENH_MASK 0x4000 #define DSPDMAC_CHNLPROP_MSPCE_LOBIT 0x10 #define DSPDMAC_CHNLPROP_MSPCE_HIBIT 0x1B #define DSPDMAC_CHNLPROP_MSPCE_MASK 0xFFF0000 #define DSPDMAC_CHNLPROP_AC_LOBIT 0x1C #define DSPDMAC_CHNLPROP_AC_HIBIT 0x1F #define DSPDMAC_CHNLPROP_AC_MASK 0xF0000000 #define DSPDMAC_ACTIVE_MODULE_OFFSET 0xFFC #define DSPDMAC_ACTIVE_INST_OFFSET \ (DSPDMAC_CHIP_OFFSET + DSPDMAC_ACTIVE_MODULE_OFFSET) #define DSPDMAC_ACTIVE_AAR_LOBIT 0x0 #define DSPDMAC_ACTIVE_AAR_HIBIT 0xB #define DSPDMAC_ACTIVE_AAR_MASK 0xFFF #define DSPDMAC_ACTIVE_WFR_LOBIT 0xC #define DSPDMAC_ACTIVE_WFR_HIBIT 0x17 #define DSPDMAC_ACTIVE_WFR_MASK 0xFFF000 #define DSP_AUX_MEM_BASE 0xE000 #define INVALID_CHIP_ADDRESS (~0U) #define X_SIZE (XRAM_XRAM_CHANNEL_COUNT * XRAM_XRAM_CHAN_INCR) #define Y_SIZE (YRAM_YRAM_CHANNEL_COUNT * YRAM_YRAM_CHAN_INCR) #define AX_SIZE (AXRAM_AXRAM_CHANNEL_COUNT * AXRAM_AXRAM_CHAN_INCR) #define AY_SIZE (AYRAM_AYRAM_CHANNEL_COUNT * AYRAM_AYRAM_CHAN_INCR) #define UC_SIZE (UC_UC_CHANNEL_COUNT * UC_UC_CHAN_INCR) #define XEXT_SIZE (X_SIZE + AX_SIZE) #define YEXT_SIZE (Y_SIZE + AY_SIZE) #define U64K 0x10000UL #define X_END (XRAM_CHIP_OFFSET + X_SIZE) #define X_EXT (XRAM_CHIP_OFFSET + XEXT_SIZE) #define AX_END (XRAM_CHIP_OFFSET + U64K*4) #define Y_END (YRAM_CHIP_OFFSET + Y_SIZE) #define Y_EXT (YRAM_CHIP_OFFSET + YEXT_SIZE) #define AY_END (YRAM_CHIP_OFFSET + U64K*4) #define UC_END (UC_CHIP_OFFSET + UC_SIZE) #define X_RANGE_MAIN(a, s) \ (((a)+((s)-1)*XRAM_XRAM_CHAN_INCR < X_END)) #define X_RANGE_AUX(a, s) \ (((a) >= X_END) && ((a)+((s)-1)*XRAM_XRAM_CHAN_INCR < AX_END)) #define X_RANGE_EXT(a, s) \ (((a)+((s)-1)*XRAM_XRAM_CHAN_INCR < X_EXT)) #define X_RANGE_ALL(a, s) \ (((a)+((s)-1)*XRAM_XRAM_CHAN_INCR < AX_END)) #define Y_RANGE_MAIN(a, s) \ (((a) >= YRAM_CHIP_OFFSET) && \ ((a)+((s)-1)*YRAM_YRAM_CHAN_INCR < Y_END)) #define Y_RANGE_AUX(a, s) \ (((a) >= Y_END) && \ ((a)+((s)-1)*YRAM_YRAM_CHAN_INCR < AY_END)) #define Y_RANGE_EXT(a, s) \ (((a) >= YRAM_CHIP_OFFSET) && \ ((a)+((s)-1)*YRAM_YRAM_CHAN_INCR < Y_EXT)) #define Y_RANGE_ALL(a, s) \ (((a) >= YRAM_CHIP_OFFSET) && \ ((a)+((s)-1)*YRAM_YRAM_CHAN_INCR < AY_END)) #define UC_RANGE(a, s) \ (((a) >= UC_CHIP_OFFSET) && \ ((a)+((s)-1)*UC_UC_CHAN_INCR < UC_END)) #define X_OFF(a) \ (((a) - XRAM_CHIP_OFFSET) / XRAM_XRAM_CHAN_INCR) #define AX_OFF(a) \ (((a) % (AXRAM_AXRAM_CHANNEL_COUNT * \ AXRAM_AXRAM_CHAN_INCR)) / AXRAM_AXRAM_CHAN_INCR) #define Y_OFF(a) \ (((a) - YRAM_CHIP_OFFSET) / YRAM_YRAM_CHAN_INCR) #define AY_OFF(a) \ (((a) % (AYRAM_AYRAM_CHANNEL_COUNT * \ AYRAM_AYRAM_CHAN_INCR)) / AYRAM_AYRAM_CHAN_INCR) #define UC_OFF(a) (((a) - UC_CHIP_OFFSET) / UC_UC_CHAN_INCR) #define X_EXT_MAIN_SIZE(a) (XRAM_XRAM_CHANNEL_COUNT - X_OFF(a)) #define X_EXT_AUX_SIZE(a, s) ((s) - X_EXT_MAIN_SIZE(a)) #define Y_EXT_MAIN_SIZE(a) (YRAM_YRAM_CHANNEL_COUNT - Y_OFF(a)) #define Y_EXT_AUX_SIZE(a, s) ((s) - Y_EXT_MAIN_SIZE(a)) #endif
{ "pile_set_name": "Github" }
# Ruby/Pango Ruby/Pango is a Ruby binding of pango based on GObject-Introspection. ## Requirements * [Ruby/GObject-Introspection](https://github.com/ruby-gnome/ruby-gnome) * [Ruby/GLib2](https://github.com/ruby-gnome/ruby-gnome) * [cairo/rcairo](http://cairographics.org/) ## Install gem install pango ## License Copyright (c) 2017 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Websites * https://ruby-gnome2.osdn.jp/ * https://github.com/ruby-gnome/ruby-gnome
{ "pile_set_name": "Github" }
/* QPBO.cpp */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "QPBO.h" template <typename REAL> QPBO<REAL>::QPBO(int node_num_max, int edge_num_max, void (*err_function)(char *)) : node_num(0), nodeptr_block(NULL), changed_list(NULL), fix_node_info_list(NULL), stage(0), all_edges_submodular(true), error_function(err_function), zero_energy(0) { node_num_max += 4; if (node_num_max < 16) node_num_max = 16; if (edge_num_max < 16) edge_num_max = 16; nodes[0] = (Node*) malloc(2*node_num_max*sizeof(Node)); arcs[0] = (Arc*) malloc(4*edge_num_max*sizeof(Arc)); if (!nodes[0] || !arcs[0]) { if (error_function) (*error_function)("Not enough memory!"); exit(1); } node_last[0] = nodes[0]; node_max[0] = nodes[1] = node_last[1] = nodes[0] + node_num_max; node_max[1] = nodes[1] + node_num_max; node_shift = node_num_max*sizeof(Node); arc_max[0] = arcs[1] = arcs[0] + 2*edge_num_max; arc_max[1] = arcs[1] + 2*edge_num_max; arc_shift = 2*edge_num_max*sizeof(Arc); maxflow_iteration = 0; memset(arcs[0], 0, 2*arc_shift); InitFreeList(); } template <typename REAL> void QPBO<REAL>::InitFreeList() { Arc* a; Arc* a_last_free; first_free = a_last_free = NULL; for (a=arcs[0]; a<arc_max[0]; a+=2) if (!a->sister) { if (a_last_free) a_last_free->next = a; else first_free = a; a_last_free = a; } if (a_last_free) a_last_free->next = NULL; } template <typename REAL> QPBO<REAL>::QPBO(QPBO<REAL>& q) : node_num(q.node_num), nodeptr_block(NULL), changed_list(NULL), fix_node_info_list(NULL), stage(q.stage), all_edges_submodular(q.all_edges_submodular), error_function(q.error_function), zero_energy(q.zero_energy) { int node_num_max = q.node_shift/sizeof(Node); int arc_num_max = (int)(q.arc_max[0] - q.arcs[0]); Node* i; Arc* a; nodes[0] = (Node*) malloc(2*node_num_max*sizeof(Node)); arcs[0] = (Arc*) malloc(2*arc_num_max*sizeof(Arc)); if (!nodes[0] || !arcs[0]) { if (error_function) (*error_function)("Not enough memory!"); exit(1); } node_last[0] = nodes[0] + node_num; node_max[0] = nodes[1] = nodes[0] + node_num_max; node_last[1] = nodes[1] + node_num; node_max[1] = nodes[1] + node_num_max; node_shift = node_num_max*sizeof(Node); arc_max[0] = arcs[1] = arcs[0] + arc_num_max; arc_max[1] = arcs[1] + arc_num_max; arc_shift = arc_num_max*sizeof(Arc); maxflow_iteration = 0; memcpy(nodes[0], q.nodes[0], 2*node_num_max*sizeof(Node)); memcpy(arcs[0], q.arcs[0], 2*arc_num_max*sizeof(Arc)); for (i=nodes[0]; i<node_last[stage]; i++) { if (i==node_last[0]) i = nodes[1]; if (i->first) i->first = (Arc*) ((char*)i->first + (((char*) arcs[0]) - ((char*) q.arcs[0]))); } for (a=arcs[0]; a<arc_max[stage]; a++) { if (a == arc_max[0]) a = arcs[1]; if (a->sister) { a->head = (Node*) ((char*)a->head + (((char*) nodes[0]) - ((char*) q.nodes[0]))); if (a->next) a->next = (Arc*) ((char*)a->next + (((char*) arcs[0]) - ((char*) q.arcs[0]))); a->sister = (Arc*) ((char*)a->sister + (((char*) arcs[0]) - ((char*) q.arcs[0]))); } } InitFreeList(); } template <typename REAL> QPBO<REAL>::~QPBO() { if (nodeptr_block) { delete nodeptr_block; nodeptr_block = NULL; } if (changed_list) { delete changed_list; changed_list = NULL; } if (fix_node_info_list) { delete fix_node_info_list; fix_node_info_list = NULL; } free(nodes[0]); free(arcs[0]); } template <typename REAL> void QPBO<REAL>::Reset() { node_last[0] = nodes[0]; node_last[1] = nodes[1]; node_num = 0; if (nodeptr_block) { delete nodeptr_block; nodeptr_block = NULL; } if (changed_list) { delete changed_list; changed_list = NULL; } if (fix_node_info_list) { delete fix_node_info_list; fix_node_info_list = NULL; } maxflow_iteration = 0; zero_energy = 0; stage = 0; all_edges_submodular = true; memset(arcs[0], 0, 2*arc_shift); InitFreeList(); } template <typename REAL> void QPBO<REAL>::reallocate_nodes(int node_num_max_new) { code_assert(node_num_max_new > node_shift/((int)sizeof(Node))); Node* nodes_old[2] = { nodes[0], nodes[1] }; int node_num_max = node_num_max_new; nodes[0] = (Node*) realloc(nodes_old[0], 2*node_num_max*sizeof(Node)); if (!nodes[0]) { if (error_function) (*error_function)("Not enough memory!"); exit(1); } node_shift = node_num_max*sizeof(Node); node_last[0] = nodes[0] + node_num; node_max[0] = nodes[1] = nodes[0] + node_num_max; node_last[1] = nodes[1] + node_num; node_max[1] = nodes[1] + node_num_max; if (stage) { memmove(nodes[1], (char*)nodes[0] + ((char*)nodes_old[1] - (char*)nodes_old[0]), node_num*sizeof(Node)); } Arc* a; for (a=arcs[0]; a<arc_max[stage]; a++) { if (a->sister) { int k = (a->head < nodes_old[1]) ? 0 : 1; a->head = (Node*) ((char*)a->head + (((char*) nodes[k]) - ((char*) nodes_old[k]))); } } } template <typename REAL> void QPBO<REAL>::reallocate_arcs(int arc_num_max_new) { int arc_num_max_old = (int)(arc_max[0] - arcs[0]); int arc_num_max = arc_num_max_new; if (arc_num_max & 1) arc_num_max ++; code_assert(arc_num_max > arc_num_max_old); Arc* arcs_old[2] = { arcs[0], arcs[1] }; arcs[0] = (Arc*) realloc(arcs_old[0], 2*arc_num_max*sizeof(Arc)); if (!arcs[0]) { if (error_function) (*error_function)("Not enough memory!"); exit(1); } arc_shift = arc_num_max*sizeof(Arc); arc_max[0] = arcs[1] = arcs[0] + arc_num_max; arc_max[1] = arcs[1] + arc_num_max; if (stage) { memmove(arcs[1], arcs[0]+arc_num_max_old, arc_num_max_old*sizeof(Arc)); memset(arcs[0]+arc_num_max_old, 0, (arc_num_max-arc_num_max_old)*sizeof(Arc)); memset(arcs[1]+arc_num_max_old, 0, (arc_num_max-arc_num_max_old)*sizeof(Arc)); } else { memset(arcs[0]+arc_num_max_old, 0, (2*arc_num_max-arc_num_max_old)*sizeof(Arc)); } Node* i; Arc* a; for (i=nodes[0]; i<node_last[stage]; i++) { if (i==node_last[0]) i = nodes[1]; if (i->first) { int k = (i->first < arcs_old[1]) ? 0 : 1; i->first = (Arc*) ((char*)i->first + (((char*) arcs[k]) - ((char*) arcs_old[k]))); } } for (a=arcs[0]; a<arc_max[stage]; a++) { if (a->sister) { if (a->next) { int k = (a->next < arcs_old[1]) ? 0 : 1; a->next = (Arc*) ((char*)a->next + (((char*) arcs[k]) - ((char*) arcs_old[k]))); } int k = (a->sister < arcs_old[1]) ? 0 : 1; a->sister = (Arc*) ((char*)a->sister + (((char*) arcs[k]) - ((char*) arcs_old[k]))); } } InitFreeList(); } ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// template <typename REAL> bool QPBO<REAL>::Save(char* filename, int format) { int e; int edge_num = 0; for (e=GetNextEdgeId(-1); e>=0; e=GetNextEdgeId(e)) edge_num ++; if (format == 0) { FILE* fp; REAL E0, E1, E00, E01, E10, E11; int i, j; char* type_name; char* type_format; char FORMAT_LINE[64]; int factor = (stage == 0) ? 2 : 1; get_type_information(type_name, type_format); fp = fopen(filename, "w"); if (!fp) return false; fprintf(fp, "nodes=%d\n", GetNodeNum()); fprintf(fp, "edges=%d\n", edge_num); fprintf(fp, "labels=2\n"); fprintf(fp, "type=%s\n", type_name); fprintf(fp, "\n"); sprintf(FORMAT_LINE, "n %%d\t%%%s %%%s\n", type_format, type_format); for (i=0; i<GetNodeNum(); i++) { GetTwiceUnaryTerm(i, E0, E1); REAL delta = (E0 < E1) ? E0 : E1; fprintf(fp, FORMAT_LINE, i, (E0-delta)/factor, (E1-delta)/factor); } sprintf(FORMAT_LINE, "e %%d %%d\t%%%s %%%s %%%s %%%s\n", type_format, type_format, type_format, type_format); for (e=GetNextEdgeId(-1); e>=0; e=GetNextEdgeId(e)) { GetTwicePairwiseTerm(e, i, j, E00, E01, E10, E11); fprintf(fp, FORMAT_LINE, i, j, E00/factor, E01/factor, E10/factor, E11/factor); } fclose(fp); return true; } if (format == 1) { FILE* fp; REAL E0, E1, E00, E01, E10, E11; int i, j; Arc* a; char* type_name; char* type_format; if (stage == 0) Solve(); get_type_information(type_name, type_format); if (type_format[0] != 'd') return false; fp = fopen(filename, "w"); if (!fp) return false; fprintf(fp, "p %d %d\n", GetNodeNum(), GetNodeNum() + edge_num); for (i=0; i<GetNodeNum(); i++) { GetTwiceUnaryTerm(i, E0, E1); REAL delta = E1 - E0; for (a=nodes[0][i].first; a; a=a->next) { if (IsNode0(a->head)) delta += a->sister->r_cap + GetMate(a)->sister->r_cap; else delta -= a->r_cap + GetMate(a)->r_cap; } fprintf(fp, "1 %d %d\n", i+1, delta); } for (e=GetNextEdgeId(-1); e>=0; e=GetNextEdgeId(e)) { GetTwicePairwiseTerm(e, i, j, E00, E01, E10, E11); fprintf(fp, "2 %d %d %d\n", i+1, j+1, E00 + E11 - E01 - E10); } fclose(fp); return true; } return false; } template <typename REAL> bool QPBO<REAL>::Load(char* filename) { FILE* fp; REAL E0, E1, E00, E01, E10, E11; int i, j; char* type_name; char* type_format; char LINE[256], FORMAT_LINE_NODE[64], FORMAT_LINE_EDGE[64]; int NODE_NUM, EDGE_NUM, K; get_type_information(type_name, type_format); fp = fopen(filename, "r"); if (!fp) { printf("Cannot open %s\n", filename); return false; } if (fscanf(fp, "nodes=%d\n", &NODE_NUM) != 1) { printf("%s: wrong format\n", filename); fclose(fp); return false; } if (fscanf(fp, "edges=%d\n", &EDGE_NUM) != 1) { printf("%s: wrong format\n", filename); fclose(fp); return false; } if (fscanf(fp, "labels=%d\n", &K) != 1) { printf("%s: wrong format\n", filename); fclose(fp); return false; } if (K != 2) { printf("%s: wrong number of labels\n", filename); fclose(fp); return false; } if (fscanf(fp, "type=%10s\n", LINE) != 1) { printf("%s: wrong format\n", filename); fclose(fp); return false; } if (strcmp(LINE, type_name)) { printf("%s: type REAL mismatch\n", filename); fclose(fp); return false; } Reset(); AddNode(NODE_NUM+4); node_num -= 4; node_last[0] -= 4; node_last[1] -= 4; sprintf(FORMAT_LINE_NODE, "n %%d %%%s %%%s\n", type_format, type_format); sprintf(FORMAT_LINE_EDGE, "e %%d %%d %%%s %%%s %%%s %%%s\n", type_format, type_format, type_format, type_format); while (fgets(LINE, sizeof(LINE), fp)) { if (sscanf(LINE, FORMAT_LINE_EDGE, &i, &j, &E00, &E01, &E10, &E11) == 6) { if (i<0 || i>=NODE_NUM || j<0 || j>=NODE_NUM || i==j) { printf("%s: wrong format\n", filename); fclose(fp); return false; } AddPairwiseTerm(i, j, E00, E01, E10, E11); } else if (sscanf(LINE, FORMAT_LINE_NODE, &i, &E0, &E1) == 3) { if (i<0 || i>=NODE_NUM) { printf("%s: wrong format\n", filename); fclose(fp); return false; } AddUnaryTerm(i, E0, E1); } } fclose(fp); return true; } ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// #define SET_SISTERS(a, a_rev) (a)->sister = (a_rev); (a_rev)->sister = (a); #define SET_FROM(a, i) (a)->next = (i)->first; (i)->first = (a); #define REMOVE_FROM(a, i) if ((i)->first==(a)) (i)->first=(a)->next;\ else { Arc* a_TMP_REMOVE_FROM; for (a_TMP_REMOVE_FROM=i->first; ; a_TMP_REMOVE_FROM=a_TMP_REMOVE_FROM->next)\ if (a_TMP_REMOVE_FROM->next==(a)) { a_TMP_REMOVE_FROM->next=(a)->next; break; } } #define SET_TO(a, j) (a)->head = (j); template <typename REAL> typename QPBO<REAL>::EdgeId QPBO<REAL>::AddPairwiseTerm(NodeId _i, NodeId _j, REAL E00, REAL E01, REAL E10, REAL E11) { user_assert(_i >= 0 && _i < node_num); user_assert(_j >= 0 && _j < node_num); user_assert(_i != _j); REAL ci, cj, cij, cji; if (!first_free) { int k = GetMaxEdgeNum(); reallocate_arcs(2*(GetMaxEdgeNum() + GetMaxEdgeNum()/2)); } EdgeId e = (int)(first_free - arcs[0])/2; first_free = first_free->next; if (stage == 0) { Arc *a, *a_rev; a = &arcs[0][2*e]; a_rev = &arcs[0][2*e+1]; Node* i = nodes[0] + _i; Node* j = nodes[0] + _j; if (E01 + E10 >= E00 + E11) { ComputeWeights(E00, E01, E10, E11, ci, cj, cij, cji); SET_TO(a, j); SET_FROM(a, i); SET_FROM(a_rev, j); j->tr_cap += cj; } else { all_edges_submodular = false; ComputeWeights(E01, E00, E11, E10, ci, cj, cij, cji); SET_TO(a, GetMate0(j)); a->next = NULL; a_rev->next = NULL; j->tr_cap -= cj; } SET_SISTERS(a, a_rev); SET_TO(a_rev, i); i->tr_cap += ci; a->r_cap = cij; a_rev->r_cap = cji; } else { Arc *a[2], *a_rev[2]; a[0] = &arcs[0][2*e]; a_rev[0] = &arcs[0][2*e+1]; a[1] = &arcs[1][2*e]; a_rev[1] = &arcs[1][2*e+1]; Node* i[2] = { nodes[0] + _i, nodes[1] + _i }; Node* j[2]; if (E01 + E10 >= E00 + E11) { j[0] = nodes[0] + _j; j[1] = nodes[1] + _j; ComputeWeights(E00, E01, E10, E11, ci, cj, cij, cji); } else { j[1] = nodes[0] + _j; j[0] = nodes[1] + _j; ComputeWeights(E01, E00, E11, E10, ci, cj, cij, cji); } SET_SISTERS(a[0], a_rev[0]); SET_SISTERS(a[1], a_rev[1]); SET_TO(a[0], j[0]); SET_TO(a_rev[0], i[0]); SET_TO(a[1], i[1]); SET_TO(a_rev[1], j[1]); SET_FROM(a[0], i[0]); SET_FROM(a_rev[0], j[0]); SET_FROM(a[1], j[1]); SET_FROM(a_rev[1], i[1]); i[0]->tr_cap += ci; i[1]->tr_cap -= ci; j[0]->tr_cap += cj; j[1]->tr_cap -= cj; a[0]->r_cap = a[1]->r_cap = cij; a_rev[0]->r_cap = a_rev[1]->r_cap = cji; } zero_energy += E00; return e; } template <typename REAL> void QPBO<REAL>::AddPairwiseTerm(EdgeId e, NodeId _i, NodeId _j, REAL E00, REAL E01, REAL E10, REAL E11) { user_assert(e >= 0 && arcs[0][2*e].sister); user_assert(arcs[0][2*e].head==&nodes[0][_i] || arcs[0][2*e].head==&nodes[1][_i] || arcs[0][2*e].head==&nodes[0][_j] || arcs[0][2*e].head==&nodes[1][_j]); user_assert(arcs[0][2*e+1].head==&nodes[0][_i] || arcs[0][2*e+1].head==&nodes[1][_i] || arcs[0][2*e+1].head==&nodes[0][_j] || arcs[0][2*e+1].head==&nodes[1][_j]); user_assert(_i != _j); REAL delta, ci, cj, cij, cji; if (stage == 0) { Arc* a = &arcs[0][2*e]; Arc* a_rev = &arcs[0][2*e+1]; code_assert(a->sister==a_rev && a->sister==a_rev); Node* i = a_rev->head; Node* j = a->head; code_assert(IsNode0(i)); if (i != &nodes[0][_i]) { delta = E01; E01 = E10; E10 = delta; } if (IsNode0(j)) { ComputeWeights(E00, E01, E10, E11, ci, cj, cij, cji); i->tr_cap += ci; j->tr_cap += cj; a->r_cap += cij; a_rev->r_cap += cji; if (a->r_cap < 0) { delta = a->r_cap; a->r_cap = 0; a_rev->r_cap += delta; i->tr_cap -= delta; j->tr_cap += delta; } if (a_rev->r_cap < 0) { delta = a_rev->r_cap; a_rev->r_cap = 0; a->r_cap += delta; j->tr_cap -= delta; i->tr_cap += delta; } if (a->r_cap < 0) { all_edges_submodular = false; REMOVE_FROM(a, i); REMOVE_FROM(a_rev, j); SET_TO(a, GetMate0(j)); delta = a->r_cap; i->tr_cap -= delta; a->r_cap = -delta; } } else { j = GetMate1(j); ComputeWeights(E01, E00, E11, E10, ci, cj, cij, cji); i->tr_cap += ci; j->tr_cap -= cj; a->r_cap += cij; a_rev->r_cap += cji; if (a->r_cap < 0) { delta = a->r_cap; a->r_cap = 0; a_rev->r_cap += delta; i->tr_cap -= delta; j->tr_cap -= delta; } if (a_rev->r_cap < 0) { delta = a_rev->r_cap; a_rev->r_cap = 0; a->r_cap += delta; j->tr_cap += delta; i->tr_cap += delta; } if (a->r_cap < 0) { SET_FROM(a, i); SET_FROM(a_rev, j); SET_TO(a, j); delta = a->r_cap; i->tr_cap -= delta; a->r_cap = -delta; } } } else { Arc* a[2] = { &arcs[0][2*e], &arcs[1][2*e] }; Arc* a_rev[2] = { &arcs[0][2*e+1], &arcs[1][2*e+1] }; code_assert(a[0]->sister==a_rev[0] && a[1]->sister==a_rev[1] && a[0]==a_rev[0]->sister && a[1]==a_rev[1]->sister); Node* i[2] = { a_rev[0]->head, a[1]->head }; Node* j[2] = { a[0]->head, a_rev[1]->head }; int k = IsNode0(i[0]) ? 0 : 1; if (i[k] != &nodes[0][_i]) { delta = E01; E01 = E10; E10 = delta; } if (IsNode0(j[k])) { ComputeWeights(E00, E01, E10, E11, ci, cj, cij, cji); } else { ComputeWeights(E01, E00, E11, E10, ci, cj, cij, cji); }; // make sure that a[0]->r_cap == a[1]->r_cap and a_rev[0]->r_cap == a_rev[1]->r_cap by pushing flow delta = a[1]->r_cap - a[0]->r_cap; //a[1]->r_cap -= delta; // don't do the subtraction - later we'll set explicitly a[1]->r_cap = a[0]->r_cap //a[1]->sister->r_cap += delta; a_rev[1]->head->tr_cap -= delta; a[1]->head->tr_cap += delta; i[0]->tr_cap += ci; i[1]->tr_cap -= ci; j[0]->tr_cap += cj; j[1]->tr_cap -= cj; a[0]->r_cap += cij; a_rev[0]->r_cap += cji; if (a[0]->r_cap < 0) { delta = a[0]->r_cap; a[0]->r_cap = 0; a_rev[0]->r_cap += delta; i[0]->tr_cap -= delta; i[1]->tr_cap += delta; j[0]->tr_cap += delta; j[1]->tr_cap -= delta; } if (a_rev[0]->r_cap < 0) { delta = a_rev[0]->r_cap; a_rev[0]->r_cap = 0; a[0]->r_cap += delta; j[0]->tr_cap -= delta; j[1]->tr_cap += delta; i[0]->tr_cap += delta; i[1]->tr_cap -= delta; } if (a[0]->r_cap < 0) { // need to swap submodular <-> supermodular SET_TO(a[0], j[1]); SET_TO(a_rev[1], j[0]); REMOVE_FROM(a_rev[0], j[0]); SET_FROM(a_rev[0], j[1]); REMOVE_FROM(a[1], j[1]); SET_FROM(a[1], j[0]); delta = a[0]->r_cap; i[0]->tr_cap -= delta; i[1]->tr_cap += delta; a[0]->r_cap = -delta; } a[1]->r_cap = a[0]->r_cap; a_rev[1]->r_cap = a_rev[0]->r_cap; } zero_energy += E00; } template <typename REAL> void QPBO<REAL>::TransformToSecondStage(bool copy_trees) { // add non-submodular edges Node* i[2]; Node* j[2]; Arc* a[2]; memset(nodes[1], 0, node_num*sizeof(Node)); node_last[1] = nodes[1] + node_num; if (!copy_trees) { for (i[0]=nodes[0], i[1]=nodes[1]; i[0]<node_last[0]; i[0]++, i[1]++) { i[1]->first = NULL; i[1]->tr_cap = -i[0]->tr_cap; } for (a[0]=arcs[0], a[1]=arcs[1]; a[0]<arc_max[0]; a[0]+=2, a[1]+=2) { if (!a[0]->sister) continue; code_assert(IsNode0(a[0]->sister->head)); SET_SISTERS(a[1], a[1]+1); if (IsNode0(a[0]->head)) { i[1] = GetMate0(a[0]->sister->head); j[1] = GetMate0(a[0]->head); SET_FROM(a[1], j[1]); SET_FROM(a[1]->sister, i[1]); SET_TO(a[1], i[1]); SET_TO(a[1]->sister, j[1]); } else { i[0] = a[0]->sister->head; i[1] = GetMate0(i[0]); j[1] = a[0]->head; j[0] = GetMate1(j[1]); SET_FROM(a[0], i[0]); SET_FROM(a[0]->sister, j[1]); SET_FROM(a[1], j[0]); SET_FROM(a[1]->sister, i[1]); SET_TO(a[1], i[1]); SET_TO(a[1]->sister, j[0]); } a[1]->r_cap = a[0]->r_cap; a[1]->sister->r_cap = a[0]->sister->r_cap; } } else { for (i[0]=nodes[0], i[1]=nodes[1]; i[0]<node_last[0]; i[0]++, i[1]++) { i[1]->first = NULL; i[1]->tr_cap = -i[0]->tr_cap; i[1]->is_sink = i[0]->is_sink ^ 1; i[1]->DIST = i[0]->DIST; i[1]->TS = i[0]->TS; if (i[0]->parent == NULL || i[0]->parent == QPBO_MAXFLOW_TERMINAL) i[1]->parent = i[0]->parent; else i[1]->parent = GetMate0(i[0]->parent->sister); } for (a[0]=arcs[0], a[1]=arcs[1]; a[0]<arc_max[0]; a[0]+=2, a[1]+=2) { if (!a[0]->sister) continue; code_assert(IsNode0(a[0]->sister->head)); SET_SISTERS(a[1], a[1]+1); if (IsNode0(a[0]->head)) { i[1] = GetMate0(a[0]->sister->head); j[1] = GetMate0(a[0]->head); SET_FROM(a[1], j[1]); SET_FROM(a[1]->sister, i[1]); SET_TO(a[1], i[1]); SET_TO(a[1]->sister, j[1]); } else { i[0] = a[0]->sister->head; i[1] = GetMate0(i[0]); j[1] = a[0]->head; j[0] = GetMate1(j[1]); SET_FROM(a[0], i[0]); SET_FROM(a[0]->sister, j[1]); SET_FROM(a[1], j[0]); SET_FROM(a[1]->sister, i[1]); SET_TO(a[1], i[1]); SET_TO(a[1]->sister, j[0]); mark_node(i[0]); mark_node(i[1]); mark_node(j[0]); mark_node(j[1]); } a[1]->r_cap = a[0]->r_cap; a[1]->sister->r_cap = a[0]->sister->r_cap; } } stage = 1; } template <typename REAL> void QPBO<REAL>::MergeParallelEdges() { if (stage == 0) TransformToSecondStage(false); Node* i; Node* j; Arc* a; Arc* a_next; for (i=nodes[0]; i<node_last[0]; i++) { for (a=i->first; a; a=a->next) { j = a->head; if (!IsNode0(j)) j = GetMate1(j); j->parent = a; } for (a=i->first; a; a=a_next) { a_next = a->next; j = a->head; if (!IsNode0(j)) j = GetMate1(j); if (j->parent == a) continue; if (MergeParallelEdges(j->parent, a)==0) { j->parent = a; a_next = a->next; } } } } template <typename REAL> void QPBO<REAL>::Solve() { Node* i; maxflow(); if (stage == 0) { if (all_edges_submodular) { for (i=nodes[0]; i<node_last[0]; i++) { i->label = what_segment(i); } return; } TransformToSecondStage(true); maxflow(true); } for (i=nodes[0]; i<node_last[0]; i++) { i->label = what_segment(i); if (i->label == what_segment(GetMate0(i))) i->label = -1; } } template <typename REAL> REAL QPBO<REAL>::ComputeTwiceEnergy(int option) { REAL E = 2*zero_energy, E1[2], E2[2][2]; int i, j, e; int xi, xj; for (i=0; i<GetNodeNum(); i++) { GetTwiceUnaryTerm(i, E1[0], E1[1]); if (option == 0) xi = (nodes[0][i].label < 0) ? 0 : nodes[0][i].label; else xi = nodes[0][i].user_label; code_assert(xi==0 || xi==1); E += E1[xi] - E1[0]; } for (e=GetNextEdgeId(-1); e>=0; e=GetNextEdgeId(e)) { GetTwicePairwiseTerm(e, i, j, E2[0][0], E2[0][1], E2[1][0], E2[1][1]); if (option == 0) { xi = (nodes[0][i].label < 0) ? 0 : nodes[0][i].label; xj = (nodes[0][j].label < 0) ? 0 : nodes[0][j].label; } else { xi = nodes[0][i].user_label; xj = nodes[0][j].user_label; } E += E2[xi][xj] - E2[0][0]; } return E; } template <typename REAL> REAL QPBO<REAL>::ComputeTwiceEnergy(int* solution) { REAL E = 2*zero_energy, E1[2], E2[2][2]; int i, j, e; for (i=0; i<GetNodeNum(); i++) { GetTwiceUnaryTerm(i, E1[0], E1[1]); if (solution[i] == 1) E += E1[1]; } for (e=GetNextEdgeId(-1); e>=0; e=GetNextEdgeId(e)) { GetTwicePairwiseTerm(e, i, j, E2[0][0], E2[0][1], E2[1][0], E2[1][1]); E += E2[(solution[i] == 1) ? 1 : 0][(solution[j] == 1) ? 1 : 0] - E2[0][0]; } return E; } template <typename REAL> REAL QPBO<REAL>::ComputeTwiceLowerBound() { REAL lowerBound = 2*zero_energy, E0, E1, E00, E01, E10, E11; int i, j, e; for (i=0; i<GetNodeNum(); i++) { GetTwiceUnaryTerm(i, E0, E1); if (E0 > E1) lowerBound += E1 - E0; } for (e=GetNextEdgeId(-1); e>=0; e=GetNextEdgeId(e)) { GetTwicePairwiseTerm(e, i, j, E00, E01, E10, E11); lowerBound -= E00; } return lowerBound; } template <typename REAL> void QPBO<REAL>::TestRelaxedSymmetry() { Node* i; Arc* a; REAL c1, c2; if (stage == 0) return; for (i=nodes[0]; i<node_last[0]; i++) { if (i->is_removed) continue; c1 = i->tr_cap; for (a=i->first; a; a=a->next) c1 += a->sister->r_cap; c2 = -GetMate0(i)->tr_cap; for (a=GetMate0(i)->first; a; a=a->next) c2 += a->r_cap; if (c1 != c2) { code_assert(0); exit(1); } } } #include "instances.inc"
{ "pile_set_name": "Github" }
source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .
{ "pile_set_name": "Github" }
module.exports.default = require('./lib/themes.demo').ThemeDemo; module.exports.ThemeDemo = require('./lib/themes.demo').ThemeDemo;
{ "pile_set_name": "Github" }
# # (C) Copyright 2014 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in # LICENSE.txt #
{ "pile_set_name": "Github" }
module tiled{ /** * 属性VO,存储map、tileset、tile相关属性数据 */ export class TMXProperty { /** * id * @version Egret 3.0.3 * */ gid: number = 0; /** * 属性名 * @version Egret 3.0.3 * */ name: string; /** * 属性值 * @version Egret 3.0.3 * */ value: string; } }
{ "pile_set_name": "Github" }
# # Module manifest for module 'RFC' # # Generated by: jimtru # # Generated on: 4/22/19 # @{ # Script module or binary module file associated with this manifest. RootModule = 'RFC.psm1' # Version number of this module. ModuleVersion = '0.0.1' # Supported PSEditions # CompatiblePSEditions = @() # ID used to uniquely identify this module GUID = 'e05ba184-7bd8-4a16-9f41-93d7c7bd4ee6' # Author of this module Author = 'jimtru' # Company or vendor of this module CompanyName = 'Microsoft' # Copyright statement for this module Copyright = 'Copyright (c) Microsoft Corporation. All rights reserved.' # Description of the functionality provided by this module # Description = '' # Type files (.ps1xml) to be loaded when importing this module TypesToProcess = @('RFC.Types.ps1xml') # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = @('RFC.Formats.ps1xml') # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = @( 'Get-MaxRFCNumber', 'Get-MaxRFC', 'Get-PullRFCNumber', 'Get-RFCPullRequest', 'Get-HighestPullRFCNumber', 'Get-NextRFCNumber', 'Get-NextRFCFileName', 'Get-GitFork', 'Get-GitBranchesFromFork', 'Get-GitTreeFromBranch', 'Get-LastCommit', 'Get-RepoFileList', 'Get-PR', "Set-Header", "Get-Header", "Remove-Header" ) # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() # Variables to export from this module VariablesToExport = '*' # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. AliasesToExport = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ } # End of PSData hashtable } # End of PrivateData hashtable }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Texas Instruments Ltd * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/clk.h> #include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/sched.h> #include "omapdss.h" #include "dss.h" #include "dss_features.h" struct dss_video_pll { struct dss_pll pll; struct device *dev; void __iomem *clkctrl_base; }; #define REG_MOD(reg, val, start, end) \ writel_relaxed(FLD_MOD(readl_relaxed(reg), val, start, end), reg) static void dss_dpll_enable_scp_clk(struct dss_video_pll *vpll) { REG_MOD(vpll->clkctrl_base, 1, 14, 14); /* CIO_CLK_ICG */ } static void dss_dpll_disable_scp_clk(struct dss_video_pll *vpll) { REG_MOD(vpll->clkctrl_base, 0, 14, 14); /* CIO_CLK_ICG */ } static void dss_dpll_power_enable(struct dss_video_pll *vpll) { REG_MOD(vpll->clkctrl_base, 2, 31, 30); /* PLL_POWER_ON_ALL */ /* * DRA7x PLL CTRL's PLL_PWR_STATUS seems to always return 0, * so we have to use fixed delay here. */ msleep(1); } static void dss_dpll_power_disable(struct dss_video_pll *vpll) { REG_MOD(vpll->clkctrl_base, 0, 31, 30); /* PLL_POWER_OFF */ } static int dss_video_pll_enable(struct dss_pll *pll) { struct dss_video_pll *vpll = container_of(pll, struct dss_video_pll, pll); int r; r = dss_runtime_get(); if (r) return r; dss_ctrl_pll_enable(pll->id, true); dss_dpll_enable_scp_clk(vpll); r = dss_pll_wait_reset_done(pll); if (r) goto err_reset; dss_dpll_power_enable(vpll); return 0; err_reset: dss_dpll_disable_scp_clk(vpll); dss_ctrl_pll_enable(pll->id, false); dss_runtime_put(); return r; } static void dss_video_pll_disable(struct dss_pll *pll) { struct dss_video_pll *vpll = container_of(pll, struct dss_video_pll, pll); dss_dpll_power_disable(vpll); dss_dpll_disable_scp_clk(vpll); dss_ctrl_pll_enable(pll->id, false); dss_runtime_put(); } static const struct dss_pll_ops dss_pll_ops = { .enable = dss_video_pll_enable, .disable = dss_video_pll_disable, .set_config = dss_pll_write_config_type_a, }; static const struct dss_pll_hw dss_dra7_video_pll_hw = { .type = DSS_PLL_TYPE_A, .n_max = (1 << 8) - 1, .m_max = (1 << 12) - 1, .mX_max = (1 << 5) - 1, .fint_min = 500000, .fint_max = 2500000, .clkdco_max = 1800000000, .n_msb = 8, .n_lsb = 1, .m_msb = 20, .m_lsb = 9, .mX_msb[0] = 25, .mX_lsb[0] = 21, .mX_msb[1] = 30, .mX_lsb[1] = 26, .mX_msb[2] = 4, .mX_lsb[2] = 0, .mX_msb[3] = 9, .mX_lsb[3] = 5, .has_refsel = true, }; struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id, struct regulator *regulator) { const char * const reg_name[] = { "pll1", "pll2" }; const char * const clkctrl_name[] = { "pll1_clkctrl", "pll2_clkctrl" }; const char * const clkin_name[] = { "video1_clk", "video2_clk" }; struct resource *res; struct dss_video_pll *vpll; void __iomem *pll_base, *clkctrl_base; struct clk *clk; struct dss_pll *pll; int r; /* PLL CONTROL */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, reg_name[id]); if (!res) { dev_err(&pdev->dev, "missing platform resource data for pll%d\n", id); return ERR_PTR(-ENODEV); } pll_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(pll_base)) { dev_err(&pdev->dev, "failed to ioremap pll%d reg_name\n", id); return ERR_CAST(pll_base); } /* CLOCK CONTROL */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, clkctrl_name[id]); if (!res) { dev_err(&pdev->dev, "missing platform resource data for pll%d\n", id); return ERR_PTR(-ENODEV); } clkctrl_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(clkctrl_base)) { dev_err(&pdev->dev, "failed to ioremap pll%d clkctrl\n", id); return ERR_CAST(clkctrl_base); } /* CLKIN */ clk = devm_clk_get(&pdev->dev, clkin_name[id]); if (IS_ERR(clk)) { DSSERR("can't get video pll clkin\n"); return ERR_CAST(clk); } vpll = devm_kzalloc(&pdev->dev, sizeof(*vpll), GFP_KERNEL); if (!vpll) return ERR_PTR(-ENOMEM); vpll->dev = &pdev->dev; vpll->clkctrl_base = clkctrl_base; pll = &vpll->pll; pll->name = id == 0 ? "video0" : "video1"; pll->id = id == 0 ? DSS_PLL_VIDEO1 : DSS_PLL_VIDEO2; pll->clkin = clk; pll->regulator = regulator; pll->base = pll_base; pll->hw = &dss_dra7_video_pll_hw; pll->ops = &dss_pll_ops; r = dss_pll_register(pll); if (r) return ERR_PTR(r); return pll; } void dss_video_pll_uninit(struct dss_pll *pll) { dss_pll_unregister(pll); }
{ "pile_set_name": "Github" }
/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.0.8/LICENSE */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.DOMPurify = factory()); }(this, function () { 'use strict'; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, objectKeys = Object.keys; var freeze = Object.freeze, seal = Object.seal; // eslint-disable-line import/no-mutable-exports var _ref = typeof Reflect !== 'undefined' && Reflect, apply = _ref.apply, construct = _ref.construct; if (!apply) { apply = function apply(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze(x) { return x; }; } if (!seal) { seal = function seal(x) { return x; }; } if (!construct) { construct = function construct(Func, args) { return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))(); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayIndexOf = unapply(Array.prototype.indexOf); var arrayJoin = unapply(Array.prototype.join); var arrayPop = unapply(Array.prototype.pop); var arrayPush = unapply(Array.prototype.push); var arraySlice = unapply(Array.prototype.slice); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var regExpCreate = unconstruct(RegExp); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function (thisArg) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function () { for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } /* Add properties to a lookup table */ function addToSet(set, array) { if (setPrototypeOf) { // Make 'in' and truthy checks like Boolean(set.constructor) // independent of any properties defined on Object.prototype. // Prevent prototype setters from intercepting set as a this value. setPrototypeOf(set, null); } var l = array.length; while (l--) { var element = array[l]; if (typeof element === 'string') { var lcElement = stringToLowerCase(element); if (lcElement !== element) { // Config presets (e.g. tags.js, attrs.js) are immutable. if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } /* Shallow clone an object */ function clone(object) { var newObject = {}; var property = void 0; for (property in object) { if (apply(hasOwnProperty, object, [property])) { newObject[property] = object[property]; } } return newObject; } var html = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG var svg = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'audio', 'canvas', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'video', 'view', 'vkern']); var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); var mathMl = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); var text = freeze(['#text']); var html$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns']); var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); var mathMl$1 = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); // eslint-disable-next-line unicorn/better-regex var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g // eslint-disable-line no-control-regex ); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } var getGlobal = function getGlobal() { return typeof window === 'undefined' ? null : window; }; /** * Creates a no-op policy for internal use only. * Don't export this function outside this module! * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. * @param {Document} document The document object (to determine policy name suffix) * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types * are not supported). */ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { return null; } // Allow the callers to control the unique policy name // by adding a data-tt-policy-suffix to the script element with the DOMPurify. // Policy creation with duplicate names throws in Trusted Types. var suffix = null; var ATTR_NAME = 'data-tt-policy-suffix'; if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { suffix = document.currentScript.getAttribute(ATTR_NAME); } var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html$$1) { return html$$1; } }); } catch (_) { // Policy creation failed (most likely another DOMPurify script has // already run). Skip creating the policy, as this will only cause errors // if TT are enforced. console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); return null; } }; function createDOMPurify() { var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify(root) { return createDOMPurify(root); }; /** * Version label, exposed for easier checks * if DOMPurify is up to date or not */ DOMPurify.version = '2.0.12'; /** * Array of elements that DOMPurify removed during sanitation. * Empty if nothing was removed. */ DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== 9) { // Not running in a browser, provide a factory function // so that you can pass your own Window DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window.document; var removeTitle = false; var document = window.document; var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, Text = window.Text, Comment = window.Comment, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes; // As per issue #47, the web-components registry is inherited by a // new document created via createHTMLDocument. As per the spec // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) // a new empty registry is used when creating a template contents owner // document, so we use that as our parent document to ensure nothing // is inherited. if (typeof HTMLTemplateElement === 'function') { var template = document.createElement('template'); if (template.content && template.content.ownerDocument) { document = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : ''; var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, getElementsByTagName = _document.getElementsByTagName, createDocumentFragment = _document.createDocumentFragment; var importNode = originalDocument.importNode; var hooks = {}; /** * Expose whether this browser supports running the full DOMPurify. */ DOMPurify.isSupported = implementation && typeof implementation.createHTMLDocument !== 'undefined' && document.documentMode !== 9; var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR, ERB_EXPR$$1 = ERB_EXPR, DATA_ATTR$$1 = DATA_ATTR, ARIA_ATTR$$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI; /** * We consider the elements and attributes below to be safe. Ideally * don't add any new ones but feel free to remove unwanted ones. */ /* allowed element names */ var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text))); /* Allowed attribute names */ var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml))); /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ var FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ var FORBID_ATTR = null; /* Decide if ARIA attributes are okay */ var ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ var ALLOW_DATA_ATTR = true; /* Decide if unknown protocols are okay */ var ALLOW_UNKNOWN_PROTOCOLS = false; /* Output should be safe for jQuery's $() factory? */ var SAFE_FOR_JQUERY = false; /* Output should be safe for common template engines. * This means, DOMPurify removes data attributes, mustaches and ERB */ var SAFE_FOR_TEMPLATES = false; /* Decide if document with <html>... should be returned */ var WHOLE_DOCUMENT = false; /* Track whether config is already set on this instance of DOMPurify. */ var SET_CONFIG = false; /* Decide if all elements (e.g. style, script) must be children of * document.body. By default, browsers might move them to document.head */ var FORCE_BODY = false; /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported). * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead */ var RETURN_DOM = false; /* Decide if a DOM `DocumentFragment` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported) */ var RETURN_DOM_FRAGMENT = false; /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM * `Node` is imported into the current `Document`. If this flag is not enabled the * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by * DOMPurify. */ var RETURN_DOM_IMPORT = false; /* Try to return a Trusted Type object instead of a string, retrun a string in * case Trusted Types are not supported */ var RETURN_TRUSTED_TYPE = false; /* Output should be free from DOM clobbering attacks? */ var SANITIZE_DOM = true; /* Keep element content when removing element? */ var KEEP_CONTENT = true; /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead * of importing it into a new Document and returning a sanitized copy */ var IN_PLACE = false; /* Allow usage of profiles like html, svg and mathMl */ var USE_PROFILES = {}; /* Tags to ignore content of when KEEP_CONTENT is true */ var FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); /* Tags that are safe for data: URIs */ var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); /* Attributes safe for values like "javascript:" */ var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']); /* Keep a reference to config to pass to hooks */ var CONFIG = null; /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ var formElement = document.createElement('form'); /** * _parseConfig * * @param {Object} cfg optional config literal */ // eslint-disable-next-line complexity var _parseConfig = function _parseConfig(cfg) { if (CONFIG && CONFIG === cfg) { return; } /* Shield configuration object from tampering */ if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') { cfg = {}; } /* Set configuration parameters */ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS; FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {}; FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {}; USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false SAFE_FOR_JQUERY = cfg.SAFE_FOR_JQUERY || false; // Default false SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false RETURN_DOM = cfg.RETURN_DOM || false; // Default false RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT || false; // Default false RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false FORCE_BODY = cfg.FORCE_BODY || false; // Default false SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true IN_PLACE = cfg.IN_PLACE || false; // Default false IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1; if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } /* Parse profile info */ if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text))); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html); addToSet(ALLOWED_ATTR, html$1); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg); addToSet(ALLOWED_ATTR, svg$1); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg$1); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl); addToSet(ALLOWED_ATTR, mathMl$1); addToSet(ALLOWED_ATTR, xml); } } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR); } /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) { ALLOWED_TAGS['#text'] = true; } /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); } /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ['tbody']); delete FORBID_TAGS.tbody; } // Prevent further manipulation of configuration. // Not available in IE8, Safari 5, etc. if (freeze) { freeze(cfg); } CONFIG = cfg; }; /** * _forceRemove * * @param {Node} node a DOM node */ var _forceRemove = function _forceRemove(node) { arrayPush(DOMPurify.removed, { element: node }); try { // eslint-disable-next-line unicorn/prefer-node-remove node.parentNode.removeChild(node); } catch (_) { node.outerHTML = emptyHTML; } }; /** * _removeAttribute * * @param {String} name an Attribute name * @param {Node} node a DOM node */ var _removeAttribute = function _removeAttribute(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); }; /** * _initDocument * * @param {String} dirty a string of dirty markup * @return {Document} a DOM, filled with the dirty markup */ var _initDocument = function _initDocument(dirty) { /* Create a HTML document */ var doc = void 0; var leadingWhitespace = void 0; if (FORCE_BODY) { dirty = '<remove></remove>' + dirty; } else { /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; /* Use the DOMParser API by default, fallback later if needs be */ try { doc = new DOMParser().parseFromString(dirtyPayload, 'text/html'); } catch (_) {} /* Remove title to fix a mXSS bug in older MS Edge */ if (removeTitle) { addToSet(FORBID_TAGS, ['title']); } /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) { doc = implementation.createHTMLDocument(''); var _doc = doc, body = _doc.body; body.parentNode.removeChild(body.parentNode.firstElementChild); body.outerHTML = dirtyPayload; } if (dirty && leadingWhitespace) { doc.body.insertBefore(document.createTextNode(leadingWhitespace), doc.body.childNodes[0] || null); } /* Work on whole document or just its body */ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; }; /* Here we test for a broken feature in Edge that might cause mXSS */ if (DOMPurify.isSupported) { (function () { try { var doc = _initDocument('<x/><title>&lt;/title&gt;&lt;img&gt;'); if (regExpTest(/<\/title/, doc.querySelector('title').innerHTML)) { removeTitle = true; } } catch (_) {} })(); } /** * _createIterator * * @param {Document} root document/fragment to create iterator for * @return {Iterator} iterator instance */ var _createIterator = function _createIterator(root) { return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, function () { return NodeFilter.FILTER_ACCEPT; }, false); }; /** * _isClobbered * * @param {Node} elm element to check for clobbering attacks * @return {Boolean} true if clobbered, false if safe */ var _isClobbered = function _isClobbered(elm) { if (elm instanceof Text || elm instanceof Comment) { return false; } if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string') { return true; } return false; }; /** * _isNode * * @param {Node} obj object to check whether it's a DOM node * @return {Boolean} true is object is a DOM node */ var _isNode = function _isNode(object) { return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? object instanceof Node : object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; }; /** * _executeHook * Execute user configurable hooks * * @param {String} entryPoint Name of the hook's entry point * @param {Node} currentNode node to work on with the hook * @param {Object} data additional hook parameters */ var _executeHook = function _executeHook(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function (hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; /** * _sanitizeElements * * @protect nodeName * @protect textContent * @protect removeChild * * @param {Node} currentNode to check for permission to exist * @return {Boolean} true if node was killed, false if left alive */ // eslint-disable-next-line complexity var _sanitizeElements = function _sanitizeElements(currentNode) { var content = void 0; /* Execute a hook if present */ _executeHook('beforeSanitizeElements', currentNode, null); /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } /* Now let's check the element's type and name */ var tagName = stringToLowerCase(currentNode.nodeName); /* Execute a hook if present */ _executeHook('uponSanitizeElement', currentNode, { tagName: tagName, allowedTags: ALLOWED_TAGS }); /* Take care of an mXSS pattern using p, br inside svg, math */ if ((tagName === 'svg' || tagName === 'math') && currentNode.querySelectorAll('p, br').length !== 0) { _forceRemove(currentNode); return true; } /* Remove element if anything forbids its presence */ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { /* Keep content except for bad-listed elements */ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && typeof currentNode.insertAdjacentHTML === 'function') { try { var htmlToInsert = currentNode.innerHTML; currentNode.insertAdjacentHTML('AfterEnd', trustedTypesPolicy ? trustedTypesPolicy.createHTML(htmlToInsert) : htmlToInsert); } catch (_) {} } _forceRemove(currentNode); return true; } /* Remove in case a noscript/noembed XSS is suspected */ if (tagName === 'noscript' && regExpTest(/<\/noscript/i, currentNode.innerHTML)) { _forceRemove(currentNode); return true; } if (tagName === 'noembed' && regExpTest(/<\/noembed/i, currentNode.innerHTML)) { _forceRemove(currentNode); return true; } /* Convert markup to cover jQuery behavior */ if (SAFE_FOR_JQUERY && !currentNode.firstElementChild && (!currentNode.content || !currentNode.content.firstElementChild) && regExpTest(/</g, currentNode.textContent)) { arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() }); if (currentNode.innerHTML) { currentNode.innerHTML = stringReplace(currentNode.innerHTML, /</g, '&lt;'); } else { currentNode.innerHTML = stringReplace(currentNode.textContent, /</g, '&lt;'); } } /* Sanitize element content to be template-safe */ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) { /* Get the element's text content */ content = currentNode.textContent; content = stringReplace(content, MUSTACHE_EXPR$$1, ' '); content = stringReplace(content, ERB_EXPR$$1, ' '); if (currentNode.textContent !== content) { arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() }); currentNode.textContent = content; } } /* Execute a hook if present */ _executeHook('afterSanitizeElements', currentNode, null); return false; }; /** * _isValidAttribute * * @param {string} lcTag Lowercase tag name of containing element. * @param {string} lcName Lowercase attribute name. * @param {string} value Attribute value. * @return {Boolean} Returns true if `value` is valid, otherwise false. */ // eslint-disable-next-line complexity var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) { /* Make sure attribute cannot clobber */ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) { return false; } /* Allow valid data-* attributes: At least one character after "-" (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes) XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804) We don't need to check the value; it's always URI safe. */ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { return false; /* Check value is safe. First, is attr inert? If so, is safe */ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if (!value) ; else { return false; } return true; }; /** * _sanitizeAttributes * * @protect attributes * @protect nodeName * @protect removeAttribute * @protect setAttribute * * @param {Node} currentNode to sanitize */ // eslint-disable-next-line complexity var _sanitizeAttributes = function _sanitizeAttributes(currentNode) { var attr = void 0; var value = void 0; var lcName = void 0; var idAttr = void 0; var l = void 0; /* Execute a hook if present */ _executeHook('beforeSanitizeAttributes', currentNode, null); var attributes = currentNode.attributes; /* Check if we have attributes; if not we might have a text node */ if (!attributes) { return; } var hookEvent = { attrName: '', attrValue: '', keepAttr: true, allowedAttributes: ALLOWED_ATTR }; l = attributes.length; /* Go backwards over all attributes; safely remove bad ones */ while (l--) { attr = attributes[l]; var _attr = attr, name = _attr.name, namespaceURI = _attr.namespaceURI; value = stringTrim(attr.value); lcName = stringToLowerCase(name); /* Execute a hook if present */ hookEvent.attrName = lcName; hookEvent.attrValue = value; hookEvent.keepAttr = true; hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set _executeHook('uponSanitizeAttribute', currentNode, hookEvent); value = hookEvent.attrValue; /* Did the hooks approve of the attribute? */ if (hookEvent.forceKeepAttr) { continue; } /* Remove attribute */ // Safari (iOS + Mac), last tested v8.0.5, crashes if you try to // remove a "name" attribute from an <img> tag that has an "id" // attribute at the time. if (lcName === 'name' && currentNode.nodeName === 'IMG' && attributes.id) { idAttr = attributes.id; attributes = arraySlice(attributes, []); _removeAttribute('id', currentNode); _removeAttribute(name, currentNode); if (arrayIndexOf(attributes, idAttr) > l) { currentNode.setAttribute('id', idAttr.value); } } else if ( // This works around a bug in Safari, where input[type=file] // cannot be dynamically set after type has been removed currentNode.nodeName === 'INPUT' && lcName === 'type' && value === 'file' && hookEvent.keepAttr && (ALLOWED_ATTR[lcName] || !FORBID_ATTR[lcName])) { continue; } else { // This avoids a crash in Safari v9.0 with double-ids. // The trick is to first set the id to be empty and then to // remove the attribute if (name === 'id') { currentNode.setAttribute(name, ''); } _removeAttribute(name, currentNode); } /* Did the hooks approve of the attribute? */ if (!hookEvent.keepAttr) { continue; } /* Work around a security issue in jQuery 3.0 */ if (SAFE_FOR_JQUERY && regExpTest(/\/>/i, value)) { _removeAttribute(name, currentNode); continue; } /* Take care of an mXSS pattern using namespace switches */ if (regExpTest(/svg|math/i, currentNode.namespaceURI) && regExpTest(regExpCreate('</(' + arrayJoin(objectKeys(FORBID_CONTENTS), '|') + ')', 'i'), value)) { _removeAttribute(name, currentNode); continue; } /* Sanitize attribute content to be template-safe */ if (SAFE_FOR_TEMPLATES) { value = stringReplace(value, MUSTACHE_EXPR$$1, ' '); value = stringReplace(value, ERB_EXPR$$1, ' '); } /* Is `value` valid for this attribute? */ var lcTag = currentNode.nodeName.toLowerCase(); if (!_isValidAttribute(lcTag, lcName, value)) { continue; } /* Handle invalid data-* attribute set by try-catching it */ try { if (namespaceURI) { currentNode.setAttributeNS(namespaceURI, name, value); } else { /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */ currentNode.setAttribute(name, value); } arrayPop(DOMPurify.removed); } catch (_) {} } /* Execute a hook if present */ _executeHook('afterSanitizeAttributes', currentNode, null); }; /** * _sanitizeShadowDOM * * @param {DocumentFragment} fragment to iterate over recursively */ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) { var shadowNode = void 0; var shadowIterator = _createIterator(fragment); /* Execute a hook if present */ _executeHook('beforeSanitizeShadowDOM', fragment, null); while (shadowNode = shadowIterator.nextNode()) { /* Execute a hook if present */ _executeHook('uponSanitizeShadowNode', shadowNode, null); /* Sanitize tags and elements */ if (_sanitizeElements(shadowNode)) { continue; } /* Deep shadow DOM detected */ if (shadowNode.content instanceof DocumentFragment) { _sanitizeShadowDOM(shadowNode.content); } /* Check attributes, sanitize if necessary */ _sanitizeAttributes(shadowNode); } /* Execute a hook if present */ _executeHook('afterSanitizeShadowDOM', fragment, null); }; /** * Sanitize * Public method providing core sanitation functionality * * @param {String|Node} dirty string or DOM node * @param {Object} configuration object */ // eslint-disable-next-line complexity DOMPurify.sanitize = function (dirty, cfg) { var body = void 0; var importedNode = void 0; var currentNode = void 0; var oldNode = void 0; var returnNode = void 0; /* Make sure we have a string to sanitize. DO NOT return early, as this will return the wrong type if the user has requested a DOM object rather than a string */ if (!dirty) { dirty = '<!-->'; } /* Stringify, in case dirty is an object */ if (typeof dirty !== 'string' && !_isNode(dirty)) { // eslint-disable-next-line no-negated-condition if (typeof dirty.toString !== 'function') { throw typeErrorCreate('toString is not a function'); } else { dirty = dirty.toString(); if (typeof dirty !== 'string') { throw typeErrorCreate('dirty is not a string, aborting'); } } } /* Check we can run. Otherwise fall back or ignore */ if (!DOMPurify.isSupported) { if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') { if (typeof dirty === 'string') { return window.toStaticHTML(dirty); } if (_isNode(dirty)) { return window.toStaticHTML(dirty.outerHTML); } } return dirty; } /* Assign config vars */ if (!SET_CONFIG) { _parseConfig(cfg); } /* Clean up removed elements */ DOMPurify.removed = []; /* Check if dirty is correctly typed for IN_PLACE */ if (typeof dirty === 'string') { IN_PLACE = false; } if (IN_PLACE) ; else if (dirty instanceof Node) { /* If dirty is a DOM element, append to an empty document to avoid elements being stripped by the parser */ body = _initDocument('<!-->'); importedNode = body.ownerDocument.importNode(dirty, true); if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') { /* Node is already a body, use as is */ body = importedNode; } else if (importedNode.nodeName === 'HTML') { body = importedNode; } else { // eslint-disable-next-line unicorn/prefer-node-append body.appendChild(importedNode); } } else { /* Exit directly if we have nothing to do */ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes dirty.indexOf('<') === -1) { return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; } /* Initialize the document to work on */ body = _initDocument(dirty); /* Check we have a DOM node from the data */ if (!body) { return RETURN_DOM ? null : emptyHTML; } } /* Remove first element node (ours) if FORCE_BODY is set */ if (body && FORCE_BODY) { _forceRemove(body.firstChild); } /* Get node iterator */ var nodeIterator = _createIterator(IN_PLACE ? dirty : body); /* Now start iterating over the created document */ while (currentNode = nodeIterator.nextNode()) { /* Fix IE's strange behavior with manipulated textNodes #89 */ if (currentNode.nodeType === 3 && currentNode === oldNode) { continue; } /* Sanitize tags and elements */ if (_sanitizeElements(currentNode)) { continue; } /* Shadow DOM detected, sanitize it */ if (currentNode.content instanceof DocumentFragment) { _sanitizeShadowDOM(currentNode.content); } /* Check attributes, sanitize if necessary */ _sanitizeAttributes(currentNode); oldNode = currentNode; } oldNode = null; /* If we sanitized `dirty` in-place, return it. */ if (IN_PLACE) { return dirty; } /* Return sanitized string or DOM */ if (RETURN_DOM) { if (RETURN_DOM_FRAGMENT) { returnNode = createDocumentFragment.call(body.ownerDocument); while (body.firstChild) { // eslint-disable-next-line unicorn/prefer-node-append returnNode.appendChild(body.firstChild); } } else { returnNode = body; } if (RETURN_DOM_IMPORT) { /* AdoptNode() is not used because internal state is not reset (e.g. the past names map of a HTMLFormElement), this is safe in theory but we would rather not risk another attack vector. The state that is cloned by importNode() is explicitly defined by the specs. */ returnNode = importNode.call(originalDocument, returnNode, true); } return returnNode; } var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; /* Sanitize final string template-safe */ if (SAFE_FOR_TEMPLATES) { serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$$1, ' '); serializedHTML = stringReplace(serializedHTML, ERB_EXPR$$1, ' '); } return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; }; /** * Public method to set the configuration once * setConfig * * @param {Object} cfg configuration object */ DOMPurify.setConfig = function (cfg) { _parseConfig(cfg); SET_CONFIG = true; }; /** * Public method to remove the configuration * clearConfig * */ DOMPurify.clearConfig = function () { CONFIG = null; SET_CONFIG = false; }; /** * Public method to check if an attribute value is valid. * Uses last set config, if any. Otherwise, uses config defaults. * isValidAttribute * * @param {string} tag Tag name of containing element. * @param {string} attr Attribute name. * @param {string} value Attribute value. * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false. */ DOMPurify.isValidAttribute = function (tag, attr, value) { /* Initialize shared config vars if necessary. */ if (!CONFIG) { _parseConfig({}); } var lcTag = stringToLowerCase(tag); var lcName = stringToLowerCase(attr); return _isValidAttribute(lcTag, lcName, value); }; /** * AddHook * Public method to add DOMPurify hooks * * @param {String} entryPoint entry point for the hook to add * @param {Function} hookFunction function to execute */ DOMPurify.addHook = function (entryPoint, hookFunction) { if (typeof hookFunction !== 'function') { return; } hooks[entryPoint] = hooks[entryPoint] || []; arrayPush(hooks[entryPoint], hookFunction); }; /** * RemoveHook * Public method to remove a DOMPurify hook at a given entryPoint * (pops it from the stack of hooks if more are present) * * @param {String} entryPoint entry point for the hook to remove */ DOMPurify.removeHook = function (entryPoint) { if (hooks[entryPoint]) { arrayPop(hooks[entryPoint]); } }; /** * RemoveHooks * Public method to remove all DOMPurify hooks at a given entryPoint * * @param {String} entryPoint entry point for the hooks to remove */ DOMPurify.removeHooks = function (entryPoint) { if (hooks[entryPoint]) { hooks[entryPoint] = []; } }; /** * RemoveAllHooks * Public method to remove all DOMPurify hooks * */ DOMPurify.removeAllHooks = function () { hooks = {}; }; return DOMPurify; } var purify = createDOMPurify(); return purify; }));
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.sql import java.math.BigDecimal import java.sql.Timestamp import org.apache.spark.sql.test.SharedSQLContext /** * A test suite for functions added for compatibility with other databases such as Oracle, MSSQL. * * These functions are typically implemented using the trait * [[org.apache.spark.sql.catalyst.expressions.RuntimeReplaceable]]. */ class SQLCompatibilityFunctionSuite extends QueryTest with SharedSQLContext { test("ifnull") { checkAnswer( sql("SELECT ifnull(null, 'x'), ifnull('y', 'x'), ifnull(null, null)"), Row("x", "y", null)) // Type coercion checkAnswer( sql("SELECT ifnull(1, 2.1d), ifnull(null, 2.1d)"), Row(1.0, 2.1)) } test("nullif") { checkAnswer( sql("SELECT nullif('x', 'x'), nullif('x', 'y')"), Row(null, "x")) // Type coercion checkAnswer( sql("SELECT nullif(1, 2.1d), nullif(1, 1.0d)"), Row(1.0, null)) } test("nvl") { checkAnswer( sql("SELECT nvl(null, 'x'), nvl('y', 'x'), nvl(null, null)"), Row("x", "y", null)) // Type coercion checkAnswer( sql("SELECT nvl(1, 2.1d), nvl(null, 2.1d)"), Row(1.0, 2.1)) } test("nvl2") { checkAnswer( sql("SELECT nvl2(null, 'x', 'y'), nvl2('n', 'x', 'y'), nvl2(null, null, null)"), Row("y", "x", null)) // Type coercion checkAnswer( sql("SELECT nvl2(null, 1, 2.1d), nvl2('n', 1, 2.1d)"), Row(2.1, 1.0)) } test("SPARK-16730 cast alias functions for Hive compatibility") { checkAnswer( sql("SELECT boolean(1), tinyint(1), smallint(1), int(1), bigint(1)"), Row(true, 1.toByte, 1.toShort, 1, 1L)) checkAnswer( sql("SELECT float(1), double(1), decimal(1)"), Row(1.toFloat, 1.0, new BigDecimal(1))) checkAnswer( sql("SELECT date(\"2014-04-04\"), timestamp(date(\"2014-04-04\"))"), Row(new java.util.Date(114, 3, 4), new Timestamp(114, 3, 4, 0, 0, 0, 0))) checkAnswer( sql("SELECT string(1)"), Row("1")) // Error handling: only one argument val errorMsg = intercept[AnalysisException](sql("SELECT string(1, 2)")).getMessage assert(errorMsg.contains("Function string accepts only one argument")) } }
{ "pile_set_name": "Github" }
// Test to ensure -emit-llvm profile-sample-accurate is honored in ThinLTO. // RUN: %clang -O2 %s -flto=thin -fprofile-sample-accurate -c -o %t.o // RUN: llvm-lto -thinlto -o %t %t.o // RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o - | FileCheck %s // CHECK: define{{.*}} void @foo() // CHECK: attributes{{.*}} "profile-sample-accurate" void foo() { }
{ "pile_set_name": "Github" }
@oknav-header-bg: #fff; @oknav-header-height: 7rem; @oknav-links-color: #2e2e33; @oknav-links-hover-color: #546edb; @oknav-links-font-size: 1.4rem; @oknav-links-font-weight: bold; @oknav-links-padding-x: 15px; @oknav-links-padding-y: 15px; @oknav-kebab-color: @oknav-links-color; // Icon color by default @oknav-kebab-active-color: @oknav-links-hover-color; // Icon color when nav is open @oknav-transition-curve: cubic-bezier(.55,0,.1,1); @oknav-transition-speed: 200ms; @oknav-invisible-background: #fff;
{ "pile_set_name": "Github" }
/** * Copyright (c) 2014-present, The osquery authors * * This source code is licensed as defined by the LICENSE file found in the * root directory of this source tree. * * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) */ #include <boost/algorithm/string.hpp> #include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid_io.hpp> #include <osquery/core/tables.h> #include <osquery/logger/logger.h> #include <osquery/tables/system/efi_misc.h> #include <osquery/utils/conversions/darwin/cfdata.h> #include <osquery/utils/conversions/darwin/cfstring.h> #include <osquery/utils/conversions/darwin/iokit.h> namespace osquery { namespace tables { #define kIODTChosenPath_ "IODeviceTree:/chosen" #define MEDIA_DEVICE_PATH 0x04 #define MEDIA_FILEPATH_DP 0x04 #define MEDIA_HARDDRIVE_DP 0x01 std::string getCanonicalEfiDevicePath(const CFDataRef& data) { std::string path; // Iterate through the EFI_DEVICE_PATH_PROTOCOL stacked structs. auto bytes = CFDataGetBytePtr((CFDataRef)data); size_t length = CFDataGetLength((CFDataRef)data); size_t search_offset = 0; while ((search_offset + sizeof(EFI_DEVICE_PATH_PROTOCOL)) < length) { auto node = (const EFI_DEVICE_PATH_PROTOCOL*)(bytes + search_offset); if (EfiIsDevicePathEnd(node)) { // End of the EFI device path stacked structs. break; } if (EfiDevicePathNodeLength(node) + search_offset > length) { // Malformed EFI device header. break; } // Only support paths and hard drive partitions. if (EfiDevicePathType(node) == MEDIA_DEVICE_PATH) { if (node->SubType == MEDIA_FILEPATH_DP) { for (int i = 0; i < EfiDevicePathNodeLength(node); i += 2) { // Strip UTF16 characters to UTF8. path += (((char*)(node)) + sizeof(EFI_DEVICE_PATH_PROTOCOL))[i]; } } else if (node->SubType == MEDIA_HARDDRIVE_DP) { // Extract the device UUID to later join with block devices. auto uuid = ((const HARDDRIVE_DEVICE_PATH*)node)->Signature; // clang-format off boost::uuids::uuid hdd_signature = {{ uuid[3], uuid[2], uuid[1], uuid[0], uuid[5], uuid[4], uuid[7], uuid[6], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15], }}; // clang-format on path += boost::to_upper_copy(boost::uuids::to_string(hdd_signature)); } } search_offset += EfiDevicePathNodeLength(node); } return path; } QueryData genKernelInfo(QueryContext& context) { QueryData results; mach_port_t master_port; auto kr = IOMasterPort(bootstrap_port, &master_port); if (kr != KERN_SUCCESS) { VLOG(1) << "Could not get the IOMaster port"; return {}; } // NVRAM registry entry is :/options. auto chosen = IORegistryEntryFromPath(master_port, kIODTChosenPath_); if (chosen == 0) { VLOG(1) << "Could not get IOKit boot device"; return {}; } // Parse the boot arguments, usually none. CFMutableDictionaryRef properties; kr = IORegistryEntryCreateCFProperties( chosen, &properties, kCFAllocatorDefault, 0); IOObjectRelease(chosen); if (kr != KERN_SUCCESS) { VLOG(1) << "Could not get IOKit boot device properties"; return {}; } Row r; CFTypeRef property; if (CFDictionaryGetValueIfPresent( properties, CFSTR("boot-args"), &property)) { r["arguments"] = stringFromCFData((CFDataRef)property); } if (CFDictionaryGetValueIfPresent( properties, CFSTR("boot-device-path"), &property)) { r["device"] = getCanonicalEfiDevicePath((CFDataRef)property); } if (CFDictionaryGetValueIfPresent( properties, CFSTR("boot-file"), &property)) { r["path"] = stringFromCFData((CFDataRef)property); std::replace(r["path"].begin(), r["path"].end(), '\\', '/'); boost::trim(r["path"]); if (!r["path"].empty() && r["path"][0] != '/') { r["path"] = "/" + r["path"]; } } // No longer need chosen properties. CFRelease(properties); // The kernel version, signature, and build information is stored in Root. auto root = IORegistryGetRootEntry(master_port); if (root != 0) { property = (CFDataRef)IORegistryEntryCreateCFProperty( root, CFSTR(kIOKitBuildVersionKey), kCFAllocatorDefault, 0); if (property != nullptr) { // The version is in the form: // Darwin Kernel Version VERSION: DATE; root:BUILD/TAG auto signature = stringFromCFString((CFStringRef)property); CFRelease(property); r["version"] = signature.substr(22, signature.find(':') - 22); } } results.push_back(r); return results; } } }
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache license, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the license for the specific language governing permissions and * limitations under the license. */ package org.apache.logging.slf4j; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.MarkerManager; import org.apache.logging.log4j.status.StatusLogger; import org.slf4j.IMarkerFactory; import org.slf4j.Marker; /** * Log4j/SLF4J bridge to create SLF4J Markers based on name or based on existing SLF4J Markers. */ public class Log4jMarkerFactory implements IMarkerFactory { private static final Logger LOGGER = StatusLogger.getLogger(); private final ConcurrentMap<String, Marker> markerMap = new ConcurrentHashMap<>(); /** * Returns a Log4j Marker that is compatible with SLF4J. * @param name The name of the Marker. * @return A Marker. */ @Override public Marker getMarker(final String name) { if (name == null) { throw new IllegalArgumentException("Marker name must not be null"); } final Marker marker = markerMap.get(name); if (marker != null) { return marker; } final org.apache.logging.log4j.Marker log4jMarker = MarkerManager.getMarker(name); return addMarkerIfAbsent(name, log4jMarker); } private Marker addMarkerIfAbsent(final String name, final org.apache.logging.log4j.Marker log4jMarker) { final Marker marker = new Log4jMarker(this, log4jMarker); final Marker existing = markerMap.putIfAbsent(name, marker); return existing == null ? marker : existing; } /** * Returns a Log4j Marker converted from an existing custom SLF4J Marker. * @param marker The SLF4J Marker to convert. * @return A converted Log4j/SLF4J Marker. * @since 2.1 */ public Marker getMarker(final Marker marker) { if (marker == null) { throw new IllegalArgumentException("Marker must not be null"); } final Marker m = markerMap.get(marker.getName()); if (m != null) { return m; } return addMarkerIfAbsent(marker.getName(), convertMarker(marker)); } private static org.apache.logging.log4j.Marker convertMarker(final Marker original) { if (original == null) { throw new IllegalArgumentException("Marker must not be null"); } return convertMarker(original, new ArrayList<Marker>()); } private static org.apache.logging.log4j.Marker convertMarker(final Marker original, final Collection<Marker> visited) { final org.apache.logging.log4j.Marker marker = MarkerManager.getMarker(original.getName()); if (original.hasReferences()) { final Iterator<Marker> it = original.iterator(); while (it.hasNext()) { final Marker next = it.next(); if (visited.contains(next)) { LOGGER.warn("Found a cycle in Marker [{}]. Cycle will be broken.", next.getName()); } else { visited.add(next); marker.addParents(convertMarker(next, visited)); } } } return marker; } /** * Returns true if the Marker exists. * @param name The Marker name. * @return {@code true} if the Marker exists, {@code false} otherwise. */ @Override public boolean exists(final String name) { return markerMap.containsKey(name); } /** * Log4j does not support detached Markers. This method always returns false. * @param name The Marker name. * @return {@code false} */ @Override public boolean detachMarker(final String name) { return false; } /** * Log4j does not support detached Markers for performance reasons. The returned Marker is attached. * @param name The Marker name. * @return The named Marker (unmodified). */ @Override public Marker getDetachedMarker(final String name) { LOGGER.warn("Log4j does not support detached Markers. Returned Marker [{}] will be unchanged.", name); return getMarker(name); } }
{ "pile_set_name": "Github" }
#include <iostream> #include <math.h> /* * The code below calculates N-th fibonacci number by O(1) * Such speed is achieved by using the Binet's formula which is * fib(n) = (phi^n - psi^n) / sqrt(5) * where * phi = (1 + sqrt(5)) / 2 and psi = (1 - sqrt(5)) / 2 * But in code we compute fib(n) as * fib(n) = round(phi^n) / sqrt(5) * because when n -> inf: abs(psi^n) -> 0 * When n is small this formula is innacurate because * we are computing in double and float and they aren't the exact values that we have in Math * Because of the same reasons we may have slightly innacurate values with small n. */ long fib(long n) { double phi = (1 + sqrt(5)) / 2; return round(pow(phi, n)) / sqrt(5); } int main() { long n = 50; std::cout << fib(n); }
{ "pile_set_name": "Github" }
# # (C) Copyright 2018 Rockchip Electronics Co., Ltd. # # SPDX-License-Identifier: GPL-2.0+ # obj-y += rk1808.o obj-y += syscon_rk1808.o obj-y += clk_rk1808.o
{ "pile_set_name": "Github" }
#ifndef WM8766_H_INCLUDED #define WM8766_H_INCLUDED #define WM8766_LDA1 0x00 #define WM8766_RDA1 0x01 #define WM8766_DAC_CTRL 0x02 #define WM8766_INT_CTRL 0x03 #define WM8766_LDA2 0x04 #define WM8766_RDA2 0x05 #define WM8766_LDA3 0x06 #define WM8766_RDA3 0x07 #define WM8766_MASTDA 0x08 #define WM8766_DAC_CTRL2 0x09 #define WM8766_DAC_CTRL3 0x0a #define WM8766_MUTE1 0x0c #define WM8766_MUTE2 0x0f #define WM8766_RESET 0x1f /* LDAx/RDAx/MASTDA */ #define WM8766_ATT_MASK 0x0ff #define WM8766_UPDATE 0x100 /* DAC_CTRL */ #define WM8766_MUTEALL 0x001 #define WM8766_DEEMPALL 0x002 #define WM8766_PWDN 0x004 #define WM8766_ATC 0x008 #define WM8766_IZD 0x010 #define WM8766_PL_LEFT_MASK 0x060 #define WM8766_PL_LEFT_MUTE 0x000 #define WM8766_PL_LEFT_LEFT 0x020 #define WM8766_PL_LEFT_RIGHT 0x040 #define WM8766_PL_LEFT_LRMIX 0x060 #define WM8766_PL_RIGHT_MASK 0x180 #define WM8766_PL_RIGHT_MUTE 0x000 #define WM8766_PL_RIGHT_LEFT 0x080 #define WM8766_PL_RIGHT_RIGHT 0x100 #define WM8766_PL_RIGHT_LRMIX 0x180 /* INT_CTRL */ #define WM8766_FMT_MASK 0x003 #define WM8766_FMT_RJUST 0x000 #define WM8766_FMT_LJUST 0x001 #define WM8766_FMT_I2S 0x002 #define WM8766_FMT_DSP 0x003 #define WM8766_LRP 0x004 #define WM8766_BCP 0x008 #define WM8766_IWL_MASK 0x030 #define WM8766_IWL_16 0x000 #define WM8766_IWL_20 0x010 #define WM8766_IWL_24 0x020 #define WM8766_IWL_32 0x030 #define WM8766_PHASE_MASK 0x1c0 /* DAC_CTRL2 */ #define WM8766_ZCD 0x001 #define WM8766_DZFM_MASK 0x006 #define WM8766_DMUTE_MASK 0x038 #define WM8766_DEEMP_MASK 0x1c0 /* DAC_CTRL3 */ #define WM8766_DACPD_MASK 0x00e #define WM8766_PWRDNALL 0x010 #define WM8766_MS 0x020 #define WM8766_RATE_MASK 0x1c0 #define WM8766_RATE_128 0x000 #define WM8766_RATE_192 0x040 #define WM8766_RATE_256 0x080 #define WM8766_RATE_384 0x0c0 #define WM8766_RATE_512 0x100 #define WM8766_RATE_768 0x140 /* MUTE1 */ #define WM8766_MPD1 0x040 /* MUTE2 */ #define WM8766_MPD2 0x020 #endif
{ "pile_set_name": "Github" }
package com.company.shop.sys.service.modules.sys.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.company.shop.sys.service.common.constant.BusinessConstant; import com.company.shop.sys.service.common.vo.SignConfigVo; import com.company.shop.sys.service.modules.sys.entity.SignConfigEntity; import com.company.shop.sys.service.modules.sys.mapper.SignConfigMapper; import com.company.shop.sys.service.modules.sys.service.ISignConfigService; import com.company.shop.sys.service.utils.RedisCacheUtils; import com.company.shop.sys.service.utils.RedisKeyUtils; import org.apache.http.util.TextUtils; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; @Service("signConfigService") public class SignConfigServiceImpl extends ServiceImpl<SignConfigMapper, SignConfigEntity> implements ISignConfigService { @Override public SignConfigEntity getStep(int day) { return baseMapper.getStep(day); } @Override public List<SignConfigEntity> getSignConfig() { SignConfigVo stepConfigVo = (SignConfigVo) RedisCacheUtils.getRedisCacheManager().get(RedisKeyUtils.getSignConfigKey()); if (null == stepConfigVo) { List<SignConfigEntity> list = baseMapper.getSignConfiguration();//fixme 存redis if (list.size() > BusinessConstant.Home.ZERO) { stepConfigVo = new SignConfigVo(); stepConfigVo.setList(list); RedisCacheUtils.getRedisCacheManager().set(RedisKeyUtils.getSignConfigKey(), stepConfigVo, BusinessConstant.Redis.EXPIRE_TIME_REDIS_1800);//半小时 return list; } return null; } return stepConfigVo.getList(); } @Override public boolean updateSignConfig(JSONObject json) { Integer award = json.getIntValue("award"); String description = json.getString("description"); Integer category = json.getIntValue("category"); Integer day = json.getIntValue("day"); if (null == award || null == day) { return false; } SignConfigEntity signConfigEntity = this.getStep(day); if (null == signConfigEntity) { signConfigEntity = new SignConfigEntity(); signConfigEntity.setCreate_by(BusinessConstant.Common.company_ADMIN); signConfigEntity.setCreate_date(new Date()); signConfigEntity.setCountDay(day); signConfigEntity.setDescription(description); signConfigEntity.setStep(award); return insertOrUpdate(signConfigEntity); } else { signConfigEntity.setUpdate_by(BusinessConstant.Common.company_ADMIN); signConfigEntity.setUpdate_date(new Date()); if (null != category) { signConfigEntity.setCategory(category); } if (null != day) { signConfigEntity.setCountDay(day); } if (null != award) { signConfigEntity.setStep(award); } if (!TextUtils.isEmpty(description)) { signConfigEntity.setDescription(description); } return insertOrUpdate(signConfigEntity); } } }
{ "pile_set_name": "Github" }
/* * Copyright 2019 New Vector Ltd * Copyright 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.matrix.android.sdk.internal.session.filter internal interface FilterRepository { /** * Return true if the filterBody has changed, or need to be sent to the server */ suspend fun storeFilter(filter: Filter, roomEventFilter: RoomEventFilter): Boolean /** * Set the filterId of this filter */ suspend fun storeFilterId(filter: Filter, filterId: String) /** * Return filter json or filter id */ suspend fun getFilter(): String /** * Return the room filter */ suspend fun getRoomFilter(): String }
{ "pile_set_name": "Github" }
apiVersion: image.openshift.io/v1 kind: ImageStreamTag metadata: name: node:v3.11 namespace: openshift-node tag: reference: true from: kind: DockerImage name: openshift/node:v3.11.0
{ "pile_set_name": "Github" }
// Copyright (c) 2009-2011, Tor M. Aamodt, Ali Bakhoda, Ivan Sham, // Wilson W.L. Fung // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. Neither the name of // The University of British Columbia nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #include "stack.h" #include <assert.h> #include <stdlib.h> void push_stack(Stack *S, address_type val) { assert(S->top < S->max_size); S->v[S->top] = val; (S->top)++; } address_type pop_stack(Stack *S) { (S->top)--; return (S->v[S->top]); } address_type top_stack(Stack *S) { assert(S->top >= 1); return (S->v[S->top - 1]); } Stack *new_stack(int size) { Stack *S; S = (Stack *)malloc(sizeof(Stack)); S->max_size = size; S->top = 0; S->v = (address_type *)calloc(size, sizeof(address_type)); return S; } void free_stack(Stack *S) { free(S->v); free(S); } int size_stack(Stack *S) { return S->top; } int full_stack(Stack *S) { return S->top >= S->max_size; } int empty_stack(Stack *S) { return S->top == 0; } int element_exist_stack(Stack *S, address_type value) { int i; for (i = 0; i < S->top; ++i) { if (value == S->v[i]) { return 1; } } return 0; } void reset_stack(Stack *S) { S->top = 0; }
{ "pile_set_name": "Github" }
package com.shiroexploit.gui; import com.shiroexploit.task.TestConnectionTask; import com.shiroexploit.util.*; import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.Stage; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; import org.controlsfx.control.CheckComboBox; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; public class StartPane extends Application { private static final int HEIGHT = 35; private Config config = Config.getInstance(); private BorderPane borderPane = new BorderPane(); private BorderPane simpleRequestSubpane = new BorderPane(); private BorderPane complexRequestSubpane = new BorderPane(); private ComboBox<String> comboBox = new ComboBox<>(); private CheckBox complexHttpRequest = new CheckBox("复杂Http请求"); private CheckBox useHttps = new CheckBox("使用Https"); private CheckBox specifyKeyAndGadget = new CheckBox("指定Key/Gadget/EchoType"); private CheckBox useBigKeyFile = new CheckBox("使用 keys.conf.big"); private TextField urlTextField = new TextField(); private TextArea cookieField = new TextArea(); private TextArea requestBodyField = new TextArea(); private Button next = new Button("下一步"); private CheckComboBox<String> keyComboBox = new CheckComboBox<>(); private Button cleanKeySelection = new Button("重置"); private CheckComboBox<String> gadgetComboBox = new CheckComboBox<>(); private Button cleanGadgetSelection = new Button("重置"); private CheckComboBox<String> echoTypeComboBox = new CheckComboBox<>(); private Button cleanEchoTypeSelection = new Button("重置"); public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { Pane borderPane = new StartPane().getPane(); primaryStage.setTitle("Shiro550/721漏洞检测 v2.5 Final by飞鸿"); primaryStage.setScene(new Scene(borderPane, 800, 700)); primaryStage.show(); // //测试 // MainPane pane = new MainPane(); // primaryStage.setTitle("Shiro550/721漏洞检测 by飞鸿"); // primaryStage.setScene(new Scene(pane.getPane(), 800,600)); // primaryStage.show(); } public StartPane(){ drawPane(); addListeners(); } public Pane getPane() { return borderPane; } private void drawPane(){ borderPane.setPadding(new Insets(10,10,10,10)); Label label = new Label("选择要验证的漏洞类型"); List<String> data = new ArrayList<>(); data.add("Shiro550"); data.add("Shiro721"); comboBox.setItems(FXCollections.observableArrayList(data)); comboBox.setPrefHeight(HEIGHT); comboBox.setPrefWidth(150); comboBox.getSelectionModel().select(0); GridPane leftGridPane = new GridPane(); leftGridPane.setAlignment(Pos.CENTER_LEFT); leftGridPane.setHgap(20); leftGridPane.setVgap(10); leftGridPane.setPadding(new Insets(10,10,10,10)); useHttps.setDisable(true); leftGridPane.add(label, 0,0); leftGridPane.add(comboBox,1,0); leftGridPane.setColumnSpan(complexHttpRequest, 2); leftGridPane.add(complexHttpRequest,0,1); leftGridPane.setColumnSpan(useHttps, 2); leftGridPane.add(useHttps, 0, 2); leftGridPane.setColumnSpan(useBigKeyFile, 2); leftGridPane.add(useBigKeyFile, 0,3); leftGridPane.setColumnSpan(specifyKeyAndGadget, 2); leftGridPane.add(specifyKeyAndGadget, 0, 4); keyComboBox.getItems().addAll(FXCollections.observableArrayList(config.getKeys())); keyComboBox.setTitle("指定Key"); keyComboBox.setPrefWidth(280); keyComboBox.setDisable(true); gadgetComboBox.getItems().addAll(Tools.getPayloadNames()); gadgetComboBox.setTitle("指定Gadget"); gadgetComboBox.setDisable(true); gadgetComboBox.setPrefWidth(280); echoTypeComboBox.getItems().addAll(Tools.getEchoTypes()); echoTypeComboBox.setTitle("指定回显方式"); echoTypeComboBox.setDisable(true); echoTypeComboBox.setPrefWidth(280); cleanKeySelection.setDisable(true); cleanGadgetSelection.setDisable(true); cleanEchoTypeSelection.setDisable(true); GridPane rightGridPane = new GridPane(); rightGridPane.setAlignment(Pos.CENTER_RIGHT); rightGridPane.setPadding(new Insets(10,10,10,10)); rightGridPane.setHgap(20); rightGridPane.setVgap(10); rightGridPane.setPadding(new Insets(10,0,10,0)); rightGridPane.add(keyComboBox, 0, 1); rightGridPane.add(cleanKeySelection, 1,1); rightGridPane.add(gadgetComboBox, 0,2); rightGridPane.add(cleanGadgetSelection, 1,2); rightGridPane.add(echoTypeComboBox, 0,3); rightGridPane.add(cleanEchoTypeSelection, 1, 3); HBox topPane = new HBox(); topPane.setSpacing(40); topPane.getChildren().addAll(leftGridPane, rightGridPane); urlTextField.setPrefHeight(35); urlTextField.setPromptText("目标地址"); cookieField.setPrefHeight(300); cookieField.setWrapText(true); cookieField.setPromptText("rememberMe=dGhpcyBpcyBhIGRlbW9uc3RyYXRpb24gc3RyaW5nCg=="); cookieField.setDisable(true); simpleRequestSubpane.setPadding(new Insets(10,10,10,10)); simpleRequestSubpane.setTop(urlTextField); simpleRequestSubpane.setMargin(urlTextField, new Insets(0,0,20,0)); simpleRequestSubpane.setCenter(cookieField); requestBodyField.setPrefHeight(350); requestBodyField.setWrapText(true); requestBodyField.setPromptText("POST /someurl HTTP/1.1\r\n" + "Host: passport.zhaopin.com\r\n" + "Connection: close\r\n" + "Accept: application/json, text/javascript, */*; q=0.01\r\n" + "Accept-Encoding: gzip, deflate\r\n" + "Accept-Language: zh-CN,zh;q=0.9\r\n" + "Cookie: x-zp-client-id=bea678e6-7fa8-4cfd-8d23-5d98f8876702; rememberMe=dGhpcyBpcyBhIGRlbW9uc3RyYXRpb24gc3RyaW5nCg==\r\n\r\n" + "param1=value1&param2=value2\r\n\r\n"); complexRequestSubpane.setPadding(new Insets(10,10,10,10)); complexRequestSubpane.setCenter(requestBodyField); borderPane.setTop(topPane); borderPane.setCenter(simpleRequestSubpane); HBox hbox = new HBox(); hbox.getChildren().add(this.next); hbox.setAlignment(Pos.CENTER); borderPane.setBottom(hbox); borderPane.setMargin(hbox, new Insets(10,0,10,0)); } private void addListeners(){ comboBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if(newValue.equalsIgnoreCase("shiro721")){ cookieField.setDisable(false); } if(newValue.equalsIgnoreCase("shiro550")){ cookieField.setDisable(true); } } }); complexHttpRequest.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if(newValue == true){ borderPane.setCenter(complexRequestSubpane); useHttps.setDisable(false); }else{ borderPane.setCenter(simpleRequestSubpane); useHttps.setSelected(false); useHttps.setDisable(true); } } }); useBigKeyFile.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if(newValue == true){ config.setKeys(ConfigReader.loadKeys(1)); keyComboBox.setTitle("指定Key"); }else{ config.setKeys(ConfigReader.loadKeys(0)); keyComboBox.setTitle("指定Key"); } keyComboBox.getItems().clear(); keyComboBox.getItems().addAll(config.getKeys()); } }); specifyKeyAndGadget.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if(newValue == true){ keyComboBox.setDisable(false); gadgetComboBox.setDisable(false); echoTypeComboBox.setDisable(false); cleanKeySelection.setDisable(false); cleanGadgetSelection.setDisable(false); cleanEchoTypeSelection.setDisable(false); }else{ keyComboBox.setDisable(true); gadgetComboBox.setDisable(true); echoTypeComboBox.setDisable(true); cleanKeySelection.setDisable(true); cleanGadgetSelection.setDisable(true); cleanEchoTypeSelection.setDisable(true); } } }); cleanKeySelection.setOnAction(event -> { keyComboBox.getCheckModel().clearChecks(); }); cleanGadgetSelection.setOnAction(event -> { gadgetComboBox.getCheckModel().clearChecks(); }); cleanEchoTypeSelection.setOnAction(event -> { echoTypeComboBox.getCheckModel().clearChecks(); }); next.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { config.setVulType(comboBox.getSelectionModel().getSelectedIndex()); if(specifyKeyAndGadget.isSelected()){ ObservableList<String> selected = keyComboBox.getCheckModel().getCheckedItems(); if(selected.size() != 0){ config.setKeys(selected); } selected = gadgetComboBox.getCheckModel().getCheckedItems(); if(selected.size() != 0){ List<PayloadType> list = new ArrayList<>(); for(String str : selected){ list.add(PayloadType.valueOf(str)); } config.setGadgets(list); } selected = echoTypeComboBox.getCheckModel().getCheckedItems(); if(selected.size() != 0){ List<EchoType> list = new ArrayList<>(); for(String str : selected){ list.add(EchoType.valueOf(str)); } config.setEchoTypes(list); } } Stage currentStage = (Stage)borderPane.getScene().getWindow(); if(!complexHttpRequest.isSelected()){ String url = urlTextField.getText(); url = url != null ? url.trim() : null; String cookie = cookieField.getText(); cookie = cookie != null ? cookie.trim() : null; boolean bool = validateURL(url); if(comboBox.getSelectionModel().getSelectedIndex() == 1){ bool = bool && validateCookie(url, cookie); } if(bool) { HttpRequestInfo httpRequestInfo = new HttpRequestInfo(); httpRequestInfo.setRequestMethod("GET"); httpRequestInfo.setRequestURL(url); if(config.getVulType() == 1) httpRequestInfo.setRememberMeCookie(Hex.encodeHexString(Base64.decodeBase64(cookie.split("=",2)[1]))); config.setRequestInfo(httpRequestInfo); final TestConnectionTask task = new TestConnectionTask(httpRequestInfo); task.valueProperty().addListener(new ChangeListener<Integer>() { @Override public void changed(ObservableValue<? extends Integer> observable, Integer oldValue, Integer newValue) { if(task.getStatus() == 1){ nextStage(); } if(task.getStatus() == -1){ PromptMessageUI.getAlert("目标地址无法访问","您输入的 URL 无法正常访问"); } } }); PenddingUI penddingUI = new PenddingUI(task, currentStage); penddingUI.activateProgressBar(); } }else{ String requestBody = requestBodyField.getText(); HttpRequestInfo httpRequestInfo = new HttpRequestInfo(); if(requestBody == null || requestBody.trim().equals("")){ PromptMessageUI.getAlert("HTTP请求不能为空","请输入一个有效的HTTP请求"); return; } try{ httpRequestInfo.parse(requestBody, useHttps.isSelected()); }catch (Exception e){ PromptMessageUI.getAlert("HTTP请求格式不正确","请输入一个格式正确的HTTP请求"); return; } if(comboBox.getSelectionModel().getSelectedIndex() == 1){ if(httpRequestInfo.getRememberMeCookie() == null){ PromptMessageUI.getAlert("缺失有效的rememberMe Cookie","未提供rememberMe Cookie或者提供的remeberMe Cookie格式不正确"); return; } } config.setRequestInfo(httpRequestInfo); final TestConnectionTask task = new TestConnectionTask(httpRequestInfo); task.valueProperty().addListener(new ChangeListener<Integer>() { @Override public void changed(ObservableValue<? extends Integer> observable, Integer oldValue, Integer newValue) { if(task.getStatus() == 1){ nextStage(); } if(task.getStatus() == -1){ PromptMessageUI.getAlert("目标地址无法访问","您输入的 Http 请求解析后无法正常访问"); } } }); PenddingUI penddingUI = new PenddingUI(task, currentStage); penddingUI.activateProgressBar(); } } }); } private void nextStage() { Stage newStage = new Stage(); ConfigPane configPane = new ConfigPane(StartPane.this); Pane next = configPane.getPane(); newStage.setTitle(Config.getInstance().getRequestInfo().getRequestURL()); newStage.setScene(new Scene(next, 550, 500)); Stage currentStage = (Stage) borderPane.getScene().getWindow(); currentStage.hide(); newStage.show(); } private boolean validateURL(String url){ if(url == null || url.trim().equals("")){ PromptMessageUI.getAlert("URL不能为空","请输入一个有效的URL"); return false; } if(!url.startsWith("http://") && !url.startsWith("https://")){ PromptMessageUI.getAlert("URL格式不正确","请输入完整的URL,包括http(s)前缀"); return false; } try{ URL u = new URL(url); } catch (MalformedURLException e) { PromptMessageUI.getAlert("URL格式不正确","请输入正确格式的URL"); return false; } return true; } private boolean validateCookie(String url, String cookie){ if(cookie == null || cookie.trim().equals("")){ PromptMessageUI.getAlert("Cookie不能为空","请输入一个有效的rememberMe Cookie"); return false; } if(!cookie.startsWith(config.getRememberMeCookieName() + "=")){ PromptMessageUI.getAlert("cookie格式不正确","请输入正确格式的rememberMe cookie"); return false; } return true; } }
{ "pile_set_name": "Github" }